From ab91ab100f4e8523fe2703d4c416ffdf44c6a45f Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Thu, 9 Mar 2023 07:14:57 -0500 Subject: [PATCH] fix: eth API: return correct txIdx around null blocks (#10419) --- node/impl/full/eth.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index 64e16ca08..46a445aeb 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -1797,12 +1797,16 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx return ethtypes.EthBlock{}, xerrors.Errorf("failed to compute state: %w", err) } - for txIdx, msg := range compOutput.Trace { + txIdx := 0 + for _, msg := range compOutput.Trace { // skip system messages like reward application and cron if msg.Msg.From == builtintypes.SystemActorAddr { continue } + ti := ethtypes.EthUint64(txIdx) + txIdx++ + gasUsed += msg.MsgRct.GasUsed smsgCid, err := getSignedMessage(ctx, cs, msg.MsgCid) if err != nil { @@ -1813,8 +1817,6 @@ func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTx return ethtypes.EthBlock{}, xerrors.Errorf("failed to convert msg to ethTx: %w", err) } - ti := ethtypes.EthUint64(txIdx) - tx.ChainID = ethtypes.EthUint64(build.Eip155ChainId) tx.BlockHash = &blkHash tx.BlockNumber = &bn