Skip to content

feat: add vm.getChain(chainAlias) #10226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 16, 2025

Conversation

redtrama
Copy link
Contributor

@redtrama redtrama commented Apr 1, 2025

Early pr to get feedback.
Closes #10198

Solution

I've tried to implement the same way StdCheats handles getChain by alias by:

  • Consulting chainId by their alias(string)
  • if it's not defined on our foundry.toml should return a default rpc
  • Default rpcs are defined into a hashMap

Once the approach is confirmed i can add getChain(chainId)

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you. please make use of alloy-chains https://github.com/alloy-rs/chains instead declaring chains again

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do without these changes, because maybe this is just alloy_chains::Chain::from_str

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When returning rpcUrl in Chain struct, as StdChain does we want to:

  1. return configured rpcUrl in foundry.toml
  2. if it's not existent on foundry.toml return a default rpcUrl

I couldn't find a feature like this in alloy-rs/chains. should i find another way or just skip this feature and just return configured rpc in env?

sorry for the delay

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @redtrama returning configured rpc sounds good, thanks

@grandizzy grandizzy added T-feature Type: feature C-forge Command: forge labels Apr 15, 2025
@grandizzy grandizzy self-requested a review April 15, 2025 11:17
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you, makes sense! @mattsse mind to have a quick look too?

