From 634de02ce1ba868d1caebf595dc87244c9493d60 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 14:35:56 -0400 Subject: [PATCH 01/58] add in cargo stylus --- arbitrator/Cargo.lock | 172 ++++++++++++++++++++++++-- arbitrator/Cargo.toml | 1 + arbitrator/cargo-stylus/Cargo.toml | 10 ++ arbitrator/cargo-stylus/src/check.rs | 27 ++++ arbitrator/cargo-stylus/src/deploy.rs | 1 + arbitrator/cargo-stylus/src/main.rs | 73 +++++++++++ 6 files changed, 271 insertions(+), 13 deletions(-) create mode 100644 arbitrator/cargo-stylus/Cargo.toml create mode 100644 arbitrator/cargo-stylus/src/check.rs create mode 100644 arbitrator/cargo-stylus/src/deploy.rs create mode 100644 arbitrator/cargo-stylus/src/main.rs diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 0141aadc5..0e4d27fb6 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -58,6 +58,55 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.71" @@ -130,6 +179,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "block-buffer" version = "0.9.0" @@ -214,6 +269,14 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +[[package]] +name = "cargo-stylus" +version = "0.1.0" +dependencies = [ + "clap 4.3.17", + "eyre", +] + [[package]] name = "cc" version = "1.0.73" @@ -234,13 +297,60 @@ checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim 0.8.0", "textwrap", "unicode-width", "vec_map", ] +[[package]] +name = "clap" +version = "4.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0827b011f6f8ab38590295339817b0d26f344aa4932c3ced71b45b0c54b4a9" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9441b403be87be858db6a23edb493e7f694761acdc3343d5a0fcaafd304cbc9e" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim 0.10.0", +] + +[[package]] +name = "clap_derive" +version = "4.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.18", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "compiletest_rs" version = "0.6.0" @@ -524,7 +634,7 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "byteorder", "lazy_static", "proc-macro-error", @@ -614,9 +724,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221239d1d5ea86bf5d6f91c9d6bc3646ffe471b08ff9b0f91c44f115ac969d2b" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" dependencies = [ "indenter", "once_cell", @@ -828,6 +938,17 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.1", + "rustix 0.38.4", + "windows-sys 0.48.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -897,9 +1018,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "linux-raw-sys" @@ -907,6 +1028,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + [[package]] name = "llvm-sys" version = "120.2.4" @@ -1467,7 +1594,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1476,7 +1603,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1525,7 +1652,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "mach", "winapi", @@ -1599,11 +1726,24 @@ version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.3", "windows-sys 0.48.0", ] @@ -1808,7 +1948,7 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ - "clap", + "clap 2.33.3", "lazy_static", "structopt-derive", ] @@ -1886,7 +2026,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -2005,6 +2145,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vec_map" version = "0.8.2" diff --git a/arbitrator/Cargo.toml b/arbitrator/Cargo.toml index c9c4efad3..fba3a6910 100644 --- a/arbitrator/Cargo.toml +++ b/arbitrator/Cargo.toml @@ -3,6 +3,7 @@ members = [ "arbutil", "prover", "stylus", + "cargo-stylus", "jit", ] exclude = [ diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml new file mode 100644 index 000000000..cb3983a55 --- /dev/null +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "cargo-stylus" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap = { version = "4.3.17", features = [ "derive" ] } +eyre = "0.6.8" diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs new file mode 100644 index 000000000..4cf1fc6a7 --- /dev/null +++ b/arbitrator/cargo-stylus/src/check.rs @@ -0,0 +1,27 @@ +#[derive(PartialEq)] +pub enum StylusCheck { + CompressedSize, +} + +impl From<&str> for StylusCheck { + fn from(value: &str) -> Self { + match value { + "compressed-size" => StylusCheck::CompressedSize, + _ => panic!( + "Invalid Stylus middleware check: {}, allowed middlewares are: foo", + value + ), + } + } +} + +pub fn run_checks(disabled: Option>) -> eyre::Result<()> { + // Compile the Rust program at the current working directory into WASM using + // Cargo and then instrument the WASM code with Stylus. If any of the checks + // are disabled, we avoid runnng it. + let _check_compressed_size = disabled + .as_ref() + .map(|d| !d.contains(&StylusCheck::CompressedSize)) + .unwrap_or(true); + Ok(()) +} \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -0,0 +1 @@ + diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs new file mode 100644 index 000000000..1d25c90b7 --- /dev/null +++ b/arbitrator/cargo-stylus/src/main.rs @@ -0,0 +1,73 @@ +use clap::{Parser, Subcommand}; + +mod check; +mod deploy; + +#[derive(Parser, Debug)] +#[command(name = "stylus")] +#[command(author = "Offchain Labs, Inc.")] +#[command(version = "0.0.1")] +#[command(about = "Cargo command for developing Arbitrum Stylus projects", long_about = None)] +#[command(propagate_version = true)] +struct Cli { + #[command(subcommand)] + command: Commands, +} + +#[derive(Debug, Subcommand)] +enum Commands { + /// Instrument a Rust project using Stylus, optionally outputting the brotli-compressed, + /// compiled WASM code to deploy on-chain. This command runs compiled WASM code through + /// Stylus instrumentation checks and reports any failures. Allows for disabling specific . + /// checks via the `--disabled-checks` flag. + #[command(alias = "c")] + Check { + disabled_checks: Option>, + output_file: Option, + }, + /// Instruments a Rust project using Stylus and by outputting its brotli-compressed WASM code. + /// Then, it submits a single, multicall transaction that both deploys the WASM + /// program to an address and triggers a compilation onchain by default. This transaction is atomic, + /// and will revert if either the program creation or onchain compilation step fails. + /// Developers can choose to split up the deploy and compile steps via this command as desired. + #[command(alias = "d")] + Deploy { + /// Does not submit a transaction, but instead estimates the gas required + /// to complete the operation. + #[arg(long, default_value = "false")] + estimate_gas: bool, + /// Disables the onchain compilation step of the deploy process. + /// This flag is useful for developers who want to split up the deploy and compile steps. + #[arg(long, default_value = "false")] + only_deploy: bool, + /// Disables the onchain deploy step of the deploy process. + /// This flag is useful for developers who want to split up the deploy and compile steps. + #[arg(long, default_value = "false")] + only_compile: bool, + /// The endpoint of the L2 node to connect to. + #[arg(short, long, default_value = "http://localhost:8545")] + endpoint: String, + /// Address of a multicall Stylus program on L2 to use for the atomic, onchain deploy+compile + /// operation. If not provided, address will be used. + #[arg(long)] + // TODO: Use an alloy primitive address type for this. + multicall_program_addr: Option, + }, +} + +fn main() -> eyre::Result<()> { + let cli = Cli::parse(); + match &cli.command { + Commands::Check { disabled_checks, .. } => { + let disabled = disabled_checks.as_ref().map(|f| { + f.into_iter() + .map(|s| s.as_str().into()) + .collect::>() + }); + check::run_checks(disabled) + } + Commands::Deploy { .. } => { + todo!(); + } + } +} From 77694af949aa3c3fd25f16abbddb31612ce65213 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 14:46:38 -0400 Subject: [PATCH 02/58] add in first pass --- arbitrator/Cargo.lock | 33 +- arbitrator/cargo-stylus/Cargo.toml | 8 + arbitrator/cargo-stylus/src/check.rs | 57 ++ arbitrator/cargo-stylus/src/constants.rs | 10 + arbitrator/stylus/tests/echo/.cargo/config | 2 + arbitrator/stylus/tests/echo/Cargo.lock | 585 +++++++++++++++++++++ arbitrator/stylus/tests/echo/Cargo.toml | 18 + arbitrator/stylus/tests/echo/src/main.rs | 10 + 8 files changed, 710 insertions(+), 13 deletions(-) create mode 100644 arbitrator/cargo-stylus/src/constants.rs create mode 100644 arbitrator/stylus/tests/echo/.cargo/config create mode 100644 arbitrator/stylus/tests/echo/Cargo.lock create mode 100644 arbitrator/stylus/tests/echo/Cargo.toml create mode 100644 arbitrator/stylus/tests/echo/src/main.rs diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 0e4d27fb6..ae4067119 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -265,16 +265,23 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cargo-stylus" version = "0.1.0" dependencies = [ + "arbutil", + "brotli2", + "bytes", "clap 4.3.17", "eyre", + "hex", + "prover", + "serde", + "stylus", ] [[package]] @@ -336,7 +343,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -1324,7 +1331,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -1429,9 +1436,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -1803,9 +1810,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.132" +version = "1.0.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" +checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" dependencies = [ "serde_derive", ] @@ -1832,13 +1839,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.132" +version = "1.0.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" +checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.27", ] [[package]] @@ -2001,9 +2008,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index cb3983a55..71e38622c 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -6,5 +6,13 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +brotli2 = "0.3.2" +bytes = "1.4.0" clap = { version = "4.3.17", features = [ "derive" ] } eyre = "0.6.8" +hex = "0.4.3" +serde = { version = "1.0.174", features = ["derive"] } +stylus = { path = "../stylus/" } +arbutil = { path = "../arbutil/" } +prover = { path = "../prover/", default-features = false, features = ["native"] } +stylus-sdk = { path = "../langs/rust/" } \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 4cf1fc6a7..e2484e453 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,3 +1,17 @@ +use std::env::current_dir; +use std::io::Read; +use std::path::PathBuf; +use std::process::Command; + +use brotli2::read::BrotliEncoder; +use bytes::buf::Reader; +use bytes::Buf; +use bytesize::ByteSize; +use hex; + +use arbutil::Color; +use prover::programs::prelude::*; + #[derive(PartialEq)] pub enum StylusCheck { CompressedSize, @@ -16,6 +30,8 @@ impl From<&str> for StylusCheck { } pub fn run_checks(disabled: Option>) -> eyre::Result<()> { + let cwd: PathBuf = current_dir().unwrap(); + // Compile the Rust program at the current working directory into WASM using // Cargo and then instrument the WASM code with Stylus. If any of the checks // are disabled, we avoid runnng it. @@ -23,5 +39,46 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { .as_ref() .map(|d| !d.contains(&StylusCheck::CompressedSize)) .unwrap_or(true); + + // TODO: Configure debug or release via flags. + // TODO: Capture errors from this command. + Command::new("cargo") + .arg("build") + .arg("--target=wasm32-unknown-unknown") + .output() + .expect("Failed to execute cargo build"); + + let wasm_path = cwd + .join(&project_name) + .join("target") + .join("wasm32-unknown-unknown") + .join("debug") + .join(format!("{}.wasm", &project_name)); + + println!("Reading compiled WASM at {}", wasm_path.display().yellow()); + + let wasm_file_bytes = + std::fs::read(&wasm_path).expect("Could not read WASM file at target path"); + + let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); + + // TODO: Configure compression level, move to constants. + let mut compressor = BrotliEncoder::new(wbytes, 9); + let mut compressed_bytes = vec![]; + compressor.read_to_end(&mut compressed_bytes).unwrap(); + + println!( + "Uncompressed size: {}", + ByteSize::b(wasm_file_bytes.len() as u64) + .to_string() + .yellow(), + ); + + println!( + "Brotli compressed size: {}", + ByteSize::b(compressed_bytes.len() as u64) + .to_string() + .mint(), + ); Ok(()) } \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs new file mode 100644 index 000000000..14a8b7a44 --- /dev/null +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -0,0 +1,10 @@ +/// Name of toml file found in Stylus project root folders +pub const PROJECT_CONFIG_FILE: &'static str = "stylus.toml"; +/// Subfolder name within the target/ output folder of Stylus projects. +pub const STYLUS_TARGET_SUBFOLDER: &'static str = "stylus"; +/// Extension for written, brotli-compressed WASM +pub const COMPRESSED_WASM_EXT: &'static str = ".compressed.wasm"; +/// Extension for written, Stylus instrumented WASM +pub const INSTRUMENTED_WASM_EXT: &'static str = ".instrumented.wasm"; +/// EOF prefix used in Stylus compressed WASMs on-chain +pub const EOF_PREFIX: &'static str = "EF000000"; \ No newline at end of file diff --git a/arbitrator/stylus/tests/echo/.cargo/config b/arbitrator/stylus/tests/echo/.cargo/config new file mode 100644 index 000000000..f4e8c002f --- /dev/null +++ b/arbitrator/stylus/tests/echo/.cargo/config @@ -0,0 +1,2 @@ +[build] +target = "wasm32-unknown-unknown" diff --git a/arbitrator/stylus/tests/echo/Cargo.lock b/arbitrator/stylus/tests/echo/Cargo.lock new file mode 100644 index 000000000..308c03ec0 --- /dev/null +++ b/arbitrator/stylus/tests/echo/Cargo.lock @@ -0,0 +1,585 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "alloy-primitives" +version = "0.2.0" +source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "proptest", + "ruint2", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.2.0" +source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" +dependencies = [ + "arrayvec", + "bytes", + "smol_str", +] + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[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 = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-hex" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "268f52aae268980d03dd9544c1ea591965b2735b038d6998d6e4ab37c8c24445" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "serde", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "echo" +version = "0.1.0" +dependencies = [ + "stylus-sdk", +] + +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" + +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" +dependencies = [ + "bit-set", + "bitflags 1.3.2", + "byteorder", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "ruint2" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b066b8e4fcea7fae86b6932d2449670b6b5545b7e8407841b2d3a916ff2a9f86" +dependencies = [ + "derive_more", + "ruint2-macro", + "rustc_version", + "thiserror", +] + +[[package]] +name = "ruint2-macro" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89dc553bc0cf4512a8b96caa2e21ed5f6e4b66bf28a1bd08fd9eb07c0b39b28c" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" + +[[package]] +name = "serde" +version = "1.0.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" + +[[package]] +name = "smol_str" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +dependencies = [ + "serde", +] + +[[package]] +name = "stylus-sdk" +version = "0.1.0" +dependencies = [ + "alloy-primitives", + "hex", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + +[[package]] +name = "thiserror" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" diff --git a/arbitrator/stylus/tests/echo/Cargo.toml b/arbitrator/stylus/tests/echo/Cargo.toml new file mode 100644 index 000000000..c3a9385a0 --- /dev/null +++ b/arbitrator/stylus/tests/echo/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "echo" +version = "0.1.0" +edition = "2021" + +[dependencies] +stylus-sdk = { path = "../../../langs/rust/" } + +[profile.release] +codegen-units = 1 +strip = true +lto = true +panic = "abort" + +# uncomment to optimize for size +# opt-level = "z" + +[workspace] diff --git a/arbitrator/stylus/tests/echo/src/main.rs b/arbitrator/stylus/tests/echo/src/main.rs new file mode 100644 index 000000000..8c5dd3b1a --- /dev/null +++ b/arbitrator/stylus/tests/echo/src/main.rs @@ -0,0 +1,10 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE + +#![no_main] + +stylus_sdk::entrypoint!(user_main); + +fn user_main(input: Vec) -> Result, Vec> { + Ok(input) +} From 59066bc47cf409da41ba40aaac97cf11495776fd Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 15:14:01 -0400 Subject: [PATCH 03/58] add in compile --- arbitrator/Cargo.lock | 200 ++++++++++++++++++++++- arbitrator/cargo-stylus/Cargo.toml | 3 +- arbitrator/cargo-stylus/src/check.rs | 24 ++- arbitrator/cargo-stylus/src/constants.rs | 11 +- arbitrator/cargo-stylus/src/main.rs | 1 + 5 files changed, 224 insertions(+), 15 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index ae4067119..43ea46ff3 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -49,6 +49,34 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" +[[package]] +name = "alloy-primitives" +version = "0.2.0" +source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa 1.0.9", + "proptest", + "ruint2", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.2.0" +source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" +dependencies = [ + "arrayvec", + "bytes", + "smol_str", +] + [[package]] name = "ansi_term" version = "0.11.0" @@ -173,6 +201,21 @@ dependencies = [ "serde", ] +[[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 = "bitflags" version = "1.3.2" @@ -269,13 +312,21 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +[[package]] +name = "bytesize" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" + [[package]] name = "cargo-stylus" version = "0.1.0" dependencies = [ + "alloy-primitives", "arbutil", "brotli2", "bytes", + "bytesize", "clap 4.3.17", "eyre", "hex", @@ -390,6 +441,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "const-hex" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "268f52aae268980d03dd9544c1ea591965b2735b038d6998d6e4ab37c8c24445" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "serde", +] + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "corosensei" version = "0.1.3" @@ -533,6 +602,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -589,6 +664,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + [[package]] name = "diff" version = "0.1.13" @@ -876,6 +964,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "ident_case" version = "1.0.1" @@ -971,6 +1065,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + [[package]] name = "jit" version = "0.1.0" @@ -1467,6 +1567,26 @@ dependencies = [ "quote", ] +[[package]] +name = "proptest" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5" +dependencies = [ + "bit-set", + "bitflags 1.3.2", + "byteorder", + "lazy_static", + "num-traits", + "quick-error 2.0.1", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", +] + [[package]] name = "prover" version = "0.1.0" @@ -1522,6 +1642,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quote" version = "1.0.28" @@ -1570,6 +1702,15 @@ dependencies = [ "rand_core", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.5.1" @@ -1700,6 +1841,24 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ruint2" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b066b8e4fcea7fae86b6932d2449670b6b5545b7e8407841b2d3a916ff2a9f86" +dependencies = [ + "derive_more", + "ruint2-macro", + "rustc_version", + "thiserror", +] + +[[package]] +name = "ruint2-macro" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89dc553bc0cf4512a8b96caa2e21ed5f6e4b66bf28a1bd08fd9eb07c0b39b28c" + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -1760,6 +1919,18 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.5" @@ -1854,7 +2025,7 @@ version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950" dependencies = [ - "itoa", + "itoa 0.4.8", "ryu", "serde", ] @@ -1925,6 +2096,15 @@ dependencies = [ "serde", ] +[[package]] +name = "smol_str" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +dependencies = [ + "serde", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2090,6 +2270,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tracing" version = "0.1.34" @@ -2170,6 +2359,15 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index 71e38622c..8ba17a5ee 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -15,4 +15,5 @@ serde = { version = "1.0.174", features = ["derive"] } stylus = { path = "../stylus/" } arbutil = { path = "../arbutil/" } prover = { path = "../prover/", default-features = false, features = ["native"] } -stylus-sdk = { path = "../langs/rust/" } \ No newline at end of file +alloy-primitives = { git = "https://github.com/rachel-bousfield/alloy-core.git", branch = "native-keccak" } +bytesize = "1.2.0" diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index e2484e453..9344b7779 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -12,9 +12,13 @@ use hex; use arbutil::Color; use prover::programs::prelude::*; +use crate::constants; + #[derive(PartialEq)] pub enum StylusCheck { CompressedSize, + // TODO: Adding more checks here would require being able to toggle + // compiler middlewares in the compile config store() method. } impl From<&str> for StylusCheck { @@ -37,7 +41,7 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { // are disabled, we avoid runnng it. let _check_compressed_size = disabled .as_ref() - .map(|d| !d.contains(&StylusCheck::CompressedSize)) + .map(|d: &Vec| !d.contains(&StylusCheck::CompressedSize)) .unwrap_or(true); // TODO: Configure debug or release via flags. @@ -49,11 +53,10 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { .expect("Failed to execute cargo build"); let wasm_path = cwd - .join(&project_name) .join("target") .join("wasm32-unknown-unknown") .join("debug") - .join(format!("{}.wasm", &project_name)); + .join(format!("{}.wasm", "echo")); println!("Reading compiled WASM at {}", wasm_path.display().yellow()); @@ -63,7 +66,7 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); // TODO: Configure compression level, move to constants. - let mut compressor = BrotliEncoder::new(wbytes, 9); + let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor.read_to_end(&mut compressed_bytes).unwrap(); @@ -80,5 +83,18 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { .to_string() .mint(), ); + + let config = CompileConfig::default(); + let instrumented = stylus::native::module( + &wasm_file_bytes, config + ).unwrap(); + + println!( + "Instrumented wasm raw bytes: {}", + ByteSize::b(instrumented.len() as u64) + .to_string() + .mint(), + ); + Ok(()) } \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 14a8b7a44..3bddf87f3 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -1,10 +1,3 @@ -/// Name of toml file found in Stylus project root folders -pub const PROJECT_CONFIG_FILE: &'static str = "stylus.toml"; -/// Subfolder name within the target/ output folder of Stylus projects. -pub const STYLUS_TARGET_SUBFOLDER: &'static str = "stylus"; -/// Extension for written, brotli-compressed WASM -pub const COMPRESSED_WASM_EXT: &'static str = ".compressed.wasm"; -/// Extension for written, Stylus instrumented WASM -pub const INSTRUMENTED_WASM_EXT: &'static str = ".instrumented.wasm"; /// EOF prefix used in Stylus compressed WASMs on-chain -pub const EOF_PREFIX: &'static str = "EF000000"; \ No newline at end of file +pub const EOF_PREFIX: &'static str = "EF000000"; +pub const BROTLI_COMPRESSION_LEVEL: u32 = 9; \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 1d25c90b7..d363db7bc 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,6 +1,7 @@ use clap::{Parser, Subcommand}; mod check; +mod constants; mod deploy; #[derive(Parser, Debug)] From 47bc79719bdcc5679e75cf6cdf4841b274add824 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 15:45:36 -0400 Subject: [PATCH 04/58] begin deploy --- arbitrator/cargo-stylus/src/check.rs | 68 ++++++++++++++++++--------- arbitrator/cargo-stylus/src/deploy.rs | 48 +++++++++++++++++++ 2 files changed, 95 insertions(+), 21 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 9344b7779..b83dff50e 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,13 +1,13 @@ use std::env::current_dir; use std::io::Read; use std::path::PathBuf; -use std::process::Command; +use std::process::{Command, Stdio}; use brotli2::read::BrotliEncoder; use bytes::buf::Reader; use bytes::Buf; use bytesize::ByteSize; -use hex; +use eyre::bail; use arbutil::Color; use prover::programs::prelude::*; @@ -34,20 +34,23 @@ impl From<&str> for StylusCheck { } pub fn run_checks(disabled: Option>) -> eyre::Result<()> { - let cwd: PathBuf = current_dir().unwrap(); - // Compile the Rust program at the current working directory into WASM using // Cargo and then instrument the WASM code with Stylus. If any of the checks // are disabled, we avoid runnng it. - let _check_compressed_size = disabled + let check_compressed_size = disabled .as_ref() .map(|d: &Vec| !d.contains(&StylusCheck::CompressedSize)) .unwrap_or(true); + let cwd: PathBuf = current_dir().unwrap(); + // TODO: Configure debug or release via flags. // TODO: Capture errors from this command. Command::new("cargo") + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) .arg("build") + .arg("--release") .arg("--target=wasm32-unknown-unknown") .output() .expect("Failed to execute cargo build"); @@ -55,7 +58,7 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { let wasm_path = cwd .join("target") .join("wasm32-unknown-unknown") - .join("debug") + .join("release") .join(format!("{}.wasm", "echo")); println!("Reading compiled WASM at {}", wasm_path.display().yellow()); @@ -65,36 +68,59 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); - // TODO: Configure compression level, move to constants. + // TODO: Configure compression level. let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor.read_to_end(&mut compressed_bytes).unwrap(); println!( - "Uncompressed size: {}", + "Uncompressed WASM size: {}", ByteSize::b(wasm_file_bytes.len() as u64) .to_string() .yellow(), ); - - println!( - "Brotli compressed size: {}", - ByteSize::b(compressed_bytes.len() as u64) - .to_string() - .mint(), - ); + + let compressed_size = ByteSize::b(compressed_bytes.len() as u64); + + if check_compressed_size { + // TODO: Configure. + if compressed_size > ByteSize::kb(24) { + bail!( + "Brotli-compressed WASM size {} is bigger than program size limit: {}", + compressed_size.to_string().red(), + ByteSize::kb(24).to_string(), + ); + } else { + println!( + "Brotli-compressed WASM size {} within program size limit: {}", + compressed_size.to_string().mint(), + ByteSize::kb(24).to_string(), + ); + } + } let config = CompileConfig::default(); - let instrumented = stylus::native::module( - &wasm_file_bytes, config - ).unwrap(); + let module = match stylus::native::module(&wasm_file_bytes, config) { + Ok(module) => module, + Err(error) => { + bail!("Failed to compile WASM: {:?}", error); + } + }; + let success = "Stylus compilation successful!".to_string().mint(); + println!("{}", success); println!( - "Instrumented wasm raw bytes: {}", - ByteSize::b(instrumented.len() as u64) + "Compiled WASM module total size: {}", + ByteSize::b(module.len() as u64) .to_string() - .mint(), ); + Ok(()) +} + +pub fn check_compressed_size() -> eyre::Result<()> { + Ok(()) +} +pub fn check_compilation() -> eyre::Result<()> { Ok(()) } \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 8b1378917..df72b49e0 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1 +1,49 @@ +use std::env::current_dir; +use std::io::Read; +use std::path::PathBuf; +use std::process::{Command, Stdio}; +use brotli2::read::BrotliEncoder; +use bytes::buf::Reader; +use bytes::Buf; + +use arbutil::Color; + +use crate::constants; + +pub fn deploy_and_compile_onchain() -> eyre::Result<()> { + let cwd: PathBuf = current_dir().unwrap(); + + // TODO: Configure debug or release via flags. + // TODO: Capture errors from this command. + Command::new("cargo") + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .arg("build") + .arg("--release") + .arg("--target=wasm32-unknown-unknown") + .output() + .expect("Failed to execute cargo build"); + + let wasm_path = cwd + .join("target") + .join("wasm32-unknown-unknown") + .join("release") + .join(format!("{}.wasm", "echo")); + + println!("Reading compiled WASM at {}", wasm_path.display().yellow()); + + let wasm_file_bytes = + std::fs::read(&wasm_path).expect("Could not read WASM file at target path"); + + let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); + + let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); + let mut compressed_bytes = vec![]; + compressor.read_to_end(&mut compressed_bytes).unwrap(); + + // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers + // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data + // tx to send to a multicall.rs rust program. + Ok(()) +} \ No newline at end of file From 9b4f9694e1087ee85b8fd6961787d1d2f36f315f Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 16:42:31 -0400 Subject: [PATCH 05/58] better cli --- arbitrator/Cargo.lock | 2439 +++++++++++++++++++++- arbitrator/cargo-stylus/Cargo.toml | 2 + arbitrator/cargo-stylus/src/check.rs | 9 +- arbitrator/cargo-stylus/src/constants.rs | 2 +- arbitrator/cargo-stylus/src/deploy.rs | 49 +- arbitrator/cargo-stylus/src/main.rs | 45 +- 6 files changed, 2463 insertions(+), 83 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 43ea46ff3..615516c22 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -7,6 +7,10 @@ name = "Inflector" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] [[package]] name = "addr2line" @@ -23,6 +27,17 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.6" @@ -36,9 +51,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.19" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -60,7 +75,7 @@ dependencies = [ "const-hex", "derive_more", "hex-literal", - "itoa 1.0.9", + "itoa", "proptest", "ruint2", "serde", @@ -77,6 +92,12 @@ dependencies = [ "smol_str", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "ansi_term" version = "0.11.0" @@ -160,6 +181,37 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "async-trait" +version = "0.1.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2d0f03b3640e3a630367e40c468cb7f309529c708ed1d88597047b0e7c6ef7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version", +] + [[package]] name = "atty" version = "0.2.14" @@ -171,6 +223,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -187,11 +251,41 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.5.3", "object 0.29.0", "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" + [[package]] name = "bincode" version = "1.3.3" @@ -228,6 +322,28 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +[[package]] +name = "bitvec" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" +dependencies = [ + "either", + "radium 0.3.0", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium 0.7.0", + "tap", + "wyz", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -273,12 +389,27 @@ dependencies = [ "libc", ] +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" +dependencies = [ + "sha2 0.9.9", +] + [[package]] name = "bumpalo" version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "bytecheck" version = "0.6.9" @@ -311,6 +442,9 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] [[package]] name = "bytesize" @@ -318,6 +452,45 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +dependencies = [ + "serde", +] + [[package]] name = "cargo-stylus" version = "0.1.0" @@ -328,18 +501,37 @@ dependencies = [ "bytes", "bytesize", "clap 4.3.17", + "ethers", "eyre", "hex", "prover", "serde", + "serde_json", "stylus", ] +[[package]] +name = "cargo_metadata" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.13", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +dependencies = [ + "jobserver", +] [[package]] name = "cfg-if" @@ -347,6 +539,26 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "num-traits", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "2.33.3" @@ -403,6 +615,62 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +[[package]] +name = "coins-bip32" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30a84aab436fcb256a2ab3c80663d8aec686e6bae12827bb05fef3e1e439c9f" +dependencies = [ + "bincode", + "bs58", + "coins-core", + "digest 0.10.7", + "getrandom", + "hmac", + "k256", + "lazy_static", + "serde", + "sha2 0.10.7", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f4d04ee18e58356accd644896aeb2094ddeafb6a713e056cef0c0a8e468c15" +dependencies = [ + "bitvec 0.17.4", + "coins-bip32", + "getrandom", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2 0.10.7", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b949a1c63fb7eb591eb7ba438746326aedf0ae843e51ec92ba6bec5bb382c4f" +dependencies = [ + "base64 0.21.2", + "bech32", + "bs58", + "digest 0.10.7", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2 0.10.7", + "sha3 0.10.8", + "thiserror", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -453,6 +721,18 @@ dependencies = [ "serde", ] +[[package]] +name = "const-oid" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + [[package]] name = "convert_case" version = "0.4.0" @@ -608,6 +888,18 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -618,6 +910,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "darling" version = "0.13.4" @@ -653,6 +954,22 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -699,7 +1016,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -723,6 +1042,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "dynasm" version = "1.2.3" @@ -749,12 +1074,81 @@ dependencies = [ "memmap2", ] +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "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.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf56acd72bb22d2824e66ae8e9e5ada4d0de17a69c7fd35569dde2ada8ec9116" +dependencies = [ + "base64 0.13.1", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "sha3 0.10.8", + "zeroize", +] + [[package]] name = "enum-iterator" version = "0.7.0" @@ -796,6 +1190,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.1" @@ -818,19 +1218,335 @@ dependencies = [ ] [[package]] -name = "eyre" -version = "0.6.8" +name = "eth-keystore" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "indenter", - "once_cell", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.7", + "sha3 0.10.8", + "thiserror", + "uuid", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3 0.10.8", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b4026b97da8281276744741fac7eb385da905f6093c583331fa2953fdd4253" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edcb6ffefc230d8c42874c51b28dc11dbb8de50b27a8fdf92648439d6baa68dc" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4719a44c3d37ab07c6dea99ab174068d8c35e441b60b6c20ce4e48357273e8" +dependencies = [ + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "ethers-signers", + "futures-util", + "hex", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "155ea1b84d169d231317ed86e307af6f2bed6b40dd17e5e94bc84da21cadb21c" +dependencies = [ + "Inflector", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "hex", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.27", + "toml", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8567ff196c4a37c1a8c90ec73bda0ad2062e191e4f0a6dc4d943e2ec4830fc88" +dependencies = [ + "Inflector", + "ethers-contract-abigen", + "ethers-core", + "hex", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.27", +] + +[[package]] +name = "ethers-core" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ca2514feb98918a0a31de7e1983c29f2267ebf61b2dc5d4294f91e5b866623" +dependencies = [ + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "elliptic-curve", + "ethabi", + "generic-array", + "hex", + "k256", + "num_enum", + "once_cell", + "open-fastrlp", + "rand", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.27", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "ethers-etherscan" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22b3a8269d3df0ed6364bc05b4735b95f4bf830ce3aef87d5e760fb0e93e5b91" +dependencies = [ + "ethers-core", + "reqwest", + "semver 1.0.13", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c339aad74ae5c451d27e0e49c7a3c7d22620b119b4f9291d7aa21f72d7f366" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b411b119f1cf0efb69e2190883dee731251882bb21270f893ee9513b3a697c48" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.2", + "bytes", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "hex", + "http", + "instant", + "once_cell", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-signers" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4864d387456a9c09a1157fa10e1528b29d90f1d859443acf06a1b23365fb518c" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "hex", + "rand", + "sha2 0.10.7", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-solc" +version = "2.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6c2b9625a2c639d46625f88acc2092a3cb35786c37f7c2128b3ca20f639b3c" +dependencies = [ + "cfg-if", + "dunce", + "ethers-core", + "glob", + "hex", + "home", + "md-5", + "num_cpus", + "once_cell", + "path-slash", + "rayon", + "regex", + "semver 1.0.13", + "serde", + "serde_json", + "solang-parser", + "svm-rs", + "thiserror", + "tiny-keccak", + "tokio", + "tracing", + "walkdir", + "yansi", +] + +[[package]] +name = "eyre" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] @@ -842,6 +1558,16 @@ dependencies = [ "instant", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + [[package]] name = "filetime" version = "0.2.21" @@ -854,12 +1580,174 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +dependencies = [ + "crc32fast", + "miniz_oxide 0.7.1", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -871,12 +1759,13 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.4" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -895,8 +1784,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -906,10 +1797,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", - "indexmap", + "indexmap 1.8.1", "stable_deref_trait", ] +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.8.1", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -928,6 +1867,21 @@ dependencies = [ "ahash", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + [[package]] name = "heck" version = "0.3.3" @@ -970,12 +1924,150 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "indenter" version = "0.3.3" @@ -993,6 +2085,16 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "inkwell" version = "0.1.0-beta.4" @@ -1019,6 +2121,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + [[package]] name = "instant" version = "0.1.12" @@ -1039,6 +2150,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + [[package]] name = "is-terminal" version = "0.4.9" @@ -1059,12 +2176,6 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - [[package]] name = "itoa" version = "1.0.9" @@ -1093,6 +2204,15 @@ dependencies = [ "wasmer-compiler-llvm", ] +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.60" @@ -1102,6 +2222,20 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "k256" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.7", + "signature", +] + [[package]] name = "keccak" version = "0.1.4" @@ -1111,6 +2245,34 @@ dependencies = [ "cpufeatures", ] +[[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", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.7.4", + "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.4.0" @@ -1192,11 +2354,20 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "memchr" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memmap2" @@ -1216,6 +2387,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + [[package]] name = "minimal-lexical" version = "0.1.3" @@ -1231,6 +2408,26 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "miow" version = "0.3.7" @@ -1246,6 +2443,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + [[package]] name = "nom" version = "7.0.0" @@ -1346,14 +2549,35 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi 0.3.1", "libc", ] +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.27", +] + [[package]] name = "object" version = "0.28.4" @@ -1362,7 +2586,7 @@ checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "crc32fast", "hashbrown 0.11.2", - "indexmap", + "indexmap 1.8.1", "memchr", ] @@ -1377,9 +2601,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -1387,6 +2611,31 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ouroboros" version = "0.15.6" @@ -1434,6 +2683,32 @@ dependencies = [ "syn 2.0.27", ] +[[package]] +name = "parity-scale-codec" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" +dependencies = [ + "arrayvec", + "bitvec 1.0.1", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "parking_lot" version = "0.11.2" @@ -1482,6 +2757,51 @@ dependencies = [ "windows-sys 0.36.1", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", + "hmac", + "password-hash", + "sha2 0.10.7", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + [[package]] name = "pest" version = "2.3.0" @@ -1492,18 +2812,171 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "petgraph" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +dependencies = [ + "fixedbitset", + "indexmap 1.8.1", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "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.27", +] + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + [[package]] name = "pin-project-lite" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + [[package]] name = "ppv-lite86" 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 = "prettyplease" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" +dependencies = [ + "proc-macro2", + "syn 2.0.27", +] + +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1582,7 +3055,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.6.27", "rusty-fork", "tempfile", ] @@ -1663,6 +3136,18 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" @@ -1686,9 +3171,9 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ "getrandom", ] @@ -1713,26 +3198,23 @@ dependencies = [ [[package]] name = "rayon" -version = "1.5.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ - "autocfg", - "crossbeam-deque", "either", "rayon-core", ] [[package]] name = "rayon-core" -version = "1.9.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "lazy_static", "num_cpus", ] @@ -1779,13 +3261,25 @@ dependencies = [ [[package]] name = "regex" -version = "1.6.0" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax 0.7.4", +] + +[[package]] +name = "regex-automata" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.7.4", ] [[package]] @@ -1794,6 +3288,12 @@ version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + [[package]] name = "region" version = "3.0.0" @@ -1815,6 +3315,79 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "reqwest" +version = "0.11.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +dependencies = [ + "base64 0.21.2", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.22.6", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "rkyv" version = "0.7.39" @@ -1823,7 +3396,7 @@ checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" dependencies = [ "bytecheck", "hashbrown 0.12.3", - "indexmap", + "indexmap 1.8.1", "ptr_meta", "rend", "rkyv_derive", @@ -1841,6 +3414,28 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ruint2" version = "1.9.0" @@ -1865,6 +3460,12 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + [[package]] name = "rustc_version" version = "0.4.0" @@ -1913,6 +3514,47 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustls" +version = "0.21.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.1", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.6" @@ -1937,6 +3579,48 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-info" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "scoped-tls" version = "1.0.1" @@ -1949,12 +3633,48 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2 0.10.7", +] + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "0.11.0" @@ -1969,6 +3689,9 @@ name = "semver" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" +dependencies = [ + "serde", +] [[package]] name = "semver-parser" @@ -1979,6 +3702,18 @@ dependencies = [ "pest", ] +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" version = "1.0.174" @@ -2021,11 +3756,32 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.67" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ - "itoa 0.4.8", + "form_urlencoded", + "itoa", "ryu", "serde", ] @@ -2053,6 +3809,41 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sha3" version = "0.9.1" @@ -2075,12 +3866,31 @@ dependencies = [ "keccak", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + [[package]] name = "siphasher" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + [[package]] name = "slice-group-by" version = "0.3.0" @@ -2105,6 +3915,46 @@ dependencies = [ "serde", ] +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "solang-parser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c792fe9fae2a2f716846f214ca10d5a1e21133e0bf36cef34bcc4a852467b21" +dependencies = [ + "itertools", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2117,6 +3967,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[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 = "strsim" version = "0.8.0" @@ -2153,6 +4016,28 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6069ca09d878a33f883cc06aaa9718ede171841d3832450354410b718b097232" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.27", +] + [[package]] name = "stylus" version = "0.1.0" @@ -2169,10 +4054,36 @@ dependencies = [ "rand", "sha3 0.10.8", "thiserror", - "wasmer", - "wasmer-compiler-cranelift", - "wasmer-compiler-llvm", - "wasmer-compiler-singlepass", + "wasmer", + "wasmer-compiler-cranelift", + "wasmer-compiler-llvm", + "wasmer-compiler-singlepass", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "svm-rs" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a04fc4f5cd35c700153b233f5575ccb3237e0f941fa5049d9e98254d10bf2fe" +dependencies = [ + "fs2", + "hex", + "home", + "once_cell", + "reqwest", + "semver 1.0.13", + "serde", + "serde_json", + "sha2 0.10.7", + "thiserror", + "url", + "zip", ] [[package]] @@ -2197,6 +4108,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "target-lexicon" version = "0.12.4" @@ -2270,6 +4187,22 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "time" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +dependencies = [ + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -2279,11 +4212,122 @@ dependencies = [ "crunchy", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +dependencies = [ + "autocfg", + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c" +dependencies = [ + "futures-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots 0.23.1", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" -version = "0.1.34" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "pin-project-lite", @@ -2293,22 +4337,59 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.27", ] [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ - "lazy_static", + "once_cell", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "rustls", + "sha1", + "thiserror", + "url", + "utf-8", + "webpki", ] [[package]] @@ -2323,12 +4404,39 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -2341,12 +4449,51 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8parse" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "vec_map" version = "0.8.2" @@ -2368,6 +4515,25 @@ dependencies = [ "libc", ] +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2504,7 +4670,7 @@ dependencies = [ "bytes", "cfg-if", "hashbrown 0.11.2", - "indexmap", + "indexmap 1.8.1", "js-sys", "macro-wasmer-universal-test", "more-asserts", @@ -2642,7 +4808,7 @@ version = "3.1.0" dependencies = [ "enum-iterator", "enumset", - "indexmap", + "indexmap 1.8.1", "memoffset", "more-asserts", "rkyv", @@ -2661,7 +4827,7 @@ dependencies = [ "cfg-if", "corosensei", "enum-iterator", - "indexmap", + "indexmap 1.8.1", "lazy_static", "libc", "mach", @@ -2712,6 +4878,34 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.1", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2728,6 +4922,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2885,3 +5088,111 @@ name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi", +] + +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.8+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +dependencies = [ + "cc", + "libc", + "pkg-config", +] diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index 8ba17a5ee..a23d22c3a 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -17,3 +17,5 @@ arbutil = { path = "../arbutil/" } prover = { path = "../prover/", default-features = false, features = ["native"] } alloy-primitives = { git = "https://github.com/rachel-bousfield/alloy-core.git", branch = "native-keccak" } bytesize = "1.2.0" +ethers = "2.0.8" +serde_json = "1.0.103" diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index b83dff50e..74a013cbc 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -33,6 +33,8 @@ impl From<&str> for StylusCheck { } } +// TODO: separate out the business logic of cargo compilation, reading the file, etc. +// as it will be reused by the deploy command. pub fn run_checks(disabled: Option>) -> eyre::Result<()> { // Compile the Rust program at the current working directory into WASM using // Cargo and then instrument the WASM code with Stylus. If any of the checks @@ -79,7 +81,7 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { .to_string() .yellow(), ); - + let compressed_size = ByteSize::b(compressed_bytes.len() as u64); if check_compressed_size { @@ -111,8 +113,7 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<()> { println!("{}", success); println!( "Compiled WASM module total size: {}", - ByteSize::b(module.len() as u64) - .to_string() + ByteSize::b(module.len() as u64).to_string() ); Ok(()) } @@ -123,4 +124,4 @@ pub fn check_compressed_size() -> eyre::Result<()> { pub fn check_compilation() -> eyre::Result<()> { Ok(()) -} \ No newline at end of file +} diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 3bddf87f3..36e1d5ddf 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -1,3 +1,3 @@ /// EOF prefix used in Stylus compressed WASMs on-chain pub const EOF_PREFIX: &'static str = "EF000000"; -pub const BROTLI_COMPRESSION_LEVEL: u32 = 9; \ No newline at end of file +pub const BROTLI_COMPRESSION_LEVEL: u32 = 9; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index df72b49e0..b1bc4cd02 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1,3 +1,4 @@ +use std::convert::TryFrom; use std::env::current_dir; use std::io::Read; use std::path::PathBuf; @@ -5,13 +6,21 @@ use std::process::{Command, Stdio}; use brotli2::read::BrotliEncoder; use bytes::buf::Reader; -use bytes::Buf; +use bytes::{Buf, Bytes}; + +use ethers::types::{Address, H160}; +use ethers::{ + core::{types::TransactionRequest, utils::Anvil}, + middleware::SignerMiddleware, + providers::{Http, Middleware, Provider}, + signers::{LocalWallet, Signer}, +}; use arbutil::Color; use crate::constants; -pub fn deploy_and_compile_onchain() -> eyre::Result<()> { +pub async fn deploy_and_compile_onchain() -> eyre::Result<()> { let cwd: PathBuf = current_dir().unwrap(); // TODO: Configure debug or release via flags. @@ -42,8 +51,42 @@ pub fn deploy_and_compile_onchain() -> eyre::Result<()> { let mut compressed_bytes = vec![]; compressor.read_to_end(&mut compressed_bytes).unwrap(); + // TODO: Add the compression and compilation checks in here. Reuse functions from check. + // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data // tx to send to a multicall.rs rust program. Ok(()) -} \ No newline at end of file +} + +async fn submit_signed_tx(endpoint: &str) -> eyre::Result<()> { + let anvil = Anvil::new().spawn(); + + let wallet: LocalWallet = anvil.keys()[0].clone().into(); + let addr = wallet.address(); + let provider = Provider::::try_from(endpoint)?; + let client = SignerMiddleware::new(provider, wallet.with_chain_id(anvil.chain_id())); + + let tx = prepare_tx(addr, Bytes::default()); + let pending_tx = client.send_transaction(tx, None).await?; + + let receipt = pending_tx + .await? + .ok_or_else(|| eyre::format_err!("tx dropped from mempool"))?; + + let tx = client.get_transaction(receipt.transaction_hash).await?; + + println!("Sent tx: {}\n", serde_json::to_string(&tx)?); + println!("Tx receipt: {}", serde_json::to_string(&receipt)?); + Ok(()) +} + +fn prepare_tx(address: H160, data: Bytes) -> TransactionRequest { + TransactionRequest::new() + .to(address) + .data(data) +} + +fn prepare_compilation_tx() -> eyre::Result<()> { + Ok(()) +} diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index d363db7bc..6d0a28d2e 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,4 +1,4 @@ -use clap::{Parser, Subcommand}; +use clap::{Parser, Subcommand, Args, ValueEnum}; mod check; mod constants; @@ -35,16 +35,12 @@ enum Commands { Deploy { /// Does not submit a transaction, but instead estimates the gas required /// to complete the operation. - #[arg(long, default_value = "false")] + #[arg(long)] estimate_gas: bool, - /// Disables the onchain compilation step of the deploy process. - /// This flag is useful for developers who want to split up the deploy and compile steps. - #[arg(long, default_value = "false")] - only_deploy: bool, - /// Disables the onchain deploy step of the deploy process. - /// This flag is useful for developers who want to split up the deploy and compile steps. - #[arg(long, default_value = "false")] - only_compile: bool, + /// By default, submits a single, atomic deploy and compile transaction to Arbitrum. + /// Otherwise, a user could choose to split up the deploy and compile steps into individual transactions. + #[arg(long, value_enum)] + mode: Option, /// The endpoint of the L2 node to connect to. #[arg(short, long, default_value = "http://localhost:8545")] endpoint: String, @@ -53,13 +49,40 @@ enum Commands { #[arg(long)] // TODO: Use an alloy primitive address type for this. multicall_program_addr: Option, + /// Wallet source to use with the cargo stylus plugin. + #[command(flatten)] + wallet: WalletSource, }, } +#[derive(Debug, Clone, ValueEnum)] +enum DeployMode { + DeployOnly, + CompileOnly, +} + +#[derive(Debug, Args)] +#[group(required = true, multiple = false)] +struct WalletSource { + #[arg(long, group = "keystore")] + keystore_path: Option, + #[arg(long, group = "keystore")] + keystore_password_path: Option, + #[arg(long)] + private_key_path: Option, +} + +#[derive(Debug, Clone, Args)] +#[group(required = true)] +struct KeystoreOpts { +} + fn main() -> eyre::Result<()> { let cli = Cli::parse(); match &cli.command { - Commands::Check { disabled_checks, .. } => { + Commands::Check { + disabled_checks, .. + } => { let disabled = disabled_checks.as_ref().map(|f| { f.into_iter() .map(|s| s.as_str().into()) From 31699e3a598e6ac134edf44dcd71d7e794b94186 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 16:59:40 -0400 Subject: [PATCH 06/58] support local wallet from keystore or privkey --- arbitrator/Cargo.lock | 13 ++++++ arbitrator/cargo-stylus/Cargo.toml | 1 + arbitrator/cargo-stylus/src/deploy.rs | 31 +++++++++---- arbitrator/cargo-stylus/src/main.rs | 63 +++++++++++++-------------- 4 files changed, 67 insertions(+), 41 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 615516c22..e6703347b 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -508,6 +508,7 @@ dependencies = [ "serde", "serde_json", "stylus", + "tokio", ] [[package]] @@ -4241,9 +4242,21 @@ dependencies = [ "num_cpus", "pin-project-lite", "socket2", + "tokio-macros", "windows-sys 0.48.0", ] +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + [[package]] name = "tokio-rustls" version = "0.24.1" diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index a23d22c3a..732b2c75d 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -19,3 +19,4 @@ alloy-primitives = { git = "https://github.com/rachel-bousfield/alloy-core.git", bytesize = "1.2.0" ethers = "2.0.8" serde_json = "1.0.103" +tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index b1bc4cd02..c5c5f4e22 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -18,9 +18,9 @@ use ethers::{ use arbutil::Color; -use crate::constants; +use crate::{constants, DeployConfig}; -pub async fn deploy_and_compile_onchain() -> eyre::Result<()> { +pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> { let cwd: PathBuf = current_dir().unwrap(); // TODO: Configure debug or release via flags. @@ -56,16 +56,29 @@ pub async fn deploy_and_compile_onchain() -> eyre::Result<()> { // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data // tx to send to a multicall.rs rust program. - Ok(()) + let wallet = if let Some(priv_key_path) = &cfg.wallet.private_key_path { + let priv_key_bytes = bytes::Bytes::from( + std::fs::read(priv_key_path).expect("Could not read private key file"), + ); + LocalWallet::from_bytes(&priv_key_bytes).expect("Could not initialize wallet from priv key bytes") + } else { + let wallet = cfg.wallet.clone(); + let keystore_password_path = wallet.keystore_password_path.expect("No keystore password file provided"); + let keystore_path = wallet.keystore_path.expect("No keystore path provided"); + let keystore_pass = std::fs::read_to_string(keystore_password_path).expect("Could not keystore password file"); + LocalWallet::decrypt_keystore( + keystore_path, + keystore_pass, + ).expect("Could not decrypt keystore") + }; + submit_signed_tx(&cfg.endpoint, wallet).await } -async fn submit_signed_tx(endpoint: &str) -> eyre::Result<()> { - let anvil = Anvil::new().spawn(); - - let wallet: LocalWallet = anvil.keys()[0].clone().into(); - let addr = wallet.address(); +async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet) -> eyre::Result<()> { let provider = Provider::::try_from(endpoint)?; - let client = SignerMiddleware::new(provider, wallet.with_chain_id(anvil.chain_id())); + let chain_id = provider.get_chainid().await?.as_u64(); + let addr = wallet.address(); + let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); let tx = prepare_tx(addr, Bytes::default()); let pending_tx = client.send_transaction(tx, None).await?; diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 6d0a28d2e..73cc04898 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -32,38 +32,41 @@ enum Commands { /// and will revert if either the program creation or onchain compilation step fails. /// Developers can choose to split up the deploy and compile steps via this command as desired. #[command(alias = "d")] - Deploy { - /// Does not submit a transaction, but instead estimates the gas required - /// to complete the operation. - #[arg(long)] - estimate_gas: bool, - /// By default, submits a single, atomic deploy and compile transaction to Arbitrum. - /// Otherwise, a user could choose to split up the deploy and compile steps into individual transactions. - #[arg(long, value_enum)] - mode: Option, - /// The endpoint of the L2 node to connect to. - #[arg(short, long, default_value = "http://localhost:8545")] - endpoint: String, - /// Address of a multicall Stylus program on L2 to use for the atomic, onchain deploy+compile - /// operation. If not provided, address will be used. - #[arg(long)] - // TODO: Use an alloy primitive address type for this. - multicall_program_addr: Option, - /// Wallet source to use with the cargo stylus plugin. - #[command(flatten)] - wallet: WalletSource, - }, + Deploy(DeployConfig), } +#[derive(Debug, Args)] +pub struct DeployConfig { + /// Does not submit a transaction, but instead estimates the gas required + /// to complete the operation. + #[arg(long)] + estimate_gas: bool, + /// By default, submits a single, atomic deploy and compile transaction to Arbitrum. + /// Otherwise, a user could choose to split up the deploy and compile steps into individual transactions. + #[arg(long, value_enum)] + mode: Option, + /// The endpoint of the L2 node to connect to. + #[arg(short, long, default_value = "http://localhost:8545")] + endpoint: String, + /// Address of a multicall Stylus program on L2 to use for the atomic, onchain deploy+compile + /// operation. If not provided, address will be used. + #[arg(long)] + // TODO: Use an alloy primitive address type for this. + multicall_program_addr: Option, + /// Wallet source to use with the cargo stylus plugin. + #[command(flatten)] + wallet: WalletSource, +} + #[derive(Debug, Clone, ValueEnum)] -enum DeployMode { +pub enum DeployMode { DeployOnly, CompileOnly, } -#[derive(Debug, Args)] +#[derive(Clone, Debug, Args)] #[group(required = true, multiple = false)] -struct WalletSource { +pub struct WalletSource { #[arg(long, group = "keystore")] keystore_path: Option, #[arg(long, group = "keystore")] @@ -72,12 +75,8 @@ struct WalletSource { private_key_path: Option, } -#[derive(Debug, Clone, Args)] -#[group(required = true)] -struct KeystoreOpts { -} - -fn main() -> eyre::Result<()> { +#[tokio::main] +async fn main() -> eyre::Result<()> { let cli = Cli::parse(); match &cli.command { Commands::Check { @@ -90,8 +89,8 @@ fn main() -> eyre::Result<()> { }); check::run_checks(disabled) } - Commands::Deploy { .. } => { - todo!(); + Commands::Deploy(deploy_config) => { + deploy::deploy_and_compile_onchain(deploy_config).await } } } From 1dc022385fbafca02e452ade1e776fede6df7563 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 17:31:52 -0400 Subject: [PATCH 07/58] contracti nit code --- arbitrator/cargo-stylus/src/deploy.rs | 53 ++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index c5c5f4e22..e8e3b7cc6 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -4,11 +4,14 @@ use std::io::Read; use std::path::PathBuf; use std::process::{Command, Stdio}; +use alloy_primitives::U256; use brotli2::read::BrotliEncoder; use bytes::buf::Reader; use bytes::{Buf, Bytes}; -use ethers::types::{Address, H160}; +use ethers::prelude::{ContractDeploymentTx, ContractDeployer, ContractFactory}; +use ethers::types::transaction::eip2718::TypedTransaction; +use ethers::types::{Address, H160, Eip1559TransactionRequest}; use ethers::{ core::{types::TransactionRequest, utils::Anvil}, middleware::SignerMiddleware, @@ -17,6 +20,7 @@ use ethers::{ }; use arbutil::Color; +use eyre::bail; use crate::{constants, DeployConfig}; @@ -74,12 +78,59 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> submit_signed_tx(&cfg.endpoint, wallet).await } +async fn deploy_stylus_program(code: Vec) -> eyre::Result<()> { + Ok(()) +} + +fn contract_init_code(code: &[u8]) -> Vec { + let code_len: [u8; 32] = U256::from(code.len()).to_be_bytes(); + let mut deploy: Vec = vec![]; + deploy.push(0x60); // PUSH32 + deploy.extend(code_len); + deploy.push(0x80); // DUP1 + deploy.push(0x60); // PUSH1 + deploy.push(0x2a); // 42 the prelude length + deploy.push(0x60); // PUSH1 + deploy.push(0x00); + deploy.push(0x39); // CODECOPY + deploy.push(0x60); // PUSH1 + deploy.push(0x00); + deploy.push(0xf3); // RETURN + deploy.extend(code); + deploy +} + async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet) -> eyre::Result<()> { let provider = Provider::::try_from(endpoint)?; let chain_id = provider.get_chainid().await?.as_u64(); let addr = wallet.address(); let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); + let block_num = client.get_block_number().await?; + let block = client.get_block(block_num).await?; + if block.is_none() { + bail!("No latest block found"); + } + // TODO: Check if base fee exists. + let base_fee = block.unwrap().base_fee_per_gas.unwrap(); + + let code = vec![]; + + // Deploy contract init code. + let init_code = contract_init_code(&code); + + let tx = Eip1559TransactionRequest::new() + .from(addr) + .max_fee_per_gas(base_fee) + .data(init_code); + + let estimated = client.estimate_gas(&TypedTransaction::Eip1559(tx), None).await?; + println!("{estimated} estimated gas"); + + // Get base fee, estimate gas. + // Create a new contract creation tx. + // Send the tx and create address from to and nonce. + let tx = prepare_tx(addr, Bytes::default()); let pending_tx = client.send_transaction(tx, None).await?; From 405f468040beaeb8004dc094d79d8688463e586d Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 21 Jul 2023 17:47:27 -0400 Subject: [PATCH 08/58] submit deployment tx --- arbitrator/cargo-stylus/src/deploy.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index e8e3b7cc6..ae3e45757 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -56,6 +56,10 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> compressor.read_to_end(&mut compressed_bytes).unwrap(); // TODO: Add the compression and compilation checks in here. Reuse functions from check. + println!( + "Compressed WASM size: {} bytes", + compressed_bytes.len().to_string().yellow() + ); // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data @@ -75,11 +79,7 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> keystore_pass, ).expect("Could not decrypt keystore") }; - submit_signed_tx(&cfg.endpoint, wallet).await -} - -async fn deploy_stylus_program(code: Vec) -> eyre::Result<()> { - Ok(()) + submit_signed_tx(&cfg.endpoint, wallet, &compressed_bytes).await } fn contract_init_code(code: &[u8]) -> Vec { @@ -100,7 +100,7 @@ fn contract_init_code(code: &[u8]) -> Vec { deploy } -async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet) -> eyre::Result<()> { +async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { let provider = Provider::::try_from(endpoint)?; let chain_id = provider.get_chainid().await?.as_u64(); let addr = wallet.address(); @@ -114,8 +114,6 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet) -> eyre::Result<( // TODO: Check if base fee exists. let base_fee = block.unwrap().base_fee_per_gas.unwrap(); - let code = vec![]; - // Deploy contract init code. let init_code = contract_init_code(&code); From d9c0c4511f04dfa66ddd48383028037aefe0d2d0 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Sat, 22 Jul 2023 00:24:38 -0400 Subject: [PATCH 09/58] add in consts --- arbitrator/cargo-stylus/src/constants.rs | 1 + arbitrator/cargo-stylus/src/deploy.rs | 27 ++++++++++----------- system_tests/program_test.go | 30 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 36e1d5ddf..81b654702 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -1,3 +1,4 @@ /// EOF prefix used in Stylus compressed WASMs on-chain pub const EOF_PREFIX: &'static str = "EF000000"; pub const BROTLI_COMPRESSION_LEVEL: u32 = 9; +pub const ARB_WASM_ADDRESS: &'static str = ""; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index ae3e45757..9ebcabe89 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -9,9 +9,10 @@ use brotli2::read::BrotliEncoder; use bytes::buf::Reader; use bytes::{Buf, Bytes}; -use ethers::prelude::{ContractDeploymentTx, ContractDeployer, ContractFactory}; +use ethers::prelude::{ContractDeploymentTx, ContractDeployer, ContractFactory, MiddlewareBuilder}; use ethers::types::transaction::eip2718::TypedTransaction; use ethers::types::{Address, H160, Eip1559TransactionRequest}; +use ethers::utils::get_contract_address; use ethers::{ core::{types::TransactionRequest, utils::Anvil}, middleware::SignerMiddleware, @@ -60,6 +61,8 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> "Compressed WASM size: {} bytes", compressed_bytes.len().to_string().yellow() ); + let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); + code.extend(compressed_bytes); // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data @@ -79,7 +82,7 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> keystore_pass, ).expect("Could not decrypt keystore") }; - submit_signed_tx(&cfg.endpoint, wallet, &compressed_bytes).await + submit_signed_tx(&cfg.endpoint, wallet, &code).await } fn contract_init_code(code: &[u8]) -> Vec { @@ -106,6 +109,7 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e let addr = wallet.address(); let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); + let nonce = client.get_transaction_count(addr, None).await?; let block_num = client.get_block_number().await?; let block = client.get_block(block_num).await?; if block.is_none() { @@ -119,36 +123,29 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e let tx = Eip1559TransactionRequest::new() .from(addr) + .to(constants::ARB_WASM_ADDRESS.parse::
().unwrap()) .max_fee_per_gas(base_fee) .data(init_code); + let tx = TypedTransaction::Eip1559(tx); - let estimated = client.estimate_gas(&TypedTransaction::Eip1559(tx), None).await?; + let estimated = client.estimate_gas(&tx, None).await?; println!("{estimated} estimated gas"); // Get base fee, estimate gas. // Create a new contract creation tx. // Send the tx and create address from to and nonce. + let contract_addr = get_contract_address(addr, nonce); - let tx = prepare_tx(addr, Bytes::default()); let pending_tx = client.send_transaction(tx, None).await?; let receipt = pending_tx .await? - .ok_or_else(|| eyre::format_err!("tx dropped from mempool"))?; + .ok_or_else(|| eyre::format_err!("Tx dropped from mempool"))?; let tx = client.get_transaction(receipt.transaction_hash).await?; println!("Sent tx: {}\n", serde_json::to_string(&tx)?); println!("Tx receipt: {}", serde_json::to_string(&receipt)?); - Ok(()) -} - -fn prepare_tx(address: H160, data: Bytes) -> TransactionRequest { - TransactionRequest::new() - .to(address) - .data(data) -} - -fn prepare_compilation_tx() -> eyre::Result<()> { + println!("Created contract {contract_addr}"); Ok(()) } diff --git a/system_tests/program_test.go b/system_tests/program_test.go index d53e03889..744f99705 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -550,6 +550,35 @@ func testEvmData(t *testing.T, jit bool) { validateBlocks(t, 1, jit, ctx, node, l2client) } +func TestStylusCargoPlugin(t *testing.T) { + t.Parallel() + ctx, node, l2info, l2client, auth, memoryAddr, cleanup := setupProgramTest(t, watFile("memory"), true) + _ = node + _ = l2info + _ = memoryAddr + defer cleanup() + + // multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) + // _ = multiAddr + + ensure := func(tx *types.Transaction, err error) *types.Receipt { + t.Helper() + Require(t, err) + receipt, err := EnsureTxSucceeded(ctx, l2client, tx) + Require(t, err) + return receipt + } + + arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) + Require(t, err) + ensure(arbOwner.SetWasmHostioInk(&auth, 0)) + ensure(arbOwner.SetInkPrice(&auth, 1e4)) + ensure(arbOwner.SetMaxTxGasLimit(&auth, 34000000)) + + colors.PrintMint(fmt.Sprintf("arbwasm addr=%#x", types.ArbWasmAddress)) + time.Sleep(time.Hour) +} + func TestProgramMemory(t *testing.T) { t.Parallel() testMemory(t, true) @@ -680,6 +709,7 @@ func setupProgramTest(t *testing.T, file string, jit bool) ( } auth := l2info.GetDefaultTransactOpts("Owner", ctx) + fmt.Printf("Owner priv key %#x", l2info.Accounts["Owner"].PrivateKey.D.Bytes()) arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) Require(t, err) From cea4d90f6459e42ff89c9ab5b07adfbfefd672a4 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Sun, 23 Jul 2023 11:52:01 -0500 Subject: [PATCH 10/58] add in deployment --- arbitrator/Cargo.lock | 156 +--------------------- arbitrator/cargo-stylus/Cargo.toml | 1 - arbitrator/cargo-stylus/src/constants.rs | 4 +- arbitrator/cargo-stylus/src/deploy.rs | 41 +++--- arbitrator/stylus/tests/echo/privkey | 1 + arbitrator/stylus/tests/multicall/privkey | 1 + system_tests/common_test.go | 2 + system_tests/program_test.go | 66 +++++++-- 8 files changed, 89 insertions(+), 183 deletions(-) create mode 100644 arbitrator/stylus/tests/echo/privkey create mode 100644 arbitrator/stylus/tests/multicall/privkey diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index e6703347b..b7c23e31c 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -64,34 +64,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" -[[package]] -name = "alloy-primitives" -version = "0.2.0" -source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" -dependencies = [ - "alloy-rlp", - "bytes", - "cfg-if", - "const-hex", - "derive_more", - "hex-literal", - "itoa", - "proptest", - "ruint2", - "serde", - "tiny-keccak", -] - -[[package]] -name = "alloy-rlp" -version = "0.2.0" -source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" -dependencies = [ - "arrayvec", - "bytes", - "smol_str", -] - [[package]] name = "android-tzdata" version = "0.1.1" @@ -495,7 +467,6 @@ dependencies = [ name = "cargo-stylus" version = "0.1.0" dependencies = [ - "alloy-primitives", "arbutil", "brotli2", "bytes", @@ -710,18 +681,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "const-hex" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268f52aae268980d03dd9544c1ea591965b2735b038d6998d6e4ab37c8c24445" -dependencies = [ - "cfg-if", - "cpufeatures", - "hex", - "serde", -] - [[package]] name = "const-oid" version = "0.9.4" @@ -734,12 +693,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - [[package]] name = "corosensei" version = "0.1.3" @@ -988,10 +941,8 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", "proc-macro2", "quote", - "rustc_version", "syn 1.0.109", ] @@ -1919,12 +1870,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - [[package]] name = "hmac" version = "0.12.1" @@ -2261,7 +2206,7 @@ dependencies = [ "lalrpop-util", "petgraph", "regex", - "regex-syntax 0.7.4", + "regex-syntax", "string_cache", "term", "tiny-keccak", @@ -3041,26 +2986,6 @@ dependencies = [ "quote", ] -[[package]] -name = "proptest" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0d9cc07f18492d879586c92b485def06bc850da3118075cd45d50e9c95b0e5" -dependencies = [ - "bit-set", - "bitflags 1.3.2", - "byteorder", - "lazy_static", - "num-traits", - "quick-error 2.0.1", - "rand", - "rand_chacha", - "rand_xorshift", - "regex-syntax 0.6.27", - "rusty-fork", - "tempfile", -] - [[package]] name = "prover" version = "0.1.0" @@ -3116,18 +3041,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quote" version = "1.0.28" @@ -3188,15 +3101,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core", -] - [[package]] name = "rayon" version = "1.7.0" @@ -3269,7 +3173,7 @@ dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.7.4", + "regex-syntax", ] [[package]] @@ -3280,15 +3184,9 @@ checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" - [[package]] name = "regex-syntax" version = "0.7.4" @@ -3437,24 +3335,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ruint2" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b066b8e4fcea7fae86b6932d2449670b6b5545b7e8407841b2d3a916ff2a9f86" -dependencies = [ - "derive_more", - "ruint2-macro", - "rustc_version", - "thiserror", -] - -[[package]] -name = "ruint2-macro" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89dc553bc0cf4512a8b96caa2e21ed5f6e4b66bf28a1bd08fd9eb07c0b39b28c" - [[package]] name = "rustc-demangle" version = "0.1.21" @@ -3562,18 +3442,6 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" -[[package]] -name = "rusty-fork" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" -dependencies = [ - "fnv", - "quick-error 1.2.3", - "tempfile", - "wait-timeout", -] - [[package]] name = "ryu" version = "1.0.5" @@ -3907,15 +3775,6 @@ dependencies = [ "serde", ] -[[package]] -name = "smol_str" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" -dependencies = [ - "serde", -] - [[package]] name = "socket2" version = "0.4.9" @@ -4519,15 +4378,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - [[package]] name = "walkdir" version = "2.3.3" diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index 732b2c75d..1ca4a0c30 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -15,7 +15,6 @@ serde = { version = "1.0.174", features = ["derive"] } stylus = { path = "../stylus/" } arbutil = { path = "../arbutil/" } prover = { path = "../prover/", default-features = false, features = ["native"] } -alloy-primitives = { git = "https://github.com/rachel-bousfield/alloy-core.git", branch = "native-keccak" } bytesize = "1.2.0" ethers = "2.0.8" serde_json = "1.0.103" diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 81b654702..9f14d5b54 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -1,4 +1,4 @@ /// EOF prefix used in Stylus compressed WASMs on-chain pub const EOF_PREFIX: &'static str = "EF000000"; -pub const BROTLI_COMPRESSION_LEVEL: u32 = 9; -pub const ARB_WASM_ADDRESS: &'static str = ""; +pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; +pub const ARB_WASM_ADDRESS: &'static str = "0000000000000000000000000000000000000071"; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 9ebcabe89..ee0810914 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -3,15 +3,16 @@ use std::env::current_dir; use std::io::Read; use std::path::PathBuf; use std::process::{Command, Stdio}; +use std::str::FromStr; -use alloy_primitives::U256; use brotli2::read::BrotliEncoder; use bytes::buf::Reader; use bytes::{Buf, Bytes}; -use ethers::prelude::{ContractDeploymentTx, ContractDeployer, ContractFactory, MiddlewareBuilder}; +use ethers::abi::Address; +use ethers::prelude::{U256, ContractDeploymentTx, ContractDeployer, ContractFactory, MiddlewareBuilder}; use ethers::types::transaction::eip2718::TypedTransaction; -use ethers::types::{Address, H160, Eip1559TransactionRequest}; +use ethers::types::{H160, Eip1559TransactionRequest}; use ethers::utils::get_contract_address; use ethers::{ core::{types::TransactionRequest, utils::Anvil}, @@ -43,12 +44,13 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> .join("target") .join("wasm32-unknown-unknown") .join("release") - .join(format!("{}.wasm", "echo")); + .join(format!("{}.wasm", "multicall")); println!("Reading compiled WASM at {}", wasm_path.display().yellow()); let wasm_file_bytes = std::fs::read(&wasm_path).expect("Could not read WASM file at target path"); + println!("Reading file {:?}, length in bytes {}", wasm_path.as_os_str(), wasm_file_bytes.len()); let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); @@ -63,15 +65,17 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> ); let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); code.extend(compressed_bytes); + println!( + "Compressed WASM with prefix len: {}", + code.len(), + ); // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data // tx to send to a multicall.rs rust program. let wallet = if let Some(priv_key_path) = &cfg.wallet.private_key_path { - let priv_key_bytes = bytes::Bytes::from( - std::fs::read(priv_key_path).expect("Could not read private key file"), - ); - LocalWallet::from_bytes(&priv_key_bytes).expect("Could not initialize wallet from priv key bytes") + let privkey = std::fs::read_to_string(priv_key_path).expect("Could not read private key file"); + LocalWallet::from_str(privkey.as_str()).expect("Could not parse privkey") } else { let wallet = cfg.wallet.clone(); let keystore_password_path = wallet.keystore_password_path.expect("No keystore password file provided"); @@ -86,9 +90,10 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> } fn contract_init_code(code: &[u8]) -> Vec { - let code_len: [u8; 32] = U256::from(code.len()).to_be_bytes(); + let mut code_len = [0u8; 32]; + U256::from(code.len()).to_big_endian(&mut code_len); let mut deploy: Vec = vec![]; - deploy.push(0x60); // PUSH32 + deploy.push(0x7f); // PUSH32 deploy.extend(code_len); deploy.push(0x80); // DUP1 deploy.push(0x60); // PUSH1 @@ -99,6 +104,11 @@ fn contract_init_code(code: &[u8]) -> Vec { deploy.push(0x60); // PUSH1 deploy.push(0x00); deploy.push(0xf3); // RETURN + let prelude = hex::encode(&deploy); + println!("Got prelude={prelude}"); + let first_few: [u8; 12] = code[..12].try_into().unwrap(); + let first_few = hex::encode(first_few); + println!("First 12 bytes={first_few}"); deploy.extend(code); deploy } @@ -121,21 +131,23 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e // Deploy contract init code. let init_code = contract_init_code(&code); + // let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + // let to = H160::from_slice(&to); let tx = Eip1559TransactionRequest::new() .from(addr) - .to(constants::ARB_WASM_ADDRESS.parse::
().unwrap()) - .max_fee_per_gas(base_fee) + .max_priority_fee_per_gas(base_fee) .data(init_code); let tx = TypedTransaction::Eip1559(tx); - let estimated = client.estimate_gas(&tx, None).await?; - println!("{estimated} estimated gas"); + //let estimated = client.estimate_gas(&tx, None).await?; + //println!("{estimated} estimated gas"); // Get base fee, estimate gas. // Create a new contract creation tx. // Send the tx and create address from to and nonce. let contract_addr = get_contract_address(addr, nonce); + println!("Sending program creation tx"); let pending_tx = client.send_transaction(tx, None).await?; let receipt = pending_tx @@ -144,7 +156,6 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e let tx = client.get_transaction(receipt.transaction_hash).await?; - println!("Sent tx: {}\n", serde_json::to_string(&tx)?); println!("Tx receipt: {}", serde_json::to_string(&receipt)?); println!("Created contract {contract_addr}"); Ok(()) diff --git a/arbitrator/stylus/tests/echo/privkey b/arbitrator/stylus/tests/echo/privkey new file mode 100644 index 000000000..e1c9ccb4b --- /dev/null +++ b/arbitrator/stylus/tests/echo/privkey @@ -0,0 +1 @@ +009f3fd6848015f83b9210c89f7744e3941acae1195c8bf9f5798c090dc8f497 \ No newline at end of file diff --git a/arbitrator/stylus/tests/multicall/privkey b/arbitrator/stylus/tests/multicall/privkey new file mode 100644 index 000000000..e1c9ccb4b --- /dev/null +++ b/arbitrator/stylus/tests/multicall/privkey @@ -0,0 +1 @@ +009f3fd6848015f83b9210c89f7744e3941acae1195c8bf9f5798c090dc8f497 \ No newline at end of file diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 1b83e45b6..1db8d4077 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -918,6 +918,8 @@ func deployContractInitCode(code []byte, revert bool) []byte { deploy = append(deploy, byte(vm.PUSH1)) deploy = append(deploy, 0) deploy = append(deploy, byte(last_opcode)) + fmt.Printf("Deployment logic prelude %#x\n", deploy) + fmt.Printf("First 12 bytes of code %#x\n", code[:12]) deploy = append(deploy, code...) return deploy } diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 744f99705..cf145b8be 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -22,6 +22,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbnode" @@ -552,14 +553,43 @@ func testEvmData(t *testing.T, jit bool) { func TestStylusCargoPlugin(t *testing.T) { t.Parallel() - ctx, node, l2info, l2client, auth, memoryAddr, cleanup := setupProgramTest(t, watFile("memory"), true) - _ = node - _ = l2info - _ = memoryAddr + ctx, cancel := context.WithCancel(context.Background()) + rand.Seed(time.Now().UTC().UnixNano()) + + // TODO: track latest ArbOS version + chainConfig := params.ArbitrumDevTestChainConfig() + chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10 + + l2config := arbnode.ConfigDefaultL1Test() + l2config.BlockValidator.Enable = true + l2config.BatchPoster.Enable = true + l2config.L1Reader.Enable = true + l2config.Sequencer.MaxRevertGasReject = 0 + l2config.L1Reader.OldHeaderTimeout = 10 * time.Minute + AddDefaultValNode(t, ctx, l2config, true /* jit */) + + stackConf := node.DefaultConfig + stackConf.HTTPHost = "localhost" + stackConf.HTTPPort = 9999 + stackConf.HTTPModules = append(stackConf.HTTPModules, "eth") + stackConf.P2P.NoDiscovery = true + stackConf.P2P.ListenAddr = "" + l2info, node, l2client, _, _, _, l1stack := createTestNodeOnL1WithConfig(t, ctx, true, l2config, chainConfig, &stackConf) + + cleanup := func() { + requireClose(t, l1stack) + node.StopAndWait() + cancel() + } defer cleanup() - // multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) - // _ = multiAddr + auth := l2info.GetDefaultTransactOpts("Owner", ctx) + fmt.Printf("Owner %x", crypto.FromECDSA(l2info.Accounts["Owner"].PrivateKey)) + + arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) + Require(t, err) + arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, l2client) + Require(t, err) ensure := func(tx *types.Transaction, err error) *types.Receipt { t.Helper() @@ -569,13 +599,21 @@ func TestStylusCargoPlugin(t *testing.T) { return receipt } - arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) - Require(t, err) - ensure(arbOwner.SetWasmHostioInk(&auth, 0)) - ensure(arbOwner.SetInkPrice(&auth, 1e4)) - ensure(arbOwner.SetMaxTxGasLimit(&auth, 34000000)) + // Set random pricing params. Note that the ink price is measured in bips, + // so an ink price of 10k means that 1 evm gas buys exactly 1 ink. + // We choose a range on both sides of this value. + inkPrice := testhelpers.RandomUint64(0, 20000) // evm to ink + wasmHostioInk := testhelpers.RandomUint64(0, 5000) // amount of ink + colors.PrintMint(fmt.Sprintf("ink price=%d, HostIO ink=%d", inkPrice, wasmHostioInk)) + + ensure(arbDebug.BecomeChainOwner(&auth)) + ensure(arbOwner.SetInkPrice(&auth, inkPrice)) + ensure(arbOwner.SetWasmHostioInk(&auth, wasmHostioInk)) - colors.PrintMint(fmt.Sprintf("arbwasm addr=%#x", types.ArbWasmAddress)) + colors.PrintMint(fmt.Sprintf("arbwasm addr is=%#x", types.ArbWasmAddress)) + + multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) + t.Logf("Multicall addr %#x", multiAddr) time.Sleep(time.Hour) } @@ -745,6 +783,7 @@ func readWasmFile(t *testing.T, file string) []byte { wasmSource, err := wasmer.Wat2Wasm(string(source)) Require(t, err) + colors.PrintMint(fmt.Sprintf("WASM source len %d, and file name %s", len(wasmSource), file)) wasm, err := arbcompress.CompressWell(wasmSource) Require(t, err) @@ -759,6 +798,7 @@ func deployWasm( t *testing.T, ctx context.Context, auth bind.TransactOpts, l2client *ethclient.Client, file string, ) common.Address { wasm := readWasmFile(t, file) + colors.PrintMint("Compressed wasm code length", len(wasm)) programAddress := deployContract(t, ctx, auth, l2client, wasm) colors.PrintBlue("program deployed to ", programAddress.Hex()) return compileWasm(t, ctx, auth, l2client, programAddress) @@ -772,8 +812,10 @@ func compileWasm( Require(t, err) timed(t, "compile", func() { + fmt.Println("Getting to compile the code...") tx, err := arbWasm.CompileProgram(&auth, program) Require(t, err) + fmt.Printf("Compile tx data %#x", tx.Data()) _, err = EnsureTxSucceeded(ctx, l2client, tx) Require(t, err) }) From e9285dc90c3c874ce212ef2db46276de09f9f63b Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Sun, 23 Jul 2023 18:07:38 -0500 Subject: [PATCH 11/58] do compile --- arbitrator/cargo-stylus/src/deploy.rs | 33 +++++++++++++++++++++++++++ system_tests/program_test.go | 3 ++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index ee0810914..0568e89cc 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -158,5 +158,38 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e println!("Tx receipt: {}", serde_json::to_string(&receipt)?); println!("Created contract {contract_addr}"); + + let nonce = client.get_transaction_count(addr, None).await?; + let block_num = client.get_block_number().await?; + let block = client.get_block(block_num).await?; + if block.is_none() { + bail!("No latest block found"); + } + // TODO: Check if base fee exists. + let base_fee = block.unwrap().base_fee_per_gas.unwrap(); + + let mut compile_calldata = [0u8; 32]; + let compile_method_hash = hex::decode("2e50f32b").unwrap(); + compile_calldata[0..4].copy_from_slice(&compile_method_hash); + compile_calldata[12..].copy_from_slice(contract_addr.as_bytes()); + println!("Got compile calldata {}", hex::encode(&compile_calldata)); + + let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + let to = H160::from_slice(&to); + let tx = Eip1559TransactionRequest::new() + .from(addr) + .to(to) + .max_priority_fee_per_gas(base_fee) + .data(compile_calldata); + let tx = TypedTransaction::Eip1559(tx); + + println!("Sending compile tx"); + let pending_tx = client.send_transaction(tx, None).await?; + + let receipt = pending_tx + .await? + .ok_or_else(|| eyre::format_err!("Tx dropped from mempool"))?; + + println!("Tx receipt: {}", serde_json::to_string(&receipt)?); Ok(()) } diff --git a/system_tests/program_test.go b/system_tests/program_test.go index cf145b8be..9f909d670 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -801,7 +801,8 @@ func deployWasm( colors.PrintMint("Compressed wasm code length", len(wasm)) programAddress := deployContract(t, ctx, auth, l2client, wasm) colors.PrintBlue("program deployed to ", programAddress.Hex()) - return compileWasm(t, ctx, auth, l2client, programAddress) + //return compileWasm(t, ctx, auth, l2client, programAddress) + return programAddress } func compileWasm( From 210226d99f6cec543ca8279d1e54add3e1a23fed Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Sun, 23 Jul 2023 18:32:04 -0500 Subject: [PATCH 12/58] compile tx working --- arbitrator/cargo-stylus/src/deploy.rs | 9 +++++---- system_tests/program_test.go | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 0568e89cc..6a614fe71 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -168,10 +168,11 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e // TODO: Check if base fee exists. let base_fee = block.unwrap().base_fee_per_gas.unwrap(); - let mut compile_calldata = [0u8; 32]; + let mut compile_calldata = vec![]; let compile_method_hash = hex::decode("2e50f32b").unwrap(); - compile_calldata[0..4].copy_from_slice(&compile_method_hash); - compile_calldata[12..].copy_from_slice(contract_addr.as_bytes()); + compile_calldata.extend(compile_method_hash); + compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + compile_calldata.extend(contract_addr.as_bytes()); println!("Got compile calldata {}", hex::encode(&compile_calldata)); let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); @@ -192,4 +193,4 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e println!("Tx receipt: {}", serde_json::to_string(&receipt)?); Ok(()) -} +} \ No newline at end of file diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 9f909d670..601c11680 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -801,8 +801,8 @@ func deployWasm( colors.PrintMint("Compressed wasm code length", len(wasm)) programAddress := deployContract(t, ctx, auth, l2client, wasm) colors.PrintBlue("program deployed to ", programAddress.Hex()) - //return compileWasm(t, ctx, auth, l2client, programAddress) - return programAddress + return compileWasm(t, ctx, auth, l2client, programAddress) + //return programAddress } func compileWasm( From 3269fe02bf7faf23b525dd4821beca7e3ac67fa0 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Sun, 23 Jul 2023 21:47:02 -0500 Subject: [PATCH 13/58] fmt include multicall addr submit --- arbitrator/cargo-stylus/src/deploy.rs | 100 ++++++++++++++++++++++---- arbitrator/cargo-stylus/src/main.rs | 8 +-- 2 files changed, 88 insertions(+), 20 deletions(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 6a614fe71..99e444c8a 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -10,9 +10,11 @@ use bytes::buf::Reader; use bytes::{Buf, Bytes}; use ethers::abi::Address; -use ethers::prelude::{U256, ContractDeploymentTx, ContractDeployer, ContractFactory, MiddlewareBuilder}; +use ethers::prelude::{ + ContractDeployer, ContractDeploymentTx, ContractFactory, MiddlewareBuilder, U256, +}; use ethers::types::transaction::eip2718::TypedTransaction; -use ethers::types::{H160, Eip1559TransactionRequest}; +use ethers::types::{Eip1559TransactionRequest, H160}; use ethers::utils::get_contract_address; use ethers::{ core::{types::TransactionRequest, utils::Anvil}, @@ -50,7 +52,11 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> let wasm_file_bytes = std::fs::read(&wasm_path).expect("Could not read WASM file at target path"); - println!("Reading file {:?}, length in bytes {}", wasm_path.as_os_str(), wasm_file_bytes.len()); + println!( + "Reading file {:?}, length in bytes {}", + wasm_path.as_os_str(), + wasm_file_bytes.len() + ); let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); @@ -65,26 +71,25 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> ); let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); code.extend(compressed_bytes); - println!( - "Compressed WASM with prefix len: {}", - code.len(), - ); + println!("Compressed WASM with prefix len: {}", code.len(),); // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data // tx to send to a multicall.rs rust program. let wallet = if let Some(priv_key_path) = &cfg.wallet.private_key_path { - let privkey = std::fs::read_to_string(priv_key_path).expect("Could not read private key file"); + let privkey = + std::fs::read_to_string(priv_key_path).expect("Could not read private key file"); LocalWallet::from_str(privkey.as_str()).expect("Could not parse privkey") } else { let wallet = cfg.wallet.clone(); - let keystore_password_path = wallet.keystore_password_path.expect("No keystore password file provided"); + let keystore_password_path = wallet + .keystore_password_path + .expect("No keystore password file provided"); let keystore_path = wallet.keystore_path.expect("No keystore path provided"); - let keystore_pass = std::fs::read_to_string(keystore_password_path).expect("Could not keystore password file"); - LocalWallet::decrypt_keystore( - keystore_path, - keystore_pass, - ).expect("Could not decrypt keystore") + let keystore_pass = std::fs::read_to_string(keystore_password_path) + .expect("Could not keystore password file"); + LocalWallet::decrypt_keystore(keystore_path, keystore_pass) + .expect("Could not decrypt keystore") }; submit_signed_tx(&cfg.endpoint, wallet, &code).await } @@ -113,6 +118,71 @@ fn contract_init_code(code: &[u8]) -> Vec { deploy } +fn prepare_deploy_compile_multicall(compressed_wasm: &[u8], expected_address: &H160) -> Vec { + let code = contract_init_code(compressed_wasm); + let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); + let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + let mut compile_calldata = vec![]; + let compile_method_hash = hex::decode("2e50f32b").unwrap(); + compile_calldata.extend(compile_method_hash); + compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + compile_calldata.extend(expected_address.as_bytes()); + multicall_append( + &mut multicall_args, + MulticallArg::Call, + H160::from_slice(&arbwasm_address), + compile_calldata, + ); + multicall_args +} + +#[derive(Clone)] +enum MulticallArg { + Call, + DelegateCall, + StaticCall, +} + +impl From for u8 { + fn from(value: MulticallArg) -> Self { + match value { + MulticallArg::Call => 0x00, + MulticallArg::DelegateCall => 0x01, + MulticallArg::StaticCall => 0x02, + } + } +} + +fn args_for_multicall( + opcode: MulticallArg, + address: H160, + value: Option, + calldata: Vec, +) -> Vec { + let mut args = vec![0x01]; + let mut length: u32 = 21 + calldata.len() as u32; + if matches!(opcode, MulticallArg::Call) { + length += 32; + } + args.extend(length.to_be_bytes()); + args.push(opcode.clone().into()); + + if matches!(opcode, MulticallArg::Call) { + let mut val = [0u8; 32]; + value.unwrap_or(U256::zero()).to_big_endian(&mut val); + args.extend(val); + } + args.extend(address.as_bytes()); + args.extend(calldata); + vec![] +} + +fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, inner: Vec) { + calls[0] += 1; // add another call + let args = args_for_multicall(opcode, address, None, inner); + calls.extend(args[1..].iter().cloned()); +} + async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { let provider = Provider::::try_from(endpoint)?; let chain_id = provider.get_chainid().await?.as_u64(); @@ -193,4 +263,4 @@ async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> e println!("Tx receipt: {}", serde_json::to_string(&receipt)?); Ok(()) -} \ No newline at end of file +} diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 73cc04898..f2f830174 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,4 +1,4 @@ -use clap::{Parser, Subcommand, Args, ValueEnum}; +use clap::{Args, Parser, Subcommand, ValueEnum}; mod check; mod constants; @@ -56,7 +56,7 @@ pub struct DeployConfig { /// Wallet source to use with the cargo stylus plugin. #[command(flatten)] wallet: WalletSource, -} +} #[derive(Debug, Clone, ValueEnum)] pub enum DeployMode { @@ -89,8 +89,6 @@ async fn main() -> eyre::Result<()> { }); check::run_checks(disabled) } - Commands::Deploy(deploy_config) => { - deploy::deploy_and_compile_onchain(deploy_config).await - } + Commands::Deploy(deploy_config) => deploy::deploy_and_compile_onchain(deploy_config).await, } } From 9e1f3198acb7a1b38b7c37f5c5790f3ae98e3781 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Sun, 23 Jul 2023 21:52:12 -0500 Subject: [PATCH 14/58] fmt include multicall addr submit --- arbitrator/cargo-stylus/src/constants.rs | 1 + arbitrator/cargo-stylus/src/deploy.rs | 43 +++++++++++++++++++++++- system_tests/program_test.go | 1 - 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 9f14d5b54..1203a0a48 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -2,3 +2,4 @@ pub const EOF_PREFIX: &'static str = "EF000000"; pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; pub const ARB_WASM_ADDRESS: &'static str = "0000000000000000000000000000000000000071"; +pub const MULTICALL_ADDR: &'static str = "0000000000000000000000000000000000000071"; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 99e444c8a..8354e43e0 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -91,7 +91,7 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> LocalWallet::decrypt_keystore(keystore_path, keystore_pass) .expect("Could not decrypt keystore") }; - submit_signed_tx(&cfg.endpoint, wallet, &code).await + submit_multicall(&cfg.endpoint, wallet, &code).await } fn contract_init_code(code: &[u8]) -> Vec { @@ -183,6 +183,47 @@ fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, in calls.extend(args[1..].iter().cloned()); } +async fn submit_multicall(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { + let provider = Provider::::try_from(endpoint)?; + let chain_id = provider.get_chainid().await?.as_u64(); + let addr = wallet.address(); + let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); + + let nonce = client.get_transaction_count(addr, None).await?; + let block_num = client.get_block_number().await?; + let block = client.get_block(block_num).await?; + if block.is_none() { + bail!("No latest block found"); + } + // TODO: Check if base fee exists. + let base_fee = block.unwrap().base_fee_per_gas.unwrap(); + let contract_addr = get_contract_address(addr, nonce); + let multicall_data = prepare_deploy_compile_multicall(&code, &contract_addr); + + let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); + let tx = Eip1559TransactionRequest::new() + .from(addr) + .to(H160::from_slice(&to)) + .max_priority_fee_per_gas(base_fee) + .data(multicall_data); + let tx = TypedTransaction::Eip1559(tx); + + //let estimated = client.estimate_gas(&tx, None).await?; + //println!("{estimated} estimated gas"); + println!("Sending program creation + compilation tx"); + let pending_tx = client.send_transaction(tx, None).await?; + + let receipt = pending_tx + .await? + .ok_or_else(|| eyre::format_err!("Tx dropped from mempool"))?; + + let tx = client.get_transaction(receipt.transaction_hash).await?; + + println!("Tx receipt: {}", serde_json::to_string(&receipt)?); + println!("Deployed and compiled program onchain at once {contract_addr}"); + Ok(()) +} + async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { let provider = Provider::::try_from(endpoint)?; let chain_id = provider.get_chainid().await?.as_u64(); diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 601c11680..cf145b8be 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -802,7 +802,6 @@ func deployWasm( programAddress := deployContract(t, ctx, auth, l2client, wasm) colors.PrintBlue("program deployed to ", programAddress.Hex()) return compileWasm(t, ctx, auth, l2client, programAddress) - //return programAddress } func compileWasm( From bbea06aad6f0806c57259a5fc15e398b747855ff Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Mon, 24 Jul 2023 09:20:23 -0500 Subject: [PATCH 15/58] args for multicall append --- arbitrator/cargo-stylus/src/constants.rs | 2 +- arbitrator/cargo-stylus/src/deploy.rs | 29 ++++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 1203a0a48..4db0d472a 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -2,4 +2,4 @@ pub const EOF_PREFIX: &'static str = "EF000000"; pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; pub const ARB_WASM_ADDRESS: &'static str = "0000000000000000000000000000000000000071"; -pub const MULTICALL_ADDR: &'static str = "0000000000000000000000000000000000000071"; +pub const MULTICALL_ADDR: &'static str = "Eba70C09bA17508c75227cCACf376975490172c3"; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 8354e43e0..a3973c316 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -46,7 +46,7 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> .join("target") .join("wasm32-unknown-unknown") .join("release") - .join(format!("{}.wasm", "multicall")); + .join(format!("{}.wasm", "echo")); println!("Reading compiled WASM at {}", wasm_path.display().yellow()); @@ -121,18 +121,18 @@ fn contract_init_code(code: &[u8]) -> Vec { fn prepare_deploy_compile_multicall(compressed_wasm: &[u8], expected_address: &H160) -> Vec { let code = contract_init_code(compressed_wasm); let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); - let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - let mut compile_calldata = vec![]; - let compile_method_hash = hex::decode("2e50f32b").unwrap(); - compile_calldata.extend(compile_method_hash); - compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - compile_calldata.extend(expected_address.as_bytes()); - multicall_append( - &mut multicall_args, - MulticallArg::Call, - H160::from_slice(&arbwasm_address), - compile_calldata, - ); + // let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + // let mut compile_calldata = vec![]; + // let compile_method_hash = hex::decode("2e50f32b").unwrap(); + // compile_calldata.extend(compile_method_hash); + // compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + // compile_calldata.extend(expected_address.as_bytes()); + // multicall_append( + // &mut multicall_args, + // MulticallArg::Call, + // H160::from_slice(&arbwasm_address), + // compile_calldata, + // ); multicall_args } @@ -174,7 +174,8 @@ fn args_for_multicall( } args.extend(address.as_bytes()); args.extend(calldata); - vec![] + println!("Got args as {}", hex::encode(&args)); + args } fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, inner: Vec) { From 6776f30f8bdb545e4f047b27df06a59875bb8441 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 10:36:53 -0500 Subject: [PATCH 16/58] split up mods --- arbitrator/cargo-stylus/src/deploy.rs | 67 ++++-------------------- arbitrator/cargo-stylus/src/main.rs | 2 + arbitrator/cargo-stylus/src/multicall.rs | 49 +++++++++++++++++ arbitrator/cargo-stylus/src/tx.rs | 0 4 files changed, 61 insertions(+), 57 deletions(-) create mode 100644 arbitrator/cargo-stylus/src/multicall.rs create mode 100644 arbitrator/cargo-stylus/src/tx.rs diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index a3973c316..26c99a3b3 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -28,9 +28,8 @@ use eyre::bail; use crate::{constants, DeployConfig}; -pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> { +fn build_project() -> eyre::Result { let cwd: PathBuf = current_dir().unwrap(); - // TODO: Configure debug or release via flags. // TODO: Capture errors from this command. Command::new("cargo") @@ -41,13 +40,16 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> .arg("--target=wasm32-unknown-unknown") .output() .expect("Failed to execute cargo build"); - let wasm_path = cwd .join("target") .join("wasm32-unknown-unknown") .join("release") .join(format!("{}.wasm", "echo")); + Ok(wasm_path) +} +fn read_compressed_wasm() -> eyre::Result, ()> { + let wasm_path = build_project().expect("Could not build project"); println!("Reading compiled WASM at {}", wasm_path.display().yellow()); let wasm_file_bytes = @@ -71,11 +73,10 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> ); let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); code.extend(compressed_bytes); - println!("Compressed WASM with prefix len: {}", code.len(),); + Ok(code) +} - // Next, we prepend with the EOF bytes and prepare a compilation tx onchain. Uses ethers - // to prepare the tx and send it over onchain to an endpoint. Will prepare a multicall data - // tx to send to a multicall.rs rust program. +fn load_wallet() -> Result { let wallet = if let Some(priv_key_path) = &cfg.wallet.private_key_path { let privkey = std::fs::read_to_string(priv_key_path).expect("Could not read private key file"); @@ -91,10 +92,10 @@ pub async fn deploy_and_compile_onchain(cfg: &DeployConfig) -> eyre::Result<()> LocalWallet::decrypt_keystore(keystore_path, keystore_pass) .expect("Could not decrypt keystore") }; - submit_multicall(&cfg.endpoint, wallet, &code).await + Ok(wallet) } -fn contract_init_code(code: &[u8]) -> Vec { +fn program_deployment_calldata(code: &[u8]) -> Vec { let mut code_len = [0u8; 32]; U256::from(code.len()).to_big_endian(&mut code_len); let mut deploy: Vec = vec![]; @@ -136,54 +137,6 @@ fn prepare_deploy_compile_multicall(compressed_wasm: &[u8], expected_address: &H multicall_args } -#[derive(Clone)] -enum MulticallArg { - Call, - DelegateCall, - StaticCall, -} - -impl From for u8 { - fn from(value: MulticallArg) -> Self { - match value { - MulticallArg::Call => 0x00, - MulticallArg::DelegateCall => 0x01, - MulticallArg::StaticCall => 0x02, - } - } -} - -fn args_for_multicall( - opcode: MulticallArg, - address: H160, - value: Option, - calldata: Vec, -) -> Vec { - let mut args = vec![0x01]; - let mut length: u32 = 21 + calldata.len() as u32; - if matches!(opcode, MulticallArg::Call) { - length += 32; - } - args.extend(length.to_be_bytes()); - args.push(opcode.clone().into()); - - if matches!(opcode, MulticallArg::Call) { - let mut val = [0u8; 32]; - value.unwrap_or(U256::zero()).to_big_endian(&mut val); - args.extend(val); - } - args.extend(address.as_bytes()); - args.extend(calldata); - println!("Got args as {}", hex::encode(&args)); - args -} - -fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, inner: Vec) { - calls[0] += 1; // add another call - let args = args_for_multicall(opcode, address, None, inner); - calls.extend(args[1..].iter().cloned()); -} - async fn submit_multicall(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { let provider = Provider::::try_from(endpoint)?; let chain_id = provider.get_chainid().await?.as_u64(); diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index f2f830174..c53f2c72b 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -3,6 +3,8 @@ use clap::{Args, Parser, Subcommand, ValueEnum}; mod check; mod constants; mod deploy; +mod multicall; +mod tx; #[derive(Parser, Debug)] #[command(name = "stylus")] diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs new file mode 100644 index 000000000..adabaf997 --- /dev/null +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -0,0 +1,49 @@ +use ethers::types::{H160, U256}; + +#[derive(Clone)] +enum MulticallArg { + Call, + DelegateCall, + StaticCall, +} + +impl From for u8 { + fn from(value: MulticallArg) -> Self { + match value { + MulticallArg::Call => 0x00, + MulticallArg::DelegateCall => 0x01, + MulticallArg::StaticCall => 0x02, + } + } +} + +fn args_for_multicall( + opcode: MulticallArg, + address: H160, + value: Option, + calldata: Vec, +) -> Vec { + let mut args = vec![0x01]; + let mut length: u32 = 21 + calldata.len() as u32; + if matches!(opcode, MulticallArg::Call) { + length += 32; + } + args.extend(length.to_be_bytes()); + args.push(opcode.clone().into()); + + if matches!(opcode, MulticallArg::Call) { + let mut val = [0u8; 32]; + value.unwrap_or(U256::zero()).to_big_endian(&mut val); + args.extend(val); + } + args.extend(address.as_bytes()); + args.extend(calldata); + println!("Got args as {}", hex::encode(&args)); + args +} + +fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, inner: Vec) { + calls[0] += 1; // add another call + let args = args_for_multicall(opcode, address, None, inner); + calls.extend(args[1..].iter().cloned()); +} \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs new file mode 100644 index 000000000..e69de29bb From 0f777b464f319a3f926670dff7a6c006f4e8ce22 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 16:05:36 -0500 Subject: [PATCH 17/58] nicer code --- arbitrator/cargo-stylus/src/check.rs | 130 +++-------- arbitrator/cargo-stylus/src/constants.rs | 7 + arbitrator/cargo-stylus/src/deploy.rs | 284 +++++------------------ arbitrator/cargo-stylus/src/main.rs | 7 +- arbitrator/cargo-stylus/src/multicall.rs | 20 +- arbitrator/cargo-stylus/src/project.rs | 71 ++++++ arbitrator/cargo-stylus/src/tx.rs | 79 +++++++ 7 files changed, 271 insertions(+), 327 deletions(-) create mode 100644 arbitrator/cargo-stylus/src/project.rs diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 74a013cbc..83bd1d113 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,19 +1,13 @@ -use std::env::current_dir; -use std::io::Read; -use std::path::PathBuf; -use std::process::{Command, Stdio}; - -use brotli2::read::BrotliEncoder; -use bytes::buf::Reader; -use bytes::Buf; use bytesize::ByteSize; -use eyre::bail; use arbutil::Color; use prover::programs::prelude::*; use crate::constants; +use crate::project; +/// Defines the stylus checks that occur during the compilation of a WASM program +/// into a module. Checks can be disabled during the compilation process for debugging purposes. #[derive(PartialEq)] pub enum StylusCheck { CompressedSize, @@ -21,107 +15,59 @@ pub enum StylusCheck { // compiler middlewares in the compile config store() method. } -impl From<&str> for StylusCheck { - fn from(value: &str) -> Self { +impl TryFrom<&str> for StylusCheck { + type Error = String; + fn try_from(value: &str) -> Result { match value { - "compressed-size" => StylusCheck::CompressedSize, - _ => panic!( - "Invalid Stylus middleware check: {}, allowed middlewares are: foo", - value - ), + "compressed-size" => Ok(StylusCheck::CompressedSize), + _ => Err(format!("invalid Stylus middleware check: {}", value,)), } } } -// TODO: separate out the business logic of cargo compilation, reading the file, etc. -// as it will be reused by the deploy command. -pub fn run_checks(disabled: Option>) -> eyre::Result<()> { - // Compile the Rust program at the current working directory into WASM using - // Cargo and then instrument the WASM code with Stylus. If any of the checks - // are disabled, we avoid runnng it. - let check_compressed_size = disabled - .as_ref() - .map(|d: &Vec| !d.contains(&StylusCheck::CompressedSize)) - .unwrap_or(true); - - let cwd: PathBuf = current_dir().unwrap(); - - // TODO: Configure debug or release via flags. - // TODO: Capture errors from this command. - Command::new("cargo") - .stdout(Stdio::inherit()) - .stderr(Stdio::inherit()) - .arg("build") - .arg("--release") - .arg("--target=wasm32-unknown-unknown") - .output() - .expect("Failed to execute cargo build"); - - let wasm_path = cwd - .join("target") - .join("wasm32-unknown-unknown") - .join("release") - .join(format!("{}.wasm", "echo")); - - println!("Reading compiled WASM at {}", wasm_path.display().yellow()); - - let wasm_file_bytes = - std::fs::read(&wasm_path).expect("Could not read WASM file at target path"); - - let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); - - // TODO: Configure compression level. - let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); - let mut compressed_bytes = vec![]; - compressor.read_to_end(&mut compressed_bytes).unwrap(); - +/// Runs a series of checks on the WASM program to ensure it is valid for compilation +/// and code size before being deployed and compiled onchain. An optional list of checks +/// to disable can be specified. +pub fn run_checks(disabled: Option>) -> eyre::Result<(), String> { + let wasm_file_path = project::build_project_to_wasm()?; + let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!( - "Uncompressed WASM size: {}", + "Compressed WASM size: {}", ByteSize::b(wasm_file_bytes.len() as u64) .to_string() .yellow(), ); - let compressed_size = ByteSize::b(compressed_bytes.len() as u64); + let compressed_size = ByteSize::b(wasm_file_bytes.len() as u64); + let check_compressed_size = disabled + .as_ref() + .map(|d: &Vec| !d.contains(&StylusCheck::CompressedSize)) + .unwrap_or(true); - if check_compressed_size { - // TODO: Configure. - if compressed_size > ByteSize::kb(24) { - bail!( - "Brotli-compressed WASM size {} is bigger than program size limit: {}", - compressed_size.to_string().red(), - ByteSize::kb(24).to_string(), - ); - } else { - println!( - "Brotli-compressed WASM size {} within program size limit: {}", - compressed_size.to_string().mint(), - ByteSize::kb(24).to_string(), - ); - } + if check_compressed_size && compressed_size > constants::MAX_PROGRAM_SIZE { + return Err(format!( + "Brotli-compressed WASM size {} is bigger than program size limit: {}", + compressed_size.to_string().red(), + constants::MAX_PROGRAM_SIZE, + )); } + compile_native_wasm_module(CompileConfig::default(), &wasm_file_bytes)?; + Ok(()) +} - let config = CompileConfig::default(); - let module = match stylus::native::module(&wasm_file_bytes, config) { - Ok(module) => module, - Err(error) => { - bail!("Failed to compile WASM: {:?}", error); - } - }; - +/// Compiles compressed wasm file bytes into a native module using a specified compile config. +pub fn compile_native_wasm_module( + cfg: CompileConfig, + wasm_file_bytes: &[u8], +) -> eyre::Result, String> { + let module = stylus::native::module(&wasm_file_bytes, cfg) + .map_err(|e| format!("could not compile wasm {}", e))?; let success = "Stylus compilation successful!".to_string().mint(); println!("{}", success); + println!( "Compiled WASM module total size: {}", ByteSize::b(module.len() as u64).to_string() ); - Ok(()) -} - -pub fn check_compressed_size() -> eyre::Result<()> { - Ok(()) -} - -pub fn check_compilation() -> eyre::Result<()> { - Ok(()) + Ok(module) } diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 4db0d472a..5f581fa34 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -1,5 +1,12 @@ +use bytesize::ByteSize; + /// EOF prefix used in Stylus compressed WASMs on-chain pub const EOF_PREFIX: &'static str = "EF000000"; +/// Maximum brotli compression level used for Stylus programs. pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; +/// Address of the Arbitrum WASM precompile on L2. pub const ARB_WASM_ADDRESS: &'static str = "0000000000000000000000000000000000000071"; +/// Address a multicall.rs Stylus program on L2. pub const MULTICALL_ADDR: &'static str = "Eba70C09bA17508c75227cCACf376975490172c3"; +/// Maximum allowed size of a program on Arbitrum (and Ethereum). +pub const MAX_PROGRAM_SIZE: ByteSize = ByteSize::kb(24); diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 26c99a3b3..9af8a8444 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1,98 +1,30 @@ -use std::convert::TryFrom; -use std::env::current_dir; -use std::io::Read; -use std::path::PathBuf; -use std::process::{Command, Stdio}; use std::str::FromStr; -use brotli2::read::BrotliEncoder; -use bytes::buf::Reader; -use bytes::{Buf, Bytes}; +use ethers::{signers::LocalWallet, types::U256}; -use ethers::abi::Address; -use ethers::prelude::{ - ContractDeployer, ContractDeploymentTx, ContractFactory, MiddlewareBuilder, U256, -}; -use ethers::types::transaction::eip2718::TypedTransaction; -use ethers::types::{Eip1559TransactionRequest, H160}; -use ethers::utils::get_contract_address; -use ethers::{ - core::{types::TransactionRequest, utils::Anvil}, - middleware::SignerMiddleware, - providers::{Http, Middleware, Provider}, - signers::{LocalWallet, Signer}, -}; +use crate::WalletSource; -use arbutil::Color; -use eyre::bail; - -use crate::{constants, DeployConfig}; - -fn build_project() -> eyre::Result { - let cwd: PathBuf = current_dir().unwrap(); - // TODO: Configure debug or release via flags. - // TODO: Capture errors from this command. - Command::new("cargo") - .stdout(Stdio::inherit()) - .stderr(Stdio::inherit()) - .arg("build") - .arg("--release") - .arg("--target=wasm32-unknown-unknown") - .output() - .expect("Failed to execute cargo build"); - let wasm_path = cwd - .join("target") - .join("wasm32-unknown-unknown") - .join("release") - .join(format!("{}.wasm", "echo")); - Ok(wasm_path) -} - -fn read_compressed_wasm() -> eyre::Result, ()> { - let wasm_path = build_project().expect("Could not build project"); - println!("Reading compiled WASM at {}", wasm_path.display().yellow()); - - let wasm_file_bytes = - std::fs::read(&wasm_path).expect("Could not read WASM file at target path"); - println!( - "Reading file {:?}, length in bytes {}", - wasm_path.as_os_str(), - wasm_file_bytes.len() - ); - - let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); - - let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); - let mut compressed_bytes = vec![]; - compressor.read_to_end(&mut compressed_bytes).unwrap(); - - // TODO: Add the compression and compilation checks in here. Reuse functions from check. - println!( - "Compressed WASM size: {} bytes", - compressed_bytes.len().to_string().yellow() - ); - let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); - code.extend(compressed_bytes); - Ok(code) -} - -fn load_wallet() -> Result { - let wallet = if let Some(priv_key_path) = &cfg.wallet.private_key_path { - let privkey = - std::fs::read_to_string(priv_key_path).expect("Could not read private key file"); - LocalWallet::from_str(privkey.as_str()).expect("Could not parse privkey") - } else { - let wallet = cfg.wallet.clone(); - let keystore_password_path = wallet - .keystore_password_path - .expect("No keystore password file provided"); - let keystore_path = wallet.keystore_path.expect("No keystore path provided"); - let keystore_pass = std::fs::read_to_string(keystore_password_path) - .expect("Could not keystore password file"); - LocalWallet::decrypt_keystore(keystore_path, keystore_pass) - .expect("Could not decrypt keystore") - }; - Ok(wallet) +/// Loads a wallet for signing transactions either from a private key file path. +/// or a keystore along with a keystore password file. +fn load_wallet(cfg: &WalletSource) -> eyre::Result { + if let Some(priv_key_path) = &cfg.private_key_path { + let privkey = std::fs::read_to_string(priv_key_path) + .map_err(|e| format!("Could not read private key file {}", e))?; + return LocalWallet::from_str(privkey.as_str()) + .map_err(|e| format!("Could not parse private key {}", e)); + } + let keystore_password_path = cfg + .keystore_password_path + .as_ref() + .ok_or("No keystore password path provided")?; + let keystore_path = cfg + .keystore_path + .as_ref() + .ok_or("No keystore path provided")?; + let keystore_pass = std::fs::read_to_string(keystore_password_path) + .map_err(|e| format!("Could not keystore password file {}", e))?; + LocalWallet::decrypt_keystore(keystore_path, keystore_pass) + .map_err(|e| format!("Could not decrypt keystore {}", e)) } fn program_deployment_calldata(code: &[u8]) -> Vec { @@ -119,143 +51,33 @@ fn program_deployment_calldata(code: &[u8]) -> Vec { deploy } -fn prepare_deploy_compile_multicall(compressed_wasm: &[u8], expected_address: &H160) -> Vec { - let code = contract_init_code(compressed_wasm); - let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); - // let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - // let mut compile_calldata = vec![]; - // let compile_method_hash = hex::decode("2e50f32b").unwrap(); - // compile_calldata.extend(compile_method_hash); - // compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - // compile_calldata.extend(expected_address.as_bytes()); - // multicall_append( - // &mut multicall_args, - // MulticallArg::Call, - // H160::from_slice(&arbwasm_address), - // compile_calldata, - // ); - multicall_args -} - -async fn submit_multicall(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { - let provider = Provider::::try_from(endpoint)?; - let chain_id = provider.get_chainid().await?.as_u64(); - let addr = wallet.address(); - let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); - - let nonce = client.get_transaction_count(addr, None).await?; - let block_num = client.get_block_number().await?; - let block = client.get_block(block_num).await?; - if block.is_none() { - bail!("No latest block found"); - } - // TODO: Check if base fee exists. - let base_fee = block.unwrap().base_fee_per_gas.unwrap(); - let contract_addr = get_contract_address(addr, nonce); - let multicall_data = prepare_deploy_compile_multicall(&code, &contract_addr); - - let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); - let tx = Eip1559TransactionRequest::new() - .from(addr) - .to(H160::from_slice(&to)) - .max_priority_fee_per_gas(base_fee) - .data(multicall_data); - let tx = TypedTransaction::Eip1559(tx); - - //let estimated = client.estimate_gas(&tx, None).await?; - //println!("{estimated} estimated gas"); - println!("Sending program creation + compilation tx"); - let pending_tx = client.send_transaction(tx, None).await?; - - let receipt = pending_tx - .await? - .ok_or_else(|| eyre::format_err!("Tx dropped from mempool"))?; - - let tx = client.get_transaction(receipt.transaction_hash).await?; - - println!("Tx receipt: {}", serde_json::to_string(&receipt)?); - println!("Deployed and compiled program onchain at once {contract_addr}"); - Ok(()) -} - -async fn submit_signed_tx(endpoint: &str, wallet: LocalWallet, code: &[u8]) -> eyre::Result<()> { - let provider = Provider::::try_from(endpoint)?; - let chain_id = provider.get_chainid().await?.as_u64(); - let addr = wallet.address(); - let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); - - let nonce = client.get_transaction_count(addr, None).await?; - let block_num = client.get_block_number().await?; - let block = client.get_block(block_num).await?; - if block.is_none() { - bail!("No latest block found"); - } - // TODO: Check if base fee exists. - let base_fee = block.unwrap().base_fee_per_gas.unwrap(); - - // Deploy contract init code. - let init_code = contract_init_code(&code); - - // let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - // let to = H160::from_slice(&to); - let tx = Eip1559TransactionRequest::new() - .from(addr) - .max_priority_fee_per_gas(base_fee) - .data(init_code); - let tx = TypedTransaction::Eip1559(tx); - - //let estimated = client.estimate_gas(&tx, None).await?; - //println!("{estimated} estimated gas"); - - // Get base fee, estimate gas. - // Create a new contract creation tx. - // Send the tx and create address from to and nonce. - let contract_addr = get_contract_address(addr, nonce); - - println!("Sending program creation tx"); - let pending_tx = client.send_transaction(tx, None).await?; - - let receipt = pending_tx - .await? - .ok_or_else(|| eyre::format_err!("Tx dropped from mempool"))?; - - let tx = client.get_transaction(receipt.transaction_hash).await?; - - println!("Tx receipt: {}", serde_json::to_string(&receipt)?); - println!("Created contract {contract_addr}"); - - let nonce = client.get_transaction_count(addr, None).await?; - let block_num = client.get_block_number().await?; - let block = client.get_block(block_num).await?; - if block.is_none() { - bail!("No latest block found"); - } - // TODO: Check if base fee exists. - let base_fee = block.unwrap().base_fee_per_gas.unwrap(); - - let mut compile_calldata = vec![]; - let compile_method_hash = hex::decode("2e50f32b").unwrap(); - compile_calldata.extend(compile_method_hash); - compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - compile_calldata.extend(contract_addr.as_bytes()); - println!("Got compile calldata {}", hex::encode(&compile_calldata)); - - let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - let to = H160::from_slice(&to); - let tx = Eip1559TransactionRequest::new() - .from(addr) - .to(to) - .max_priority_fee_per_gas(base_fee) - .data(compile_calldata); - let tx = TypedTransaction::Eip1559(tx); - - println!("Sending compile tx"); - let pending_tx = client.send_transaction(tx, None).await?; - - let receipt = pending_tx - .await? - .ok_or_else(|| eyre::format_err!("Tx dropped from mempool"))?; - - println!("Tx receipt: {}", serde_json::to_string(&receipt)?); - Ok(()) -} +// let multicall_data = prepare_deploy_compile_multicall(&code, &contract_addr); + +// let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); +// let tx = Eip1559TransactionRequest::new() +// .from(addr) +// .to(H160::from_slice(&to)) +// .max_priority_fee_per_gas(base_fee) +// .data(multicall_data); +//let init_code = contract_init_code(&code); +// let tx = Eip1559TransactionRequest::new() +// .from(addr) +// .max_priority_fee_per_gas(base_fee) +// .data(init_code); +// let tx = TypedTransaction::Eip1559(tx); + +// let mut compile_calldata = vec![]; +// let compile_method_hash = hex::decode("2e50f32b").unwrap(); +// compile_calldata.extend(compile_method_hash); +// compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); +// compile_calldata.extend(contract_addr.as_bytes()); +// println!("Got compile calldata {}", hex::encode(&compile_calldata)); + +// let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); +// let to = H160::from_slice(&to); +// let tx = Eip1559TransactionRequest::new() +// .from(addr) +// .to(to) +// .max_priority_fee_per_gas(base_fee) +// .data(compile_calldata); +// let tx = TypedTransaction::Eip1559(tx); diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index c53f2c72b..31937d850 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -4,6 +4,7 @@ mod check; mod constants; mod deploy; mod multicall; +mod project; mod tx; #[derive(Parser, Debug)] @@ -78,7 +79,7 @@ pub struct WalletSource { } #[tokio::main] -async fn main() -> eyre::Result<()> { +async fn main() -> eyre::Result<(), String> { let cli = Cli::parse(); match &cli.command { Commands::Check { @@ -86,11 +87,11 @@ async fn main() -> eyre::Result<()> { } => { let disabled = disabled_checks.as_ref().map(|f| { f.into_iter() - .map(|s| s.as_str().into()) + .map(|s| s.as_str().try_into()) .collect::>() }); check::run_checks(disabled) } - Commands::Deploy(deploy_config) => deploy::deploy_and_compile_onchain(deploy_config).await, + Commands::Deploy(deploy_config) => Ok(()), } } diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs index adabaf997..b3900cf12 100644 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -17,6 +17,24 @@ impl From for u8 { } } +fn prepare_deploy_compile_multicall(compressed_wasm: &[u8], expected_address: &H160) -> Vec { + // let code = contract_init_code(compressed_wasm); + // let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); + // let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + // let mut compile_calldata = vec![]; + // let compile_method_hash = hex::decode("2e50f32b").unwrap(); + // compile_calldata.extend(compile_method_hash); + // compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + // compile_calldata.extend(expected_address.as_bytes()); + // multicall_append( + // &mut multicall_args, + // MulticallArg::Call, + // H160::from_slice(&arbwasm_address), + // compile_calldata, + // ); + vec![] +} + fn args_for_multicall( opcode: MulticallArg, address: H160, @@ -46,4 +64,4 @@ fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, in calls[0] += 1; // add another call let args = args_for_multicall(opcode, address, None, inner); calls.extend(args[1..].iter().cloned()); -} \ No newline at end of file +} diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs new file mode 100644 index 000000000..29cd8c36d --- /dev/null +++ b/arbitrator/cargo-stylus/src/project.rs @@ -0,0 +1,71 @@ +use std::env::current_dir; +use std::io::Read; +use std::path::{Component, PathBuf}; +use std::process::{Command, Stdio}; + +use brotli2::read::BrotliEncoder; +use bytes::buf::Reader; +use bytes::Buf; + +use crate::constants; +use arbutil::Color; + +// Loads the project name from the current working directory, +// which is assumed to be the project root. +pub fn get_project_name(cwd: &PathBuf) -> Option { + while let Some(component) = cwd.components().into_iter().next() { + match component { + Component::Normal(name) => { + return Some(name.to_str().unwrap().to_string()); + } + _ => {} + } + } + None +} + +// Build a Rust project to WASM and return the path to the compiled WASM file. +// TODO: Configure debug or release via flags. +pub fn build_project_to_wasm() -> eyre::Result { + let cwd: PathBuf = current_dir().map_err(|e| format!("Could not get current dir {}", e))?; + let project_name = get_project_name(&cwd).ok_or("Could not get project name from directory")?; + + Command::new("cargo") + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + .arg("build") + .arg("--release") + .arg("--target=wasm32-unknown-unknown") + .output() + .map_err(|e| format!("Failed to execute cargo build {}", e))?; + + let wasm_path = cwd + .join("target") + .join("wasm32-unknown-unknown") + .join("release") + .join(format!("{}.wasm", project_name)); + Ok(wasm_path) +} + +// Reads a WASM file at a specified path and returns its brotli compressed bytes. +pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, String> { + println!("Reading WASM file at {}", wasm_path.display().yellow()); + + let wasm_file_bytes = std::fs::read(&wasm_path) + .map_err(|e| format!("Could not read WASM file at target path {}", e))?; + let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); + + let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); + let mut compressed_bytes = vec![]; + compressor + .read_to_end(&mut compressed_bytes) + .map_err(|e| format!("Could not Brotli compress WASM bytes {}", e))?; + + println!( + "Compressed WASM size: {} bytes", + compressed_bytes.len().to_string().yellow() + ); + let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); + code.extend(compressed_bytes); + Ok(code) +} diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index e69de29bb..6803ac2f7 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -0,0 +1,79 @@ +use std::convert::TryFrom; + +use crate::constants; +use ethers::types::transaction::eip2718::TypedTransaction; +use ethers::types::Eip1559TransactionRequest; +use ethers::{ + middleware::SignerMiddleware, + providers::{Http, Middleware, Provider}, + signers::{LocalWallet, Signer}, +}; + +pub async fn submit_signed_tx( + endpoint: &str, + wallet: LocalWallet, + data: &[u8], + estimate_only: bool, + prep_tx: F, +) -> eyre::Result<(), String> +where + F: FnOnce() -> Eip1559TransactionRequest, +{ + let provider = Provider::::try_from(endpoint) + .map_err(|e| format!("could not initialize provider from http {}", e))?; + let chain_id = provider + .get_chainid() + .await + .map_err(|e| format!("could not get chain id {}", e))? + .as_u64(); + let addr = wallet.address(); + let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); + + let nonce = client + .get_transaction_count(addr, None) + .await + .map_err(|e| format!("Could not get nonce {} {}", addr, e))?; + let block_num = client + .get_block_number() + .await + .map_err(|e| format!("Could not get block number {}", e))?; + let block = client + .get_block(block_num) + .await + .map_err(|e| format!("Could not get block {}", e))? + .ok_or("No block found")?; + let base_fee = block.base_fee_per_gas.expect("No base fee found for block"); + + let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); + let tx = prep_tx(); + let typed = TypedTransaction::Eip1559(tx.clone()); + let estimated = client + .estimate_gas(&typed, None) + .await + .map_err(|e| format!("{}", e))?; + + println!("Estimated gas: {estimated}"); + + if estimate_only { + return Ok(()); + } + + println!("Submitting tx..."); + let pending_tx = client + .send_transaction(tx, None) + .await + .map_err(|e| format!("Could not send tx {}", e))?; + + let receipt = pending_tx + .await + .map_err(|e| format!("Could not get receipt {}", e))? + .ok_or("No receipt found")?; + + match receipt.status { + None => Err(format!( + "Tx with hash {} reverted", + receipt.transaction_hash + )), + Some(_) => Ok(()), + } +} From c6acc62c9b606f8c401262d5cd27e4c6313404ed Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 16:30:10 -0500 Subject: [PATCH 18/58] include the atomic multicall items --- arbitrator/cargo-stylus/src/check.rs | 2 + arbitrator/cargo-stylus/src/constants.rs | 2 + arbitrator/cargo-stylus/src/deploy.rs | 106 +++++++++++++++-------- arbitrator/cargo-stylus/src/main.rs | 4 +- arbitrator/cargo-stylus/src/multicall.rs | 2 + arbitrator/cargo-stylus/src/project.rs | 12 +-- arbitrator/cargo-stylus/src/tx.rs | 12 ++- 7 files changed, 92 insertions(+), 48 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 83bd1d113..2f36da3fc 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,3 +1,5 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use bytesize::ByteSize; use arbutil::Color; diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 5f581fa34..9e9272255 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -1,3 +1,5 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use bytesize::ByteSize; /// EOF prefix used in Stylus compressed WASMs on-chain diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 9af8a8444..42276a49d 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1,8 +1,73 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use std::str::FromStr; -use ethers::{signers::LocalWallet, types::U256}; +use ethers::{ + signers::{LocalWallet, Signer}, + types::{Eip1559TransactionRequest, U256, H160}, +}; -use crate::WalletSource; +use crate::{constants, project, tx, DeployConfig, WalletSource}; + +pub fn atomic_deploy_and_compile(cfg: DeployConfig) -> eyre::Result<(), String> { + // let multicall_data = prepare_deploy_compile_multicall(&code, &contract_addr); + + // let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); + // let tx = Eip1559TransactionRequest::new() + Ok(()) +} + +/// Sends a signed program deployment tx to a backend provider +/// and returns the deployed program's address. +pub fn send_deploy_program_tx(cfg: DeployConfig) -> eyre::Result<(), String> { + let wasm_file_path = project::build_project_to_wasm()?; + let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; + let wallet = load_wallet(&cfg.wallet)?; + + let prepare_tx = |base_fee: U256| { + let deployment_calldata = program_deployment_calldata(&wasm_file_bytes); + Eip1559TransactionRequest::new() + .from(wallet.address()) + .max_fee_per_gas(base_fee) + .data(deployment_calldata) + }; + tx::submit_signed_tx( + &cfg.endpoint, + wallet, + cfg.estimate_gas_only, + prepare_tx, + ); + Ok(()) +} + +/// Sends a signed program compilation tx to a backend provider for the specified program address. +pub fn send_compile_program_tx(cfg: DeployConfig) -> eyre::Result<(), String> { + let wallet = load_wallet(&cfg.wallet)?; + let program_addr = H160::zero(); + let mut compile_calldata = vec![]; + let compile_method_hash = hex::decode("2e50f32b").unwrap(); + compile_calldata.extend(compile_method_hash); + compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + compile_calldata.extend(program_addr.as_bytes()); + + let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + let to = H160::from_slice(&to); + + let prepare_tx = |base_fee: U256| { + Eip1559TransactionRequest::new() + .from(wallet.address()) + .to(to) + .max_fee_per_gas(base_fee) + .data(compile_calldata) + }; + tx::submit_signed_tx( + &cfg.endpoint, + wallet, + cfg.estimate_gas_only, + prepare_tx, + ); + Ok(()) +} /// Loads a wallet for signing transactions either from a private key file path. /// or a keystore along with a keystore password file. @@ -43,41 +108,6 @@ fn program_deployment_calldata(code: &[u8]) -> Vec { deploy.push(0x00); deploy.push(0xf3); // RETURN let prelude = hex::encode(&deploy); - println!("Got prelude={prelude}"); - let first_few: [u8; 12] = code[..12].try_into().unwrap(); - let first_few = hex::encode(first_few); - println!("First 12 bytes={first_few}"); deploy.extend(code); deploy -} - -// let multicall_data = prepare_deploy_compile_multicall(&code, &contract_addr); - -// let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); -// let tx = Eip1559TransactionRequest::new() -// .from(addr) -// .to(H160::from_slice(&to)) -// .max_priority_fee_per_gas(base_fee) -// .data(multicall_data); -//let init_code = contract_init_code(&code); -// let tx = Eip1559TransactionRequest::new() -// .from(addr) -// .max_priority_fee_per_gas(base_fee) -// .data(init_code); -// let tx = TypedTransaction::Eip1559(tx); - -// let mut compile_calldata = vec![]; -// let compile_method_hash = hex::decode("2e50f32b").unwrap(); -// compile_calldata.extend(compile_method_hash); -// compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); -// compile_calldata.extend(contract_addr.as_bytes()); -// println!("Got compile calldata {}", hex::encode(&compile_calldata)); - -// let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); -// let to = H160::from_slice(&to); -// let tx = Eip1559TransactionRequest::new() -// .from(addr) -// .to(to) -// .max_priority_fee_per_gas(base_fee) -// .data(compile_calldata); -// let tx = TypedTransaction::Eip1559(tx); +} \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 31937d850..67c7a0356 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,3 +1,5 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use clap::{Args, Parser, Subcommand, ValueEnum}; mod check; @@ -43,7 +45,7 @@ pub struct DeployConfig { /// Does not submit a transaction, but instead estimates the gas required /// to complete the operation. #[arg(long)] - estimate_gas: bool, + estimate_gas_only: bool, /// By default, submits a single, atomic deploy and compile transaction to Arbitrum. /// Otherwise, a user could choose to split up the deploy and compile steps into individual transactions. #[arg(long, value_enum)] diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs index b3900cf12..7f62a8042 100644 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -1,3 +1,5 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use ethers::types::{H160, U256}; #[derive(Clone)] diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index 29cd8c36d..fe5160482 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -1,3 +1,5 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use std::env::current_dir; use std::io::Read; use std::path::{Component, PathBuf}; @@ -10,8 +12,8 @@ use bytes::Buf; use crate::constants; use arbutil::Color; -// Loads the project name from the current working directory, -// which is assumed to be the project root. +/// Loads the project name from the current working directory, +/// which is assumed to be the project root. pub fn get_project_name(cwd: &PathBuf) -> Option { while let Some(component) = cwd.components().into_iter().next() { match component { @@ -24,8 +26,8 @@ pub fn get_project_name(cwd: &PathBuf) -> Option { None } -// Build a Rust project to WASM and return the path to the compiled WASM file. -// TODO: Configure debug or release via flags. +/// Build a Rust project to WASM and return the path to the compiled WASM file. +/// TODO: Configure debug or release via flags. pub fn build_project_to_wasm() -> eyre::Result { let cwd: PathBuf = current_dir().map_err(|e| format!("Could not get current dir {}", e))?; let project_name = get_project_name(&cwd).ok_or("Could not get project name from directory")?; @@ -47,7 +49,7 @@ pub fn build_project_to_wasm() -> eyre::Result { Ok(wasm_path) } -// Reads a WASM file at a specified path and returns its brotli compressed bytes. +/// Reads a WASM file at a specified path and returns its brotli compressed bytes. pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, String> { println!("Reading WASM file at {}", wasm_path.display().yellow()); diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index 6803ac2f7..785295982 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -1,23 +1,27 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use std::convert::TryFrom; use crate::constants; use ethers::types::transaction::eip2718::TypedTransaction; -use ethers::types::Eip1559TransactionRequest; +use ethers::types::{Eip1559TransactionRequest, U256}; use ethers::{ middleware::SignerMiddleware, providers::{Http, Middleware, Provider}, signers::{LocalWallet, Signer}, }; +/// Submits a signed tx to an endpoint, given a wallet, a data payload, and a closure +/// to get a transaction request to sign and send. If estimate_only is true, only a call to +/// estimate gas will occur and the actual tx will not be submitted. pub async fn submit_signed_tx( endpoint: &str, wallet: LocalWallet, - data: &[u8], estimate_only: bool, prep_tx: F, ) -> eyre::Result<(), String> where - F: FnOnce() -> Eip1559TransactionRequest, + F: FnOnce(U256) -> Eip1559TransactionRequest, { let provider = Provider::::try_from(endpoint) .map_err(|e| format!("could not initialize provider from http {}", e))?; @@ -45,7 +49,7 @@ where let base_fee = block.base_fee_per_gas.expect("No base fee found for block"); let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); - let tx = prep_tx(); + let tx = prep_tx(base_fee); let typed = TypedTransaction::Eip1559(tx.clone()); let estimated = client .estimate_gas(&typed, None) From a37e522cc13950c75c01b4c4575a05bed31a7524 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 22:48:54 -0500 Subject: [PATCH 19/58] wrap up --- arbitrator/cargo-stylus/src/check.rs | 13 +- arbitrator/cargo-stylus/src/constants.rs | 8 +- arbitrator/cargo-stylus/src/deploy.rs | 147 +++++++++++++---------- arbitrator/cargo-stylus/src/main.rs | 23 +++- arbitrator/cargo-stylus/src/multicall.rs | 44 ++++--- arbitrator/cargo-stylus/src/project.rs | 25 ++-- arbitrator/cargo-stylus/src/tx.rs | 60 ++++----- 7 files changed, 173 insertions(+), 147 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 2f36da3fc..c3d6dbd9d 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -30,7 +30,7 @@ impl TryFrom<&str> for StylusCheck { /// Runs a series of checks on the WASM program to ensure it is valid for compilation /// and code size before being deployed and compiled onchain. An optional list of checks /// to disable can be specified. -pub fn run_checks(disabled: Option>) -> eyre::Result<(), String> { +pub fn run_checks(disabled: Vec) -> eyre::Result<(), String> { let wasm_file_path = project::build_project_to_wasm()?; let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!( @@ -41,10 +41,7 @@ pub fn run_checks(disabled: Option>) -> eyre::Result<(), String ); let compressed_size = ByteSize::b(wasm_file_bytes.len() as u64); - let check_compressed_size = disabled - .as_ref() - .map(|d: &Vec| !d.contains(&StylusCheck::CompressedSize)) - .unwrap_or(true); + let check_compressed_size = disabled.contains(&StylusCheck::CompressedSize); if check_compressed_size && compressed_size > constants::MAX_PROGRAM_SIZE { return Err(format!( @@ -62,14 +59,14 @@ pub fn compile_native_wasm_module( cfg: CompileConfig, wasm_file_bytes: &[u8], ) -> eyre::Result, String> { - let module = stylus::native::module(&wasm_file_bytes, cfg) - .map_err(|e| format!("could not compile wasm {}", e))?; + let module = stylus::native::module(wasm_file_bytes, cfg) + .map_err(|e| format!("Could not compile wasm {}", e))?; let success = "Stylus compilation successful!".to_string().mint(); println!("{}", success); println!( "Compiled WASM module total size: {}", - ByteSize::b(module.len() as u64).to_string() + ByteSize::b(module.len() as u64), ); Ok(module) } diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 9e9272255..2c54f7db8 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -3,12 +3,14 @@ use bytesize::ByteSize; /// EOF prefix used in Stylus compressed WASMs on-chain -pub const EOF_PREFIX: &'static str = "EF000000"; +pub const EOF_PREFIX: &str = "EF000000"; /// Maximum brotli compression level used for Stylus programs. pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; /// Address of the Arbitrum WASM precompile on L2. -pub const ARB_WASM_ADDRESS: &'static str = "0000000000000000000000000000000000000071"; +pub const ARB_WASM_ADDRESS: &str = "0000000000000000000000000000000000000071"; /// Address a multicall.rs Stylus program on L2. -pub const MULTICALL_ADDR: &'static str = "Eba70C09bA17508c75227cCACf376975490172c3"; +pub const MULTICALL_ADDR: &str = "Eba70C09bA17508c75227cCACf376975490172c3"; /// Maximum allowed size of a program on Arbitrum (and Ethereum). pub const MAX_PROGRAM_SIZE: ByteSize = ByteSize::kb(24); +/// 4 bytes method selector for the compile method of ArbWasm. +pub const ARBWASM_COMPILE_METHOD_HASH: &str = "2e50f32b"; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 42276a49d..319106bb1 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -2,71 +2,96 @@ // For license information, see https://github.com/nitro/blob/master/LICENSE use std::str::FromStr; +use ethers::types::{Eip1559TransactionRequest, H160, U256}; +use ethers::utils::get_contract_address; use ethers::{ + middleware::SignerMiddleware, + providers::{Http, Middleware, Provider}, signers::{LocalWallet, Signer}, - types::{Eip1559TransactionRequest, U256, H160}, }; -use crate::{constants, project, tx, DeployConfig, WalletSource}; +use crate::{constants, multicall, project, tx, DeployConfig, DeployMode, WalletSource}; -pub fn atomic_deploy_and_compile(cfg: DeployConfig) -> eyre::Result<(), String> { - // let multicall_data = prepare_deploy_compile_multicall(&code, &contract_addr); - - // let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); - // let tx = Eip1559TransactionRequest::new() - Ok(()) -} - -/// Sends a signed program deployment tx to a backend provider -/// and returns the deployed program's address. -pub fn send_deploy_program_tx(cfg: DeployConfig) -> eyre::Result<(), String> { +/// Performs one of three different modes for a Stylus program: +/// DeployOnly: Sends a signed tx to deploy a Stylus program to a new address. +/// CompileOnly: Sends a signed tx to compile a Stylus program at a specified address. +/// DeployAndCompile (default): Sends a signed, multicall tx to both deploy and compile a Stylus program atomically. +pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let wasm_file_path = project::build_project_to_wasm()?; let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; let wallet = load_wallet(&cfg.wallet)?; - let prepare_tx = |base_fee: U256| { - let deployment_calldata = program_deployment_calldata(&wasm_file_bytes); - Eip1559TransactionRequest::new() - .from(wallet.address()) - .max_fee_per_gas(base_fee) - .data(deployment_calldata) - }; - tx::submit_signed_tx( - &cfg.endpoint, - wallet, - cfg.estimate_gas_only, - prepare_tx, - ); - Ok(()) + let provider = Provider::::try_from(&cfg.endpoint) + .map_err(|e| format!("could not initialize provider from http {}", e))?; + let chain_id = provider + .get_chainid() + .await + .map_err(|e| format!("could not get chain id {}", e))? + .as_u64(); + let client = SignerMiddleware::new(provider, wallet.clone().with_chain_id(chain_id)); + + let addr = wallet.address(); + let nonce = client + .get_transaction_count(addr, None) + .await + .map_err(|e| format!("could not get nonce {} {}", addr, e))?; + + let mut tx_request = prepare_tx_request(&cfg, &wasm_file_bytes, &wallet, nonce)?; + + tx::submit_signed_tx(client, cfg.estimate_gas_only, &mut tx_request).await } -/// Sends a signed program compilation tx to a backend provider for the specified program address. -pub fn send_compile_program_tx(cfg: DeployConfig) -> eyre::Result<(), String> { - let wallet = load_wallet(&cfg.wallet)?; - let program_addr = H160::zero(); - let mut compile_calldata = vec![]; - let compile_method_hash = hex::decode("2e50f32b").unwrap(); - compile_calldata.extend(compile_method_hash); - compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - compile_calldata.extend(program_addr.as_bytes()); +/// Prepares a tx request for the given deploy config. For deploying a program only, it +/// prepares a contract creation transaction. For compiling only, it prepares a compilation tx, +/// and for both deploying and atomically compiling, prepares a multicall tx. +fn prepare_tx_request( + cfg: &DeployConfig, + wasm_file_bytes: &[u8], + wallet: &LocalWallet, + nonce: U256, +) -> eyre::Result { + match cfg.mode { + Some(DeployMode::DeployOnly) => { + let program_addr = get_contract_address(wallet.address(), nonce); + println!("Deploying program to address {}", &program_addr); + let deployment_calldata = program_deployment_calldata(wasm_file_bytes); + Ok(Eip1559TransactionRequest::new() + .from(wallet.address()) + .data(deployment_calldata)) + } + Some(DeployMode::CompileOnly) => { + let program_addr = cfg + .compile_program_addr + .ok_or("No --compile-program-addr provided")?; + let mut compile_calldata = vec![]; + let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); + compile_calldata.extend(compile_method_hash); + compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + compile_calldata.extend(program_addr.as_bytes()); + + let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + let to = H160::from_slice(&to); - let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - let to = H160::from_slice(&to); + Ok(Eip1559TransactionRequest::new() + .from(wallet.address()) + .to(to) + .data(compile_calldata)) + } + // Default mode is to deploy and compile atomically. + None => { + let program_addr = get_contract_address(wallet.address(), nonce); + println!("Deploying program to address {}", &program_addr); + let multicall_data = + multicall::prepare_deploy_compile_multicall(wasm_file_bytes, &program_addr); - let prepare_tx = |base_fee: U256| { - Eip1559TransactionRequest::new() - .from(wallet.address()) - .to(to) - .max_fee_per_gas(base_fee) - .data(compile_calldata) - }; - tx::submit_signed_tx( - &cfg.endpoint, - wallet, - cfg.estimate_gas_only, - prepare_tx, - ); - Ok(()) + let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); + let to = H160::from_slice(&to); + Ok(Eip1559TransactionRequest::new() + .to(to) + .from(wallet.address()) + .data(multicall_data)) + } + } } /// Loads a wallet for signing transactions either from a private key file path. @@ -74,25 +99,26 @@ pub fn send_compile_program_tx(cfg: DeployConfig) -> eyre::Result<(), String> { fn load_wallet(cfg: &WalletSource) -> eyre::Result { if let Some(priv_key_path) = &cfg.private_key_path { let privkey = std::fs::read_to_string(priv_key_path) - .map_err(|e| format!("Could not read private key file {}", e))?; + .map_err(|e| format!("could not read private key file {}", e))?; return LocalWallet::from_str(privkey.as_str()) - .map_err(|e| format!("Could not parse private key {}", e)); + .map_err(|e| format!("could not parse private key {}", e)); } let keystore_password_path = cfg .keystore_password_path .as_ref() - .ok_or("No keystore password path provided")?; + .ok_or("no keystore password path provided")?; let keystore_path = cfg .keystore_path .as_ref() - .ok_or("No keystore path provided")?; + .ok_or("no keystore path provided")?; let keystore_pass = std::fs::read_to_string(keystore_password_path) - .map_err(|e| format!("Could not keystore password file {}", e))?; + .map_err(|e| format!("could not keystore password file {}", e))?; LocalWallet::decrypt_keystore(keystore_path, keystore_pass) - .map_err(|e| format!("Could not decrypt keystore {}", e)) + .map_err(|e| format!("could not decrypt keystore {}", e)) } -fn program_deployment_calldata(code: &[u8]) -> Vec { +/// Prepares an EVM bytecode prelude for contract creation. +pub fn program_deployment_calldata(code: &[u8]) -> Vec { let mut code_len = [0u8; 32]; U256::from(code.len()).to_big_endian(&mut code_len); let mut deploy: Vec = vec![]; @@ -107,7 +133,6 @@ fn program_deployment_calldata(code: &[u8]) -> Vec { deploy.push(0x60); // PUSH1 deploy.push(0x00); deploy.push(0xf3); // RETURN - let prelude = hex::encode(&deploy); deploy.extend(code); deploy -} \ No newline at end of file +} diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 67c7a0356..f70fd9d11 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,6 +1,8 @@ +use check::StylusCheck; // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use clap::{Args, Parser, Subcommand, ValueEnum}; +use ethers::types::H160; mod check; mod constants; @@ -61,6 +63,9 @@ pub struct DeployConfig { /// Wallet source to use with the cargo stylus plugin. #[command(flatten)] wallet: WalletSource, + /// If only compiling an onchain program, the address of the program to send a compilation tx for. + #[arg(long)] + compile_program_addr: Option, } #[derive(Debug, Clone, ValueEnum)] @@ -83,17 +88,25 @@ pub struct WalletSource { #[tokio::main] async fn main() -> eyre::Result<(), String> { let cli = Cli::parse(); - match &cli.command { + match cli.command { Commands::Check { disabled_checks, .. } => { - let disabled = disabled_checks.as_ref().map(|f| { - f.into_iter() + let disabled = disabled_checks.map_or(Vec::default(), |checks| { + checks + .into_iter() .map(|s| s.as_str().try_into()) - .collect::>() + .collect::, String>>() + .expect("Could not parse disabled Stylus checks") }); check::run_checks(disabled) } - Commands::Deploy(deploy_config) => Ok(()), + Commands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { + Ok(_) => Ok(()), + Err(e) => Err(format!( + "Could not perform deployment/compilation transaction {}", + e + )), + }, } } diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs index 7f62a8042..1fd194dd2 100644 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -2,13 +2,18 @@ // For license information, see https://github.com/nitro/blob/master/LICENSE use ethers::types::{H160, U256}; +use crate::{constants, deploy}; + +/// Defines the different types of calls that can be made in a multicall transaction. #[derive(Clone)] +#[allow(dead_code)] enum MulticallArg { Call, DelegateCall, StaticCall, } +/// Convertes a multicall into an opcode (byte). impl From for u8 { fn from(value: MulticallArg) -> Self { match value { @@ -19,24 +24,29 @@ impl From for u8 { } } -fn prepare_deploy_compile_multicall(compressed_wasm: &[u8], expected_address: &H160) -> Vec { - // let code = contract_init_code(compressed_wasm); - // let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); - // let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - // let mut compile_calldata = vec![]; - // let compile_method_hash = hex::decode("2e50f32b").unwrap(); - // compile_calldata.extend(compile_method_hash); - // compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - // compile_calldata.extend(expected_address.as_bytes()); - // multicall_append( - // &mut multicall_args, - // MulticallArg::Call, - // H160::from_slice(&arbwasm_address), - // compile_calldata, - // ); - vec![] +/// Prepares the data for a deploy and compile multicall tx. +pub fn prepare_deploy_compile_multicall( + compressed_wasm: &[u8], + expected_address: &H160, +) -> Vec { + let code = deploy::program_deployment_calldata(compressed_wasm); + let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); + let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + let mut compile_calldata = vec![]; + let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); + compile_calldata.extend(compile_method_hash); + compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); + compile_calldata.extend(expected_address.as_bytes()); + multicall_append( + &mut multicall_args, + MulticallArg::Call, + H160::from_slice(&arbwasm_address), + compile_calldata, + ); + multicall_args } +/// Converts arguments into the format the multicall Rust Stylus program expects. fn args_for_multicall( opcode: MulticallArg, address: H160, @@ -58,10 +68,10 @@ fn args_for_multicall( } args.extend(address.as_bytes()); args.extend(calldata); - println!("Got args as {}", hex::encode(&args)); args } +/// Adds another call to a multicall transaction. fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, inner: Vec) { calls[0] += 1; // add another call let args = args_for_multicall(opcode, address, None, inner); diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index fe5160482..c7b7ea088 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -2,7 +2,7 @@ // For license information, see https://github.com/nitro/blob/master/LICENSE use std::env::current_dir; use std::io::Read; -use std::path::{Component, PathBuf}; +use std::path::{Component, Path, PathBuf}; use std::process::{Command, Stdio}; use brotli2::read::BrotliEncoder; @@ -14,13 +14,10 @@ use arbutil::Color; /// Loads the project name from the current working directory, /// which is assumed to be the project root. -pub fn get_project_name(cwd: &PathBuf) -> Option { - while let Some(component) = cwd.components().into_iter().next() { - match component { - Component::Normal(name) => { - return Some(name.to_str().unwrap().to_string()); - } - _ => {} +pub fn get_project_name(cwd: &Path) -> Option { + while let Some(component) = cwd.components().next() { + if let Component::Normal(name) = component { + return Some(name.to_str().unwrap().to_string()); } } None @@ -29,8 +26,8 @@ pub fn get_project_name(cwd: &PathBuf) -> Option { /// Build a Rust project to WASM and return the path to the compiled WASM file. /// TODO: Configure debug or release via flags. pub fn build_project_to_wasm() -> eyre::Result { - let cwd: PathBuf = current_dir().map_err(|e| format!("Could not get current dir {}", e))?; - let project_name = get_project_name(&cwd).ok_or("Could not get project name from directory")?; + let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir {}", e))?; + let project_name = get_project_name(&cwd).ok_or("could not get project name from directory")?; Command::new("cargo") .stdout(Stdio::inherit()) @@ -39,7 +36,7 @@ pub fn build_project_to_wasm() -> eyre::Result { .arg("--release") .arg("--target=wasm32-unknown-unknown") .output() - .map_err(|e| format!("Failed to execute cargo build {}", e))?; + .map_err(|e| format!("failed to execute cargo build {}", e))?; let wasm_path = cwd .join("target") @@ -53,15 +50,15 @@ pub fn build_project_to_wasm() -> eyre::Result { pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, String> { println!("Reading WASM file at {}", wasm_path.display().yellow()); - let wasm_file_bytes = std::fs::read(&wasm_path) - .map_err(|e| format!("Could not read WASM file at target path {}", e))?; + let wasm_file_bytes = std::fs::read(wasm_path) + .map_err(|e| format!("could not read WASM file at target path {}", e))?; let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor .read_to_end(&mut compressed_bytes) - .map_err(|e| format!("Could not Brotli compress WASM bytes {}", e))?; + .map_err(|e| format!("could not Brotli compress WASM bytes {}", e))?; println!( "Compressed WASM size: {} bytes", diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index 785295982..e63aac2ed 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -1,56 +1,37 @@ // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE -use std::convert::TryFrom; - -use crate::constants; use ethers::types::transaction::eip2718::TypedTransaction; -use ethers::types::{Eip1559TransactionRequest, U256}; -use ethers::{ - middleware::SignerMiddleware, - providers::{Http, Middleware, Provider}, - signers::{LocalWallet, Signer}, -}; +use ethers::types::Eip1559TransactionRequest; +use ethers::{middleware::SignerMiddleware, providers::Middleware, signers::Signer}; /// Submits a signed tx to an endpoint, given a wallet, a data payload, and a closure /// to get a transaction request to sign and send. If estimate_only is true, only a call to /// estimate gas will occur and the actual tx will not be submitted. -pub async fn submit_signed_tx( - endpoint: &str, - wallet: LocalWallet, +pub async fn submit_signed_tx( + client: SignerMiddleware, estimate_only: bool, - prep_tx: F, + tx_request: &mut Eip1559TransactionRequest, ) -> eyre::Result<(), String> where - F: FnOnce(U256) -> Eip1559TransactionRequest, + M: Middleware, + S: Signer, { - let provider = Provider::::try_from(endpoint) - .map_err(|e| format!("could not initialize provider from http {}", e))?; - let chain_id = provider - .get_chainid() - .await - .map_err(|e| format!("could not get chain id {}", e))? - .as_u64(); - let addr = wallet.address(); - let client = SignerMiddleware::new(provider, wallet.with_chain_id(chain_id)); - - let nonce = client - .get_transaction_count(addr, None) - .await - .map_err(|e| format!("Could not get nonce {} {}", addr, e))?; let block_num = client .get_block_number() .await - .map_err(|e| format!("Could not get block number {}", e))?; + .map_err(|e| format!("could not get block number {}", e))?; let block = client .get_block(block_num) .await - .map_err(|e| format!("Could not get block {}", e))? - .ok_or("No block found")?; - let base_fee = block.base_fee_per_gas.expect("No base fee found for block"); + .map_err(|e| format!("could not get block {}", e))? + .ok_or("no block found")?; + let base_fee = block + .base_fee_per_gas + .ok_or("no base fee found for block")?; + + tx_request.max_fee_per_gas = Some(base_fee); - let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); - let tx = prep_tx(base_fee); - let typed = TypedTransaction::Eip1559(tx.clone()); + let typed = TypedTransaction::Eip1559(tx_request.clone()); let estimated = client .estimate_gas(&typed, None) .await @@ -63,15 +44,16 @@ where } println!("Submitting tx..."); + let pending_tx = client - .send_transaction(tx, None) + .send_transaction(typed, None) .await - .map_err(|e| format!("Could not send tx {}", e))?; + .map_err(|e| format!("could not send tx {}", e))?; let receipt = pending_tx .await - .map_err(|e| format!("Could not get receipt {}", e))? - .ok_or("No receipt found")?; + .map_err(|e| format!("could not get receipt {}", e))? + .ok_or("no receipt found")?; match receipt.status { None => Err(format!( From 5f1779468f33da986a2cca2032a1b6a5e4a0bcb6 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 23:32:00 -0500 Subject: [PATCH 20/58] confirmed tx --- arbitrator/cargo-stylus/src/deploy.rs | 4 +-- arbitrator/cargo-stylus/src/project.rs | 39 +++++++++++++++----------- arbitrator/cargo-stylus/src/tx.rs | 8 +++++- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 319106bb1..a0a8ba1a1 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -53,7 +53,7 @@ fn prepare_tx_request( match cfg.mode { Some(DeployMode::DeployOnly) => { let program_addr = get_contract_address(wallet.address(), nonce); - println!("Deploying program to address {}", &program_addr); + println!("Deploying program to address {program_addr:#032x}"); let deployment_calldata = program_deployment_calldata(wasm_file_bytes); Ok(Eip1559TransactionRequest::new() .from(wallet.address()) @@ -80,7 +80,7 @@ fn prepare_tx_request( // Default mode is to deploy and compile atomically. None => { let program_addr = get_contract_address(wallet.address(), nonce); - println!("Deploying program to address {}", &program_addr); + println!("Deploying program to address {program_addr:#032x}"); let multicall_data = multicall::prepare_deploy_compile_multicall(wasm_file_bytes, &program_addr); diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index c7b7ea088..4c38ba6cb 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -2,7 +2,7 @@ // For license information, see https://github.com/nitro/blob/master/LICENSE use std::env::current_dir; use std::io::Read; -use std::path::{Component, Path, PathBuf}; +use std::path::PathBuf; use std::process::{Command, Stdio}; use brotli2::read::BrotliEncoder; @@ -12,22 +12,10 @@ use bytes::Buf; use crate::constants; use arbutil::Color; -/// Loads the project name from the current working directory, -/// which is assumed to be the project root. -pub fn get_project_name(cwd: &Path) -> Option { - while let Some(component) = cwd.components().next() { - if let Component::Normal(name) = component { - return Some(name.to_str().unwrap().to_string()); - } - } - None -} - /// Build a Rust project to WASM and return the path to the compiled WASM file. /// TODO: Configure debug or release via flags. pub fn build_project_to_wasm() -> eyre::Result { let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir {}", e))?; - let project_name = get_project_name(&cwd).ok_or("could not get project name from directory")?; Command::new("cargo") .stdout(Stdio::inherit()) @@ -38,12 +26,29 @@ pub fn build_project_to_wasm() -> eyre::Result { .output() .map_err(|e| format!("failed to execute cargo build {}", e))?; - let wasm_path = cwd + let release_path = cwd .join("target") .join("wasm32-unknown-unknown") - .join("release") - .join(format!("{}.wasm", project_name)); - Ok(wasm_path) + .join("release"); + + // Gets the files in the release folder. + let release_files: Vec = std::fs::read_dir(release_path) + .map_err(|e| format!("could not read release dir {}", e))? + .filter(|r| r.is_ok()) + .map(|r| r.unwrap().path()) + .filter(|r| r.is_file()) + .collect(); + + let wasm_file_path = release_files + .into_iter() + .find(|p| { + if let Some(ext) = p.file_name() { + return ext.to_str().unwrap_or("").contains(".wasm") + } + false + }) + .ok_or("could not find WASM file in release dir")?; + Ok(wasm_file_path) } /// Reads a WASM file at a specified path and returns its brotli compressed bytes. diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index e63aac2ed..cad4fbe96 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -30,6 +30,7 @@ where .ok_or("no base fee found for block")?; tx_request.max_fee_per_gas = Some(base_fee); + tx_request.max_priority_fee_per_gas = Some(base_fee); let typed = TypedTransaction::Eip1559(tx_request.clone()); let estimated = client @@ -60,6 +61,11 @@ where "Tx with hash {} reverted", receipt.transaction_hash )), - Some(_) => Ok(()), + Some(_) => { + let tx_hash = receipt.transaction_hash; + let gas_used = receipt.gas_used.unwrap(); + println!("Confirmed tx {tx_hash:#032x}, gas used {gas_used}"); + Ok(()) + }, } } From bc5796be6bafd08406bfb0bd56d027a3be115eb9 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 23:35:41 -0500 Subject: [PATCH 21/58] revert --- arbitrator/stylus/tests/echo/.cargo/config | 2 - arbitrator/stylus/tests/echo/Cargo.lock | 585 --------------------- arbitrator/stylus/tests/echo/Cargo.toml | 18 - arbitrator/stylus/tests/echo/privkey | 1 - arbitrator/stylus/tests/echo/src/main.rs | 10 - system_tests/common_test.go | 2 - system_tests/program_test.go | 72 --- 7 files changed, 690 deletions(-) delete mode 100644 arbitrator/stylus/tests/echo/.cargo/config delete mode 100644 arbitrator/stylus/tests/echo/Cargo.lock delete mode 100644 arbitrator/stylus/tests/echo/Cargo.toml delete mode 100644 arbitrator/stylus/tests/echo/privkey delete mode 100644 arbitrator/stylus/tests/echo/src/main.rs diff --git a/arbitrator/stylus/tests/echo/.cargo/config b/arbitrator/stylus/tests/echo/.cargo/config deleted file mode 100644 index f4e8c002f..000000000 --- a/arbitrator/stylus/tests/echo/.cargo/config +++ /dev/null @@ -1,2 +0,0 @@ -[build] -target = "wasm32-unknown-unknown" diff --git a/arbitrator/stylus/tests/echo/Cargo.lock b/arbitrator/stylus/tests/echo/Cargo.lock deleted file mode 100644 index 308c03ec0..000000000 --- a/arbitrator/stylus/tests/echo/Cargo.lock +++ /dev/null @@ -1,585 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "alloy-primitives" -version = "0.2.0" -source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" -dependencies = [ - "alloy-rlp", - "bytes", - "cfg-if", - "const-hex", - "derive_more", - "hex-literal", - "itoa", - "proptest", - "ruint2", - "serde", - "tiny-keccak", -] - -[[package]] -name = "alloy-rlp" -version = "0.2.0" -source = "git+https://github.com/rachel-bousfield/alloy-core.git?branch=native-keccak#fd40d0a68a538a7583c8094c97e77fa2d9e49eb0" -dependencies = [ - "arrayvec", - "bytes", - "smol_str", -] - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[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 = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "const-hex" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "268f52aae268980d03dd9544c1ea591965b2735b038d6998d6e4ab37c8c24445" -dependencies = [ - "cfg-if", - "cpufeatures", - "hex", - "serde", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cpufeatures" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" -dependencies = [ - "libc", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", -] - -[[package]] -name = "echo" -version = "0.1.0" -dependencies = [ - "stylus-sdk", -] - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "fastrand" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" - -[[package]] -name = "libm" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - -[[package]] -name = "linux-raw-sys" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" - -[[package]] -name = "num-traits" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "proc-macro2" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proptest" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" -dependencies = [ - "bit-set", - "bitflags 1.3.2", - "byteorder", - "lazy_static", - "num-traits", - "rand", - "rand_chacha", - "rand_xorshift", - "regex-syntax", - "rusty-fork", - "tempfile", - "unarray", -] - -[[package]] -name = "quick-error" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" - -[[package]] -name = "quote" -version = "1.0.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "ruint2" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b066b8e4fcea7fae86b6932d2449670b6b5545b7e8407841b2d3a916ff2a9f86" -dependencies = [ - "derive_more", - "ruint2-macro", - "rustc_version", - "thiserror", -] - -[[package]] -name = "ruint2-macro" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89dc553bc0cf4512a8b96caa2e21ed5f6e4b66bf28a1bd08fd9eb07c0b39b28c" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" -dependencies = [ - "bitflags 2.3.3", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "rusty-fork" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" -dependencies = [ - "fnv", - "quick-error", - "tempfile", - "wait-timeout", -] - -[[package]] -name = "semver" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" - -[[package]] -name = "serde" -version = "1.0.174" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" - -[[package]] -name = "smol_str" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" -dependencies = [ - "serde", -] - -[[package]] -name = "stylus-sdk" -version = "0.1.0" -dependencies = [ - "alloy-primitives", - "hex", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys", -] - -[[package]] -name = "thiserror" -version = "1.0.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.27", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - -[[package]] -name = "unicode-ident" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" diff --git a/arbitrator/stylus/tests/echo/Cargo.toml b/arbitrator/stylus/tests/echo/Cargo.toml deleted file mode 100644 index c3a9385a0..000000000 --- a/arbitrator/stylus/tests/echo/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "echo" -version = "0.1.0" -edition = "2021" - -[dependencies] -stylus-sdk = { path = "../../../langs/rust/" } - -[profile.release] -codegen-units = 1 -strip = true -lto = true -panic = "abort" - -# uncomment to optimize for size -# opt-level = "z" - -[workspace] diff --git a/arbitrator/stylus/tests/echo/privkey b/arbitrator/stylus/tests/echo/privkey deleted file mode 100644 index e1c9ccb4b..000000000 --- a/arbitrator/stylus/tests/echo/privkey +++ /dev/null @@ -1 +0,0 @@ -009f3fd6848015f83b9210c89f7744e3941acae1195c8bf9f5798c090dc8f497 \ No newline at end of file diff --git a/arbitrator/stylus/tests/echo/src/main.rs b/arbitrator/stylus/tests/echo/src/main.rs deleted file mode 100644 index 8c5dd3b1a..000000000 --- a/arbitrator/stylus/tests/echo/src/main.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2023, Offchain Labs, Inc. -// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE - -#![no_main] - -stylus_sdk::entrypoint!(user_main); - -fn user_main(input: Vec) -> Result, Vec> { - Ok(input) -} diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 1db8d4077..1b83e45b6 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -918,8 +918,6 @@ func deployContractInitCode(code []byte, revert bool) []byte { deploy = append(deploy, byte(vm.PUSH1)) deploy = append(deploy, 0) deploy = append(deploy, byte(last_opcode)) - fmt.Printf("Deployment logic prelude %#x\n", deploy) - fmt.Printf("First 12 bytes of code %#x\n", code[:12]) deploy = append(deploy, code...) return deploy } diff --git a/system_tests/program_test.go b/system_tests/program_test.go index cf145b8be..d53e03889 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -22,7 +22,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbnode" @@ -551,72 +550,6 @@ func testEvmData(t *testing.T, jit bool) { validateBlocks(t, 1, jit, ctx, node, l2client) } -func TestStylusCargoPlugin(t *testing.T) { - t.Parallel() - ctx, cancel := context.WithCancel(context.Background()) - rand.Seed(time.Now().UTC().UnixNano()) - - // TODO: track latest ArbOS version - chainConfig := params.ArbitrumDevTestChainConfig() - chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10 - - l2config := arbnode.ConfigDefaultL1Test() - l2config.BlockValidator.Enable = true - l2config.BatchPoster.Enable = true - l2config.L1Reader.Enable = true - l2config.Sequencer.MaxRevertGasReject = 0 - l2config.L1Reader.OldHeaderTimeout = 10 * time.Minute - AddDefaultValNode(t, ctx, l2config, true /* jit */) - - stackConf := node.DefaultConfig - stackConf.HTTPHost = "localhost" - stackConf.HTTPPort = 9999 - stackConf.HTTPModules = append(stackConf.HTTPModules, "eth") - stackConf.P2P.NoDiscovery = true - stackConf.P2P.ListenAddr = "" - l2info, node, l2client, _, _, _, l1stack := createTestNodeOnL1WithConfig(t, ctx, true, l2config, chainConfig, &stackConf) - - cleanup := func() { - requireClose(t, l1stack) - node.StopAndWait() - cancel() - } - defer cleanup() - - auth := l2info.GetDefaultTransactOpts("Owner", ctx) - fmt.Printf("Owner %x", crypto.FromECDSA(l2info.Accounts["Owner"].PrivateKey)) - - arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) - Require(t, err) - arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, l2client) - Require(t, err) - - ensure := func(tx *types.Transaction, err error) *types.Receipt { - t.Helper() - Require(t, err) - receipt, err := EnsureTxSucceeded(ctx, l2client, tx) - Require(t, err) - return receipt - } - - // Set random pricing params. Note that the ink price is measured in bips, - // so an ink price of 10k means that 1 evm gas buys exactly 1 ink. - // We choose a range on both sides of this value. - inkPrice := testhelpers.RandomUint64(0, 20000) // evm to ink - wasmHostioInk := testhelpers.RandomUint64(0, 5000) // amount of ink - colors.PrintMint(fmt.Sprintf("ink price=%d, HostIO ink=%d", inkPrice, wasmHostioInk)) - - ensure(arbDebug.BecomeChainOwner(&auth)) - ensure(arbOwner.SetInkPrice(&auth, inkPrice)) - ensure(arbOwner.SetWasmHostioInk(&auth, wasmHostioInk)) - - colors.PrintMint(fmt.Sprintf("arbwasm addr is=%#x", types.ArbWasmAddress)) - - multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) - t.Logf("Multicall addr %#x", multiAddr) - time.Sleep(time.Hour) -} - func TestProgramMemory(t *testing.T) { t.Parallel() testMemory(t, true) @@ -747,7 +680,6 @@ func setupProgramTest(t *testing.T, file string, jit bool) ( } auth := l2info.GetDefaultTransactOpts("Owner", ctx) - fmt.Printf("Owner priv key %#x", l2info.Accounts["Owner"].PrivateKey.D.Bytes()) arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) Require(t, err) @@ -783,7 +715,6 @@ func readWasmFile(t *testing.T, file string) []byte { wasmSource, err := wasmer.Wat2Wasm(string(source)) Require(t, err) - colors.PrintMint(fmt.Sprintf("WASM source len %d, and file name %s", len(wasmSource), file)) wasm, err := arbcompress.CompressWell(wasmSource) Require(t, err) @@ -798,7 +729,6 @@ func deployWasm( t *testing.T, ctx context.Context, auth bind.TransactOpts, l2client *ethclient.Client, file string, ) common.Address { wasm := readWasmFile(t, file) - colors.PrintMint("Compressed wasm code length", len(wasm)) programAddress := deployContract(t, ctx, auth, l2client, wasm) colors.PrintBlue("program deployed to ", programAddress.Hex()) return compileWasm(t, ctx, auth, l2client, programAddress) @@ -812,10 +742,8 @@ func compileWasm( Require(t, err) timed(t, "compile", func() { - fmt.Println("Getting to compile the code...") tx, err := arbWasm.CompileProgram(&auth, program) Require(t, err) - fmt.Printf("Compile tx data %#x", tx.Data()) _, err = EnsureTxSucceeded(ctx, l2client, tx) Require(t, err) }) From 025d5ba3fe35c18ba933d70f009e2d0fb198cc11 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 23:36:42 -0500 Subject: [PATCH 22/58] rem file --- arbitrator/stylus/tests/multicall/privkey | 1 - 1 file changed, 1 deletion(-) delete mode 100644 arbitrator/stylus/tests/multicall/privkey diff --git a/arbitrator/stylus/tests/multicall/privkey b/arbitrator/stylus/tests/multicall/privkey deleted file mode 100644 index e1c9ccb4b..000000000 --- a/arbitrator/stylus/tests/multicall/privkey +++ /dev/null @@ -1 +0,0 @@ -009f3fd6848015f83b9210c89f7744e3941acae1195c8bf9f5798c090dc8f497 \ No newline at end of file From 530c89aa582d14e97dc21a2e9bf4ba0169c0ec99 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 25 Jul 2023 23:50:59 -0500 Subject: [PATCH 23/58] comments --- arbitrator/cargo-stylus/src/tx.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index cad4fbe96..f02e5c2a0 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -4,8 +4,8 @@ use ethers::types::transaction::eip2718::TypedTransaction; use ethers::types::Eip1559TransactionRequest; use ethers::{middleware::SignerMiddleware, providers::Middleware, signers::Signer}; -/// Submits a signed tx to an endpoint, given a wallet, a data payload, and a closure -/// to get a transaction request to sign and send. If estimate_only is true, only a call to +/// Submits a tx to a client given a data payload and a +/// transaction request to sign and send. If estimate_only is true, only a call to /// estimate gas will occur and the actual tx will not be submitted. pub async fn submit_signed_tx( client: SignerMiddleware, From 70a43209bea4bc09e01dc4e9f777746520df3224 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 4 Aug 2023 16:33:11 -0400 Subject: [PATCH 24/58] add in custom wasm file param --- arbitrator/cargo-stylus/src/main.rs | 5 +++++ arbitrator/langs/c | 1 - go-ethereum | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) delete mode 160000 arbitrator/langs/c diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index f70fd9d11..fc4d2e07e 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -66,6 +66,11 @@ pub struct DeployConfig { /// If only compiling an onchain program, the address of the program to send a compilation tx for. #[arg(long)] compile_program_addr: Option, + /// If desired, it loads a WASM file from a specified path. If not provided, it will try to find + /// a WASM file under the current working directory's Rust target release directory and use its + /// contents for the deploy command. + #[arg(long)] + wasm_file_path: Option, } #[derive(Debug, Clone, ValueEnum)] diff --git a/arbitrator/langs/c b/arbitrator/langs/c deleted file mode 160000 index 832ba3aa6..000000000 --- a/arbitrator/langs/c +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 832ba3aa6c06835d9a11744d347a9c91ac2bb1f1 diff --git a/go-ethereum b/go-ethereum index c51d75b66..cf4ad8f29 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit c51d75b66a83c523884123b1d4a7e28170b340bf +Subproject commit cf4ad8f297b845569b75f860f1106e3b42c9d53e From 9fcde5e237488246f6047f32b3635c27df89d5bf Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 4 Aug 2023 16:33:59 -0400 Subject: [PATCH 25/58] update --- go-ethereum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go-ethereum b/go-ethereum index cf4ad8f29..c51d75b66 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit cf4ad8f297b845569b75f860f1106e3b42c9d53e +Subproject commit c51d75b66a83c523884123b1d4a7e28170b340bf From 3ebcacd2381a8e066dbb964fba9907920e499a6d Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 09:55:22 -0400 Subject: [PATCH 26/58] optional wasm file path --- arbitrator/cargo-stylus/src/check.rs | 13 +++++++++++-- arbitrator/cargo-stylus/src/deploy.rs | 8 ++++++-- arbitrator/cargo-stylus/src/main.rs | 9 ++++++--- arbitrator/cargo-stylus/src/multicall.rs | 1 + 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index c3d6dbd9d..f3d51daa6 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,3 +1,6 @@ +use std::path::PathBuf; +use std::str::FromStr; + // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use bytesize::ByteSize; @@ -30,8 +33,14 @@ impl TryFrom<&str> for StylusCheck { /// Runs a series of checks on the WASM program to ensure it is valid for compilation /// and code size before being deployed and compiled onchain. An optional list of checks /// to disable can be specified. -pub fn run_checks(disabled: Vec) -> eyre::Result<(), String> { - let wasm_file_path = project::build_project_to_wasm()?; +pub fn run_checks( + wasm_file_path: Option, + disabled: Vec, +) -> eyre::Result<(), String> { + let wasm_file_path: PathBuf = match wasm_file_path { + Some(path) => PathBuf::from_str(&path).unwrap(), + None => project::build_project_to_wasm()?, + }; let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!( "Compressed WASM size: {}", diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index a0a8ba1a1..1743637ed 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1,3 +1,4 @@ +use std::path::PathBuf; // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use std::str::FromStr; @@ -17,7 +18,10 @@ use crate::{constants, multicall, project, tx, DeployConfig, DeployMode, WalletS /// CompileOnly: Sends a signed tx to compile a Stylus program at a specified address. /// DeployAndCompile (default): Sends a signed, multicall tx to both deploy and compile a Stylus program atomically. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { - let wasm_file_path = project::build_project_to_wasm()?; + let wasm_file_path: PathBuf = match &cfg.wasm_file_path { + Some(path) => PathBuf::from_str(&path).unwrap(), + None => project::build_project_to_wasm()?, + }; let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; let wallet = load_wallet(&cfg.wallet)?; @@ -77,7 +81,7 @@ fn prepare_tx_request( .to(to) .data(compile_calldata)) } - // Default mode is to deploy and compile atomically. + // Default mode is to deploy and compile atomically via a multicall Stylus program. None => { let program_addr = get_contract_address(wallet.address(), nonce); println!("Deploying program to address {program_addr:#032x}"); diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index fc4d2e07e..3835af5c6 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -30,8 +30,10 @@ enum Commands { /// checks via the `--disabled-checks` flag. #[command(alias = "c")] Check { + #[arg(long)] disabled_checks: Option>, - output_file: Option, + #[arg(long)] + wasm_file_path: Option, }, /// Instruments a Rust project using Stylus and by outputting its brotli-compressed WASM code. /// Then, it submits a single, multicall transaction that both deploys the WASM @@ -95,7 +97,8 @@ async fn main() -> eyre::Result<(), String> { let cli = Cli::parse(); match cli.command { Commands::Check { - disabled_checks, .. + disabled_checks, + wasm_file_path, } => { let disabled = disabled_checks.map_or(Vec::default(), |checks| { checks @@ -104,7 +107,7 @@ async fn main() -> eyre::Result<(), String> { .collect::, String>>() .expect("Could not parse disabled Stylus checks") }); - check::run_checks(disabled) + check::run_checks(wasm_file_path, disabled) } Commands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { Ok(_) => Ok(()), diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs index 1fd194dd2..f15593bc9 100644 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -43,6 +43,7 @@ pub fn prepare_deploy_compile_multicall( H160::from_slice(&arbwasm_address), compile_calldata, ); + println!("{}", hex::encode(&multicall_args)); multicall_args } From 5d3735d492fe36efaacd6ff870802a0d7d59e9e8 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 12:59:06 -0400 Subject: [PATCH 27/58] add in test --- system_tests/program_test.go | 90 ++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 7eeb47121..8db2c0bfa 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -22,6 +22,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbnode" @@ -327,6 +328,95 @@ func testCalls(t *testing.T, jit bool) { validateBlockRange(t, blocks, jit, ctx, node, l2client) } +func TestStylusCargoPlugin(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) + rand.Seed(time.Now().UTC().UnixNano()) + + // TODO: track latest ArbOS version + chainConfig := params.ArbitrumDevTestChainConfig() + chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10 + + l2config := arbnode.ConfigDefaultL1Test() + l2config.BlockValidator.Enable = true + l2config.BatchPoster.Enable = true + l2config.L1Reader.Enable = true + l2config.Sequencer.MaxRevertGasReject = 0 + l2config.L1Reader.OldHeaderTimeout = 10 * time.Minute + AddDefaultValNode(t, ctx, l2config, true /* jit */) + + stackConf := node.DefaultConfig + stackConf.HTTPHost = "localhost" + stackConf.HTTPPort = 9999 + stackConf.HTTPModules = append(stackConf.HTTPModules, "eth") + stackConf.P2P.NoDiscovery = true + stackConf.P2P.ListenAddr = "" + l2info, node, l2client, _, _, _, l1stack := createTestNodeOnL1WithConfig(t, ctx, true, l2config, chainConfig, &stackConf) + + cleanup := func() { + requireClose(t, l1stack) + node.StopAndWait() + cancel() + } + defer cleanup() + + auth := l2info.GetDefaultTransactOpts("Owner", ctx) + fmt.Printf("Owner %x", crypto.FromECDSA(l2info.Accounts["Owner"].PrivateKey)) + + arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) + Require(t, err) + arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, l2client) + Require(t, err) + + ensure := func(tx *types.Transaction, err error) *types.Receipt { + t.Helper() + Require(t, err) + receipt, err := EnsureTxSucceeded(ctx, l2client, tx) + Require(t, err) + return receipt + } + + // Set random pricing params. Note that the ink price is measured in bips, + // so an ink price of 10k means that 1 evm gas buys exactly 1 ink. + // We choose a range on both sides of this value. + inkPrice := testhelpers.RandomUint64(0, 20000) // evm to ink + wasmHostioInk := testhelpers.RandomUint64(0, 5000) // amount of ink + colors.PrintMint(fmt.Sprintf("ink price=%d, HostIO ink=%d", inkPrice, wasmHostioInk)) + + ensure(arbDebug.BecomeChainOwner(&auth)) + ensure(arbOwner.SetInkPrice(&auth, inkPrice)) + ensure(arbOwner.SetWasmHostioInk(&auth, wasmHostioInk)) + + colors.PrintMint(fmt.Sprintf("arbwasm addr is=%#x", types.ArbWasmAddress)) + + multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) + t.Logf("Multicall addr %#x", multiAddr) + + wasm := readWasmFile(t, rustFile("keccak")) + programCreationData := deployContractInitCode(wasm, false /* no revert */) + args := argsForMulticall( + vm.CALL, + common.Address{}, + nil, + programCreationData, + ) + arbWasmABI, err := precompilesgen.ArbWasmMetaData.GetAbi() + Require(t, err) + compileMethod, ok := arbWasmABI.Methods["compileProgram"] + if !ok { + Fatal(t, "Cannot find compileProgram method in ArbWasm ABI") + } + compileProgramData := compileMethod.ID + programArg := make([]byte, 32) + copy(programArg[12:], types.ArbOwnerAddress[:]) + compileProgramData = append(compileProgramData, programArg...) + + args = multicallAppend(args, vm.CALL, types.ArbWasmAddress, compileProgramData) + + t.Logf("Multicall full data is %#x", args) + time.Sleep(time.Hour) +} + func TestProgramReturnData(t *testing.T) { t.Parallel() testReturnData(t, true) From 720e4a6742005ad9aaa2b1aac996743b3b39fa30 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 15:50:53 -0400 Subject: [PATCH 28/58] ffix up --- arbitrator/cargo-stylus/src/multicall.rs | 15 +++++++-- arbitrator/langs/c | 1 + arbitrator/stylus/tests/keccak/privkey | 1 + arbos/programs/native.go | 2 ++ arbos/programs/programs.go | 7 ++++ system_tests/program_test.go | 41 ++++++++++++++++-------- 6 files changed, 51 insertions(+), 16 deletions(-) create mode 160000 arbitrator/langs/c create mode 100644 arbitrator/stylus/tests/keccak/privkey diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs index f15593bc9..81702d659 100644 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -29,14 +29,23 @@ pub fn prepare_deploy_compile_multicall( compressed_wasm: &[u8], expected_address: &H160, ) -> Vec { - let code = deploy::program_deployment_calldata(compressed_wasm); + let compressed = hex::decode("ef0000001b1f5c25d36d7228b78348527047cf06d3e03c406151f78011a9357322aaea65819321826e4f5bbcdbe7e152abd7ed20c672cad05f6cb463c53627ab66391e2b340ea1b0b0b86a21ca67a375380a6acd0235df0fb8af8f82a615d4baaa6c95ca0ac5be8a6375fdf8190b2fcc1367803b395247a2ff6fceb77b25d991e135fa804e1b15719097b3054c06807362950701321d605c2278d0cedabec080876d81e40ec4f3d512eab7f896244ddb99dd7f8ae7e1044620dc290bfcffff3bcbde93545d4a5fa9ad611764663f0d395033eceab04e2d742ab5aaff06a8bf02cf21757b39613be000d630c0271042116b3a8965216fd7955d48f55a562aa4fe0b4b7a74e702482acc2fcc7b21c5499eecd84ed33ee02a824fc8081f60636c68e1fd529223c00d8cd331d40ed1e7f4f7aa96ed7f0f80c0bb2ce874778ea14c450351b4af74ec0ae1bf0f2cf83f008e006803406977494a6b864ba276778eda40721315bc43c9490e31771773e5149ade739d7bb7aefa10a777d9baa81bf3f0b6ab02c5d464f76ab1532ed98f5fa8a68936556a22fb6ffa3f9b999dd950bbaac72364b874054ef23679bf94a2e8aaaada7575680ec6a2b07c0b0fff7f697adf09484e4007074052da7f9378f752b735a7b5e012aedab01d199f03716adab4afc1a49b8bfc56444a44e7be4040bd4957eb41672ab3a1d63897777ca53ec120045d0bf233c2eecdc104c0cdb3b62ecb92655b5d3396c83bb7ec02ca914a57a69dcd0c4f0da04df48763576da3ed3107b7c2a2488e4c843cb965d5fb1e090556b9e502438a111c82cc96b2d5e5bf5e28bd8e69a29860ad16abd8da3849b4b25a51a994511c93044890852985ef3f8d897818fbfa224d301ed625b7083d6425b678e8b50cf41ab52da2985ba690d849b60c771875f99be5b3a3b396515be84f5b2dfb9c6678f95e9a59eb7fb01e972d63ff9ad654324c6cc10c50a56118db85a5f9139a872febb61f06fcfee416ff849ff874f2d03fac730a7ea81e563a13f4b840d23cff37993dddda72ed0258be5d103cf61cac6e9e4ea72e5024065670218540da5820b642eca2fe1058f5d652fa5350f180032a23c0aad85a32634ca9be2330a0e0a3d652ee89a0eefadc74eaa410880d3e1660b85ec9ba44ff9fba7aca0c413d93f91d0f38d655ade2ea16f096ee72f2af549a4cfcf576af2c3ad534137d7b5863edac6fb8a70a405885b71aaed8bd29f91f47a34e44fa09a775adfdf86e7dbd71ed7fddaa2addf61b77a9238e7a0fdb97c627b8331e81a81b33ba6c72713aa20e4fbf2fab133158ab9e7a7fe10f73548094ce2c695c6faca3afb12b10e4a5ea46bdb1386f3b2c9429f729a3f487cca6415e2abce118a55cd47bab0ceaa62fda2a823d563a13dc27e5acd1a253afed3d733e9f00cfbdaf88ad4d45468e8269d7084185974c09a0edbb5ad2ada77495837f32184eda78b9a7c2e9c9f2dc03c272c5c8e5c8288f9d9e15cb44c6345761fa39472f85eecfde9ebc746238851e572f9089a7de434354bd42e647283d8b294e4f711f35f6b88e8d41274fcbb387e9893b47b65d14f69fc7a11b46042bf07db9d29b457d0fa5a94f52e33c5bc635bf7e58de19ab561c733332de17c6d4f728b270127a96c38e1bb56c7c4dd373378480a53e55dde786396707267644536b2db58937d41e45f15aa517c2c1bcdfe16e0998708a44a47331e395503a2c67061a097159b5b568335db65bfdcf23a6cf82a7037b29677362384cd37772b568b8366d0778f93d22e95b163ac6b58e03277ce52738fb830dd09bb91377aac984995ef90c8a647124e3f25a6121c19f23050ab2e7b1cf3140d196f25879e78deab64704d5a618ef4504051a0c4410430d2c2490420639084c803a38e8837e18804118826118815118837128a00113615251b3317f1d2b64a58b630df1615afacc1ad29edf7ed290dca479fd7b926493e4fa90b3f55ceb7d13c34a1a8378ae3007a93f2aaf2e7bb7ee9935a8d5d5b960915a61a110449c21bc13acb24c21f1095d78c31effffec9c42ea6c088b044f3a64b71e84f5052e8fe7f76c7212b75a8eb187c80a96e5613271156ad66505fee1f0b83ef3e5be272ca5fb1eb3945dad3733ab4102ec7d7421d6688c62fbe9a5c73d5dfd2b20b3b92c166d0d485a102cb0c985cd8950bc62f59cdd5f0afba7f7ee05de1812e7ef06698d8b2facbe4265c393b9c49c634e31c727faf98d1d3c5d77fdd99fc15c58566a76b2a4ef6e055747f5b67f7e6a3dc61ed8e9cf0125151399714515e2523a535195ea5b029b9088ec87ec1a770046dfd09c5de89d7c5f8d92354d591995398a58e2a2a352d7ba40b4a64d501ef27ac944ac465cdd398f8e7d56f31affd19d739df469cf090a86900717c1e0fe8c50f98ac072f2c567aa64778c4df6e4f7505affa2c1d865d3a70b9a99271fb8f388f9ca06751df4dcb67cf438049e1c2c6fcace246a735cbb109cb60d566b60541d26ca55d55fe878b6f0062bc96f0b117573eb3b2e76853617aeef65b94c27f097f18876277cb7966493343a5d77d75c2f16f4a6aade5364f5d20b3e3e57595acd9dcea26515be37581ca041ee4827f94b7f377cb18974dad8f8a41c3ce9dc6c3507618e5c392b54aad845575d02047be8a9c7c7e0317a0c0fe3b00eb341a386dbd8d6368fe0888ef0c978b29ecca338aaa3bc1017ea425e8ecb7539afc495ba7266eacfd353df7ac6aaabbb4dfc2475928f921ee4474586be7832f784146dda7f30ac3792189d0e87f541127fedd7f7eadc55196c24229668f307c642277938ecbf39b1f1cc8d11c361065d53f0c7a045be991f25bf4ebf2a2ba550aec33f3ef7eba62cded8f98d9f71976ddef1967dbef191637e6c8681736e1b0c4c5cae19475aee99465e9e994759de59465dbe59475b7ed846df7618d43ec632ce31e632cd39d632cf35f62c23f232f595f00161fe741714b4cdd36058b9114c88659fe12a5d08e60b150463951c825eed4c769718a849c7465da61f3eb560c17b9e8eb3b7e4e9c2f574525d0fe4a4fc940f34c75e842cbb1c7eb2b65158a0f43f24a3f2f7813abb1023590d9a563758febb80b67f1bd0c98ea29bacc3af6755c1f7df040cfc2930cc9e8c51b21ef3c6561e12ff55c0d4ba92cc3a82b9d5a338fd5fb950aa773d5669031efe0cf7c19961cfea7a8dde4e4139239f91cd48677533ab5be259e8a098603d1833f40c35ab7b9a357a3bcefb00209033f8c2a6742652ba53cfea1af3597b39d9017ad8bd98644634239c11cc6a93c8d48ff0fd7efc2f6737d112d8d897e909140493fec227bbec3b044ec3adcd8cfe6e7842408d727add2dd0e3803f57b4442cebadc30a3e85c3d46cd5ed06a9b697ac4b453b498fc7a992e64bd03c1a1c6681c37833768c1aa3281b83d634953b1142120d4bd3b2163db6edeb87370b020b3cd1846e6d31bb1c3f2578b4dcd2633f94b36b5631090deb43418d9eada5d9bdf9ae9cd50df0efad597d385bd4b49cb94e7de5d3d2afbbb5ebb64de8119f56fae12bd3a91b387d76558941facbf1d47dc899610018bf0e98b245b13ebed42b8648d8756aa0de059709d05c9fb1394062f5030d762fd477400dc20813b1d3888a56cdbec73c6d8364cb9e2c7f6f02a3928d56253108c38b5fe52164917f05fd84b28082444f194e906fc2b2e6f4292a4f86381e2389dc9cefaae6e46d49578e821787f95119f34309e47e72940bc18c86155d343f9534f9a28497cb41c4b6d6a546d81dd15f553fd1b0ba6aff167ff3e96fd904fd9a4bab67d71f3ce834f0c69df6cc95a661e9d58bf3e17936a8836f303a0b2a014be11b0b89b7029af95271c96869b2cbf3b24d749d037b77c986ec3c779f2702d573572aa7aaf4456662d5b44d41f769a0df92a23a062ddf62461a4b717d1af5d89a43eb961a6c2fae236d4ccd8a2dd27acc0ed40b0e98aecfbb08a4f80577c677bfef6576858456de54cdbf2104dc70339d316a8ed27a889ca72546f1eef0f478203093b7cca362430ce049e5abe7001db4734edd19cee60c3b617355cf57a603f9ea86bc0b1be1be3d4ab2af472fd77a5da81f5cec3b1da2df91562fc89d1ffe8c679c57edef8f48f2cf982e5bf3638da1df38d89bfe69805ead4edc935f4059143aae4542cf5ddf58e9766f4884b06e2ab8816a6ef9f9d5236b8bdedfa21403d9f1510cffcb361047d76e1a2913d0105252a3fe18c1e85d3cedb172fe2b5d242616e7aadd968f9c384ee7c7871b14b5a4c7722ca4db23c7c6fd6fb42b0b4a2f3143bee023945d8613e35af764fa1d65d2d8eaad6a948ed660b50c46e7e2861949e59488168e7fb54b0693e72b794ba0012647ee659642013abbba61003a1ce79475c3ca64458da5ad14cf448e732c044b6649be8c656a96c562c1fa282e8fdb336654ff8491d1495f534522caaa6ee6a368a1d76c0a20799f3919481f2c9ccaa88bae1836d6ad1b80e2a348fad846065014da2ac282fe3ca0f7aba09aade47ebf20c33180a341f3c692d2a62d19ee8da1b1add06fdba40807844a060692f65f9458b59631ea73eea2edc7d9e0e06c97650c6bf145bb043c2b6e596cb51eff9af6fdd2e9c94309b4dce4d86d2d0c65f0bdba4ce6150580a4025d823e17c760c2fd9ced74f9debc66b32c2f1ea85eade5a27bdcdda48d276c58c307de88402e86eda530e019d12beaced839a2513cc0b4b9f1b342639438beb6d9a6d4dc2c468c103a6da271dcd6997cb4a6acffc6dc2bbd4e1009cd5e239c9240911af1e746bde0bc5e13c735eda5ae22cb56713db41468c738623eb2ab833e46f0b4c652d4c841e271188b25380bd8281ba39d5f6ad09e2befd8e0f0e1660fab7dc76ce1615244cfce0d718e0056384430e6f6561c9025712a65b2b3328ad99e0832f1bc7c47c69abf2fe9ce904523377e460d959b53547908c88d9c0df912849e57f9cca345617aed6f7aa9de28fa3502095f97d744f07ca7e883a84e7f59d786583f7ed5bfa3745794ecd85d77cc6c4af1b4bc46e98a03e69113c1cc7a488f1e8c2d7aec81d21b6928b2736c3ee4266df60d916b85458251fe2108028f18876170a5ae3c0eb8644e6288d89663128ea0a76c56562b91a2b7cd032c3dcc8ea4c88d912ae2106dd3b4c80ce4d5df22664ef9a0e883f865652331b598a25c837f01d9149a1912065978745f0b48ba84355bd14b410424b2a71f3a73229c182fcb573b38053c8fe47215872974d6eb6482c274eac33719358bda7365d2e35ef704e5e27751b70af4f42452a9abcf3904fffdf0ab1ccd59950b6cdfdfc1248b68718550b5717311bd28ff5fe8d06a44e72b2bbce5800c6b9905d63dd070539666b64dba6d9771f8fea1aab0a6185ef6ed0dd0b87adb8ae60b8b130c84f24d12bf613468c0e8dc34e0fa04ac400bd0229924f08ba1913a5c70928d079829280b733d0b439434cef0ab6e0acafa8b98f9c85b47e9b6dc128963339e85ad5d9eeaed97c41ba9200fb30ed7ac2c9a59b1e2594b799e89b7f14972aff4f8ceba37224247d99f1d54cc99007c685f80e24a4472a51b8082228a0aad47155a32a8ee48f372ec23f705000e69b23d94d8ff682877519d98b973f42de3a59de28009f12164cb01d6242a8bf6b21b02079604beb00c8b03aada5e64df6f78b03f420db2ee8a6494e16da5dcb269ddf3f50dba97b51fa8f24d0544929248c58f414b8b3a2251f34c285b52d53ce4b4bdd508ed84b9bab6914a633880598219279a45c299269e55a29927994de259269d5d9259279b43d2d9269f53b2c9d7059dae3016abfb4ca9a5638a39379603042dd7540b46eea917ac3cd32c3879a75df0e39b6ec1c70f3d2e45950d2bb9d2d92eabecb2ca2eabfc1a74d3c40b54e64916982c932e7059275b10b24dbe20659f6241c931e5829673aa0523d7d40b56ee69169c3cd32ef8f14eb7e0e39b1e97a22a7a74537e3fa9fc015600bf166442d09af427ef0ae26df90b58144170d635a8ee44e6c9e5617cdbfbac3aba037b544e83544fe5992be284eab3d81015dec8db78c905ef9a55975ee9d75a9be27417a889ae68de4a75ed7870ac22b2d03551bd7fb66796efecfa9def886bb7273b32632dde7e42093271d16ce4cd2a69f20c4a4ca4b26aee529094298125baab0d591be0f3b5a3e1f2f2e536e6c0b9f33240918c58936cf2ccd92fb24be47391e039e73ed8348dd15cb94c3dd1781a72bacc39d7dc9d5d6bfec0628a46ba228d2e84408b72e66c07ac46fc8ce4dc2bfe185ec4759ec13fcf166fa8eff71ea115f8cd15dcf103bc31c02bb046a29a277ac39adef88e75bdf3031bfae02736f5c92f6ce98bdfd8d6377fb0a31ffe6257bffcc39efef88f7dfd13e0408010878244381222c6b130094e4448712a4a863331729c8b53e04282129792547025852aaea552c38d34f6089e8e459dce33b0a4337826967526cfc2893a8b67e3c1ad71e52141d67f3de73592effbb547981cafceb9ae3f7d2c39f31ff899eed7a3ba47b5c297f51d249eceff13f57c2aada917b927867ac16f4aa19ecfa521894e7006bcf85ffd527afc7b5d65f498b2ba259c39d8f2cd9774cf5cd210eb07f4500db5fc228819bd20e3ce16071ab096d0291042c987877ce862de5cf509ea96d77234a31077b9b9f54530fa91b0d0c2a752728574c74961e0f7bb52c51cfdcfd3d25f1888d3f9391369eb08aba9a1c1381a33c9032ecf8d8a719eec52875b27759dc7439bb028e99f75370e55a4861134acc90355870fd68a2f072d9d078eea6c272148ec8862308042ee9820a3148979e8dd8b61e41369c8c273331017de0c32fa35f2bb930c16394aa1ba6c27de782d729e9b40379b1ec449f392ec4ae0c382611a89e9a677b038f9b2998ecd748ce8c881ccb4d0cb4839f6ba0b8ec5a93f2efcfc04e838a035eec45d4aca5d41c4f52617db7bb76edf85d05599c9a08c3ff7f548722bb3786750d36d75bd3800c0adbdc6a0c70e805701787fde2f5b2a4291642909475e2f38058844e999ecd2d7a348add74beb1e5358a259c244c0dd9d9742a58dd3b2ae4547755a26e9cdd15304787a946bce984ae5821406a71b6e11007fb364b38b53ea1bb614217631225186c2b618ba15e58490d896e8a94606b151d83735e21957ad25d1fd2334ca444aa4bedf9d3634645a948dad08553018388f52227cda5e667f5ed1e7f5815134cdab28dd51175f0f851a7161d38dd65c9259368b31bd458d8969c3e809a34b4fc71283970740e7f1222985b3b998df3c2ecd25d9b069b4ee739684febc1d6867286afc1cbe8967f5d29eb014520892f2e058d23c9e17cd1eb8c074df6e09eb3a10ef93354a2242e02f81e9128469e6ff1319a14ba9cfa46afec7672bf05d2d42ef32b3a0524c5de818dc6b92888ac4c577f1514704121f3f948e870fd1b10e965cc4c564b75de862b679a73d79cd87816968701a6abc08baef3311967f585da0f23e2eee632ebcd51e1bcf23ad4b8ced82ae828d7e7f56a57a83f654818828e8bf22eb4b96bfbd5bdf8fbf7bb6e86e7f5bb668b7bfac2dfabbfd5db0b92a3d7fe0623a299cd99398e805ea14bd08cbc3b22dfb42cdd58f5f5c14174327950203b332d871b07ac7fb334b9c156eedab5fbdf8e2a797fd2c94d671e08937bcf9363b977e32427775377b218602e8bb52e9c8e486fbbde3ca48c7b4396dfc427bb6f75e095a778af53f74a31b79ac7a5a691cca9f902b3d09ab1d7f7e61e51ecbbdd3ea615fe055d70c067b791f21d052bebf38a6dec2177d31e866fc3204da34da0d5df6bc8e2f27d6490847a2371582485043ef18c7fe490850271845f2958b51486f0f0e7b06bdb501bab797ed9e26d305c5553815ae3e8b1713e0335bcec2bd058ee27ddd6bb3d6da6f76e59bf2748f5a3b0b70158fb2c738402ab287dc9b9304493eb2ceaf386cafbc23cd475b318de963e4aa7fd430fdb36b474fd92bd70273afc6806136329c5dbb252852b39844dcd9c2b9f5557b60c0c35c86dce0c0735efa82961bddbee0dd3d9090c241526e48d1aa3dc9133eea4f12fbbe0733f11ea7cdb7ab441630272db014e29d1b17b3f06a531fca48654a40cdef65e95c7892e158b8f12681f65e2fdc15db69053a3167faf06264764488191a99fb3d46baa58470843c7147e172cea84392a0a7c6f14b3562946f3c28738258276a3bd2909f00379bde4cb43408dad554e8a043ab84e00c92110e91fd6af6e81010fc9d0151a7555d5fedc9072989b24b97c304599bca487e5a235263c265239b36465864438aa8e7ffab0d8afaa6c5ba972b35e29324dd57fffad6af83eac1a1e24bcf2e8c554c2587a877118429be6af04f686d9c563c1ebb74d9cd791bc89e2dd19cd7317fe24395a8db45c16ca5d8bd843b24149fa4bcb31db75afaef7c82307105d2767671dd38193abc1b8272c7e3771345127b823660430df0a6fa3c89d946c6b58adf869aceeb53ecb81760a0e08558db57123f9464ca60e87c3fe0d3f266da66ee9dea422a2362a7269290fba8643e2a73efe601dbfcdc0e743bc39ab9798279d030270f722ae86f9244eb2532cb6f74b382845c5e076fc183070e2536ef00a8600b727b3991cf728703c3ad4586373fec2e37d02528bce5c231bc10c51400c34ae27c724509931940dc04a813a93502515a1f26691e656ce621575d382604ae20a10341bc23d008060099b6d769b273bbbf3b49279e07aad77d9bce3e31e70f0e2c5e2a7d3a7af15ab8d5b3d580d2d141d7c0aa02848261246fe5dd557f0b08c46090b4bf872a08488f68c6e75b3d31dbd8c97210e56083dbc24423668b61869c67a3458a45595c976463f678633c9562911462601b733c4eacbc630ab229c91a158db2d2e567e366f74f16427f176151b234f02aab2ad5d044ce7bf3c0c655695da45c21625255c7b6740be5d3eb317b0fa5de25de38a9255f176bb9bcd19793aa564d419e79de9b08662616d5cc1c21df3223d0d801fa330c8e3cfdce878c1edac6c1c19b0d2cb327ef7293fe0ba54717f360a9273ba224e5cb3bc07bf5b25a2896d15e624afd57296a446868d24a9f4c81d4ef3f4186afa4731ced3fc6db6053cf60ad93ac963090747e61ababaa0647e73f48aa59a29d8e5db2e36677e0570c45b24776c452b9fbfcdd9c0f03ee50f0009e4151c2bb2584276d72eae8039c0261e4db2895df242e188930d9d6b783c214b9dda69b87a7183954f3c1f0f29b7e765046feb4c547089d215108d101c2eb94a775caf3def42d77bcd57fff1c1b87861b6ebcf9cae1fda39389ee28e798edcfaec002afee081bd408bcb7324b9bd875f03319c2d3258ac6ea8088809eeeb8ef0b136b728a33772a166cc7a8388c922053fb62c2a70564693e88a3795181653ac6a2c16e929506b14ee9cfeb1ea0f10e55eea76ee405ecb0de51d085dda41c5868f9aa260f4bfee8e774383e6153bc5c7c7d0762e4c76ba3ed96c4fb0be0d0746358543a19e6e384d9acd269360ca6213d2911abcef303f1f8553b64cbb592f5b31afed8296482c0f52de8517de16828dd43a5745691242add053dc2a034cf9f33e6062aee4a58bdfe421f637295701b2df028c4f8483a58fcd084425bb19609347310f2a526f6dfcf0b9707d6d78569f395fb889e8198fa8aeceec4fb8b11fdbd9529b35f29d2e3226f222f2f3c6f1e2173ced987129f4dd40c91ba9ed21750a3ae099d2a036b58552d7bdab38c265fc670abdca7b1755b89482587d9f1b98a57921d585e21e4dc98d2d011be3c90c419595f379f14d56226a4eb1b396d5c589925360f3ec973148b21d7a330a210038c2a92bc0e232a56725d01d9bae0958e1146a0aa067c69e8b1cf257e6e0266df48d4f5688c07915043765509918b454f54469e74284ac5aacaa962a5946d82d3630158442219e36cea348c74ee22a162b98cba58a9d4a875cc4ca112dfd976b6cd2449abaea6bf9d21465b59e25c12090c734db64255bdcbeb509bc6f9134e5897bf8ff89a9a62dc3c2382fbb11d35ed7d1d46d9bf397aae7664274c5a40568cc10e067618d55b7533a3439ac4f8813e8b22efd7de77ebc7129f4f2450552727401ba141c585a663150922b11c125e4f24ec0be560430317c940306f891a8aa22cb875f044938a1e41ac9715b7851c57f2ca6b6d0ab496e04b871d6da9df1e171e4b078dc399dba446ebfe157de544fa2da907a3734198210ef24abecec37d6a060465e2f4ee4238e7ac093891a26910598cdf73b0f77b9fa69f20cb8f73a71896a6d48a89e480934084fc621427a963484cb41a1685f30a8d03dd8d74228443751292eb5b67050d326da0101abdb85f2f95541329c44720436cd8ec2f5f9b2e41c8aef90f07859afd2e344f65c8da659727281969210239df3aa1a67640caca891fe8338a0a207d5297d2b62d128c898f98b98f00eccef7bd1a60080ce5f5f79c4636ac9b0500efb037c04d0012008b08655c4845d52cdb713d7f0b8011c10e9840c277c7b9b27c2ddfd421831c1a9e09387b62f4f5250ae2c8f361bbe7accf05244097fcab50ec469473e2738e3306a3f71c58372c718fb9dc59003eec3d3593cfa0902b886067a885d8f37129804d36c990348eb91785359ec79c05ad277c70ebc7b48289a3e4ed6b7722dddc75577bf20263004e64d00fa7430e17832eb4715eaee031605a43336670d740eec703a79e7befee7afd9cf14cdd5a3f6b51de654faea034bfc21d7878be6a9c190c1bfcff3d9ecc4ee7e6310008c10816c5e1390449d10c97e5f1358228c98a56d5e93d8669d98ed7f5f9334118c54936cde57716cbd57ab3bbdddbef14655537ddb6d7bf391c4fe7cbedf5eefee7f17cbd3fbfdfbfffb70c0ec3acf5b768f83d210af943a1cccb9cb08675733e15f01d0eafcf0440cb131f9ebe95f039b22f14e97c0ac85c042a916e3d3eb1f276ac32652ffedef9ee563e4919752edc001282762c1997f54397e784c991efdd04bbf6bcbbdb21f92b335c4aef02f2a6753bfede13d3dc39f38bb71b340a5b80497f097f00ce383f0212cfc93e92000ad7464ea74e03f604b0fef2aa3c13d8d63e0f7af6e9f0024e6608a9ba7a59d04f29046060a77a2e31844b6df4a4104e418427354ea1364dd15c736a10f54238d967a81b435d1d10a67d9ae248de118de09d896101").unwrap(); + println!( + "len = {}, first 4 {}, last 4 {}", + compressed.len(), + hex::encode(&compressed[0..4]), + hex::encode(&compressed[compressed.len() - 4..]) + ); + let code = deploy::program_deployment_calldata(&compressed); let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); let mut compile_calldata = vec![]; let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); compile_calldata.extend(compile_method_hash); - compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - compile_calldata.extend(expected_address.as_bytes()); + let mut extension = [0u8; 32]; + // Next, we add the address to the last 20 bytes of extension + extension[12..32].copy_from_slice(expected_address.as_bytes()); + compile_calldata.extend(extension); multicall_append( &mut multicall_args, MulticallArg::Call, diff --git a/arbitrator/langs/c b/arbitrator/langs/c new file mode 160000 index 000000000..832ba3aa6 --- /dev/null +++ b/arbitrator/langs/c @@ -0,0 +1 @@ +Subproject commit 832ba3aa6c06835d9a11744d347a9c91ac2bb1f1 diff --git a/arbitrator/stylus/tests/keccak/privkey b/arbitrator/stylus/tests/keccak/privkey new file mode 100644 index 000000000..e1c9ccb4b --- /dev/null +++ b/arbitrator/stylus/tests/keccak/privkey @@ -0,0 +1 @@ +009f3fd6848015f83b9210c89f7744e3941acae1195c8bf9f5798c090dc8f497 \ No newline at end of file diff --git a/arbos/programs/native.go b/arbos/programs/native.go index 797c43abc..a315cb04f 100644 --- a/arbos/programs/native.go +++ b/arbos/programs/native.go @@ -19,6 +19,7 @@ typedef size_t usize; */ import "C" import ( + "fmt" "math/big" "github.com/ethereum/go-ethereum/common" @@ -98,6 +99,7 @@ func callUserWasm( if status == userFailure { str := arbutil.ToStringOrHex(returnData) + fmt.Println(string(data)) log.Debug("program failure", "err", string(data), "program", program.address, "returnData", str) } return data, err diff --git a/arbos/programs/programs.go b/arbos/programs/programs.go index 4289c2423..ed5b59e51 100644 --- a/arbos/programs/programs.go +++ b/arbos/programs/programs.go @@ -162,34 +162,41 @@ func (p Programs) ProgramVersion(program common.Address) (uint32, error) { } func (p Programs) CompileProgram(evm *vm.EVM, program common.Address, debugMode bool) (uint32, bool, error) { + fmt.Printf("Attempting compilation %#x\n", program) statedb := evm.StateDB version, err := p.StylusVersion() if err != nil { + fmt.Println(err) return 0, false, err } latest, err := p.ProgramVersion(program) if err != nil { + fmt.Println(err) return 0, false, err } if latest >= version { + fmt.Println("Up to date") return 0, false, ProgramUpToDateError() } wasm, err := getWasm(statedb, program) if err != nil { + fmt.Println(err) return 0, false, err } // require the program's footprint not exceed the remaining memory budget pageLimit, err := p.PageLimit() if err != nil { + fmt.Println(err) return 0, false, err } pageLimit = arbmath.SaturatingUSub(pageLimit, statedb.GetStylusPagesOpen()) footprint, err := compileUserWasm(statedb, program, wasm, pageLimit, version, debugMode) if err != nil { + fmt.Println("Compile error", err) return 0, true, err } diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 8db2c0bfa..4b045de20 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -400,20 +400,35 @@ func TestStylusCargoPlugin(t *testing.T) { nil, programCreationData, ) - arbWasmABI, err := precompilesgen.ArbWasmMetaData.GetAbi() - Require(t, err) - compileMethod, ok := arbWasmABI.Methods["compileProgram"] - if !ok { - Fatal(t, "Cannot find compileProgram method in ArbWasm ABI") - } - compileProgramData := compileMethod.ID - programArg := make([]byte, 32) - copy(programArg[12:], types.ArbOwnerAddress[:]) - compileProgramData = append(compileProgramData, programArg...) - - args = multicallAppend(args, vm.CALL, types.ArbWasmAddress, compileProgramData) - t.Logf("Multicall full data is %#x", args) + tx := l2info.PrepareTxTo("Owner", &multiAddr, 1e9, nil, args) + receipt := ensure(tx, l2client.SendTransaction(ctx, tx)) + if receipt.Status != types.ReceiptStatusSuccessful { + Fatal(t, "not OK receipt") + } + // } + + // arbWasmABI, err := precompilesgen.ArbWasmMetaData.GetAbi() + // Require(t, err) + // compileMethod, ok := arbWasmABI.Methods["compileProgram"] + // if !ok { + // Fatal(t, "Cannot find compileProgram method in ArbWasm ABI") + // } + // compileProgramData := compileMethod.ID + // programArg := make([]byte, 32) + // expectedAddr := common.HexToAddress("0x921bd9fa0f3295c0351164a28ba7c23c343b786d") + // copy(programArg[12:], expectedAddr[:]) + // compileProgramData = append(compileProgramData, programArg...) + + // args = argsForMulticall(vm.CALL, types.ArbWasmAddress, nil, compileProgramData) + + // tx = l2info.PrepareTxTo("Owner", &multiAddr, 1e9, nil, args) + // receipt = ensure(tx, l2client.SendTransaction(ctx, tx)) + // if receipt.Status != types.ReceiptStatusSuccessful { + // Fatal(t, "not OK receipt") + // } + + // t.Log("Submitted both txs") time.Sleep(time.Hour) } From 149646118286e8a3d94ae9d1b2cf9e4d465b47f6 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 16:46:34 -0400 Subject: [PATCH 29/58] fix up cargo stylus command --- arbitrator/cargo-stylus/src/constants.rs | 2 - arbitrator/cargo-stylus/src/deploy.rs | 98 ++++++++++-------------- arbitrator/cargo-stylus/src/main.rs | 13 +--- arbitrator/cargo-stylus/src/multicall.rs | 89 --------------------- arbitrator/cargo-stylus/src/tx.rs | 4 +- system_tests/common_test.go | 1 + system_tests/program_test.go | 42 ---------- 7 files changed, 46 insertions(+), 203 deletions(-) delete mode 100644 arbitrator/cargo-stylus/src/multicall.rs diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 2c54f7db8..2bf1d2749 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -8,8 +8,6 @@ pub const EOF_PREFIX: &str = "EF000000"; pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; /// Address of the Arbitrum WASM precompile on L2. pub const ARB_WASM_ADDRESS: &str = "0000000000000000000000000000000000000071"; -/// Address a multicall.rs Stylus program on L2. -pub const MULTICALL_ADDR: &str = "Eba70C09bA17508c75227cCACf376975490172c3"; /// Maximum allowed size of a program on Arbitrum (and Ethereum). pub const MAX_PROGRAM_SIZE: ByteSize = ByteSize::kb(24); /// 4 bytes method selector for the compile method of ArbWasm. diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 1743637ed..9466156f0 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -11,18 +11,13 @@ use ethers::{ signers::{LocalWallet, Signer}, }; -use crate::{constants, multicall, project, tx, DeployConfig, DeployMode, WalletSource}; +use crate::{constants, project, tx, DeployConfig, DeployMode, WalletSource}; /// Performs one of three different modes for a Stylus program: /// DeployOnly: Sends a signed tx to deploy a Stylus program to a new address. /// CompileOnly: Sends a signed tx to compile a Stylus program at a specified address. -/// DeployAndCompile (default): Sends a signed, multicall tx to both deploy and compile a Stylus program atomically. +/// DeployAndCompile (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { - let wasm_file_path: PathBuf = match &cfg.wasm_file_path { - Some(path) => PathBuf::from_str(&path).unwrap(), - None => project::build_project_to_wasm()?, - }; - let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; let wallet = load_wallet(&cfg.wallet)?; let provider = Provider::::try_from(&cfg.endpoint) @@ -40,62 +35,49 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .await .map_err(|e| format!("could not get nonce {} {}", addr, e))?; - let mut tx_request = prepare_tx_request(&cfg, &wasm_file_bytes, &wallet, nonce)?; - - tx::submit_signed_tx(client, cfg.estimate_gas_only, &mut tx_request).await -} + let expected_program_addr = get_contract_address(wallet.address(), nonce); -/// Prepares a tx request for the given deploy config. For deploying a program only, it -/// prepares a contract creation transaction. For compiling only, it prepares a compilation tx, -/// and for both deploying and atomically compiling, prepares a multicall tx. -fn prepare_tx_request( - cfg: &DeployConfig, - wasm_file_bytes: &[u8], - wallet: &LocalWallet, - nonce: U256, -) -> eyre::Result { - match cfg.mode { - Some(DeployMode::DeployOnly) => { - let program_addr = get_contract_address(wallet.address(), nonce); - println!("Deploying program to address {program_addr:#032x}"); - let deployment_calldata = program_deployment_calldata(wasm_file_bytes); - Ok(Eip1559TransactionRequest::new() - .from(wallet.address()) - .data(deployment_calldata)) - } - Some(DeployMode::CompileOnly) => { - let program_addr = cfg - .compile_program_addr - .ok_or("No --compile-program-addr provided")?; - let mut compile_calldata = vec![]; - let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); - compile_calldata.extend(compile_method_hash); - compile_calldata.extend(hex::decode("000000000000000000000000").unwrap()); - compile_calldata.extend(program_addr.as_bytes()); + let (deploy, compile) = match cfg.mode { + Some(DeployMode::DeployOnly) => (true, false), + Some(DeployMode::CompileOnly) => (false, true), + // Default mode is to deploy and compile + None => (true, true), + }; - let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - let to = H160::from_slice(&to); + if deploy { + let wasm_file_path: PathBuf = match &cfg.wasm_file_path { + Some(path) => PathBuf::from_str(&path).unwrap(), + None => project::build_project_to_wasm()?, + }; + let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; + println!("Deploying program to address {expected_program_addr:#032x}"); + let deployment_calldata = program_deployment_calldata(&wasm_file_bytes); + let mut tx_request = Eip1559TransactionRequest::new() + .from(wallet.address()) + .data(deployment_calldata); + tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request).await?; + } + if compile { + let program_addr = cfg.compile_program_address.unwrap_or(expected_program_addr); + println!("Compiling program at address {program_addr:#032x}"); + let mut compile_calldata = vec![]; + let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); + compile_calldata.extend(compile_method_hash); + let mut extension = [0u8; 32]; + // Next, we add the address to the last 20 bytes of extension + extension[12..32].copy_from_slice(program_addr.as_bytes()); + compile_calldata.extend(extension); - Ok(Eip1559TransactionRequest::new() - .from(wallet.address()) - .to(to) - .data(compile_calldata)) - } - // Default mode is to deploy and compile atomically via a multicall Stylus program. - None => { - let program_addr = get_contract_address(wallet.address(), nonce); - println!("Deploying program to address {program_addr:#032x}"); - let multicall_data = - multicall::prepare_deploy_compile_multicall(wasm_file_bytes, &program_addr); + let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); + let to = H160::from_slice(&to); - let to = hex::decode(constants::MULTICALL_ADDR).unwrap(); - let to = H160::from_slice(&to); - Ok(Eip1559TransactionRequest::new() - .to(to) - .from(wallet.address()) - .data(multicall_data)) - } + let mut tx_request = Eip1559TransactionRequest::new() + .from(wallet.address()) + .to(to) + .data(compile_calldata); + tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request).await?; } + Ok(()) } /// Loads a wallet for signing transactions either from a private key file path. diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 3835af5c6..cfbe0d302 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -7,7 +7,6 @@ use ethers::types::H160; mod check; mod constants; mod deploy; -mod multicall; mod project; mod tx; @@ -36,9 +35,8 @@ enum Commands { wasm_file_path: Option, }, /// Instruments a Rust project using Stylus and by outputting its brotli-compressed WASM code. - /// Then, it submits a single, multicall transaction that both deploys the WASM - /// program to an address and triggers a compilation onchain by default. This transaction is atomic, - /// and will revert if either the program creation or onchain compilation step fails. + /// Then, it submits two transactions: the first deploys the WASM + /// program to an address and the second triggers a compilation onchain /// Developers can choose to split up the deploy and compile steps via this command as desired. #[command(alias = "d")] Deploy(DeployConfig), @@ -57,17 +55,12 @@ pub struct DeployConfig { /// The endpoint of the L2 node to connect to. #[arg(short, long, default_value = "http://localhost:8545")] endpoint: String, - /// Address of a multicall Stylus program on L2 to use for the atomic, onchain deploy+compile - /// operation. If not provided, address will be used. - #[arg(long)] - // TODO: Use an alloy primitive address type for this. - multicall_program_addr: Option, /// Wallet source to use with the cargo stylus plugin. #[command(flatten)] wallet: WalletSource, /// If only compiling an onchain program, the address of the program to send a compilation tx for. #[arg(long)] - compile_program_addr: Option, + compile_program_address: Option, /// If desired, it loads a WASM file from a specified path. If not provided, it will try to find /// a WASM file under the current working directory's Rust target release directory and use its /// contents for the deploy command. diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs deleted file mode 100644 index 81702d659..000000000 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2023, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE -use ethers::types::{H160, U256}; - -use crate::{constants, deploy}; - -/// Defines the different types of calls that can be made in a multicall transaction. -#[derive(Clone)] -#[allow(dead_code)] -enum MulticallArg { - Call, - DelegateCall, - StaticCall, -} - -/// Convertes a multicall into an opcode (byte). -impl From for u8 { - fn from(value: MulticallArg) -> Self { - match value { - MulticallArg::Call => 0x00, - MulticallArg::DelegateCall => 0x01, - MulticallArg::StaticCall => 0x02, - } - } -} - -/// Prepares the data for a deploy and compile multicall tx. -pub fn prepare_deploy_compile_multicall( - compressed_wasm: &[u8], - expected_address: &H160, -) -> Vec { - let compressed = hex::decode("ef0000001b1f5c25d36d7228b78348527047cf06d3e03c406151f78011a9357322aaea65819321826e4f5bbcdbe7e152abd7ed20c672cad05f6cb463c53627ab66391e2b340ea1b0b0b86a21ca67a375380a6acd0235df0fb8af8f82a615d4baaa6c95ca0ac5be8a6375fdf8190b2fcc1367803b395247a2ff6fceb77b25d991e135fa804e1b15719097b3054c06807362950701321d605c2278d0cedabec080876d81e40ec4f3d512eab7f896244ddb99dd7f8ae7e1044620dc290bfcffff3bcbde93545d4a5fa9ad611764663f0d395033eceab04e2d742ab5aaff06a8bf02cf21757b39613be000d630c0271042116b3a8965216fd7955d48f55a562aa4fe0b4b7a74e702482acc2fcc7b21c5499eecd84ed33ee02a824fc8081f60636c68e1fd529223c00d8cd331d40ed1e7f4f7aa96ed7f0f80c0bb2ce874778ea14c450351b4af74ec0ae1bf0f2cf83f008e006803406977494a6b864ba276778eda40721315bc43c9490e31771773e5149ade739d7bb7aefa10a777d9baa81bf3f0b6ab02c5d464f76ab1532ed98f5fa8a68936556a22fb6ffa3f9b999dd950bbaac72364b874054ef23679bf94a2e8aaaada7575680ec6a2b07c0b0fff7f697adf09484e4007074052da7f9378f752b735a7b5e012aedab01d199f03716adab4afc1a49b8bfc56444a44e7be4040bd4957eb41672ab3a1d63897777ca53ec120045d0bf233c2eecdc104c0cdb3b62ecb92655b5d3396c83bb7ec02ca914a57a69dcd0c4f0da04df48763576da3ed3107b7c2a2488e4c843cb965d5fb1e090556b9e502438a111c82cc96b2d5e5bf5e28bd8e69a29860ad16abd8da3849b4b25a51a994511c93044890852985ef3f8d897818fbfa224d301ed625b7083d6425b678e8b50cf41ab52da2985ba690d849b60c771875f99be5b3a3b396515be84f5b2dfb9c6678f95e9a59eb7fb01e972d63ff9ad654324c6cc10c50a56118db85a5f9139a872febb61f06fcfee416ff849ff874f2d03fac730a7ea81e563a13f4b840d23cff37993dddda72ed0258be5d103cf61cac6e9e4ea72e5024065670218540da5820b642eca2fe1058f5d652fa5350f180032a23c0aad85a32634ca9be2330a0e0a3d652ee89a0eefadc74eaa410880d3e1660b85ec9ba44ff9fba7aca0c413d93f91d0f38d655ade2ea16f096ee72f2af549a4cfcf576af2c3ad534137d7b5863edac6fb8a70a405885b71aaed8bd29f91f47a34e44fa09a775adfdf86e7dbd71ed7fddaa2addf61b77a9238e7a0fdb97c627b8331e81a81b33ba6c72713aa20e4fbf2fab133158ab9e7a7fe10f73548094ce2c695c6faca3afb12b10e4a5ea46bdb1386f3b2c9429f729a3f487cca6415e2abce118a55cd47bab0ceaa62fda2a823d563a13dc27e5acd1a253afed3d733e9f00cfbdaf88ad4d45468e8269d7084185974c09a0edbb5ad2ada77495837f32184eda78b9a7c2e9c9f2dc03c272c5c8e5c8288f9d9e15cb44c6345761fa39472f85eecfde9ebc746238851e572f9089a7de434354bd42e647283d8b294e4f711f35f6b88e8d41274fcbb387e9893b47b65d14f69fc7a11b46042bf07db9d29b457d0fa5a94f52e33c5bc635bf7e58de19ab561c733332de17c6d4f728b270127a96c38e1bb56c7c4dd373378480a53e55dde786396707267644536b2db58937d41e45f15aa517c2c1bcdfe16e0998708a44a47331e395503a2c67061a097159b5b568335db65bfdcf23a6cf82a7037b29677362384cd37772b568b8366d0778f93d22e95b163ac6b58e03277ce52738fb830dd09bb91377aac984995ef90c8a647124e3f25a6121c19f23050ab2e7b1cf3140d196f25879e78deab64704d5a618ef4504051a0c4410430d2c2490420639084c803a38e8837e18804118826118815118837128a00113615251b3317f1d2b64a58b630df1615afacc1ad29edf7ed290dca479fd7b926493e4fa90b3f55ceb7d13c34a1a8378ae3007a93f2aaf2e7bb7ee9935a8d5d5b960915a61a110449c21bc13acb24c21f1095d78c31effffec9c42ea6c088b044f3a64b71e84f5052e8fe7f76c7212b75a8eb187c80a96e5613271156ad66505fee1f0b83ef3e5be272ca5fb1eb3945dad3733ab4102ec7d7421d6688c62fbe9a5c73d5dfd2b20b3b92c166d0d485a102cb0c985cd8950bc62f59cdd5f0afba7f7ee05de1812e7ef06698d8b2facbe4265c393b9c49c634e31c727faf98d1d3c5d77fdd99fc15c58566a76b2a4ef6e055747f5b67f7e6a3dc61ed8e9cf0125151399714515e2523a535195ea5b029b9088ec87ec1a770046dfd09c5de89d7c5f8d92354d591995398a58e2a2a352d7ba40b4a64d501ef27ac944ac465cdd398f8e7d56f31affd19d739df469cf090a86900717c1e0fe8c50f98ac072f2c567aa64778c4df6e4f7505affa2c1d865d3a70b9a99271fb8f388f9ca06751df4dcb67cf438049e1c2c6fcace246a735cbb109cb60d566b60541d26ca55d55fe878b6f0062bc96f0b117573eb3b2e76853617aeef65b94c27f097f18876277cb7966493343a5d77d75c2f16f4a6aade5364f5d20b3e3e57595acd9dcea26515be37581ca041ee4827f94b7f377cb18974dad8f8a41c3ce9dc6c3507618e5c392b54aad845575d02047be8a9c7c7e0317a0c0fe3b00eb341a386dbd8d6368fe0888ef0c978b29ecca338aaa3bc1017ea425e8ecb7539afc495ba7266eacfd353df7ac6aaabbb4dfc2475928f921ee4474586be7832f784146dda7f30ac3792189d0e87f541127fedd7f7eadc55196c24229668f307c642277938ecbf39b1f1cc8d11c361065d53f0c7a045be991f25bf4ebf2a2ba550aec33f3ef7eba62cded8f98d9f71976ddef1967dbef191637e6c8681736e1b0c4c5cae19475aee99465e9e994759de59465dbe59475b7ed846df7618d43ec632ce31e632cd39d632cf35f62c23f232f595f00161fe741714b4cdd36058b9114c88659fe12a5d08e60b150463951c825eed4c769718a849c7465da61f3eb560c17b9e8eb3b7e4e9c2f574525d0fe4a4fc940f34c75e842cbb1c7eb2b65158a0f43f24a3f2f7813abb1023590d9a563758febb80b67f1bd0c98ea29bacc3af6755c1f7df040cfc2930cc9e8c51b21ef3c6561e12ff55c0d4ba92cc3a82b9d5a338fd5fb950aa773d5669031efe0cf7c19961cfea7a8dde4e4139239f91cd48677533ab5be259e8a098603d1833f40c35ab7b9a357a3bcefb00209033f8c2a6742652ba53cfea1af3597b39d9017ad8bd98644634239c11cc6a93c8d48ff0fd7efc2f6737d112d8d897e909140493fec227bbec3b044ec3adcd8cfe6e7842408d727add2dd0e3803f57b4442cebadc30a3e85c3d46cd5ed06a9b697ac4b453b498fc7a992e64bd03c1a1c6681c37833768c1aa3281b83d634953b1142120d4bd3b2163db6edeb87370b020b3cd1846e6d31bb1c3f2578b4dcd2633f94b36b5631090deb43418d9eada5d9bdf9ae9cd50df0efad597d385bd4b49cb94e7de5d3d2afbbb5ebb64de8119f56fae12bd3a91b387d76558941facbf1d47dc899610018bf0e98b245b13ebed42b8648d8756aa0de059709d05c9fb1394062f5030d762fd477400dc20813b1d3888a56cdbec73c6d8364cb9e2c7f6f02a3928d56253108c38b5fe52164917f05fd84b28082444f194e906fc2b2e6f4292a4f86381e2389dc9cefaae6e46d49578e821787f95119f34309e47e72940bc18c86155d343f9534f9a28497cb41c4b6d6a546d81dd15f553fd1b0ba6aff167ff3e96fd904fd9a4bab67d71f3ce834f0c69df6cc95a661e9d58bf3e17936a8836f303a0b2a014be11b0b89b7029af95271c96869b2cbf3b24d749d037b77c986ec3c779f2702d573572aa7aaf4456662d5b44d41f769a0df92a23a062ddf62461a4b717d1af5d89a43eb961a6c2fae236d4ccd8a2dd27acc0ed40b0e98aecfbb08a4f80577c677bfef6576858456de54cdbf2104dc70339d316a8ed27a889ca72546f1eef0f478203093b7cca362430ce049e5abe7001db4734edd19cee60c3b617355cf57a603f9ea86bc0b1be1be3d4ab2af472fd77a5da81f5cec3b1da2df91562fc89d1ffe8c679c57edef8f48f2cf982e5bf3638da1df38d89bfe69805ead4edc935f4059143aae4542cf5ddf58e9766f4884b06e2ab8816a6ef9f9d5236b8bdedfa21403d9f1510cffcb361047d76e1a2913d0105252a3fe18c1e85d3cedb172fe2b5d242616e7aadd968f9c384ee7c7871b14b5a4c7722ca4db23c7c6fd6fb42b0b4a2f3143bee023945d8613e35af764fa1d65d2d8eaad6a948ed660b50c46e7e2861949e59488168e7fb54b0693e72b794ba0012647ee659642013abbba61003a1ce79475c3ca64458da5ad14cf448e732c044b6649be8c656a96c562c1fa282e8fdb336654ff8491d1495f534522caaa6ee6a368a1d76c0a20799f3919481f2c9ccaa88bae1836d6ad1b80e2a348fad846065014da2ac282fe3ca0f7aba09aade47ebf20c33180a341f3c692d2a62d19ee8da1b1add06fdba40807844a060692f65f9458b59631ea73eea2edc7d9e0e06c97650c6bf145bb043c2b6e596cb51eff9af6fdd2e9c94309b4dce4d86d2d0c65f0bdba4ce6150580a4025d823e17c760c2fd9ced74f9debc66b32c2f1ea85eade5a27bdcdda48d276c58c307de88402e86eda530e019d12beaced839a2513cc0b4b9f1b342639438beb6d9a6d4dc2c468c103a6da271dcd6997cb4a6acffc6dc2bbd4e1009cd5e239c9240911af1e746bde0bc5e13c735eda5ae22cb56713db41468c738623eb2ab833e46f0b4c652d4c841e271188b25380bd8281ba39d5f6ad09e2befd8e0f0e1660fab7dc76ce1615244cfce0d718e0056384430e6f6561c9025712a65b2b3328ad99e0832f1bc7c47c69abf2fe9ce904523377e460d959b53547908c88d9c0df912849e57f9cca345617aed6f7aa9de28fa3502095f97d744f07ca7e883a84e7f59d786583f7ed5bfa3745794ecd85d77cc6c4af1b4bc46e98a03e69113c1cc7a488f1e8c2d7aec81d21b6928b2736c3ee4266df60d916b85458251fe2108028f18876170a5ae3c0eb8644e6288d89663128ea0a76c56562b91a2b7cd032c3dcc8ea4c88d912ae2106dd3b4c80ce4d5df22664ef9a0e883f865652331b598a25c837f01d9149a1912065978745f0b48ba84355bd14b410424b2a71f3a73229c182fcb573b38053c8fe47215872974d6eb6482c274eac33719358bda7365d2e35ef704e5e27751b70af4f42452a9abcf3904fffdf0ab1ccd59950b6cdfdfc1248b68718550b5717311bd28ff5fe8d06a44e72b2bbce5800c6b9905d63dd070539666b64dba6d9771f8fea1aab0a6185ef6ed0dd0b87adb8ae60b8b130c84f24d12bf613468c0e8dc34e0fa04ac400bd0229924f08ba1913a5c70928d079829280b733d0b439434cef0ab6e0acafa8b98f9c85b47e9b6dc128963339e85ad5d9eeaed97c41ba9200fb30ed7ac2c9a59b1e2594b799e89b7f14972aff4f8ceba37224247d99f1d54cc99007c685f80e24a4472a51b8082228a0aad47155a32a8ee48f372ec23f705000e69b23d94d8ff682877519d98b973f42de3a59de28009f12164cb01d6242a8bf6b21b02079604beb00c8b03aada5e64df6f78b03f420db2ee8a6494e16da5dcb269ddf3f50dba97b51fa8f24d0544929248c58f414b8b3a2251f34c285b52d53ce4b4bdd508ed84b9bab6914a633880598219279a45c299269e55a29927994de259269d5d9259279b43d2d9269f53b2c9d7059dae3016abfb4ca9a5638a39379603042dd7540b46eea917ac3cd32c3879a75df0e39b6ec1c70f3d2e45950d2bb9d2d92eabecb2ca2eabfc1a74d3c40b54e64916982c932e7059275b10b24dbe20659f6241c931e5829673aa0523d7d40b56ee69169c3cd32ef8f14eb7e0e39b1e97a22a7a74537e3fa9fc015600bf166442d09af427ef0ae26df90b58144170d635a8ee44e6c9e5617cdbfbac3aba037b544e83544fe5992be284eab3d81015dec8db78c905ef9a55975ee9d75a9be27417a889ae68de4a75ed7870ac22b2d03551bd7fb66796efecfa9def886bb7273b32632dde7e42093271d16ce4cd2a69f20c4a4ca4b26aee529094298125baab0d591be0f3b5a3e1f2f2e536e6c0b9f33240918c58936cf2ccd92fb24be47391e039e73ed8348dd15cb94c3dd1781a72bacc39d7dc9d5d6bfec0628a46ba228d2e84408b72e66c07ac46fc8ce4dc2bfe185ec4759ec13fcf166fa8eff71ea115f8cd15dcf103bc31c02bb046a29a277ac39adef88e75bdf3031bfae02736f5c92f6ce98bdfd8d6377fb0a31ffe6257bffcc39efef88f7dfd13e0408010878244381222c6b130094e4448712a4a863331729c8b53e04282129792547025852aaea552c38d34f6089e8e459dce33b0a4337826967526cfc2893a8b67e3c1ad71e52141d67f3de73592effbb547981cafceb9ae3f7d2c39f31ff899eed7a3ba47b5c297f51d249eceff13f57c2aada917b927867ac16f4aa19ecfa521894e7006bcf85ffd527afc7b5d65f498b2ba259c39d8f2cd9774cf5cd210eb07f4500db5fc228819bd20e3ce16071ab096d0291042c987877ce862de5cf509ea96d77234a31077b9b9f54530fa91b0d0c2a752728574c74961e0f7bb52c51cfdcfd3d25f1888d3f9391369eb08aba9a1c1381a33c9032ecf8d8a719eec52875b27759dc7439bb028e99f75370e55a4861134acc90355870fd68a2f072d9d078eea6c272148ec8862308042ee9820a3148979e8dd8b61e41369c8c273331017de0c32fa35f2bb930c16394aa1ba6c27de782d729e9b40379b1ec449f392ec4ae0c382611a89e9a677b038f9b2998ecd748ce8c881ccb4d0cb4839f6ba0b8ec5a93f2efcfc04e838a035eec45d4aca5d41c4f52617db7bb76edf85d05599c9a08c3ff7f548722bb3786750d36d75bd3800c0adbdc6a0c70e805701787fde2f5b2a4291642909475e2f38058844e999ecd2d7a348add74beb1e5358a259c244c0dd9d9742a58dd3b2ae4547755a26e9cdd15304787a946bce984ae5821406a71b6e11007fb364b38b53ea1bb614217631225186c2b618ba15e58490d896e8a94606b151d83735e21957ad25d1fd2334ca444aa4bedf9d3634645a948dad08553018388f52227cda5e667f5ed1e7f5815134cdab28dd51175f0f851a7161d38dd65c9259368b31bd458d8969c3e809a34b4fc71283970740e7f1222985b3b998df3c2ecd25d9b069b4ee739684febc1d6867286afc1cbe8967f5d29eb014520892f2e058d23c9e17cd1eb8c074df6e09eb3a10ef93354a2242e02f81e9128469e6ff1319a14ba9cfa46afec7672bf05d2d42ef32b3a0524c5de818dc6b92888ac4c577f1514704121f3f948e870fd1b10e965cc4c564b75de862b679a73d79cd87816968701a6abc08baef3311967f585da0f23e2eee632ebcd51e1bcf23ad4b8ced82ae828d7e7f56a57a83f654818828e8bf22eb4b96bfbd5bdf8fbf7bb6e86e7f5bb668b7bfac2dfabbfd5db0b92a3d7fe0623a299cd99398e805ea14bd08cbc3b22dfb42cdd58f5f5c14174327950203b332d871b07ac7fb334b9c156eedab5fbdf8e2a797fd2c94d671e08937bcf9363b977e32427775377b218602e8bb52e9c8e486fbbde3ca48c7b4396dfc427bb6f75e095a778af53f74a31b79ac7a5a691cca9f902b3d09ab1d7f7e61e51ecbbdd3ea615fe055d70c067b791f21d052bebf38a6dec2177d31e866fc3204da34da0d5df6bc8e2f27d6490847a2371582485043ef18c7fe490850271845f2958b51486f0f0e7b06bdb501bab797ed9e26d305c5553815ae3e8b1713e0335bcec2bd058ee27ddd6bb3d6da6f76e59bf2748f5a3b0b70158fb2c738402ab287dc9b9304493eb2ceaf386cafbc23cd475b318de963e4aa7fd430fdb36b474fd92bd70273afc6806136329c5dbb252852b39844dcd9c2b9f5557b60c0c35c86dce0c0735efa82961bddbee0dd3d9090c241526e48d1aa3dc9133eea4f12fbbe0733f11ea7cdb7ab441630272db014e29d1b17b3f06a531fca48654a40cdef65e95c7892e158b8f12681f65e2fdc15db69053a3167faf06264764488191a99fb3d46baa58470843c7147e172cea84392a0a7c6f14b3562946f3c28738258276a3bd2909f00379bde4cb43408dad554e8a043ab84e00c92110e91fd6af6e81010fc9d0151a7555d5fedc9072989b24b97c304599bca487e5a235263c265239b36465864438aa8e7ffab0d8afaa6c5ba972b35e29324dd57fffad6af83eac1a1e24bcf2e8c554c2587a877118429be6af04f686d9c563c1ebb74d9cd791bc89e2dd19cd7317fe24395a8db45c16ca5d8bd843b24149fa4bcb31db75afaef7c82307105d2767671dd38193abc1b8272c7e3771345127b823660430df0a6fa3c89d946c6b58adf869aceeb53ecb81760a0e08558db57123f9464ca60e87c3fe0d3f266da66ee9dea422a2362a7269290fba8643e2a73efe601dbfcdc0e743bc39ab9798279d030270f722ae86f9244eb2532cb6f74b382845c5e076fc183070e2536ef00a8600b727b3991cf728703c3ad4586373fec2e37d02528bce5c231bc10c51400c34ae27c724509931940dc04a813a93502515a1f26691e656ce621575d382604ae20a10341bc23d008060099b6d769b273bbbf3b49279e07aad77d9bce3e31e70f0e2c5e2a7d3a7af15ab8d5b3d580d2d141d7c0aa02848261246fe5dd557f0b08c46090b4bf872a08488f68c6e75b3d31dbd8c97210e56083dbc24423668b61869c67a3458a45595c976463f678633c9562911462601b733c4eacbc630ab229c91a158db2d2e567e366f74f16427f176151b234f02aab2ad5d044ce7bf3c0c655695da45c21625255c7b6740be5d3eb317b0fa5de25de38a9255f176bb9bcd19793aa564d419e79de9b08662616d5cc1c21df3223d0d801fa330c8e3cfdce878c1edac6c1c19b0d2cb327ef7293fe0ba54717f360a9273ba224e5cb3bc07bf5b25a2896d15e624afd57296a446868d24a9f4c81d4ef3f4186afa4731ced3fc6db6053cf60ad93ac963090747e61ababaa0647e73f48aa59a29d8e5db2e36677e0570c45b24776c452b9fbfcdd9c0f03ee50f0009e4151c2bb2584276d72eae8039c0261e4db2895df242e188930d9d6b783c214b9dda69b87a7183954f3c1f0f29b7e765046feb4c547089d215108d101c2eb94a775caf3def42d77bcd57fff1c1b87861b6ebcf9cae1fda39389ee28e798edcfaec002afee081bd408bcb7324b9bd875f03319c2d3258ac6ea8088809eeeb8ef0b136b728a33772a166cc7a8388c922053fb62c2a70564693e88a3795181653ac6a2c16e929506b14ee9cfeb1ea0f10e55eea76ee405ecb0de51d085dda41c5868f9aa260f4bfee8e774383e6153bc5c7c7d0762e4c76ba3ed96c4fb0be0d0746358543a19e6e384d9acd269360ca6213d2911abcef303f1f8553b64cbb592f5b31afed8296482c0f52de8517de16828dd43a5745691242add053dc2a034cf9f33e6062aee4a58bdfe421f637295701b2df028c4f8483a58fcd084425bb19609347310f2a526f6dfcf0b9707d6d78569f395fb889e8198fa8aeceec4fb8b11fdbd9529b35f29d2e3226f222f2f3c6f1e2173ced987129f4dd40c91ba9ed21750a3ae099d2a036b58552d7bdab38c265fc670abdca7b1755b89482587d9f1b98a57921d585e21e4dc98d2d011be3c90c419595f379f14d56226a4eb1b396d5c589925360f3ec973148b21d7a330a210038c2a92bc0e232a56725d01d9bae0958e1146a0aa067c69e8b1cf257e6e0266df48d4f5688c07915043765509918b454f54469e74284ac5aacaa962a5946d82d3630158442219e36cea348c74ee22a162b98cba58a9d4a875cc4ca112dfd976b6cd2449abaea6bf9d21465b59e25c12090c734db64255bdcbeb509bc6f9134e5897bf8ff89a9a62dc3c2382fbb11d35ed7d1d46d9bf397aae7664274c5a40568cc10e067618d55b7533a3439ac4f8813e8b22efd7de77ebc7129f4f2450552727401ba141c585a663150922b11c125e4f24ec0be560430317c940306f891a8aa22cb875f044938a1e41ac9715b7851c57f2ca6b6d0ab496e04b871d6da9df1e171e4b078dc399dba446ebfe157de544fa2da907a3734198210ef24abecec37d6a060465e2f4ee4238e7ac093891a26910598cdf73b0f77b9fa69f20cb8f73a71896a6d48a89e480934084fc621427a963484cb41a1685f30a8d03dd8d74228443751292eb5b67050d326da0101abdb85f2f95541329c44720436cd8ec2f5f9b2e41c8aef90f07859afd2e344f65c8da659727281969210239df3aa1a67640caca891fe8338a0a207d5297d2b62d128c898f98b98f00eccef7bd1a60080ce5f5f79c4636ac9b0500efb037c04d0012008b08655c4845d52cdb713d7f0b8011c10e9840c277c7b9b27c2ddfd421831c1a9e09387b62f4f5250ae2c8f361bbe7accf05244097fcab50ec469473e2738e3306a3f71c58372c718fb9dc59003eec3d3593cfa0902b886067a885d8f37129804d36c990348eb91785359ec79c05ad277c70ebc7b48289a3e4ed6b7722dddc75577bf20263004e64d00fa7430e17832eb4715eaee031605a43336670d740eec703a79e7befee7afd9cf14cdd5a3f6b51de654faea034bfc21d7878be6a9c190c1bfcff3d9ecc4ee7e6310008c10816c5e1390449d10c97e5f1358228c98a56d5e93d8669d98ed7f5f9334118c54936cde57716cbd57ab3bbdddbef14655537ddb6d7bf391c4fe7cbedf5eefee7f17cbd3fbfdfbfffb70c0ec3acf5b768f83d210af943a1cccb9cb08675733e15f01d0eafcf0440cb131f9ebe95f039b22f14e97c0ac85c042a916e3d3eb1f276ac32652ffedef9ee563e4919752edc001282762c1997f54397e784c991efdd04bbf6bcbbdb21f92b335c4aef02f2a6753bfede13d3dc39f38bb71b340a5b80497f097f00ce383f0212cfc93e92000ad7464ea74e03f604b0fef2aa3c13d8d63e0f7af6e9f0024e6608a9ba7a59d04f29046060a77a2e31844b6df4a4104e418427354ea1364dd15c736a10f54238d967a81b435d1d10a67d9ae248de118de09d896101").unwrap(); - println!( - "len = {}, first 4 {}, last 4 {}", - compressed.len(), - hex::encode(&compressed[0..4]), - hex::encode(&compressed[compressed.len() - 4..]) - ); - let code = deploy::program_deployment_calldata(&compressed); - let mut multicall_args = args_for_multicall(MulticallArg::Call, H160::zero(), None, code); - let arbwasm_address = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); - let mut compile_calldata = vec![]; - let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); - compile_calldata.extend(compile_method_hash); - let mut extension = [0u8; 32]; - // Next, we add the address to the last 20 bytes of extension - extension[12..32].copy_from_slice(expected_address.as_bytes()); - compile_calldata.extend(extension); - multicall_append( - &mut multicall_args, - MulticallArg::Call, - H160::from_slice(&arbwasm_address), - compile_calldata, - ); - println!("{}", hex::encode(&multicall_args)); - multicall_args -} - -/// Converts arguments into the format the multicall Rust Stylus program expects. -fn args_for_multicall( - opcode: MulticallArg, - address: H160, - value: Option, - calldata: Vec, -) -> Vec { - let mut args = vec![0x01]; - let mut length: u32 = 21 + calldata.len() as u32; - if matches!(opcode, MulticallArg::Call) { - length += 32; - } - args.extend(length.to_be_bytes()); - args.push(opcode.clone().into()); - - if matches!(opcode, MulticallArg::Call) { - let mut val = [0u8; 32]; - value.unwrap_or(U256::zero()).to_big_endian(&mut val); - args.extend(val); - } - args.extend(address.as_bytes()); - args.extend(calldata); - args -} - -/// Adds another call to a multicall transaction. -fn multicall_append(calls: &mut Vec, opcode: MulticallArg, address: H160, inner: Vec) { - calls[0] += 1; // add another call - let args = args_for_multicall(opcode, address, None, inner); - calls.extend(args[1..].iter().cloned()); -} diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index f02e5c2a0..9f0e4e464 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -8,7 +8,7 @@ use ethers::{middleware::SignerMiddleware, providers::Middleware, signers::Signe /// transaction request to sign and send. If estimate_only is true, only a call to /// estimate gas will occur and the actual tx will not be submitted. pub async fn submit_signed_tx( - client: SignerMiddleware, + client: &SignerMiddleware, estimate_only: bool, tx_request: &mut Eip1559TransactionRequest, ) -> eyre::Result<(), String> @@ -66,6 +66,6 @@ where let gas_used = receipt.gas_used.unwrap(); println!("Confirmed tx {tx_hash:#032x}, gas used {gas_used}"); Ok(()) - }, + } } } diff --git a/system_tests/common_test.go b/system_tests/common_test.go index a7df6aeea..25759fc50 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -937,6 +937,7 @@ func deployContract( Data: deploy, }) Require(t, err) + t.Logf("Data for creation %#x", deploy) tx := types.NewContractCreation(nonce, big.NewInt(0), gas, basefee, deploy) tx, err = auth.Signer(auth.From, tx) Require(t, err) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 4b045de20..fc01b7315 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -387,48 +387,6 @@ func TestStylusCargoPlugin(t *testing.T) { ensure(arbOwner.SetInkPrice(&auth, inkPrice)) ensure(arbOwner.SetWasmHostioInk(&auth, wasmHostioInk)) - colors.PrintMint(fmt.Sprintf("arbwasm addr is=%#x", types.ArbWasmAddress)) - - multiAddr := deployWasm(t, ctx, auth, l2client, rustFile("multicall")) - t.Logf("Multicall addr %#x", multiAddr) - - wasm := readWasmFile(t, rustFile("keccak")) - programCreationData := deployContractInitCode(wasm, false /* no revert */) - args := argsForMulticall( - vm.CALL, - common.Address{}, - nil, - programCreationData, - ) - - tx := l2info.PrepareTxTo("Owner", &multiAddr, 1e9, nil, args) - receipt := ensure(tx, l2client.SendTransaction(ctx, tx)) - if receipt.Status != types.ReceiptStatusSuccessful { - Fatal(t, "not OK receipt") - } - // } - - // arbWasmABI, err := precompilesgen.ArbWasmMetaData.GetAbi() - // Require(t, err) - // compileMethod, ok := arbWasmABI.Methods["compileProgram"] - // if !ok { - // Fatal(t, "Cannot find compileProgram method in ArbWasm ABI") - // } - // compileProgramData := compileMethod.ID - // programArg := make([]byte, 32) - // expectedAddr := common.HexToAddress("0x921bd9fa0f3295c0351164a28ba7c23c343b786d") - // copy(programArg[12:], expectedAddr[:]) - // compileProgramData = append(compileProgramData, programArg...) - - // args = argsForMulticall(vm.CALL, types.ArbWasmAddress, nil, compileProgramData) - - // tx = l2info.PrepareTxTo("Owner", &multiAddr, 1e9, nil, args) - // receipt = ensure(tx, l2client.SendTransaction(ctx, tx)) - // if receipt.Status != types.ReceiptStatusSuccessful { - // Fatal(t, "not OK receipt") - // } - - // t.Log("Submitted both txs") time.Sleep(time.Hour) } From 8d57bf619e2c76233d9839c3408db8fa653a43d6 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 17:47:01 -0400 Subject: [PATCH 30/58] add in test --- arbitrator/Cargo.lock | 51 +++++------------------- arbitrator/cargo-stylus/Cargo.toml | 2 + arbitrator/cargo-stylus/src/check.rs | 34 ++++++++++------ arbitrator/cargo-stylus/src/constants.rs | 2 + arbitrator/cargo-stylus/src/main.rs | 10 ++++- arbitrator/cargo-stylus/src/project.rs | 16 +++----- 6 files changed, 49 insertions(+), 66 deletions(-) diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index b7c23e31c..76da9e33c 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -479,7 +479,9 @@ dependencies = [ "serde", "serde_json", "stylus", + "tempfile", "tokio", + "wasmer", ] [[package]] @@ -1503,12 +1505,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "ff" @@ -2085,17 +2084,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.8.0" @@ -2109,7 +2097,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.1", - "rustix 0.38.4", + "rustix", "windows-sys 0.48.0", ] @@ -2237,12 +2225,6 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.3" @@ -3368,20 +3350,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "rustix" -version = "0.37.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - [[package]] name = "rustix" version = "0.38.4" @@ -3391,7 +3359,7 @@ dependencies = [ "bitflags 2.3.3", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys", "windows-sys 0.48.0", ] @@ -3982,15 +3950,14 @@ checksum = "c02424087780c9b71cc96799eaeddff35af2bc513278cda5c99fc1f5d026d3c1" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.20", + "rustix", "windows-sys 0.48.0", ] diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index 1ca4a0c30..547134053 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -19,3 +19,5 @@ bytesize = "1.2.0" ethers = "2.0.8" serde_json = "1.0.103" tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } +wasmer = { path = "../tools/wasmer/lib/api/" } +tempfile = "3.7.1" diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index f3d51daa6..ed8a5ddd8 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,6 +1,3 @@ -use std::path::PathBuf; -use std::str::FromStr; - // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use bytesize::ByteSize; @@ -9,7 +6,6 @@ use arbutil::Color; use prover::programs::prelude::*; use crate::constants; -use crate::project; /// Defines the stylus checks that occur during the compilation of a WASM program /// into a module. Checks can be disabled during the compilation process for debugging purposes. @@ -33,15 +29,7 @@ impl TryFrom<&str> for StylusCheck { /// Runs a series of checks on the WASM program to ensure it is valid for compilation /// and code size before being deployed and compiled onchain. An optional list of checks /// to disable can be specified. -pub fn run_checks( - wasm_file_path: Option, - disabled: Vec, -) -> eyre::Result<(), String> { - let wasm_file_path: PathBuf = match wasm_file_path { - Some(path) => PathBuf::from_str(&path).unwrap(), - None => project::build_project_to_wasm()?, - }; - let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; +pub fn run_checks(wasm_file_bytes: &[u8], disabled: Vec) -> eyre::Result<(), String> { println!( "Compressed WASM size: {}", ByteSize::b(wasm_file_bytes.len() as u64) @@ -79,3 +67,23 @@ pub fn compile_native_wasm_module( ); Ok(module) } + +#[cfg(test)] +mod test { + use super::*; + use wasmer::wat2wasm; + #[test] + fn test_run_checks() { + let wat = r#" + (module + (func $foo (export "foo") (result v128) + v128.const i32x4 1 2 3 4)) + "#; + let wasm_bytes = wat2wasm(wat.as_bytes()).unwrap(); + let disabled = vec![]; + match run_checks(&wasm_bytes, disabled) { + Ok(_) => panic!("Expected error"), + Err(e) => assert!(e.contains("128-bit types are not supported")), + } + } +} diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 2bf1d2749..162070a64 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -12,3 +12,5 @@ pub const ARB_WASM_ADDRESS: &str = "0000000000000000000000000000000000000071"; pub const MAX_PROGRAM_SIZE: ByteSize = ByteSize::kb(24); /// 4 bytes method selector for the compile method of ArbWasm. pub const ARBWASM_COMPILE_METHOD_HASH: &str = "2e50f32b"; +/// Target for compiled WASM folder in a Rust project +pub const RUST_TARGET: &str = "wasm32-unknown-unknown"; diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index cfbe0d302..57ae6d7a1 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,3 +1,6 @@ +use std::path::PathBuf; +use std::str::FromStr; + use check::StylusCheck; // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE @@ -100,7 +103,12 @@ async fn main() -> eyre::Result<(), String> { .collect::, String>>() .expect("Could not parse disabled Stylus checks") }); - check::run_checks(wasm_file_path, disabled) + let wasm_file_path: PathBuf = match wasm_file_path { + Some(path) => PathBuf::from_str(&path).unwrap(), + None => project::build_project_to_wasm()?, + }; + let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; + check::run_checks(&wasm_file_bytes, disabled) } Commands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { Ok(_) => Ok(()), diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index 4c38ba6cb..6ec02a145 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -9,11 +9,10 @@ use brotli2::read::BrotliEncoder; use bytes::buf::Reader; use bytes::Buf; -use crate::constants; +use crate::constants::{BROTLI_COMPRESSION_LEVEL, EOF_PREFIX, RUST_TARGET}; use arbutil::Color; /// Build a Rust project to WASM and return the path to the compiled WASM file. -/// TODO: Configure debug or release via flags. pub fn build_project_to_wasm() -> eyre::Result { let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir {}", e))?; @@ -22,14 +21,11 @@ pub fn build_project_to_wasm() -> eyre::Result { .stderr(Stdio::inherit()) .arg("build") .arg("--release") - .arg("--target=wasm32-unknown-unknown") + .arg(format!("--target={}", RUST_TARGET)) .output() .map_err(|e| format!("failed to execute cargo build {}", e))?; - let release_path = cwd - .join("target") - .join("wasm32-unknown-unknown") - .join("release"); + let release_path = cwd.join("target").join(RUST_TARGET).join("release"); // Gets the files in the release folder. let release_files: Vec = std::fs::read_dir(release_path) @@ -43,7 +39,7 @@ pub fn build_project_to_wasm() -> eyre::Result { .into_iter() .find(|p| { if let Some(ext) = p.file_name() { - return ext.to_str().unwrap_or("").contains(".wasm") + return ext.to_str().unwrap_or("").contains(".wasm"); } false }) @@ -59,7 +55,7 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, S .map_err(|e| format!("could not read WASM file at target path {}", e))?; let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); - let mut compressor = BrotliEncoder::new(wbytes, constants::BROTLI_COMPRESSION_LEVEL); + let mut compressor = BrotliEncoder::new(wbytes, BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor .read_to_end(&mut compressed_bytes) @@ -69,7 +65,7 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, S "Compressed WASM size: {} bytes", compressed_bytes.len().to_string().yellow() ); - let mut code = hex::decode(constants::EOF_PREFIX).unwrap(); + let mut code = hex::decode(EOF_PREFIX).unwrap(); code.extend(compressed_bytes); Ok(code) } From bb2297e06bb11c3e8207ee39299ec6fa1da88be4 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 17:47:56 -0400 Subject: [PATCH 31/58] revert --- system_tests/common_test.go | 1 - system_tests/program_test.go | 63 ------------------------------------ 2 files changed, 64 deletions(-) diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 25759fc50..a7df6aeea 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -937,7 +937,6 @@ func deployContract( Data: deploy, }) Require(t, err) - t.Logf("Data for creation %#x", deploy) tx := types.NewContractCreation(nonce, big.NewInt(0), gas, basefee, deploy) tx, err = auth.Signer(auth.From, tx) Require(t, err) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index fc01b7315..7eeb47121 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -22,7 +22,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbnode" @@ -328,68 +327,6 @@ func testCalls(t *testing.T, jit bool) { validateBlockRange(t, blocks, jit, ctx, node, l2client) } -func TestStylusCargoPlugin(t *testing.T) { - t.Parallel() - ctx, cancel := context.WithCancel(context.Background()) - rand.Seed(time.Now().UTC().UnixNano()) - - // TODO: track latest ArbOS version - chainConfig := params.ArbitrumDevTestChainConfig() - chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10 - - l2config := arbnode.ConfigDefaultL1Test() - l2config.BlockValidator.Enable = true - l2config.BatchPoster.Enable = true - l2config.L1Reader.Enable = true - l2config.Sequencer.MaxRevertGasReject = 0 - l2config.L1Reader.OldHeaderTimeout = 10 * time.Minute - AddDefaultValNode(t, ctx, l2config, true /* jit */) - - stackConf := node.DefaultConfig - stackConf.HTTPHost = "localhost" - stackConf.HTTPPort = 9999 - stackConf.HTTPModules = append(stackConf.HTTPModules, "eth") - stackConf.P2P.NoDiscovery = true - stackConf.P2P.ListenAddr = "" - l2info, node, l2client, _, _, _, l1stack := createTestNodeOnL1WithConfig(t, ctx, true, l2config, chainConfig, &stackConf) - - cleanup := func() { - requireClose(t, l1stack) - node.StopAndWait() - cancel() - } - defer cleanup() - - auth := l2info.GetDefaultTransactOpts("Owner", ctx) - fmt.Printf("Owner %x", crypto.FromECDSA(l2info.Accounts["Owner"].PrivateKey)) - - arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) - Require(t, err) - arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, l2client) - Require(t, err) - - ensure := func(tx *types.Transaction, err error) *types.Receipt { - t.Helper() - Require(t, err) - receipt, err := EnsureTxSucceeded(ctx, l2client, tx) - Require(t, err) - return receipt - } - - // Set random pricing params. Note that the ink price is measured in bips, - // so an ink price of 10k means that 1 evm gas buys exactly 1 ink. - // We choose a range on both sides of this value. - inkPrice := testhelpers.RandomUint64(0, 20000) // evm to ink - wasmHostioInk := testhelpers.RandomUint64(0, 5000) // amount of ink - colors.PrintMint(fmt.Sprintf("ink price=%d, HostIO ink=%d", inkPrice, wasmHostioInk)) - - ensure(arbDebug.BecomeChainOwner(&auth)) - ensure(arbOwner.SetInkPrice(&auth, inkPrice)) - ensure(arbOwner.SetWasmHostioInk(&auth, wasmHostioInk)) - - time.Sleep(time.Hour) -} - func TestProgramReturnData(t *testing.T) { t.Parallel() testReturnData(t, true) From 8cd16bfda00fd1ec089f68659a3a9c5b39ba2334 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 17:59:59 -0400 Subject: [PATCH 32/58] fix build --- Dockerfile | 4 ++++ arbitrator/Cargo.lock | 1 - arbitrator/cargo-stylus/Cargo.toml | 5 +++-- arbitrator/cargo-stylus/src/main.rs | 9 ++++++--- arbitrator/stylus/tests/keccak/privkey | 1 - 5 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 arbitrator/stylus/tests/keccak/privkey diff --git a/Dockerfile b/Dockerfile index 3185fd5b8..820293de9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,7 @@ COPY arbitrator/prover arbitrator/prover COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/tools/wasmer arbitrator/tools/wasmer COPY arbitrator/arbutil arbitrator/arbutil +COPY arbitrator/cargo-stylus arbitrator/cargo-stylus COPY --from=brotli-wasm-export / target/ RUN . ~/.cargo/env && NITRO_BUILD_IGNORE_TIMESTAMPS=1 RUSTFLAGS='-C symbol-mangling-version=v0' make build-wasm-libs @@ -96,6 +97,7 @@ COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/jit arbitrator/jit COPY arbitrator/stylus arbitrator/stylus COPY arbitrator/tools/wasmer arbitrator/tools/wasmer +COPY arbitrator/cargo-stylus arbitrator/cargo-stylus RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-header FROM scratch as prover-header-export @@ -116,6 +118,7 @@ COPY arbitrator/prover/Cargo.toml arbitrator/prover/ COPY arbitrator/jit/Cargo.toml arbitrator/jit/ COPY arbitrator/stylus/Cargo.toml arbitrator/stylus/ COPY arbitrator/tools/wasmer arbitrator/tools/wasmer +COPY arbitrator/cargo-stylus arbitrator/cargo-stylus RUN mkdir arbitrator/prover/src arbitrator/jit/src arbitrator/stylus/src && \ echo "fn test() {}" > arbitrator/jit/src/lib.rs && \ echo "fn test() {}" > arbitrator/prover/src/lib.rs && \ @@ -127,6 +130,7 @@ COPY arbitrator/prover arbitrator/prover COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/jit arbitrator/jit COPY arbitrator/stylus arbitrator/stylus +COPY arbitrator/cargo-stylus arbitrator/cargo-stylus COPY --from=brotli-library-export / target/ RUN touch -a -m arbitrator/prover/src/lib.rs RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-lib diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 76da9e33c..cc1f65195 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -479,7 +479,6 @@ dependencies = [ "serde", "serde_json", "stylus", - "tempfile", "tokio", "wasmer", ] diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index 547134053..b1d62cb5b 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -19,5 +19,6 @@ bytesize = "1.2.0" ethers = "2.0.8" serde_json = "1.0.103" tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } -wasmer = { path = "../tools/wasmer/lib/api/" } -tempfile = "3.7.1" + +[dev-dependencies] +wasmer = { path = "../tools/wasmer/lib/api/" } \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 57ae6d7a1..b287b0e1d 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -26,12 +26,15 @@ struct Cli { #[derive(Debug, Subcommand)] enum Commands { - /// Instrument a Rust project using Stylus, optionally outputting the brotli-compressed, - /// compiled WASM code to deploy on-chain. This command runs compiled WASM code through - /// Stylus instrumentation checks and reports any failures. Allows for disabling specific . + /// Instrument a Rust project using Stylus, + /// . This command runs compiled WASM code through + /// Stylus instrumentation checks and reports any failures. Allows for disabling specific. /// checks via the `--disabled-checks` flag. #[command(alias = "c")] Check { + /// Disables specific compilation checks. At the moment, `compressed-size` is the only + /// option available to disable. Disabling it skips checking the compressed program + /// is within the 24Kb contract limit. #[arg(long)] disabled_checks: Option>, #[arg(long)] diff --git a/arbitrator/stylus/tests/keccak/privkey b/arbitrator/stylus/tests/keccak/privkey deleted file mode 100644 index e1c9ccb4b..000000000 --- a/arbitrator/stylus/tests/keccak/privkey +++ /dev/null @@ -1 +0,0 @@ -009f3fd6848015f83b9210c89f7744e3941acae1195c8bf9f5798c090dc8f497 \ No newline at end of file From e1b6831551b0e5b7f3ad6713a168af01cac1b537 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 18:02:44 -0400 Subject: [PATCH 33/58] commentary --- arbitrator/cargo-stylus/src/main.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index b287b0e1d..e4b1e5395 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -26,8 +26,8 @@ struct Cli { #[derive(Debug, Subcommand)] enum Commands { - /// Instrument a Rust project using Stylus, - /// . This command runs compiled WASM code through + /// Instrument a Rust project using Stylus. + /// This command runs compiled WASM code through /// Stylus instrumentation checks and reports any failures. Allows for disabling specific. /// checks via the `--disabled-checks` flag. #[command(alias = "c")] @@ -37,6 +37,9 @@ enum Commands { /// is within the 24Kb contract limit. #[arg(long)] disabled_checks: Option>, + /// If desired, it loads a WASM file from a specified path. If not provided, it will try to find + /// a WASM file under the current working directory's Rust target release directory and use its + /// contents for the deploy command. #[arg(long)] wasm_file_path: Option, }, @@ -54,7 +57,7 @@ pub struct DeployConfig { /// to complete the operation. #[arg(long)] estimate_gas_only: bool, - /// By default, submits a single, atomic deploy and compile transaction to Arbitrum. + /// By default, submits two transactions to deploy and compile the program to Arbitrum. /// Otherwise, a user could choose to split up the deploy and compile steps into individual transactions. #[arg(long, value_enum)] mode: Option, From 72c8dd670459bdaa8fe5cd1451e3cfa6d71f1769 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 18:04:16 -0400 Subject: [PATCH 34/58] rev arbos --- arbos/programs/native.go | 2 -- arbos/programs/programs.go | 7 ------- 2 files changed, 9 deletions(-) diff --git a/arbos/programs/native.go b/arbos/programs/native.go index a315cb04f..797c43abc 100644 --- a/arbos/programs/native.go +++ b/arbos/programs/native.go @@ -19,7 +19,6 @@ typedef size_t usize; */ import "C" import ( - "fmt" "math/big" "github.com/ethereum/go-ethereum/common" @@ -99,7 +98,6 @@ func callUserWasm( if status == userFailure { str := arbutil.ToStringOrHex(returnData) - fmt.Println(string(data)) log.Debug("program failure", "err", string(data), "program", program.address, "returnData", str) } return data, err diff --git a/arbos/programs/programs.go b/arbos/programs/programs.go index ed5b59e51..4289c2423 100644 --- a/arbos/programs/programs.go +++ b/arbos/programs/programs.go @@ -162,41 +162,34 @@ func (p Programs) ProgramVersion(program common.Address) (uint32, error) { } func (p Programs) CompileProgram(evm *vm.EVM, program common.Address, debugMode bool) (uint32, bool, error) { - fmt.Printf("Attempting compilation %#x\n", program) statedb := evm.StateDB version, err := p.StylusVersion() if err != nil { - fmt.Println(err) return 0, false, err } latest, err := p.ProgramVersion(program) if err != nil { - fmt.Println(err) return 0, false, err } if latest >= version { - fmt.Println("Up to date") return 0, false, ProgramUpToDateError() } wasm, err := getWasm(statedb, program) if err != nil { - fmt.Println(err) return 0, false, err } // require the program's footprint not exceed the remaining memory budget pageLimit, err := p.PageLimit() if err != nil { - fmt.Println(err) return 0, false, err } pageLimit = arbmath.SaturatingUSub(pageLimit, statedb.GetStylusPagesOpen()) footprint, err := compileUserWasm(statedb, program, wasm, pageLimit, version, debugMode) if err != nil { - fmt.Println("Compile error", err) return 0, true, err } From 5a07bda41a0d4492be405bf64edd4d846a56eeea Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 8 Aug 2023 18:06:10 -0400 Subject: [PATCH 35/58] comment --- arbitrator/cargo-stylus/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index e4b1e5395..def2f47c6 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -28,7 +28,7 @@ struct Cli { enum Commands { /// Instrument a Rust project using Stylus. /// This command runs compiled WASM code through - /// Stylus instrumentation checks and reports any failures. Allows for disabling specific. + /// Stylus instrumentation checks and reports any failures. Allows for disabling specific /// checks via the `--disabled-checks` flag. #[command(alias = "c")] Check { From 8678aca5a9e7eb69d5c68c762aea7c27e26f9827 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 16 Aug 2023 15:47:05 -0400 Subject: [PATCH 36/58] update header --- arbitrator/cargo-stylus/src/constants.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index 162070a64..ab5664aec 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -3,7 +3,7 @@ use bytesize::ByteSize; /// EOF prefix used in Stylus compressed WASMs on-chain -pub const EOF_PREFIX: &str = "EF000000"; +pub const EOF_PREFIX: &str = "EFF000"; /// Maximum brotli compression level used for Stylus programs. pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; /// Address of the Arbitrum WASM precompile on L2. From 4d1f048054a69693d8256e714ad83614f84a284a Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Fri, 18 Aug 2023 20:58:01 -0700 Subject: [PATCH 37/58] Comments and fixes --- arbitrator/cargo-stylus/src/check.rs | 15 ++++++--------- arbitrator/cargo-stylus/src/deploy.rs | 4 ++-- arbitrator/cargo-stylus/src/main.rs | 5 +++-- arbitrator/cargo-stylus/src/project.rs | 15 +++++++++------ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index ed8a5ddd8..a16b3553a 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -29,15 +29,12 @@ impl TryFrom<&str> for StylusCheck { /// Runs a series of checks on the WASM program to ensure it is valid for compilation /// and code size before being deployed and compiled onchain. An optional list of checks /// to disable can be specified. -pub fn run_checks(wasm_file_bytes: &[u8], disabled: Vec) -> eyre::Result<(), String> { - println!( - "Compressed WASM size: {}", - ByteSize::b(wasm_file_bytes.len() as u64) - .to_string() - .yellow(), - ); - - let compressed_size = ByteSize::b(wasm_file_bytes.len() as u64); +pub fn run_checks( + wasm_file_bytes: &[u8], + deploy_ready_code: &[u8], + disabled: Vec, +) -> eyre::Result<(), String> { + let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); let check_compressed_size = disabled.contains(&StylusCheck::CompressedSize); if check_compressed_size && compressed_size > constants::MAX_PROGRAM_SIZE { diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 9466156f0..efa30cb8f 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -49,9 +49,9 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { Some(path) => PathBuf::from_str(&path).unwrap(), None => project::build_project_to_wasm()?, }; - let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; + let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!("Deploying program to address {expected_program_addr:#032x}"); - let deployment_calldata = program_deployment_calldata(&wasm_file_bytes); + let deployment_calldata = program_deployment_calldata(&deploy_ready_code); let mut tx_request = Eip1559TransactionRequest::new() .from(wallet.address()) .data(deployment_calldata); diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index def2f47c6..34e125f30 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -113,8 +113,9 @@ async fn main() -> eyre::Result<(), String> { Some(path) => PathBuf::from_str(&path).unwrap(), None => project::build_project_to_wasm()?, }; - let wasm_file_bytes = project::get_compressed_wasm_bytes(&wasm_file_path)?; - check::run_checks(&wasm_file_bytes, disabled) + let (wasm_file_bytes, deploy_ready_code) = + project::get_compressed_wasm_bytes(&wasm_file_path)?; + check::run_checks(&wasm_file_bytes, &deploy_ready_code, disabled) } Commands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { Ok(_) => Ok(()), diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index 6ec02a145..ce474d3c4 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -8,6 +8,7 @@ use std::process::{Command, Stdio}; use brotli2::read::BrotliEncoder; use bytes::buf::Reader; use bytes::Buf; +use bytesize::ByteSize; use crate::constants::{BROTLI_COMPRESSION_LEVEL, EOF_PREFIX, RUST_TARGET}; use arbutil::Color; @@ -48,7 +49,7 @@ pub fn build_project_to_wasm() -> eyre::Result { } /// Reads a WASM file at a specified path and returns its brotli compressed bytes. -pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, String> { +pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, Vec), String> { println!("Reading WASM file at {}", wasm_path.display().yellow()); let wasm_file_bytes = std::fs::read(wasm_path) @@ -62,10 +63,12 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result, S .map_err(|e| format!("could not Brotli compress WASM bytes {}", e))?; println!( - "Compressed WASM size: {} bytes", - compressed_bytes.len().to_string().yellow() + "Compressed WASM size: {}", + ByteSize::b(compressed_bytes.len() as u64) + .to_string() + .yellow(), ); - let mut code = hex::decode(EOF_PREFIX).unwrap(); - code.extend(compressed_bytes); - Ok(code) + let mut deploy_ready_code = hex::decode(EOF_PREFIX).unwrap(); + deploy_ready_code.extend(compressed_bytes); + Ok((wasm_file_bytes, deploy_ready_code)) } From ebc92f46705b7ed505fc2b00516ebe0d74b61979 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Tue, 22 Aug 2023 10:49:29 -0600 Subject: [PATCH 38/58] cargo-stylus: small fixes --- arbitrator/cargo-stylus/src/deploy.rs | 11 +++++++++-- arbitrator/cargo-stylus/src/tx.rs | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index efa30cb8f..9355707ca 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -41,7 +41,14 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { Some(DeployMode::DeployOnly) => (true, false), Some(DeployMode::CompileOnly) => (false, true), // Default mode is to deploy and compile - None => (true, true), + None => { + if cfg.estimate_gas_only && cfg.compile_program_address.is_none() { + // cannot compile if not really deploying + (true, false) + } else { + (true, true) + } + } }; if deploy { @@ -86,7 +93,7 @@ fn load_wallet(cfg: &WalletSource) -> eyre::Result { if let Some(priv_key_path) = &cfg.private_key_path { let privkey = std::fs::read_to_string(priv_key_path) .map_err(|e| format!("could not read private key file {}", e))?; - return LocalWallet::from_str(privkey.as_str()) + return LocalWallet::from_str(privkey.as_str().trim()) .map_err(|e| format!("could not parse private key {}", e)); } let keystore_password_path = cfg diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index 9f0e4e464..e77d4ec5b 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -29,8 +29,10 @@ where .base_fee_per_gas .ok_or("no base fee found for block")?; - tx_request.max_fee_per_gas = Some(base_fee); - tx_request.max_priority_fee_per_gas = Some(base_fee); + if !(estimate_only) { + tx_request.max_fee_per_gas = Some(base_fee); + tx_request.max_priority_fee_per_gas = Some(base_fee); + } let typed = TypedTransaction::Eip1559(tx_request.clone()); let estimated = client From 05465f736a47f2176e2683fd9b31b5331ca4ffc5 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 22 Aug 2023 10:14:46 -0700 Subject: [PATCH 39/58] buf reader for reading privkey --- arbitrator/cargo-stylus/src/deploy.rs | 11 +++++++++-- arbitrator/cargo-stylus/src/main.rs | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index efa30cb8f..046da4ded 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1,3 +1,4 @@ +use std::io::{BufRead, BufReader}; use std::path::PathBuf; // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE @@ -84,9 +85,15 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { /// or a keystore along with a keystore password file. fn load_wallet(cfg: &WalletSource) -> eyre::Result { if let Some(priv_key_path) = &cfg.private_key_path { - let privkey = std::fs::read_to_string(priv_key_path) + let f = std::fs::File::open(priv_key_path) .map_err(|e| format!("could not read private key file {}", e))?; - return LocalWallet::from_str(privkey.as_str()) + let mut buf_reader = BufReader::new(f); + let mut privkey = String::new(); + buf_reader + .read_line(&mut privkey) + .map_err(|e| format!("could not read privkey from file {}", e))?; + let privkey = privkey.trim(); + return LocalWallet::from_str(privkey) .map_err(|e| format!("could not parse private key {}", e)); } let keystore_password_path = cfg diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 34e125f30..64c56fed5 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,9 +1,9 @@ +// Copyright 2023, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE use std::path::PathBuf; use std::str::FromStr; use check::StylusCheck; -// Copyright 2023, Offchain Labs, Inc. -// For license information, see https://github.com/nitro/blob/master/LICENSE use clap::{Args, Parser, Subcommand, ValueEnum}; use ethers::types::H160; @@ -84,7 +84,7 @@ pub enum DeployMode { } #[derive(Clone, Debug, Args)] -#[group(required = true, multiple = false)] +#[group(required = true, multiple = true)] pub struct WalletSource { #[arg(long, group = "keystore")] keystore_path: Option, From 0585fd0d7f5ad353835a003befbd9122bc4d97ef Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 22 Aug 2023 10:42:01 -0700 Subject: [PATCH 40/58] address usage issues --- arbitrator/cargo-stylus/src/check.rs | 2 +- arbitrator/cargo-stylus/src/deploy.rs | 40 +++++++++++++++++---------- arbitrator/cargo-stylus/src/main.rs | 15 +++++----- 3 files changed, 35 insertions(+), 22 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index a16b3553a..b6d6291dd 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -78,7 +78,7 @@ mod test { "#; let wasm_bytes = wat2wasm(wat.as_bytes()).unwrap(); let disabled = vec![]; - match run_checks(&wasm_bytes, disabled) { + match run_checks(&wasm_bytes, &[], &disabled) { Ok(_) => panic!("Expected error"), Err(e) => assert!(e.contains("128-bit types are not supported")), } diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index 027fb839e..ca69e35a8 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -12,14 +12,14 @@ use ethers::{ signers::{LocalWallet, Signer}, }; -use crate::{constants, project, tx, DeployConfig, DeployMode, WalletSource}; +use crate::{constants, project, tx, DeployConfig, DeployMode}; /// Performs one of three different modes for a Stylus program: /// DeployOnly: Sends a signed tx to deploy a Stylus program to a new address. /// CompileOnly: Sends a signed tx to compile a Stylus program at a specified address. /// DeployAndCompile (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { - let wallet = load_wallet(&cfg.wallet)?; + let wallet = load_wallet(&cfg)?; let provider = Provider::::try_from(&cfg.endpoint) .map_err(|e| format!("could not initialize provider from http {}", e))?; @@ -90,33 +90,45 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { /// Loads a wallet for signing transactions either from a private key file path. /// or a keystore along with a keystore password file. -fn load_wallet(cfg: &WalletSource) -> eyre::Result { +fn load_wallet(cfg: &DeployConfig) -> eyre::Result { + if cfg.private_key_path.is_some() + && (cfg.keystore_opts.keystore_password_path.is_some() + && cfg.keystore_opts.keystore_path.is_some()) + { + return Err("must provide either privkey path or keystore options exclusively".to_string()); + } + if let Some(priv_key_path) = &cfg.private_key_path { - let f = std::fs::File::open(priv_key_path) - .map_err(|e| format!("could not read private key file {}", e))?; - let mut buf_reader = BufReader::new(f); - let mut privkey = String::new(); - buf_reader - .read_line(&mut privkey) - .map_err(|e| format!("could not read privkey from file {}", e))?; - let privkey = privkey.trim(); - return LocalWallet::from_str(privkey) + let privkey = read_secret_from_file(&priv_key_path)?; + return LocalWallet::from_str(&privkey) .map_err(|e| format!("could not parse private key {}", e)); } let keystore_password_path = cfg + .keystore_opts .keystore_password_path .as_ref() .ok_or("no keystore password path provided")?; + let keystore_pass = read_secret_from_file(&keystore_password_path)?; let keystore_path = cfg + .keystore_opts .keystore_path .as_ref() .ok_or("no keystore path provided")?; - let keystore_pass = std::fs::read_to_string(keystore_password_path) - .map_err(|e| format!("could not keystore password file {}", e))?; LocalWallet::decrypt_keystore(keystore_path, keystore_pass) .map_err(|e| format!("could not decrypt keystore {}", e)) } +fn read_secret_from_file(fpath: &str) -> Result { + let f = + std::fs::File::open(fpath).map_err(|e| format!("could not read secret from file {}", e))?; + let mut buf_reader = BufReader::new(f); + let mut secret = String::new(); + buf_reader + .read_line(&mut secret) + .map_err(|e| format!("could not read secret from file {}", e))?; + Ok(secret.trim().to_string()) +} + /// Prepares an EVM bytecode prelude for contract creation. pub fn program_deployment_calldata(code: &[u8]) -> Vec { let mut code_len = [0u8; 32]; diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 64c56fed5..2742ff3bb 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -66,7 +66,10 @@ pub struct DeployConfig { endpoint: String, /// Wallet source to use with the cargo stylus plugin. #[command(flatten)] - wallet: WalletSource, + keystore_opts: KeystoreOpts, + /// Privkey source to use with the cargo stylus plugin. + #[arg(long)] + private_key_path: Option, /// If only compiling an onchain program, the address of the program to send a compilation tx for. #[arg(long)] compile_program_address: Option, @@ -84,14 +87,12 @@ pub enum DeployMode { } #[derive(Clone, Debug, Args)] -#[group(required = true, multiple = true)] -pub struct WalletSource { - #[arg(long, group = "keystore")] +#[group(multiple = true)] +pub struct KeystoreOpts { + #[arg(long)] keystore_path: Option, - #[arg(long, group = "keystore")] - keystore_password_path: Option, #[arg(long)] - private_key_path: Option, + keystore_password_path: Option, } #[tokio::main] From 3feba74869a6f240e76a2014108b9f5527b30025 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 22 Aug 2023 10:43:34 -0700 Subject: [PATCH 41/58] test fix --- arbitrator/cargo-stylus/src/check.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index b6d6291dd..f91f392e8 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -77,8 +77,8 @@ mod test { v128.const i32x4 1 2 3 4)) "#; let wasm_bytes = wat2wasm(wat.as_bytes()).unwrap(); - let disabled = vec![]; - match run_checks(&wasm_bytes, &[], &disabled) { + let disabled: Vec = vec![]; + match run_checks(&wasm_bytes, &[], disabled) { Ok(_) => panic!("Expected error"), Err(e) => assert!(e.contains("128-bit types are not supported")), } From 6aa8089d4e5d8790beff9ac3357cdbf223f65935 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 11:16:57 -0700 Subject: [PATCH 42/58] fix up cargo stylus subcommand usage --- arbitrator/cargo-stylus/src/main.rs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 2742ff3bb..6ced6930e 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use std::str::FromStr; use check::StylusCheck; -use clap::{Args, Parser, Subcommand, ValueEnum}; +use clap::{Args, Parser, ValueEnum}; use ethers::types::H160; mod check; @@ -13,19 +13,27 @@ mod deploy; mod project; mod tx; +#[derive(Parser, Debug)] +#[command(name = "cargo")] +#[command(bin_name = "cargo")] +enum CargoCli { + Stylus(StylusArgs), +} + #[derive(Parser, Debug)] #[command(name = "stylus")] +#[command(bin_name = "cargo stylus")] #[command(author = "Offchain Labs, Inc.")] #[command(version = "0.0.1")] #[command(about = "Cargo command for developing Arbitrum Stylus projects", long_about = None)] #[command(propagate_version = true)] -struct Cli { +struct StylusArgs { #[command(subcommand)] - command: Commands, + command: StylusSubcommands, } -#[derive(Debug, Subcommand)] -enum Commands { +#[derive(Parser, Debug, Clone)] +enum StylusSubcommands { /// Instrument a Rust project using Stylus. /// This command runs compiled WASM code through /// Stylus instrumentation checks and reports any failures. Allows for disabling specific @@ -51,7 +59,7 @@ enum Commands { Deploy(DeployConfig), } -#[derive(Debug, Args)] +#[derive(Debug, Args, Clone)] pub struct DeployConfig { /// Does not submit a transaction, but instead estimates the gas required /// to complete the operation. @@ -97,9 +105,9 @@ pub struct KeystoreOpts { #[tokio::main] async fn main() -> eyre::Result<(), String> { - let cli = Cli::parse(); - match cli.command { - Commands::Check { + let CargoCli::Stylus(args) = CargoCli::parse(); + match args.command { + StylusSubcommands::Check { disabled_checks, wasm_file_path, } => { @@ -118,7 +126,7 @@ async fn main() -> eyre::Result<(), String> { project::get_compressed_wasm_bytes(&wasm_file_path)?; check::run_checks(&wasm_file_bytes, &deploy_ready_code, disabled) } - Commands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { + StylusSubcommands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { Ok(_) => Ok(()), Err(e) => Err(format!( "Could not perform deployment/compilation transaction {}", From 14fff7c82629e3ef4dd6e0a55df0b98fde51c776 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 11:25:29 -0700 Subject: [PATCH 43/58] rename to activate --- arbitrator/cargo-stylus/src/check.rs | 2 +- arbitrator/cargo-stylus/src/constants.rs | 4 +-- arbitrator/cargo-stylus/src/deploy.rs | 32 +++++++++++++----------- arbitrator/cargo-stylus/src/main.rs | 14 +++++------ 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index f91f392e8..054d2d169 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -27,7 +27,7 @@ impl TryFrom<&str> for StylusCheck { } /// Runs a series of checks on the WASM program to ensure it is valid for compilation -/// and code size before being deployed and compiled onchain. An optional list of checks +/// and code size before being deployed and activated onchain. An optional list of checks /// to disable can be specified. pub fn run_checks( wasm_file_bytes: &[u8], diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index ab5664aec..e086300b3 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -10,7 +10,7 @@ pub const BROTLI_COMPRESSION_LEVEL: u32 = 11; pub const ARB_WASM_ADDRESS: &str = "0000000000000000000000000000000000000071"; /// Maximum allowed size of a program on Arbitrum (and Ethereum). pub const MAX_PROGRAM_SIZE: ByteSize = ByteSize::kb(24); -/// 4 bytes method selector for the compile method of ArbWasm. -pub const ARBWASM_COMPILE_METHOD_HASH: &str = "2e50f32b"; +/// 4 bytes method selector for the activate method of ArbWasm. +pub const ARBWASM_ACTIVATE_METHOD_HASH: &str = "2e50f32b"; /// Target for compiled WASM folder in a Rust project pub const RUST_TARGET: &str = "wasm32-unknown-unknown"; diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index ca69e35a8..ebdaaae05 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -16,8 +16,8 @@ use crate::{constants, project, tx, DeployConfig, DeployMode}; /// Performs one of three different modes for a Stylus program: /// DeployOnly: Sends a signed tx to deploy a Stylus program to a new address. -/// CompileOnly: Sends a signed tx to compile a Stylus program at a specified address. -/// DeployAndCompile (default): Sends both transactions above. +/// ActivateOnly: Sends a signed tx to activate a Stylus program at a specified address. +/// DeployAndActivate (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let wallet = load_wallet(&cfg)?; @@ -38,13 +38,13 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let expected_program_addr = get_contract_address(wallet.address(), nonce); - let (deploy, compile) = match cfg.mode { + let (deploy, activate) = match cfg.mode { Some(DeployMode::DeployOnly) => (true, false), - Some(DeployMode::CompileOnly) => (false, true), - // Default mode is to deploy and compile + Some(DeployMode::ActivateOnly) => (false, true), + // Default mode is to deploy and activate None => { - if cfg.estimate_gas_only && cfg.compile_program_address.is_none() { - // cannot compile if not really deploying + if cfg.estimate_gas_only && cfg.activate_program_address.is_none() { + // cannot activate if not really deploying (true, false) } else { (true, true) @@ -65,16 +65,18 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .data(deployment_calldata); tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request).await?; } - if compile { - let program_addr = cfg.compile_program_address.unwrap_or(expected_program_addr); - println!("Compiling program at address {program_addr:#032x}"); - let mut compile_calldata = vec![]; - let compile_method_hash = hex::decode(constants::ARBWASM_COMPILE_METHOD_HASH).unwrap(); - compile_calldata.extend(compile_method_hash); + if activate { + let program_addr = cfg + .activate_program_address + .unwrap_or(expected_program_addr); + println!("Activating program at address {program_addr:#032x}"); + let mut activate_calldata = vec![]; + let activate_method_hash = hex::decode(constants::ARBWASM_ACTIVATE_METHOD_HASH).unwrap(); + activate_calldata.extend(activate_method_hash); let mut extension = [0u8; 32]; // Next, we add the address to the last 20 bytes of extension extension[12..32].copy_from_slice(program_addr.as_bytes()); - compile_calldata.extend(extension); + activate_calldata.extend(extension); let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); let to = H160::from_slice(&to); @@ -82,7 +84,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let mut tx_request = Eip1559TransactionRequest::new() .from(wallet.address()) .to(to) - .data(compile_calldata); + .data(activate_calldata); tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request).await?; } Ok(()) diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 6ced6930e..97d2b4cb9 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -53,8 +53,8 @@ enum StylusSubcommands { }, /// Instruments a Rust project using Stylus and by outputting its brotli-compressed WASM code. /// Then, it submits two transactions: the first deploys the WASM - /// program to an address and the second triggers a compilation onchain - /// Developers can choose to split up the deploy and compile steps via this command as desired. + /// program to an address and the second triggers an activation onchain + /// Developers can choose to split up the deploy and activate steps via this command as desired. #[command(alias = "d")] Deploy(DeployConfig), } @@ -65,8 +65,8 @@ pub struct DeployConfig { /// to complete the operation. #[arg(long)] estimate_gas_only: bool, - /// By default, submits two transactions to deploy and compile the program to Arbitrum. - /// Otherwise, a user could choose to split up the deploy and compile steps into individual transactions. + /// By default, submits two transactions to deploy and activate the program to Arbitrum. + /// Otherwise, a user could choose to split up the deploy and activate steps into individual transactions. #[arg(long, value_enum)] mode: Option, /// The endpoint of the L2 node to connect to. @@ -78,9 +78,9 @@ pub struct DeployConfig { /// Privkey source to use with the cargo stylus plugin. #[arg(long)] private_key_path: Option, - /// If only compiling an onchain program, the address of the program to send a compilation tx for. + /// If only activating an already-deployed, onchain program, the address of the program to send an activation tx for. #[arg(long)] - compile_program_address: Option, + activate_program_address: Option, /// If desired, it loads a WASM file from a specified path. If not provided, it will try to find /// a WASM file under the current working directory's Rust target release directory and use its /// contents for the deploy command. @@ -91,7 +91,7 @@ pub struct DeployConfig { #[derive(Debug, Clone, ValueEnum)] pub enum DeployMode { DeployOnly, - CompileOnly, + ActivateOnly, } #[derive(Clone, Debug, Args)] From ac27ee3b45d1dd2613446f73567e9dbc5f4b39f5 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 11:51:05 -0700 Subject: [PATCH 44/58] update method hash --- arbitrator/cargo-stylus/src/constants.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/constants.rs b/arbitrator/cargo-stylus/src/constants.rs index e086300b3..3fa14df78 100644 --- a/arbitrator/cargo-stylus/src/constants.rs +++ b/arbitrator/cargo-stylus/src/constants.rs @@ -11,6 +11,6 @@ pub const ARB_WASM_ADDRESS: &str = "0000000000000000000000000000000000000071"; /// Maximum allowed size of a program on Arbitrum (and Ethereum). pub const MAX_PROGRAM_SIZE: ByteSize = ByteSize::kb(24); /// 4 bytes method selector for the activate method of ArbWasm. -pub const ARBWASM_ACTIVATE_METHOD_HASH: &str = "2e50f32b"; +pub const ARBWASM_ACTIVATE_METHOD_HASH: &str = "58c780c2"; /// Target for compiled WASM folder in a Rust project pub const RUST_TARGET: &str = "wasm32-unknown-unknown"; From f100759c7a578dad31d6d49c444789acdc7fe828 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 14:37:36 -0700 Subject: [PATCH 45/58] Atomic Check Deploy/Compile Multicall --- arbitrator/cargo-stylus/src/deploy.rs | 19 +++--- arbitrator/cargo-stylus/src/main.rs | 1 + arbitrator/cargo-stylus/src/multicall.rs | 74 ++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 7 deletions(-) create mode 100644 arbitrator/cargo-stylus/src/multicall.rs diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index ebdaaae05..c3f52cf17 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -70,13 +70,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .activate_program_address .unwrap_or(expected_program_addr); println!("Activating program at address {program_addr:#032x}"); - let mut activate_calldata = vec![]; - let activate_method_hash = hex::decode(constants::ARBWASM_ACTIVATE_METHOD_HASH).unwrap(); - activate_calldata.extend(activate_method_hash); - let mut extension = [0u8; 32]; - // Next, we add the address to the last 20 bytes of extension - extension[12..32].copy_from_slice(program_addr.as_bytes()); - activate_calldata.extend(extension); + let activate_calldata = activation_calldata(&program_addr); let to = hex::decode(constants::ARB_WASM_ADDRESS).unwrap(); let to = H160::from_slice(&to); @@ -131,6 +125,17 @@ fn read_secret_from_file(fpath: &str) -> Result { Ok(secret.trim().to_string()) } +pub fn activation_calldata(program_addr: &H160) -> Vec { + let mut activate_calldata = vec![]; + let activate_method_hash = hex::decode(constants::ARBWASM_ACTIVATE_METHOD_HASH).unwrap(); + activate_calldata.extend(activate_method_hash); + let mut extension = [0u8; 32]; + // Next, we add the address to the last 20 bytes of extension + extension[12..32].copy_from_slice(program_addr.as_bytes()); + activate_calldata.extend(extension); + activate_calldata +} + /// Prepares an EVM bytecode prelude for contract creation. pub fn program_deployment_calldata(code: &[u8]) -> Vec { let mut code_len = [0u8; 32]; diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 97d2b4cb9..e5b7fad58 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -10,6 +10,7 @@ use ethers::types::H160; mod check; mod constants; mod deploy; +mod multicall; mod project; mod tx; diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs new file mode 100644 index 000000000..a5235fbaa --- /dev/null +++ b/arbitrator/cargo-stylus/src/multicall.rs @@ -0,0 +1,74 @@ +use ethers::types::{H160, U256}; + +use crate::{constants::ARB_WASM_ADDRESS, deploy::activation_calldata}; + +pub fn check_deploy_compile_succeeds(compressed_wasm: &[u8], expected_address: &H160) -> Vec { + let deployment_calldata = program_deployment_calldata(&compressed_wasm); + + let mut multicall_args = + args_for_multicall(MulticallArg::Call, H160::zero(), None, deployment_calldata); + + let activate_calldata = activation_calldata(expected_address); + let arbwasm_address = hex::decode(ARB_WASM_ADDRESS).unwrap(); + multicall_append( + &mut multicall_args, + MulticallArg::Call, + H160::from_slice(&arbwasm_address), + None, + compile_calldata, + ); + multicall_args +} + +#[derive(Clone)] +enum MulticallArg { + Call, + DelegateCall, + StaticCall, +} + +impl From for u8 { + fn from(value: MulticallArg) -> Self { + match value { + MulticallArg::Call => 0x00, + MulticallArg::DelegateCall => 0x01, + MulticallArg::StaticCall => 0x02, + } + } +} + +fn args_for_multicall( + opcode: MulticallArg, + address: H160, + value: Option, + calldata: Vec, +) -> Vec { + let mut args = vec![0x01]; + let mut length: u32 = 21 + calldata.len() as u32; + if matches!(opcode, MulticallArg::Call) { + length += 32; + } + args.extend(length.to_be_bytes()); + args.push(opcode.clone().into()); + + if matches!(opcode, MulticallArg::Call) { + let mut val = [0u8; 32]; + value.unwrap_or(U256::zero()).to_big_endian(&mut val); + args.extend(val); + } + args.extend(address.as_bytes()); + args.extend(calldata); + args +} + +fn multicall_append( + calls: &mut Vec, + opcode: MulticallArg, + address: H160, + value: Option, + inner: Vec, +) { + calls[0] += 1; // add another call + let args = args_for_multicall(opcode, address, value, inner); + calls.extend(args[1..].iter().cloned()); +} From 01d8894d154505389bb9ee17ee8ebbd9abae8d66 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 15:37:35 -0700 Subject: [PATCH 46/58] check can activate using state override --- arbitrator/cargo-stylus/src/check.rs | 85 +++++++++++++----------- arbitrator/cargo-stylus/src/main.rs | 1 - arbitrator/cargo-stylus/src/multicall.rs | 74 --------------------- system_tests/program_test.go | 62 +++++++++++++++++ 4 files changed, 110 insertions(+), 112 deletions(-) delete mode 100644 arbitrator/cargo-stylus/src/multicall.rs diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 054d2d169..282e4ffb6 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -3,9 +3,22 @@ use bytesize::ByteSize; use arbutil::Color; -use prover::programs::prelude::*; -use crate::constants; +use ethers::{ + providers::JsonRpcClient, + types::{transaction::eip2718::TypedTransaction, Address}, +}; + +use crate::{ + constants::{ARB_WASM_ADDRESS, MAX_PROGRAM_SIZE}, + deploy::activation_calldata, +}; + +use ethers::types::Eip1559TransactionRequest; +use ethers::{ + core::types::spoof, + providers::{Provider, RawCall}, +}; /// Defines the stylus checks that occur during the compilation of a WASM program /// into a module. Checks can be disabled during the compilation process for debugging purposes. @@ -37,50 +50,48 @@ pub fn run_checks( let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); let check_compressed_size = disabled.contains(&StylusCheck::CompressedSize); - if check_compressed_size && compressed_size > constants::MAX_PROGRAM_SIZE { + if check_compressed_size && compressed_size > MAX_PROGRAM_SIZE { return Err(format!( "Brotli-compressed WASM size {} is bigger than program size limit: {}", compressed_size.to_string().red(), - constants::MAX_PROGRAM_SIZE, + MAX_PROGRAM_SIZE, )); } - compile_native_wasm_module(CompileConfig::default(), &wasm_file_bytes)?; + //check_can_activate(client, expected_program_address, compressed_wasm) Ok(()) } -/// Compiles compressed wasm file bytes into a native module using a specified compile config. -pub fn compile_native_wasm_module( - cfg: CompileConfig, - wasm_file_bytes: &[u8], -) -> eyre::Result, String> { - let module = stylus::native::module(wasm_file_bytes, cfg) - .map_err(|e| format!("Could not compile wasm {}", e))?; - let success = "Stylus compilation successful!".to_string().mint(); - println!("{}", success); +/// Checks if a program can be successfully activated onchain before it is deployed +/// by using an eth_call override that injects the program's code at a specified address. +/// This allows for verifying an activation call is correct and will succeed if sent +/// as a transaction with the appropriate gas. +pub async fn check_can_activate( + client: Provider, + expected_program_address: &Address, + compressed_wasm: Vec, +) -> eyre::Result<(), String> +where + T: JsonRpcClient + Sync + Send + std::fmt::Debug, +{ + let calldata = activation_calldata(expected_program_address); + let to = hex::decode(ARB_WASM_ADDRESS).unwrap(); + let to = Address::from_slice(&to); + + let tx_request = Eip1559TransactionRequest::new().to(to).data(calldata); + let tx = TypedTransaction::Eip1559(tx_request); - println!( - "Compiled WASM module total size: {}", - ByteSize::b(module.len() as u64), + // Spoof the state as if the program already exists at the specified address + // using an eth_call override. + let state = spoof::code( + Address::from_slice(expected_program_address.as_bytes()), + compressed_wasm.into(), ); - Ok(module) -} + let response = client + .call_raw(&tx) + .state(&state) + .await + .map_err(|e| format!("program predeployment check failed: {e}"))?; -#[cfg(test)] -mod test { - use super::*; - use wasmer::wat2wasm; - #[test] - fn test_run_checks() { - let wat = r#" - (module - (func $foo (export "foo") (result v128) - v128.const i32x4 1 2 3 4)) - "#; - let wasm_bytes = wat2wasm(wat.as_bytes()).unwrap(); - let disabled: Vec = vec![]; - match run_checks(&wasm_bytes, &[], disabled) { - Ok(_) => panic!("Expected error"), - Err(e) => assert!(e.contains("128-bit types are not supported")), - } - } + println!("Got response: {}", hex::encode(&response)); + Ok(()) } diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index e5b7fad58..97d2b4cb9 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -10,7 +10,6 @@ use ethers::types::H160; mod check; mod constants; mod deploy; -mod multicall; mod project; mod tx; diff --git a/arbitrator/cargo-stylus/src/multicall.rs b/arbitrator/cargo-stylus/src/multicall.rs deleted file mode 100644 index a5235fbaa..000000000 --- a/arbitrator/cargo-stylus/src/multicall.rs +++ /dev/null @@ -1,74 +0,0 @@ -use ethers::types::{H160, U256}; - -use crate::{constants::ARB_WASM_ADDRESS, deploy::activation_calldata}; - -pub fn check_deploy_compile_succeeds(compressed_wasm: &[u8], expected_address: &H160) -> Vec { - let deployment_calldata = program_deployment_calldata(&compressed_wasm); - - let mut multicall_args = - args_for_multicall(MulticallArg::Call, H160::zero(), None, deployment_calldata); - - let activate_calldata = activation_calldata(expected_address); - let arbwasm_address = hex::decode(ARB_WASM_ADDRESS).unwrap(); - multicall_append( - &mut multicall_args, - MulticallArg::Call, - H160::from_slice(&arbwasm_address), - None, - compile_calldata, - ); - multicall_args -} - -#[derive(Clone)] -enum MulticallArg { - Call, - DelegateCall, - StaticCall, -} - -impl From for u8 { - fn from(value: MulticallArg) -> Self { - match value { - MulticallArg::Call => 0x00, - MulticallArg::DelegateCall => 0x01, - MulticallArg::StaticCall => 0x02, - } - } -} - -fn args_for_multicall( - opcode: MulticallArg, - address: H160, - value: Option, - calldata: Vec, -) -> Vec { - let mut args = vec![0x01]; - let mut length: u32 = 21 + calldata.len() as u32; - if matches!(opcode, MulticallArg::Call) { - length += 32; - } - args.extend(length.to_be_bytes()); - args.push(opcode.clone().into()); - - if matches!(opcode, MulticallArg::Call) { - let mut val = [0u8; 32]; - value.unwrap_or(U256::zero()).to_big_endian(&mut val); - args.extend(val); - } - args.extend(address.as_bytes()); - args.extend(calldata); - args -} - -fn multicall_append( - calls: &mut Vec, - opcode: MulticallArg, - address: H160, - value: Option, - inner: Vec, -) { - calls[0] += 1; // add another call - let args = args_for_multicall(opcode, address, value, inner); - calls.extend(args[1..].iter().cloned()); -} diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 1537204c4..b8427d22c 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -24,6 +24,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbnode" @@ -452,6 +453,67 @@ func testLogs(t *testing.T, jit bool) { validateBlocks(t, 10, jit, ctx, node, l2client) } +func TestStylusCargoPlugin(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) + rand.Seed(time.Now().UTC().UnixNano()) + + // TODO: track latest ArbOS version + chainConfig := params.ArbitrumDevTestChainConfig() + chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10 + + l2config := arbnode.ConfigDefaultL1Test() + l2config.BlockValidator.Enable = true + l2config.BatchPoster.Enable = true + l2config.L1Reader.Enable = true + l2config.Sequencer.MaxRevertGasReject = 0 + l2config.L1Reader.OldHeaderTimeout = 10 * time.Minute + AddDefaultValNode(t, ctx, l2config, true /* jit */) + + stackConf := node.DefaultConfig + stackConf.HTTPHost = "localhost" + stackConf.HTTPPort = 9999 + stackConf.HTTPModules = append(stackConf.HTTPModules, "eth") + stackConf.P2P.NoDiscovery = true + stackConf.P2P.ListenAddr = "" + l2info, node, l2client, _, _, _, l1stack := createTestNodeOnL1WithConfig(t, ctx, true, l2config, chainConfig, &stackConf) + + cleanup := func() { + requireClose(t, l1stack) + node.StopAndWait() + cancel() + } + defer cleanup() + + auth := l2info.GetDefaultTransactOpts("Owner", ctx) + fmt.Printf("Owner %x", crypto.FromECDSA(l2info.Accounts["Owner"].PrivateKey)) + + arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) + Require(t, err) + arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, l2client) + Require(t, err) + + ensure := func(tx *types.Transaction, err error) *types.Receipt { + t.Helper() + Require(t, err) + receipt, err := EnsureTxSucceeded(ctx, l2client, tx) + Require(t, err) + return receipt + } + + // Set random pricing params. Note that the ink price is measured in bips, + // so an ink price of 10k means that 1 evm gas buys exactly 1 ink. + // We choose a range on both sides of this value. + inkPrice := testhelpers.RandomUint32(0, 20000) // evm to ink + wasmHostioInk := testhelpers.RandomUint64(0, 5000) // amount of ink + colors.PrintMint(fmt.Sprintf("ink price=%d, HostIO ink=%d", inkPrice, wasmHostioInk)) + + ensure(arbDebug.BecomeChainOwner(&auth)) + ensure(arbOwner.SetInkPrice(&auth, inkPrice)) + + time.Sleep(time.Hour) +} + func TestProgramCreate(t *testing.T) { t.Parallel() testCreate(t, true) From 368093885fc9078109f66d57f496ba560b8ae856 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 16:06:18 -0700 Subject: [PATCH 47/58] abstract wallet code --- arbitrator/cargo-stylus/src/check.rs | 75 ++++++++++++++------------ arbitrator/cargo-stylus/src/deploy.rs | 50 ++---------------- arbitrator/cargo-stylus/src/main.rs | 76 +++++++++++---------------- arbitrator/cargo-stylus/src/wallet.rs | 47 +++++++++++++++++ 4 files changed, 122 insertions(+), 126 deletions(-) create mode 100644 arbitrator/cargo-stylus/src/wallet.rs diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 282e4ffb6..b1c90e468 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,17 +1,22 @@ +use std::path::PathBuf; +use std::str::FromStr; + // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use bytesize::ByteSize; use arbutil::Color; -use ethers::{ - providers::JsonRpcClient, - types::{transaction::eip2718::TypedTransaction, Address}, -}; - use crate::{ constants::{ARB_WASM_ADDRESS, MAX_PROGRAM_SIZE}, deploy::activation_calldata, + project, wallet, CheckConfig, +}; +use ethers::prelude::*; +use ethers::utils::get_contract_address; +use ethers::{ + providers::JsonRpcClient, + types::{transaction::eip2718::TypedTransaction, Address}, }; use ethers::types::Eip1559TransactionRequest; @@ -20,45 +25,45 @@ use ethers::{ providers::{Provider, RawCall}, }; -/// Defines the stylus checks that occur during the compilation of a WASM program -/// into a module. Checks can be disabled during the compilation process for debugging purposes. -#[derive(PartialEq)] -pub enum StylusCheck { - CompressedSize, - // TODO: Adding more checks here would require being able to toggle - // compiler middlewares in the compile config store() method. -} - -impl TryFrom<&str> for StylusCheck { - type Error = String; - fn try_from(value: &str) -> Result { - match value { - "compressed-size" => Ok(StylusCheck::CompressedSize), - _ => Err(format!("invalid Stylus middleware check: {}", value,)), - } - } -} - /// Runs a series of checks on the WASM program to ensure it is valid for compilation /// and code size before being deployed and activated onchain. An optional list of checks /// to disable can be specified. -pub fn run_checks( - wasm_file_bytes: &[u8], - deploy_ready_code: &[u8], - disabled: Vec, -) -> eyre::Result<(), String> { - let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); - let check_compressed_size = disabled.contains(&StylusCheck::CompressedSize); +pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { + let wasm_file_path: PathBuf = match cfg.wasm_file_path { + Some(path) => PathBuf::from_str(&path).unwrap(), + None => project::build_project_to_wasm()?, + }; + let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path)?; - if check_compressed_size && compressed_size > MAX_PROGRAM_SIZE { + let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); + if compressed_size > MAX_PROGRAM_SIZE { return Err(format!( "Brotli-compressed WASM size {} is bigger than program size limit: {}", compressed_size.to_string().red(), MAX_PROGRAM_SIZE, )); } - //check_can_activate(client, expected_program_address, compressed_wasm) - Ok(()) + + let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts)?; + + let provider = Provider::::try_from(&cfg.endpoint) + .map_err(|e| format!("could not initialize provider from http {}", e))?; + let chain_id = provider + .get_chainid() + .await + .map_err(|e| format!("could not get chain id {}", e))? + .as_u64(); + let client = SignerMiddleware::new(provider.clone(), wallet.clone().with_chain_id(chain_id)); + + let addr = wallet.address(); + let nonce = client + .get_transaction_count(addr, None) + .await + .map_err(|e| format!("could not get nonce {} {}", addr, e))?; + + let next_program_addr = get_contract_address(wallet.address(), nonce); + let expected_program_addr = cfg.activate_program_address.unwrap_or(next_program_addr); + check_can_activate(provider, &expected_program_addr, deploy_ready_code).await } /// Checks if a program can be successfully activated onchain before it is deployed @@ -71,7 +76,7 @@ pub async fn check_can_activate( compressed_wasm: Vec, ) -> eyre::Result<(), String> where - T: JsonRpcClient + Sync + Send + std::fmt::Debug, + T: JsonRpcClient + Send + Sync + std::fmt::Debug, { let calldata = activation_calldata(expected_program_address); let to = hex::decode(ARB_WASM_ADDRESS).unwrap(); diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index c3f52cf17..daa30a314 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -1,7 +1,6 @@ -use std::io::{BufRead, BufReader}; -use std::path::PathBuf; // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE +use std::path::PathBuf; use std::str::FromStr; use ethers::types::{Eip1559TransactionRequest, H160, U256}; @@ -9,17 +8,17 @@ use ethers::utils::get_contract_address; use ethers::{ middleware::SignerMiddleware, providers::{Http, Middleware, Provider}, - signers::{LocalWallet, Signer}, + signers::Signer, }; -use crate::{constants, project, tx, DeployConfig, DeployMode}; +use crate::{constants, project, tx, wallet, DeployConfig, DeployMode}; /// Performs one of three different modes for a Stylus program: /// DeployOnly: Sends a signed tx to deploy a Stylus program to a new address. /// ActivateOnly: Sends a signed tx to activate a Stylus program at a specified address. /// DeployAndActivate (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { - let wallet = load_wallet(&cfg)?; + let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts)?; let provider = Provider::::try_from(&cfg.endpoint) .map_err(|e| format!("could not initialize provider from http {}", e))?; @@ -84,47 +83,6 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { Ok(()) } -/// Loads a wallet for signing transactions either from a private key file path. -/// or a keystore along with a keystore password file. -fn load_wallet(cfg: &DeployConfig) -> eyre::Result { - if cfg.private_key_path.is_some() - && (cfg.keystore_opts.keystore_password_path.is_some() - && cfg.keystore_opts.keystore_path.is_some()) - { - return Err("must provide either privkey path or keystore options exclusively".to_string()); - } - - if let Some(priv_key_path) = &cfg.private_key_path { - let privkey = read_secret_from_file(&priv_key_path)?; - return LocalWallet::from_str(&privkey) - .map_err(|e| format!("could not parse private key {}", e)); - } - let keystore_password_path = cfg - .keystore_opts - .keystore_password_path - .as_ref() - .ok_or("no keystore password path provided")?; - let keystore_pass = read_secret_from_file(&keystore_password_path)?; - let keystore_path = cfg - .keystore_opts - .keystore_path - .as_ref() - .ok_or("no keystore path provided")?; - LocalWallet::decrypt_keystore(keystore_path, keystore_pass) - .map_err(|e| format!("could not decrypt keystore {}", e)) -} - -fn read_secret_from_file(fpath: &str) -> Result { - let f = - std::fs::File::open(fpath).map_err(|e| format!("could not read secret from file {}", e))?; - let mut buf_reader = BufReader::new(f); - let mut secret = String::new(); - buf_reader - .read_line(&mut secret) - .map_err(|e| format!("could not read secret from file {}", e))?; - Ok(secret.trim().to_string()) -} - pub fn activation_calldata(program_addr: &H160) -> Vec { let mut activate_calldata = vec![]; let activate_method_hash = hex::decode(constants::ARBWASM_ACTIVATE_METHOD_HASH).unwrap(); diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 97d2b4cb9..58026ae55 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,9 +1,5 @@ // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE -use std::path::PathBuf; -use std::str::FromStr; - -use check::StylusCheck; use clap::{Args, Parser, ValueEnum}; use ethers::types::H160; @@ -12,6 +8,7 @@ mod constants; mod deploy; mod project; mod tx; +mod wallet; #[derive(Parser, Debug)] #[command(name = "cargo")] @@ -35,22 +32,9 @@ struct StylusArgs { #[derive(Parser, Debug, Clone)] enum StylusSubcommands { /// Instrument a Rust project using Stylus. - /// This command runs compiled WASM code through - /// Stylus instrumentation checks and reports any failures. Allows for disabling specific - /// checks via the `--disabled-checks` flag. + /// This command runs compiled WASM code through Stylus instrumentation checks and reports any failures. #[command(alias = "c")] - Check { - /// Disables specific compilation checks. At the moment, `compressed-size` is the only - /// option available to disable. Disabling it skips checking the compressed program - /// is within the 24Kb contract limit. - #[arg(long)] - disabled_checks: Option>, - /// If desired, it loads a WASM file from a specified path. If not provided, it will try to find - /// a WASM file under the current working directory's Rust target release directory and use its - /// contents for the deploy command. - #[arg(long)] - wasm_file_path: Option, - }, + Check(CheckConfig), /// Instruments a Rust project using Stylus and by outputting its brotli-compressed WASM code. /// Then, it submits two transactions: the first deploys the WASM /// program to an address and the second triggers an activation onchain @@ -59,6 +43,27 @@ enum StylusSubcommands { Deploy(DeployConfig), } +#[derive(Debug, Args, Clone)] +pub struct CheckConfig { + /// The endpoint of the L2 node to connect to. + #[arg(short, long, default_value = "http://localhost:8545")] + endpoint: String, + /// If desired, it loads a WASM file from a specified path. If not provided, it will try to find + /// a WASM file under the current working directory's Rust target release directory and use its + /// contents for the deploy command. + #[arg(long)] + wasm_file_path: Option, + /// If only activating an already-deployed, onchain program, the address of the program to send an activation tx for. + #[arg(long)] + activate_program_address: Option, + /// Privkey source to use with the cargo stylus plugin. + #[arg(long)] + private_key_path: Option, + /// Wallet source to use with the cargo stylus plugin. + #[command(flatten)] + keystore_opts: KeystoreOpts, +} + #[derive(Debug, Args, Clone)] pub struct DeployConfig { /// Does not submit a transaction, but instead estimates the gas required @@ -106,32 +111,13 @@ pub struct KeystoreOpts { #[tokio::main] async fn main() -> eyre::Result<(), String> { let CargoCli::Stylus(args) = CargoCli::parse(); + match args.command { - StylusSubcommands::Check { - disabled_checks, - wasm_file_path, - } => { - let disabled = disabled_checks.map_or(Vec::default(), |checks| { - checks - .into_iter() - .map(|s| s.as_str().try_into()) - .collect::, String>>() - .expect("Could not parse disabled Stylus checks") - }); - let wasm_file_path: PathBuf = match wasm_file_path { - Some(path) => PathBuf::from_str(&path).unwrap(), - None => project::build_project_to_wasm()?, - }; - let (wasm_file_bytes, deploy_ready_code) = - project::get_compressed_wasm_bytes(&wasm_file_path)?; - check::run_checks(&wasm_file_bytes, &deploy_ready_code, disabled) - } - StylusSubcommands::Deploy(deploy_config) => match deploy::deploy(deploy_config).await { - Ok(_) => Ok(()), - Err(e) => Err(format!( - "Could not perform deployment/compilation transaction {}", - e - )), - }, + StylusSubcommands::Check(cfg) => check::run_checks(cfg) + .await + .map_err(|e| format!("Could not run Stylus checks: {e}")), + StylusSubcommands::Deploy(cfg) => deploy::deploy(cfg) + .await + .map_err(|e| format!("Could not perform deploy / activate tx: {e}")), } } diff --git a/arbitrator/cargo-stylus/src/wallet.rs b/arbitrator/cargo-stylus/src/wallet.rs new file mode 100644 index 000000000..f80c28376 --- /dev/null +++ b/arbitrator/cargo-stylus/src/wallet.rs @@ -0,0 +1,47 @@ +use std::io::{BufRead, BufReader}; +use std::str::FromStr; + +use ethers::signers::LocalWallet; + +use crate::KeystoreOpts; + +/// Loads a wallet for signing transactions either from a private key file path. +/// or a keystore along with a keystore password file. +pub fn load( + private_key_path: Option, + keystore_opts: KeystoreOpts, +) -> eyre::Result { + if private_key_path.is_some() + && (keystore_opts.keystore_password_path.is_some() && keystore_opts.keystore_path.is_some()) + { + return Err("must provide either privkey path or keystore options exclusively".to_string()); + } + + if let Some(priv_key_path) = &private_key_path { + let privkey = read_secret_from_file(&priv_key_path)?; + return LocalWallet::from_str(&privkey) + .map_err(|e| format!("could not parse private key {}", e)); + } + let keystore_password_path = keystore_opts + .keystore_password_path + .as_ref() + .ok_or("no keystore password path provided")?; + let keystore_pass = read_secret_from_file(&keystore_password_path)?; + let keystore_path = keystore_opts + .keystore_path + .as_ref() + .ok_or("no keystore path provided")?; + LocalWallet::decrypt_keystore(keystore_path, keystore_pass) + .map_err(|e| format!("could not decrypt keystore {}", e)) +} + +fn read_secret_from_file(fpath: &str) -> Result { + let f = + std::fs::File::open(fpath).map_err(|e| format!("could not read secret from file {}", e))?; + let mut buf_reader = BufReader::new(f); + let mut secret = String::new(); + buf_reader + .read_line(&mut secret) + .map_err(|e| format!("could not read secret from file {}", e))?; + Ok(secret.trim().to_string()) +} From 8a54368ba9e72992a1c210fbe4cfecb6058756c1 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 16:09:07 -0700 Subject: [PATCH 48/58] fix up check --- arbitrator/cargo-stylus/src/check.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index b1c90e468..0ea5862f7 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -38,7 +38,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); if compressed_size > MAX_PROGRAM_SIZE { return Err(format!( - "Brotli-compressed WASM size {} is bigger than program size limit: {}", + "brotli-compressed WASM size {} is bigger than program size limit: {}", compressed_size.to_string().red(), MAX_PROGRAM_SIZE, )); @@ -47,11 +47,11 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts)?; let provider = Provider::::try_from(&cfg.endpoint) - .map_err(|e| format!("could not initialize provider from http {}", e))?; + .map_err(|e| format!("could not initialize provider from http {e}"))?; let chain_id = provider .get_chainid() .await - .map_err(|e| format!("could not get chain id {}", e))? + .map_err(|e| format!("could not get chain id {e}"))? .as_u64(); let client = SignerMiddleware::new(provider.clone(), wallet.clone().with_chain_id(chain_id)); @@ -59,7 +59,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let nonce = client .get_transaction_count(addr, None) .await - .map_err(|e| format!("could not get nonce {} {}", addr, e))?; + .map_err(|e| format!("could not get nonce {addr} {e}"))?; let next_program_addr = get_contract_address(wallet.address(), nonce); let expected_program_addr = cfg.activate_program_address.unwrap_or(next_program_addr); From 5a69f1663ded37fc2768918573209751b581a537 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 17:16:43 -0700 Subject: [PATCH 49/58] working --- arbitrator/cargo-stylus/src/check.rs | 55 ++++++++++++++++++---------- arbitrator/cargo-stylus/src/main.rs | 9 +++-- 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 0ea5862f7..aeba8ea8e 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -1,9 +1,8 @@ -use std::path::PathBuf; -use std::str::FromStr; - // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use bytesize::ByteSize; +use std::path::PathBuf; +use std::str::FromStr; use arbutil::Color; @@ -44,25 +43,30 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { )); } - let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts)?; - let provider = Provider::::try_from(&cfg.endpoint) .map_err(|e| format!("could not initialize provider from http {e}"))?; - let chain_id = provider - .get_chainid() - .await - .map_err(|e| format!("could not get chain id {e}"))? - .as_u64(); - let client = SignerMiddleware::new(provider.clone(), wallet.clone().with_chain_id(chain_id)); - let addr = wallet.address(); - let nonce = client - .get_transaction_count(addr, None) - .await - .map_err(|e| format!("could not get nonce {addr} {e}"))?; + let expected_program_addr = match cfg.activate_program_address { + Some(addr) => addr, + None => { + let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts)?; + let chain_id = provider + .get_chainid() + .await + .map_err(|e| format!("could not get chain id {e}"))? + .as_u64(); + let client = + SignerMiddleware::new(provider.clone(), wallet.clone().with_chain_id(chain_id)); + + let addr = wallet.address(); + let nonce = client + .get_transaction_count(addr, None) + .await + .map_err(|e| format!("could not get nonce {addr} {e}"))?; - let next_program_addr = get_contract_address(wallet.address(), nonce); - let expected_program_addr = cfg.activate_program_address.unwrap_or(next_program_addr); + get_contract_address(wallet.address(), nonce) + } + }; check_can_activate(provider, &expected_program_addr, deploy_ready_code).await } @@ -76,7 +80,7 @@ pub async fn check_can_activate( compressed_wasm: Vec, ) -> eyre::Result<(), String> where - T: JsonRpcClient + Send + Sync + std::fmt::Debug, + T: JsonRpcClient + Send + Sync, { let calldata = activation_calldata(expected_program_address); let to = hex::decode(ARB_WASM_ADDRESS).unwrap(); @@ -97,6 +101,17 @@ where .await .map_err(|e| format!("program predeployment check failed: {e}"))?; - println!("Got response: {}", hex::encode(&response)); + if response.len() < 2 { + return Err(format!( + "Stylus version bytes response too short: {}", + hex::encode(&response) + )); + } + let n = response.len(); + let version_bytes: [u8; 2] = response[n - 2..] + .try_into() + .map_err(|e| format!("could not parse Stylus version bytes: {e}"))?; + let version = u16::from_be_bytes(version_bytes); + println!("Program succeeded Stylus onchain activation checks - Stylus version: {version}"); Ok(()) } diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 58026ae55..47822e56f 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -53,7 +53,10 @@ pub struct CheckConfig { /// contents for the deploy command. #[arg(long)] wasm_file_path: Option, - /// If only activating an already-deployed, onchain program, the address of the program to send an activation tx for. + /// Specify the program address we want to check activation for. If unspecified, it will + /// compute the next program address from the user's wallet address and nonce. + /// To avoid needing a wallet to run this command, pass in 0x0000000000000000000000000000000000000000 + /// or any other desired program address to check against. #[arg(long)] activate_program_address: Option, /// Privkey source to use with the cargo stylus plugin. @@ -115,9 +118,9 @@ async fn main() -> eyre::Result<(), String> { match args.command { StylusSubcommands::Check(cfg) => check::run_checks(cfg) .await - .map_err(|e| format!("Could not run Stylus checks: {e}")), + .map_err(|e| format!("Stylus checks failed: {e}")), StylusSubcommands::Deploy(cfg) => deploy::deploy(cfg) .await - .map_err(|e| format!("Could not perform deploy / activate tx: {e}")), + .map_err(|e| format!("Deploy / activation command failed: {e}")), } } From 2a4f0c54a637d2d683564ca6941e8af624551fe6 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 17:31:42 -0700 Subject: [PATCH 50/58] red --- arbitrator/Cargo.lock | 4 -- arbitrator/cargo-stylus/Cargo.toml | 8 +-- arbitrator/cargo-stylus/src/check.rs | 23 +++---- arbitrator/cargo-stylus/src/color.rs | 87 ++++++++++++++++++++++++++ arbitrator/cargo-stylus/src/deploy.rs | 26 +++++--- arbitrator/cargo-stylus/src/main.rs | 6 +- arbitrator/cargo-stylus/src/project.rs | 22 ++++--- arbitrator/cargo-stylus/src/tx.rs | 8 +-- 8 files changed, 140 insertions(+), 44 deletions(-) create mode 100644 arbitrator/cargo-stylus/src/color.rs diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index ad2fb6173..2f0d09649 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -467,7 +467,6 @@ dependencies = [ name = "cargo-stylus" version = "0.1.0" dependencies = [ - "arbutil", "brotli2", "bytes", "bytesize", @@ -475,12 +474,9 @@ dependencies = [ "ethers", "eyre", "hex", - "prover", "serde", "serde_json", - "stylus", "tokio", - "wasmer", ] [[package]] diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index b1d62cb5b..6237724d6 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -12,13 +12,7 @@ clap = { version = "4.3.17", features = [ "derive" ] } eyre = "0.6.8" hex = "0.4.3" serde = { version = "1.0.174", features = ["derive"] } -stylus = { path = "../stylus/" } -arbutil = { path = "../arbutil/" } -prover = { path = "../prover/", default-features = false, features = ["native"] } bytesize = "1.2.0" ethers = "2.0.8" serde_json = "1.0.103" -tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } - -[dev-dependencies] -wasmer = { path = "../tools/wasmer/lib/api/" } \ No newline at end of file +tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } \ No newline at end of file diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index aeba8ea8e..1c4d6ba40 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -4,9 +4,8 @@ use bytesize::ByteSize; use std::path::PathBuf; use std::str::FromStr; -use arbutil::Color; - use crate::{ + color::Color, constants::{ARB_WASM_ADDRESS, MAX_PROGRAM_SIZE}, deploy::activation_calldata, project, wallet, CheckConfig, @@ -30,9 +29,11 @@ use ethers::{ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let wasm_file_path: PathBuf = match cfg.wasm_file_path { Some(path) => PathBuf::from_str(&path).unwrap(), - None => project::build_project_to_wasm()?, + None => project::build_project_to_wasm() + .map_err(|e| format!("failed to build project to WASM: {e}"))?, }; - let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path)?; + let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path) + .map_err(|e| format!("failed to get compressed WASM bytes: {e}"))?; let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); if compressed_size > MAX_PROGRAM_SIZE { @@ -95,15 +96,15 @@ where Address::from_slice(expected_program_address.as_bytes()), compressed_wasm.into(), ); - let response = client - .call_raw(&tx) - .state(&state) - .await - .map_err(|e| format!("program predeployment check failed: {e}"))?; + let response = client.call_raw(&tx).state(&state).await.map_err(|e| { + format!( + "program predeployment check failed when checking against ARB_WASM_ADDRESS {to}: {e}" + ) + })?; if response.len() < 2 { return Err(format!( - "Stylus version bytes response too short: {}", + "Stylus version bytes response too short, expected at least 2 bytes but got: {}", hex::encode(&response) )); } @@ -112,6 +113,6 @@ where .try_into() .map_err(|e| format!("could not parse Stylus version bytes: {e}"))?; let version = u16::from_be_bytes(version_bytes); - println!("Program succeeded Stylus onchain activation checks - Stylus version: {version}"); + println!("Program succeeded Stylus onchain activation checks with Stylus version: {version}"); Ok(()) } diff --git a/arbitrator/cargo-stylus/src/color.rs b/arbitrator/cargo-stylus/src/color.rs new file mode 100644 index 000000000..c3b074554 --- /dev/null +++ b/arbitrator/cargo-stylus/src/color.rs @@ -0,0 +1,87 @@ +// Copyright 2020-2023, Offchain Labs, Inc. +// For license information, see https://github.com/OffchainLabs/nitro/blob/master/LICENSE + +#![allow(dead_code)] + +use std::fmt::{Debug, Display}; + +pub const BLUE: &str = "\x1b[34;1m"; +pub const DIM: &str = "\x1b[2m"; +pub const GREY: &str = "\x1b[0;0m\x1b[90m"; +pub const MINT: &str = "\x1b[38;5;48;1m"; +pub const PINK: &str = "\x1b[38;5;161;1m"; +pub const RED: &str = "\x1b[31;1m"; +pub const CLEAR: &str = "\x1b[0;0m"; +pub const WHITE: &str = "\x1b[0;1m"; +pub const YELLOW: &str = "\x1b[33;1m"; + +pub trait Color { + fn color(&self, color: &str) -> String; + + fn blue(&self) -> String; + fn dim(&self) -> String; + fn clear(&self) -> String; + fn grey(&self) -> String; + fn mint(&self) -> String; + fn pink(&self) -> String; + fn red(&self) -> String; + fn white(&self) -> String; + fn yellow(&self) -> String; +} + +#[rustfmt::skip] +impl Color for T where T: Display { + + fn color(&self, color: &str) -> String { + format!("{}{}{}", color, self, CLEAR) + } + + fn blue(&self) -> String { self.color(BLUE) } + fn dim(&self) -> String { self.color(DIM) } + fn clear(&self) -> String { self.color(CLEAR) } + fn grey(&self) -> String { self.color(GREY) } + fn mint(&self) -> String { self.color(MINT) } + fn pink(&self) -> String { self.color(PINK) } + fn red(&self) -> String { self.color(RED) } + fn white(&self) -> String { self.color(WHITE) } + fn yellow(&self) -> String { self.color(YELLOW) } +} + +pub fn when(cond: bool, text: T, when_color: &str) -> String { + match cond { + true => text.color(when_color), + false => format!("{text}"), + } +} + +pub trait DebugColor { + fn debug_color(&self, color: &str) -> String; + + fn debug_blue(&self) -> String; + fn debug_dim(&self) -> String; + fn debug_clear(&self) -> String; + fn debug_grey(&self) -> String; + fn debug_mint(&self) -> String; + fn debug_pink(&self) -> String; + fn debug_red(&self) -> String; + fn debug_white(&self) -> String; + fn debug_yellow(&self) -> String; +} + +#[rustfmt::skip] +impl DebugColor for T where T: Debug { + + fn debug_color(&self, color: &str) -> String { + format!("{}{:?}{}", color, self, CLEAR) + } + + fn debug_blue(&self) -> String { self.debug_color(BLUE) } + fn debug_dim(&self) -> String { self.debug_color(DIM) } + fn debug_clear(&self) -> String { self.debug_color(CLEAR) } + fn debug_grey(&self) -> String { self.debug_color(GREY) } + fn debug_mint(&self) -> String { self.debug_color(MINT) } + fn debug_pink(&self) -> String { self.debug_color(PINK) } + fn debug_red(&self) -> String { self.debug_color(RED) } + fn debug_white(&self) -> String { self.debug_color(WHITE) } + fn debug_yellow(&self) -> String { self.debug_color(YELLOW) } +} diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index daa30a314..f75789c11 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -18,14 +18,19 @@ use crate::{constants, project, tx, wallet, DeployConfig, DeployMode}; /// ActivateOnly: Sends a signed tx to activate a Stylus program at a specified address. /// DeployAndActivate (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { - let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts)?; + let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts) + .map_err(|e| format!("could not load wallet: {e}"))?; - let provider = Provider::::try_from(&cfg.endpoint) - .map_err(|e| format!("could not initialize provider from http {}", e))?; + let provider = Provider::::try_from(&cfg.endpoint).map_err(|e| { + format!( + "could not initialize provider from http endpoint: {}: {e}", + &cfg.endpoint + ) + })?; let chain_id = provider .get_chainid() .await - .map_err(|e| format!("could not get chain id {}", e))? + .map_err(|e| format!("could not get chain id {e}"))? .as_u64(); let client = SignerMiddleware::new(provider, wallet.clone().with_chain_id(chain_id)); @@ -33,7 +38,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let nonce = client .get_transaction_count(addr, None) .await - .map_err(|e| format!("could not get nonce {} {}", addr, e))?; + .map_err(|e| format!("could not get nonce for address {addr}: {e}"))?; let expected_program_addr = get_contract_address(wallet.address(), nonce); @@ -54,7 +59,8 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { if deploy { let wasm_file_path: PathBuf = match &cfg.wasm_file_path { Some(path) => PathBuf::from_str(&path).unwrap(), - None => project::build_project_to_wasm()?, + None => project::build_project_to_wasm() + .map_err(|e| format!("could not build project to WASM: {e}"))?, }; let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!("Deploying program to address {expected_program_addr:#032x}"); @@ -62,7 +68,9 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let mut tx_request = Eip1559TransactionRequest::new() .from(wallet.address()) .data(deployment_calldata); - tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request).await?; + tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request) + .await + .map_err(|e| format!("could not submit signed deployment tx: {e}"))?; } if activate { let program_addr = cfg @@ -78,7 +86,9 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .from(wallet.address()) .to(to) .data(activate_calldata); - tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request).await?; + tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request) + .await + .map_err(|e| format!("could not submit signed deployment tx: {e}"))?; } Ok(()) } diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 47822e56f..db8837aa3 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -1,9 +1,11 @@ // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE use clap::{Args, Parser, ValueEnum}; +use color::Color; use ethers::types::H160; mod check; +mod color; mod constants; mod deploy; mod project; @@ -118,9 +120,9 @@ async fn main() -> eyre::Result<(), String> { match args.command { StylusSubcommands::Check(cfg) => check::run_checks(cfg) .await - .map_err(|e| format!("Stylus checks failed: {e}")), + .map_err(|e| format!("Stylus checks failed: {}", e.red())), StylusSubcommands::Deploy(cfg) => deploy::deploy(cfg) .await - .map_err(|e| format!("Deploy / activation command failed: {e}")), + .map_err(|e| format!("Deploy / activation command failed: {}", e.red())), } } diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index ce474d3c4..9c0fcff87 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -10,12 +10,14 @@ use bytes::buf::Reader; use bytes::Buf; use bytesize::ByteSize; -use crate::constants::{BROTLI_COMPRESSION_LEVEL, EOF_PREFIX, RUST_TARGET}; -use arbutil::Color; +use crate::{ + color::Color, + constants::{BROTLI_COMPRESSION_LEVEL, EOF_PREFIX, RUST_TARGET}, +}; /// Build a Rust project to WASM and return the path to the compiled WASM file. pub fn build_project_to_wasm() -> eyre::Result { - let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir {}", e))?; + let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir: {e}"))?; Command::new("cargo") .stdout(Stdio::inherit()) @@ -24,13 +26,13 @@ pub fn build_project_to_wasm() -> eyre::Result { .arg("--release") .arg(format!("--target={}", RUST_TARGET)) .output() - .map_err(|e| format!("failed to execute cargo build {}", e))?; + .map_err(|e| format!("failed to execute cargo build: {e}"))?; let release_path = cwd.join("target").join(RUST_TARGET).join("release"); // Gets the files in the release folder. let release_files: Vec = std::fs::read_dir(release_path) - .map_err(|e| format!("could not read release dir {}", e))? + .map_err(|e| format!("could not read release dir: {e}"))? .filter(|r| r.is_ok()) .map(|r| r.unwrap().path()) .filter(|r| r.is_file()) @@ -52,15 +54,19 @@ pub fn build_project_to_wasm() -> eyre::Result { pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, Vec), String> { println!("Reading WASM file at {}", wasm_path.display().yellow()); - let wasm_file_bytes = std::fs::read(wasm_path) - .map_err(|e| format!("could not read WASM file at target path {}", e))?; + let wasm_file_bytes = std::fs::read(wasm_path).map_err(|e| { + format!( + "could not read WASM file at target path {}: {e}", + wasm_path.as_os_str().to_string_lossy(), + ) + })?; let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); let mut compressor = BrotliEncoder::new(wbytes, BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor .read_to_end(&mut compressed_bytes) - .map_err(|e| format!("could not Brotli compress WASM bytes {}", e))?; + .map_err(|e| format!("could not Brotli compress WASM bytes: {e}"))?; println!( "Compressed WASM size: {}", diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index e77d4ec5b..f826fd1ad 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -19,11 +19,11 @@ where let block_num = client .get_block_number() .await - .map_err(|e| format!("could not get block number {}", e))?; + .map_err(|e| format!("could not get block number: {e}"))?; let block = client .get_block(block_num) .await - .map_err(|e| format!("could not get block {}", e))? + .map_err(|e| format!("could not get block: {e}"))? .ok_or("no block found")?; let base_fee = block .base_fee_per_gas @@ -51,11 +51,11 @@ where let pending_tx = client .send_transaction(typed, None) .await - .map_err(|e| format!("could not send tx {}", e))?; + .map_err(|e| format!("could not send tx: {e}"))?; let receipt = pending_tx .await - .map_err(|e| format!("could not get receipt {}", e))? + .map_err(|e| format!("could not get receipt: {e}"))? .ok_or("no receipt found")?; match receipt.status { From 589e83fcdf6f622bfbbc197000815782be7bcd83 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 17:32:25 -0700 Subject: [PATCH 51/58] rev program test --- system_tests/program_test.go | 62 ------------------------------------ 1 file changed, 62 deletions(-) diff --git a/system_tests/program_test.go b/system_tests/program_test.go index b8427d22c..1537204c4 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -24,7 +24,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" "github.com/offchainlabs/nitro/arbcompress" "github.com/offchainlabs/nitro/arbnode" @@ -453,67 +452,6 @@ func testLogs(t *testing.T, jit bool) { validateBlocks(t, 10, jit, ctx, node, l2client) } -func TestStylusCargoPlugin(t *testing.T) { - t.Parallel() - ctx, cancel := context.WithCancel(context.Background()) - rand.Seed(time.Now().UTC().UnixNano()) - - // TODO: track latest ArbOS version - chainConfig := params.ArbitrumDevTestChainConfig() - chainConfig.ArbitrumChainParams.InitialArbOSVersion = 10 - - l2config := arbnode.ConfigDefaultL1Test() - l2config.BlockValidator.Enable = true - l2config.BatchPoster.Enable = true - l2config.L1Reader.Enable = true - l2config.Sequencer.MaxRevertGasReject = 0 - l2config.L1Reader.OldHeaderTimeout = 10 * time.Minute - AddDefaultValNode(t, ctx, l2config, true /* jit */) - - stackConf := node.DefaultConfig - stackConf.HTTPHost = "localhost" - stackConf.HTTPPort = 9999 - stackConf.HTTPModules = append(stackConf.HTTPModules, "eth") - stackConf.P2P.NoDiscovery = true - stackConf.P2P.ListenAddr = "" - l2info, node, l2client, _, _, _, l1stack := createTestNodeOnL1WithConfig(t, ctx, true, l2config, chainConfig, &stackConf) - - cleanup := func() { - requireClose(t, l1stack) - node.StopAndWait() - cancel() - } - defer cleanup() - - auth := l2info.GetDefaultTransactOpts("Owner", ctx) - fmt.Printf("Owner %x", crypto.FromECDSA(l2info.Accounts["Owner"].PrivateKey)) - - arbOwner, err := precompilesgen.NewArbOwner(types.ArbOwnerAddress, l2client) - Require(t, err) - arbDebug, err := precompilesgen.NewArbDebug(types.ArbDebugAddress, l2client) - Require(t, err) - - ensure := func(tx *types.Transaction, err error) *types.Receipt { - t.Helper() - Require(t, err) - receipt, err := EnsureTxSucceeded(ctx, l2client, tx) - Require(t, err) - return receipt - } - - // Set random pricing params. Note that the ink price is measured in bips, - // so an ink price of 10k means that 1 evm gas buys exactly 1 ink. - // We choose a range on both sides of this value. - inkPrice := testhelpers.RandomUint32(0, 20000) // evm to ink - wasmHostioInk := testhelpers.RandomUint64(0, 5000) // amount of ink - colors.PrintMint(fmt.Sprintf("ink price=%d, HostIO ink=%d", inkPrice, wasmHostioInk)) - - ensure(arbDebug.BecomeChainOwner(&auth)) - ensure(arbOwner.SetInkPrice(&auth, inkPrice)) - - time.Sleep(time.Hour) -} - func TestProgramCreate(t *testing.T) { t.Parallel() testCreate(t, true) From e68f32f0251bd134b12f0acc29311c2e0de1a357 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 17:38:51 -0700 Subject: [PATCH 52/58] err format --- arbitrator/cargo-stylus/src/wallet.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arbitrator/cargo-stylus/src/wallet.rs b/arbitrator/cargo-stylus/src/wallet.rs index f80c28376..07ea0246d 100644 --- a/arbitrator/cargo-stylus/src/wallet.rs +++ b/arbitrator/cargo-stylus/src/wallet.rs @@ -36,12 +36,12 @@ pub fn load( } fn read_secret_from_file(fpath: &str) -> Result { - let f = - std::fs::File::open(fpath).map_err(|e| format!("could not read secret from file {}", e))?; + let f = std::fs::File::open(fpath) + .map_err(|e| format!("could not open file at path: {fpath}: {e}"))?; let mut buf_reader = BufReader::new(f); let mut secret = String::new(); buf_reader .read_line(&mut secret) - .map_err(|e| format!("could not read secret from file {}", e))?; + .map_err(|e| format!("could not read secret from file at path {fpath}: {e}"))?; Ok(secret.trim().to_string()) } From 4a90853545e757ada705dc134914fc7ca0b2a45f Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 17:48:45 -0700 Subject: [PATCH 53/58] err --- arbitrator/cargo-stylus/src/wallet.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/wallet.rs b/arbitrator/cargo-stylus/src/wallet.rs index 07ea0246d..1ee38a299 100644 --- a/arbitrator/cargo-stylus/src/wallet.rs +++ b/arbitrator/cargo-stylus/src/wallet.rs @@ -14,7 +14,7 @@ pub fn load( if private_key_path.is_some() && (keystore_opts.keystore_password_path.is_some() && keystore_opts.keystore_path.is_some()) { - return Err("must provide either privkey path or keystore options exclusively".to_string()); + return Err("must provide either --private-key-path or (--keystore-path and --keystore-password-path)".to_string()); } if let Some(priv_key_path) = &private_key_path { From 6a39767cfe6e57acaf78a843f4b75c258677e577 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 17:58:57 -0700 Subject: [PATCH 54/58] fix esc --- arbitrator/cargo-stylus/src/main.rs | 17 +++++++++++------ arbitrator/cargo-stylus/src/project.rs | 4 ++-- arbitrator/cargo-stylus/src/tx.rs | 10 ++++++++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index db8837aa3..1cd871cd5 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -118,11 +118,16 @@ async fn main() -> eyre::Result<(), String> { let CargoCli::Stylus(args) = CargoCli::parse(); match args.command { - StylusSubcommands::Check(cfg) => check::run_checks(cfg) - .await - .map_err(|e| format!("Stylus checks failed: {}", e.red())), - StylusSubcommands::Deploy(cfg) => deploy::deploy(cfg) - .await - .map_err(|e| format!("Deploy / activation command failed: {}", e.red())), + StylusSubcommands::Check(cfg) => { + if let Err(e) = check::run_checks(cfg).await { + println!("Stylus checks failed: {}", e.red()); + }; + } + StylusSubcommands::Deploy(cfg) => { + if let Err(e) = deploy::deploy(cfg).await { + println!("Deploy / activation command failed: {}", e.red()); + }; + } } + Ok(()) } diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index 9c0fcff87..8720824d2 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -52,7 +52,7 @@ pub fn build_project_to_wasm() -> eyre::Result { /// Reads a WASM file at a specified path and returns its brotli compressed bytes. pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, Vec), String> { - println!("Reading WASM file at {}", wasm_path.display().yellow()); + println!("Reading WASM file at {}", wasm_path.display().pink()); let wasm_file_bytes = std::fs::read(wasm_path).map_err(|e| { format!( @@ -72,7 +72,7 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, "Compressed WASM size: {}", ByteSize::b(compressed_bytes.len() as u64) .to_string() - .yellow(), + .mint(), ); let mut deploy_ready_code = hex::decode(EOF_PREFIX).unwrap(); deploy_ready_code.extend(compressed_bytes); diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index f826fd1ad..3f2b0ab25 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -1,5 +1,7 @@ // Copyright 2023, Offchain Labs, Inc. // For license information, see https://github.com/nitro/blob/master/LICENSE +use crate::color::Color; + use ethers::types::transaction::eip2718::TypedTransaction; use ethers::types::Eip1559TransactionRequest; use ethers::{middleware::SignerMiddleware, providers::Middleware, signers::Signer}; @@ -40,7 +42,7 @@ where .await .map_err(|e| format!("{}", e))?; - println!("Estimated gas: {estimated}"); + println!("Estimated gas: {}", estimated.pink()); if estimate_only { return Ok(()); @@ -66,7 +68,11 @@ where Some(_) => { let tx_hash = receipt.transaction_hash; let gas_used = receipt.gas_used.unwrap(); - println!("Confirmed tx {tx_hash:#032x}, gas used {gas_used}"); + println!( + "Confirmed tx {}, gas used {}", + tx_hash.pink(), + gas_used.mint() + ); Ok(()) } } From 24cf245b057dec7535ac49b082edc706ab3f6cb5 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 18:12:09 -0700 Subject: [PATCH 55/58] grey color --- arbitrator/cargo-stylus/src/project.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index 8720824d2..df9442397 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -52,7 +52,7 @@ pub fn build_project_to_wasm() -> eyre::Result { /// Reads a WASM file at a specified path and returns its brotli compressed bytes. pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, Vec), String> { - println!("Reading WASM file at {}", wasm_path.display().pink()); + println!("Reading WASM file at {}", wasm_path.display().grey()); let wasm_file_bytes = std::fs::read(wasm_path).map_err(|e| { format!( From a34a71ba2de059066c90573b8de71ce878863691 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 21:28:30 -0700 Subject: [PATCH 56/58] rem from workspace --- arbitrator/Cargo.toml | 1 - arbitrator/cargo-stylus/Cargo.toml | 3 ++- arbitrator/cargo-stylus/src/project.rs | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arbitrator/Cargo.toml b/arbitrator/Cargo.toml index fba3a6910..c9c4efad3 100644 --- a/arbitrator/Cargo.toml +++ b/arbitrator/Cargo.toml @@ -3,7 +3,6 @@ members = [ "arbutil", "prover", "stylus", - "cargo-stylus", "jit", ] exclude = [ diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index 6237724d6..d81b92408 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -15,4 +15,5 @@ serde = { version = "1.0.174", features = ["derive"] } bytesize = "1.2.0" ethers = "2.0.8" serde_json = "1.0.103" -tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } \ No newline at end of file +tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread" ] } +wasmer = "3.1.0" diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index df9442397..8c20bac1e 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -6,8 +6,6 @@ use std::path::PathBuf; use std::process::{Command, Stdio}; use brotli2::read::BrotliEncoder; -use bytes::buf::Reader; -use bytes::Buf; use bytesize::ByteSize; use crate::{ @@ -60,9 +58,12 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, wasm_path.as_os_str().to_string_lossy(), ) })?; - let wbytes: Reader<&[u8]> = wasm_file_bytes.reader(); - let mut compressor = BrotliEncoder::new(wbytes, BROTLI_COMPRESSION_LEVEL); + let wasm_bytes = wasmer::wat2wasm(&wasm_file_bytes) + .map_err(|e| format!("could not parse wasm file bytes: {e:?}"))?; + let wasm_bytes = &*wasm_bytes; + + let mut compressor = BrotliEncoder::new(wasm_bytes, BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor .read_to_end(&mut compressed_bytes) @@ -76,5 +77,5 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, ); let mut deploy_ready_code = hex::decode(EOF_PREFIX).unwrap(); deploy_ready_code.extend(compressed_bytes); - Ok((wasm_file_bytes, deploy_ready_code)) + Ok((wasm_bytes.to_vec(), deploy_ready_code)) } From 16ef120399334e464358eaddcd45211e1fb92835 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 21:43:43 -0700 Subject: [PATCH 57/58] last updates --- Dockerfile | 4 - arbitrator/Cargo.lock | 2528 +------------- arbitrator/cargo-stylus/Cargo.lock | 4346 ++++++++++++++++++++++++ arbitrator/cargo-stylus/Cargo.toml | 2 +- arbitrator/cargo-stylus/src/check.rs | 14 +- arbitrator/cargo-stylus/src/deploy.rs | 14 +- arbitrator/cargo-stylus/src/main.rs | 4 +- arbitrator/cargo-stylus/src/project.rs | 10 +- arbitrator/cargo-stylus/src/tx.rs | 10 +- arbitrator/cargo-stylus/src/wallet.rs | 8 +- 10 files changed, 4397 insertions(+), 2543 deletions(-) create mode 100644 arbitrator/cargo-stylus/Cargo.lock diff --git a/Dockerfile b/Dockerfile index 820293de9..3185fd5b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,7 +48,6 @@ COPY arbitrator/prover arbitrator/prover COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/tools/wasmer arbitrator/tools/wasmer COPY arbitrator/arbutil arbitrator/arbutil -COPY arbitrator/cargo-stylus arbitrator/cargo-stylus COPY --from=brotli-wasm-export / target/ RUN . ~/.cargo/env && NITRO_BUILD_IGNORE_TIMESTAMPS=1 RUSTFLAGS='-C symbol-mangling-version=v0' make build-wasm-libs @@ -97,7 +96,6 @@ COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/jit arbitrator/jit COPY arbitrator/stylus arbitrator/stylus COPY arbitrator/tools/wasmer arbitrator/tools/wasmer -COPY arbitrator/cargo-stylus arbitrator/cargo-stylus RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-header FROM scratch as prover-header-export @@ -118,7 +116,6 @@ COPY arbitrator/prover/Cargo.toml arbitrator/prover/ COPY arbitrator/jit/Cargo.toml arbitrator/jit/ COPY arbitrator/stylus/Cargo.toml arbitrator/stylus/ COPY arbitrator/tools/wasmer arbitrator/tools/wasmer -COPY arbitrator/cargo-stylus arbitrator/cargo-stylus RUN mkdir arbitrator/prover/src arbitrator/jit/src arbitrator/stylus/src && \ echo "fn test() {}" > arbitrator/jit/src/lib.rs && \ echo "fn test() {}" > arbitrator/prover/src/lib.rs && \ @@ -130,7 +127,6 @@ COPY arbitrator/prover arbitrator/prover COPY arbitrator/wasm-libraries arbitrator/wasm-libraries COPY arbitrator/jit arbitrator/jit COPY arbitrator/stylus arbitrator/stylus -COPY arbitrator/cargo-stylus arbitrator/cargo-stylus COPY --from=brotli-library-export / target/ RUN touch -a -m arbitrator/prover/src/lib.rs RUN NITRO_BUILD_IGNORE_TIMESTAMPS=1 make build-prover-lib diff --git a/arbitrator/Cargo.lock b/arbitrator/Cargo.lock index 2f0d09649..1bda50b34 100644 --- a/arbitrator/Cargo.lock +++ b/arbitrator/Cargo.lock @@ -7,10 +7,6 @@ name = "Inflector" version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] [[package]] name = "addr2line" @@ -27,17 +23,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aes" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - [[package]] name = "ahash" version = "0.7.6" @@ -64,12 +49,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "ansi_term" version = "0.11.0" @@ -79,55 +58,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "anstream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is-terminal", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" - -[[package]] -name = "anstyle-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "anstyle-wincon" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" -dependencies = [ - "anstyle", - "windows-sys 0.48.0", -] - [[package]] name = "anyhow" version = "1.0.71" @@ -153,37 +83,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4dc07131ffa69b8072d35f5007352af944213cde02545e2103680baed38fcd" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - -[[package]] -name = "async-trait" -version = "0.1.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2d0f03b3640e3a630367e40c468cb7f309529c708ed1d88597047b0e7c6ef7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.27", -] - -[[package]] -name = "async_io_stream" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" -dependencies = [ - "futures", - "pharos", - "rustc_version", -] - [[package]] name = "atty" version = "0.2.14" @@ -195,18 +94,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "auto_impl" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -223,41 +110,11 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide 0.5.3", + "miniz_oxide", "object 0.29.0", "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bech32" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" - [[package]] name = "bincode" version = "1.3.3" @@ -267,21 +124,6 @@ dependencies = [ "serde", ] -[[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 = "bitflags" version = "1.3.2" @@ -294,28 +136,6 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" -[[package]] -name = "bitvec" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41262f11d771fd4a61aa3ce019fca363b4b6c282fca9da2a31186d3965a47a5c" -dependencies = [ - "either", - "radium 0.3.0", -] - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium 0.7.0", - "tap", - "wyz", -] - [[package]] name = "block-buffer" version = "0.9.0" @@ -361,27 +181,12 @@ dependencies = [ "libc", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" -dependencies = [ - "sha2 0.9.9", -] - [[package]] name = "bumpalo" version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - [[package]] name = "bytecheck" version = "0.6.9" @@ -414,93 +219,12 @@ name = "bytes" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -dependencies = [ - "serde", -] - -[[package]] -name = "bytesize" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5" - -[[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "camino" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-stylus" -version = "0.1.0" -dependencies = [ - "brotli2", - "bytes", - "bytesize", - "clap 4.3.17", - "ethers", - "eyre", - "hex", - "serde", - "serde_json", - "tokio", -] - -[[package]] -name = "cargo_metadata" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.13", - "serde", - "serde_json", - "thiserror", -] [[package]] name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] [[package]] name = "cfg-if" @@ -508,26 +232,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" -dependencies = [ - "android-tzdata", - "num-traits", -] - -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clap" version = "2.33.3" @@ -543,109 +247,6 @@ dependencies = [ "vec_map", ] -[[package]] -name = "clap" -version = "4.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0827b011f6f8ab38590295339817b0d26f344aa4932c3ced71b45b0c54b4a9" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9441b403be87be858db6a23edb493e7f694761acdc3343d5a0fcaafd304cbc9e" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim 0.10.0", -] - -[[package]] -name = "clap_derive" -version = "4.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "syn 2.0.27", -] - -[[package]] -name = "clap_lex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" - -[[package]] -name = "coins-bip32" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30a84aab436fcb256a2ab3c80663d8aec686e6bae12827bb05fef3e1e439c9f" -dependencies = [ - "bincode", - "bs58", - "coins-core", - "digest 0.10.7", - "getrandom", - "hmac", - "k256", - "lazy_static", - "serde", - "sha2 0.10.7", - "thiserror", -] - -[[package]] -name = "coins-bip39" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f4d04ee18e58356accd644896aeb2094ddeafb6a713e056cef0c0a8e468c15" -dependencies = [ - "bitvec 0.17.4", - "coins-bip32", - "getrandom", - "hmac", - "once_cell", - "pbkdf2 0.12.2", - "rand", - "sha2 0.10.7", - "thiserror", -] - -[[package]] -name = "coins-core" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b949a1c63fb7eb591eb7ba438746326aedf0ae843e51ec92ba6bec5bb382c4f" -dependencies = [ - "base64 0.21.2", - "bech32", - "bs58", - "digest 0.10.7", - "generic-array", - "hex", - "ripemd", - "serde", - "serde_derive", - "sha2 0.10.7", - "sha3 0.10.8", - "thiserror", -] - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - [[package]] name = "compiletest_rs" version = "0.6.0" @@ -679,20 +280,8 @@ dependencies = [ ] [[package]] -name = "const-oid" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "corosensei" -version = "0.1.3" +name = "corosensei" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" dependencies = [ @@ -833,24 +422,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -861,15 +432,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - [[package]] name = "darling" version = "0.13.4" @@ -905,22 +467,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "data-encoding" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" - -[[package]] -name = "der" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" -dependencies = [ - "const-oid", - "zeroize", -] - [[package]] name = "derivative" version = "2.2.0" @@ -932,17 +478,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "diff" version = "0.1.13" @@ -965,9 +500,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "const-oid", "crypto-common", - "subtle", ] [[package]] @@ -991,12 +524,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dunce" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" - [[package]] name = "dynasm" version = "1.2.3" @@ -1023,81 +550,12 @@ dependencies = [ "memmap2", ] -[[package]] -name = "ecdsa" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" -[[package]] -name = "elliptic-curve" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "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.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enr" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf56acd72bb22d2824e66ae8e9e5ada4d0de17a69c7fd35569dde2ada8ec9116" -dependencies = [ - "base64 0.13.1", - "bytes", - "hex", - "k256", - "log", - "rand", - "rlp", - "serde", - "sha3 0.10.8", - "zeroize", -] - [[package]] name = "enum-iterator" version = "0.7.0" @@ -1139,12 +597,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - [[package]] name = "errno" version = "0.3.1" @@ -1166,322 +618,6 @@ dependencies = [ "libc", ] -[[package]] -name = "eth-keystore" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" -dependencies = [ - "aes", - "ctr", - "digest 0.10.7", - "hex", - "hmac", - "pbkdf2 0.11.0", - "rand", - "scrypt", - "serde", - "serde_json", - "sha2 0.10.7", - "sha3 0.10.8", - "thiserror", - "uuid", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", - "once_cell", - "regex", - "serde", - "serde_json", - "sha3 0.10.8", - "thiserror", - "uint", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types", - "scale-info", - "uint", -] - -[[package]] -name = "ethers" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b4026b97da8281276744741fac7eb385da905f6093c583331fa2953fdd4253" -dependencies = [ - "ethers-addressbook", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-middleware", - "ethers-providers", - "ethers-signers", - "ethers-solc", -] - -[[package]] -name = "ethers-addressbook" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edcb6ffefc230d8c42874c51b28dc11dbb8de50b27a8fdf92648439d6baa68dc" -dependencies = [ - "ethers-core", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "ethers-contract" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4719a44c3d37ab07c6dea99ab174068d8c35e441b60b6c20ce4e48357273e8" -dependencies = [ - "ethers-contract-abigen", - "ethers-contract-derive", - "ethers-core", - "ethers-providers", - "ethers-signers", - "futures-util", - "hex", - "once_cell", - "pin-project", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ethers-contract-abigen" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "155ea1b84d169d231317ed86e307af6f2bed6b40dd17e5e94bc84da21cadb21c" -dependencies = [ - "Inflector", - "dunce", - "ethers-core", - "ethers-etherscan", - "eyre", - "hex", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "reqwest", - "serde", - "serde_json", - "syn 2.0.27", - "toml", - "walkdir", -] - -[[package]] -name = "ethers-contract-derive" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8567ff196c4a37c1a8c90ec73bda0ad2062e191e4f0a6dc4d943e2ec4830fc88" -dependencies = [ - "Inflector", - "ethers-contract-abigen", - "ethers-core", - "hex", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.27", -] - -[[package]] -name = "ethers-core" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60ca2514feb98918a0a31de7e1983c29f2267ebf61b2dc5d4294f91e5b866623" -dependencies = [ - "arrayvec", - "bytes", - "cargo_metadata", - "chrono", - "elliptic-curve", - "ethabi", - "generic-array", - "hex", - "k256", - "num_enum", - "once_cell", - "open-fastrlp", - "rand", - "rlp", - "serde", - "serde_json", - "strum", - "syn 2.0.27", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "ethers-etherscan" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22b3a8269d3df0ed6364bc05b4735b95f4bf830ce3aef87d5e760fb0e93e5b91" -dependencies = [ - "ethers-core", - "reqwest", - "semver 1.0.13", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-middleware" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0c339aad74ae5c451d27e0e49c7a3c7d22620b119b4f9291d7aa21f72d7f366" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-providers", - "ethers-signers", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", -] - -[[package]] -name = "ethers-providers" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b411b119f1cf0efb69e2190883dee731251882bb21270f893ee9513b3a697c48" -dependencies = [ - "async-trait", - "auto_impl", - "base64 0.21.2", - "bytes", - "enr", - "ethers-core", - "futures-core", - "futures-timer", - "futures-util", - "hashers", - "hex", - "http", - "instant", - "once_cell", - "pin-project", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-tungstenite", - "tracing", - "tracing-futures", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "ws_stream_wasm", -] - -[[package]] -name = "ethers-signers" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4864d387456a9c09a1157fa10e1528b29d90f1d859443acf06a1b23365fb518c" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "elliptic-curve", - "eth-keystore", - "ethers-core", - "hex", - "rand", - "sha2 0.10.7", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-solc" -version = "2.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6c2b9625a2c639d46625f88acc2092a3cb35786c37f7c2128b3ca20f639b3c" -dependencies = [ - "cfg-if", - "dunce", - "ethers-core", - "glob", - "hex", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver 1.0.13", - "serde", - "serde_json", - "solang-parser", - "svm-rs", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", -] - [[package]] name = "eyre" version = "0.6.8" @@ -1504,16 +640,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core", - "subtle", -] - [[package]] name = "filetime" version = "0.2.21" @@ -1526,174 +652,12 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "flate2" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" -dependencies = [ - "crc32fast", - "miniz_oxide 0.7.1", -] - [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-executor" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", -] - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.27", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" -dependencies = [ - "gloo-timers", - "send_wrapper 0.4.0", -] - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - [[package]] name = "fxhash" version = "0.2.1" @@ -1711,7 +675,6 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", - "zeroize", ] [[package]] @@ -1730,10 +693,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1743,58 +704,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", - "indexmap 1.8.1", + "indexmap", "stable_deref_trait", ] -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - -[[package]] -name = "h2" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap 1.8.1", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.11.2" @@ -1813,21 +726,6 @@ dependencies = [ "ahash", ] -[[package]] -name = "hashbrown" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" - -[[package]] -name = "hashers" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" -dependencies = [ - "fxhash", -] - [[package]] name = "heck" version = "0.3.3" @@ -1864,150 +762,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "home" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "indenter" version = "0.3.3" @@ -2025,16 +785,6 @@ dependencies = [ "serde", ] -[[package]] -name = "indexmap" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" -dependencies = [ - "equivalent", - "hashbrown 0.14.0", -] - [[package]] name = "inkwell" version = "0.1.0-beta.4" @@ -2054,20 +804,11 @@ dependencies = [ name = "inkwell_internals" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7090af3d300424caa81976b8c97bca41cd70e861272c072e188ae082fb49f9" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "3c7090af3d300424caa81976b8c97bca41cd70e861272c072e188ae082fb49f9" dependencies = [ - "generic-array", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] @@ -2079,23 +820,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "ipnet" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi 0.3.1", - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -2133,15 +857,6 @@ dependencies = [ "wasmer-compiler-llvm", ] -[[package]] -name = "jobserver" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.60" @@ -2151,20 +866,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "k256" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2 0.10.7", - "signature", -] - [[package]] name = "keccak" version = "0.1.4" @@ -2174,34 +875,6 @@ dependencies = [ "cpufeatures", ] -[[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", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax", - "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.4.0" @@ -2277,15 +950,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "md-5" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "memchr" version = "2.5.0" @@ -2310,12 +974,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - [[package]] name = "minimal-lexical" version = "0.1.3" @@ -2331,26 +989,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "miow" version = "0.3.7" @@ -2366,12 +1004,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - [[package]] name = "nom" version = "7.0.0" @@ -2480,27 +1112,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.27", -] - [[package]] name = "object" version = "0.28.4" @@ -2509,7 +1120,7 @@ checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "crc32fast", "hashbrown 0.11.2", - "indexmap 1.8.1", + "indexmap", "memchr", ] @@ -2534,31 +1145,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "open-fastrlp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", -] - -[[package]] -name = "open-fastrlp-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "ouroboros" version = "0.15.6" @@ -2606,32 +1192,6 @@ dependencies = [ "syn 2.0.27", ] -[[package]] -name = "parity-scale-codec" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" -dependencies = [ - "arrayvec", - "bitvec 1.0.1", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "parking_lot" version = "0.11.2" @@ -2680,51 +1240,6 @@ dependencies = [ "windows-sys 0.36.1", ] -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", - "hmac", - "password-hash", - "sha2 0.10.7", -] - -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest 0.10.7", - "hmac", -] - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - [[package]] name = "pest" version = "2.3.0" @@ -2735,171 +1250,18 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "petgraph" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" -dependencies = [ - "fixedbitset", - "indexmap 1.8.1", -] - -[[package]] -name = "pharos" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" -dependencies = [ - "futures", - "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.27", -] - -[[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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.27", -] - [[package]] name = "pin-project-lite" version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - [[package]] name = "ppv-lite86" 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 = "prettyplease" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" -dependencies = [ - "proc-macro2", - "syn 2.0.27", -] - -[[package]] -name = "primitive-types" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -3022,22 +1384,10 @@ dependencies = [ name = "quote" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def50a86306165861203e7f84ecffbbdfdea79f0e51039b33de1e952358c47ac" - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +dependencies = [ + "proc-macro2", +] [[package]] name = "rand" @@ -3191,79 +1541,6 @@ dependencies = [ "bytecheck", ] -[[package]] -name = "reqwest" -version = "0.11.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" -dependencies = [ - "base64 0.21.2", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots 0.22.6", - "winreg", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "rkyv" version = "0.7.39" @@ -3272,7 +1549,7 @@ checksum = "cec2b3485b07d96ddfd3134767b8a447b45ea4eb91448d0a35180ec0ffd5ed15" dependencies = [ "bytecheck", "hashbrown 0.12.3", - "indexmap 1.8.1", + "indexmap", "ptr_meta", "rend", "rkyv_derive", @@ -3290,40 +1567,12 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes", - "rlp-derive", - "rustc-hex", -] - -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rustc-demangle" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - [[package]] name = "rustc_version" version = "0.4.0" @@ -3358,47 +1607,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "rustls" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" -dependencies = [ - "log", - "ring", - "rustls-webpki 0.101.1", - "sct", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" -dependencies = [ - "base64 0.21.2", -] - -[[package]] -name = "rustls-webpki" -version = "0.100.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "rustversion" version = "1.0.6" @@ -3411,48 +1619,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scale-info" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" -dependencies = [ - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "scoped-tls" version = "1.0.1" @@ -3465,48 +1631,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scrypt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" -dependencies = [ - "hmac", - "pbkdf2 0.11.0", - "salsa20", - "sha2 0.10.7", -] - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "0.11.0" @@ -3521,9 +1651,6 @@ name = "semver" version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" @@ -3534,18 +1661,6 @@ dependencies = [ "pest", ] -[[package]] -name = "send_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" - -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" - [[package]] name = "serde" version = "1.0.174" @@ -3597,27 +1712,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_spanned" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - [[package]] name = "serde_with" version = "1.12.1" @@ -3641,41 +1735,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "sha1" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - [[package]] name = "sha3" version = "0.9.1" @@ -3698,31 +1757,12 @@ dependencies = [ "keccak", ] -[[package]] -name = "signature" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" -dependencies = [ - "digest 0.10.7", - "rand_core", -] - [[package]] name = "siphasher" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - [[package]] name = "slice-group-by" version = "0.3.0" @@ -3738,46 +1778,6 @@ dependencies = [ "serde", ] -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "solang-parser" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c792fe9fae2a2f716846f214ca10d5a1e21133e0bf36cef34bcc4a852467b21" -dependencies = [ - "itertools", - "lalrpop", - "lalrpop-util", - "phf", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spki" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" -dependencies = [ - "base64ct", - "der", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3790,19 +1790,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[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 = "strsim" version = "0.8.0" @@ -3821,7 +1808,7 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" dependencies = [ - "clap 2.33.3", + "clap", "lazy_static", "structopt-derive", ] @@ -3839,28 +1826,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6069ca09d878a33f883cc06aaa9718ede171841d3832450354410b718b097232" -dependencies = [ - "heck 0.4.1", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.27", -] - [[package]] name = "stylus" version = "0.1.0" @@ -3881,34 +1846,8 @@ dependencies = [ "wasmer-compiler-cranelift", "wasmer-compiler-llvm", "wasmer-compiler-singlepass", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "svm-rs" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a04fc4f5cd35c700153b233f5575ccb3237e0f941fa5049d9e98254d10bf2fe" -dependencies = [ - "fs2", - "hex", - "home", - "once_cell", - "reqwest", - "semver 1.0.13", - "serde", - "serde_json", - "sha2 0.10.7", - "thiserror", - "url", - "zip", + "wasmer-types", + "wasmer-vm", ] [[package]] @@ -3933,12 +1872,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - [[package]] name = "target-lexicon" version = "0.12.4" @@ -4011,154 +1944,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "time" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" -dependencies = [ - "serde", - "time-core", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" -dependencies = [ - "autocfg", - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.27", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c" -dependencies = [ - "futures-util", - "log", - "rustls", - "tokio", - "tokio-rustls", - "tungstenite", - "webpki-roots 0.23.1", -] - -[[package]] -name = "tokio-util" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" -dependencies = [ - "indexmap 2.0.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - [[package]] name = "tracing" version = "0.1.37" @@ -4191,43 +1976,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "tungstenite" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand", - "rustls", - "sha1", - "thiserror", - "url", - "utf-8", - "webpki", -] - [[package]] name = "typenum" version = "1.14.0" @@ -4240,39 +1988,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - [[package]] name = "unicode-ident" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-segmentation" version = "1.8.0" @@ -4285,51 +2006,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] - [[package]] name = "vec_map" version = "0.8.2" @@ -4342,25 +2018,6 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" -[[package]] -name = "walkdir" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -4497,7 +2154,7 @@ dependencies = [ "bytes", "cfg-if", "hashbrown 0.11.2", - "indexmap 1.8.1", + "indexmap", "js-sys", "macro-wasmer-universal-test", "more-asserts", @@ -4635,7 +2292,7 @@ version = "3.1.0" dependencies = [ "enum-iterator", "enumset", - "indexmap 1.8.1", + "indexmap", "memoffset", "more-asserts", "rkyv", @@ -4654,7 +2311,7 @@ dependencies = [ "cfg-if", "corosensei", "enum-iterator", - "indexmap 1.8.1", + "indexmap", "lazy_static", "libc", "mach", @@ -4705,34 +2362,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - -[[package]] -name = "webpki-roots" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" -dependencies = [ - "rustls-webpki 0.100.1", -] - [[package]] name = "winapi" version = "0.3.9" @@ -4749,15 +2378,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -4915,111 +2535,3 @@ name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "winnow" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "ws_stream_wasm" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" -dependencies = [ - "async_io_stream", - "futures", - "js-sys", - "log", - "pharos", - "rustc_version", - "send_wrapper 0.6.0", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - -[[package]] -name = "zeroize" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2 0.11.0", - "sha1", - "time", - "zstd", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" -dependencies = [ - "cc", - "libc", - "pkg-config", -] diff --git a/arbitrator/cargo-stylus/Cargo.lock b/arbitrator/cargo-stylus/Cargo.lock new file mode 100644 index 000000000..7c42c837f --- /dev/null +++ b/arbitrator/cargo-stylus/Cargo.lock @@ -0,0 +1,4346 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli 0.28.0", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + +[[package]] +name = "array-init" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +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 = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures", + "pharos", + "rustc_version", +] + +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + +[[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 = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +dependencies = [ + "brotli-sys", + "libc", +] + +[[package]] +name = "bs58" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" +dependencies = [ + "sha2", + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +dependencies = [ + "serde", +] + +[[package]] +name = "bytesize" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" + +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-stylus" +version = "0.1.0" +dependencies = [ + "brotli2", + "bytes", + "bytesize", + "clap", + "ethers", + "eyre", + "hex", + "serde", + "serde_json", + "tokio", + "wasmer", +] + +[[package]] +name = "cargo_metadata" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "num-traits", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" +dependencies = [ + "clap_builder", + "clap_derive", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + +[[package]] +name = "coins-bip32" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" +dependencies = [ + "bs58", + "coins-core", + "digest", + "hmac", + "k256", + "serde", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-bip39" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" +dependencies = [ + "bitvec", + "coins-bip32", + "hmac", + "once_cell", + "pbkdf2 0.12.2", + "rand", + "sha2", + "thiserror", +] + +[[package]] +name = "coins-core" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" +dependencies = [ + "base64 0.21.2", + "bech32", + "bs58", + "digest", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2", + "sha3", + "thiserror", +] + +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "const-hex" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca268df6cd88e646b564e6aff1a016834e5f42077c736ef6b6789c31ef9ec5dc" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "corosensei" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" +dependencies = [ + "autocfg", + "cfg-if", + "libc", + "scopeguard", + "windows-sys 0.33.0", +] + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a2ab4512dfd3a6f4be184403a195f76e81a8a9f9e6c898e19d2dc3ce20e0115" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b022ed2a5913a38839dfbafe6cf135342661293b08049843362df4301261dc" +dependencies = [ + "arrayvec", + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-egraph", + "cranelift-entity", + "cranelift-isle", + "gimli 0.26.2", + "log", + "regalloc2", + "smallvec 1.11.0", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "639307b45434ad112a98f8300c0f0ab085cbefcd767efcdef9ef19d4c0756e74" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7" + +[[package]] +name = "cranelift-egraph" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73" +dependencies = [ + "cranelift-entity", + "fxhash", + "hashbrown 0.12.3", + "indexmap 1.9.3", + "log", + "smallvec 1.11.0", +] + +[[package]] +name = "cranelift-entity" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c" + +[[package]] +name = "cranelift-frontend" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d70abacb8cfef3dc8ff7e8836e9c1d70f7967dfdac824a4cd5e30223415aca6" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec 1.11.0", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.91.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" + +[[package]] +name = "crc32fast" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.0", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "darling" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "darling_macro" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "dashmap" +version = "5.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd72493923899c6f10c641bdbdeddc7183d6396641d99c1a0d1597f37f92e28" +dependencies = [ + "cfg-if", + "hashbrown 0.14.0", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "proc-macro2", + "quote", + "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 = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "ecdsa" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "elliptic-curve" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enr" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0be7b2ac146c1f99fe245c02d16af0696450d8e06c135db75e10eeb9e642c20d" +dependencies = [ + "base64 0.21.2", + "bytes", + "hex", + "k256", + "log", + "rand", + "rlp", + "serde", + "serde-hex", + "sha3", + "zeroize", +] + +[[package]] +name = "enum-iterator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" +dependencies = [ + "enum-iterator-derive", +] + +[[package]] +name = "enum-iterator-derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "enumset" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e875f1719c16de097dee81ed675e2d9bb63096823ed3f0ca827b7dea3028bbbb" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest", + "hex", + "hmac", + "pbkdf2 0.11.0", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2", + "sha3", + "thiserror", + "uuid 0.8.2", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "primitive-types", + "scale-info", + "uint", +] + +[[package]] +name = "ethers" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ba3fd516c15a9a587135229466dbbfc85796de55c5660afbbb1b1c78517d85c" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0245617f11b8178fa50b52e433e2c34ac69f39116b62c8be2437decf2edf1986" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02bb80fd2c22631a5eb8a02cbf373cc5fd86937fc966bb670b9a884580c8e71c" +dependencies = [ + "const-hex", + "ethers-contract-abigen", + "ethers-contract-derive", + "ethers-core", + "ethers-providers", + "futures-util", + "once_cell", + "pin-project", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "ethers-contract-abigen" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22c54db0d393393e732a5b20273e4f8ab89f0cce501c84e75fab9c126799a6e6" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "reqwest", + "serde", + "serde_json", + "syn 2.0.29", + "toml", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ee4f216184a1304b707ed258f4f70aa40bf7e1522ab8963d127a8d516eaa1a" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.29", +] + +[[package]] +name = "ethers-core" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c29523f73c12753165781c6e5dc11c84d3e44c080a15f7c6cfbd70b514cb6f1" +dependencies = [ + "arrayvec", + "bytes", + "cargo_metadata", + "chrono", + "const-hex", + "elliptic-curve", + "ethabi", + "generic-array", + "k256", + "num_enum", + "once_cell", + "open-fastrlp", + "rand", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.29", + "tempfile", + "thiserror", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "ethers-etherscan" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aab5af432b3fe5b7756b60df5c9ddeb85a13414575ad8a9acd707c24f0a77a5" +dependencies = [ + "ethers-core", + "reqwest", + "semver", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "356151d5ded56d4918146366abc9dfc9df367cf0096492a7a5477b21b7693615" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00c84664b294e47fc2860d6db0db0246f79c4c724e552549631bb9505b834bee" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.2", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http", + "instant", + "jsonwebtoken", + "once_cell", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", + "tracing-futures", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "ws_stream_wasm", +] + +[[package]] +name = "ethers-signers" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170b299698702ef1f53d2275af7d6d97409cfa4f9398ee9ff518f6bc9102d0ad" +dependencies = [ + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve", + "eth-keystore", + "ethers-core", + "rand", + "sha2", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-solc" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66559c8f774712df303c907d087275a52a2046b256791aaa566d5abc8ea66731" +dependencies = [ + "cfg-if", + "const-hex", + "dirs", + "dunce", + "ethers-core", + "glob", + "home", + "md-5", + "num_cpus", + "once_cell", + "path-slash", + "rayon", + "regex", + "semver", + "serde", + "serde_json", + "solang-parser", + "svm-rs", + "thiserror", + "tiny-keccak", + "tokio", + "tracing", + "walkdir", + "yansi", +] + +[[package]] +name = "eyre" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +dependencies = [ + "indenter", + "once_cell", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "flate2" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", +] + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" +dependencies = [ + "gloo-timers", + "send_wrapper 0.4.0", +] + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "indexmap 1.9.3", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.2", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "k256" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[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", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax", + "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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.48.0", +] + +[[package]] +name = "more-asserts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "object" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "open-fastrlp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", + "ethereum-types", + "open-fastrlp-derive", +] + +[[package]] +name = "open-fastrlp-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" +dependencies = [ + "bytes", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parity-scale-codec" +version = "3.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "smallvec 1.11.0", + "windows-targets", +] + +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core", + "subtle", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", + "hmac", + "password-hash", + "sha2", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64 0.13.1", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.0.0", +] + +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures", + "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.29", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "ppv-lite86" +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 = "prettyplease" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64d9ba0963cdcea2e1b2230fbae2bab30eb25a174be395c41e764bfb65dd62" +dependencies = [ + "proc-macro2", + "syn 2.0.29", +] + +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "scale-info", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom", + "redox_syscall 0.2.16", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" +dependencies = [ + "fxhash", + "log", + "slice-group-by", + "smallvec 1.11.0", +] + +[[package]] +name = "regex" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" + +[[package]] +name = "region" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" +dependencies = [ + "bitflags 1.3.2", + "libc", + "mach", + "winapi", +] + +[[package]] +name = "rend" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "reqwest" +version = "0.11.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +dependencies = [ + "base64 0.21.2", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.2", + "winreg", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest", +] + +[[package]] +name = "rkyv" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +dependencies = [ + "bitvec", + "bytecheck", + "hashbrown 0.12.3", + "indexmap 1.9.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid 1.4.1", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rlp-derive", + "rustc-hex", +] + +[[package]] +name = "rlp-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.4", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scale-info" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +dependencies = [ + "cfg-if", + "derive_more", + "parity-scale-codec", + "scale-info-derive", +] + +[[package]] +name = "scale-info-derive" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2 0.11.0", + "salsa20", + "sha2", +] + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +dependencies = [ + "serde", +] + +[[package]] +name = "send_wrapper" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" + +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + +[[package]] +name = "serde" +version = "1.0.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-hex" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" +dependencies = [ + "array-init", + "serde", + "smallvec 0.6.14", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_derive" +version = "1.0.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror", + "time", +] + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "solang-parser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c792fe9fae2a2f716846f214ca10d5a1e21133e0bf36cef34bcc4a852467b21" +dependencies = [ + "itertools", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[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", + "phf_shared 0.10.0", + "precomputed-hash", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.29", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "svm-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597e3a746727984cb7ea2487b6a40726cad0dbe86628e7d429aa6b8c4c153db4" +dependencies = [ + "dirs", + "fs2", + "hex", + "once_cell", + "reqwest", + "semver", + "serde", + "serde_json", + "sha2", + "thiserror", + "url", + "zip", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "target-lexicon" +version = "0.12.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.48.0", +] + +[[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 = "thiserror" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "time" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" +dependencies = [ + "deranged", + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "pin-project-lite", + "socket2 0.5.3", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2dbec703c26b00d74844519606ef15d09a7d6857860f84ad223dec002ddea2" +dependencies = [ + "futures-util", + "log", + "rustls", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots 0.23.1", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "tungstenite" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e862a1c4128df0112ab625f55cd5c934bcb4312ba80b39ae4b4835a3fd58e649" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand", + "rustls", + "sha1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + +[[package]] +name = "uuid" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "walkdir" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-downcast" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dac026d43bcca6e7ce1c0956ba68f59edf6403e8e930a5d891be72c31a44340" +dependencies = [ + "js-sys", + "once_cell", + "wasm-bindgen", + "wasm-bindgen-downcast-macros", +] + +[[package]] +name = "wasm-bindgen-downcast-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5020cfa87c7cecefef118055d44e3c1fc122c7ec25701d528ee458a0b45f38f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "wasm-encoder" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmer" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78caedecd8cb71ed47ccca03b68d69414a3d278bb031e6f93f15759344efdd52" +dependencies = [ + "bytes", + "cfg-if", + "derivative", + "indexmap 1.9.3", + "js-sys", + "more-asserts", + "rustc-demangle", + "serde", + "serde-wasm-bindgen", + "target-lexicon", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-downcast", + "wasmer-compiler", + "wasmer-compiler-cranelift", + "wasmer-derive", + "wasmer-types", + "wasmer-vm", + "wat", + "winapi", +] + +[[package]] +name = "wasmer-compiler" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726a8450541af4a57c34af7b6973fdbfc79f896cc7e733429577dfd1d1687180" +dependencies = [ + "backtrace", + "cfg-if", + "enum-iterator", + "enumset", + "lazy_static", + "leb128", + "memmap2", + "more-asserts", + "region", + "smallvec 1.11.0", + "thiserror", + "wasmer-types", + "wasmer-vm", + "wasmparser", + "winapi", +] + +[[package]] +name = "wasmer-compiler-cranelift" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e5633f90f372563ebbdf3f9799c7b29ba11c90e56cf9b54017112d2e656c95" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "gimli 0.26.2", + "more-asserts", + "rayon", + "smallvec 1.11.0", + "target-lexicon", + "tracing", + "wasmer-compiler", + "wasmer-types", +] + +[[package]] +name = "wasmer-derive" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97901fdbaae383dbb90ea162cc3a76a9fa58ac39aec7948b4c0b9bbef9307738" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "wasmer-types" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67f1f2839f4f61509550e4ddcd0e658e19f3af862b51c79fda15549d735d659b" +dependencies = [ + "bytecheck", + "enum-iterator", + "enumset", + "indexmap 1.9.3", + "more-asserts", + "rkyv", + "target-lexicon", + "thiserror", +] + +[[package]] +name = "wasmer-vm" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043118ec4f16d1714fed3aab758b502b864bd865e1d5188626c9ad290100563f" +dependencies = [ + "backtrace", + "cc", + "cfg-if", + "corosensei", + "dashmap", + "derivative", + "enum-iterator", + "fnv", + "indexmap 1.9.3", + "lazy_static", + "libc", + "mach", + "memoffset 0.8.0", + "more-asserts", + "region", + "scopeguard", + "thiserror", + "wasmer-types", + "winapi", +] + +[[package]] +name = "wasmparser" +version = "0.95.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +dependencies = [ + "indexmap 1.9.3", + "url", +] + +[[package]] +name = "wast" +version = "63.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2560471f60a48b77fccefaf40796fda61c97ce1e790b59dfcec9dc3995c9f63a" +dependencies = [ + "leb128", + "memchr", + "unicode-width", + "wasm-encoder", +] + +[[package]] +name = "wat" +version = "1.0.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bdc306c2c4c2f2bf2ba69e083731d0d2a77437fc6a350a19db139636e7e416c" +dependencies = [ + "wast", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.2", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +dependencies = [ + "windows_aarch64_msvc 0.33.0", + "windows_i686_gnu 0.33.0", + "windows_i686_msvc 0.33.0", + "windows_x86_64_gnu 0.33.0", + "windows_x86_64_msvc 0.33.0", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "ws_stream_wasm" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" +dependencies = [ + "async_io_stream", + "futures", + "js-sys", + "log", + "pharos", + "rustc_version", + "send_wrapper 0.6.0", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" + +[[package]] +name = "zip" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +dependencies = [ + "aes", + "byteorder", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd", +] + +[[package]] +name = "zstd" +version = "0.11.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "5.0.2+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.8+zstd.1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +dependencies = [ + "cc", + "libc", + "pkg-config", +] diff --git a/arbitrator/cargo-stylus/Cargo.toml b/arbitrator/cargo-stylus/Cargo.toml index d81b92408..6fabfc0b2 100644 --- a/arbitrator/cargo-stylus/Cargo.toml +++ b/arbitrator/cargo-stylus/Cargo.toml @@ -3,7 +3,7 @@ name = "cargo-stylus" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[workspace] [dependencies] brotli2 = "0.3.2" diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 1c4d6ba40..76e4ec268 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -30,10 +30,10 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let wasm_file_path: PathBuf = match cfg.wasm_file_path { Some(path) => PathBuf::from_str(&path).unwrap(), None => project::build_project_to_wasm() - .map_err(|e| format!("failed to build project to WASM: {e}"))?, + .map_err(|e| format!("failed to build project to WASM: {e:?}"))?, }; let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path) - .map_err(|e| format!("failed to get compressed WASM bytes: {e}"))?; + .map_err(|e| format!("failed to get compressed WASM bytes: {e:?}"))?; let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); if compressed_size > MAX_PROGRAM_SIZE { @@ -45,7 +45,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { } let provider = Provider::::try_from(&cfg.endpoint) - .map_err(|e| format!("could not initialize provider from http {e}"))?; + .map_err(|e| format!("could not initialize provider from http: {e:?}"))?; let expected_program_addr = match cfg.activate_program_address { Some(addr) => addr, @@ -54,7 +54,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let chain_id = provider .get_chainid() .await - .map_err(|e| format!("could not get chain id {e}"))? + .map_err(|e| format!("could not get chain id {e:?}"))? .as_u64(); let client = SignerMiddleware::new(provider.clone(), wallet.clone().with_chain_id(chain_id)); @@ -63,7 +63,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let nonce = client .get_transaction_count(addr, None) .await - .map_err(|e| format!("could not get nonce {addr} {e}"))?; + .map_err(|e| format!("could not get nonce {addr}: {e:?}"))?; get_contract_address(wallet.address(), nonce) } @@ -98,7 +98,7 @@ where ); let response = client.call_raw(&tx).state(&state).await.map_err(|e| { format!( - "program predeployment check failed when checking against ARB_WASM_ADDRESS {to}: {e}" + "program predeployment check failed when checking against ARB_WASM_ADDRESS {to}: {e:?}" ) })?; @@ -111,7 +111,7 @@ where let n = response.len(); let version_bytes: [u8; 2] = response[n - 2..] .try_into() - .map_err(|e| format!("could not parse Stylus version bytes: {e}"))?; + .map_err(|e| format!("could not parse Stylus version bytes: {e:?}"))?; let version = u16::from_be_bytes(version_bytes); println!("Program succeeded Stylus onchain activation checks with Stylus version: {version}"); Ok(()) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index f75789c11..f807741de 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -19,18 +19,18 @@ use crate::{constants, project, tx, wallet, DeployConfig, DeployMode}; /// DeployAndActivate (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts) - .map_err(|e| format!("could not load wallet: {e}"))?; + .map_err(|e| format!("could not load wallet: {e:?}"))?; let provider = Provider::::try_from(&cfg.endpoint).map_err(|e| { format!( - "could not initialize provider from http endpoint: {}: {e}", + "could not initialize provider from http endpoint: {}: {e:?}", &cfg.endpoint ) })?; let chain_id = provider .get_chainid() .await - .map_err(|e| format!("could not get chain id {e}"))? + .map_err(|e| format!("could not get chain id: {e:?}"))? .as_u64(); let client = SignerMiddleware::new(provider, wallet.clone().with_chain_id(chain_id)); @@ -38,7 +38,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let nonce = client .get_transaction_count(addr, None) .await - .map_err(|e| format!("could not get nonce for address {addr}: {e}"))?; + .map_err(|e| format!("could not get nonce for address {addr}: {e:?}"))?; let expected_program_addr = get_contract_address(wallet.address(), nonce); @@ -60,7 +60,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let wasm_file_path: PathBuf = match &cfg.wasm_file_path { Some(path) => PathBuf::from_str(&path).unwrap(), None => project::build_project_to_wasm() - .map_err(|e| format!("could not build project to WASM: {e}"))?, + .map_err(|e| format!("could not build project to WASM: {e:?}"))?, }; let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!("Deploying program to address {expected_program_addr:#032x}"); @@ -70,7 +70,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .data(deployment_calldata); tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request) .await - .map_err(|e| format!("could not submit signed deployment tx: {e}"))?; + .map_err(|e| format!("could not submit signed deployment tx: {e:?}"))?; } if activate { let program_addr = cfg @@ -88,7 +88,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .data(activate_calldata); tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request) .await - .map_err(|e| format!("could not submit signed deployment tx: {e}"))?; + .map_err(|e| format!("could not submit signed deployment tx: {e:?}"))?; } Ok(()) } diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 1cd871cd5..69a8c134b 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -120,12 +120,12 @@ async fn main() -> eyre::Result<(), String> { match args.command { StylusSubcommands::Check(cfg) => { if let Err(e) = check::run_checks(cfg).await { - println!("Stylus checks failed: {}", e.red()); + println!("Stylus checks failed: {:?}", e.red()); }; } StylusSubcommands::Deploy(cfg) => { if let Err(e) = deploy::deploy(cfg).await { - println!("Deploy / activation command failed: {}", e.red()); + println!("Deploy / activation command failed: {:?}", e.red()); }; } } diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index 8c20bac1e..e386b394f 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -15,7 +15,7 @@ use crate::{ /// Build a Rust project to WASM and return the path to the compiled WASM file. pub fn build_project_to_wasm() -> eyre::Result { - let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir: {e}"))?; + let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir: {e:?}"))?; Command::new("cargo") .stdout(Stdio::inherit()) @@ -24,13 +24,13 @@ pub fn build_project_to_wasm() -> eyre::Result { .arg("--release") .arg(format!("--target={}", RUST_TARGET)) .output() - .map_err(|e| format!("failed to execute cargo build: {e}"))?; + .map_err(|e| format!("failed to execute cargo build: {e:?}"))?; let release_path = cwd.join("target").join(RUST_TARGET).join("release"); // Gets the files in the release folder. let release_files: Vec = std::fs::read_dir(release_path) - .map_err(|e| format!("could not read release dir: {e}"))? + .map_err(|e| format!("could not read release dir: {e:?}"))? .filter(|r| r.is_ok()) .map(|r| r.unwrap().path()) .filter(|r| r.is_file()) @@ -54,7 +54,7 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, let wasm_file_bytes = std::fs::read(wasm_path).map_err(|e| { format!( - "could not read WASM file at target path {}: {e}", + "could not read WASM file at target path {}: {e:?}", wasm_path.as_os_str().to_string_lossy(), ) })?; @@ -67,7 +67,7 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, let mut compressed_bytes = vec![]; compressor .read_to_end(&mut compressed_bytes) - .map_err(|e| format!("could not Brotli compress WASM bytes: {e}"))?; + .map_err(|e| format!("could not Brotli compress WASM bytes: {e:?}"))?; println!( "Compressed WASM size: {}", diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index 3f2b0ab25..b8fb418ac 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -21,11 +21,11 @@ where let block_num = client .get_block_number() .await - .map_err(|e| format!("could not get block number: {e}"))?; + .map_err(|e| format!("could not get block number: {e:?}"))?; let block = client .get_block(block_num) .await - .map_err(|e| format!("could not get block: {e}"))? + .map_err(|e| format!("could not get block: {e:?}"))? .ok_or("no block found")?; let base_fee = block .base_fee_per_gas @@ -53,17 +53,17 @@ where let pending_tx = client .send_transaction(typed, None) .await - .map_err(|e| format!("could not send tx: {e}"))?; + .map_err(|e| format!("could not send tx: {e:?}"))?; let receipt = pending_tx .await - .map_err(|e| format!("could not get receipt: {e}"))? + .map_err(|e| format!("could not get receipt: {e:?}"))? .ok_or("no receipt found")?; match receipt.status { None => Err(format!( "Tx with hash {} reverted", - receipt.transaction_hash + receipt.transaction_hash, )), Some(_) => { let tx_hash = receipt.transaction_hash; diff --git a/arbitrator/cargo-stylus/src/wallet.rs b/arbitrator/cargo-stylus/src/wallet.rs index 1ee38a299..639a75e9c 100644 --- a/arbitrator/cargo-stylus/src/wallet.rs +++ b/arbitrator/cargo-stylus/src/wallet.rs @@ -20,7 +20,7 @@ pub fn load( if let Some(priv_key_path) = &private_key_path { let privkey = read_secret_from_file(&priv_key_path)?; return LocalWallet::from_str(&privkey) - .map_err(|e| format!("could not parse private key {}", e)); + .map_err(|e| format!("could not parse private key: {e:?}")); } let keystore_password_path = keystore_opts .keystore_password_path @@ -32,16 +32,16 @@ pub fn load( .as_ref() .ok_or("no keystore path provided")?; LocalWallet::decrypt_keystore(keystore_path, keystore_pass) - .map_err(|e| format!("could not decrypt keystore {}", e)) + .map_err(|e| format!("could not decrypt keystore: {e:?}")) } fn read_secret_from_file(fpath: &str) -> Result { let f = std::fs::File::open(fpath) - .map_err(|e| format!("could not open file at path: {fpath}: {e}"))?; + .map_err(|e| format!("could not open file at path: {fpath}: {e:?}"))?; let mut buf_reader = BufReader::new(f); let mut secret = String::new(); buf_reader .read_line(&mut secret) - .map_err(|e| format!("could not read secret from file at path {fpath}: {e}"))?; + .map_err(|e| format!("could not read secret from file at path {fpath}: {e:?}"))?; Ok(secret.trim().to_string()) } From 6e4feff442dd00bb8172e24ac0ac059fd82ce7e6 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 23 Aug 2023 21:50:05 -0700 Subject: [PATCH 58/58] rev --- arbitrator/cargo-stylus/src/check.rs | 14 +++++++------- arbitrator/cargo-stylus/src/deploy.rs | 14 +++++++------- arbitrator/cargo-stylus/src/main.rs | 4 ++-- arbitrator/cargo-stylus/src/project.rs | 12 ++++++------ arbitrator/cargo-stylus/src/tx.rs | 8 ++++---- arbitrator/cargo-stylus/src/wallet.rs | 8 ++++---- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/arbitrator/cargo-stylus/src/check.rs b/arbitrator/cargo-stylus/src/check.rs index 76e4ec268..53a87d566 100644 --- a/arbitrator/cargo-stylus/src/check.rs +++ b/arbitrator/cargo-stylus/src/check.rs @@ -30,10 +30,10 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let wasm_file_path: PathBuf = match cfg.wasm_file_path { Some(path) => PathBuf::from_str(&path).unwrap(), None => project::build_project_to_wasm() - .map_err(|e| format!("failed to build project to WASM: {e:?}"))?, + .map_err(|e| format!("failed to build project to WASM: {e}"))?, }; let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path) - .map_err(|e| format!("failed to get compressed WASM bytes: {e:?}"))?; + .map_err(|e| format!("failed to get compressed WASM bytes: {e}"))?; let compressed_size = ByteSize::b(deploy_ready_code.len() as u64); if compressed_size > MAX_PROGRAM_SIZE { @@ -45,7 +45,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { } let provider = Provider::::try_from(&cfg.endpoint) - .map_err(|e| format!("could not initialize provider from http: {e:?}"))?; + .map_err(|e| format!("could not initialize provider from http: {e}"))?; let expected_program_addr = match cfg.activate_program_address { Some(addr) => addr, @@ -54,7 +54,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let chain_id = provider .get_chainid() .await - .map_err(|e| format!("could not get chain id {e:?}"))? + .map_err(|e| format!("could not get chain id {e}"))? .as_u64(); let client = SignerMiddleware::new(provider.clone(), wallet.clone().with_chain_id(chain_id)); @@ -63,7 +63,7 @@ pub async fn run_checks(cfg: CheckConfig) -> eyre::Result<(), String> { let nonce = client .get_transaction_count(addr, None) .await - .map_err(|e| format!("could not get nonce {addr}: {e:?}"))?; + .map_err(|e| format!("could not get nonce {addr}: {e}"))?; get_contract_address(wallet.address(), nonce) } @@ -98,7 +98,7 @@ where ); let response = client.call_raw(&tx).state(&state).await.map_err(|e| { format!( - "program predeployment check failed when checking against ARB_WASM_ADDRESS {to}: {e:?}" + "program predeployment check failed when checking against ARB_WASM_ADDRESS {to}: {e}" ) })?; @@ -111,7 +111,7 @@ where let n = response.len(); let version_bytes: [u8; 2] = response[n - 2..] .try_into() - .map_err(|e| format!("could not parse Stylus version bytes: {e:?}"))?; + .map_err(|e| format!("could not parse Stylus version bytes: {e}"))?; let version = u16::from_be_bytes(version_bytes); println!("Program succeeded Stylus onchain activation checks with Stylus version: {version}"); Ok(()) diff --git a/arbitrator/cargo-stylus/src/deploy.rs b/arbitrator/cargo-stylus/src/deploy.rs index f807741de..136b47f5e 100644 --- a/arbitrator/cargo-stylus/src/deploy.rs +++ b/arbitrator/cargo-stylus/src/deploy.rs @@ -19,18 +19,18 @@ use crate::{constants, project, tx, wallet, DeployConfig, DeployMode}; /// DeployAndActivate (default): Sends both transactions above. pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let wallet = wallet::load(cfg.private_key_path, cfg.keystore_opts) - .map_err(|e| format!("could not load wallet: {e:?}"))?; + .map_err(|e| format!("could not load wallet: {e}"))?; let provider = Provider::::try_from(&cfg.endpoint).map_err(|e| { format!( - "could not initialize provider from http endpoint: {}: {e:?}", + "could not initialize provider from http endpoint: {}: {e}", &cfg.endpoint ) })?; let chain_id = provider .get_chainid() .await - .map_err(|e| format!("could not get chain id: {e:?}"))? + .map_err(|e| format!("could not get chain id: {e}"))? .as_u64(); let client = SignerMiddleware::new(provider, wallet.clone().with_chain_id(chain_id)); @@ -38,7 +38,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let nonce = client .get_transaction_count(addr, None) .await - .map_err(|e| format!("could not get nonce for address {addr}: {e:?}"))?; + .map_err(|e| format!("could not get nonce for address {addr}: {e}"))?; let expected_program_addr = get_contract_address(wallet.address(), nonce); @@ -60,7 +60,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { let wasm_file_path: PathBuf = match &cfg.wasm_file_path { Some(path) => PathBuf::from_str(&path).unwrap(), None => project::build_project_to_wasm() - .map_err(|e| format!("could not build project to WASM: {e:?}"))?, + .map_err(|e| format!("could not build project to WASM: {e}"))?, }; let (_, deploy_ready_code) = project::get_compressed_wasm_bytes(&wasm_file_path)?; println!("Deploying program to address {expected_program_addr:#032x}"); @@ -70,7 +70,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .data(deployment_calldata); tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request) .await - .map_err(|e| format!("could not submit signed deployment tx: {e:?}"))?; + .map_err(|e| format!("could not submit signed deployment tx: {e}"))?; } if activate { let program_addr = cfg @@ -88,7 +88,7 @@ pub async fn deploy(cfg: DeployConfig) -> eyre::Result<(), String> { .data(activate_calldata); tx::submit_signed_tx(&client, cfg.estimate_gas_only, &mut tx_request) .await - .map_err(|e| format!("could not submit signed deployment tx: {e:?}"))?; + .map_err(|e| format!("could not submit signed deployment tx: {e}"))?; } Ok(()) } diff --git a/arbitrator/cargo-stylus/src/main.rs b/arbitrator/cargo-stylus/src/main.rs index 69a8c134b..1cd871cd5 100644 --- a/arbitrator/cargo-stylus/src/main.rs +++ b/arbitrator/cargo-stylus/src/main.rs @@ -120,12 +120,12 @@ async fn main() -> eyre::Result<(), String> { match args.command { StylusSubcommands::Check(cfg) => { if let Err(e) = check::run_checks(cfg).await { - println!("Stylus checks failed: {:?}", e.red()); + println!("Stylus checks failed: {}", e.red()); }; } StylusSubcommands::Deploy(cfg) => { if let Err(e) = deploy::deploy(cfg).await { - println!("Deploy / activation command failed: {:?}", e.red()); + println!("Deploy / activation command failed: {}", e.red()); }; } } diff --git a/arbitrator/cargo-stylus/src/project.rs b/arbitrator/cargo-stylus/src/project.rs index e386b394f..f63bf736a 100644 --- a/arbitrator/cargo-stylus/src/project.rs +++ b/arbitrator/cargo-stylus/src/project.rs @@ -15,7 +15,7 @@ use crate::{ /// Build a Rust project to WASM and return the path to the compiled WASM file. pub fn build_project_to_wasm() -> eyre::Result { - let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir: {e:?}"))?; + let cwd: PathBuf = current_dir().map_err(|e| format!("could not get current dir: {e}"))?; Command::new("cargo") .stdout(Stdio::inherit()) @@ -24,13 +24,13 @@ pub fn build_project_to_wasm() -> eyre::Result { .arg("--release") .arg(format!("--target={}", RUST_TARGET)) .output() - .map_err(|e| format!("failed to execute cargo build: {e:?}"))?; + .map_err(|e| format!("failed to execute cargo build: {e}"))?; let release_path = cwd.join("target").join(RUST_TARGET).join("release"); // Gets the files in the release folder. let release_files: Vec = std::fs::read_dir(release_path) - .map_err(|e| format!("could not read release dir: {e:?}"))? + .map_err(|e| format!("could not read release dir: {e}"))? .filter(|r| r.is_ok()) .map(|r| r.unwrap().path()) .filter(|r| r.is_file()) @@ -54,20 +54,20 @@ pub fn get_compressed_wasm_bytes(wasm_path: &PathBuf) -> eyre::Result<(Vec, let wasm_file_bytes = std::fs::read(wasm_path).map_err(|e| { format!( - "could not read WASM file at target path {}: {e:?}", + "could not read WASM file at target path {}: {e}", wasm_path.as_os_str().to_string_lossy(), ) })?; let wasm_bytes = wasmer::wat2wasm(&wasm_file_bytes) - .map_err(|e| format!("could not parse wasm file bytes: {e:?}"))?; + .map_err(|e| format!("could not parse wasm file bytes: {e}"))?; let wasm_bytes = &*wasm_bytes; let mut compressor = BrotliEncoder::new(wasm_bytes, BROTLI_COMPRESSION_LEVEL); let mut compressed_bytes = vec![]; compressor .read_to_end(&mut compressed_bytes) - .map_err(|e| format!("could not Brotli compress WASM bytes: {e:?}"))?; + .map_err(|e| format!("could not Brotli compress WASM bytes: {e}"))?; println!( "Compressed WASM size: {}", diff --git a/arbitrator/cargo-stylus/src/tx.rs b/arbitrator/cargo-stylus/src/tx.rs index b8fb418ac..b93575a5c 100644 --- a/arbitrator/cargo-stylus/src/tx.rs +++ b/arbitrator/cargo-stylus/src/tx.rs @@ -21,11 +21,11 @@ where let block_num = client .get_block_number() .await - .map_err(|e| format!("could not get block number: {e:?}"))?; + .map_err(|e| format!("could not get block number: {e}"))?; let block = client .get_block(block_num) .await - .map_err(|e| format!("could not get block: {e:?}"))? + .map_err(|e| format!("could not get block: {e}"))? .ok_or("no block found")?; let base_fee = block .base_fee_per_gas @@ -53,11 +53,11 @@ where let pending_tx = client .send_transaction(typed, None) .await - .map_err(|e| format!("could not send tx: {e:?}"))?; + .map_err(|e| format!("could not send tx: {e}"))?; let receipt = pending_tx .await - .map_err(|e| format!("could not get receipt: {e:?}"))? + .map_err(|e| format!("could not get receipt: {e}"))? .ok_or("no receipt found")?; match receipt.status { diff --git a/arbitrator/cargo-stylus/src/wallet.rs b/arbitrator/cargo-stylus/src/wallet.rs index 639a75e9c..0bbddecca 100644 --- a/arbitrator/cargo-stylus/src/wallet.rs +++ b/arbitrator/cargo-stylus/src/wallet.rs @@ -20,7 +20,7 @@ pub fn load( if let Some(priv_key_path) = &private_key_path { let privkey = read_secret_from_file(&priv_key_path)?; return LocalWallet::from_str(&privkey) - .map_err(|e| format!("could not parse private key: {e:?}")); + .map_err(|e| format!("could not parse private key: {e}")); } let keystore_password_path = keystore_opts .keystore_password_path @@ -32,16 +32,16 @@ pub fn load( .as_ref() .ok_or("no keystore path provided")?; LocalWallet::decrypt_keystore(keystore_path, keystore_pass) - .map_err(|e| format!("could not decrypt keystore: {e:?}")) + .map_err(|e| format!("could not decrypt keystore: {e}")) } fn read_secret_from_file(fpath: &str) -> Result { let f = std::fs::File::open(fpath) - .map_err(|e| format!("could not open file at path: {fpath}: {e:?}"))?; + .map_err(|e| format!("could not open file at path: {fpath}: {e}"))?; let mut buf_reader = BufReader::new(f); let mut secret = String::new(); buf_reader .read_line(&mut secret) - .map_err(|e| format!("could not read secret from file at path {fpath}: {e:?}"))?; + .map_err(|e| format!("could not read secret from file at path {fpath}: {e}"))?; Ok(secret.trim().to_string()) }