From a0a2ef22e47c3c9b1cac490311ed5133d9ed5bc2 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Wed, 8 Nov 2023 06:25:35 -0500 Subject: [PATCH] Remove ethers-solc ethers-solc was used for a type (now manually specified) and to call out to solc. Since Foundry was already a documented dependency, a call to it now handles building. Removing this single crate removes a total of 17 crates from our dependency tree. While these may still be around due to Foundry, they at least may not be. Further work to remove the requirement on Foundry for solc alone would be appreciated. --- .github/actions/build-dependencies/action.yml | 6 + Cargo.lock | 256 +----------------- coins/ethereum/Cargo.toml | 4 - coins/ethereum/build.rs | 13 +- coins/ethereum/foundry.toml | 6 + docs/Getting Started.md | 4 +- 6 files changed, 21 insertions(+), 268 deletions(-) create mode 100644 coins/ethereum/foundry.toml diff --git a/.github/actions/build-dependencies/action.yml b/.github/actions/build-dependencies/action.yml index 8717be4e2..cd7137a38 100644 --- a/.github/actions/build-dependencies/action.yml +++ b/.github/actions/build-dependencies/action.yml @@ -54,5 +54,11 @@ runs: components: ${{ inputs.rust-components }} targets: wasm32-unknown-unknown, riscv32imac-unknown-none-elf + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@cb603ca0abb544f301eaed59ac0baf579aa6aecf + with: + version: nightly + cache: false + # - name: Cache Rust # uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 diff --git a/Cargo.lock b/Cargo.lock index 87bb9f3b4..3dca59ba8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,15 +221,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "asn1-rs" version = "0.5.2" @@ -485,21 +476,6 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitcoin" version = "0.31.0" @@ -1294,7 +1270,7 @@ dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "itertools 0.10.5", + "itertools", "log", "smallvec", "wasmparser", @@ -1651,12 +1627,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "difflib" version = "0.4.0" @@ -1716,25 +1686,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - [[package]] name = "dirs-sys" version = "0.4.1" @@ -1951,15 +1902,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", -] - [[package]] name = "encoding_rs" version = "0.8.33" @@ -2109,7 +2051,6 @@ dependencies = [ "ethers-middleware", "ethers-providers", "ethers-signers", - "ethers-solc", "eyre", "group", "k256", @@ -2322,37 +2263,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "ethers-solc" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de34e484e7ae3cab99fbfd013d6c5dc7f9013676a4e0e414d8b12e1213e8b3ba" -dependencies = [ - "cfg-if", - "const-hex", - "dirs", - "dunce", - "ethers-core", - "glob", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver 1.0.20", - "serde", - "serde_json", - "solang-parser", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -2668,7 +2578,7 @@ dependencies = [ "derive-syn-parse", "expander", "frame-support-procedural-tools", - "itertools 0.10.5", + "itertools", "macro_magic", "proc-macro-warning", "proc-macro2", @@ -3565,15 +3475,6 @@ 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" @@ -3800,34 +3701,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "lalrpop" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools 0.10.5", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax 0.7.5", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" - [[package]] name = "lazy_static" version = "1.5.0" @@ -5038,12 +4911,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - [[package]] name = "nix" version = "0.24.3" @@ -5590,12 +5457,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - [[package]] name = "pbkdf2" version = "0.11.0" @@ -5658,57 +5519,6 @@ dependencies = [ "rustc_version", ] -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_macros", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared 0.11.2", - "rand", -] - -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project" version = "1.1.3" @@ -5820,12 +5630,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "predicates" version = "2.1.5" @@ -5834,7 +5638,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools 0.10.5", + "itertools", "normalize-line-endings", "predicates-core", "regex", @@ -6008,7 +5812,7 @@ checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", - "itertools 0.10.5", + "itertools", "lazy_static", "log", "multimap", @@ -6029,7 +5833,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools", "proc-macro2", "quote", "syn 1.0.109", @@ -6351,12 +6155,6 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" -[[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" - [[package]] name = "regex-syntax" version = "0.8.2" @@ -8721,20 +8519,6 @@ dependencies = [ "sha-1", ] -[[package]] -name = "solang-parser" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb9fa2fa2fa6837be8a2495486ff92e3ffe68a99b6eeba288e139efdd842457" -dependencies = [ - "itertools 0.11.0", - "lalrpop", - "lalrpop-util", - "phf", - "thiserror", - "unicode-xid", -] - [[package]] name = "sp-api" version = "4.0.0-dev" @@ -9429,19 +9213,6 @@ dependencies = [ "spin 0.9.8", ] -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot 0.12.1", - "phf_shared 0.10.0", - "precomputed-hash", -] - [[package]] name = "strobe-rs" version = "0.8.1" @@ -9744,17 +9515,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "termcolor" version = "1.3.0" @@ -11103,12 +10863,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "yap" version = "0.10.0" diff --git a/coins/ethereum/Cargo.toml b/coins/ethereum/Cargo.toml index b77adee06..53b5342de 100644 --- a/coins/ethereum/Cargo.toml +++ b/coins/ethereum/Cargo.toml @@ -29,10 +29,6 @@ ethers-signers = { version = "2", default-features = false } ethers-middleware = { version = "2", default-features = false } ethers-providers = { version = "2", default-features = false } ethers-contract = { version = "2", default-features = false, features = ["abigen", "providers"] } -ethers-solc = { version = "2", default-features = false } - -[build-dependencies] -ethers-solc = { version = "2", default-features = false } [dev-dependencies] rand_core = { version = "0.6", default-features = false, features = ["std"] } diff --git a/coins/ethereum/build.rs b/coins/ethereum/build.rs index 5ea99c7dd..8094bbfeb 100644 --- a/coins/ethereum/build.rs +++ b/coins/ethereum/build.rs @@ -1,16 +1,7 @@ -use ethers_solc::{Project, ProjectPathsConfig}; - fn main() { println!("cargo:rerun-if-changed=contracts"); println!("cargo:rerun-if-changed=artifacts"); + println!("cargo:rerun-if-changed=foundry.toml"); - // configure the project with all its paths, solc, cache etc. - let project = Project::builder() - .paths(ProjectPathsConfig::hardhat(env!("CARGO_MANIFEST_DIR")).unwrap()) - .build() - .unwrap(); - project.compile().unwrap(); - - // Tell Cargo that if a source file changes, to rerun this build script. - project.rerun_if_sources_changed(); + assert!(std::process::Command::new("forge").args(["build"]).status().unwrap().success()); } diff --git a/coins/ethereum/foundry.toml b/coins/ethereum/foundry.toml new file mode 100644 index 000000000..1eddc8c80 --- /dev/null +++ b/coins/ethereum/foundry.toml @@ -0,0 +1,6 @@ +[profile.default] +src = "contracts" +out = "artifacts" + +optimizer = true +optimizer_runs = 20_000 diff --git a/docs/Getting Started.md b/docs/Getting Started.md index bfb098f1a..2dd4b2c57 100644 --- a/docs/Getting Started.md +++ b/docs/Getting Started.md @@ -48,10 +48,10 @@ svm install 0.8.16 svm use 0.8.16 ``` -### Install foundry and anvil (for tests) +### Install foundry and anvil ``` -cargo install --git https://github.com/foundry-rs/foundry --profile local --locked foundry-cli anvil +cargo install --git https://github.com/foundry-rs/foundry --profile local --locked forge cast chisel anvil ``` ### Clone and Build Serai