Skip to content

v0.9.1

Choose a tag to compare

@pyk pyk released this 07 Aug 12:27
· 228 commits to main since this release
ac3c09d

Added

  • vm.getEnv cheatcode to read environment variables as strings:

    function getEnv(string calldata key) external returns (string memory value);
    function getEnv(string calldata key, string calldata defaultValue)
        external
        returns (string memory value);

    The single-argument form reverts when the key is missing:

    Failed to get environment variable FOO as type string: environment variable not found
    

    The two-argument form returns defaultValue when the key is missing.

  • Automatic .env loading from the project directory (defaults to the current
    working directory). Values are available to vm.getEnv. Existing process
    environment variables take precedence over .env.

  • vm.fork cheatcode to create or select a remote chain fork:

    struct ForkConfig {
        uint32 retries;
        uint64 backoffMs;
        uint64 timeoutMs;
        uint64 rateLimit;
    }
    
    function fork(string calldata url, uint256 blockNumber) external;
    function fork(string calldata url, uint256 blockNumber, ForkConfig config)
        external;

    Campaigns always start as an empty sandbox. Call vm.fork in setup or
    action modifiers to opt into remote state. Multiple forks are cached and
    selected by (url, block). Local accounts (harness, deployer, vm.addr
    results) persist across switches. Remote state is isolated per fork, so the
    same address on two chains (e.g. a bridge on Ethereum and Polygon) keeps
    independent storage and balances. Coverage is keyed by bytecode hash, not
    address. Single-arg vm.fork defaults: retries 3, backoff 100ms, timeout
    30s, no rate limit (same as the former CLI defaults).

Changed

  • RVM address is now derived from keccak256("ripfuzz cheatcode") instead of
    Foundry's hevm cheat code:

    // before (Foundry HEVM)
    0x7109709ECfa91a80626fF3989D68f67F5b1DD12D
    
    // after
    0x628dC59F11F72B611132eC40437F125ba1312F08
    

    Harnesses must point rvm at the new address (ripfuzz-std Harness already
    does this).

  • ripfuzz run <HARNESS> accepts a bare harness name (Harness) or a full
    artifact id (src/Harness.sol:Harness). When multiple contracts share the
    same name, the command lists the matching full ids to choose from

  • Upgraded solc dependency to v0.0.14

  • Campaign directory IDs include seconds
    (.ripfuzz/campaigns/YYYY-MM-DD-HHMMSS-<uuid>/) so campaigns started in the
    same minute are easier to tell apart

  • Fork mode is driven entirely by vm.fork in the harness. CLI flags
    --rpc-url, --rpc-block, --rpc-retries, --rpc-backoff,
    --rpc-timeout, and --rpc-rate-limit are removed. Single-arg
    vm.fork(url, block) uses built-in defaults (retries 3, backoff 100ms,
    timeout 30s, no rate limit). Override via vm.fork(url, block, ForkConfig)

  • Removed the library helper Chain::fork_with_transport. Tests and campaigns
    create an empty sandbox and opt into remote state with vm.fork only.

  • Removed the startup log for spawning the test chain (including empty-sandbox
    chain id, EVM version, block number, and timestamp). Empty vs fork is decided
    at runtime by vm.fork, so those defaults were misleading

Fixed

  • vm.fork now applies the forked block's EVM SpecId (and matching mainnet
    gas params) to the active chain config. Previously only the former
    Chain::fork path did this, so harnesses that called vm.fork kept the
    empty-sandbox hardfork instead of the remote chain's hardfork at that height
    (opcodes, gas schedule, and blob base-fee fraction).

  • Traces now surface calls to empty accounts clearly. A successful call with no
    bytecode shows ← [stop] (no code), and a parent empty revert that follows
    such a call decodes as no contract code at <address> instead of plain
    reverted. This makes --fail-on-revert failures actionable when a harness
    hits remote addresses without rvm.fork.