From bad41c247a51916b096b93ade2bffe21e8a5255c Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Fri, 17 Feb 2023 12:02:00 -0800 Subject: [PATCH] fix: eth: cleanup error cases 1. Return an error on gas estimation failure instead of logging. 2. Return early when processing signed messages on failure instead of continuing. --- node/impl/full/eth.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index 454b3eca538..5e18e7e77d9 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -895,7 +895,7 @@ func (a *EthModule) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (et expectedGas, err := ethGasSearch(ctx, a.Chain, a.Stmgr, a.Mpool, msg, ts) if err != nil { - log.Errorw("expected gas", "err", err) + return 0, xerrors.Errorf("gas search failed: %w", err) } return ethtypes.EthUint64(expectedGas), nil @@ -2157,11 +2157,13 @@ func (m *EthTxHashManager) ProcessSignedMessage(ctx context.Context, msg *types. ethTx, err := newEthTxFromSignedMessage(ctx, msg, m.StateAPI) if err != nil { log.Errorf("error converting filecoin message to eth tx: %s", err) + return } err = m.TransactionHashLookup.UpsertHash(ethTx.Hash, msg.Cid()) if err != nil { log.Errorf("error inserting tx mapping to db: %s", err) + return } }