From 7961e4ddbb05ed3bd2de7da583db9e9cb6a30daa Mon Sep 17 00:00:00 2001 From: ubermensch3dot0 Date: Sat, 8 Mar 2025 15:36:02 +0000 Subject: [PATCH 1/3] add get-eth-id from proposal files --- Cargo.lock | 1 + Cargo.toml | 1 + src/main.rs | 74 +++++++++++++++++++++++++++++++++++++++++++-- test-data/zip5.json | 31 +++++++++++++++++++ 4 files changed, 104 insertions(+), 3 deletions(-) create mode 100644 test-data/zip5.json diff --git a/Cargo.lock b/Cargo.lock index 10c028f..c867092 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4199,6 +4199,7 @@ dependencies = [ "hex", "log", "reqwest", + "serde", "serde_json", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index 3af9840..c7d2ec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,4 @@ log = "0.4" hex = "0.4" reqwest = { version = "0.11", features = ["json"] } serde_json = "1.0" +serde = { version = "1.0", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index 1c06af0..e90516e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,8 @@ use eyre::{eyre, Result}; use clap::{Parser, Subcommand}; use std::env; use std::str::FromStr; +use std::fs; +use serde::{Deserialize, Serialize}; use reqwest; const VERSION: &str = "0.0.6"; @@ -36,7 +38,25 @@ struct Cli { enum Commands { GetZkId { tx_hash: String }, GetUpgrades { tx_hash: String }, - GetEthId { tx_hash: String }, + GetEthId { + tx_hash: Option, + #[arg(long)] + from_file: Option, + }, +} + +#[derive(Serialize, Deserialize, Debug)] +struct ProposalCall { + target: String, + value: String, + data: String, +} + +#[derive(Serialize, Deserialize, Debug)] +struct ProposalData { + executor: String, + salt: String, + calls: Vec, } async fn get_provider(rpc_url: &str) -> Result> { @@ -461,6 +481,48 @@ pub async fn get_eth_id(tx_hash: &str, rpc_url: &str, _governor: &str) -> Result Ok(()) } +pub async fn get_eth_id_from_file(file_path: &str) -> Result<()> { + // Read and parse the JSON file + let file_content = fs::read_to_string(file_path)?; + let proposal: ProposalData = serde_json::from_str(&file_content)?; + + // Convert the proposal data into the format needed for encoding + let mut call_tokens = Vec::new(); + for call in proposal.calls.iter() { + let target = Address::from_str(&call.target)?; + let value = U256::from_str(&call.value)?; + let data = hex::decode(call.data.trim_start_matches("0x"))?; + + call_tokens.push(Token::Tuple(vec![ + Token::Address(target), + Token::Uint(value), + Token::Bytes(data), + ])); + } + + let executor = Address::from_str(&proposal.executor)?; + let salt = hex::decode(proposal.salt.trim_start_matches("0x"))?; + if salt.len() != 32 { + return Err(eyre!("Salt must be 32 bytes")); + } + + let proposal_token = Token::Tuple(vec![ + Token::Array(call_tokens), + Token::Address(executor), + Token::FixedBytes(salt), + ]); + + // Encode and hash the proposal + let encoded_proposal = encode(&[proposal_token]); + let hash = keccak256(&encoded_proposal); + + print_header("Ethereum Proposal ID"); + print_field("Proposal ID", &format!("0x{}", hex::encode(hash))); + print_field("Encoded Proposal", &format!("0x{}", hex::encode(&encoded_proposal))); + + Ok(()) +} + fn print_header(header: &str) { println!("\n{}", header.underline()); } @@ -490,8 +552,14 @@ async fn main() -> Result<()> { Commands::GetUpgrades { tx_hash } => { get_upgrades(&tx_hash, &rpc_url, cli.decode).await?; } - Commands::GetEthId { tx_hash } => { - get_eth_id(&tx_hash, &rpc_url, &cli.governor).await?; + Commands::GetEthId { tx_hash, from_file } => { + if let Some(file_path) = from_file { + get_eth_id_from_file(&file_path).await?; + } else if let Some(tx_hash) = tx_hash { + get_eth_id(&tx_hash, &rpc_url, &cli.governor).await?; + } else { + return Err(eyre!("{}", "Either --from-file or transaction hash must be provided".red().bold())); + } } } Ok(()) diff --git a/test-data/zip5.json b/test-data/zip5.json new file mode 100644 index 0000000..c698110 --- /dev/null +++ b/test-data/zip5.json @@ -0,0 +1,31 @@ +{ + "executor": "0xECE8e30bFc92c2A8e11e6cb2e17B70868572E3f6", + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "calls": [ + { + "target": "0x303a465b659cbb0ab36ee643ea362c509eeb5213", + "value": "0x00", + "data": "0x79ba5097" + }, + { + "target": "0xc2ee6b6af7d616f6e27ce7f4a451aedc2b0f5f5c", + "value": "0x00", + "data": "0x79ba5097" + }, + { + "target": "0xd7f9f54194c633f36ccd5f3da84ad4a1c38cb2cb", + "value": "0x00", + "data": "0x79ba5097" + }, + { + "target": "0x5d8ba173dc6c3c90c8f7c04c9288bef5fdbad06e", + "value": "0x00", + "data": "0x79ba5097" + }, + { + "target": "0xf553e6d903aa43420ed7e3bc2313be9286a8f987", + "value": "0x00", + "data": "0x79ba5097" + } + ] +} \ No newline at end of file From a8fed87fc638a3daf12fc9c09c6b293d9bbacec4 Mon Sep 17 00:00:00 2001 From: ubermensch3dot0 Date: Mon, 10 Mar 2025 16:23:55 +0000 Subject: [PATCH 2/3] update readme --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 45 ++++++++++++++++++--------------------------- src/main.rs | 24 +++++++++++++++++------- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c867092..cd9c3bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4189,7 +4189,7 @@ dependencies = [ [[package]] name = "zkgov-check" -version = "0.0.1" +version = "0.0.2" dependencies = [ "clap", "colored", diff --git a/Cargo.toml b/Cargo.toml index c7d2ec3..0ae3aab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zkgov-check" -version = "0.0.1" +version = "0.0.2" edition = "2021" authors = ["ubermensch3dot0"] description = "ZkSync Upgrade Verification Tool" diff --git a/README.md b/README.md index f8b24f9..bcaa4a1 100644 --- a/README.md +++ b/README.md @@ -5,37 +5,19 @@ ## Installation -To install and use the `zkgov-check` tool, follow these steps. Note that the tool is distributed via GitHub Releases, but you may need to build it locally if a compatible binary for your platform (e.g., macOS, Linux, Windows) is not available. +To install and use the `zkgov-check` tool, follow these steps. Note that the tool is distributed via GitHub Releases, but you may need to build it locally if a compatible binary for your platform is not available. ### Prerequisites - curl - A ZKsync RPC URL (set as an environment variable, e.g., `export ZKSYNC_RPC_URL=https://zksync-era-rpc.example.com`). ### Option 1: Install from GitHub Release -If a binary for your platform is available in the GitHub Release, you can download and install it directly: -1. Download the latest `zkgov-check` binary for your platform (e.g., macOS, Linux) from the [releases page](https://github.com/Cyfrin/zksync-upgrade-verification-rs/releases): - ```bash - curl -L https://github.com/Cyfrin/zksync-upgrade-verification-rs/releases/download/v0.1.0/zkgov-check-linux -o zkgov-check - ``` - (Replace `zkgov-check-linux` with the appropriate file for your OS, e.g., `zkgov-check-macos`) - -2. Make the binary executable: - ```bash - chmod +x zkgov-check - ``` - -3. Move it to a system directory (e.g., `/usr/local/bin/` on macOS/Linux): - ```bash - sudo mv zkgov-check /usr/local/bin/ - ``` +- Run the install script: -4. Verify the installation: - ```bash - zkgov-check --help - ``` - -**Note**: If the release doesn’t include a binary for your platform (e.g., Windows), proceed to Option 2. +```bash +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/cyfrin/zksync-upgrade-verification-rs/releases/latest/download/zkgov-check-installer.sh | sh +``` ### Option 2: Build from Source If no pre-built binary is available or you prefer to build locally, follow these steps: @@ -87,7 +69,7 @@ zkgov-check get-upgrades --rpc-url $ZKSYNC_RPC_URL --decode ``` **Output**: A detailed list of targets, values, and calldata, plus any Ethereum transactions if `sendToL1` is called. -### 3. Compute the Ethereum Proposal ID +### 3. Compute the Ethereum Proposal ID from a transaction hash: Generate the Ethereum-side proposal hash for verification: ```bash zkgov-check get-eth-id --rpc-url $ZKSYNC_RPC_URL @@ -97,6 +79,18 @@ zkgov-check get-eth-id --rpc-url $ZKSYNC_RPC_URL Ethereum proposal ID #1: 0x5ebd899d... ``` +### 4. Compute the Ethereum Proposal ID from a proposale file (json): +Generate the Ethereum-side proposal hash for verification: +```bash +zkgov-check get-eth-id --from-file +``` +**Output**: The Keccak-256 hash for the calls in the json file (see the file structure [here](/test-data/zip5.json)), e.g.: +``` +Ethereum Proposal ID +Proposal ID: 0x123456... +Encoded Proposal: 0x0000... +``` + ## Practical Examples Using the ZKsync Upgrade Verification Tool can significantly enhance the security of governance operations. Below is a step-by-step guide for verifying a proposal like [ZIP-7](https://www.tally.xyz/gov/zksync/proposal/53064417471903525695516096129021600825622830249245179379231067906906888383956): @@ -189,6 +183,3 @@ Using the ZKsync Upgrade Verification Tool can significantly enhance the securit ## Contributing Contributions are welcome! Please fork the repository and submit a pull request with your changes. - -## License - diff --git a/src/main.rs b/src/main.rs index e90516e..c6585fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use std::fs; use serde::{Deserialize, Serialize}; use reqwest; -const VERSION: &str = "0.0.6"; +const VERSION: &str = "0.0.2"; const PROPOSAL_CREATED_TOPIC: &str = "0x7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e0"; const DEFAULT_GOVERNOR: &str = "0x76705327e682F2d96943280D99464Ab61219e34f"; @@ -24,23 +24,33 @@ struct Cli { #[command(subcommand)] command: Commands, - #[arg(long, global = true)] + #[arg(long, global = true, help = "RPC URL for zkSync Era (can also be set via ZKSYNC_RPC_URL env var)")] rpc_url: Option, - #[arg(long, global = true, default_value = DEFAULT_GOVERNOR)] + #[arg(long, global = true, default_value = DEFAULT_GOVERNOR, help = "Governor contract address")] governor: String, - #[arg(long, global = true)] + #[arg(long, global = true, help = "Decode calldata for each transaction")] decode: bool, } #[derive(Subcommand)] enum Commands { - GetZkId { tx_hash: String }, - GetUpgrades { tx_hash: String }, + #[command(about = "Get the zkSync proposal ID from a transaction hash")] + GetZkId { + #[arg(help = "Transaction hash to analyze")] + tx_hash: String + }, + #[command(about = "List proposal actions and Ethereum transactions")] + GetUpgrades { + #[arg(help = "Transaction hash to analyze")] + tx_hash: String + }, + #[command(about = "Compute the Ethereum proposal ID from a transaction hash or JSON file")] GetEthId { + #[arg(help = "Transaction hash to analyze (not required if --from-file is used)")] tx_hash: Option, - #[arg(long)] + #[arg(long, help = "Path to a JSON file containing proposal data")] from_file: Option, }, } From 4511349b4a58d9e4fa98ba33df53a454a41c345e Mon Sep 17 00:00:00 2001 From: ubermensch3dot0 Date: Mon, 10 Mar 2025 16:28:09 +0000 Subject: [PATCH 3/3] Fix conflict --- Cargo.lock | 519 ++++++++++++++++++++++++++++++++++++----------------- Cargo.toml | 10 +- 2 files changed, 365 insertions(+), 164 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd9c3bd..c00a355 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,6 +184,12 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -350,6 +356,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" version = "0.4.40" @@ -981,7 +993,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "syn 2.0.99", @@ -1043,7 +1055,7 @@ checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" dependencies = [ "chrono", "ethers-core", - "reqwest", + "reqwest 0.11.27", "semver", "serde", "serde_json", @@ -1068,7 +1080,7 @@ dependencies = [ "futures-locks", "futures-util", "instant", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror 1.0.69", @@ -1095,12 +1107,12 @@ dependencies = [ "futures-timer", "futures-util", "hashers", - "http", + "http 0.2.12", "instant", "jsonwebtoken", "once_cell", "pin-project", - "reqwest", + "reqwest 0.11.27", "serde", "serde_json", "thiserror 1.0.69", @@ -1226,21 +1238,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1402,8 +1399,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -1464,7 +1463,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", "indexmap", "slab", "tokio", @@ -1534,6 +1533,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1541,7 +1551,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.2.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.2.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -1574,8 +1607,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1587,6 +1620,25 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.2.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1594,24 +1646,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", - "rustls", + "http 0.2.12", + "hyper 0.14.32", + "rustls 0.21.12", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", ] [[package]] -name = "hyper-tls" -version = "0.5.0" +name = "hyper-rustls" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +dependencies = [ + "futures-util", + "http 1.2.0", + "hyper 1.6.0", + "hyper-util", + "rustls 0.23.23", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.2", + "tower-service", + "webpki-roots 0.26.8", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" dependencies = [ "bytes", - "hyper", - "native-tls", + "futures-channel", + "futures-util", + "http 1.2.0", + "http-body 1.0.1", + "hyper 1.6.0", + "pin-project-lite", + "socket2", "tokio", - "tokio-native-tls", + "tower-service", + "tracing", ] [[package]] @@ -2030,23 +2106,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "native-tls" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -2158,50 +2217,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "openssl" -version = "0.10.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" -dependencies = [ - "bitflags 2.9.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.99", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-sys" -version = "0.9.106" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "option-ext" version = "0.2.0" @@ -2502,6 +2517,58 @@ dependencies = [ "unarray", ] +[[package]] +name = "quinn" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.23", + "socket2", + "thiserror 2.0.12", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +dependencies = [ + "bytes", + "getrandom 0.2.15", + "rand", + "ring 0.17.11", + "rustc-hash", + "rustls 0.23.23", + "rustls-pki-types", + "slab", + "thiserror 2.0.12", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e46f3055866785f6b92bc6164b76be02ca8f2eb4b002c0354b28cf4c119e5944" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + [[package]] name = "quote" version = "1.0.39" @@ -2637,38 +2704,79 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "hyper-tls", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-rustls 0.24.2", "ipnet", "js-sys", "log", "mime", - "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", - "rustls-pemfile", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", - "tokio-native-tls", - "tokio-rustls", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.25.4", "winreg", ] +[[package]] +name = "reqwest" +version = "0.12.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http 1.2.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.6.0", + "hyper-rustls 0.27.5", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls 0.23.23", + "rustls-pemfile 2.2.0", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.2", + "tokio", + "tokio-rustls 0.26.2", + "tower", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.26.8", + "windows-registry", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -2745,6 +2853,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -2781,10 +2895,24 @@ checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.11", - "rustls-webpki", + "rustls-webpki 0.101.7", "sct", ] +[[package]] +name = "rustls" +version = "0.23.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +dependencies = [ + "once_cell", + "ring 0.17.11", + "rustls-pki-types", + "rustls-webpki 0.102.8", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -2794,6 +2922,24 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" +dependencies = [ + "web-time", +] + [[package]] name = "rustls-webpki" version = "0.101.7" @@ -2804,6 +2950,17 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring 0.17.11", + "rustls-pki-types", + "untrusted 0.9.0", +] + [[package]] name = "rustversion" version = "1.0.19" @@ -2858,15 +3015,6 @@ dependencies = [ "syn 2.0.99", ] -[[package]] -name = "schannel" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -2909,29 +3057,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.9.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.25" @@ -3204,7 +3329,7 @@ dependencies = [ "fs2", "hex", "once_cell", - "reqwest", + "reqwest 0.11.27", "semver", "serde", "serde_json", @@ -3242,6 +3367,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -3440,22 +3574,22 @@ dependencies = [ ] [[package]] -name = "tokio-native-tls" -version = "0.3.1" +name = "tokio-rustls" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "native-tls", + "rustls 0.21.12", "tokio", ] [[package]] name = "tokio-rustls" -version = "0.24.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ - "rustls", + "rustls 0.23.23", "tokio", ] @@ -3467,11 +3601,11 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" dependencies = [ "futures-util", "log", - "rustls", + "rustls 0.21.12", "tokio", - "tokio-rustls", + "tokio-rustls 0.24.1", "tungstenite", - "webpki-roots", + "webpki-roots 0.25.4", ] [[package]] @@ -3521,6 +3655,27 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 1.0.2", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + [[package]] name = "tower-service" version = "0.3.3" @@ -3583,11 +3738,11 @@ dependencies = [ "byteorder", "bytes", "data-encoding", - "http", + "http 0.2.12", "httparse", "log", "rand", - "rustls", + "rustls 0.21.12", "sha1", "thiserror 1.0.69", "url", @@ -3687,12 +3842,6 @@ dependencies = [ "serde", ] -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -3814,12 +3963,31 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "webpki-roots" +version = "0.26.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3851,6 +4019,36 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -4198,8 +4396,7 @@ dependencies = [ "eyre", "hex", "log", - "reqwest", - "serde", + "reqwest 0.12.12", "serde_json", "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index 0ae3aab..8d087a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.0.2" edition = "2021" authors = ["ubermensch3dot0"] description = "ZkSync Upgrade Verification Tool" - +repository = "https://github.com/cyfrin/zksync-upgrade-verification-rs" [dependencies] ethers = { version = "2.0", features = ["rustls"] } @@ -15,6 +15,10 @@ tokio = { version = "1.38", features = ["full"] } env_logger = "0.11" log = "0.4" hex = "0.4" -reqwest = { version = "0.11", features = ["json"] } +reqwest = { version = "0.12.2", default-features = false, features = ["blocking", "json", "rustls-tls"] } serde_json = "1.0" -serde = { version = "1.0", features = ["derive"] } + +# The profile that 'dist' will build with +[profile.dist] +inherits = "release" +lto = "thin" \ No newline at end of file