Functions returning extra returndata unexpectedly revert #6768
Labels
A-compatibility
Area: compatibility
C-forge
Command: forge
Cmd-forge-test
Command: forge test
T-bug
Type: bug
T-to-investigate
Type: to investigate
Milestone
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (05d6062 2024-01-10T00:17:37.314532000Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
Summary
In Solidity, when decoding returndata and calldata arguments, extra data is always ignored. This behavior is the same as using
abi.decode
:However, when testing this behavior using Foundry, the transaction reverts instead of just ignoring the extra data.
A simple test in Sepolia confirms that the transaction actually goes through.
Replication
Consider the following two contracts:
When calling
callERC1271isValidSignature(address(wallet),bytes32(0),"")
inVeryCriticalContract
the transaction doesn't revert when using a testnet, but it does revert when usingforge test
as the following test confirms:Expected behavior
When running
forge test
, the result should be the same as in the specified Sepolia transaction. Such transaction was also done with forge scripting:The text was updated successfully, but these errors were encountered: