@@ -392,7 +392,13 @@ func (h *Handler) EmulateMessageToAccountEvent(ctx context.Context, request *oas
392
392
return nil , toError (http .StatusBadRequest , err )
393
393
}
394
394
hash , err := c .HashString ()
395
+ if err != nil {
396
+ return nil , toError (http .StatusBadRequest , err )
397
+ }
395
398
trace , _ , err := h .storage .GetTraceWithState (ctx , hash )
399
+ if err != nil {
400
+ h .logger .Warn ("get trace from storage: " , zap .Error (err ))
401
+ }
396
402
if trace == nil {
397
403
configBase64 , err := h .storage .TrimmedConfigBase64 ()
398
404
if err != nil {
@@ -418,7 +424,7 @@ func (h *Handler) EmulateMessageToAccountEvent(ctx context.Context, request *oas
418
424
if err != nil {
419
425
return nil , toError (http .StatusInternalServerError , err )
420
426
}
421
- err = h .storage .SaveTraceWithState (hash , trace , []abi.MethodInvocation {}, 24 * time .Hour )
427
+ err = h .storage .SaveTraceWithState (ctx , hash , trace , []abi.MethodInvocation {}, 24 * time .Hour )
422
428
if err != nil {
423
429
fmt .Println ("trace not saved: " , err )
424
430
}
@@ -446,8 +452,14 @@ func (h *Handler) EmulateMessageToEvent(ctx context.Context, request *oas.Emulat
446
452
}
447
453
trace , prs := h .mempoolEmulate .traces .Get (hash )
448
454
if ! prs {
449
- hs , _ := c .HashString ()
455
+ hs , err := c .HashString ()
456
+ if err != nil {
457
+ return nil , toError (http .StatusBadRequest , err )
458
+ }
450
459
trace , _ , err = h .storage .GetTraceWithState (ctx , hs )
460
+ if err != nil {
461
+ h .logger .Warn ("get trace from storage: " , zap .Error (err ))
462
+ }
451
463
if trace == nil {
452
464
var m tlb.Message
453
465
if err := tlb .Unmarshal (c , & m ); err != nil {
@@ -477,7 +489,7 @@ func (h *Handler) EmulateMessageToEvent(ctx context.Context, request *oas.Emulat
477
489
if err != nil {
478
490
return nil , toError (http .StatusInternalServerError , err )
479
491
}
480
- err = h .storage .SaveTraceWithState (hs , trace , []abi.MethodInvocation {}, 24 * time .Hour )
492
+ err = h .storage .SaveTraceWithState (ctx , hs , trace , []abi.MethodInvocation {}, 24 * time .Hour )
481
493
if err != nil {
482
494
fmt .Println ("trace not saved: " , err )
483
495
}
@@ -507,7 +519,13 @@ func (h *Handler) EmulateMessageToTrace(ctx context.Context, request *oas.Emulat
507
519
trace , prs := h .mempoolEmulate .traces .Get (hash )
508
520
if ! prs {
509
521
hs , err := c .HashString ()
522
+ if err != nil {
523
+ return nil , toError (http .StatusBadRequest , err )
524
+ }
510
525
trace , _ , err = h .storage .GetTraceWithState (ctx , hs )
526
+ if err != nil {
527
+ h .logger .Warn ("get trace from storage: " , zap .Error (err ))
528
+ }
511
529
if trace == nil {
512
530
var m tlb.Message
513
531
err = tlb .Unmarshal (c , & m )
@@ -538,7 +556,7 @@ func (h *Handler) EmulateMessageToTrace(ctx context.Context, request *oas.Emulat
538
556
if err != nil {
539
557
return nil , toError (http .StatusInternalServerError , err )
540
558
}
541
- err = h .storage .SaveTraceWithState (hs , trace , []abi.MethodInvocation {}, 24 * time .Hour )
559
+ err = h .storage .SaveTraceWithState (ctx , hs , trace , []abi.MethodInvocation {}, 24 * time .Hour )
542
560
if err != nil {
543
561
fmt .Println ("trace not saved: " , err )
544
562
}
@@ -630,7 +648,13 @@ func (h *Handler) EmulateMessageToWallet(ctx context.Context, request *oas.Emula
630
648
}
631
649
632
650
hash , err := msgCell .HashString ()
651
+ if err != nil {
652
+ return nil , toError (http .StatusBadRequest , err )
653
+ }
633
654
trace , _ , err := h .storage .GetTraceWithState (ctx , hash )
655
+ if err != nil {
656
+ h .logger .Warn ("get trace from storage: " , zap .Error (err ))
657
+ }
634
658
if trace == nil {
635
659
configBase64 , err := h .storage .TrimmedConfigBase64 ()
636
660
if err != nil {
@@ -672,7 +696,7 @@ func (h *Handler) EmulateMessageToWallet(ctx context.Context, request *oas.Emula
672
696
if err != nil {
673
697
return nil , toError (http .StatusInternalServerError , err )
674
698
}
675
- err = h .storage .SaveTraceWithState (hash , trace , []abi.MethodInvocation {}, 24 * time .Hour )
699
+ err = h .storage .SaveTraceWithState (ctx , hash , trace , []abi.MethodInvocation {}, 24 * time .Hour )
676
700
if err != nil {
677
701
fmt .Println ("trace not saved: " , err )
678
702
}
0 commit comments