From 5dd7a10f61e5a4562b5d95a449a66c0eec4e8617 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Sat, 14 Jan 2023 12:45:55 -0800 Subject: [PATCH] fix: check for unread params bytes in all cases --- chain/types/ethtypes/eth_transactions.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chain/types/ethtypes/eth_transactions.go b/chain/types/ethtypes/eth_transactions.go index 43419546920..ba4b14f5649 100644 --- a/chain/types/ethtypes/eth_transactions.go +++ b/chain/types/ethtypes/eth_transactions.go @@ -104,9 +104,6 @@ func EthTxArgsFromMessage(msg *types.Message) (EthTxArgs, error) { return EthTxArgs{}, xerrors.Errorf("failed to read params byte array: %w", err) } - if paramsReader.Len() != 0 { - return EthTxArgs{}, xerrors.Errorf("extra data found in params") - } if len(params) == 0 { // Otherwise, we don't get a guaranteed round-trip. return EthTxArgs{}, xerrors.Errorf("cannot invoke contracts with empty parameters from an eth-account") @@ -114,6 +111,10 @@ func EthTxArgsFromMessage(msg *types.Message) (EthTxArgs, error) { } } + if paramsReader.Len() != 0 { + return EthTxArgs{}, xerrors.Errorf("extra data found in params") + } + return EthTxArgs{ ChainID: build.Eip155ChainId, Nonce: int(msg.Nonce),