Commit d0d88e0
fix(test): cap gas when probing a fuzzed address
Both helpers that coerce a fuzzed address into a usable recipient probed
it with all remaining gas: `isErc1155Receiver` via `to.call(...)` and
`_nudgeAddressIfProblematic` via `call(gas(), ...)`.
A fuzzed address can be any contract already in state, including the
canonical CREATE2 deployer at 0x4e59b44847b379578588920cA78FbF26c0B4956C
that foundry pre-deploys. It has 69 bytes of code, so it gets probed, and
it reads whatever calldata it receives as a salt plus initcode and
attempts a CREATE2. The first probe deploys an empty contract; a second
probe with the same calldata collides, and a failed CREATE2 consumes
every bit of gas forwarded to it. Measured on this configuration: the
first call costs 32834 gas and the second costs 1040389983, the entire
budget, so the test dies with OutOfGas.
That is why raising gas_limit did not help. A larger budget is simply a
larger amount to burn; at 2^34 the failure rate did not improve.
Capping the probe at 100000 gas bounds the damage without changing any
legitimate path, since a real onERC1155Received or native transfer costs
far less. Across the conduit and zone suites with the fuzz cache cleared
between runs, this moves 15 trials from roughly a fifth to a half
failing to 15 of 15 passing.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 5d7d768 commit d0d88e0
3 files changed
Lines changed: 15 additions & 3 deletions
File tree
- test/foundry
- conduit
- zone
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1463 | 1463 | | |
1464 | 1464 | | |
1465 | 1465 | | |
1466 | | - | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
1467 | 1470 | | |
1468 | 1471 | | |
1469 | 1472 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1660 | 1660 | | |
1661 | 1661 | | |
1662 | 1662 | | |
1663 | | - | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
1664 | 1667 | | |
1665 | 1668 | | |
1666 | 1669 | | |
| |||
0 commit comments