diff --git a/itests/eth_api_test.go b/itests/eth_api_test.go index 32949cc7163..c24b3241615 100644 --- a/itests/eth_api_test.go +++ b/itests/eth_api_test.go @@ -87,3 +87,25 @@ func TestFilecoinAddressToEthAddress(t *testing.T) { require.ErrorContains(t, err, ethtypes.ErrInvalidAddress.Error()) } + +func TestEthGetGenesis(t *testing.T) { + blockTime := 100 * time.Millisecond + client, _, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ThroughRPC()) + ens.InterconnectAll().BeginMining(blockTime) + + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + + ethBlk, err := client.EVM().EthGetBlockByNumber(ctx, "0x0", true) + require.NoError(t, err) + + genesis, err := client.ChainGetGenesis(ctx) + require.NoError(t, err) + + genesisCid, err := genesis.Key().Cid() + require.NoError(t, err) + + genesisHash, err := ethtypes.EthHashFromCid(genesisCid) + require.NoError(t, err) + require.Equal(t, ethBlk.Hash, genesisHash) +} diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index 0bdf8c14015..907adf8cd8d 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -1763,11 +1763,7 @@ func (e *ethSubscription) stop() { } func newEthBlockFromFilecoinTipSet(ctx context.Context, ts *types.TipSet, fullTxInfo bool, cs *store.ChainStore, sa StateAPI) (ethtypes.EthBlock, error) { - parent, err := cs.LoadTipSet(ctx, ts.Parents()) - if err != nil { - return ethtypes.EthBlock{}, err - } - parentKeyCid, err := parent.Key().Cid() + parentKeyCid, err := ts.Parents().Cid() if err != nil { return ethtypes.EthBlock{}, err }