forked from foundry-rs/foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cheatcodes): add deterministic random value generation with seed (…
…foundry-rs#8622) * feat(cheatcodes): add ability to set seed for `vm.randomUint()` * chore: move `vm.randomAddress` test to its own contract * feat(cheatcodes): add ability to set seed for `vm.randomAddress()` * feat: use global seed instead of introducing new cheatcodes * chore: clean up * chore: clean up tests * feat: add `fuzz.seed` as inline parameter in tests * chore: trim 0x prefix * chore: nit * test: update random tests * fix: inline parsing on fuzz seed * test: set seed and update random tests * chore: remove inline config for seed * chore: clean up * chore: clean up tests * test: remove deterministic tests from testdata * test: implement forgetest to test that forge test with a seed produces deterministic random values * test: fix tests * chore: clean up * test: remove seed * fix: clippy and forge-fmt * chore: clean up * chore: rename test contract * fix: lint * chore: move rng to state instead of creating a new one when calling `vm.random*` cheats * chore: nit * test: update tests * fix: clippy * chore: nit * chore: clean up * Update crates/cheatcodes/src/inspector.rs Co-authored-by: DaniPopes <[email protected]> * test: only check outputs are the same or different * chore: clean up * chore: nits --------- Co-authored-by: DaniPopes <[email protected]>
- Loading branch information
Showing
7 changed files
with
114 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
pragma solidity 0.8.18; | ||
|
||
import "ds-test/test.sol"; | ||
import "cheats/Vm.sol"; | ||
|
||
contract RandomAddress is DSTest { | ||
Vm constant vm = Vm(HEVM_ADDRESS); | ||
|
||
function testRandomAddress() public { | ||
vm.randomAddress(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters