diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml
index 8a2e3198c02eb..bd9e19fc21db3 100644
--- a/.github/workflows/cross-platform.yml
+++ b/.github/workflows/cross-platform.yml
@@ -183,7 +183,7 @@ jobs:
if: matrix.nextest.name != 'non-forking'
with:
path: "$HOME/.foundry/cache"
- key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
+ key: rpc-cache-${{ hashFiles('crates/forge/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
diff --git a/.github/workflows/deny.yml b/.github/workflows/deny.yml
index ca2d98dfa936c..9fac75ef56019 100644
--- a/.github/workflows/deny.yml
+++ b/.github/workflows/deny.yml
@@ -21,5 +21,5 @@ jobs:
with:
command: check all
# Clear out arguments to not pass `--all-features` to `cargo deny`.
- # `foundry-cli` has an `openssl` feature which enables banned dependencies
+ # many crates have an `openssl` feature which enables banned dependencies
arguments: ""
diff --git a/.github/workflows/heavy-integration.yml b/.github/workflows/heavy-integration.yml
index 3a6e8df7873ed..e051e706bc81d 100644
--- a/.github/workflows/heavy-integration.yml
+++ b/.github/workflows/heavy-integration.yml
@@ -18,7 +18,7 @@ jobs:
archive:
- name: heavy-integration-tests
file: heavy-integration.tar.zst
- flags: -p foundry-cli --features heavy-integration-tests
+ flags: -p forge --features heavy-integration-tests
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
@@ -75,7 +75,7 @@ jobs:
if: matrix.job.name != 'non-forking'
with:
path: "$HOME/.foundry/cache"
- key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
+ key: rpc-cache-${{ hashFiles('crates/forge/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
@@ -100,4 +100,4 @@ jobs:
WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
update_existing: true
- filename: .github/INTEGRATION_FAILURE.md
\ No newline at end of file
+ filename: .github/INTEGRATION_FAILURE.md
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index b40401634c167..bb89338c160f2 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -24,7 +24,7 @@ jobs:
flags: --workspace
- name: external-integration-tests
file: nextest-external-integration.tar.zst
- flags: -p foundry-cli --features external-integration-tests
+ flags: -p forge --features external-integration-tests
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
@@ -110,7 +110,7 @@ jobs:
if: matrix.job.name != 'issue-repros'
with:
path: "$HOME/.foundry/cache"
- key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
+ key: rpc-cache-${{ hashFiles('crates/forge/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
@@ -147,7 +147,7 @@ jobs:
if: matrix.job.name != 'forge-std-test'
with:
path: "$HOME/.foundry/cache"
- key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
+ key: rpc-cache-${{ hashFiles('crates/forge/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
@@ -187,7 +187,7 @@ jobs:
if: matrix.job.name != 'non-forking'
with:
path: "$HOME/.foundry/cache"
- key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
+ key: rpc-cache-${{ hashFiles('crates/forge/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
git config --global user.name "GitHub Actions Bot"
@@ -226,7 +226,7 @@ jobs:
if: matrix.job.name != 'non-forking'
with:
path: "$HOME/.foundry/cache"
- key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }}
+ key: rpc-cache-${{ hashFiles('crates/forge/tests/rpc-cache-keyfile') }}
- name: Setup git config
run: |
diff --git a/Cargo.lock b/Cargo.lock
index feb63032a4f4a..1ac2a96a23d8d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -175,7 +175,7 @@ dependencies = [
"axum",
"bytes",
"chrono",
- "clap 4.3.21",
+ "clap",
"clap_complete",
"clap_complete_fig",
"crc 3.0.1",
@@ -185,7 +185,6 @@ dependencies = [
"ethers-solc",
"fdlimit",
"flate2",
- "forge",
"foundry-common",
"foundry-config",
"foundry-evm",
@@ -193,7 +192,7 @@ dependencies = [
"futures",
"hash-db",
"hyper",
- "itertools",
+ "itertools 0.11.0",
"memory-db",
"parking_lot",
"pretty_assertions",
@@ -246,7 +245,7 @@ dependencies = [
"async-trait",
"axum",
"bytes",
- "clap 4.3.21",
+ "clap",
"futures",
"hyper",
"parity-tokio-ipc",
@@ -306,7 +305,7 @@ dependencies = [
"ark-std 0.4.0",
"derivative",
"digest 0.10.7",
- "itertools",
+ "itertools 0.10.5",
"num-bigint",
"num-traits",
"paste",
@@ -478,17 +477,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8ab6b55fe97976e46f91ddbed8d147d966475dc29b2032757ba47e02376fbc3"
-[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi 0.1.19",
- "libc",
- "winapi",
-]
-
[[package]]
name = "auto_impl"
version = "1.1.0"
@@ -805,27 +793,44 @@ name = "cast"
version = "0.2.0"
dependencies = [
"async-trait",
+ "bytes",
"chrono",
+ "clap",
+ "clap_complete",
+ "clap_complete_fig",
+ "comfy-table",
"const-hex",
- "ethers-contract",
+ "criterion",
+ "dunce",
+ "eth-keystore",
+ "ethers",
"ethers-core",
"ethers-etherscan",
"ethers-providers",
- "ethers-signers",
"evm-disassembler",
"eyre",
+ "foundry-cli",
"foundry-common",
"foundry-config",
"foundry-evm",
+ "foundry-test-utils",
"foundry-utils",
"futures",
+ "indicatif",
+ "itertools 0.11.0",
"rayon",
+ "regex",
+ "rpassword",
"rusoto_core",
"rusoto_kms",
+ "semver 1.0.18",
"serde",
"serde_json",
- "thiserror",
+ "tempfile",
"tokio",
+ "tracing",
+ "vergen",
+ "yansi 0.5.1",
]
[[package]]
@@ -855,13 +860,12 @@ name = "chisel"
version = "0.2.0"
dependencies = [
"bytes",
- "clap 4.3.21",
+ "clap",
"criterion",
"dirs 5.0.1",
"ethers",
"ethers-solc",
"eyre",
- "forge",
"forge-fmt",
"foundry-cli",
"foundry-common",
@@ -934,18 +938,6 @@ dependencies = [
"inout",
]
-[[package]]
-name = "clap"
-version = "3.2.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
-dependencies = [
- "bitflags 1.3.2",
- "clap_lex 0.2.4",
- "indexmap 1.9.3",
- "textwrap",
-]
-
[[package]]
name = "clap"
version = "4.3.21"
@@ -965,7 +957,7 @@ checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa"
dependencies = [
"anstream",
"anstyle",
- "clap_lex 0.5.0",
+ "clap_lex",
"once_cell",
"strsim",
"terminal_size",
@@ -979,7 +971,7 @@ version = "4.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce"
dependencies = [
- "clap 4.3.21",
+ "clap",
]
[[package]]
@@ -988,7 +980,7 @@ version = "4.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99fee1d30a51305a6c2ed3fc5709be3c8af626c9c958e04dd9ae94e27bcbce9f"
dependencies = [
- "clap 4.3.21",
+ "clap",
"clap_complete",
]
@@ -1004,15 +996,6 @@ dependencies = [
"syn 2.0.28",
]
-[[package]]
-name = "clap_lex"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
-dependencies = [
- "os_str_bytes",
-]
-
[[package]]
name = "clap_lex"
version = "0.5.0"
@@ -1285,20 +1268,20 @@ dependencies = [
[[package]]
name = "criterion"
-version = "0.4.0"
+version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb"
+checksum = "f2b12d017a929603d80db1831cd3a24082f8137ce19c69e6447f54f5fc8d692f"
dependencies = [
"anes",
- "atty",
"cast 0.3.0",
"ciborium",
- "clap 3.2.25",
+ "clap",
"criterion-plot",
"futures",
- "itertools",
- "lazy_static",
+ "is-terminal",
+ "itertools 0.10.5",
"num-traits",
+ "once_cell",
"oorandom",
"plotters",
"rayon",
@@ -1318,7 +1301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
dependencies = [
"cast 0.3.0",
- "itertools",
+ "itertools 0.10.5",
]
[[package]]
@@ -1907,7 +1890,7 @@ dependencies = [
[[package]]
name = "ethers"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"ethers-addressbook",
"ethers-contract",
@@ -1922,7 +1905,7 @@ dependencies = [
[[package]]
name = "ethers-addressbook"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"ethers-core",
"once_cell",
@@ -1933,7 +1916,7 @@ dependencies = [
[[package]]
name = "ethers-contract"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"const-hex",
"ethers-contract-abigen",
@@ -1952,7 +1935,7 @@ dependencies = [
[[package]]
name = "ethers-contract-abigen"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"Inflector",
"const-hex",
@@ -1975,7 +1958,7 @@ dependencies = [
[[package]]
name = "ethers-contract-derive"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"Inflector",
"const-hex",
@@ -1990,7 +1973,7 @@ dependencies = [
[[package]]
name = "ethers-core"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"arrayvec",
"bytes",
@@ -2019,7 +2002,7 @@ dependencies = [
[[package]]
name = "ethers-etherscan"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"ethers-core",
"ethers-solc",
@@ -2034,7 +2017,7 @@ dependencies = [
[[package]]
name = "ethers-middleware"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"async-trait",
"auto_impl",
@@ -2060,7 +2043,7 @@ dependencies = [
[[package]]
name = "ethers-providers"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"async-trait",
"auto_impl",
@@ -2098,7 +2081,7 @@ dependencies = [
[[package]]
name = "ethers-signers"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"async-trait",
"coins-bip32",
@@ -2125,7 +2108,7 @@ dependencies = [
[[package]]
name = "ethers-solc"
version = "2.0.8"
-source = "git+https://github.com/gakonst/ethers-rs#50a684ce47dd31d597d55546548acc76fc3d4074"
+source = "git+https://github.com/gakonst/ethers-rs#fa3017715a298728d9fb341933818a5d0d84c2dc"
dependencies = [
"cfg-if",
"const-hex",
@@ -2326,27 +2309,53 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
name = "forge"
version = "0.2.0"
dependencies = [
+ "anvil",
+ "async-trait",
+ "bytes",
+ "clap",
+ "clap_complete",
+ "clap_complete_fig",
"comfy-table",
"const-hex",
+ "criterion",
+ "dialoguer",
+ "dunce",
"ethers",
"eyre",
+ "forge-doc",
+ "forge-fmt",
+ "foundry-cli",
"foundry-common",
"foundry-config",
"foundry-evm",
+ "foundry-test-utils",
"foundry-utils",
- "glob",
+ "futures",
+ "globset",
+ "indicatif",
+ "itertools 0.11.0",
"once_cell",
"parking_lot",
+ "path-slash",
+ "pretty_assertions",
"proptest",
"rayon",
"regex",
- "rlp",
+ "reqwest",
"semver 1.0.18",
"serde",
"serde_json",
+ "serial_test",
+ "similar",
+ "solang-parser",
+ "strum 0.25.0",
+ "svm-rs",
+ "thiserror",
"tokio",
"tracing",
- "tracing-subscriber",
+ "ui",
+ "vergen",
+ "watchexec",
"yansi 0.5.1",
]
@@ -2355,17 +2364,15 @@ name = "forge-doc"
version = "0.2.0"
dependencies = [
"auto_impl",
- "clap 4.3.21",
"derive_more",
"ethers-core",
"ethers-solc",
"eyre",
"forge-fmt",
- "foundry-common",
"foundry-config",
"foundry-utils",
"futures-util",
- "itertools",
+ "itertools 0.11.0",
"mdbook",
"once_cell",
"rayon",
@@ -2386,9 +2393,8 @@ dependencies = [
"ariadne",
"ethers-core",
"foundry-config",
- "itertools",
+ "itertools 0.11.0",
"pretty_assertions",
- "semver 1.0.18",
"solang-parser",
"thiserror",
"toml 0.7.6",
@@ -2437,91 +2443,42 @@ dependencies = [
name = "foundry-cli"
version = "0.2.0"
dependencies = [
- "anvil",
"async-trait",
- "bytes",
- "cast 0.2.0",
- "clap 4.3.21",
- "clap_complete",
- "clap_complete_fig",
+ "clap",
"color-eyre",
- "comfy-table",
"const-hex",
- "criterion",
- "dialoguer",
"dotenvy",
- "dunce",
- "eth-keystore",
"ethers",
"eyre",
- "forge",
- "forge-doc",
- "forge-fmt",
- "foundry-cli-test-utils",
"foundry-common",
"foundry-config",
"foundry-evm",
- "foundry-utils",
- "futures",
- "globset",
"indicatif",
- "itertools",
+ "itertools 0.11.0",
"once_cell",
- "parking_lot",
- "path-slash",
- "pretty_assertions",
- "proptest",
- "rayon",
"regex",
- "reqwest",
"rpassword",
- "semver 1.0.18",
+ "rusoto_core",
+ "rusoto_kms",
"serde",
- "serde_json",
- "serial_test",
- "similar",
- "solang-parser",
"strsim",
"strum 0.25.0",
- "svm-rs",
"tempfile",
"thiserror",
"tokio",
- "toml 0.7.6",
"tracing",
"tracing-error",
"tracing-subscriber",
"ui",
- "vergen",
- "walkdir",
- "watchexec",
"yansi 0.5.1",
]
-[[package]]
-name = "foundry-cli-test-utils"
-version = "0.2.0"
-dependencies = [
- "ethers",
- "ethers-solc",
- "eyre",
- "foundry-common",
- "foundry-config",
- "once_cell",
- "parking_lot",
- "pretty_assertions",
- "regex",
- "serde_json",
- "tempfile",
- "walkdir",
-]
-
[[package]]
name = "foundry-common"
version = "0.2.0"
dependencies = [
"auto_impl",
- "clap 4.3.21",
+ "clap",
"comfy-table",
"dunce",
"ethers-core",
@@ -2594,7 +2551,7 @@ dependencies = [
"foundry-utils",
"futures",
"hashbrown 0.13.2",
- "itertools",
+ "itertools 0.11.0",
"jsonpath_lib",
"once_cell",
"ordered-float",
@@ -2632,6 +2589,24 @@ dependencies = [
"syn 2.0.28",
]
+[[package]]
+name = "foundry-test-utils"
+version = "0.2.0"
+dependencies = [
+ "ethers",
+ "ethers-solc",
+ "eyre",
+ "foundry-common",
+ "foundry-config",
+ "once_cell",
+ "parking_lot",
+ "pretty_assertions",
+ "regex",
+ "serde_json",
+ "tempfile",
+ "walkdir",
+]
+
[[package]]
name = "foundry-utils"
version = "0.2.0"
@@ -2641,7 +2616,6 @@ dependencies = [
"ethers-addressbook",
"ethers-contract",
"ethers-core",
- "ethers-etherscan",
"ethers-providers",
"ethers-solc",
"eyre",
@@ -2652,11 +2626,7 @@ dependencies = [
"once_cell",
"pretty_assertions",
"rand 0.8.5",
- "reqwest",
- "rlp",
- "serde",
"serde_json",
- "tokio",
"tracing",
]
@@ -3251,15 +3221,6 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "hermit-abi"
version = "0.3.2"
@@ -3642,7 +3603,7 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
dependencies = [
- "hermit-abi 0.3.2",
+ "hermit-abi",
"libc",
"windows-sys 0.48.0",
]
@@ -3659,7 +3620,7 @@ version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
dependencies = [
- "hermit-abi 0.3.2",
+ "hermit-abi",
"rustix 0.38.8",
"windows-sys 0.48.0",
]
@@ -3673,6 +3634,15 @@ dependencies = [
"either",
]
+[[package]]
+name = "itertools"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itoa"
version = "1.0.9"
@@ -3787,7 +3757,7 @@ dependencies = [
"diff",
"ena",
"is-terminal",
- "itertools",
+ "itertools 0.10.5",
"lalrpop-util",
"petgraph",
"regex",
@@ -3981,7 +3951,7 @@ dependencies = [
"ammonia",
"anyhow",
"chrono",
- "clap 4.3.21",
+ "clap",
"clap_complete",
"elasticlunr-rs",
"env_logger",
@@ -4299,7 +4269,7 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
- "hermit-abi 0.3.2",
+ "hermit-abi",
"libc",
]
@@ -4461,12 +4431,6 @@ dependencies = [
"num-traits",
]
-[[package]]
-name = "os_str_bytes"
-version = "6.5.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac"
-
[[package]]
name = "overload"
version = "0.1.1"
@@ -6232,7 +6196,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c792fe9fae2a2f716846f214ca10d5a1e21133e0bf36cef34bcc4a852467b21"
dependencies = [
- "itertools",
+ "itertools 0.10.5",
"lalrpop",
"lalrpop-util",
"phf 0.11.2",
@@ -6506,12 +6470,6 @@ dependencies = [
"phf_codegen 0.11.2",
]
-[[package]]
-name = "textwrap"
-version = "0.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
-
[[package]]
name = "thiserror"
version = "1.0.44"
@@ -7074,12 +7032,11 @@ checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
name = "ui"
version = "0.2.0"
dependencies = [
- "const-hex",
"crossterm 0.26.1",
"ethers",
"eyre",
- "forge",
"foundry-common",
+ "foundry-evm",
"revm",
"tui",
]
diff --git a/Cargo.toml b/Cargo.toml
index 66a72314887e6..cf1d5d3e4a37f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -96,21 +96,23 @@ codegen-units = 16
package = {}
[workspace.dependencies]
-foundry-abi = { path = "crates/abi" }
anvil = { path = "crates/anvil" }
-foundry-binder = { path = "crates/binder" }
cast = { path = "crates/cast" }
chisel = { path = "crates/chisel" }
+forge = { path = "crates/forge" }
+
+forge-doc = { path = "crates/doc" }
+forge-fmt = { path = "crates/fmt" }
+foundry-abi = { path = "crates/abi" }
+foundry-binder = { path = "crates/binder" }
foundry-cli = { path = "crates/cli" }
foundry-common = { path = "crates/common" }
foundry-config = { path = "crates/config" }
-forge-doc = { path = "crates/doc" }
foundry-evm = { path = "crates/evm" }
-forge-fmt = { path = "crates/fmt" }
-forge = { path = "crates/forge" }
foundry-macros = { path = "crates/macros" }
-ui = { path = "crates/ui" }
+foundry-test-utils = { path = "crates/test-utils" }
foundry-utils = { path = "crates/utils" }
+ui = { path = "crates/ui" }
ethers = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
ethers-addressbook = { git = "https://github.com/gakonst/ethers-rs", default-features = false }
@@ -125,6 +127,7 @@ ethers-solc = { git = "https://github.com/gakonst/ethers-rs", default-features =
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
hex = { package = "const-hex", version = "1.6", features = ["hex"] }
+itertools = "0.11"
solang-parser = "=0.3.1"
#[patch."https://github.com/gakonst/ethers-rs"]
diff --git a/crates/abi/src/lib.rs b/crates/abi/src/lib.rs
index 3fad9673e5be5..16dcdd1365185 100644
--- a/crates/abi/src/lib.rs
+++ b/crates/abi/src/lib.rs
@@ -2,6 +2,8 @@
//!
//! Automatically generated by [abigen](ethers_contract::abigen).
+#![warn(unused_crate_dependencies)]
+
mod bindings;
pub use bindings::{console, hardhat_console, hevm};
diff --git a/crates/anvil/Cargo.toml b/crates/anvil/Cargo.toml
index 58aee11d6cc16..9d7a24ba379ba 100644
--- a/crates/anvil/Cargo.toml
+++ b/crates/anvil/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "anvil"
-description = "Foundry's local ethereum node"
+description = "Local ethereum node"
version.workspace = true
edition.workspace = true
@@ -20,14 +20,13 @@ vergen = { version = "8", default-features = false, features = ["build", "git",
[dependencies]
# foundry internal
-foundry-evm = { path = "../evm" }
anvil-core = { path = "core", features = ["fastrlp", "serde", "impersonated-tx"] }
anvil-rpc = { path = "rpc" }
anvil-server = { path = "server" }
-foundry-utils = { path = "../utils" }
-foundry-common = { path = "../common", optional = true }
-forge = { path = "../forge", optional = true }
-foundry-config = { path = "../config" }
+foundry-common.workspace = true
+foundry-config.workspace = true
+foundry-evm.workspace = true
+foundry-utils.workspace = true
# evm support
bytes = "1.4.0"
@@ -59,7 +58,7 @@ serde = { version = "1", features = ["derive"] }
thiserror = "1"
yansi = "0.5"
tempfile = "3"
-itertools = "0.10"
+itertools.workspace = true
# cli
clap = { version = "4", features = ["derive", "env", "wrap_help"], optional = true }
@@ -71,7 +70,6 @@ fdlimit = { version = "0.2", optional = true }
clap_complete_fig = "4"
ethereum-forkid = "0.12"
-
[dev-dependencies]
ethers = { workspace = true, features = ["abigen"] }
ethers-solc = { workspace = true, features = ["project-util", "full"] }
@@ -81,5 +79,5 @@ crc = "3.0.1"
[features]
default = ["cli"]
-cmd = ["foundry-common", "forge", "clap", "clap_complete", "ctrlc", "anvil-server/clap"]
+cmd = ["clap", "clap_complete", "ctrlc", "anvil-server/clap"]
cli = ["tokio/full", "cmd", "fdlimit"]
diff --git a/crates/anvil/README.md b/crates/anvil/README.md
index ca5752c351d94..48e42c24412a3 100644
--- a/crates/anvil/README.md
+++ b/crates/anvil/README.md
@@ -1,6 +1,6 @@
## Anvil
-`anvil` is a local Ethereum node, designed for development with [**Forge**](../forge), akin to Ganache.
+A local Ethereum node, akin to Ganache, designed for development with [**Forge**](../../bin/forge).
## Features
@@ -26,7 +26,7 @@ cargo install --path ./anvil --bins --locked --force
## Getting started
```console
-anvil
+$ anvil
_ _
(_) | |
@@ -35,24 +35,26 @@ anvil
| (_| | | | | | \ V / | | | |
\__,_| |_| |_| \_/ |_| |_|
- 0.1.0 (b7c0774 2022-05-04T16:47:13.180846+00:00)
+ 0.1.0 (8d507b4 2023-08-05T00:20:34.048397801Z)
https://github.com/foundry-rs/foundry
Available Accounts
==================
-(0) 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH)
-(1) 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 (10000 ETH)
-(2) 0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc (10000 ETH)
-(3) 0x90f79bf6eb2c4f870365e785982e1f101e93b906 (10000 ETH)
-(4) 0x15d34aaf54267db7d7c367839aaf71a00a2c6a65 (10000 ETH)
-(5) 0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc (10000 ETH)
-(6) 0x976ea74026e726554db657fa54763abd0c3a0aa9 (10000 ETH)
-(7) 0x14dc79964da2c08b23698b3d3cc7ca32193d9955 (10000 ETH)
-(8) 0x23618e81e3f5cdf7f54c3d65f7fbc0abf5b21e8f (10000 ETH)
-(9) 0xa0ee7a142d267c1f36714e4a8f75612f20a79720 (10000 ETH)
+
+(0) "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" (10000.000000000000000000 ETH)
+(1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH)
+(2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH)
+(3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH)
+(4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH)
+(5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH)
+(6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH)
+(7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH)
+(8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH)
+(9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH)
Private Keys
==================
+
(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
@@ -69,17 +71,26 @@ Wallet
Mnemonic: test test test test test test test test test test test junk
Derivation path: m/44'/60'/0'/0/
-Base Fee
+
+Chain ID
==================
-1000000000
-Gas Price
+31337
+
+Base Fee
==================
-20000000000
+
+1000000000
Gas Limit
==================
+
30000000
+Genesis Timestamp
+==================
+
+1692087429
+
Listening on 127.0.0.1:8545
```
diff --git a/crates/anvil/src/config.rs b/crates/anvil/src/config.rs
index b4254208cdb69..f32aaf1ad8a8e 100644
--- a/crates/anvil/src/config.rs
+++ b/crates/anvil/src/config.rs
@@ -27,7 +27,6 @@ use ethers::{
types::BlockNumber,
utils::{format_ether, hex, to_checksum, WEI_IN_ETHER},
};
-use forge::utils::{h256_to_b256, u256_to_ru256};
use foundry_common::{
ProviderBuilder, ALCHEMY_FREE_TIER_CUPS, NON_ARCHIVE_NODE_WARNING, REQUEST_TIMEOUT,
};
@@ -36,7 +35,7 @@ use foundry_evm::{
executor::fork::{BlockchainDb, BlockchainDbMeta, SharedBackend},
revm,
revm::primitives::{BlockEnv, CfgEnv, SpecId, TxEnv, U256 as rU256},
- utils::apply_chain_and_block_specific_env_changes,
+ utils::{apply_chain_and_block_specific_env_changes, h256_to_b256, u256_to_ru256},
};
use parking_lot::RwLock;
use serde_json::{json, to_writer, Value};
diff --git a/crates/anvil/src/eth/api.rs b/crates/anvil/src/eth/api.rs
index bd19d19ec35b6..19a28b4a5ac54 100644
--- a/crates/anvil/src/eth/api.rs
+++ b/crates/anvil/src/eth/api.rs
@@ -57,11 +57,13 @@ use ethers::{
},
utils::rlp,
};
-use forge::{executor::DatabaseRef, revm::primitives::BlockEnv};
use foundry_common::ProviderBuilder;
use foundry_evm::{
- executor::backend::DatabaseError,
- revm::interpreter::{return_ok, return_revert, InstructionResult},
+ executor::{backend::DatabaseError, DatabaseRef},
+ revm::{
+ interpreter::{return_ok, return_revert, InstructionResult},
+ primitives::BlockEnv,
+ },
};
use futures::channel::mpsc::Receiver;
use parking_lot::RwLock;
diff --git a/crates/anvil/src/eth/backend/cheats.rs b/crates/anvil/src/eth/backend/cheats.rs
index 1f32d7d780b11..336f4672e8976 100644
--- a/crates/anvil/src/eth/backend/cheats.rs
+++ b/crates/anvil/src/eth/backend/cheats.rs
@@ -2,7 +2,7 @@
use anvil_core::eth::transaction::IMPERSONATED_SIGNATURE;
use ethers::types::{Address, Signature};
-use forge::hashbrown::HashSet;
+use foundry_evm::hashbrown::HashSet;
use parking_lot::RwLock;
use std::sync::Arc;
use tracing::trace;
diff --git a/crates/anvil/src/eth/backend/db.rs b/crates/anvil/src/eth/backend/db.rs
index 7c8dc0f37c385..6967b79d13f8c 100644
--- a/crates/anvil/src/eth/backend/db.rs
+++ b/crates/anvil/src/eth/backend/db.rs
@@ -7,7 +7,6 @@ use ethers::{
types::H256,
utils::keccak256,
};
-use forge::revm::primitives::{B160, B256, KECCAK_EMPTY, U256 as rU256};
use foundry_common::errors::FsPathError;
use foundry_evm::{
executor::{
@@ -16,7 +15,7 @@ use foundry_evm::{
},
revm::{
db::{CacheDB, DbAccount},
- primitives::Bytecode,
+ primitives::{Bytecode, B160, B256, KECCAK_EMPTY, U256 as rU256},
Database, DatabaseCommit,
},
HashMap,
diff --git a/crates/anvil/src/eth/backend/executor.rs b/crates/anvil/src/eth/backend/executor.rs
index 8b3e8e2987688..7198e160cd0ab 100644
--- a/crates/anvil/src/eth/backend/executor.rs
+++ b/crates/anvil/src/eth/backend/executor.rs
@@ -17,21 +17,18 @@ use ethers::{
types::{Bloom, H256, U256},
utils::rlp,
};
-use forge::{
- revm::primitives::{EVMError, ExecutionResult},
- utils::{
- b160_to_h160, eval_to_instruction_result, h160_to_b160, halt_to_instruction_result,
- ru256_to_u256,
- },
-};
use foundry_evm::{
executor::backend::DatabaseError,
revm,
revm::{
interpreter::InstructionResult,
- primitives::{BlockEnv, CfgEnv, Env, Output, SpecId},
+ primitives::{BlockEnv, CfgEnv, EVMError, Env, ExecutionResult, Output, SpecId},
},
trace::{node::CallTraceNode, CallTraceArena},
+ utils::{
+ b160_to_h160, eval_to_instruction_result, h160_to_b160, halt_to_instruction_result,
+ ru256_to_u256,
+ },
};
use std::sync::Arc;
use tracing::{trace, warn};
diff --git a/crates/anvil/src/eth/backend/genesis.rs b/crates/anvil/src/eth/backend/genesis.rs
index 044e8d23209fe..4f1c0f92c3a96 100644
--- a/crates/anvil/src/eth/backend/genesis.rs
+++ b/crates/anvil/src/eth/backend/genesis.rs
@@ -8,16 +8,13 @@ use ethers::{
abi::ethereum_types::BigEndianHash,
types::{Address, H256},
};
-use forge::{
- revm::primitives::{B160, B256, KECCAK_EMPTY, U256},
- utils::b160_to_h160,
-};
use foundry_evm::{
executor::{
backend::{snapshot::StateSnapshot, DatabaseError, DatabaseResult},
DatabaseRef,
},
- revm::primitives::{AccountInfo, Bytecode},
+ revm::primitives::{AccountInfo, Bytecode, B160, B256, KECCAK_EMPTY, U256},
+ utils::b160_to_h160,
};
use parking_lot::Mutex;
use std::{collections::HashMap, sync::Arc};
diff --git a/crates/anvil/src/eth/backend/mem/fork_db.rs b/crates/anvil/src/eth/backend/mem/fork_db.rs
index 863f82f31b0e2..593fae025a7e5 100644
--- a/crates/anvil/src/eth/backend/mem/fork_db.rs
+++ b/crates/anvil/src/eth/backend/mem/fork_db.rs
@@ -6,11 +6,13 @@ use crate::{
Address, U256,
};
use ethers::prelude::H256;
-use forge::revm::Database;
pub use foundry_evm::executor::fork::database::ForkedDatabase;
-use foundry_evm::executor::{
- backend::{snapshot::StateSnapshot, DatabaseResult},
- fork::database::ForkDbSnapshot,
+use foundry_evm::{
+ executor::{
+ backend::{snapshot::StateSnapshot, DatabaseResult},
+ fork::database::ForkDbSnapshot,
+ },
+ revm::Database,
};
/// Implement the helper for the fork database
diff --git a/crates/anvil/src/eth/backend/mem/in_memory_db.rs b/crates/anvil/src/eth/backend/mem/in_memory_db.rs
index faad463488546..18b0c83690ef7 100644
--- a/crates/anvil/src/eth/backend/mem/in_memory_db.rs
+++ b/crates/anvil/src/eth/backend/mem/in_memory_db.rs
@@ -9,7 +9,7 @@ use crate::{
Address, U256,
};
use ethers::prelude::H256;
-use forge::utils::h160_to_b160;
+use foundry_evm::utils::h160_to_b160;
use tracing::{trace, warn};
// reexport for convenience
@@ -120,8 +120,10 @@ mod tests {
};
use bytes::Bytes;
use ethers::types::U256;
- use forge::revm::primitives::{Bytecode, KECCAK_EMPTY, U256 as rU256};
- use foundry_evm::executor::{backend::MemDb, DatabaseRef};
+ use foundry_evm::{
+ executor::{backend::MemDb, DatabaseRef},
+ revm::primitives::{Bytecode, KECCAK_EMPTY, U256 as rU256},
+ };
use std::{collections::BTreeMap, str::FromStr};
// verifies that all substantial aspects of a loaded account remain the state after an account
diff --git a/crates/anvil/src/eth/backend/mem/inspector.rs b/crates/anvil/src/eth/backend/mem/inspector.rs
index 17f1231257873..805f01e3c3bc1 100644
--- a/crates/anvil/src/eth/backend/mem/inspector.rs
+++ b/crates/anvil/src/eth/backend/mem/inspector.rs
@@ -3,7 +3,6 @@
use crate::{eth::macros::node_info, revm::Database};
use bytes::Bytes;
use ethers::types::Log;
-use forge::revm::primitives::{B160, B256};
use foundry_evm::{
call_inspectors,
decode::decode_console_logs,
@@ -12,6 +11,7 @@ use foundry_evm::{
revm::{
inspectors::GasInspector,
interpreter::{CallInputs, CreateInputs, Gas, InstructionResult, Interpreter},
+ primitives::{B160, B256},
EVMData,
},
};
diff --git a/crates/anvil/src/eth/backend/mem/mod.rs b/crates/anvil/src/eth/backend/mem/mod.rs
index 8d1da3e31965d..98ba22c2eba25 100644
--- a/crates/anvil/src/eth/backend/mem/mod.rs
+++ b/crates/anvil/src/eth/backend/mem/mod.rs
@@ -55,28 +55,25 @@ use ethers::{
utils::{get_contract_address, hex, keccak256, rlp},
};
use flate2::{read::GzDecoder, write::GzEncoder, Compression};
-use forge::{
- executor::inspector::AccessListTracer,
- revm::{
- interpreter::{return_ok, InstructionResult},
- primitives::{BlockEnv, ExecutionResult},
- },
- utils::{
- eval_to_instruction_result, h256_to_b256, halt_to_instruction_result, ru256_to_u256,
- u256_to_ru256,
- },
-};
use foundry_evm::{
decode::{decode_custom_error_args, decode_revert},
- executor::backend::{DatabaseError, DatabaseResult},
+ executor::{
+ backend::{DatabaseError, DatabaseResult},
+ inspector::AccessListTracer,
+ },
revm::{
self,
db::CacheDB,
+ interpreter::{return_ok, InstructionResult},
primitives::{
- Account, CreateScheme, EVMError, Env, Output, SpecId, TransactTo, TxEnv, KECCAK_EMPTY,
+ Account, BlockEnv, CreateScheme, EVMError, Env, ExecutionResult, Output, SpecId,
+ TransactTo, TxEnv, KECCAK_EMPTY,
},
},
- utils::u256_to_h256_be,
+ utils::{
+ eval_to_instruction_result, h256_to_b256, halt_to_instruction_result, ru256_to_u256,
+ u256_to_h256_be, u256_to_ru256,
+ },
};
use futures::channel::mpsc::{unbounded, UnboundedSender};
use hash_db::HashDB;
diff --git a/crates/anvil/src/eth/backend/mem/state.rs b/crates/anvil/src/eth/backend/mem/state.rs
index 3460ae25c9830..b36f8bf8df923 100644
--- a/crates/anvil/src/eth/backend/mem/state.rs
+++ b/crates/anvil/src/eth/backend/mem/state.rs
@@ -8,17 +8,13 @@ use ethers::{
types::H256,
utils::{rlp, rlp::RlpStream},
};
-use forge::{
- executor::DatabaseRef,
+use foundry_evm::{
+ executor::{backend::DatabaseError, DatabaseRef},
revm::{
db::{CacheDB, DbAccount},
- primitives::{Bytecode, B160, U256 as rU256},
+ primitives::{AccountInfo, Bytecode, Log, B160, U256 as rU256},
},
utils::{b160_to_h160, b256_to_h256, ru256_to_u256, u256_to_ru256},
-};
-use foundry_evm::{
- executor::backend::DatabaseError,
- revm::primitives::{AccountInfo, Log},
HashMap as Map,
};
use memory_db::HashKey;
diff --git a/crates/anvil/src/eth/backend/mem/storage.rs b/crates/anvil/src/eth/backend/mem/storage.rs
index 0d0b5fa42a7a8..17f65910c8144 100644
--- a/crates/anvil/src/eth/backend/mem/storage.rs
+++ b/crates/anvil/src/eth/backend/mem/storage.rs
@@ -15,7 +15,7 @@ use ethers::{
prelude::{BlockId, BlockNumber, DefaultFrame, Trace, H256, H256 as TxHash, U64},
types::{ActionType, Bytes, GethDebugTracingOptions, TransactionReceipt, U256},
};
-use forge::revm::{interpreter::InstructionResult, primitives::Env};
+use foundry_evm::revm::{interpreter::InstructionResult, primitives::Env};
use parking_lot::RwLock;
use std::{
collections::{HashMap, VecDeque},
@@ -423,11 +423,13 @@ mod tests {
use super::*;
use crate::eth::backend::db::Db;
use ethers::{abi::ethereum_types::BigEndianHash, types::Address};
- use forge::revm::{
- db::DatabaseRef,
- primitives::{AccountInfo, U256 as rU256},
+ use foundry_evm::{
+ executor::backend::MemDb,
+ revm::{
+ db::DatabaseRef,
+ primitives::{AccountInfo, U256 as rU256},
+ },
};
- use foundry_evm::executor::backend::MemDb;
#[test]
fn test_interval_update() {
diff --git a/crates/anvil/src/eth/error.rs b/crates/anvil/src/eth/error.rs
index c45d20bb4b591..888f185d5647a 100644
--- a/crates/anvil/src/eth/error.rs
+++ b/crates/anvil/src/eth/error.rs
@@ -11,9 +11,11 @@ use ethers::{
signers::WalletError,
types::{Bytes, SignatureError, U256},
};
-use forge::revm::{self, primitives::EVMError};
use foundry_common::SELECTOR_LEN;
-use foundry_evm::{executor::backend::DatabaseError, revm::interpreter::InstructionResult};
+use foundry_evm::{
+ executor::backend::DatabaseError,
+ revm::{self, interpreter::InstructionResult, primitives::EVMError},
+};
use serde::Serialize;
use tracing::error;
diff --git a/crates/anvil/src/eth/util.rs b/crates/anvil/src/eth/util.rs
index 0479049c885d6..078971c577884 100644
--- a/crates/anvil/src/eth/util.rs
+++ b/crates/anvil/src/eth/util.rs
@@ -1,6 +1,5 @@
use ethers::{abi::Address, types::H160};
-use forge::revm::primitives::SpecId;
-use foundry_evm::revm::precompile::Precompiles;
+use foundry_evm::revm::{self, precompile::Precompiles, primitives::SpecId};
use std::fmt;
pub fn get_precompiles_for(spec_id: SpecId) -> Vec
{
@@ -59,18 +58,18 @@ impl<'a> fmt::Debug for HexDisplay<'a> {
}
}
-pub fn to_precompile_id(spec_id: SpecId) -> forge::revm::precompile::SpecId {
+pub fn to_precompile_id(spec_id: SpecId) -> revm::precompile::SpecId {
match spec_id {
SpecId::FRONTIER |
SpecId::FRONTIER_THAWING |
SpecId::HOMESTEAD |
SpecId::DAO_FORK |
SpecId::TANGERINE |
- SpecId::SPURIOUS_DRAGON => forge::revm::precompile::SpecId::HOMESTEAD,
+ SpecId::SPURIOUS_DRAGON => revm::precompile::SpecId::HOMESTEAD,
SpecId::BYZANTIUM | SpecId::CONSTANTINOPLE | SpecId::PETERSBURG => {
- forge::revm::precompile::SpecId::BYZANTIUM
+ revm::precompile::SpecId::BYZANTIUM
}
- SpecId::ISTANBUL | SpecId::MUIR_GLACIER => forge::revm::precompile::SpecId::ISTANBUL,
+ SpecId::ISTANBUL | SpecId::MUIR_GLACIER => revm::precompile::SpecId::ISTANBUL,
SpecId::BERLIN |
SpecId::LONDON |
SpecId::ARROW_GLACIER |
@@ -78,6 +77,6 @@ pub fn to_precompile_id(spec_id: SpecId) -> forge::revm::precompile::SpecId {
SpecId::MERGE |
SpecId::SHANGHAI |
SpecId::CANCUN |
- SpecId::LATEST => forge::revm::precompile::SpecId::BERLIN,
+ SpecId::LATEST => revm::precompile::SpecId::BERLIN,
}
}
diff --git a/crates/anvil/src/genesis.rs b/crates/anvil/src/genesis.rs
index 307801abf2160..3ab285a1018ad 100644
--- a/crates/anvil/src/genesis.rs
+++ b/crates/anvil/src/genesis.rs
@@ -4,11 +4,11 @@ use ethers::{
signers::LocalWallet,
types::{serde_helpers::*, Address, Bytes, H256, U256},
};
-use forge::{
+use foundry_common::errors::FsPathError;
+use foundry_evm::{
revm::primitives::{Bytecode, Env, KECCAK_EMPTY, U256 as rU256},
utils::h160_to_b160,
};
-use foundry_common::errors::FsPathError;
use serde::{Deserialize, Serialize};
use std::{
collections::{BTreeMap, HashMap},
diff --git a/crates/anvil/tests/it/anvil_api.rs b/crates/anvil/tests/it/anvil_api.rs
index bc156d02c26fe..a4213dc495d5b 100644
--- a/crates/anvil/tests/it/anvil_api.rs
+++ b/crates/anvil/tests/it/anvil_api.rs
@@ -14,7 +14,7 @@ use ethers::{
},
utils::hex,
};
-use forge::revm::primitives::SpecId;
+use foundry_evm::revm::primitives::SpecId;
use std::{
str::FromStr,
sync::Arc,
diff --git a/crates/anvil/tests/it/fork.rs b/crates/anvil/tests/it/fork.rs
index 7e5d97416d88b..c539445be2b6d 100644
--- a/crates/anvil/tests/it/fork.rs
+++ b/crates/anvil/tests/it/fork.rs
@@ -13,9 +13,9 @@ use ethers::{
U256,
},
};
-use forge::utils::h160_to_b160;
use foundry_common::get_http_provider;
use foundry_config::Config;
+use foundry_evm::utils::h160_to_b160;
use foundry_utils::{rpc, rpc::next_http_rpc_endpoint};
use futures::StreamExt;
use std::{sync::Arc, time::Duration};
diff --git a/crates/cast/Cargo.toml b/crates/cast/Cargo.toml
index 6a02f1c0337cc..d73c1cc1c0d7f 100644
--- a/crates/cast/Cargo.toml
+++ b/crates/cast/Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "cast"
+description = "Command-line tool for performing Ethereum RPC calls"
version.workspace = true
edition.workspace = true
@@ -9,37 +10,70 @@ license.workspace = true
homepage.workspace = true
repository.workspace = true
+[[bin]]
+name = "cast"
+path = "bin/main.rs"
+
+[build-dependencies]
+vergen = { version = "8", default-features = false, features = ["build", "git", "git2"] }
+
[dependencies]
+# lib
foundry-utils.workspace = true
foundry-evm.workspace = true
foundry-config.workspace = true
foundry-common.workspace = true
ethers-etherscan.workspace = true
-ethers-contract = { workspace = true, features = ["abigen"] }
ethers-core.workspace = true
ethers-providers.workspace = true
-ethers-signers.workspace = true
-futures = "0.3"
-eyre = "0.6"
-serde = "1"
-serde_json = "1"
chrono.workspace = true
+evm-disassembler = "0.2"
+eyre = "0.6"
+futures = "0.3"
hex.workspace = true
rayon = "1"
+serde = "1"
+serde_json = "1"
# aws
-rusoto_core = { version = "0.48", default-features = false, optional = true }
-rusoto_kms = { version = "0.48", default-features = false, optional = true }
-evm-disassembler = "0.2"
+rusoto_core = { version = "0.48", default-features = false }
+rusoto_kms = { version = "0.48", default-features = false }
+
+# bin
+# foundry internal
+foundry-cli.workspace = true
+
+# eth
+ethers = { workspace = true, features = ["rustls"] }
+eth-keystore = "0.5"
+
+bytes = "1.4"
+clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }
+clap_complete = "4"
+clap_complete_fig = "4"
+comfy-table = "6"
+dunce = "1"
+indicatif = "0.17"
+itertools.workspace = true
+regex = { version = "1", default-features = false }
+rpassword = "7"
+semver = "1"
+tempfile = "3"
+tokio = { version = "1", features = ["macros"] }
+tracing = "0.1"
+yansi = "0.5"
[dev-dependencies]
+foundry-test-utils.workspace = true
async-trait = "0.1"
-tokio = "1"
-thiserror = "1"
+criterion = "0.5"
[features]
-default = ["ledger", "trezor", "aws"]
-ledger = ["ethers-signers/ledger"]
-trezor = ["ethers-signers/trezor"]
-aws = ["ethers-signers/aws", "rusoto_core/rustls", "rusoto_kms/rustls"]
+default = ["rustls"]
+rustls = ["foundry-cli/rustls"]
+openssl = ["foundry-cli/openssl"]
+
+[[bench]]
+name = "vanity"
+harness = false
diff --git a/crates/cast/README.md b/crates/cast/README.md
index 2085c953b5314..32de3fd74c215 100644
--- a/crates/cast/README.md
+++ b/crates/cast/README.md
@@ -1,66 +1,5 @@
# `cast`
-**Need help with Cast? Read the [📖 Foundry Book (Cast Guide)][foundry-book-cast-guide] (WIP)!**
+Cast is a command-line tool for performing Ethereum RPC calls. You can make smart contract calls, send transactions, or retrieve any type of chain data - all from your command-line!
-[foundry-book-cast-guide]: https://book.getfoundry.sh/cast/index.html
-
-## Features
-
-- [x] `--abi-decode`
-- [x] `--calldata-decode`
-- [x] `--from-ascii` (with `--from-utf8` alias)
-- [x] `--from-bin`
-- [x] `--from-fix`
-- [x] `--from-wei`
-- [x] `--max-int`
-- [x] `--max-uint`
-- [x] `--min-int`
-- [x] `--to-checksum-address` (`--to-address` in dapptools)
-- [x] `--to-ascii`
-- [x] `--to-bytes32`
-- [x] `--to-dec`
-- [x] `--to-fix`
-- [x] `--to-hex`
-- [x] `--to-hexdata`
-- [x] `--to-int256`
-- [x] `--to-uint256`
-- [x] `--to-wei`
-- [x] `4byte`
-- [x] `4byte-decode`
-- [x] `4byte-event`
-- [x] `abi-encode`
-- [x] `age`
-- [x] `balance`
-- [x] `basefee`
-- [x] `block`
-- [x] `block-number`
-- [ ] `bundle-source`
-- [x] `call` (partial)
-- [x] `calldata`
-- [x] `chain`
-- [x] `chain-id`
-- [x] `client`
-- [x] `code`
-- [x] `codesize`
-- [ ] `debug`
-- [x] `estimate`
-- [x] `etherscan-source`
-- [ ] `events`
-- [x] `gas-price`
-- [x] `index`
-- [x] `keccak`
-- [ ] `logs`
-- [x] `lookup-address`
-- [ ] `ls`
-- [ ] `mktx`
-- [x] `namehash`
-- [x] `nonce`
-- [x] `publish`
-- [x] `receipt`
-- [x] `resolve-name`
-- [ ] `run-tx`
-- [x] `send` (partial)
-- [x] `sig`
-- [ ] `sign`
-- [x] `storage`
-- [x] `tx`
+For more information, see the [📖 Foundry Book (Cast Guide)](https://book.getfoundry.sh/cast/index.html).
diff --git a/crates/cli/benches/cast.rs b/crates/cast/benches/vanity.rs
similarity index 96%
rename from crates/cli/benches/cast.rs
rename to crates/cast/benches/vanity.rs
index f7c1b2020061f..4311b5283a74e 100644
--- a/crates/cli/benches/cast.rs
+++ b/crates/cast/benches/vanity.rs
@@ -2,7 +2,7 @@ use criterion::{criterion_group, criterion_main, Criterion};
use rayon::prelude::*;
use std::{hint::black_box, time::Duration};
-#[path = "../src/cast/cmd/wallet/mod.rs"]
+#[path = "../bin/cmd/wallet/mod.rs"]
#[allow(unused)]
mod wallet;
use wallet::vanity::*;
diff --git a/crates/cli/src/cast/cmd/access_list.rs b/crates/cast/bin/cmd/access_list.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/access_list.rs
rename to crates/cast/bin/cmd/access_list.rs
diff --git a/crates/cli/src/cast/cmd/bind.rs b/crates/cast/bin/cmd/bind.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/bind.rs
rename to crates/cast/bin/cmd/bind.rs
diff --git a/crates/cli/src/cast/cmd/call.rs b/crates/cast/bin/cmd/call.rs
similarity index 99%
rename from crates/cli/src/cast/cmd/call.rs
rename to crates/cast/bin/cmd/call.rs
index 741e03a862817..5c3ff7a9e4334 100644
--- a/crates/cli/src/cast/cmd/call.rs
+++ b/crates/cast/bin/cmd/call.rs
@@ -5,13 +5,12 @@ use ethers::{
types::{BlockId, NameOrAddress, U256},
};
use eyre::{Result, WrapErr};
-use forge::executor::opts::EvmOpts;
use foundry_cli::{
opts::{EthereumOpts, TransactionOpts},
utils::{self, handle_traces, parse_ether_value, TraceResult},
};
use foundry_config::{find_project_root_path, Config};
-use foundry_evm::trace::TracingExecutor;
+use foundry_evm::{executor::opts::EvmOpts, trace::TracingExecutor};
use std::str::FromStr;
type Provider =
diff --git a/crates/cli/src/cast/cmd/create2.rs b/crates/cast/bin/cmd/create2.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/create2.rs
rename to crates/cast/bin/cmd/create2.rs
diff --git a/crates/cli/src/cast/cmd/estimate.rs b/crates/cast/bin/cmd/estimate.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/estimate.rs
rename to crates/cast/bin/cmd/estimate.rs
diff --git a/crates/cli/src/cast/cmd/find_block.rs b/crates/cast/bin/cmd/find_block.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/find_block.rs
rename to crates/cast/bin/cmd/find_block.rs
diff --git a/crates/cli/src/cast/cmd/interface.rs b/crates/cast/bin/cmd/interface.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/interface.rs
rename to crates/cast/bin/cmd/interface.rs
diff --git a/crates/cli/src/cast/cmd/logs.rs b/crates/cast/bin/cmd/logs.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/logs.rs
rename to crates/cast/bin/cmd/logs.rs
diff --git a/crates/cli/src/cast/cmd/mod.rs b/crates/cast/bin/cmd/mod.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/mod.rs
rename to crates/cast/bin/cmd/mod.rs
diff --git a/crates/cli/src/cast/cmd/rpc.rs b/crates/cast/bin/cmd/rpc.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/rpc.rs
rename to crates/cast/bin/cmd/rpc.rs
diff --git a/crates/cli/src/cast/cmd/run.rs b/crates/cast/bin/cmd/run.rs
similarity index 98%
rename from crates/cli/src/cast/cmd/run.rs
rename to crates/cast/bin/cmd/run.rs
index 0576322d28a6b..902271adf76bf 100644
--- a/crates/cli/src/cast/cmd/run.rs
+++ b/crates/cast/bin/cmd/run.rs
@@ -1,11 +1,6 @@
use clap::Parser;
use ethers::{prelude::Middleware, solc::EvmVersion, types::H160};
use eyre::{Result, WrapErr};
-use forge::{
- executor::{inspector::cheatcodes::util::configure_tx_env, opts::EvmOpts},
- revm::primitives::U256 as rU256,
- utils::h256_to_b256,
-};
use foundry_cli::{
init_progress,
opts::RpcOpts,
@@ -13,7 +8,12 @@ use foundry_cli::{
utils::{handle_traces, TraceResult},
};
use foundry_config::{find_project_root_path, Config};
-use foundry_evm::{executor::EvmError, trace::TracingExecutor};
+use foundry_evm::{
+ executor::{inspector::cheatcodes::util::configure_tx_env, opts::EvmOpts, EvmError},
+ revm::primitives::U256 as rU256,
+ trace::TracingExecutor,
+ utils::h256_to_b256,
+};
use tracing::trace;
const ARBITRUM_SENDER: H160 = H160([
diff --git a/crates/cli/src/cast/cmd/send.rs b/crates/cast/bin/cmd/send.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/send.rs
rename to crates/cast/bin/cmd/send.rs
diff --git a/crates/cli/src/cast/cmd/storage.rs b/crates/cast/bin/cmd/storage.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/storage.rs
rename to crates/cast/bin/cmd/storage.rs
diff --git a/crates/cli/src/cast/cmd/wallet/mod.rs b/crates/cast/bin/cmd/wallet/mod.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/wallet/mod.rs
rename to crates/cast/bin/cmd/wallet/mod.rs
diff --git a/crates/cli/src/cast/cmd/wallet/vanity.rs b/crates/cast/bin/cmd/wallet/vanity.rs
similarity index 100%
rename from crates/cli/src/cast/cmd/wallet/vanity.rs
rename to crates/cast/bin/cmd/wallet/vanity.rs
diff --git a/crates/cli/src/cast/main.rs b/crates/cast/bin/main.rs
similarity index 100%
rename from crates/cli/src/cast/main.rs
rename to crates/cast/bin/main.rs
diff --git a/crates/cli/src/cast/opts.rs b/crates/cast/bin/opts.rs
similarity index 99%
rename from crates/cli/src/cast/opts.rs
rename to crates/cast/bin/opts.rs
index 4d0dae5af7d83..e5c7b89a264cd 100644
--- a/crates/cli/src/cast/opts.rs
+++ b/crates/cast/bin/opts.rs
@@ -15,8 +15,17 @@ use foundry_cli::{
};
use std::{path::PathBuf, str::FromStr};
+const VERSION_MESSAGE: &str = concat!(
+ env!("CARGO_PKG_VERSION"),
+ " (",
+ env!("VERGEN_GIT_SHA"),
+ " ",
+ env!("VERGEN_BUILD_TIMESTAMP"),
+ ")"
+);
+
#[derive(Debug, Parser)]
-#[clap(name = "cast", version = foundry_cli::utils::VERSION_MESSAGE)]
+#[clap(name = "cast", version = VERSION_MESSAGE)]
pub struct Opts {
#[clap(subcommand)]
pub sub: Subcommands,
diff --git a/crates/cli/build.rs b/crates/cast/build.rs
similarity index 100%
rename from crates/cli/build.rs
rename to crates/cast/build.rs
diff --git a/crates/cast/src/lib.rs b/crates/cast/src/lib.rs
index 0e0e6ebf1688f..7df722fe87639 100644
--- a/crates/cast/src/lib.rs
+++ b/crates/cast/src/lib.rs
@@ -1,7 +1,3 @@
-//! Cast
-//!
-//! Contains core function implementation for `cast`
-
use crate::rlp_converter::Item;
use base::{Base, NumberWithBase, ToBase};
use chrono::NaiveDateTime;
diff --git a/crates/cast/src/rlp_converter.rs b/crates/cast/src/rlp_converter.rs
index 2110cfd12afd6..5c64556daa8cf 100644
--- a/crates/cast/src/rlp_converter.rs
+++ b/crates/cast/src/rlp_converter.rs
@@ -87,7 +87,6 @@ impl Display for Item {
}
}
-#[macro_use]
#[cfg(test)]
mod test {
use crate::rlp_converter::Item;
diff --git a/crates/cli/tests/it/cast.rs b/crates/cast/tests/cli/main.rs
similarity index 96%
rename from crates/cli/tests/it/cast.rs
rename to crates/cast/tests/cli/main.rs
index b757451ee9abc..9eff595b69695 100644
--- a/crates/cli/tests/it/cast.rs
+++ b/crates/cast/tests/cli/main.rs
@@ -1,11 +1,11 @@
//! Contains various tests for checking cast commands
-use foundry_cli_test_utils::{
+use foundry_test_utils::{
casttest,
util::{OutputExt, TestCommand, TestProject},
};
use foundry_utils::rpc::next_http_rpc_endpoint;
-use std::{io::Write, path::PathBuf};
+use std::{io::Write, path::Path};
// tests `--help` is printed to std out
casttest!(print_help, |_: TestProject, mut cmd: TestCommand| {
@@ -57,7 +57,7 @@ casttest!(new_wallet_keystore_with_password, |_: TestProject, mut cmd: TestComma
// tests that we can get the address of a keystore file
casttest!(wallet_address_keystore_with_password_file, |_: TestProject, mut cmd: TestCommand| {
- let keystore_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/keystore");
+ let keystore_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/keystore");
cmd.args([
"wallet",
@@ -123,7 +123,7 @@ casttest!(cast_wallet_sign_typed_data_file, |_: TestProject, mut cmd: TestComman
"0x0000000000000000000000000000000000000000000000000000000000000001",
"--data",
"--from-file",
- PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+ Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests/fixtures/sign_typed_data.json")
.into_os_string()
.into_string()
@@ -205,7 +205,7 @@ casttest!(upload_signatures, |_: TestProject, mut cmd: TestCommand| {
"upload-signature",
"event Transfer(address,uint256)",
"transfer(address,uint256)",
- PathBuf::from(env!("CARGO_MANIFEST_DIR"))
+ Path::new(env!("CARGO_MANIFEST_DIR"))
.join("tests/fixtures/ERC20Artifact.json")
.into_os_string()
.into_string()
@@ -406,7 +406,7 @@ casttest!(cast_logs_topics, |_: TestProject, mut cmd: TestCommand| {
]);
cmd.unchecked_output().stdout_matches_path(
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
+ Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
);
});
@@ -427,7 +427,7 @@ casttest!(cast_logs_topic_2, |_: TestProject, mut cmd: TestCommand| {
]);
cmd.unchecked_output().stdout_matches_path(
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
+ Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
);
});
@@ -446,7 +446,7 @@ casttest!(cast_logs_sig, |_: TestProject, mut cmd: TestCommand| {
]);
cmd.unchecked_output().stdout_matches_path(
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
+ Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
);
});
@@ -466,7 +466,7 @@ casttest!(cast_logs_sig_2, |_: TestProject, mut cmd: TestCommand| {
]);
cmd.unchecked_output().stdout_matches_path(
- PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
+ Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/cast_logs.stdout"),
);
});
diff --git a/crates/cli/tests/fixtures/ERC20Artifact.json b/crates/cast/tests/fixtures/ERC20Artifact.json
similarity index 100%
rename from crates/cli/tests/fixtures/ERC20Artifact.json
rename to crates/cast/tests/fixtures/ERC20Artifact.json
diff --git a/crates/cli/tests/fixtures/cast_logs.stdout b/crates/cast/tests/fixtures/cast_logs.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/cast_logs.stdout
rename to crates/cast/tests/fixtures/cast_logs.stdout
diff --git a/crates/cli/tests/fixtures/keystore/UTC--2022-10-30T06-51-20.130356000Z--560d246fcddc9ea98a8b032c9a2f474efb493c28 b/crates/cast/tests/fixtures/keystore/UTC--2022-10-30T06-51-20.130356000Z--560d246fcddc9ea98a8b032c9a2f474efb493c28
similarity index 100%
rename from crates/cli/tests/fixtures/keystore/UTC--2022-10-30T06-51-20.130356000Z--560d246fcddc9ea98a8b032c9a2f474efb493c28
rename to crates/cast/tests/fixtures/keystore/UTC--2022-10-30T06-51-20.130356000Z--560d246fcddc9ea98a8b032c9a2f474efb493c28
diff --git a/crates/cli/tests/fixtures/keystore/UTC--2022-12-20T10-30-43.591916000Z--ec554aeafe75601aaab43bd4621a22284db566c2 b/crates/cast/tests/fixtures/keystore/UTC--2022-12-20T10-30-43.591916000Z--ec554aeafe75601aaab43bd4621a22284db566c2
similarity index 100%
rename from crates/cli/tests/fixtures/keystore/UTC--2022-12-20T10-30-43.591916000Z--ec554aeafe75601aaab43bd4621a22284db566c2
rename to crates/cast/tests/fixtures/keystore/UTC--2022-12-20T10-30-43.591916000Z--ec554aeafe75601aaab43bd4621a22284db566c2
diff --git a/crates/cli/tests/fixtures/keystore/password b/crates/cast/tests/fixtures/keystore/password
similarity index 100%
rename from crates/cli/tests/fixtures/keystore/password
rename to crates/cast/tests/fixtures/keystore/password
diff --git a/crates/cli/tests/fixtures/keystore/password-ec554 b/crates/cast/tests/fixtures/keystore/password-ec554
similarity index 100%
rename from crates/cli/tests/fixtures/keystore/password-ec554
rename to crates/cast/tests/fixtures/keystore/password-ec554
diff --git a/crates/cli/tests/fixtures/sign_typed_data.json b/crates/cast/tests/fixtures/sign_typed_data.json
similarity index 100%
rename from crates/cli/tests/fixtures/sign_typed_data.json
rename to crates/cast/tests/fixtures/sign_typed_data.json
diff --git a/crates/chisel/Cargo.toml b/crates/chisel/Cargo.toml
index 61972dc05b721..679063eb1b1c9 100644
--- a/crates/chisel/Cargo.toml
+++ b/crates/chisel/Cargo.toml
@@ -1,10 +1,7 @@
[package]
name = "chisel"
-authors = [
- "clabby ",
- "asnared ",
-]
-description = "Solidity REPL"
+authors = ["clabby ", "asnared "]
+description = "Fast, utilitarian, and verbose Solidity REPL"
version.workspace = true
edition.workspace = true
@@ -15,12 +12,14 @@ repository.workspace = true
[[bin]]
name = "chisel"
-path = "src/bin/chisel.rs"
+path = "bin/main.rs"
+
+[build-dependencies]
+vergen = { version = "8", default-features = false, features = ["build", "git", "git2"] }
[dependencies]
# forge
foundry-evm.workspace = true
-forge.workspace = true
foundry-config.workspace = true
foundry-cli.workspace = true
foundry-common.workspace = true
@@ -32,7 +31,7 @@ ethers-solc = { workspace = true, features = ["project-util", "full"] }
# async
tokio = { version = "1", features = ["full"] }
-reqwest = { version = "0.11", default-features = false, features = ["rustls"] }
+reqwest = { version = "0.11", default-features = false }
# misc
clap = { version = "4", features = ["derive", "env", "wrap_help"] }
@@ -51,16 +50,14 @@ time = { version = "0.3", features = ["formatting"] }
regex = "1"
[dev-dependencies]
-criterion = { version = "0.4", features = ["async_tokio"] }
+criterion = { version = "0.5", features = ["async_tokio"] }
serial_test = "2"
once_cell = "1"
-[build-dependencies]
-vergen = { version = "8", default-features = false, features = [
- "build",
- "git",
- "git2",
-] }
+[features]
+default = ["rustls"]
+rustls = ["ethers/rustls", "reqwest/rustls-tls", "reqwest/rustls-tls-native-roots"]
+openssl = ["ethers/openssl", "reqwest/default-tls"]
[[bench]]
name = "session_source"
diff --git a/crates/chisel/README.md b/crates/chisel/README.md
index 48e4e2f605c6a..8ea2840aa36a8 100644
--- a/crates/chisel/README.md
+++ b/crates/chisel/README.md
@@ -1,6 +1,6 @@
# `chisel`
-Chisel is a fast, utilitarian, and verbose solidity REPL. It is heavily inspired by the incredible work done in [soli](https://github.com/jpopesculian/soli) and [solidity-shell](https://github.com/tintinweb/solidity-shell)!
+Chisel is a fast, utilitarian, and verbose Solidity REPL. It is heavily inspired by the incredible work done in [soli](https://github.com/jpopesculian/soli) and [solidity-shell](https://github.com/tintinweb/solidity-shell)!

@@ -54,6 +54,7 @@ If you do not have `foundryup` installed, reference the Foundry [installation gu
=============
General
!help | !h - Display all commands
+ !quit | !q - Quit Chisel
!exec [args] | !e [args] - Execute a shell command and print the output
Session
@@ -65,14 +66,17 @@ Session
!clearcache | !cc - Clear the chisel cache of all stored sessions
!export | !ex - Export the current session source to a script file
!fetch | !fe - Fetch the interface of a verified contract on Etherscan
+ !edit - Open the current session in an editor
Environment
!fork | !f - Fork an RPC for the current session. Supply 0 arguments to return to a local network
!traces | !t - Enable / disable traces for the current session
+ !calldata [data] | !cd [data] - Set calldata (`msg.data`) for the current session (appended after function selector). Clears it if no argument provided.
Debug
!memdump | !md - Dump the raw memory of the current state
!stackdump | !sd - Dump the raw stack of the current state
+ !rawstack | !rs - Display the raw value of a variable's stack allocation. For variables that are > 32 bytes in length, this will display their memory pointer.
```
### Cache Session
diff --git a/crates/chisel/benches/session_source.rs b/crates/chisel/benches/session_source.rs
index b5e181a94ee1a..696c57c9745a0 100644
--- a/crates/chisel/benches/session_source.rs
+++ b/crates/chisel/benches/session_source.rs
@@ -1,8 +1,8 @@
use chisel::session_source::{SessionSource, SessionSourceConfig};
use criterion::{criterion_group, Criterion};
use ethers_solc::Solc;
-use forge::executor::opts::EvmOpts;
use foundry_config::Config;
+use foundry_evm::executor::opts::EvmOpts;
use once_cell::sync::Lazy;
use std::hint::black_box;
use tokio::runtime::Runtime;
diff --git a/crates/chisel/src/bin/chisel.rs b/crates/chisel/bin/main.rs
similarity index 98%
rename from crates/chisel/src/bin/chisel.rs
rename to crates/chisel/bin/main.rs
index 9844d2c5d96fb..55de1f0649edb 100644
--- a/crates/chisel/src/bin/chisel.rs
+++ b/crates/chisel/bin/main.rs
@@ -26,8 +26,7 @@ use yansi::Paint;
// Loads project's figment and merges the build cli arguments into it
foundry_config::merge_impl_figment_convert!(ChiselParser, opts, evm_opts);
-/// Version tag generated by vergen
-pub(crate) const VERSION_MESSAGE: &str = concat!(
+const VERSION_MESSAGE: &str = concat!(
env!("CARGO_PKG_VERSION"),
" (",
env!("VERGEN_GIT_SHA"),
@@ -36,7 +35,7 @@ pub(crate) const VERSION_MESSAGE: &str = concat!(
")"
);
-/// Chisel is a fast, utilitarian, and verbose solidity REPL.
+/// Fast, utilitarian, and verbose Solidity REPL.
#[derive(Debug, Parser)]
#[clap(name = "chisel", version = VERSION_MESSAGE)]
pub struct ChiselParser {
diff --git a/crates/chisel/src/dispatcher.rs b/crates/chisel/src/dispatcher.rs
index 9cff07e313658..1115514749b90 100644
--- a/crates/chisel/src/dispatcher.rs
+++ b/crates/chisel/src/dispatcher.rs
@@ -8,15 +8,15 @@ use crate::prelude::{
SolidityHelper,
};
use ethers::{abi::ParamType, contract::Lazy, types::Address, utils::hex};
-use forge::{
+use forge_fmt::FormatterConfig;
+use foundry_config::{Config, RpcEndpoint};
+use foundry_evm::{
decode::decode_console_logs,
trace::{
identifier::{EtherscanIdentifier, SignaturesIdentifier},
CallTraceDecoder, CallTraceDecoderBuilder, TraceKind,
},
};
-use forge_fmt::FormatterConfig;
-use foundry_config::{Config, RpcEndpoint};
use regex::Regex;
use reqwest::Url;
use serde::{Deserialize, Serialize};
diff --git a/crates/chisel/src/executor.rs b/crates/chisel/src/executor.rs
index c97d0310054d3..a0ed5aee86a07 100644
--- a/crates/chisel/src/executor.rs
+++ b/crates/chisel/src/executor.rs
@@ -13,7 +13,7 @@ use ethers::{
};
use ethers_solc::Artifact;
use eyre::{Result, WrapErr};
-use forge::{
+use foundry_evm::{
decode::decode_console_logs,
executor::{inspector::CheatsConfig, Backend, ExecutorBuilder},
utils::ru256_to_u256,
diff --git a/crates/chisel/src/runner.rs b/crates/chisel/src/runner.rs
index 1a8291a397372..45aa46f93342f 100644
--- a/crates/chisel/src/runner.rs
+++ b/crates/chisel/src/runner.rs
@@ -8,7 +8,7 @@ use ethers::{
types::{Bytes, Log},
};
use eyre::Result;
-use forge::{
+use foundry_evm::{
executor::{DeployResult, Executor, RawCallResult},
trace::{CallTraceArena, TraceKind},
};
diff --git a/crates/chisel/src/session_source.rs b/crates/chisel/src/session_source.rs
index 852afff3a62f7..c7bea2b5fd567 100644
--- a/crates/chisel/src/session_source.rs
+++ b/crates/chisel/src/session_source.rs
@@ -9,9 +9,9 @@ use ethers_solc::{
CompilerInput, CompilerOutput, EvmVersion, Solc,
};
use eyre::Result;
-use forge::executor::{opts::EvmOpts, Backend};
use forge_fmt::solang_ext::SafeUnwrap;
use foundry_config::{Config, SolcReq};
+use foundry_evm::executor::{opts::EvmOpts, Backend};
use semver::Version;
use serde::{Deserialize, Serialize};
use solang_parser::pt;
diff --git a/crates/chisel/tests/cache.rs b/crates/chisel/tests/cache.rs
index 4f24b1c65ecd8..9ff4e325719fb 100644
--- a/crates/chisel/tests/cache.rs
+++ b/crates/chisel/tests/cache.rs
@@ -1,10 +1,9 @@
-use std::path::Path;
-
use chisel::session::ChiselSession;
use ethers_solc::EvmVersion;
-use forge::executor::opts::EvmOpts;
use foundry_config::Config;
+use foundry_evm::executor::opts::EvmOpts;
use serial_test::serial;
+use std::path::Path;
#[test]
#[serial]
diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml
index 10b9661c4fcdf..07734dd122ac6 100644
--- a/crates/cli/Cargo.toml
+++ b/crates/cli/Cargo.toml
@@ -9,112 +9,45 @@ license.workspace = true
homepage.workspace = true
repository.workspace = true
-[build-dependencies]
-vergen = { version = "8", default-features = false, features = ["build", "git", "git2"] }
-
[dependencies]
# foundry internal
-forge-fmt.workspace = true
-forge-doc.workspace = true
-foundry-utils.workspace = true
-forge.workspace = true
foundry-config.workspace = true
foundry-common.workspace = true
foundry-evm.workspace = true
-cast.workspace = true
ui.workspace = true
+# aws
+rusoto_core = { version = "0.48", default-features = false }
+rusoto_kms = { version = "0.48", default-features = false }
+
# eth
-ethers = { workspace = true, features = ["rustls"] }
-solang-parser.workspace = true
-eth-keystore = "0.5"
+ethers = { workspace = true, features = ["aws", "ledger", "trezor"] }
-# cli
+async-trait = "0.1"
clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }
-clap_complete = "4"
-clap_complete_fig = "4"
-yansi = "0.5"
-tracing-error = "0.2"
-tracing-subscriber = { version = "0.3", features = ["registry", "env-filter", "fmt"] }
-tracing = "0.1"
-watchexec = "2"
-comfy-table = "6"
-reqwest = { version = "0.11", default-features = false, features = [
- "json",
- "rustls",
- "rustls-tls-native-roots",
-] }
+color-eyre = "0.6"
dotenvy = "0.15"
-dialoguer = { version = "0.10", default-features = false }
-
-# async / parallel
-tokio = { version = "1", features = ["macros"] }
-futures = "0.3"
-rayon = "1"
-async-trait = "0.1"
-
-# disk / paths
-walkdir = "2"
-dunce = "1"
-path-slash = "0.2"
-tempfile = "3"
-
-# misc
eyre = "0.6"
-color-eyre = "0.6"
-serde = { version = "1", features = ["derive"] }
-serde_json = "1"
-regex = { version = "1", default-features = false }
-rpassword = "7"
hex = { workspace = true, features = ["serde"] }
-itertools = "0.10"
-proptest = "1"
-semver = "1"
+indicatif = "0.17"
+itertools.workspace = true
once_cell = "1"
-similar = { version = "2", features = ["inline"] }
+regex = { version = "1", default-features = false }
+rpassword = "7"
+serde = { version = "1", features = ["derive"] }
strsim = "0.10"
-bytes = "1.4"
strum = { version = "0.25", features = ["derive"] }
thiserror = "1"
-indicatif = "0.17"
-parking_lot = "0.12"
+tokio = { version = "1", features = ["macros"] }
+tracing = "0.1"
+tracing-error = "0.2"
+tracing-subscriber = { version = "0.3", features = ["registry", "env-filter", "fmt"] }
+yansi = "0.5"
[dev-dependencies]
-anvil.workspace = true
-foundry-utils.workspace = true
-foundry-cli-test-utils.path = "test-utils"
-pretty_assertions = "1"
-toml = "0.7"
-serial_test = "2"
-criterion = "0.4"
-svm = { package = "svm-rs", version = "0.3", default-features = false, features = ["rustls"] }
-globset = "0.4"
+tempfile = "3.7"
[features]
default = ["rustls"]
-rustls = ["ethers/rustls"]
+rustls = ["ethers/rustls", "rusoto_core/rustls"]
openssl = ["ethers/openssl"]
-
-# feature for integration tests that test external projects
-external-integration-tests = []
-
-# feature for heavy (long-running) integration tests
-heavy-integration-tests = []
-
-[[bin]]
-name = "cast"
-path = "src/cast/main.rs"
-doc = false
-
-[[bin]]
-name = "forge"
-path = "src/forge/main.rs"
-doc = false
-
-[[bench]]
-name = "forge_test"
-harness = false
-
-[[bench]]
-name = "cast"
-harness = false
diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs
index 8779c6defe276..39f4e95765dd2 100644
--- a/crates/cli/src/lib.rs
+++ b/crates/cli/src/lib.rs
@@ -1,3 +1,5 @@
+#![warn(unused_crate_dependencies)]
+
pub mod handler;
pub mod opts;
pub mod stdin;
diff --git a/crates/cli/src/opts/wallet/mod.rs b/crates/cli/src/opts/wallet/mod.rs
index 82e60e6d41cf8..a85b4e7c77026 100644
--- a/crates/cli/src/opts/wallet/mod.rs
+++ b/crates/cli/src/opts/wallet/mod.rs
@@ -1,6 +1,5 @@
use crate::opts::error::PrivateKeyError;
use async_trait::async_trait;
-use cast::{AwsChainProvider, AwsClient, AwsHttpClient, AwsRegion, KmsClient};
use clap::Parser;
use ethers::{
signers::{
@@ -16,6 +15,11 @@ use ethers::{
use eyre::{bail, Result, WrapErr};
use foundry_common::fs;
use foundry_config::Config;
+use rusoto_core::{
+ credential::ChainProvider as AwsChainProvider, region::Region as AwsRegion,
+ request::HttpClient as AwsHttpClient, Client as AwsClient,
+};
+use rusoto_kms::KmsClient;
use serde::{Deserialize, Serialize};
use std::{
path::{Path, PathBuf},
@@ -559,7 +563,8 @@ mod tests {
#[test]
fn find_keystore() {
- let keystore = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/keystore");
+ let keystore =
+ Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../cast/tests/fixtures/keystore"));
let keystore_file = keystore
.join("UTC--2022-10-30T06-51-20.130356000Z--560d246fcddc9ea98a8b032c9a2f474efb493c28");
let wallet: Wallet = Wallet::parse_from([
@@ -606,9 +611,7 @@ mod tests {
#[test]
fn gets_password_from_file() {
- let path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
- .join("tests/fixtures/keystore/password")
- .into_os_string();
+ let path = concat!(env!("CARGO_MANIFEST_DIR"), "/../cast/tests/fixtures/keystore/password");
let wallet: Wallet = Wallet::parse_from(["foundry-cli"]);
let password = wallet.password_from_file(path).unwrap();
assert_eq!(password, "this is keystore password")
diff --git a/crates/cli/src/opts/wallet/multi_wallet.rs b/crates/cli/src/opts/wallet/multi_wallet.rs
index 0f9aa43d5e6ab..92091e2263d6c 100644
--- a/crates/cli/src/opts/wallet/multi_wallet.rs
+++ b/crates/cli/src/opts/wallet/multi_wallet.rs
@@ -1,5 +1,4 @@
use super::{WalletSigner, WalletTrait};
-use cast::{AwsChainProvider, AwsClient, AwsHttpClient, AwsRegion, KmsClient};
use clap::Parser;
use ethers::{
prelude::{Middleware, Signer},
@@ -10,6 +9,11 @@ use eyre::{Context, ContextCompat, Result};
use foundry_common::RetryProvider;
use foundry_config::Config;
use itertools::izip;
+use rusoto_core::{
+ credential::ChainProvider as AwsChainProvider, region::Region as AwsRegion,
+ request::HttpClient as AwsHttpClient, Client as AwsClient,
+};
+use rusoto_kms::KmsClient;
use serde::Serialize;
use std::{
collections::{HashMap, HashSet},
@@ -440,7 +444,7 @@ impl MultiWallet {
#[cfg(test)]
mod tests {
use super::*;
- use std::path::PathBuf;
+ use std::path::Path;
#[test]
fn parse_keystore_args() {
@@ -457,13 +461,12 @@ mod tests {
#[test]
fn parse_keystore_password_file() {
- let keystore = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/keystore");
+ let keystore =
+ Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/../cast/tests/fixtures/keystore"));
let keystore_file = keystore
.join("UTC--2022-12-20T10-30-43.591916000Z--ec554aeafe75601aaab43bd4621a22284db566c2");
- let keystore_password_file = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
- .join("tests/fixtures/keystore/password-ec554")
- .into_os_string();
+ let keystore_password_file = keystore.join("password-ec554").into_os_string();
let args: MultiWallet = MultiWallet::parse_from([
"foundry-cli",
diff --git a/crates/cli/src/utils/cmd.rs b/crates/cli/src/utils/cmd.rs
index 914cdab436866..44a5dbc6f4b92 100644
--- a/crates/cli/src/utils/cmd.rs
+++ b/crates/cli/src/utils/cmd.rs
@@ -10,12 +10,11 @@ use ethers::{
},
};
use eyre::{Result, WrapErr};
-use forge::executor::opts::EvmOpts;
use foundry_common::{cli_warn, fs, TestFunctionExt};
use foundry_config::{error::ExtractConfigError, figment::Figment, Chain as ConfigChain, Config};
use foundry_evm::{
debug::DebugArena,
- executor::{DeployResult, EvmError, ExecutionErr, RawCallResult},
+ executor::{opts::EvmOpts, DeployResult, EvmError, ExecutionErr, RawCallResult},
trace::{
identifier::{EtherscanIdentifier, SignaturesIdentifier},
CallTraceDecoder, CallTraceDecoderBuilder, TraceKind, Traces,
diff --git a/crates/cli/src/utils/mod.rs b/crates/cli/src/utils/mod.rs
index f60d1d924d158..d94119cd5ad62 100644
--- a/crates/cli/src/utils/mod.rs
+++ b/crates/cli/src/utils/mod.rs
@@ -30,17 +30,6 @@ pub use suggestions::*;
#[doc(hidden)]
pub use foundry_config::utils::*;
-/// The version message for the current program, like
-/// `forge 0.1.0 (f01b232bc 2022-01-22T23:28:39.493201+00:00)`
-pub const VERSION_MESSAGE: &str = concat!(
- env!("CARGO_PKG_VERSION"),
- " (",
- env!("VERGEN_GIT_SHA"),
- " ",
- env!("VERGEN_BUILD_TIMESTAMP"),
- ")"
-);
-
/// Deterministic fuzzer seed used for gas snapshots and coverage reports.
///
/// The keccak256 hash of "foundry rulez"
@@ -533,9 +522,9 @@ https://github.com/foundry-rs/foundry/issues/new/choose"
#[cfg(test)]
mod tests {
use super::*;
- use foundry_cli_test_utils::tempfile::tempdir;
use foundry_common::fs;
use std::{env, fs::File, io::Write};
+ use tempfile::tempdir;
#[test]
fn foundry_path_ext_works() {
diff --git a/crates/cli/tests/it/heavy_integration.rs b/crates/cli/tests/it/heavy_integration.rs
deleted file mode 100644
index 16db33965c153..0000000000000
--- a/crates/cli/tests/it/heavy_integration.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-// ! Heavy integration tests that can take an hour to run or more.
-use foundry_cli_test_utils::forgetest_external;
-
-forgetest_external!(maple, "maple-labs/maple-core-v2");
diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs
index 19aa0ef3dcf52..cb045a25bb279 100644
--- a/crates/common/src/lib.rs
+++ b/crates/common/src/lib.rs
@@ -1,5 +1,6 @@
//! Common utilities for building and using foundry's tools.
-#![deny(missing_docs, unused_crate_dependencies)]
+
+#![warn(missing_docs, unused_crate_dependencies)]
pub mod abi;
pub mod calc;
diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs
index 776c3d55da030..80899815fd1c9 100644
--- a/crates/config/src/lib.rs
+++ b/crates/config/src/lib.rs
@@ -1,5 +1,6 @@
-//! foundry configuration.
-#![deny(missing_docs, unsafe_code, unused_crate_dependencies)]
+//! Foundry configuration.
+
+#![warn(missing_docs, unused_crate_dependencies)]
use crate::cache::StorageCachingConfig;
use ethers_core::types::{Address, Chain::Mainnet, H160, H256, U256};
diff --git a/crates/doc/Cargo.toml b/crates/doc/Cargo.toml
index 1e694f2ebb8b2..b189f3732f69e 100644
--- a/crates/doc/Cargo.toml
+++ b/crates/doc/Cargo.toml
@@ -12,7 +12,6 @@ repository.workspace = true
[dependencies]
# foundry internal
-foundry-common.workspace = true
forge-fmt.workspace = true
foundry-config.workspace = true
foundry-utils.workspace = true
@@ -21,9 +20,6 @@ foundry-utils.workspace = true
ethers-solc = { workspace = true, features = ["async"] }
ethers-core.workspace = true
-# cli
-clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }
-
# tracing
tracing = "0.1"
@@ -38,7 +34,7 @@ solang-parser.workspace = true
eyre = "0.6"
thiserror = "1"
rayon = "1"
-itertools = "0.10"
+itertools.workspace = true
toml = "0.7"
auto_impl = "1"
derive_more = "0.99"
diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs
index cfc5a107f675e..d629283b55723 100644
--- a/crates/doc/src/lib.rs
+++ b/crates/doc/src/lib.rs
@@ -1,4 +1,4 @@
-#![warn(missing_debug_implementations, missing_docs, unreachable_pub)]
+#![warn(missing_debug_implementations, missing_docs, unreachable_pub, unused_crate_dependencies)]
#![deny(unused_must_use, rust_2018_idioms)]
#![doc(test(
no_crate_inject,
diff --git a/crates/evm/Cargo.toml b/crates/evm/Cargo.toml
index 70db99d7d5846..4ebb920539d46 100644
--- a/crates/evm/Cargo.toml
+++ b/crates/evm/Cargo.toml
@@ -46,7 +46,7 @@ revm = { version = "3", default-features = false, features = [
"memory_limit",
"optional_eip3607",
"optional_block_gas_limit",
- "optional_no_base_fee"
+ "optional_no_base_fee",
] }
# Fuzzer
@@ -58,7 +58,7 @@ yansi = "0.5"
# Misc
url = "2"
auto_impl = "1"
-itertools = "0.10"
+itertools.workspace = true
ordered-float = "3"
walkdir = "2"
diff --git a/crates/evm/src/lib.rs b/crates/evm/src/lib.rs
index 5f6090f272700..1d4d04ce89ad1 100644
--- a/crates/evm/src/lib.rs
+++ b/crates/evm/src/lib.rs
@@ -1,3 +1,5 @@
+#![warn(unused_crate_dependencies)]
+
#[macro_use]
extern crate tracing;
diff --git a/crates/fmt/Cargo.toml b/crates/fmt/Cargo.toml
index 7e37191c5ba45..fd57b6ec80bc5 100644
--- a/crates/fmt/Cargo.toml
+++ b/crates/fmt/Cargo.toml
@@ -20,14 +20,13 @@ ethers-core.workspace = true
solang-parser.workspace = true
# misc
-semver = "1"
-itertools = "0.10"
+itertools.workspace = true
thiserror = "1"
ariadne = "0.2"
tracing = "0.1"
[dev-dependencies]
pretty_assertions = "1"
-itertools = "0.10"
+itertools.workspace = true
toml = "0.7"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
diff --git a/crates/fmt/src/lib.rs b/crates/fmt/src/lib.rs
index 8ece42f8a7a1f..66f8bc4a5d35c 100644
--- a/crates/fmt/src/lib.rs
+++ b/crates/fmt/src/lib.rs
@@ -1,4 +1,5 @@
#![doc = include_str!("../README.md")]
+#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#[macro_use]
extern crate tracing;
diff --git a/crates/forge/Cargo.toml b/crates/forge/Cargo.toml
index 72205cdaff9be..c7e48e46bd8b3 100644
--- a/crates/forge/Cargo.toml
+++ b/crates/forge/Cargo.toml
@@ -1,5 +1,6 @@
[package]
name = "forge"
+description = "Fast and flexible Ethereum testing framework"
version.workspace = true
edition.workspace = true
@@ -8,35 +9,82 @@ authors.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
-exclude.workspace = true
+
+[[bin]]
+name = "forge"
+path = "bin/main.rs"
+
+[build-dependencies]
+vergen = { version = "8", default-features = false, features = ["build", "git", "git2"] }
[dependencies]
+# lib
foundry-utils.workspace = true
foundry-common.workspace = true
foundry-config.workspace = true
foundry-evm.workspace = true
-# TODO: Trim down
-ethers = { workspace = true, features = ["solc-full"] }
-
comfy-table = "6"
+ethers = { workspace = true, features = ["solc-full"] }
eyre = "0.6"
-glob = "0.3"
+proptest = "1"
+rayon = "1"
+serde = "1"
+tracing = "0.1"
+yansi = "0.5"
+
+# bin
+forge-fmt.workspace = true
+forge-doc.workspace = true
+foundry-cli.workspace = true
+ui.workspace = true
+
+async-trait = "0.1"
+bytes = "1.4"
+clap = { version = "4", features = ["derive", "env", "unicode", "wrap_help"] }
+clap_complete = "4"
+clap_complete_fig = "4"
+dialoguer = { version = "0.10", default-features = false }
+dunce = "1"
+futures = "0.3"
hex.workspace = true
+indicatif = "0.17"
+itertools.workspace = true
once_cell = "1"
parking_lot = "0.12"
-proptest = "1"
-rayon = "1"
regex = { version = "1", default-features = false }
-rlp = "0.5"
+reqwest = { version = "0.11", default-features = false, features = ["json"] }
semver = "1"
-serde = "1"
serde_json = "1"
+similar = { version = "2", features = ["inline"] }
+solang-parser.workspace = true
+strum = { version = "0.25", features = ["derive"] }
+thiserror = "1"
tokio = { version = "1", features = ["time"] }
-tracing = "0.1"
-tracing-subscriber = "0.3"
-yansi = "0.5"
+watchexec = "2"
[dev-dependencies]
-ethers = { workspace = true, features = ["solc-full", "solc-tests", "rustls"] }
-foundry-utils.workspace = true
+anvil.workspace = true
+foundry-test-utils.workspace = true
+
+criterion = "0.5"
+globset = "0.4"
+path-slash = "0.2"
+pretty_assertions = "1"
+serial_test = "2"
+svm = { package = "svm-rs", version = "0.3", default-features = false, features = ["rustls"] }
+
+[features]
+default = ["rustls"]
+rustls = ["foundry-cli/rustls", "reqwest/rustls-tls", "reqwest/rustls-tls-native-roots"]
+openssl = ["foundry-cli/openssl", "reqwest/default-tls"]
+
+# feature for integration tests that test external projects
+external-integration-tests = []
+
+# feature for heavy (long-running) integration tests
+heavy-integration-tests = []
+
+[[bench]]
+name = "test"
+harness = false
diff --git a/crates/cli/assets/.gitignoreTemplate b/crates/forge/assets/.gitignoreTemplate
similarity index 100%
rename from crates/cli/assets/.gitignoreTemplate
rename to crates/forge/assets/.gitignoreTemplate
diff --git a/crates/cli/assets/CounterTemplate.s.sol b/crates/forge/assets/CounterTemplate.s.sol
similarity index 100%
rename from crates/cli/assets/CounterTemplate.s.sol
rename to crates/forge/assets/CounterTemplate.s.sol
diff --git a/crates/cli/assets/CounterTemplate.sol b/crates/forge/assets/CounterTemplate.sol
similarity index 100%
rename from crates/cli/assets/CounterTemplate.sol
rename to crates/forge/assets/CounterTemplate.sol
diff --git a/crates/cli/assets/CounterTemplate.t.sol b/crates/forge/assets/CounterTemplate.t.sol
similarity index 100%
rename from crates/cli/assets/CounterTemplate.t.sol
rename to crates/forge/assets/CounterTemplate.t.sol
diff --git a/crates/cli/assets/README.md b/crates/forge/assets/README.md
similarity index 100%
rename from crates/cli/assets/README.md
rename to crates/forge/assets/README.md
diff --git a/crates/cli/assets/generated/TestTemplate.t.sol b/crates/forge/assets/generated/TestTemplate.t.sol
similarity index 100%
rename from crates/cli/assets/generated/TestTemplate.t.sol
rename to crates/forge/assets/generated/TestTemplate.t.sol
diff --git a/crates/cli/assets/workflowTemplate.yml b/crates/forge/assets/workflowTemplate.yml
similarity index 100%
rename from crates/cli/assets/workflowTemplate.yml
rename to crates/forge/assets/workflowTemplate.yml
diff --git a/crates/cli/benches/forge_test.rs b/crates/forge/benches/test.rs
similarity index 89%
rename from crates/cli/benches/forge_test.rs
rename to crates/forge/benches/test.rs
index 7ce87d967ef58..7650077b116ac 100644
--- a/crates/cli/benches/forge_test.rs
+++ b/crates/forge/benches/test.rs
@@ -1,5 +1,5 @@
use criterion::{criterion_group, criterion_main, Criterion};
-use foundry_cli_test_utils::{util::setup_forge_remote, TestCommand, TestProject};
+use foundry_test_utils::{util::setup_forge_remote, TestCommand, TestProject};
/// Returns a cloned and `forge built` `solmate` project
fn built_solmate() -> (TestProject, TestCommand) {
diff --git a/crates/cli/src/forge/cmd/bind.rs b/crates/forge/bin/cmd/bind.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/bind.rs
rename to crates/forge/bin/cmd/bind.rs
diff --git a/crates/cli/src/forge/cmd/build.rs b/crates/forge/bin/cmd/build.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/build.rs
rename to crates/forge/bin/cmd/build.rs
diff --git a/crates/cli/src/forge/cmd/cache.rs b/crates/forge/bin/cmd/cache.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/cache.rs
rename to crates/forge/bin/cmd/cache.rs
diff --git a/crates/cli/src/forge/cmd/config.rs b/crates/forge/bin/cmd/config.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/config.rs
rename to crates/forge/bin/cmd/config.rs
diff --git a/crates/cli/src/forge/cmd/coverage.rs b/crates/forge/bin/cmd/coverage.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/coverage.rs
rename to crates/forge/bin/cmd/coverage.rs
diff --git a/crates/cli/src/forge/cmd/create.rs b/crates/forge/bin/cmd/create.rs
similarity index 97%
rename from crates/cli/src/forge/cmd/create.rs
rename to crates/forge/bin/cmd/create.rs
index fb2abf16b23a4..ad82163aa72f6 100644
--- a/crates/cli/src/forge/cmd/create.rs
+++ b/crates/forge/bin/cmd/create.rs
@@ -1,11 +1,11 @@
use super::{retry::RetryArgs, verify};
-use cast::SimpleCast;
use clap::{Parser, ValueHint};
use ethers::{
abi::{Abi, Constructor, Token},
prelude::{artifacts::BytecodeObject, ContractFactory, Middleware, MiddlewareBuilder},
solc::{info::ContractInfo, utils::canonicalized},
types::{transaction::eip2718::TypedTransaction, Chain},
+ utils::to_checksum,
};
use eyre::{Context, Result};
use foundry_cli::{
@@ -271,14 +271,14 @@ impl CreateArgs {
let address = deployed_contract.address();
if self.json {
let output = json!({
- "deployer": SimpleCast::to_checksum_address(&deployer_address),
- "deployedTo": SimpleCast::to_checksum_address(&address),
+ "deployer": to_checksum(&deployer_address, None),
+ "deployedTo": to_checksum(&address, None),
"transactionHash": receipt.transaction_hash
});
println!("{output}");
} else {
- println!("Deployer: {}", SimpleCast::to_checksum_address(&deployer_address));
- println!("Deployed to: {}", SimpleCast::to_checksum_address(&address));
+ println!("Deployer: {}", to_checksum(&deployer_address, None));
+ println!("Deployed to: {}", to_checksum(&address, None));
println!("Transaction hash: {:?}", receipt.transaction_hash);
};
diff --git a/crates/cli/src/forge/cmd/debug.rs b/crates/forge/bin/cmd/debug.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/debug.rs
rename to crates/forge/bin/cmd/debug.rs
diff --git a/crates/cli/src/forge/cmd/doc.rs b/crates/forge/bin/cmd/doc.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/doc.rs
rename to crates/forge/bin/cmd/doc.rs
diff --git a/crates/cli/src/forge/cmd/flatten.rs b/crates/forge/bin/cmd/flatten.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/flatten.rs
rename to crates/forge/bin/cmd/flatten.rs
diff --git a/crates/cli/src/forge/cmd/fmt.rs b/crates/forge/bin/cmd/fmt.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/fmt.rs
rename to crates/forge/bin/cmd/fmt.rs
diff --git a/crates/cli/src/forge/cmd/fourbyte.rs b/crates/forge/bin/cmd/fourbyte.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/fourbyte.rs
rename to crates/forge/bin/cmd/fourbyte.rs
diff --git a/crates/cli/src/forge/cmd/geiger/error.rs b/crates/forge/bin/cmd/geiger/error.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/geiger/error.rs
rename to crates/forge/bin/cmd/geiger/error.rs
diff --git a/crates/cli/src/forge/cmd/geiger/find.rs b/crates/forge/bin/cmd/geiger/find.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/geiger/find.rs
rename to crates/forge/bin/cmd/geiger/find.rs
diff --git a/crates/cli/src/forge/cmd/geiger/mod.rs b/crates/forge/bin/cmd/geiger/mod.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/geiger/mod.rs
rename to crates/forge/bin/cmd/geiger/mod.rs
diff --git a/crates/cli/src/forge/cmd/geiger/visitor.rs b/crates/forge/bin/cmd/geiger/visitor.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/geiger/visitor.rs
rename to crates/forge/bin/cmd/geiger/visitor.rs
diff --git a/crates/cli/src/forge/cmd/generate/mod.rs b/crates/forge/bin/cmd/generate/mod.rs
similarity index 95%
rename from crates/cli/src/forge/cmd/generate/mod.rs
rename to crates/forge/bin/cmd/generate/mod.rs
index 7f5ffbc5070b8..9e25d6532a808 100644
--- a/crates/cli/src/forge/cmd/generate/mod.rs
+++ b/crates/forge/bin/cmd/generate/mod.rs
@@ -30,7 +30,7 @@ impl GenerateTestArgs {
let instance_name = format_identifier(&self.contract_name, false);
// Create the test file content.
- let test_content = include_str!("../../../../assets/generated/TestTemplate.t.sol");
+ let test_content = include_str!("../../../assets/generated/TestTemplate.t.sol");
let test_content = test_content
.replace("{contract_name}", &contract_name)
.replace("{instance_name}", &instance_name);
diff --git a/crates/cli/src/forge/cmd/init.rs b/crates/forge/bin/cmd/init.rs
similarity index 93%
rename from crates/cli/src/forge/cmd/init.rs
rename to crates/forge/bin/cmd/init.rs
index 6bc8f80db76c3..2ae3c91844e0c 100644
--- a/crates/cli/src/forge/cmd/init.rs
+++ b/crates/forge/bin/cmd/init.rs
@@ -101,16 +101,16 @@ impl InitArgs {
// write the contract file
let contract_path = src.join("Counter.sol");
- fs::write(contract_path, include_str!("../../../assets/CounterTemplate.sol"))?;
+ fs::write(contract_path, include_str!("../../assets/CounterTemplate.sol"))?;
// write the tests
let contract_path = test.join("Counter.t.sol");
- fs::write(contract_path, include_str!("../../../assets/CounterTemplate.t.sol"))?;
+ fs::write(contract_path, include_str!("../../assets/CounterTemplate.t.sol"))?;
// write the script
let contract_path = script.join("Counter.s.sol");
- fs::write(contract_path, include_str!("../../../assets/CounterTemplate.s.sol"))?;
+ fs::write(contract_path, include_str!("../../assets/CounterTemplate.s.sol"))?;
// Write the default README file
let readme_path = root.join("README.md");
- fs::write(readme_path, include_str!("../../../assets/README.md"))?;
+ fs::write(readme_path, include_str!("../../assets/README.md"))?;
// write foundry.toml, if it doesn't exist already
let dest = root.join(Config::FILE_NAME);
@@ -166,14 +166,14 @@ fn init_git_repo(git: Git<'_>, no_commit: bool) -> Result<()> {
// .gitignore
let gitignore = git.root.join(".gitignore");
if !gitignore.exists() {
- fs::write(gitignore, include_str!("../../../assets/.gitignoreTemplate"))?;
+ fs::write(gitignore, include_str!("../../assets/.gitignoreTemplate"))?;
}
// github workflow
let workflow = git.root.join(".github/workflows/test.yml");
if !workflow.exists() {
fs::create_dir_all(workflow.parent().unwrap())?;
- fs::write(workflow, include_str!("../../../assets/workflowTemplate.yml"))?;
+ fs::write(workflow, include_str!("../../assets/workflowTemplate.yml"))?;
}
// commit everything
diff --git a/crates/cli/src/forge/cmd/inspect.rs b/crates/forge/bin/cmd/inspect.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/inspect.rs
rename to crates/forge/bin/cmd/inspect.rs
diff --git a/crates/cli/src/forge/cmd/install.rs b/crates/forge/bin/cmd/install.rs
similarity index 99%
rename from crates/cli/src/forge/cmd/install.rs
rename to crates/forge/bin/cmd/install.rs
index 945ddfc2155e8..5dcf3960adf17 100644
--- a/crates/cli/src/forge/cmd/install.rs
+++ b/crates/forge/bin/cmd/install.rs
@@ -488,7 +488,7 @@ fn match_yn(input: String) -> bool {
#[cfg(test)]
mod tests {
use super::*;
- use foundry_cli_test_utils::tempfile::tempdir;
+ use foundry_test_utils::tempfile::tempdir;
#[test]
fn get_oz_tags() {
diff --git a/crates/cli/src/forge/cmd/mod.rs b/crates/forge/bin/cmd/mod.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/mod.rs
rename to crates/forge/bin/cmd/mod.rs
diff --git a/crates/cli/src/forge/cmd/remappings.rs b/crates/forge/bin/cmd/remappings.rs
similarity index 98%
rename from crates/cli/src/forge/cmd/remappings.rs
rename to crates/forge/bin/cmd/remappings.rs
index 17277fd16b812..c3d30cf73526e 100644
--- a/crates/cli/src/forge/cmd/remappings.rs
+++ b/crates/forge/bin/cmd/remappings.rs
@@ -1,9 +1,9 @@
-use cast::HashMap;
use clap::{Parser, ValueHint};
use ethers::solc::remappings::RelativeRemapping;
use eyre::Result;
use foundry_cli::utils::LoadConfig;
use foundry_config::impl_figment_convert_basic;
+use foundry_evm::HashMap;
use std::path::PathBuf;
/// CLI arguments for `forge remappings`.
diff --git a/crates/cli/src/forge/cmd/remove.rs b/crates/forge/bin/cmd/remove.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/remove.rs
rename to crates/forge/bin/cmd/remove.rs
diff --git a/crates/cli/src/forge/cmd/retry.rs b/crates/forge/bin/cmd/retry.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/retry.rs
rename to crates/forge/bin/cmd/retry.rs
diff --git a/crates/cli/src/forge/cmd/script/artifacts.rs b/crates/forge/bin/cmd/script/artifacts.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/artifacts.rs
rename to crates/forge/bin/cmd/script/artifacts.rs
diff --git a/crates/cli/src/forge/cmd/script/broadcast.rs b/crates/forge/bin/cmd/script/broadcast.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/broadcast.rs
rename to crates/forge/bin/cmd/script/broadcast.rs
diff --git a/crates/cli/src/forge/cmd/script/build.rs b/crates/forge/bin/cmd/script/build.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/build.rs
rename to crates/forge/bin/cmd/script/build.rs
diff --git a/crates/cli/src/forge/cmd/script/cmd.rs b/crates/forge/bin/cmd/script/cmd.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/cmd.rs
rename to crates/forge/bin/cmd/script/cmd.rs
diff --git a/crates/cli/src/forge/cmd/script/executor.rs b/crates/forge/bin/cmd/script/executor.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/executor.rs
rename to crates/forge/bin/cmd/script/executor.rs
diff --git a/crates/cli/src/forge/cmd/script/mod.rs b/crates/forge/bin/cmd/script/mod.rs
similarity index 99%
rename from crates/cli/src/forge/cmd/script/mod.rs
rename to crates/forge/bin/cmd/script/mod.rs
index 70d0ad354ec3c..1825644c31295 100644
--- a/crates/cli/src/forge/cmd/script/mod.rs
+++ b/crates/forge/bin/cmd/script/mod.rs
@@ -3,13 +3,6 @@ use self::{
runner::ScriptRunner,
};
use super::{build::BuildArgs, retry::RetryArgs};
-use cast::{
- decode,
- executor::inspector::{
- cheatcodes::{util::BroadcastableTransactions, BroadcastableTransaction},
- DEFAULT_CREATE2_DEPLOYER,
- },
-};
use clap::{Parser, ValueHint};
use dialoguer::Confirm;
use ethers::{
@@ -54,6 +47,13 @@ use foundry_config::{
},
Config,
};
+use foundry_evm::{
+ decode,
+ executor::inspector::{
+ cheatcodes::{util::BroadcastableTransactions, BroadcastableTransaction},
+ DEFAULT_CREATE2_DEPLOYER,
+ },
+};
use futures::future;
use serde::{Deserialize, Serialize};
use std::{
@@ -785,8 +785,8 @@ For more information, please see https://eips.ethereum.org/EIPS/eip-3855"#,
mod tests {
use super::*;
use foundry_cli::utils::LoadConfig;
- use foundry_cli_test_utils::tempfile::tempdir;
use foundry_config::UnresolvedEnvVarError;
+ use foundry_test_utils::tempfile::tempdir;
use std::fs;
#[test]
diff --git a/crates/cli/src/forge/cmd/script/multi.rs b/crates/forge/bin/cmd/script/multi.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/multi.rs
rename to crates/forge/bin/cmd/script/multi.rs
diff --git a/crates/cli/src/forge/cmd/script/providers.rs b/crates/forge/bin/cmd/script/providers.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/providers.rs
rename to crates/forge/bin/cmd/script/providers.rs
diff --git a/crates/cli/src/forge/cmd/script/receipts.rs b/crates/forge/bin/cmd/script/receipts.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/receipts.rs
rename to crates/forge/bin/cmd/script/receipts.rs
diff --git a/crates/cli/src/forge/cmd/script/runner.rs b/crates/forge/bin/cmd/script/runner.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/runner.rs
rename to crates/forge/bin/cmd/script/runner.rs
diff --git a/crates/cli/src/forge/cmd/script/sequence.rs b/crates/forge/bin/cmd/script/sequence.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/sequence.rs
rename to crates/forge/bin/cmd/script/sequence.rs
diff --git a/crates/cli/src/forge/cmd/script/transaction.rs b/crates/forge/bin/cmd/script/transaction.rs
similarity index 99%
rename from crates/cli/src/forge/cmd/script/transaction.rs
rename to crates/forge/bin/cmd/script/transaction.rs
index 2f0bf4cf9a6c9..73d466f3a460b 100644
--- a/crates/cli/src/forge/cmd/script/transaction.rs
+++ b/crates/forge/bin/cmd/script/transaction.rs
@@ -1,5 +1,4 @@
use super::{artifacts::ArtifactInfo, ScriptResult};
-use cast::{executor::inspector::DEFAULT_CREATE2_DEPLOYER, trace::CallTraceDecoder, CallKind};
use ethers::{
abi,
abi::Address,
@@ -8,6 +7,9 @@ use ethers::{
};
use eyre::{ContextCompat, Result, WrapErr};
use foundry_common::{abi::format_token_raw, RpcUrl, SELECTOR_LEN};
+use foundry_evm::{
+ executor::inspector::DEFAULT_CREATE2_DEPLOYER, trace::CallTraceDecoder, CallKind,
+};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use tracing::error;
diff --git a/crates/cli/src/forge/cmd/script/verify.rs b/crates/forge/bin/cmd/script/verify.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/script/verify.rs
rename to crates/forge/bin/cmd/script/verify.rs
diff --git a/crates/cli/src/forge/cmd/selectors.rs b/crates/forge/bin/cmd/selectors.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/selectors.rs
rename to crates/forge/bin/cmd/selectors.rs
diff --git a/crates/cli/src/forge/cmd/snapshot.rs b/crates/forge/bin/cmd/snapshot.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/snapshot.rs
rename to crates/forge/bin/cmd/snapshot.rs
diff --git a/crates/cli/src/forge/cmd/test/filter.rs b/crates/forge/bin/cmd/test/filter.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/test/filter.rs
rename to crates/forge/bin/cmd/test/filter.rs
diff --git a/crates/cli/src/forge/cmd/test/mod.rs b/crates/forge/bin/cmd/test/mod.rs
similarity index 99%
rename from crates/cli/src/forge/cmd/test/mod.rs
rename to crates/forge/bin/cmd/test/mod.rs
index 113903ca1e12d..f5648b850b899 100644
--- a/crates/cli/src/forge/cmd/test/mod.rs
+++ b/crates/forge/bin/cmd/test/mod.rs
@@ -1,5 +1,4 @@
use super::{debug::DebugArgs, install, test::filter::ProjectPathsAwareFilter, watch::WatchArgs};
-use cast::fuzz::CounterExample;
use clap::Parser;
use ethers::types::U256;
use eyre::Result;
@@ -31,7 +30,7 @@ use foundry_config::{
},
get_available_profiles, Config,
};
-use foundry_evm::utils::evm_spec;
+use foundry_evm::{fuzz::CounterExample, utils::evm_spec};
use regex::Regex;
use std::{collections::BTreeMap, path::PathBuf, sync::mpsc::channel, time::Duration};
use tracing::trace;
diff --git a/crates/cli/src/forge/cmd/tree.rs b/crates/forge/bin/cmd/tree.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/tree.rs
rename to crates/forge/bin/cmd/tree.rs
diff --git a/crates/cli/src/forge/cmd/update.rs b/crates/forge/bin/cmd/update.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/update.rs
rename to crates/forge/bin/cmd/update.rs
diff --git a/crates/cli/src/forge/cmd/verify/etherscan/flatten.rs b/crates/forge/bin/cmd/verify/etherscan/flatten.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/verify/etherscan/flatten.rs
rename to crates/forge/bin/cmd/verify/etherscan/flatten.rs
diff --git a/crates/cli/src/forge/cmd/verify/etherscan/mod.rs b/crates/forge/bin/cmd/verify/etherscan/mod.rs
similarity index 98%
rename from crates/cli/src/forge/cmd/verify/etherscan/mod.rs
rename to crates/forge/bin/cmd/verify/etherscan/mod.rs
index 38c287103e992..b0d5edbe4e16e 100644
--- a/crates/cli/src/forge/cmd/verify/etherscan/mod.rs
+++ b/crates/forge/bin/cmd/verify/etherscan/mod.rs
@@ -1,6 +1,5 @@
use super::{provider::VerificationProvider, VerifyArgs, VerifyCheckArgs};
use crate::cmd::retry::RETRY_CHECK_ON_VERIFY;
-use cast::SimpleCast;
use ethers::{
abi::Function,
etherscan::{
@@ -10,6 +9,7 @@ use ethers::{
},
prelude::errors::EtherscanError,
solc::{artifacts::CompactContract, cache::CacheEntry, Project, Solc},
+ utils::to_checksum,
};
use eyre::{eyre, Context, Result};
use foundry_cli::utils::{get_cached_entry_by_name, read_constructor_args_file, LoadConfig};
@@ -66,7 +66,7 @@ impl VerificationProvider for EtherscanVerificationProvider {
println!(
"\nContract [{}] {:?} is already verified. Skipping verification.",
verify_args.contract_name,
- SimpleCast::to_checksum_address(&verify_args.address)
+ to_checksum(&verify_args.address, None)
);
return Ok(())
@@ -77,7 +77,7 @@ impl VerificationProvider for EtherscanVerificationProvider {
let retry: Retry = args.retry.into();
let resp = retry.run_async(|| {
async {
- println!("\nSubmitting verification for [{}] {:?}.", verify_args.contract_name, SimpleCast::to_checksum_address(&verify_args.address));
+ println!("\nSubmitting verification for [{}] {:?}.", verify_args.contract_name, to_checksum(&verify_args.address, None));
let resp = etherscan
.submit_contract_verification(&verify_args)
.await
@@ -454,8 +454,8 @@ mod tests {
use super::*;
use clap::Parser;
use foundry_cli::utils::LoadConfig;
- use foundry_cli_test_utils::tempfile::tempdir;
use foundry_common::fs;
+ use foundry_test_utils::tempfile::tempdir;
#[test]
fn can_extract_etherscan_verify_config() {
diff --git a/crates/cli/src/forge/cmd/verify/etherscan/standard_json.rs b/crates/forge/bin/cmd/verify/etherscan/standard_json.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/verify/etherscan/standard_json.rs
rename to crates/forge/bin/cmd/verify/etherscan/standard_json.rs
diff --git a/crates/cli/src/forge/cmd/verify/mod.rs b/crates/forge/bin/cmd/verify/mod.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/verify/mod.rs
rename to crates/forge/bin/cmd/verify/mod.rs
diff --git a/crates/cli/src/forge/cmd/verify/provider.rs b/crates/forge/bin/cmd/verify/provider.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/verify/provider.rs
rename to crates/forge/bin/cmd/verify/provider.rs
diff --git a/crates/cli/src/forge/cmd/verify/sourcify.rs b/crates/forge/bin/cmd/verify/sourcify.rs
similarity index 98%
rename from crates/cli/src/forge/cmd/verify/sourcify.rs
rename to crates/forge/bin/cmd/verify/sourcify.rs
index af1a0dc30a7ff..30a5139ba61ad 100644
--- a/crates/cli/src/forge/cmd/verify/sourcify.rs
+++ b/crates/forge/bin/cmd/verify/sourcify.rs
@@ -1,7 +1,6 @@
use super::{provider::VerificationProvider, VerifyArgs, VerifyCheckArgs};
use async_trait::async_trait;
-use cast::SimpleCast;
-use ethers::solc::ConfigurableContractArtifact;
+use ethers::{solc::ConfigurableContractArtifact, utils::to_checksum};
use eyre::Result;
use foundry_cli::utils::{get_cached_entry_by_name, LoadConfig};
use foundry_common::fs;
@@ -39,7 +38,7 @@ impl VerificationProvider for SourcifyVerificationProvider {
println!(
"\nSubmitting verification for [{}] {:?}.",
args.contract.name,
- SimpleCast::to_checksum_address(&args.address)
+ to_checksum(&args.address, None)
);
let response = client
.post(args.verifier.verifier_url.as_deref().unwrap_or(SOURCIFY_URL))
diff --git a/crates/cli/src/forge/cmd/watch.rs b/crates/forge/bin/cmd/watch.rs
similarity index 100%
rename from crates/cli/src/forge/cmd/watch.rs
rename to crates/forge/bin/cmd/watch.rs
diff --git a/crates/cli/src/forge/main.rs b/crates/forge/bin/main.rs
similarity index 100%
rename from crates/cli/src/forge/main.rs
rename to crates/forge/bin/main.rs
diff --git a/crates/cli/src/forge/opts.rs b/crates/forge/bin/opts.rs
similarity index 95%
rename from crates/cli/src/forge/opts.rs
rename to crates/forge/bin/opts.rs
index fd3f3a1f4dd8a..68c2683ca14e2 100644
--- a/crates/cli/src/forge/opts.rs
+++ b/crates/forge/bin/opts.rs
@@ -23,8 +23,17 @@ use crate::cmd::{
use clap::{Parser, Subcommand, ValueHint};
use std::path::PathBuf;
+const VERSION_MESSAGE: &str = concat!(
+ env!("CARGO_PKG_VERSION"),
+ " (",
+ env!("VERGEN_GIT_SHA"),
+ " ",
+ env!("VERGEN_BUILD_TIMESTAMP"),
+ ")"
+);
+
#[derive(Debug, Parser)]
-#[clap(name = "forge", version = foundry_cli::utils::VERSION_MESSAGE)]
+#[clap(name = "forge", version = VERSION_MESSAGE)]
pub struct Opts {
#[clap(subcommand)]
pub sub: Subcommands,
diff --git a/crates/forge/build.rs b/crates/forge/build.rs
new file mode 100644
index 0000000000000..c2f550fb6f829
--- /dev/null
+++ b/crates/forge/build.rs
@@ -0,0 +1,3 @@
+fn main() {
+ vergen::EmitBuilder::builder().build_timestamp().git_sha(true).emit().unwrap();
+}
diff --git a/crates/cli/tests/it/cache.rs b/crates/forge/tests/cli/cache.rs
similarity index 94%
rename from crates/cli/tests/it/cache.rs
rename to crates/forge/tests/cli/cache.rs
index 55499c850d944..22fc6ea2339ec 100644
--- a/crates/cli/tests/it/cache.rs
+++ b/crates/forge/tests/cli/cache.rs
@@ -1,5 +1,5 @@
//! Tests for various cache command
-use foundry_cli_test_utils::{
+use foundry_test_utils::{
forgetest,
util::{TestCommand, TestProject},
};
diff --git a/crates/cli/tests/it/cmd.rs b/crates/forge/tests/cli/cmd.rs
similarity index 99%
rename from crates/cli/tests/it/cmd.rs
rename to crates/forge/tests/cli/cmd.rs
index 9952df8d11bef..09a504ffe0db0 100644
--- a/crates/cli/tests/it/cmd.rs
+++ b/crates/forge/tests/cli/cmd.rs
@@ -8,12 +8,12 @@ use ethers::{
ConfigurableContractArtifact,
},
};
-use foundry_cli_test_utils::{
+use foundry_config::{parse_with_profile, BasicConfig, Chain, Config, SolidityErrorCode};
+use foundry_test_utils::{
ethers_solc::PathStyle,
forgetest, forgetest_init,
util::{pretty_err, read_string, OutputExt, TestCommand, TestProject},
};
-use foundry_config::{parse_with_profile, BasicConfig, Chain, Config, SolidityErrorCode};
use semver::Version;
use std::{
env, fs,
diff --git a/crates/cli/tests/it/config.rs b/crates/forge/tests/cli/config.rs
similarity index 99%
rename from crates/cli/tests/it/config.rs
rename to crates/forge/tests/cli/config.rs
index b1bdb03d9ab63..597f304f75154 100644
--- a/crates/cli/tests/it/config.rs
+++ b/crates/forge/tests/cli/config.rs
@@ -1,20 +1,21 @@
//! Contains various tests for checking forge commands related to config values
-use crate::forge_utils;
+
use ethers::{
prelude::artifacts::YulDetails,
solc::artifacts::RevertStrings,
types::{Address, H256, U256},
};
-use forge::executor::opts::EvmOpts;
-use foundry_cli_test_utils::{
- ethers_solc::{remappings::Remapping, EvmVersion},
- forgetest, forgetest_init, pretty_eq,
- util::{pretty_err, OutputExt, TestCommand, TestProject},
-};
+use foundry_cli::utils as forge_utils;
use foundry_config::{
cache::{CachedChains, CachedEndpoints, StorageCachingConfig},
Config, FuzzConfig, InvariantConfig, OptimizerDetails, SolcReq,
};
+use foundry_evm::executor::opts::EvmOpts;
+use foundry_test_utils::{
+ ethers_solc::{remappings::Remapping, EvmVersion},
+ forgetest, forgetest_init, pretty_eq,
+ util::{pretty_err, OutputExt, TestCommand, TestProject},
+};
use path_slash::PathBufExt;
use std::{fs, path::PathBuf, str::FromStr};
diff --git a/crates/cli/tests/it/constants.rs b/crates/forge/tests/cli/constants.rs
similarity index 100%
rename from crates/cli/tests/it/constants.rs
rename to crates/forge/tests/cli/constants.rs
diff --git a/crates/cli/tests/it/create.rs b/crates/forge/tests/cli/create.rs
similarity index 99%
rename from crates/cli/tests/it/create.rs
rename to crates/forge/tests/cli/create.rs
index b790dfd84daf4..4f2d67ff58d43 100644
--- a/crates/cli/tests/it/create.rs
+++ b/crates/forge/tests/cli/create.rs
@@ -9,11 +9,11 @@ use ethers::{
solc::{artifacts::BytecodeHash, remappings::Remapping},
types::Address,
};
-use foundry_cli_test_utils::{
+use foundry_config::Config;
+use foundry_test_utils::{
forgetest, forgetest_async,
util::{OutputExt, TestCommand, TestProject},
};
-use foundry_config::Config;
use std::{path::PathBuf, str::FromStr};
/// This will insert _dummy_ contract that uses a library
diff --git a/crates/cli/tests/it/doc.rs b/crates/forge/tests/cli/doc.rs
similarity index 80%
rename from crates/cli/tests/it/doc.rs
rename to crates/forge/tests/cli/doc.rs
index 82d38b147b092..9ad34c1df77a5 100644
--- a/crates/cli/tests/it/doc.rs
+++ b/crates/forge/tests/cli/doc.rs
@@ -1,4 +1,4 @@
-use foundry_cli_test_utils::util::{setup_forge_remote, RemoteProject};
+use foundry_test_utils::util::{setup_forge_remote, RemoteProject};
#[test]
fn can_generate_solmate_docs() {
diff --git a/crates/forge/tests/cli/heavy_integration.rs b/crates/forge/tests/cli/heavy_integration.rs
new file mode 100644
index 0000000000000..7363b0ca4ef68
--- /dev/null
+++ b/crates/forge/tests/cli/heavy_integration.rs
@@ -0,0 +1,5 @@
+//! Heavy integration tests that can take an hour to run or more.
+
+use foundry_test_utils::forgetest_external;
+
+forgetest_external!(maple, "maple-labs/maple-core-v2");
diff --git a/crates/cli/tests/it/integration.rs b/crates/forge/tests/cli/integration.rs
similarity index 90%
rename from crates/cli/tests/it/integration.rs
rename to crates/forge/tests/cli/integration.rs
index be7b2d868bf7d..a32bd95e22a4d 100644
--- a/crates/cli/tests/it/integration.rs
+++ b/crates/forge/tests/cli/integration.rs
@@ -1,4 +1,4 @@
-use foundry_cli_test_utils::{forgetest_external, util::setup_forge_remote};
+use foundry_test_utils::{forgetest_external, util::setup_forge_remote};
forgetest_external!(solmate, "transmissions11/solmate");
forgetest_external!(prb_math, "PaulRBerg/prb-math");
@@ -22,7 +22,7 @@ fn can_checkout_build() {
/// Forking tests
mod fork_integration {
- use foundry_cli_test_utils::forgetest_external;
+ use foundry_test_utils::forgetest_external;
forgetest_external!(multicall, "makerdao/multicall", &["--block-number", "1"]);
forgetest_external!(
diff --git a/crates/cli/tests/it/main.rs b/crates/forge/tests/cli/main.rs
similarity index 81%
rename from crates/cli/tests/it/main.rs
rename to crates/forge/tests/cli/main.rs
index e031bfb2c9dc5..1892172dabecf 100644
--- a/crates/cli/tests/it/main.rs
+++ b/crates/forge/tests/cli/main.rs
@@ -1,8 +1,6 @@
#[cfg(not(feature = "external-integration-tests"))]
mod cache;
#[cfg(not(feature = "external-integration-tests"))]
-mod cast;
-#[cfg(not(feature = "external-integration-tests"))]
mod cmd;
#[cfg(not(feature = "external-integration-tests"))]
mod config;
@@ -22,11 +20,6 @@ mod utils;
#[cfg(not(feature = "external-integration-tests"))]
mod verify;
-// import forge utils as mod
-#[allow(unused)]
-#[path = "../../src/utils/mod.rs"]
-pub(crate) mod forge_utils;
-
#[cfg(feature = "external-integration-tests")]
mod integration;
@@ -34,5 +27,3 @@ mod integration;
mod heavy_integration;
pub mod constants;
-
-fn main() {}
diff --git a/crates/cli/tests/it/multi_script.rs b/crates/forge/tests/cli/multi_script.rs
similarity index 98%
rename from crates/cli/tests/it/multi_script.rs
rename to crates/forge/tests/cli/multi_script.rs
index 19666076a0cee..f571585b96b66 100644
--- a/crates/cli/tests/it/multi_script.rs
+++ b/crates/forge/tests/cli/multi_script.rs
@@ -1,6 +1,6 @@
//! Contains various tests related to forge script
use anvil::{spawn, NodeConfig};
-use foundry_cli_test_utils::{
+use foundry_test_utils::{
forgetest_async,
util::{TestCommand, TestProject},
ScriptOutcome, ScriptTester,
diff --git a/crates/cli/tests/it/script.rs b/crates/forge/tests/cli/script.rs
similarity index 98%
rename from crates/cli/tests/it/script.rs
rename to crates/forge/tests/cli/script.rs
index 2393f5fe44e88..a6ce2d588cbcd 100644
--- a/crates/cli/tests/it/script.rs
+++ b/crates/forge/tests/cli/script.rs
@@ -1,14 +1,13 @@
//! Contains various tests related to forge script
use crate::constants::TEMPLATE_CONTRACT;
use anvil::{spawn, NodeConfig};
-use cast::SimpleCast;
use ethers::abi::Address;
-use foundry_cli_test_utils::{
+use foundry_config::Config;
+use foundry_test_utils::{
forgetest, forgetest_async, forgetest_init,
util::{OutputExt, TestCommand, TestProject},
ScriptOutcome, ScriptTester,
};
-use foundry_config::Config;
use foundry_utils::rpc;
use regex::Regex;
use serde_json::Value;
@@ -129,7 +128,7 @@ contract Demo {
forgetest_async!(
can_execute_script_command_with_manual_gas_limit_unlocked,
|prj: TestProject, mut cmd: TestCommand| async move {
- foundry_cli_test_utils::util::initialize(prj.root());
+ foundry_test_utils::util::initialize(prj.root());
let deploy_script = prj
.inner()
.add_source(
@@ -189,7 +188,7 @@ contract DeployScript is Script {
forgetest_async!(
can_execute_script_command_with_manual_gas_limit,
|prj: TestProject, mut cmd: TestCommand| async move {
- foundry_cli_test_utils::util::initialize(prj.root());
+ foundry_test_utils::util::initialize(prj.root());
let deploy_script = prj
.inner()
.add_source(
@@ -302,7 +301,7 @@ contract Demo {
forgetest_async!(
can_broadcast_script_skipping_simulation,
|prj: TestProject, mut cmd: TestCommand| async move {
- foundry_cli_test_utils::util::initialize(prj.root());
+ foundry_test_utils::util::initialize(prj.root());
// This example script would fail in on-chain simulation
let deploy_script = prj
.inner()
@@ -367,11 +366,9 @@ contract DeployScript is Script {
let run_log =
std::fs::read_to_string("broadcast/DeployScript.sol/1/run-latest.json").unwrap();
let run_object: Value = serde_json::from_str(&run_log).unwrap();
- let contract_address = SimpleCast::to_checksum_address(
- ðers::prelude::H160::from_str(
- run_object["receipts"][0]["contractAddress"].as_str().unwrap(),
- )
- .unwrap(),
+ let contract_address = ethers::utils::to_checksum(
+ &run_object["receipts"][0]["contractAddress"].as_str().unwrap().parse().unwrap(),
+ None,
);
let run_code = r#"
diff --git a/crates/cli/tests/it/svm.rs b/crates/forge/tests/cli/svm.rs
similarity index 96%
rename from crates/cli/tests/it/svm.rs
rename to crates/forge/tests/cli/svm.rs
index 10db8c6489796..be761193d4954 100644
--- a/crates/cli/tests/it/svm.rs
+++ b/crates/forge/tests/cli/svm.rs
@@ -1,6 +1,6 @@
//! svm sanity checks
-use foundry_cli_test_utils::{forgetest_init, TestCommand, TestProject};
+use foundry_test_utils::{forgetest_init, TestCommand, TestProject};
use semver::Version;
use svm::{self, Platform};
diff --git a/crates/cli/tests/it/test_cmd.rs b/crates/forge/tests/cli/test_cmd.rs
similarity index 99%
rename from crates/cli/tests/it/test_cmd.rs
rename to crates/forge/tests/cli/test_cmd.rs
index 8830a5b809c1c..3c99a547c5d4e 100644
--- a/crates/cli/tests/it/test_cmd.rs
+++ b/crates/forge/tests/cli/test_cmd.rs
@@ -1,9 +1,9 @@
//! Contains various tests for checking `forge test`
-use foundry_cli_test_utils::{
+use foundry_config::Config;
+use foundry_test_utils::{
forgetest, forgetest_init,
util::{OutputExt, TestCommand, TestProject},
};
-use foundry_config::Config;
use foundry_utils::rpc;
use std::{path::PathBuf, str::FromStr};
diff --git a/crates/cli/tests/it/utils.rs b/crates/forge/tests/cli/utils.rs
similarity index 100%
rename from crates/cli/tests/it/utils.rs
rename to crates/forge/tests/cli/utils.rs
diff --git a/crates/cli/tests/it/verify.rs b/crates/forge/tests/cli/verify.rs
similarity index 99%
rename from crates/cli/tests/it/verify.rs
rename to crates/forge/tests/cli/verify.rs
index 03be241c775c4..bdd35d5914e65 100644
--- a/crates/cli/tests/it/verify.rs
+++ b/crates/forge/tests/cli/verify.rs
@@ -2,7 +2,7 @@
//! and sourcify
use crate::utils::{self, EnvExternalities};
-use foundry_cli_test_utils::{
+use foundry_test_utils::{
forgetest,
util::{TestCommand, TestProject},
};
diff --git a/crates/cli/tests/fixtures/ScriptVerify.sol b/crates/forge/tests/fixtures/ScriptVerify.sol
similarity index 100%
rename from crates/cli/tests/fixtures/ScriptVerify.sol
rename to crates/forge/tests/fixtures/ScriptVerify.sol
diff --git a/crates/cli/tests/fixtures/can_build_skip_contracts.stdout b/crates/forge/tests/fixtures/can_build_skip_contracts.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_build_skip_contracts.stdout
rename to crates/forge/tests/fixtures/can_build_skip_contracts.stdout
diff --git a/crates/cli/tests/fixtures/can_build_skip_glob.stdout b/crates/forge/tests/fixtures/can_build_skip_glob.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_build_skip_glob.stdout
rename to crates/forge/tests/fixtures/can_build_skip_glob.stdout
diff --git a/crates/cli/tests/fixtures/can_check_snapshot.stdout b/crates/forge/tests/fixtures/can_check_snapshot.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_check_snapshot.stdout
rename to crates/forge/tests/fixtures/can_check_snapshot.stdout
diff --git a/crates/cli/tests/fixtures/can_create_template_contract-2nd.stdout b/crates/forge/tests/fixtures/can_create_template_contract-2nd.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_create_template_contract-2nd.stdout
rename to crates/forge/tests/fixtures/can_create_template_contract-2nd.stdout
diff --git a/crates/cli/tests/fixtures/can_create_template_contract.stdout b/crates/forge/tests/fixtures/can_create_template_contract.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_create_template_contract.stdout
rename to crates/forge/tests/fixtures/can_create_template_contract.stdout
diff --git a/crates/cli/tests/fixtures/can_create_using_unlocked-2nd.stdout b/crates/forge/tests/fixtures/can_create_using_unlocked-2nd.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_create_using_unlocked-2nd.stdout
rename to crates/forge/tests/fixtures/can_create_using_unlocked-2nd.stdout
diff --git a/crates/cli/tests/fixtures/can_create_using_unlocked.stdout b/crates/forge/tests/fixtures/can_create_using_unlocked.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_create_using_unlocked.stdout
rename to crates/forge/tests/fixtures/can_create_using_unlocked.stdout
diff --git a/crates/cli/tests/fixtures/can_detect_dirty_git_status_on_init.stderr b/crates/forge/tests/fixtures/can_detect_dirty_git_status_on_init.stderr
similarity index 100%
rename from crates/cli/tests/fixtures/can_detect_dirty_git_status_on_init.stderr
rename to crates/forge/tests/fixtures/can_detect_dirty_git_status_on_init.stderr
diff --git a/crates/cli/tests/fixtures/can_execute_script_and_skip_contracts.stdout b/crates/forge/tests/fixtures/can_execute_script_and_skip_contracts.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_execute_script_and_skip_contracts.stdout
rename to crates/forge/tests/fixtures/can_execute_script_and_skip_contracts.stdout
diff --git a/crates/cli/tests/fixtures/can_execute_script_command.stdout b/crates/forge/tests/fixtures/can_execute_script_command.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_execute_script_command.stdout
rename to crates/forge/tests/fixtures/can_execute_script_command.stdout
diff --git a/crates/cli/tests/fixtures/can_execute_script_command_fqn.stdout b/crates/forge/tests/fixtures/can_execute_script_command_fqn.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_execute_script_command_fqn.stdout
rename to crates/forge/tests/fixtures/can_execute_script_command_fqn.stdout
diff --git a/crates/cli/tests/fixtures/can_execute_script_command_with_args.stdout b/crates/forge/tests/fixtures/can_execute_script_command_with_args.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_execute_script_command_with_args.stdout
rename to crates/forge/tests/fixtures/can_execute_script_command_with_args.stdout
diff --git a/crates/cli/tests/fixtures/can_execute_script_command_with_returned.stdout b/crates/forge/tests/fixtures/can_execute_script_command_with_returned.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_execute_script_command_with_returned.stdout
rename to crates/forge/tests/fixtures/can_execute_script_command_with_returned.stdout
diff --git a/crates/cli/tests/fixtures/can_execute_script_command_with_sig.stdout b/crates/forge/tests/fixtures/can_execute_script_command_with_sig.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_execute_script_command_with_sig.stdout
rename to crates/forge/tests/fixtures/can_execute_script_command_with_sig.stdout
diff --git a/crates/cli/tests/fixtures/can_run_test_in_custom_test_folder.stdout b/crates/forge/tests/fixtures/can_run_test_in_custom_test_folder.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_run_test_in_custom_test_folder.stdout
rename to crates/forge/tests/fixtures/can_run_test_in_custom_test_folder.stdout
diff --git a/crates/cli/tests/fixtures/can_set_yul_optimizer.stderr b/crates/forge/tests/fixtures/can_set_yul_optimizer.stderr
similarity index 100%
rename from crates/cli/tests/fixtures/can_set_yul_optimizer.stderr
rename to crates/forge/tests/fixtures/can_set_yul_optimizer.stderr
diff --git a/crates/cli/tests/fixtures/can_test_repeatedly.stdout b/crates/forge/tests/fixtures/can_test_repeatedly.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_test_repeatedly.stdout
rename to crates/forge/tests/fixtures/can_test_repeatedly.stdout
diff --git a/crates/cli/tests/fixtures/can_use_libs_in_multi_fork.stdout b/crates/forge/tests/fixtures/can_use_libs_in_multi_fork.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/can_use_libs_in_multi_fork.stdout
rename to crates/forge/tests/fixtures/can_use_libs_in_multi_fork.stdout
diff --git a/crates/cli/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.10.stdout b/crates/forge/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.10.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.10.stdout
rename to crates/forge/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.10.stdout
diff --git a/crates/cli/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.13.stdout b/crates/forge/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.13.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.13.stdout
rename to crates/forge/tests/fixtures/runs_tests_exactly_once_with_changed_versions.0.8.13.stdout
diff --git a/crates/cli/tests/fixtures/suggest_when_no_tests_match.stdout b/crates/forge/tests/fixtures/suggest_when_no_tests_match.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/suggest_when_no_tests_match.stdout
rename to crates/forge/tests/fixtures/suggest_when_no_tests_match.stdout
diff --git a/crates/cli/tests/fixtures/warn_no_tests.stdout b/crates/forge/tests/fixtures/warn_no_tests.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/warn_no_tests.stdout
rename to crates/forge/tests/fixtures/warn_no_tests.stdout
diff --git a/crates/cli/tests/fixtures/warn_no_tests_match.stdout b/crates/forge/tests/fixtures/warn_no_tests_match.stdout
similarity index 100%
rename from crates/cli/tests/fixtures/warn_no_tests_match.stdout
rename to crates/forge/tests/fixtures/warn_no_tests_match.stdout
diff --git a/crates/forge/tests/it/core.rs b/crates/forge/tests/it/core.rs
index beadfb55ad885..fd2f22812cdcb 100644
--- a/crates/forge/tests/it/core.rs
+++ b/crates/forge/tests/it/core.rs
@@ -1,9 +1,7 @@
//! forge tests for core functionality
use crate::{config::*, test_helpers::filter::Filter};
-
use forge::result::SuiteResult;
-
use foundry_evm::trace::TraceKind;
use std::{collections::BTreeMap, env};
diff --git a/crates/forge/tests/it/main.rs b/crates/forge/tests/it/main.rs
index 0ed7348c0bef2..f8197c99d42a5 100644
--- a/crates/forge/tests/it/main.rs
+++ b/crates/forge/tests/it/main.rs
@@ -9,5 +9,3 @@ mod invariant;
mod repros;
mod spec;
pub mod test_helpers;
-
-fn main() {}
diff --git a/crates/forge/tests/it/spec.rs b/crates/forge/tests/it/spec.rs
index 74556a7e7b232..8afe3b57a69df 100644
--- a/crates/forge/tests/it/spec.rs
+++ b/crates/forge/tests/it/spec.rs
@@ -1,5 +1,5 @@
use crate::{config::*, test_helpers::filter::Filter};
-use forge::revm::primitives::SpecId;
+use foundry_evm::revm::primitives::SpecId;
#[tokio::test(flavor = "multi_thread")]
async fn test_shanghai_compat() {
diff --git a/crates/cli/tests/rpc-cache-keyfile b/crates/forge/tests/rpc-cache-keyfile
similarity index 100%
rename from crates/cli/tests/rpc-cache-keyfile
rename to crates/forge/tests/rpc-cache-keyfile
diff --git a/crates/macros/impl/src/lib.rs b/crates/macros/impl/src/lib.rs
index 23a5a65486e1c..c56e51060bc4c 100644
--- a/crates/macros/impl/src/lib.rs
+++ b/crates/macros/impl/src/lib.rs
@@ -1,3 +1,5 @@
+#![warn(unused_crate_dependencies)]
+
mod console_fmt;
mod utils;
diff --git a/crates/macros/src/lib.rs b/crates/macros/src/lib.rs
index 0b8b26cf0da89..c1b94f5b6a141 100644
--- a/crates/macros/src/lib.rs
+++ b/crates/macros/src/lib.rs
@@ -2,6 +2,8 @@
//!
//! Also includes traits and other utilities used by the macros.
+#![warn(unused_crate_dependencies)]
+
pub mod fmt;
pub use fmt::{console_format, ConsoleFmt, FormatSpec, TokenDisplay, UIfmt};
diff --git a/crates/cli/test-utils/Cargo.toml b/crates/test-utils/Cargo.toml
similarity index 72%
rename from crates/cli/test-utils/Cargo.toml
rename to crates/test-utils/Cargo.toml
index 53245330ba5d8..849ba66fdf7ff 100644
--- a/crates/cli/test-utils/Cargo.toml
+++ b/crates/test-utils/Cargo.toml
@@ -1,6 +1,7 @@
[package]
-name = "foundry-cli-test-utils"
-description = "Foundry CLI testing utilities"
+name = "foundry-test-utils"
+description = "Foundry testing utilities"
+publish = false
version.workspace = true
edition.workspace = true
@@ -25,3 +26,7 @@ regex = "1"
serde_json = "1"
tempfile = "3"
walkdir = "2"
+
+[features]
+# feature for integration tests that test external projects
+external-integration-tests = []
diff --git a/crates/cli/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs
similarity index 88%
rename from crates/cli/test-utils/src/lib.rs
rename to crates/test-utils/src/lib.rs
index 59d4d4b496579..1cdbe23c96df6 100644
--- a/crates/cli/test-utils/src/lib.rs
+++ b/crates/test-utils/src/lib.rs
@@ -1,3 +1,5 @@
+#![warn(unused_crate_dependencies)]
+
// Macros useful for testing.
mod macros;
diff --git a/crates/cli/test-utils/src/macros.rs b/crates/test-utils/src/macros.rs
similarity index 98%
rename from crates/cli/test-utils/src/macros.rs
rename to crates/test-utils/src/macros.rs
index 09705386a50a9..88faf98bca0a9 100644
--- a/crates/cli/test-utils/src/macros.rs
+++ b/crates/test-utils/src/macros.rs
@@ -10,7 +10,7 @@
/// run `forge init`
///
/// ```no_run
-/// use foundry_cli_test_utils::*;
+/// use foundry_test_utils::*;
/// forgetest!(my_test, |prj: TestProject, mut cmd: TestCommand| {
/// // adds `init` to forge's command arguments
/// cmd.arg("init");
@@ -22,8 +22,8 @@
/// Configure a hardhat project layout by adding a `PathStyle::HardHat` argument
///
/// ```no_run
-/// use foundry_cli_test_utils::*;
-/// use foundry_cli_test_utils::ethers_solc::PathStyle;
+/// use foundry_test_utils::*;
+/// use foundry_test_utils::ethers_solc::PathStyle;
/// forgetest!(can_clean_hardhat, PathStyle::HardHat, |prj: TestProject, mut cmd: TestCommand| {
/// prj.assert_create_dirs_exists();
/// prj.assert_style_paths_exist(PathStyle::HardHat);
diff --git a/crates/cli/test-utils/src/script.rs b/crates/test-utils/src/script.rs
similarity index 99%
rename from crates/cli/test-utils/src/script.rs
rename to crates/test-utils/src/script.rs
index 4ac44ebf70100..4ff1b47aede3a 100644
--- a/crates/cli/test-utils/src/script.rs
+++ b/crates/test-utils/src/script.rs
@@ -93,7 +93,7 @@ impl ScriptTester {
/// Returns the path to the dir that contains testdata
fn testdata_path() -> String {
- format!("{}/../../../testdata", env!("CARGO_MANIFEST_DIR"))
+ concat!(env!("CARGO_MANIFEST_DIR"), "/../../testdata").into()
}
/// Initialises the test contracts by copying them into the workspace
diff --git a/crates/cli/test-utils/src/util.rs b/crates/test-utils/src/util.rs
similarity index 99%
rename from crates/cli/test-utils/src/util.rs
rename to crates/test-utils/src/util.rs
index 58b085e56d3b3..1bccadb2249c4 100644
--- a/crates/cli/test-utils/src/util.rs
+++ b/crates/test-utils/src/util.rs
@@ -322,13 +322,13 @@ impl TestProject {
/// Adds DSTest as a source under "test.sol"
pub fn insert_ds_test(&self) -> PathBuf {
- let s = include_str!("../../../../testdata/lib/ds-test/src/test.sol");
+ let s = include_str!("../../../testdata/lib/ds-test/src/test.sol");
self.inner().add_source("test.sol", s).unwrap()
}
/// Adds `console.sol` as a source under "console.sol"
pub fn insert_console(&self) -> PathBuf {
- let s = include_str!("../../../../testdata/logs/console.sol");
+ let s = include_str!("../../../testdata/logs/console.sol");
self.inner().add_source("console.sol", s).unwrap()
}
diff --git a/crates/ui/Cargo.toml b/crates/ui/Cargo.toml
index d5d4bd09346f2..4a7f767d45e4f 100644
--- a/crates/ui/Cargo.toml
+++ b/crates/ui/Cargo.toml
@@ -10,13 +10,12 @@ homepage.workspace = true
repository.workspace = true
[dependencies]
-forge.workspace = true
+foundry-evm.workspace = true
foundry-common.workspace = true
ethers.workspace = true
crossterm = "0.26"
eyre = "0.6"
-hex.workspace = true
revm = { version = "3", features = ["std", "serde"] }
tui = { version = "0.19", default-features = false, features = ["crossterm"] }
diff --git a/crates/ui/src/lib.rs b/crates/ui/src/lib.rs
index 13c90bd69ceda..0588fc2bd4086 100644
--- a/crates/ui/src/lib.rs
+++ b/crates/ui/src/lib.rs
@@ -1,3 +1,5 @@
+#![warn(unused_crate_dependencies)]
+
use crossterm::{
event::{
self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyEvent, KeyModifiers,
@@ -8,12 +10,12 @@ use crossterm::{
};
use ethers::{solc::artifacts::ContractBytecodeSome, types::Address};
use eyre::Result;
-use forge::{
+use foundry_common::evm::Breakpoints;
+use foundry_evm::{
debug::{DebugStep, Instruction},
utils::{build_pc_ic_map, PCICMap},
CallKind,
};
-use foundry_common::evm::Breakpoints;
use revm::{interpreter::opcode, primitives::SpecId};
use std::{
cmp::{max, min},
diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml
index c51e4c11a1b8e..8d455e305fee3 100644
--- a/crates/utils/Cargo.toml
+++ b/crates/utils/Cargo.toml
@@ -14,7 +14,6 @@ forge-fmt.workspace = true
ethers-core.workspace = true
ethers-contract = { workspace = true, features = ["abigen"] }
-ethers-etherscan.workspace = true
ethers-addressbook.workspace = true
ethers-providers.workspace = true
ethers-solc.workspace = true
@@ -25,11 +24,7 @@ glob = "0.3"
hex.workspace = true
once_cell = "1"
rand = "0.8"
-reqwest = { version = "0.11", default-features = false, features = ["json", "rustls"] }
-rlp = "0.5"
-serde = "1"
serde_json = { version = "1", default-features = false }
-tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
tracing = "0.1"
dunce = "1"
diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs
index 8b577acc45446..df519a8d64590 100644
--- a/crates/utils/src/lib.rs
+++ b/crates/utils/src/lib.rs
@@ -1,4 +1,5 @@
#![doc = include_str!("../README.md")]
+#![warn(unused_crate_dependencies)]
use ethers_addressbook::contract;
use ethers_core::types::*;
diff --git a/foundryup/foundryup b/foundryup/foundryup
index c513380f46ae8..4ea420ecc39b6 100755
--- a/foundryup/foundryup
+++ b/foundryup/foundryup
@@ -58,7 +58,7 @@ main() {
# Enter local repo and build
say "installing from $FOUNDRYUP_LOCAL_REPO"
cd "$FOUNDRYUP_LOCAL_REPO"
- ensure cargo build --release # need 4 speed
+ ensure cargo build --bins --release # need 4 speed
for bin in "${BINS[@]}"; do
# Remove prior installations if they exist
@@ -204,12 +204,10 @@ EOF
fi
# Build the repo and install the binaries locally to the .foundry bin directory.
- # --root appends /bin to the directory it is given, so we pass FOUNDRY_DIR.
- ensure cargo install --path ./cli --bins --locked --force --root "$FOUNDRY_DIR"
- # install anvil
- ensure cargo install --path ./anvil --bin anvil --locked --force --root "$FOUNDRY_DIR"
- # install chisel
- ensure cargo install --path ./chisel --bin chisel --locked --force --root "$FOUNDRY_DIR"
+ ensure cargo build --bins --release
+ for bin in "${BINS[@]}"; do
+ mv -f "target/release/$bin" "target/release/$bin.exe" "$FOUNDRY_DIR"
+ done
# If help2man is installed, use it to add Foundry man pages.
if check_cmd help2man; then
@@ -315,4 +313,4 @@ Contribute : https://github.com/orgs/foundry-rs/projects/2/
}
-main "$@" || exit 1
\ No newline at end of file
+main "$@" || exit 1