pcaversaccio / createx

Factory smart contract to make easier and safer usage of the `CREATE` and `CREATE2` EVM opcodes as well as of `CREATE3`-based (i.e. without an initcode factor) contract creations.
https://createx.rocks
GNU Affero General Public License v3.0
341 stars 26 forks source link

♻️ ️Fix Fuzzing Edge Case in `NonZeroBalance` Tests #99

Closed pcaversaccio closed 7 months ago

pcaversaccio commented 7 months ago

🕓 Changelog

This PR fixes a fuzzing edge case where the fuzzed address msgSender equals arg3 and thus the test assert:

// Since everything was returned in the previous call, the balance must be equal to the original
// refund amount.
assertEq(arg3.balance, cachedBalance, "1800");

in the testFuzz_WhenTheCreateXContractHasANonZeroBalanceAndWhenTheRefundTransactionIsSuccessful tests fail.

Furthermore, I also add an additional assume condition to prevent the fuzzed address originalDeployer to have collisions with arg3 as well. Eventually, for the CREATE tests, I add an additional assume condition to prevent the test contract sender to collide with arg3.

🐶 Cute Animal Picture

image

github-actions[bot] commented 7 months ago

Coverage after merging fix/fuzzing-edge-case into main will be

100.00%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   CreateX.sol100%100%100%100%