huff-language / huffmate

A library of modern, hyper-optimized, and extensible Huff contracts with extensive testing and documentation built by Huff maintainers.

Home Page:https://github.com/pentagonxyz/huffmate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix: `SafeTransferLib` tests

clabby opened this issue · comments

commented

Overview

In SafeTransferLib's tests, we don't currently exclude the hardhat console or vm addresses from the non-contract tests. As pointed out in #119, this can sometimes cause the fuzz tests to fail.

Solution

Exclude the hardhat console or vm addresses from the non-contract tests. Bonus points for replacing the parameter restrictions with vm.assume so we get full advantage of all fuzz runs.

commented

This issue also affects testFuzzTransferETH(...).

Failing tests:
Encountered 1 failing test in test/utils/SafeTransferLib.t.sol:SafeTransferLibTest
[FAIL. Reason: ETHTransferFailed() Counterexample: calldata=0xb91b6ee7000000000000000000000000000000000000000000636f6e736f6c652e6c6f670000000000000000000000000000000000000000000000000000000000000492000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000a0a, args=[0x000000000000000000636F6e736F6c652e6c6f67, 1170, 0x0000000000000000000000000000000000000000000000000000000000000a0a]] testFuzzTransferETH(address,uint256,bytes) (runs: 179, μ: 41692, ~: 43294)