From e7dee0531a4ba2ac211d4fee652ed48d4a828dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mi=C5=82kowski?= Date: Mon, 19 Feb 2024 18:14:59 +0100 Subject: [PATCH] Do not panic on missing tokenID erc1155 --- eth/tracers/blocknative/decoder/calldata.go | 3 ++- eth/tracers/blocknative/decoder/evm_caller.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/eth/tracers/blocknative/decoder/calldata.go b/eth/tracers/blocknative/decoder/calldata.go index b5756b47f0ba..ba44ee9f905b 100644 --- a/eth/tracers/blocknative/decoder/calldata.go +++ b/eth/tracers/blocknative/decoder/calldata.go @@ -1,9 +1,10 @@ package decoder import ( + "math/big" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "math/big" ) func decodeCallData(sender common.Address, contract *Contract, input []byte) (*CallData, error) { diff --git a/eth/tracers/blocknative/decoder/evm_caller.go b/eth/tracers/blocknative/decoder/evm_caller.go index e54c785adb78..b602c3164b7b 100644 --- a/eth/tracers/blocknative/decoder/evm_caller.go +++ b/eth/tracers/blocknative/decoder/evm_caller.go @@ -121,6 +121,10 @@ func evmCallMethodBalanceOf(evmCall evmCallFn, addr common.Address, owner common // evmCallMethodBalanceOf2 decodes the balance of an asset from the EVM. func evmCallMethodBalanceOf2(evmCall evmCallFn, addr common.Address, owner common.Address, tokenID *big.Int) (*big.Int, error) { + if tokenID == nil { + return nil, fmt.Errorf("tokenID is nil") + } + tokenIDBytes := common.LeftPadBytes(tokenID.Bytes(), 32) ownerBytes := common.LeftPadBytes(owner.Bytes(), 32) input := append(methodIDBalanceOf2, ownerBytes...)