Skip to content

v1.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 24 Nov 06:14
· 62 commits to master since this release
1c57854

Foundry v1.5.0

Foundry v1.5.0 release comes with an improved fuzzer that use Solar to analyze contracts and extract interested values from AST, and incorporate updated logic to minimize counterexamples generated by invariant tests. This version adds support for browser extension wallets, provides a simpler way to interact with ERC20 tokens using cast and publishes all foundry binaries as npm packages. It also continues the effort to improve new forge formatter rolled out in previous version and makes it more customizable.

Fuzzed tests improvements

AST seeded dictionary

Foundry v1.5.0 leverages the Solar API to analyze contracts, collect all relevant AST literals from the sources, and use those values to generate inputs for the fuzzing campaign (#12015).
For example, with this addition a counterexample for the simple test below can be generated within a couple of runs:

function testHash(bytes memory v) external {
    assert(keccak256(v) != keccak256("hello"));
}

Early testers have reported substantially improved fuzzing results and we are running additional benchmarks to quantify the effectiveness.

Improved counterexample shrinking

In previous versions, counterexamples generated by invariant tests were replayed and minimized only once. In Foundry v1.5.0, the call sequence is replayed multiple times until all configured shrink runs are completed (#12180). Additionally, the counterexamples saved on disk and replayed on subsequent campaigns, are now also minimized (#12351). This allows Foundry to produce a more thoroughly minimized call sequence that can be used to generate unit tests and reproduce smart contract invariant violations.

Browser wallet integration

Foundry v1.5.0 introduces support for browser extension wallets in the cast send and cast wallet sign commands, enabling developers to sign transactions directly in the browser (#12302). Future releases will expand browser wallet support to other Foundry commands. We look forward to get external contributions to improve the interface and feature set of the browser wallet.

To try it out, pass the --browser flag to cast send to send a transaction using any of your browser wallets: cast send <TO> --value <VALUE> --rpc-url <RPC_URL> --browser

Porto send

Additionally you can sign messages and typed data with cast wallet sign: cast wallet sign --browser "Hello World!"

Porto Sign

ERC20 support in cast

This release introduces the cast erc20 command to facilitate interaction with ERC-20 tokens (#12258 #12381). This makes it simple to query balances, perform transfers, and access other ERC-20 token details.

  balance       Query ERC20 token balance [aliases: b]
  transfer      Transfer ERC20 tokens [aliases: t]
  approve       Approve ERC20 token spending [aliases: a]
  allowance     Query ERC20 token allowance [aliases: al]
  name          Query ERC20 token name [aliases: n]
  symbol        Query ERC20 token symbol [aliases: s]
  decimals      Query ERC20 token decimals [aliases: d]
  total-supply  Query ERC20 token total supply [aliases: ts]
  mint          Mint ERC20 tokens (if the token supports minting) [aliases: m]
  burn          Burn ERC20 tokens [aliases: bu]

New cheatcodes

Foundry v1.5.0 includes a set of new cheatcodes designed to improve the testing experience:

  • getEvmVersion/setEvmVersion to retrieve and change the execution EVM version within tests and scripts (#12014)
  • signWithNonce to create deterministic ECDSA signatures using a specified ephemeral nonce (#11267)
  • getStorageSlots leverage the storage layout to accurately identify the base slot of a variable (#11537)

npm packages

Continuing the work introduced in v1.4.0 for forge, v1.5.0 publishes the remaining Foundry binaries as npm packages. This allows tools such as bun, npx, pnpm to easily install and run any Foundry executable directly from the npm registry (#11945).

bun x @foundry-rs/anvil --version
npx --yes @foundry-rs/cast --version
pnpm dlx --silent @foundry-rs/chisel --version

Performance Improvements

Anvil Features

  • feat(anvil): wire eth_protocolVersion, eth_hashrate, eth_coinbase RPCs (#11934) by @sashass1315
  • perf(anvil): optimize internal data passing in log queries (#11896) by @silvekkk
  • feat(anvil): add /eth/v1/beacon/blobs beacon endpoint (#12182) by @mablr
  • feat(anvil): add debug_dbGet endpoint (#12375) by @mablr
  • perf(anvil): avoid unnecessary transaction vector cloning in Block::new (#12393) by @CreeptoGengar
  • feat(anvil): Implement alloy_evm FromRecoveredTx trait for anvil TypedTransaction (#12424) by @mablr
  • perf(anvil): avoid snapshot cloning when counting ready transactions (#12432) by @phrwlk
  • fix(anvil): set evm block number to input value (#12490) by @Syzygy106
  • feat(anvil): handle signature impersonation for EIP-7702 authorization list (#12553) by @mablr

Anvil Fixes

  • anvil: remove unused BlockNumberOrTag import in hardfork tests (#11952) by @anim001k
  • fix: use blobparams for blob fee calc (#12056) by @mattsse
  • fix(anvil): set envelope for non deposit tx in debug tracers (#12080) by @grandizzy
  • fix(anvil): eth_getAccountInfo check if predates fork inclusive (#12101) by @grandizzy
  • fix(anvil): always disable nonce check for eth_calls (#12144) by @grandizzy
  • fix(anvil): get account info from db when node block > fork block (#12175) by @grandizzy
  • fix(anvil): remove transactions before block/hash in unwind_to to prevent leaks (#12178) by @sashass1315
  • fix(anvil): preserve OP receipt fields in convert_to_anvil_receipt (#12396) by @Syzygy106
  • fix(anvil): respect configured fork initial_backoff in setup_fork_db_config (#12401) by @phrwlk
  • fix(anvil): serialize genesis time as string (#12512) by @StackOverflowExcept1on

Cast Features

Cast Fixes

Forge Features

Forge Fixes

Other

Full Changelog:

v1.4.4...v1.5.0-rc1