@jenpaff jenpaff moved this to Ready For Review in Foundry Apr 15, 2025
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +128 to +133
// Check if this is an unknown chain ID by comparing the name to the chain ID
// When a numeric ID is passed for an unknown chain, alloy_chain.to_string() will return the ID
// So if they match, it's likely an unknown chain ID
if alloy_chain.to_string() == alloy_chain.id().to_string() {
return Err(fmt_err!("invalid chain alias: {chain_alias}"));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I see, we're actually missing a helper function for this on the chaintype, so this is a workaround

@mattsse mattsse merged commit 1da4d32 into foundry-rs:master Apr 16, 2025
22 checks passed
grandizzy pushed a commit to foundry-rs/forge-std that referenced this pull request Apr 23, 2025
- add new `vm.attachBlob(blob)` foundry-rs/foundry#10336
- add new `vm.getChain(chainAlias)` and `vm.getChain(chainId)`:
foundry-rs/foundry#10226
@zerosnacks zerosnacks mentioned this pull request Jun 5, 2025
3 tasks
0xgregthedev added a commit to phylaxsystems/phoundry that referenced this pull request Jul 9, 2025
* fix(forge): coverage for contracts with ctor with args (#10270)

* feat(forge): allow invariant contract address as targetContract (#10274)

* feat: improve uninformative error messages (#10201)

* feat: improve uninformative error messages

* Update dispatcher.rs

* Update dispatcher.rs

* Update dispatcher.rs

---------

Co-authored-by: grandizzy <[email protected]>

* fix(forge): trace identify by creation code with stripped args (#10271)

* Force `prevrandao` on Rootstock network (#10279)

fix: force prevrandao on rootstock network

* feat(abi): Implement UIfmt for DSTest console logs (#10185)

* refactor: signatures identifier, trace decoding (#10282)

* refactor: signatures identifier

* nit

* cleanup

* dedup fallback decoding

* fix

* chore: clippy

* feat: ignore non ABI calldata

* feat: skip decoding create traces

* fixes

* fixes

* chore: use CallTraceNode directly

* chore: etherscan code dedup

* chore: more filtering

* fix: add workaround for unlinked artifacts (#10291)

* fix: add workaround for unlinked artifacts

* clippy

* chore: bump upcoming version 1.1.0 (#10292)

* test: add a test case for RevertDecoder (#10294)

* chore(deps): weekly `cargo update` (#10297)

Locking 19 packages to latest compatible versions
   Unchanged alloy-chains v0.1.69 (available: v0.2.0)
   Unchanged alloy-consensus v0.12.6 (available: v0.14.0)
   Unchanged alloy-contract v0.12.6 (available: v0.14.0)
   Unchanged alloy-dyn-abi v0.8.25 (available: v1.0.0)
   Unchanged alloy-eips v0.12.6 (available: v0.14.0)
   Unchanged alloy-genesis v0.12.6 (available: v0.14.0)
   Unchanged alloy-json-abi v0.8.25 (available: v1.0.0)
   Unchanged alloy-json-rpc v0.12.6 (available: v0.14.0)
   Unchanged alloy-network v0.12.6 (available: v0.14.0)
   Unchanged alloy-primitives v0.8.25 (available: v1.0.0)
   Unchanged alloy-provider v0.12.6 (available: v0.14.0)
   Unchanged alloy-pubsub v0.12.6 (available: v0.14.0)
   Unchanged alloy-rpc-client v0.12.6 (available: v0.14.0)
   Unchanged alloy-rpc-types v0.12.6 (available: v0.14.0)
   Unchanged alloy-serde v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-aws v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-gcp v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-ledger v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-local v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-trezor v0.12.6 (available: v0.14.0)
   Unchanged alloy-sol-macro-expander v0.8.25 (available: v1.0.0)
   Unchanged alloy-sol-macro-input v0.8.25 (available: v1.0.0)
   Unchanged alloy-sol-types v0.8.25 (available: v1.0.0)
   Unchanged alloy-transport v0.12.6 (available: v0.14.0)
   Unchanged alloy-transport-http v0.12.6 (available: v0.14.0)
   Unchanged alloy-transport-ipc v0.12.6 (available: v0.14.0)
   Unchanged alloy-transport-ws v0.12.6 (available: v0.14.0)
   Unchanged alloy-trie v0.7.9 (available: v0.8.0)
    Updating auto_impl v1.2.1 -> v1.3.0
   Unchanged axum v0.7.9 (available: v0.8.3)
   Unchanged backtrace v0.3.71 (available: v0.3.74)
    Updating bon v3.5.1 -> v3.5.2
    Updating bon-macros v3.5.1 -> v3.5.2
    Updating bstr v1.11.3 -> v1.12.0
    Updating cc v1.2.18 -> v1.2.19
    Updating clap v4.5.35 -> v4.5.36
    Updating clap_builder v4.5.35 -> v4.5.36
   Unchanged crossterm v0.28.1 (available: v0.29.0)
    Updating data-encoding v2.8.0 -> v2.9.0
    Updating fs4 v0.12.0 -> v0.13.1
   Unchanged gcloud-sdk v0.26.4 (available: v0.27.0)
    Updating half v2.5.0 -> v2.6.0
    Updating jiff v0.2.5 -> v0.2.6
    Updating jiff-static v0.2.5 -> v0.2.6
    Updating linux-raw-sys v0.9.3 -> v0.9.4
    Updating miniz_oxide v0.8.7 -> v0.8.8
   Unchanged op-alloy-consensus v0.11.4 (available: v0.13.0)
   Unchanged op-alloy-rpc-types v0.11.4 (available: v0.13.0)
   Unchanged protobuf v3.3.0 (available: v3.7.2)
   Unchanged protobuf-support v3.3.0 (available: v3.7.2)
   Unchanged rand v0.8.5 (available: v0.9.0)
   Unchanged revm v19.7.0 (available: v22.0.0)
   Unchanged revm-inspectors v0.16.0 (available: v0.19.0)
   Unchanged revm-primitives v15.2.0 (available: v18.0.0)
    Updating rustls v0.23.25 -> v0.23.26
   Unchanged solang-parser v0.3.3 (available: v0.3.4)
    Updating svm-rs v0.5.14 -> v0.5.15
    Updating svm-rs-builds v0.5.14 -> v0.5.15
   Unchanged vergen v8.3.2 (available: v9.0.6)
    Updating which v7.0.2 -> v7.0.3
    Updating winnow v0.7.4 -> v0.7.6
note: to see how you depend on a package, run `cargo tree --invert --package <dep>@<ver>`

Co-authored-by: mattsse <[email protected]>

* fix(forge): do not set balance as apparent value in delegate prank (#10304)

* chore: release 1.1.0 - update last stable version (#10303)

* fix(docker): build docker aarch64 without jemalloc (#10286)

* fix(forge): ensure selected fork contains init state for persisted accounts (#10301)

* chore(anvil): spawn estimate on blocking task (#10307)

* chore: rm redundant clone (#10308)

* fix(forge): avoid preprocessor constructor args struct name conflict (#10313)

* chore: trigger releases on rc-* tags too (#10315)

* feat: add vm.getChain(chainAlias)  (#10226)

* add Chain struct

* generate interface

* define getChain cheatcode

* add getChain(alias) implementation

* add GetChain test

* run fmt

* fix: add alloy_chain for check chain validity

---------

Co-authored-by: grandizzy <[email protected]>

* feat(`cast`): getTransactionBySenderAndNonce (#10323)

* feat(`cast`): getTransactionBySenderAndNonce

* fix doc-test

* fix: force install default crypto provider (#10327)

* fix: force install default crypto provider

* Fix tests and cargo deny

---------

Co-authored-by: grandizzy <[email protected]>

* Support the `gcp` option in `cast wallet list` (#8232)

* Support gcp option in `cast wallet list`

* implement `gcp_sugners` to `MultiWalletOpts`

* add comment

* Make gcp option infallible if the env vars are missing

* align version with Alloy

---------

Co-authored-by: evalir <[email protected]>
Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: zerosnacks <[email protected]>

* feat: add serde derive to forge bind (#10332)

feat: add serde derive

* fix(forge): avoid panic on internal decoding of linked tests (#10333)

Failing tests related to etherscan sepolia migration

* chore(deps): weekly `cargo update` (#10339)

Locking 25 packages to latest compatible versions
   Unchanged alloy-chains v0.1.69 (available: v0.2.0)
   Unchanged alloy-consensus v0.12.6 (available: v0.14.0)
   Unchanged alloy-contract v0.12.6 (available: v0.14.0)
   Unchanged alloy-dyn-abi v0.8.25 (available: v1.0.0)
   Unchanged alloy-eips v0.12.6 (available: v0.14.0)
   Unchanged alloy-genesis v0.12.6 (available: v0.14.0)
   Unchanged alloy-json-abi v0.8.25 (available: v1.0.0)
   Unchanged alloy-json-rpc v0.12.6 (available: v0.14.0)
   Unchanged alloy-network v0.12.6 (available: v0.14.0)
   Unchanged alloy-primitives v0.8.25 (available: v1.0.0)
   Unchanged alloy-provider v0.12.6 (available: v0.14.0)
   Unchanged alloy-pubsub v0.12.6 (available: v0.14.0)
   Unchanged alloy-rpc-client v0.12.6 (available: v0.14.0)
   Unchanged alloy-rpc-types v0.12.6 (available: v0.14.0)
   Unchanged alloy-serde v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-aws v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-gcp v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-ledger v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-local v0.12.6 (available: v0.14.0)
   Unchanged alloy-signer-trezor v0.12.6 (available: v0.14.0)
   Unchanged alloy-sol-macro-expander v0.8.25 (available: v1.0.0)
   Unchanged alloy-sol-macro-input v0.8.25 (available: v1.0.0)
   Unchanged alloy-sol-types v0.8.25 (available: v1.0.0)
   Unchanged alloy-transport v0.12.6 (available: v0.14.0)
   Unchanged alloy-transport-http v0.12.6 (available: v0.14.0)
   Unchanged alloy-transport-ipc v0.12.6 (available: v0.14.0)
   Unchanged alloy-transport-ws v0.12.6 (available: v0.14.0)
   Unchanged alloy-trie v0.7.9 (available: v0.8.1)
    Updating anyhow v1.0.97 -> v1.0.98
    Updating aws-lc-sys v0.28.0 -> v0.28.1
   Unchanged axum v0.7.9 (available: v0.8.3)
   Unchanged backtrace v0.3.71 (available: v0.3.74)
    Updating bon v3.5.2 -> v3.6.1
    Updating bon-macros v3.5.2 -> v3.6.1
    Updating clap v4.5.36 -> v4.5.37
    Updating clap_builder v4.5.36 -> v4.5.37
   Unchanged crossterm v0.28.1 (available: v0.29.0)
    Updating der v0.7.9 -> v0.7.10
    Updating foundry-block-explorers v0.13.0 -> v0.13.1
    Updating foundry-compilers v0.14.0 -> v0.14.1
    Updating foundry-compilers-artifacts v0.14.0 -> v0.14.1
    Updating foundry-compilers-artifacts-solc v0.14.0 -> v0.14.1
    Updating foundry-compilers-artifacts-vyper v0.14.0 -> v0.14.1
    Updating foundry-compilers-core v0.14.0 -> v0.14.1
   Unchanged gcloud-sdk v0.26.4 (available: v0.27.0)
    Updating h2 v0.4.8 -> v0.4.9
    Updating jiff v0.2.6 -> v0.2.9
    Updating jiff-static v0.2.6 -> v0.2.9
    Updating libc v0.2.171 -> v0.2.172
    Removing lockfree-object-pool v0.1.6
    Removing md-5 v0.10.6
   Unchanged op-alloy-consensus v0.11.4 (available: v0.14.1)
   Unchanged op-alloy-rpc-types v0.11.4 (available: v0.14.1)
    Updating proc-macro2 v1.0.94 -> v1.0.95
    Updating prodash v29.0.1 -> v29.0.2
   Unchanged protobuf v3.3.0 (available: v3.7.2)
   Unchanged protobuf-support v3.3.0 (available: v3.7.2)
    Updating rand v0.9.0 -> v0.9.1
   Unchanged rand v0.8.5 (available: v0.9.1)
   Unchanged revm v19.7.0 (available: v22.0.1)
   Unchanged revm-inspectors v0.16.0 (available: v0.19.1)
   Unchanged revm-primitives v15.2.0 (available: v18.0.0)
    Updating rtoolbox v0.0.2 -> v0.0.3
    Updating scc v2.3.3 -> v2.3.4
    Updating signal-hook-registry v1.4.2 -> v1.4.4
   Unchanged solang-parser v0.3.3 (available: v0.3.4)
   Unchanged vergen v8.3.2 (available: v9.0.6)
      Adding xxhash-rust v0.8.15
    Updating zopfli v0.8.1 -> v0.8.2
note: to see how you depend on a package, run `cargo tree --invert --package <dep>@<ver>`

Co-authored-by: mattsse <[email protected]>

* fix(forge): run git submodule sync when installing (#10347)

* chore(`release`): add `gcp-kms` flag to default release workflow (#10346)

add gcp kms flag to workflow

* feat(forge): add new cheatcode `attachBlob` to send EIP-4844 transaction (#10336)

* feat: add new cheatcode attachBlob

* fix: lint

* fix: build fail due to missing feature flag

---------

Co-authored-by: grandizzy <[email protected]>

* feat(script): revert if address(this) used (#10295)

* Update stack.rs

* Update lib.rs

* Update lib.rs

* Update stack.rs

* Create ScriptAddressWarn.t.sol

* Update mod.rs

* Update stack.rs

* Update lib.rs

* Create script.rs

* Fix compilation, cleanup, add new test in script tests

* Set and check current address is script address

* Update stack.rs

* Allow calls to external libraries

* changes after review: use sh_err

---------

Co-authored-by: grandizzy <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* feat(cast): Include recover_authority when logging SignedAuthorization (#10349)

* add recover_authority when logging signed_authority

* add error handling and test for signed_authorization formatting

* update naming

* update formatting

---------

Co-authored-by: Nnamdi Aninye <[email protected]>

* chore: fix isolate tests (#10344)

* Add state overrides flags to cast call  (#10255)

* add initial implementation

* modify flag names

* minor change: fix cargo clipy

* fix docs

* fix docs

* minor fix

* fix cargo fmt

* Revert "fix cargo fmt"

This reverts commit e7712694339203ef7c23435d18d15089fc654794.

* add test

* fix tests

* use alloys Accountoverride

* move get_state_overrides to self

* minor fixes

* remove parse_address_value_for_nonce and use a general function. use get_or_insert_default. remove clones().

* use regex for address slot value parsing

* make all override flags options

* Fmt and clippy

* Use StateOverridesBuilder, nit

* Fix docs

* Add better tests for state, code and balance overrides

---------

Co-authored-by: grandizzy <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* chore(deps): weekly `cargo update` (#10381)

* chore(deps): weekly `cargo update`

     Locking 46 packages to latest compatible versions
   Unchanged alloy-chains v0.1.69 (available: v0.2.0)
   Unchanged alloy-consensus v0.12.6 (available: v0.15.6)
   Unchanged alloy-contract v0.12.6 (available: v0.15.6)
   Unchanged alloy-dyn-abi v0.8.25 (available: v1.0.0)
   Unchanged alloy-eips v0.12.6 (available: v0.15.6)
   Unchanged alloy-genesis v0.12.6 (available: v0.15.6)
   Unchanged alloy-json-abi v0.8.25 (available: v1.0.0)
   Unchanged alloy-json-rpc v0.12.6 (available: v0.15.6)
   Unchanged alloy-network v0.12.6 (available: v0.15.6)
   Unchanged alloy-primitives v0.8.25 (available: v1.0.0)
   Unchanged alloy-provider v0.12.6 (available: v0.15.6)
   Unchanged alloy-pubsub v0.12.6 (available: v0.15.6)
   Unchanged alloy-rpc-client v0.12.6 (available: v0.15.6)
   Unchanged alloy-rpc-types v0.12.6 (available: v0.15.6)
   Unchanged alloy-serde v0.12.6 (available: v0.15.6)
   Unchanged alloy-signer v0.12.6 (available: v0.15.6)
   Unchanged alloy-signer-aws v0.12.6 (available: v0.15.6)
   Unchanged alloy-signer-gcp v0.12.6 (available: v0.15.6)
   Unchanged alloy-signer-ledger v0.12.6 (available: v0.15.6)
   Unchanged alloy-signer-local v0.12.6 (available: v0.15.6)
   Unchanged alloy-signer-trezor v0.12.6 (available: v0.15.6)
   Unchanged alloy-sol-macro-expander v0.8.25 (available: v1.0.0)
   Unchanged alloy-sol-macro-input v0.8.25 (available: v1.0.0)
   Unchanged alloy-sol-types v0.8.25 (available: v1.0.0)
   Unchanged alloy-transport v0.12.6 (available: v0.15.6)
   Unchanged alloy-transport-http v0.12.6 (available: v0.15.6)
   Unchanged alloy-transport-ipc v0.12.6 (available: v0.15.6)
   Unchanged alloy-transport-ws v0.12.6 (available: v0.15.6)
   Unchanged alloy-trie v0.7.9 (available: v0.8.1)
    Updating ammonia v4.0.0 -> v4.1.0
    Updating async-compression v0.4.22 -> v0.4.23
    Updating aws-config v1.6.1 -> v1.6.2
    Updating aws-credential-types v1.2.2 -> v1.2.3
    Updating aws-lc-sys v0.28.1 -> v0.28.2
    Updating aws-runtime v1.5.6 -> v1.5.7
    Updating aws-sdk-kms v1.65.0 -> v1.66.0
    Updating aws-sdk-sso v1.64.0 -> v1.65.0
    Updating aws-sdk-ssooidc v1.65.0 -> v1.66.0
    Updating aws-sdk-sts v1.65.0 -> v1.66.0
    Updating aws-sigv4 v1.3.0 -> v1.3.1
    Updating aws-smithy-http v0.62.0 -> v0.62.1
    Updating aws-smithy-observability v0.1.2 -> v0.1.3
    Updating aws-smithy-runtime v1.8.1 -> v1.8.3
    Updating aws-smithy-runtime-api v1.7.4 -> v1.8.0
    Updating aws-smithy-types v1.3.0 -> v1.3.1
    Updating aws-types v1.3.6 -> v1.3.7
   Unchanged axum v0.7.9 (available: v0.8.3)
   Unchanged backtrace v0.3.71 (available: v0.3.74)
    Updating bon v3.6.1 -> v3.6.3
    Updating bon-macros v3.6.1 -> v3.6.3
    Updating cc v1.2.19 -> v1.2.20
   Unchanged crossterm v0.28.1 (available: v0.29.0)
      Adding cssparser v0.35.0
      Adding cssparser-macros v0.6.1
      Adding dtoa v1.0.10
      Adding dtoa-short v0.3.5
   Unchanged gcloud-sdk v0.26.4 (available: v0.27.0)
    Updating getrandom v0.2.15 -> v0.2.16
    Updating gix-path v0.10.15 -> v0.10.17
      Adding gix-validate v0.10.0
    Updating html5ever v0.27.0 -> v0.31.0
    Updating jiff v0.2.9 -> v0.2.10
    Updating jiff-static v0.2.9 -> v0.2.10
    Updating libm v0.2.11 -> v0.2.13
    Updating markup5ever v0.12.1 -> v0.16.1
      Adding match_token v0.1.0
   Unchanged op-alloy-consensus v0.11.4 (available: v0.15.1)
   Unchanged op-alloy-rpc-types v0.11.4 (available: v0.15.1)
   Unchanged protobuf v3.3.0 (available: v3.7.2)
   Unchanged protobuf-support v3.3.0 (available: v3.7.2)
    Updating quinn-proto v0.11.10 -> v0.11.11
   Unchanged rand v0.8.5 (available: v0.9.1)
   Unchanged revm v19.7.0 (available: v22.0.1)
   Unchanged revm-inspectors v0.16.0 (available: v0.20.0)
   Unchanged revm-primitives v15.2.0 (available: v18.0.0)
    Updating rpassword v7.3.1 -> v7.4.0
    Updating signal-hook-registry v1.4.4 -> v1.4.5
   Unchanged solang-parser v0.3.3 (available: v0.3.4)
    Updating syn v2.0.100 -> v2.0.101
    Updating tokio-util v0.7.14 -> v0.7.15
    Updating toml v0.8.20 -> v0.8.21
    Updating toml_datetime v0.6.8 -> v0.6.9
    Updating toml_edit v0.22.24 -> v0.22.25
      Adding toml_write v0.1.0
   Unchanged vergen v8.3.2 (available: v9.0.6)
      Adding web_atoms v0.1.0
    Removing windows-sys v0.48.0
    Removing windows-targets v0.48.5
    Removing windows_aarch64_gnullvm v0.48.5
    Removing windows_aarch64_msvc v0.48.5
    Removing windows_i686_gnu v0.48.5
    Removing windows_i686_msvc v0.48.5
    Removing windows_x86_64_gnu v0.48.5
    Removing windows_x86_64_gnullvm v0.48.5
    Removing windows_x86_64_msvc v0.48.5
    Updating winnow v0.7.6 -> v0.7.7
    Updating zerocopy v0.8.24 -> v0.8.25
    Updating zerocopy-derive v0.8.24 -> v0.8.25
note: to see how you depend on a package, run `cargo tree --invert --package <dep>@<ver>`

* chore: clippy

* test

---------

Co-authored-by: mattsse <[email protected]>
Co-authored-by: DaniPopes <[email protected]>

* chore(deps): replace inflector with heck (#10386)

* chore(deps): switch to proc-macro-error2 (#10387)

* chore(deps): remove serde_regex (#10389)

* chore(deps): use unicode-rs as the idna backend (#10390)

* test(anvil): fix flaky test (#10391)

* test: move serial_tests to nextest test groups (#10392)

* chore: metadata hash extraction cleanup (#10396)

* chore(deps): replace humantime with jiff (#10395)

* chore(deps): replace humantime with jiff

* tests

* feat(forge): script warn if no transactions to broadcast (#10384)

* warn if no transactions to broadcast

* Update revert_handlers.rs

* Update error.rs

* moving to sh_warn from warn

* Adding tc for "no tx to broadcast"

* fmt

* Move and fix test

---------

Co-authored-by: grandizzy <[email protected]>

* Update to soldeer 0.5.4 (#10399)

* Update to release 0.5.4

* refactor: use soldeer_core structs where possible

* fix(config): soldeer import

* style: format

---------

Co-authored-by: beeb <[email protected]>

* fix(forge): do not use bytecode metadata in fuzz dict (#10402)

fix(forge): do not use metadata in fuzzing

* chore: fix anvil immutable fork test (#10409)

* chore(tests): bump forge-std version (#10406)

* chore: bump forge-std version used for tests

* fix tests - additional file in forge-std

* Fix precompile label test

---------

Co-authored-by: DaniPopes <[email protected]>
Co-authored-by: grandizzy <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* chore: update `std::process::exit(0)` calls in `ProjectCompiler::compile` (#10328)

* Update compile.rs

* Update compile.rs

* Update compile.rs

* Update compile.rs

* Reverted changes in compile.rs

* Added TODO comments in compile.rs

* return result

---------

Co-authored-by: Matthias Seitz <[email protected]>
Co-authored-by: grandizzy <[email protected]>
Co-authored-by: DaniPopes <[email protected]>

* fix(anvil): trace_filter same to and from block range is valid (#10400)

* fix(anvil): trace_filter same to and from block range is valid

* Update crates/anvil/src/eth/backend/mem/mod.rs

---------

Co-authored-by: grandizzy <[email protected]>
Co-authored-by: DaniPopes <[email protected]>

* Apply access list to tracing executor for 'cast call --trace' (#10161)

Co-authored-by: grandizzy <[email protected]>

* chore: minor changes (#10415)

* feat(forge): add `vm.stopRecord` (#10370)

* add initial implementation of StopRecord cheatcode

* modify command to be stopRecordAndReturnAccesses instead

* improve documentation and lint fixes

* lint changes in integration tests

* implement resetRecord and stopRecord

* clippy fix

* minor formatting changes

* chore: cleanup, rm reset

---------

Co-authored-by: DaniPopes <[email protected]>

* feat(forge): add script execution protection config (#10408)

* feat(forge): add script execution protection config

* Update crates/config/src/lib.rs

Co-authored-by: DaniPopes <[email protected]>

---------

Co-authored-by: DaniPopes <[email protected]>

* feat: add Alpine Linux support to foundryup (#10257)

* feat: add Alpine Linux support to foundryup

This change adds Alpine Linux as a supported platform in `foundryup`
script, enabling straightforward installation on Alpine systems.

Alpine binaries (which use MUSL instead of GNU libc) have been available
in nightly builds since PR #10086. This commit makes Alpine a
first-class supported platform alongside existing ones.

This benefits teams working in lightweight Alpine-based environments
(e.g. CI, containers) and other systems that favor MUSL's smaller
footprint.

* Bump foundryup version

---------

Co-authored-by: grandizzy <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* fix(forge): show lcov hits for do while statements (#10423)

* feat: Add file option for calldata input (#10397)

* Update opts.rs

* Update args.rs

* Update args-> final_args

* Update crates/cast/src/opts.rs

Co-authored-by: grandizzy <[email protected]>

* test case

* fmt

* splitting the string

* fmt

---------

Co-authored-by: grandizzy <[email protected]>

* chore: update immutable forked test (#10439)

* chore(deps): weekly `cargo update` (#10433)

* chore(deps): weekly `cargo update`

     Locking 27 packages to latest compatible versions
    Updating addr2line v0.21.0 -> v0.24.2
    Removing adler v1.0.2
   Unchanged alloy-chains v0.1.69 (available: v0.2.0)
   Unchanged alloy-consensus v0.12.6 (available: v0.15.8)
   Unchanged alloy-contract v0.12.6 (available: v0.15.8)
   Unchanged alloy-dyn-abi v0.8.25 (available: v1.1.0)
   Unchanged alloy-eips v0.12.6 (available: v0.15.8)
   Unchanged alloy-genesis v0.12.6 (available: v0.15.8)
   Unchanged alloy-json-abi v0.8.25 (available: v1.1.0)
   Unchanged alloy-json-rpc v0.12.6 (available: v0.15.8)
   Unchanged alloy-network v0.12.6 (available: v0.15.8)
   Unchanged alloy-primitives v0.8.25 (available: v1.1.0)
   Unchanged alloy-provider v0.12.6 (available: v0.15.8)
   Unchanged alloy-pubsub v0.12.6 (available: v0.15.8)
   Unchanged alloy-rpc-client v0.12.6 (available: v0.15.8)
   Unchanged alloy-rpc-types v0.12.6 (available: v0.15.8)
   Unchanged alloy-serde v0.12.6 (available: v0.15.8)
   Unchanged alloy-signer v0.12.6 (available: v0.15.8)
   Unchanged alloy-signer-aws v0.12.6 (available: v0.15.8)
   Unchanged alloy-signer-gcp v0.12.6 (available: v0.15.8)
   Unchanged alloy-signer-ledger v0.12.6 (available: v0.15.8)
   Unchanged alloy-signer-local v0.12.6 (available: v0.15.8)
   Unchanged alloy-signer-trezor v0.12.6 (available: v0.15.8)
   Unchanged alloy-sol-macro-expander v0.8.25 (available: v1.1.0)
   Unchanged alloy-sol-macro-input v0.8.25 (available: v1.1.0)
   Unchanged alloy-sol-types v0.8.25 (available: v1.1.0)
   Unchanged alloy-transport v0.12.6 (available: v0.15.8)
   Unchanged alloy-transport-http v0.12.6 (available: v0.15.8)
   Unchanged alloy-transport-ipc v0.12.6 (available: v0.15.8)
   Unchanged alloy-transport-ws v0.12.6 (available: v0.15.8)
   Unchanged alloy-trie v0.7.9 (available: v0.8.1)
   Unchanged axum v0.7.9 (available: v0.8.4)
    Updating backtrace v0.3.71 -> v0.3.74
    Updating bytemuck v1.22.0 -> v1.23.0
    Updating cc v1.2.20 -> v1.2.21
    Updating chrono v0.4.40 -> v0.4.41
    Updating clap_complete v4.5.47 -> v4.5.48
    Updating color-eyre v0.6.3 -> v0.6.4
    Updating color-spantrace v0.2.1 -> v0.2.2
   Unchanged crossterm v0.28.1 (available: v0.29.0)
   Unchanged gcloud-sdk v0.26.4 (available: v0.27.0)
    Updating gimli v0.28.1 -> v0.31.1
    Updating hashbrown v0.15.2 -> v0.15.3
   Unchanged idna_adapter v1.1.0 (available: v1.2.0)
    Updating jiff v0.2.10 -> v0.2.12
    Updating jiff-static v0.2.10 -> v0.2.12
    Updating miette v7.5.0 -> v7.6.0
    Updating miette-derive v7.5.0 -> v7.6.0
    Removing miniz_oxide v0.7.4
    Updating object v0.32.2 -> v0.36.7
   Unchanged op-alloy-consensus v0.11.4 (available: v0.15.2)
   Unchanged op-alloy-rpc-types v0.11.4 (available: v0.15.2)
    Updating owo-colors v3.5.0 -> v4.2.0
   Unchanged protobuf v3.3.0 (available: v3.7.2)
   Unchanged protobuf-support v3.3.0 (available: v3.7.2)
    Updating quick-xml v0.37.4 -> v0.37.5
    Updating quinn-udp v0.5.11 -> v0.5.12
   Unchanged rand v0.8.5 (available: v0.9.1)
    Updating redox_syscall v0.5.11 -> v0.5.12
   Unchanged revm v19.7.0 (available: v22.0.1)
   Unchanged revm-inspectors v0.16.0 (available: v0.20.1)
   Unchanged revm-primitives v15.2.0 (available: v18.0.0)
    Updating rustix v1.0.5 -> v1.0.7
    Updating sha2 v0.10.8 -> v0.10.9
   Unchanged solang-parser v0.3.3 (available: v0.3.4)
    Updating toml v0.8.21 -> v0.8.22
    Updating toml_edit v0.22.25 -> v0.22.26
    Updating toml_write v0.1.0 -> v0.1.1
   Unchanged vergen v8.3.2 (available: v9.0.6)
    Updating web_atoms v0.1.0 -> v0.1.1
    Updating webpki-roots v0.26.8 -> v0.26.10
    Updating winnow v0.7.7 -> v0.7.9
note: to see how you depend on a package, run `cargo tree --invert --package <dep>@<ver>`

* Allow CDLA-Permissive-2.0

---------

Co-authored-by: mattsse <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* fix(forge): remove `strategy` section from workflow template to simplify (#10434)

Simplify workflow configuration for Foundry project

- Refactor the Foundry project workflow for improved clarity and efficiency.
- Remove the `fail-fast` option to ensure all checks run regardless of failures.
- Streamline job configurations for better maintainability and readability.

Signed-off-by: katsumata <[email protected]>

* core: sprinkle some traces (#10456)

* feat: Etherscan V2 support (#10440)

* Adding support to etherscanv2

* clippy+fmt

* Adding default for v2 and updating configuration to parse etherscan api version from config

* Updating api_version to use new variable and fix merge

* Use block explorer rev, fix fmt

* fix api version parsing

* fix fmt

* Simplify Etherscan provider option, default v2

* Use released version

* Updates, fix script --verify

* Clone api version, cast

* Cast fixes

* Tests nits

* configs for verify check

* Simplify, use EtherscanApiVersion enum

---------

Co-authored-by: Iain Nash <[email protected]>

* feat: solc 0.8.30 (#10459)

* chore: add OpRetro to funding.json (#10462)

* fix: add check for conflicting create (#10467)

* test(`cast`): add and enable negative octal formatting test (#10468)

Update base.rs

* perf: spawn mining on blocking (#10471)

* perf: spawn mining on blocking

* fmt

* chore: replaced trie with alloy-trie (#10478)

* chore: replaced trie with alloy-trie

* fixes

* fix(forge): Set empty code if the 7702 delegation address is 0x (#10481)

fix(forge): Set empty code if the 7702 delegation address of authority is 0x

* chore: rm work type (#10474)

* chore: rm unused account type (#10472)

* chore: rm unused account type

* rm unused crate

* replaced default with calculate (#10236)

* replaced default with calculate

* fmt

* fmt fixes

* fixes

* fmt

* touchups

---------

Co-authored-by: Matthias Seitz <[email protected]>

* feat: add devcontainer (#10429)

Co-authored-by: grandizzy <[email protected]>

* feat: added TransactionStream to subscribe to pending transactions (#10482)

* added new method to subscribe to pending tx

* wip

* clippy -.-

* clippy -.-

* unbounded channel

* wip

* wip test

* touchup

* check

---------

Co-authored-by: Matthias Seitz <[email protected]>

* refactor(common): improve URL path handling in runtime transport (#10493)

Update runtime_transport.rs

* fix(forge): fix nonce for tx with 7702 auth (#10464)

* fix(forge): fix nonce for tx with 7702 auth

* simplify, only set_code with incremented nonce

* added eth_getAccountInfo to anvil (#10496)

* added eth_getAccountInfo to anvil

* fixes

* fixes

* fix: Replay raw txs without tweaks in anvil_reorg (#10442)

fix: Replay raw txs without txs in anvil_reorg

Co-authored-by: grandizzy <[email protected]>

* fix(anvil): use saturating_to when check for req funds (#10503)

* chore: prepare v1.2 release (#10502)

* fix(anvil): recomputing next-base-fee after reloading state (#10488)

* recomputing next-base-fee after reloading state

* unit test

---------

Co-authored-by: grandizzy <[email protected]>

* fix(forge): support preproc with try contract creation (#10498)

* fix(forge): support preproc with try contract creation

* visit nested vars and statements of try stmt

* feat: add 7702 support to eth-sendtransaction (#10504)

* chore: remove `Eof::decode` usage (#10499)

* chore: remove Eof::decode

* fmt

* fix: sort blocks by number (#10505)

* perf: find latest block for next-base-fee. replaces #10505 (#10511)

* perf: find latest block for next-base-fee. replaces #10505

* wip

* chore: account for auths in 7702 min estimated gas (#10512)

* fix: fix formating crash caused by non-breaking space in comment. (#10522)

fix: fix formating crash caused by non-breaking space in comment

* fix(cast): disassembler PC & end of code push padding (#10520)

* fix da

* fix da test

* fix fmt

* fix(`Makefile`): update `lint-foundry` target to explicitly use nightly (#10526)

* feat(forge): cheatcodes to crosschain sign and attach delegation (#10518)

* feat(forge): cheatcodes to crosschain sign and attach delegation

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: zerosnacks <[email protected]>

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: zerosnacks <[email protected]>

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: zerosnacks <[email protected]>

* Nits

---------

Co-authored-by: zerosnacks <[email protected]>

* Refactor: abstract global allocator in `foundry-cli` to be used across crates (#10523)

Refactor: abstract global allocator in `foundry-cli` to be used cross crates

- Conditional allocator type selection with cfg-if macro
- Explicit use of `std::alloc::System` if feature "jemalloc" is not  enabled
- Linking "jemalloc" feature in all crates to "foundry-cli/jemalloc"

* fix(forge): mark prank applied on contract creation too (#10532)

* fix(forge): do not revert if event with count 0 not emitted (#10534)

* chore(meta): delete CHANGELOG.md (#10535)

* fix(`cast`): respect `full` arg in `cast block` (#10536)

fix: respect full arg

* fix(`common`): find target by path if present (#10538)

* fix(`common`): prefer to find by path if present

* test

* fix: adds zksync, abstract to diff gas calc (#10539)

* Add standard-json as inspect output field (#10537)

* Add standard-json as inspect output field option

* Address PR feedback

* fix: patch solang-parser (#10509)

* fix: patch solang-parser

* layout at test

* bump

* chore: update

* update

* format layout

* fix pragma

* chore: update

* chore: update

* fix: pragma 2

* feat: re-implement pragma

* fix(forge): vm.cool mark cold instead storage cleaning (#10546)

* feat(cast): Verbose signing output (#10529)

* add verbose logging

* respect pipe as default

* add verbose signing to signAuth

* ci: fix flaky fork test using `StdChains`, add temporary workaround for `eth.llamarpc.com` being down (#10549)

add temporary workaround for eth.llamarpc.com being down

* bump(`revm`: step 1): bump `revm` to `21.0.0` release (#10183)

* start fixing imports

* continue fixing imports

* continue fixing imports

* continue fixing imports

* add alloy-evm

* fix known good changes

* more known good fixes

* more known good fixes

* more known good fixes

* more known good fixes, unclear how OptimismFields should be ported

* start introducing crate::Env

* continue introducing crate::Env

* fix cow types

* fix type

* add journaledstate types, fix env types

* fix JournaledState = JournalInner<JournalEntry>

* fix types

* fix merge type

* add odyssey precompile

* continue fixing type issues, handler abstraction

* start working on create2 handler

* revert to type instead of struct, investigating handlers

* comment out accesslistinspector for now, needs to be addressed

* fix imports, minor fixes

* imports, minor fixes, there is no equivalent of AuthorizationList - requires slight refactor

* more interpreter type fixes

* continue type fixes

* fix inspectorext

* start porting inspectors

* start adding custom evm

* continue adding custom FoundryEvm

* impl traits for FoundryEvm

* restructure, move out of utils into evm, precompiles and future handlers

* clean up

* clean up

* improve docs

* scaffold handler

* evaluate how to add handles

* prefer EnvRef over EnvMut

* address feedback of owned env

* revert get_or_insert_map workaround

* avoid changing types, leave mut where previously, avoid unnecessary mut

* start layout out handler registry connected to evm

* get create2 from frame inputs

* start adding create2 handler

* continue create2handler

* wrap up create2 handler

* clean up

* continue fixing types

* generalize precompiles

* clean up

* tag inline

* fix imports

* start fixing cheatcode types

* use `env` on handler

* clean up

* temp revert

* odyssey precompile was deprecated

* refix cheatcode types

* clean up

* still facing issues with borrow-checker, double mut

* open questions around passing around env

* minor fix

* for now work around mutability limitations by limited cloning, unclear performance impact or whether it will work with cheatcode macros

* continue fixing types, still issues around cheatcodes, inspector

* bump revm

* bump deps

* minor type fixes

* bump foundry-fork-db to handle c-kzg build issue

* bump rust version

* utilize Host, ContextTr, JournalTr to avoid double mutable borrows

* temp revert

* temp revert

* restore handler, improve types

* refactor types

* restore types

* restore, clean up

* continue fixing types

* clean up

* continue fixing types

* revert journal env cloning, still issues around double borrows

* fix core types per conversation, use EnvMut<'_>

* fix types

* more progress for foundry-evm

* mutate outcome in place

* temp revert exec_create

* some progress with porting with_evm core loop

* remove redundant types

* context -> test_context in Cheatcodes config

* construct new handler, wrapping evm context, imports Handler trait

* temporarily comment out exec_create section to unblock

* add replacement of EnvWithHandlerCfg

* minor fixes

* continue fixing types

* continue fixing types

* continue fixing types

* continue fixing types

* continue types

* fix cached_env

* remove possibly incorrect handling of CreateOutcome on methods like do_eofcreate_end as outcome is now mutated in place

* add custom_printer from revm19, porting for compatibility

* cast: fix types

* verify: fix types

* forge + script: fix types

* anvil: start fixing types

* anvil: continue porting types

* anvil: continue porting types

* anvil: continue porting types

* anvil: continue porting types, small fix in foundry-evm

* use AnvilEvm

* stash optimism hardfork specifics for now

* temp mute anvil use in forge

* apply apparant fixes, test still failing

* clean up

* revert to replay

* apply possible nonce 0/1 fixes, committed to proceed

* disable nonce check in local_evm_env

* undo is_odyssey remove

* always spawn evm with handler

* replay() -> inspect_replay()

* modify macro, comment out anvil related cast tests for the time being

* reapply state depth = 1

* something like this?

* introduce outer block for early return

* print debugging

* clean up

* fix merge

* migrate: anvil to revm 21 (#10361)

* downgrade op-revm to 2.0.0 to resolve dep conflict

* op-revm 3.0 uses revm 22

* add `as_mut_dyn` to trait `MaybeFullDatabase` as we now require mut db_ref access (

* Revert "add `as_mut_dyn` to trait `MaybeFullDatabase` as we now require mut db_ref access ("

This reverts commit 84d11f1742df768d773253de216a223a7d4683e6.

* fix: Inspector should be generic over CTX not DB

* fixes helpers: new_evm_with_inspector_* to use CTX generic

* fix: pass TxEnv to evm.transact

* fix: inspector inference in TransactionExecutor and build_access_list_with_state

* workaround: dup LogCollector to use with AnvilEvmContext

* coz FoundryEvmContext is not generic over DB, instead hardoded to dyn DatabaseExt

* fix tests

* fix traces test

* fix: use default kzg settings in blob validation

* reintroduce OptimismHardfork

* fix: disable nonce check if nonce is None

* fix!: load state tests by addressing breaking changes in state files

* BlockEnv Breaking change:
- most fields now use `u64` instead of `U64` / `U256`
- coinbase renamed to beneficiary
- best_block_number is `u64`, prev `U64`

* fix: access_list test by using evm.inspect_with_tx

* fix: replace evm.transact with evm.inspect_with_tx

* fix: make impl Inspector for AnvilInspector generic over CTX

* fix: clone inspector in TransactionExecutor to enable evm.inspect_commit

* fix: remove cloned inspector from TransactionExecutor

* feat(`anvil`): op support revm 21 (#10407)

* enable OpHardforks in NodeConfig

* feat: add is_optimism flag to foundry_evm::Env

* feat(`anvil`): set is_optimism in Backend

* feat(`anvil`): introducing EvmContext enum holding Eth and Op variants.

* adds OpEnv to foundry_evm_core

* feat: EitherEvm

* impl Evm for EitherEvm

* integrate EitherEvm into RPC and executor

*Map OpHaltReason and OpTransactionError

* rm old evm helpers

* feat(`foundry_evm`): add deposit tx parts field to Env

* fix(`anvil`): set deposit tx parts in tx executor and backend.inspect_tx

* nit

* docs EitherEvm

* nit

* refac: return TxEnv and Deposit parts separately

* nits

* nit

* make anvil result aliases more generic

* nit

* intermediary(`revm bump`): re-enable Anvil tests, remove duplicate `LogCollector`, entire codebase builds (#10412)

* temp refactor, still facing issue

* clean up

* clean up

* temp cleanup, can later be refd

* clean up, refactor stack.rs to apply ecx restore from cache to outside lamba

* fix

* clean up

* clean up

* avoid borrowing mutably for clarity

* use EthEvmContext directly

* FoundryEvmContext -> EthEvmContext

* continue

* fix tests

* fix inspectors

* codebase now builds entirely

* fix clippy lints

* remove duplicate LogCollector in Anvil

* fmt

* fix clippy

* fix doctests

* disable nonce checks on forks, enforce setting of tx.nonce on set_nonce

* fix: use `transact` from alloy-evm (#10417)

* Patch revm to fix interpreter panic

* bump revm

* fix eof test

* fix bytecode hash

* fix fixture

* fix fixture

* fix fixture

* chore: mv EitherEvm to foundry_evm (#10445)

mv EitherEvm to foundry_evm_core

* remove unused JournalTr

* restore formatting, avoid diff

* remove leftover comment re: optimism support

* fix displays_chained_error test

* fix doc test

* remove optimism todo leftover

* avoid direct field assignment, prefer *current.

* create2 handler register

* fix patch

* fix test_broadcast_raw_create2_deployer

* fix gas meter test

* correctly reset env.tx to cached env, cfg and block, ref https://github.com/foundry-rs/foundry/blob/a34f4c989b94f572497631ff5c85909d674c23a6/crates/evm/evm/src/inspectors/stack.rs#L640-L649

* exec_create

* revert test_GasMeter, assert exact gas used

* fix arbitrum test

* doc test fixes

* fix clippy warnings

* remove leftover comment

* fix assert_can_detect_unlinked_target_with_libraries, ref: https://github.com/bluealloy/revm/commit/fc54dd087ba9a96291b1130bc8be73ade5d01ea5

* fix gas metering tests

* restore unintended .wrap_err changes, ref: https://github.com/search?q=repo%3Afoundry-rs%2Ffoundry%20wrap_err(%22EVM%20error%22)&type=code

* fix test_cheats_local_default

* add CC0-1.0 license exception, has been previously approved in Reth: https://github.com/paradigmxyz/reth/blob/adb8bdc70758558d6122e87d78d73cc0f12d4dbb/deny.toml#L48

* usize depth

* repin foundry-fork-db, this aligns the revm and alloy version back

* fix clippy, after usize depth change

* allow foundry-fork-db as git exception

* fix: EitherEvm should work over OpTransaction

* fix fmt

* Env::from_with_spec_id -> Env::new_with_spec_id

* bump clippy msrv to align with foundry.toml

* chore: avoid leaking Anvil specific optimism fields into evm/core (#10466)

* start sketching

* maybe ?

* some kind of conversion still required

* continue porting

* clean up types

* pass op transaction in directly

* fixes

* restore setting of enveloped_tx

* refactor anvil Env and reduce changes in tx processing

* fix: correctly set txtype when setting up TxEnv

* update last commits from master to be u64 compatible

* fix clippy lint

* revert clippy changes, make sure lint-foundry uses nightly clippy version

* apply tx_type if set, upgrading from legacy to eip2930 if access_list is present and tx type is legacy

* restore #[ret] macro that was removed unintendedly

* replace redundant Env::new_with_spec_id(..) with default

* allow passing is_optimism into Env constructor specific to Anvil

* extract environment configuration into init.rs to make configuring the environment less error prone

* remove redundant debug derive

---------

Co-authored-by: Arsenii Kulikov <[email protected]>
Co-authored-by: Yash Atreya <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* bump(`revm`: step 2): bump `alloy` + `revm` + `alloy-evm` + other deps to latest (#10454)

* restructure, move out of utils into evm, precompiles and future handlers

* clean up

* clean up

* improve docs

* scaffold handler

* evaluate how to add handles

* prefer EnvRef over EnvMut

* address feedback of owned env

* revert get_or_insert_map workaround

* avoid changing types, leave mut where previously, avoid unnecessary mut

* start layout out handler registry connected to evm

* get create2 from frame inputs

* start adding create2 handler

* continue create2handler

* wrap up create2 handler

* clean up

* continue fixing types

* generalize precompiles

* clean up

* tag inline

* fix imports

* start fixing cheatcode types

* use `env` on handler

* clean up

* temp revert

* odyssey precompile was deprecated

* refix cheatcode types

* clean up

* still facing issues with borrow-checker, double mut

* open questions around passing around env

* minor fix

* for now work around mutability limitations by limited cloning, unclear performance impact or whether it will work with cheatcode macros

* continue fixing types, still issues around cheatcodes, inspector

* bump revm

* bump deps

* minor type fixes

* bump foundry-fork-db to handle c-kzg build issue

* bump rust version

* utilize Host, ContextTr, JournalTr to avoid double mutable borrows

* temp revert

* temp revert

* restore handler, improve types

* refactor types

* restore types

* restore, clean up

* continue fixing types

* clean up

* continue fixing types

* revert journal env cloning, still issues around double borrows

* fix core types per conversation, use EnvMut<'_>

* fix types

* more progress for foundry-evm

* mutate outcome in place

* temp revert exec_create

* some progress with porting with_evm core loop

* remove redundant types

* context -> test_context in Cheatcodes config

* construct new handler, wrapping evm context, imports Handler trait

* temporarily comment out exec_create section to unblock

* add replacement of EnvWithHandlerCfg

* minor fixes

* continue fixing types

* continue fixing types

* continue fixing types

* continue fixing types

* continue types

* fix cached_env

* remove possibly incorrect handling of CreateOutcome on methods like do_eofcreate_end as outcome is now mutated in place

* add custom_printer from revm19, porting for compatibility

* cast: fix types

* verify: fix types

* forge + script: fix types

* anvil: start fixing types

* anvil: continue porting types

* anvil: continue porting types

* anvil: continue porting types

* anvil: continue porting types, small fix in foundry-evm

* use AnvilEvm

* stash optimism hardfork specifics for now

* temp mute anvil use in forge

* apply apparant fixes, test still failing

* clean up

* revert to replay

* apply possible nonce 0/1 fixes, committed to proceed

* disable nonce check in local_evm_env

* undo is_odyssey remove

* always spawn evm with handler

* replay() -> inspect_replay()

* modify macro, comment out anvil related cast tests for the time being

* reapply state depth = 1

* something like this?

* introduce outer block for early return

* print debugging

* clean up

* fix merge

* migrate: anvil to revm 21 (#10361)

* downgrade op-revm to 2.0.0 to resolve dep conflict

* op-revm 3.0 uses revm 22

* add `as_mut_dyn` to trait `MaybeFullDatabase` as we now require mut db_ref access (

* Revert "add `as_mut_dyn` to trait `MaybeFullDatabase` as we now require mut db_ref access ("

This reverts commit 84d11f1742df768d773253de216a223a7d4683e6.

* fix: Inspector should be generic over CTX not DB

* fixes helpers: new_evm_with_inspector_* to use CTX generic

* fix: pass TxEnv to evm.transact

* fix: inspector inference in TransactionExecutor and build_access_list_with_state

* workaround: dup LogCollector to use with AnvilEvmContext

* coz FoundryEvmContext is not generic over DB, instead hardoded to dyn DatabaseExt

* fix tests

* fix traces test

* fix: use default kzg settings in blob validation

* reintroduce OptimismHardfork

* fix: disable nonce check if nonce is None

* fix!: load state tests by addressing breaking changes in state files

* BlockEnv Breaking change:
- most fields now use `u64` instead of `U64` / `U256`
- coinbase renamed to beneficiary
- best_block_number is `u64`, prev `U64`

* fix: access_list test by using evm.inspect_with_tx

* fix: replace evm.transact with evm.inspect_with_tx

* fix: make impl Inspector for AnvilInspector generic over CTX

* fix: clone inspector in TransactionExecutor to enable evm.inspect_commit

* fix: remove cloned inspector from TransactionExecutor

* feat(`anvil`): op support revm 21 (#10407)

* enable OpHardforks in NodeConfig

* feat: add is_optimism flag to foundry_evm::Env

* feat(`anvil`): set is_optimism in Backend

* feat(`anvil`): introducing EvmContext enum holding Eth and Op variants.

* adds OpEnv to foundry_evm_core

* feat: EitherEvm

* impl Evm for EitherEvm

* integrate EitherEvm into RPC and executor

*Map OpHaltReason and OpTransactionError

* rm old evm helpers

* feat(`foundry_evm`): add deposit tx parts field to Env

* fix(`anvil`): set deposit tx parts in tx executor and backend.inspect_tx

* nit

* docs EitherEvm

* nit

* refac: return TxEnv and Deposit parts separately

* nits

* nit

* make anvil result aliases more generic

* nit

* intermediary(`revm bump`): re-enable Anvil tests, remove duplicate `LogCollector`, entire codebase builds (#10412)

* temp refactor, still facing issue

* clean up

* clean up

* temp cleanup, can later be refd

* clean up, refactor stack.rs to apply ecx restore from cache to outside lamba

* fix

* clean up

* clean up

* avoid borrowing mutably for clarity

* use EthEvmContext directly

* FoundryEvmContext -> EthEvmContext

* continue

* fix tests

* fix inspectors

* codebase now builds entirely

* fix clippy lints

* remove duplicate LogCollector in Anvil

* fmt

* fix clippy

* fix doctests

* disable nonce checks on forks, enforce setting of tx.nonce on set_nonce

* fix: use `transact` from alloy-evm (#10417)

* Patch revm to fix interpreter panic

* bump revm

* fix eof test

* fix bytecode hash

* fix fixture

* fix fixture

* fix fixture

* chore: mv EitherEvm to foundry_evm (#10445)

mv EitherEvm to foundry_evm_core

* remove unused JournalTr

* restore formatting, avoid diff

* remove leftover comment re: optimism support

* fix displays_chained_error test

* fix doc test

* remove optimism todo leftover

* avoid direct field assignment, prefer *current.

* create2 handler register

* fix patch

* fix test_broadcast_raw_create2_deployer

* bump alloy and related deps

apply patches for block-explorers and compilers

* fix: common

* fix gas meter test

* fix

* fix: ConsoleFmt proc_macro

* more fixes

* fix: validate bool removal from abi_decode_*

* fix: use take_slice instead of take_slice_unchecked in Decoder

* fix more validate bool removal

* correctly reset env.tx to cached env, cfg and block, ref https://github.com/foundry-rs/foundry/blob/a34f4c989b94f572497631ff5c85909d674c23a6/crates/evm/evm/src/inspectors/stack.rs#L640-L649

* address more alloy-core 1.0 breaking changes

* fix anvil

* exec_create

* fix cast

* bump gcloudsdk in wallets

* fix(`cheatcodes`): rand workaround
Use ChaChaRng as temporary measure since proptest is on rand 8

* revert test_GasMeter, assert exact gas used

* fix arbitrum test

* address deprecations

* doc test fixes

* fix clippy warnings

* remove leftover comment

* fix assert_can_detect_unlinked_target_with_libraries, ref: https://github.com/bluealloy/revm/commit/fc54dd087ba9a96291b1130bc8be73ade5d01ea5

* fix gas metering tests

* restore unintended .wrap_err changes, ref: https://github.com/search?q=repo%3Afoundry-rs%2Ffoundry%20wrap_err(%22EVM%20error%22)&type=code

* fix test_cheats_local_default

* add CC0-1.0 license exception, has been previously approved in Reth: https://github.com/paradigmxyz/reth/blob/adb8bdc70758558d6122e87d78d73cc0f12d4dbb/deny.toml#L48

* usize depth

* repin foundry-fork-db, this aligns the revm and alloy version back

* fix clippy, after usize depth change

* allow foundry-fork-db as git exception

* revm 23

* fix: EitherEvm should work over OpTransaction

* bump compilers and explorers

* fix fmt

* Env::from_with_spec_id -> Env::new_with_spec_id

* bump clippy msrv to align with foundry.toml

* chore: avoid leaking Anvil specific optimism fields into evm/core (#10466)

* start sketching

* maybe ?

* some kind of conversion still required

* continue porting

* clean up types

* pass op transaction in directly

* fixes

* restore setting of enveloped_tx

* refactor anvil Env and reduce changes in tx processing

* apply revm bump fixes, solar fixes

* bump op-alloy-*

* bump to msrv 1.86 for solar, use 0.15.* for alloy instead of pinning to 0.15.0, use alloy-evm patch for .use_ref() issue

* fix: correctly set txtype when setting up TxEnv

* start upgrading to revm 23

* bump PR to be revm 23+ compatible

* fix: correctly set txtype when setting up TxEnv

* fix: correctly set txtype when setting up TxEnv

* clean up

* fix merge conflict, apply fixes from upstream

* bump to 0.7.2

* fix order

* update block-explorers and compilers

* fix clippy

* fix failing abi test

* empty

* integrate BlobParams into anvil

* fix tests

* fix cast decode-event

* fix tests

* fix colored_traces

* fix gas pausing

* fix tests

* fix test

* update last commits from master to be u64 compatible

* syn no longer implements PartialEq requiring us to use `matches!`

* temp comment out journal push loop

* fix clippy lint

* revert clippy changes, make sure lint-foundry uses nightly clippy version

* also assert that blob_count is less than the configured max_blob_count

* fix: only upgrade tx_type to eip-2930 (type 1) if it is a legacy tx

* optimistically remove previous workaround that was required for internal tracking, tests do not indicate it is longer required

* nit

* prefer using typed TransactionType over raw u8

* apply tx_type if set, upgrading from legacy to eip2930 if access_list is present and tx type is legacy

* restore #[ret] macro that was removed unintendedly

* replace redundant Env::new_with_spec_id(..) with default

* allow passing is_optimism into Env constructor specific to Anvil

* extract environment configuration into init.rs to make configuring the environment less error prone

* remove redundant debug derive

* restore #[cold] do hardhat log, previously preferred inline because of new context requirement for bytes but we refactor resolved this

* avoid code duplication, add documented `apply_accesslist`

* alloy 1.0 + fork-db 0.14 + op-alloy 0.16 + revm-insp 0.22 + block-explorers 0.17

* fix clippy

* Update crates/evm/evm/src/inspectors/logs.rs

Co-authored-by: Arsenii Kulikov <[email protected]>

* fix fmt

* set env tx type by deriving tx type from other fields if no transaction_type has been set

* use hardfork configured max_blob_count rather than hardcoded Dancun in assertion and error message

* add temporary workaround for failing StdChains test because eth.llamarpc.com is down

* bump(`revm`: step 3): reintroduce precompile injection (#10508)

* sketching

* sketch

* sketch

* restore test

* add echo precompile test

* pick a safe non precompile target outside of 0x00-0xff range

* add op evm test

* instead of activating all precompiles by default we activate selectively based on the spec defined

* add note for us pinning to OpSpecId::BEDROCK here, we should make this configurable

* bump deps to latest

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: Arsenii Kulikov <[email protected]>
Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: grandizzy <[email protected]>

* feat(foundry-cli::utils): add support for mimalloc and tracy-allocator (#10545)

- Introduced `mimalloc` as an optional allocator.
- Added `tracy-allocator` support for profiling memory allocations.
- Updated global allocator logic to conditionally use `jemalloc` (default) or `mimalloc`.
- Modified `anvil`, `cast`, `chisel` and `forge` crates to include new features.
These new features are inspired from Reth and Solar projects.

Co-authored-by: grandizzy <[email protected]>

* fix(fmt): 'at' is not a keyword (#10556)

* chore(deps): weekly `cargo update` (#10497)

* chore(deps): weekly `cargo update`

    Updating git repository `https://github.com/bluealloy/revm.git`
     Locking 85 packages to latest compatible versions
    Updating alloy-chains v0.2.0 -> v0.2.1
    Updating alloy-consensus v1.0.3 -> v1.0.4
    Updating alloy-consensus-any v1.0.3 -> v1.0.4
    Updating alloy-contract v1.0.3 -> v1.0.4
    Updating alloy-eip7702 v0.6.0 -> v0.6.1
    Updating alloy-eips v1.0.3 -> v1.0.4
    Updating alloy-genesis v1.0.3 -> v1.0.4
    Updating alloy-hardforks v0.2.0 -> v0.2.2
    Updating alloy-json-rpc v1.0.3 -> v1.0.4
    Updating alloy-network v1.0.3 -> v1.0.4
    Updating alloy-network-primitives v1.0.3 -> v1.0.4
    Updating alloy-op-hardforks v0.2.0 -> v0.2.2
    Updating alloy-provider v1.0.3 -> v1.0.4
    Updating alloy-pubsub v1.0.3 -> v1.0.4
    Updating alloy-rlp v0.3.11 -> v0.3.12
    Updating alloy-rlp-derive v0.3.11 -> v0.3.12
    Updating alloy-rpc-client v1.0.3 -> v1.0.4
    Updating alloy-rpc-types v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-anvil v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-any v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-debug v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-engine v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-eth v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-trace v1.0.3 -> v1.0.4
    Updating alloy-rpc-types-txpool v1.0.3 -> v1.0.4
    Updating alloy-serde v1.0.3 -> v1.0.4
    Updating alloy-signer v1.0.3 -> v1.0.4
    Updating alloy-signer-aws v1.0.3 -> v1.0.4
    Updating alloy-signer-gcp v1.0.3 -> v1.0.4
    Updating alloy-signer-ledger v1.0.3 -> v1.0.4
    Updating alloy-signer-local v1.0.3 -> v1.0.4
    Updating alloy-signer-trezor v1.0.3 -> v1.0.4
    Updating alloy-transport v1.0.3 -> v1.0.4
    Updating alloy-transport-http v1.0.3 -> v1.0.4
    Updating alloy-transport-ipc v1.0.3 -> v1.0.4
    Updating alloy-transport-ws v1.0.3 -> v1.0.4
    Updating aws-config v1.6.2 -> v1.6.3
    Updating aws-sdk-kms v1.68.0 -> v1.69.0
    Updating aws-sdk-sso v1.67.0 -> v1.68.0
    Updating aws-sdk-ssooidc v1.68.0 -> v1.69.0
    Updating aws-sdk-sts v1.68.0 -> v1.69.0
    Updating aws-sigv4 v1.3.1 -> v1.3.2
   Unchanged axum v0.7.9 (available: v0.8.4)
    Updating bitflags v2.9.0 -> v2.9.1
    Updating cc v1.2.22 -> v1.2.23
    Updating const-hex v1.14.0 -> v1.14.1
   Unchanged crossterm v0.28.1 (available: v0.29.0)
      Adding displaydoc v0.2.5
    Updating errno v0.3.11 -> v0.3.12
    Updating faster-hex v0.9.0 -> v0.10.0
   Unchanged gcloud-sdk v0.26.4 (available: v0.27.1)
    Updating generator v0.8.4 -> v0.8.5
    Updating gix-actor v0.33.2 -> v0.35.1
    Updating gix-config v0.42.0 -> v0.45.1
    Updating gix-config-value v0.14.12 -> v0.15.0
    Updating gix-date v0.9.4 -> v0.10.2
    Updating gix-features v0.39.1 -> v0.42.1
    Updating gix-fs v0.12.1 -> v0.15.0
    Updating gix-glob v0.17.1 -> v0.20.1
    Updating gix-hash v0.15.1 -> v0.18.0
    Updating gix-hashtable v0.6.0 -> v0.8.1
    Updating gix-lock v15.0.1 -> v17.1.0
    Updating gix-object v0.46.1 -> v0.49.1
    Updating gix-ref v0.49.1 -> v0.52.1
    Updating gix-sec v0.10.12 -> v0.11.0
    Updating gix-tempfile v15.0.0 -> v17.1.0
    Updating gix-utils v0.1.14 -> v0.3.0
    Removing gix-validate v0.9.4
      Adding hash32 v0.3.1
      Adding heapless v0.8.0
   Unchanged idna_adapter v1.1.0 (available: v1.2.1)
    Updating ignore-files v3.0.3 -> v3.0.4
      Adding libz-rs-sys v0.5.0
   Unchanged matchit v0.8.4 (available: v0.8.6)
    Updating owo-colors v4.2.0 -> v4.2.1
    Updating process-wrap v8.2.0 -> v8.2.1
    Updating project-origins v1.4.1 -> v1.4.2
   Unchanged protobuf v3.3.0 (available: v3.7.2)
   Unchanged protobuf-support v3.3.0 (available: v3.7.2)
   Unchanged rand v0.8.5 (available: v0.9.1)
      Adding sha1-checked v0.10.0
    Removing sha1_smol v1.0.1
   Unchanged vergen v8.3.2 (available: v9.0.6)
   Unchanged watchexec v6.0.0 (available: v8.0.1)
    Updating watchexec-events v5.0.0 -> v5.0.1 (available: v6.0.0)
   Unchanged watchexec-signals v4.0.1 (available: v5.0.0)
    Removing windows v0.58.0
    Removing windows v0.59.0
      Adding windows v0.61.1
      Adding windows-collections v0.2.0
    Removing windows-core v0.58.0
    Removing windows-core v0.59.0
      Adding windows-core v0.61.1
      Adding windows-future v0.2.1
    Removing windows-implement v0.58.0
    Removing windows-implement v0.59.0
      Adding windows-implement v0.60.0
    Removing windows-interface v0.58.0
      Adding windows-numerics v0.2.0
    Removing windows-result v0.2.0
    Removing windows-result v0.3.2
      Adding windows-result v0.3.3
    Updating windows-strings v0.1.0 -> v0.4.1
      Adding windows-threading v0.1.0
    Removing winnow v0.6.26
    Removing zip v2.6.1
      Adding zip v2.4.2
      Adding zip v3.0.0
      Adding zlib-rs v0.5.0
note: to see how you depend on a package, run `cargo tree --invert --package <dep>@<ver>`

* fix: dedup zip dep

* chore: bump gcloud-sdk, axum, watchexec

* fix: breaking changes

Co-Authored-By: getong <[email protected]>

* fix: pin zip-extract to 0.2.1 instead

---------

Co-authored-by: DaniPopes <[email protected]>
Co-authored-by: getong <[email protected]>

* test: increase retry delay from 3s to 5s (#10559)

* chore: rm dead file (#10560)

* fix(`revm bump`): re-add `P256` precompile injection for `forge` / `cast` (#10555)

* chore: add `redundant_imports` rust lint (#10486)

* add redundant_imports rust lint

* add back unreachable pub commented out

* fix fmt + clippy

---------

Co-authored-by: grandizzy <[email protected]>

* fix(`forge bind`): add `serde` as a dependency to generated `Cargo.toml` if `Serde` is being derived in bindings (#10563)

add `serde` as a dependency to `Cargo.toml` if Serde is being derived so bindings compile out of the box

* chore: remove additional `EOF` leftovers (#10506)

* remove eof leftovers

* remove eof

* clean up EOF leftovers

* fix build issues, remove PragueEOF

* restore cancun as latest

* fix merge conflict

* chore: bump alloy 1.0.5 (#10568)

* fix(`anvil`): inject the P256 precompile for `--odyssey` upon EVM construction and fix `NotActivated` error for `--optimism` (#10567)

* inject the P256 precompile for Odyssey upon EVM construction

* apply fix for Optimism `NotActivated` bug, add Isthmus support

* use Isthmus for tests, do not pin to `--evm-version paris`

* fix clippy

* chore: Simplifing mined_logs_for_block filter (#10572)

* chore: Simplifing mined_logs_for_block filter

* fmt

* fmt

* forge(fix): update persistent storage from active db (#10576)

* forge(fix): update persistent storage from active db

* Clippy

* chore: avoid unnecessary use of `inspector_mut`, `precompiles_mut` in precompile injection (#10578)

* chore: bump version to 1.2.1 (#10580)

* chore: replaced anvil DepositTransaction with just op_alloy::TxDeposit (#10480)

* chore: replaced anvil DepositTransaction with just op_alloy::TxDeposit

* fixes

* fixes

* fixes

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>

* feat(anvil): add block context overrides for eth_call and eth_estimateGas (#10487)

* feat(anvil): add block context overrides for eth_call and eth_estimateGas

This commit implements block context overrides for eth_call and eth_estimateGas RPC methods,
allowing users to specify block parameters like timestamp, number, difficulty, etc. for call
execution context.

Key changes:
- BlockOverrides added to EthRequest enum variants for eth_call and eth_estimateGas
- Block overrides handling implemented in `anvil::eth::backend::mem::state` as `apply_block_overrides()` function (ported from reth)
- Add new error type EvmOverrideError to group state and block override related errors (due to fork mode)
- State override handling refactored:
  - Rename `apply_cached_db_state_override()` to `apply_state_overrides()`
  - Modify to take mutable `CacheDB` reference instead of creating new instance
  - Consistent pattern for `apply_state_overrides()` and `apply_block_overrides()`

* fix fmt

* test: add block number override test

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>

* feat(forge): revert diagnostic inspector (#10446)

* chore: revert diagnostic inspector

* style: clippy + fmt

* style: more readable code + docs

* fix: track call stack depth + EXTCODESIZE checks

* chore(traces decoder): non-supported fn selector call

* disable diagnostic revert when verbosity < '-vvv'

* fix: do not warm address

* fix: call inspector

* fix: config revert diag with `fn tracing()`

* improve docs + make diagnostics more restrictive

* inject revert reason directly into interpreter

* style: clippy + fmt

* integrate new revm version

* style: nits

* chore(cast): upgrade evmole to 0.8.0 (#10585)

* chore(ens): replacing common::ens with the alloy_ens crate. (#10584)

* chore(ens): replacing common::ens with the alloy_ens crate.

* reformat.

* add default feature.

* chore: update lockfile (#10587)

* feat: add cast da-estimate (#10588)

* feat: add cast da-estimate

* use sh-println

* ci: use Optimism mainnet instead of DRPC due to limits (#10592)

use Optimism mainnet instead of DRPC due to limits

* fix: `vm.chainId` regression in isolation mode on `nightly` post `revm` bump (#10589)

* reapply refactor

* reset env

* add repro

* add isolation test into repro

* add previous trace for comparison

* nit remove unused event

* move ecx as_db_env_and_journal into with_stack and resets as well

* revert to use *env directly

* fix: refactor `step` and `step_end` for clarity (#10590)

* fix: refactor `step` and `step_end` for clarity

* fix: mark fns as cold

* feat(forge): forge lint (#10405)

* add lint cmd, variable lints

* wip

* wip

* wip

* wip

* wip

* wip

* add keccak256 opt test

* wip

* wip

* wip

* wip

* fix div before mul

* update lint args

* wip

* update declare lints macro

* update with_severity

* configure linter

* wip

* update hash value

* fix read in source

* rayon

* reorder lint declarations

* clippy

* add placeholder for additional lints

* more placeholders

* wip

* wip

* refactor into sol linter

* impl Linter for SolidityLinter

* fmt

* wip

* wip

* refactor lints into SolLint enum

* update lint trait

* wip

* wip

* wip

* wip

* wip

* update lint

* update forge lint to use ProjectLinter

* wip

* include/exclude files from linting

* linter output display note

* configure with severity and description

* fmt

* implementing display

* wip

* wip

* implement display for linter…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge T-feature Type: feature
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

feat: add vm.getChain cheatcodes to get chain info
3 participants