From c5d57ab2234def7246316560ca28d1f33347caa4 Mon Sep 17 00:00:00 2001 From: ptrus Date: Thu, 31 Jul 2025 09:55:45 +0200 Subject: [PATCH] fix: Fix parsing of legacy transactions without chain ID Newer go-ethereum versions reject a zero `chainID` in `LatestSignerForChainID`. For legacy transactions without a chain ID, we now correctly pass `nil`. --- indexer/utils.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/indexer/utils.go b/indexer/utils.go index 4e8393fb..d59dfcc9 100644 --- a/indexer/utils.go +++ b/indexer/utils.go @@ -149,7 +149,14 @@ func blockToModels( for idx, ethTx := range transactions { ethTxHex := ethTx.Hash().Hex() v, r, s := ethTx.RawSignatureValues() - signer := ethtypes.LatestSignerForChainID(ethTx.ChainId()) + chainID := ethTx.ChainId() + if chainID != nil && chainID.Cmp(big.NewInt(0)) == 0 { + // Legacy transactions don't have a chain ID but `ChainId()` returns 0, which is invalid + // for `LatestSignerForChainId` which expects a null in that case (zero causes a panic). + // https://github.com/ethereum/go-ethereum/issues/31653 + chainID = nil + } + signer := ethtypes.LatestSignerForChainID(chainID) from, _ := signer.Sender(ethTx) ethAccList := ethTx.AccessList() accList := make([]model.AccessTuple, 0, len(ethAccList))