@@ -2,6 +2,7 @@ package relayerset
22
33import (
44 "context"
5+ "errors"
56 "fmt"
67
78 "google.golang.org/grpc"
@@ -100,6 +101,9 @@ func (s *Server) GetTransactionFee(ctx context.Context, request *evmpb.GetTransa
100101 if err != nil {
101102 return nil , err
102103 }
104+ if reply == nil {
105+ return nil , errors .New ("reply is nil" )
106+ }
103107
104108 return & evmpb.GetTransactionFeeReply {TransactionFee : valuespb .NewBigIntFromInt (reply .TransactionFee )}, nil
105109}
@@ -401,19 +405,22 @@ func (s *Server) SubmitTransaction(ctx context.Context, request *evmpb.SubmitTra
401405 return nil , err
402406 }
403407
404- txResult , err := evmService .SubmitTransaction (ctx , evm.SubmitTransactionRequest {
408+ reply , err := evmService .SubmitTransaction (ctx , evm.SubmitTransactionRequest {
405409 To : evm .Address (request .To ),
406410 Data : evm .ABIPayload (request .Data ),
407411 GasConfig : evmpb .ConvertGasConfigFromProto (request .GetGasConfig ()),
408412 })
409413 if err != nil {
410414 return nil , err
411415 }
416+ if reply == nil {
417+ return nil , fmt .Errorf ("txResult is nil" )
418+ }
412419
413420 return & evmpb.SubmitTransactionReply {
414- TxHash : txResult .TxHash [:],
415- TxStatus : evmpb .ConvertTxStatusToProto (txResult .TxStatus ),
416- TxIdempotencyKey : txResult .TxIdempotencyKey ,
421+ TxHash : reply .TxHash [:],
422+ TxStatus : evmpb .ConvertTxStatusToProto (reply .TxStatus ),
423+ TxIdempotencyKey : reply .TxIdempotencyKey ,
417424 }, nil
418425}
419426
@@ -423,16 +430,19 @@ func (s *Server) CalculateTransactionFee(ctx context.Context, request *evmpb.Cal
423430 return nil , err
424431 }
425432
426- fee , err := evmService .CalculateTransactionFee (ctx , evm.ReceiptGasInfo {
433+ reply , err := evmService .CalculateTransactionFee (ctx , evm.ReceiptGasInfo {
427434 GasUsed : request .GasInfo .GasUsed ,
428435 EffectiveGasPrice : valuespb .NewIntFromBigInt (request .GasInfo .EffectiveGasPrice ),
429436 })
430437 if err != nil {
431438 return nil , err
432439 }
440+ if reply == nil {
441+ return nil , fmt .Errorf ("reply is nil" )
442+ }
433443
434444 return & evmpb.CalculateTransactionFeeReply {
435- TransactionFee : valuespb .NewBigIntFromInt (fee .TransactionFee ),
445+ TransactionFee : valuespb .NewBigIntFromInt (reply .TransactionFee ),
436446 }, nil
437447}
438448
0 commit comments