Skip to content

Commit

Permalink
fix: check for unread params bytes in all cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Jan 14, 2023
1 parent cb10108 commit 99bc0aa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions chain/types/ethtypes/eth_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,17 @@ 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")
}
}
}

if paramsReader.Len() != 0 {
return EthTxArgs{}, xerrors.Errorf("extra data found in params")
}

return EthTxArgs{
ChainID: build.Eip155ChainId,
Nonce: int(msg.Nonce),
Expand Down

0 comments on commit 99bc0aa

Please sign in to comment.