Releases: foundry-rs/forge-std
Releases · foundry-rs/forge-std
v1.8.0
Featured Changes
- feat/perf: use native assertions by @klkvr in #514.
- This replaces forge-std Solidity code with native cheatcode assertions from Foundry, so should give a small performance boost.
- Assertion failures now cause tests to exit early, instead of continuing with execution.
- This also will require some visibility modifier changes to tests, as assertion methods no longer set state.
- NOTE: If you were using the
vm.expectSafeMemory
cheat, you may need to now use the newvm.stopExpectSafeMemory
cheat from #507. See #503 (comment) to learn more, h/t @clabby.
- feat(stdStorage): support packed variables by @klkvr in #505. This means
deal
now works with USDC and other variables that reply on packed storage slots.- The USDC
deal
support works out of the box. - To avoid breaking changes arbitrary packed slot support is not enabled by default, and can be enabled with
stdstore.enable_packed_slots().target(....
.
- The USDC
- feat: add TOML reading/writing cheatcodes by @zerosnacks in #518. These are analogous to their JSON equivalents.
- NOTE: This adds file specific
keyExistsJson
andkeyExistsToml
cheats. The ambiguouskeyExists
currently is an alias forkeyExistsJson
and will be deprecated.
- NOTE: This adds file specific
- feat: native string maniupulation cheatcodes of
toLowercase
,toUppercase
,trim
,replace
andsplit
from foundry-rs/foundry#6891. - feat: implement interfaces in mock tokens by @arr00 in #510.
Other Changes
- Exclude internal cheats from Vm by @klkvr in #501.
- Fix typo in
StdJson.sol
usage comments by @coopbri in #511. - feat: fraxtal mainnet/testnet rpc support by @pegahcarter in #517.
New Contributors
- @coopbri made their first contribution in #511.
- @arr00 made their first contribution in #510.
- @pegahcarter made their first contribution in #517.
- @zerosnacks made their first contribution in #518.
Full Changelog: v1.7.6...v1.8.0
v1.7.6
Featured Changes:
- New cheatcodes:
vm.dumpState
by @tynes in #499 (foundry-rs/foundry#6827)vm.signP256
cheatcode for generating P256 (i.e. secp256r1) signatures, by @wilsoncusack in #497 (foundry-rs/foundry#6797)vm.toBase64
andvm.toBase64URL
cheatcodes by @ 0xAndoroid and @DaniPopes in #499 (foundry-rs/foundry#6785 and foundry-rs/foundry#6830)
Other Changes
- fix: don't hardcode string values in Vm generator by @DaniPopes in #497
- chore: bump to v1.7.6 by @mds1 in #500
Full Changelog: v1.7.5...v1.7.6
v1.7.5
Featured Changes
vm.envOr
andvm.getLabel
are nowview
@anikaraghu in #491
Other Changes
- feat: automatically generate Vm.sol from cheatcodes.json by @DaniPopes in #487
- chore: bump to v1.7.5 by @mds1 in #492
New Contributors
- @anikaraghu made their first contribution in #491
Full Changelog: v1.7.4...v1.7.5
v1.7.4
Featured Changes
- Update
Vm.sol
with changes toAccountAccessKind
by @emo-eth in #483.- This adds
Balance
,Extcodesize
,Extcodehash
,Extcodecopy
as account access kinds
- This adds
- feat: add new snapshot cheatcodes by @mattsse in #484.
- The
vm.revertTo(snapshotId)
cheat does not automatically delete thesnapshotId
snapshot, which can lead to unbounded memory growth with lots of snapshots. Therefore,vm.revertToAndDelete(snapshotId)
,vm.deleteSnapshot(snapshotId)
, andvm.deleteSnapshots()
were added as new cheats.
- The
Other Changes
Full Changelog: v1.7.3...v1.7.4
v1.7.3
Featured Changes
- feat: add
vm.startStateDiffRecording
andvm.stopAndReturnStateDiff
cheats to record all account accesses and storage accesses, by @Inphi in #481 - feat: add
vm.computeCreateAddress
andvm.computeCreate2Address
cheats, by @qiweiii in #479- These native cheats replace the need for the
StdUtils
methods of the same now, which will now give a deprecation warning when used.
- These native cheats replace the need for the
- feat: add mock contracts for ERC20 and ERC721, by @andreivladbrg in #470
- Be aware that these use initializers instead of constructors for compatibility across Solidity versions. Therefore it's recommended to use the
deployMockERC20
anddeployMockERC721
methods inStdUtils
to deploy them.
- Be aware that these use initializers instead of constructors for compatibility across Solidity versions. Therefore it's recommended to use the
Other Changes
New Contributors
- @Inphi made their first contribution in #481
- @qiweiii made their first contribution in #479
- @andreivladbrg made their first contribution in #470
Full Changelog: v1.7.2...v1.7.3
v1.7.2
Featured Changes
- feat: add
vm.loadAllocs(string)
cheatcode by @tynes in #474. This reads in a JSON file to directly set state for many accounts at once. - feat: add
vm.eth_getLogs
andvm.rpc
cheats by @Evalir in #475. Thevm.eth_getLogs
cheat makes aneth_getLogs
RPC call and returns the result, and thevm.rpc
cheat allows arbitrary RPC calls to be made. These query the current fork URL.
Other Changes
- fix: rely less on foundry internals by @DaniPopes in #473
- fix: test naming by @totomanov in #472
- chore: bump to v1.7.2 by @mds1 in #478
New Contributors
- @totomanov made their first contribution in #472
- @tynes made their first contribution in #474
Full Changelog: v1.7.1...v1.7.2
v1.7.1
v1.7.0
Featured Changes
- chore(BREAKING CHANGE): Change
exit_code
toexitCode
by @PaulRBerg in #458- This is a breaking change for any users who use the
exit_code
variable in theFfiResult
struct1
- This is a breaking change for any users who use the
- feat: add new
vm.serializeJson
cheatcode to the Vm and to StdJson by @vdrg in #453 - feat: add
vm.unixTime
toVmSafe
interface by @Tudmotu in #465 - perf: mark
vm.parseJsonKeys
as pure by @PaulRBerg in #460
Other Changes
Full Changelog: v1.6.1...v1.7.0
-
exit_code
was recently introduced, and a sourcegraph search did not reveal many existing users of it. Because this repo usescamelCase
, it was determined this breaking change was acceptable to keep things consistent, even though this technically does not follow semver. ↩
v1.6.1
Featured Changes
- feat: add cheatcodes and standard cheats to get keys of a mapping, by @clouds56, @Evalir, and @mds1 in #448 and #449
- feat: add
targetInterface()
helpers toStdInvariant
to allow targeting interfaces by @bernard-wagner in #445 - New filesystem cheats:
- feat: add
vm.copyFile
cheatcode by @DaniPopes in #431 - feat: add
vm.exists
,vm.isFile
andvm.isDir
by @ruvaag in #441
- feat: add
- New JSON parsing cheats:
- New chains in
StdChains
:- feat: add base goerli and base chains to
StdChains
by @giuseppecrj in #437 - feat: add moonbeam.network chains to
StdChains
by @klkvr in #426
- feat: add base goerli and base chains to
- feat:: add
vm.createWallet
,vm.sign
, andvm.getNonce
forWallet
struct by @trevorgjohnson in #435 - feat: add
vm.sleep(uint)
toVmSafe
interface by @Tudmotu in #438 - feat: add
vm.tryFfi
by @jrcarlos2000 in #443
Other Changes
- fix: restore inheritance order by @ZeroEkkusu in #425
- chore(
StdCheats
): deprecate changePrank by @Evalir in #434 - fix: assumeNotForgeAddress in StdCheats.sol by @ashhanai in #430
- chore: conform test naming to style guide by @Sabnock01 in #433
- chore: make json parse cheatcodes pure by @vdrg in #447
- fix(stdStorage): wrong slot id may returned by
find()
when slot value == 1337 by @paco0x in #446
New Contributors
- @klkvr made their first contribution in #426
- @trevorgjohnson made their first contribution in #435
- @ashhanai made their first contribution in #430
- @Tudmotu made their first contribution in #438
- @giuseppecrj made their first contribution in #437
- @ruvaag made their first contribution in #441
- @jrcarlos2000 made their first contribution in #443
- @vdrg made their first contribution in #447
- @bernard-wagner made their first contribution in #445
Full Changelog: v1.6.0...v1.6.1
v1.6.0
Featured Changes
- fix(tests): conform to upcoming
expectRevert
behavior by @Evalir in #379 — Read more about the upcoming forge v1 behavior here - feat: add
CallerMode
enum andvm.readCallers
cheat by @xeno097 in #400 - feat: add
deployCodeTo
StdCheat by @ZeroEkkusu in #401 - feat: add
vm.skip(bool)
cheat by @Evalir in #410 - feat: add
checked_write_int
forint256
toStdStorage
by @0xb10ckdev in #415 - feat: add
assumeAddressIsNot
StdCheats @Sabnock01 in #407
Other Changes
- chore: remove unused import by @paco0x in #392
- fix: improve DX by @ZeroEkkusu in #398
- ci: check for warnings by @ZeroEkkusu in #403
- ci: fix indentation by @mds1 in #408
- ci: remove dup step by @ZeroEkkusu in #413
- chore: bump to v1.6.0 by @mds1 in #417
New Contributors
- @paco0x made their first contribution in #392
- @xeno097 made their first contribution in #400
- @0xb10ckdev made their first contribution in #415
Full Changelog: v1.5.6...v1.6.0