From ee302ec78c363f0384011d35c76907a9deebe93a Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 26 Sep 2024 14:47:03 -0300 Subject: [PATCH 01/19] Send uncoded commitment --- core/lib/l1_contract_interface/Cargo.toml | 5 +- .../src/i_executor/structures/blob_info.rs | 140 ++++++++++++++++++ .../structures/commit_batch_info.rs | 32 +++- .../src/i_executor/structures/mod.rs | 1 + 4 files changed, 169 insertions(+), 9 deletions(-) create mode 100644 core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs diff --git a/core/lib/l1_contract_interface/Cargo.toml b/core/lib/l1_contract_interface/Cargo.toml index 8b68df854e71..e7bcf19d4ca3 100644 --- a/core/lib/l1_contract_interface/Cargo.toml +++ b/core/lib/l1_contract_interface/Cargo.toml @@ -23,8 +23,11 @@ sha2.workspace = true sha3.workspace = true hex.workspace = true once_cell.workspace = true +rlp.workspace = true +serde.workspace = true +bincode.workspace = true [dev-dependencies] -serde.workspace = true serde_json.workspace = true serde_with = { workspace = true, features = ["base64", "hex"] } + diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs new file mode 100644 index 000000000000..18a433fdc7aa --- /dev/null +++ b/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs @@ -0,0 +1,140 @@ +use rlp::Decodable; +use rlp::DecoderError; +use rlp::Rlp; +use serde::{Serialize, Deserialize}; + +#[derive(Debug,Serialize, Deserialize)] +struct G1Commitment { + pub x: Vec, + pub y: Vec, +} + +impl Decodable for G1Commitment { + fn decode(rlp: &Rlp) -> Result { + let x: Vec = rlp.val_at(0)?; // Decode first element as Vec + let y: Vec = rlp.val_at(1)?; // Decode second element as Vec + + Ok(G1Commitment { x, y }) + } +} + +#[derive(Debug,Serialize, Deserialize)] +struct BlobQuorumParam { + pub quorum_number: u32, + pub adversary_threshold_percentage: u32, + pub confirmation_threshold_percentage: u32, + pub chunk_length: u32 +} + +impl Decodable for BlobQuorumParam { + fn decode(rlp: &Rlp) -> Result { + Ok(BlobQuorumParam { + quorum_number: rlp.val_at(0)?, + adversary_threshold_percentage: rlp.val_at(1)?, + confirmation_threshold_percentage: rlp.val_at(2)?, + chunk_length: rlp.val_at(3)?, + }) + } +} + +#[derive(Debug,Serialize, Deserialize)] +struct BlobHeader { + pub commitment: G1Commitment, + pub data_length: u32, + pub blob_quorum_params: Vec +} + +impl Decodable for BlobHeader { + fn decode(rlp: &Rlp) -> Result { + let commitment: G1Commitment = rlp.val_at(0)?; + let data_length: u32 = rlp.val_at(1)?; + let blob_quorum_params: Vec = rlp.list_at(2)?; + + Ok(BlobHeader { + commitment, + data_length, + blob_quorum_params, + }) + } +} + +#[derive(Debug,Serialize, Deserialize)] +struct BatchHeader { + pub batch_root: Vec, + pub quorum_numbers: Vec, + pub quorum_signed_percentages: Vec, + pub reference_block_number: u32 +} + +impl Decodable for BatchHeader { + fn decode(rlp: &Rlp) -> Result { + Ok(BatchHeader { + batch_root: rlp.val_at(0)?, + quorum_numbers: rlp.val_at(1)?, + quorum_signed_percentages: rlp.val_at(2)?, + reference_block_number: rlp.val_at(3)?, + }) + } +} + +#[derive(Debug,Serialize, Deserialize)] +struct BatchMetadata { + pub batch_header: BatchHeader, + pub signatory_record_hash: Vec, + pub fee: Vec, + pub confirmation_block_number: u32, + pub batch_header_hash: Vec +} + +impl Decodable for BatchMetadata { + fn decode(rlp: &Rlp) -> Result { + let batch_header: BatchHeader = rlp.val_at(0)?; + + Ok(BatchMetadata { + batch_header, + signatory_record_hash: rlp.val_at(1)?, + fee: rlp.val_at(2)?, + confirmation_block_number: rlp.val_at(3)?, + batch_header_hash: rlp.val_at(4)?, + }) + } +} + +#[derive(Debug,Serialize, Deserialize)] +struct BlobVerificationProof { + pub batch_id: u32, + pub blob_index: u32, + pub batch_medatada: BatchMetadata, + pub inclusion_proof: Vec, + pub quorum_indexes: Vec +} + +impl Decodable for BlobVerificationProof { + fn decode(rlp: &Rlp) -> Result { + Ok(BlobVerificationProof { + batch_id: rlp.val_at(0)?, + blob_index: rlp.val_at(1)?, + batch_medatada: rlp.val_at(2)?, + inclusion_proof: rlp.val_at(3)?, + quorum_indexes: rlp.val_at(4)?, + }) + } +} + +#[derive(Debug,Serialize, Deserialize)] +pub struct BlobInfo { + pub blob_header: BlobHeader, + pub blob_verification_proof: BlobVerificationProof +} + +impl Decodable for BlobInfo { + fn decode(rlp: &Rlp) -> Result { + let blob_header: BlobHeader = rlp.val_at(0)?; + let blob_verification_proof: BlobVerificationProof = rlp.val_at(1)?; + + Ok(BlobInfo { + blob_header, + blob_verification_proof, + }) + } +} diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs index 0d1ff91163fa..42bcc3526a13 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs @@ -1,3 +1,4 @@ +use rlp::decode; use zksync_types::{ commitment::{ pre_boojum_serialize_commitments, serialize_commitments, L1BatchCommitmentMode, @@ -13,6 +14,8 @@ use crate::{ i_executor::commit::kzg::{KzgInfo, ZK_SYNC_BYTES_PER_BLOB}, Tokenizable, }; +use bincode; +use super::blob_info::BlobInfo; /// These are used by the L1 Contracts to indicate what DA layer is used for pubdata const PUBDATA_SOURCE_CALLDATA: u8 = 0; @@ -217,14 +220,27 @@ impl Tokenizable for CommitBatchInfo<'_> { } (L1BatchCommitmentMode::Validium, PubdataDA::Custom) => { let mut operator_da_input = vec![PUBDATA_SOURCE_CUSTOM]; - operator_da_input.extend( - &self - .l1_batch_with_metadata - .metadata - .da_blob_id - .clone() - .unwrap_or_default() - ); + + let commitment = &self + .l1_batch_with_metadata + .metadata + .da_blob_id + .clone() + .unwrap_or_default(); + + let data = &hex::decode(commitment).unwrap()[3..]; + + let blob_info: BlobInfo = match decode(&data) { + Ok(blob_info) => blob_info, + Err(e) => panic!("Error decoding commitment: {}", e) + }; + + let bytes = match bincode::serialize(&blob_info) { + Ok(bytes) => bytes, + Err(e) => panic!("Error serializing commitment: {}", e) + }; + + operator_da_input.extend(bytes); operator_da_input } diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs index d1ed57e41f2e..90c16d37c573 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs @@ -2,5 +2,6 @@ mod commit_batch_info; mod stored_batch_info; +mod blob_info; pub use self::{commit_batch_info::CommitBatchInfo, stored_batch_info::StoredBatchInfo}; From bc8c30e41fab2e29881a70920c135f402f090e0b Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 26 Sep 2024 17:44:49 -0300 Subject: [PATCH 02/19] Add call to verify --- Cargo.lock | 1277 +++++++++++++++++++++++-- core/node/da_clients/Cargo.toml | 4 + core/node/da_clients/src/blob_info.rs | 221 +++++ core/node/da_clients/src/eigen_da.rs | 36 + core/node/da_clients/src/lib.rs | 1 + 5 files changed, 1461 insertions(+), 78 deletions(-) create mode 100644 core/node/da_clients/src/blob_info.rs diff --git a/Cargo.lock b/Cargo.lock index 7a032bea5e86..005769ae56db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,16 @@ # 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 = "addchain" version = "0.2.0" @@ -233,6 +243,15 @@ 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 = "assert_matches" version = "1.5.0" @@ -404,6 +423,17 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "async_io_stream" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +dependencies = [ + "futures 0.3.30", + "pharos", + "rustc_version", +] + [[package]] name = "atoi" version = "2.0.0" @@ -436,6 +466,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2 1.0.86", + "quote 1.0.36", + "syn 2.0.72", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -603,6 +644,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "beef" version = "0.5.2" @@ -689,6 +736,15 @@ dependencies = [ "unicode-normalization", ] +[[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" @@ -942,6 +998,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" dependencies = [ + "sha2 0.10.8", "tinyvec", ] @@ -1002,6 +1059,9 @@ name = "bytes" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +dependencies = [ + "serde", +] [[package]] name = "bytesize" @@ -1009,6 +1069,16 @@ 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" @@ -1051,6 +1121,20 @@ dependencies = [ "serde_json", ] +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cast" version = "0.3.0" @@ -1393,6 +1477,58 @@ dependencies = [ "indexmap 1.9.3", ] +[[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 0.10.7", + "hmac 0.12.1", + "k256 0.13.3", + "serde", + "sha2 0.10.8", + "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 0.12.1", + "once_cell", + "pbkdf2 0.12.2", + "rand 0.8.5", + "sha2 0.10.8", + "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.5", + "bech32", + "bs58", + "digest 0.10.7", + "generic-array", + "hex", + "ripemd", + "serde", + "serde_derive", + "sha2 0.10.8", + "sha3 0.10.8", + "thiserror", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -1436,6 +1572,19 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "const-hex" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + [[package]] name = "const-oid" version = "0.9.5" @@ -1867,6 +2016,12 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + [[package]] name = "debugid" version = "0.8.0" @@ -1874,7 +2029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ "serde", - "uuid", + "uuid 1.5.0", ] [[package]] @@ -1980,6 +2135,48 @@ dependencies = [ "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 = "dotenvy" version = "0.15.7" @@ -2127,6 +2324,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "ena" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +dependencies = [ + "log", +] + [[package]] name = "encode_unicode" version = "0.3.6" @@ -2142,6 +2348,24 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enr" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" +dependencies = [ + "base64 0.21.5", + "bytes", + "hex", + "k256 0.13.3", + "log", + "rand 0.8.5", + "rlp", + "serde", + "sha3 0.10.8", + "zeroize", +] + [[package]] name = "enum_dispatch" version = "0.3.13" @@ -2199,67 +2423,341 @@ dependencies = [ ] [[package]] -name = "error-chain" -version = "0.12.4" +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[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 0.12.1", + "pbkdf2 0.11.0", + "rand 0.8.5", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3 0.10.8", + "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 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 2.0.2", +] + +[[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.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" +dependencies = [ + "ethers-addressbook", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-middleware", + "ethers-providers", + "ethers-signers", + "ethers-solc", +] + +[[package]] +name = "ethers-addressbook" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" +dependencies = [ + "ethers-core", + "once_cell", + "serde", + "serde_json", +] + +[[package]] +name = "ethers-contract" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" +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.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" +dependencies = [ + "Inflector", + "const-hex", + "dunce", + "ethers-core", + "ethers-etherscan", + "eyre", + "prettyplease", + "proc-macro2 1.0.86", + "quote 1.0.36", + "regex", + "reqwest 0.11.22", + "serde", + "serde_json", + "syn 2.0.72", + "toml", + "walkdir", +] + +[[package]] +name = "ethers-contract-derive" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" +dependencies = [ + "Inflector", + "const-hex", + "ethers-contract-abigen", + "ethers-core", + "proc-macro2 1.0.86", + "quote 1.0.36", + "serde_json", + "syn 2.0.72", +] + +[[package]] +name = "ethers-core" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" +dependencies = [ + "arrayvec 0.7.4", + "bytes", + "cargo_metadata 0.18.1", + "chrono", + "const-hex", + "elliptic-curve 0.13.8", + "ethabi", + "generic-array", + "k256 0.13.3", + "num_enum 0.7.2", + "once_cell", + "open-fastrlp", + "rand 0.8.5", + "rlp", + "serde", + "serde_json", + "strum", + "syn 2.0.72", + "tempfile", + "thiserror", + "tiny-keccak 2.0.2", + "unicode-xid 0.2.4", +] + +[[package]] +name = "ethers-etherscan" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" +dependencies = [ + "chrono", + "ethers-core", + "reqwest 0.11.22", + "semver", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "ethers-middleware" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" +dependencies = [ + "async-trait", + "auto_impl", + "ethers-contract", + "ethers-core", + "ethers-etherscan", + "ethers-providers", + "ethers-signers", + "futures-channel", + "futures-locks", + "futures-util", + "instant", + "reqwest 0.11.22", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "url", +] + +[[package]] +name = "ethers-providers" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" +dependencies = [ + "async-trait", + "auto_impl", + "base64 0.21.5", + "bytes", + "const-hex", + "enr", + "ethers-core", + "futures-core", + "futures-timer", + "futures-util", + "hashers", + "http 0.2.9", + "instant", + "jsonwebtoken 8.3.0", + "once_cell", + "pin-project", + "reqwest 0.11.22", + "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.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" dependencies = [ - "version_check", + "async-trait", + "coins-bip32", + "coins-bip39", + "const-hex", + "elliptic-curve 0.13.8", + "eth-keystore", + "ethers-core", + "rand 0.8.5", + "sha2 0.10.8", + "thiserror", + "tracing", ] [[package]] -name = "etcetera" -version = "0.8.0" +name = "ethers-solc" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +checksum = "66244a771d9163282646dbeffe0e6eca4dda4146b6498644e678ac6089b11edd" dependencies = [ "cfg-if", + "const-hex", + "dirs", + "dunce", + "ethers-core", + "glob", "home", - "windows-sys 0.48.0", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", + "md-5", + "num_cpus", "once_cell", + "path-slash", + "rayon", "regex", + "semver", "serde", "serde_json", - "sha3 0.10.8", + "solang-parser", + "svm-rs", "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-rlp", - "impl-serde", "tiny-keccak 2.0.2", -] - -[[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-rlp", - "impl-serde", - "primitive-types", - "uint", + "tokio", + "tracing", + "walkdir", + "yansi", ] [[package]] @@ -2293,6 +2791,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "fastrand" version = "2.0.1" @@ -2397,7 +2905,7 @@ checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "spin", + "spin 0.9.8", ] [[package]] @@ -2496,6 +3004,16 @@ dependencies = [ "zksync_bellman", ] +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "fs_extra" version = "1.3.0" @@ -2593,6 +3111,16 @@ dependencies = [ "pin-project-lite", ] +[[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.30" @@ -2623,7 +3151,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" dependencies = [ "gloo-timers", - "send_wrapper", + "send_wrapper 0.4.0", ] [[package]] @@ -2645,6 +3173,15 @@ dependencies = [ "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" @@ -2782,7 +3319,7 @@ dependencies = [ "google-cloud-metadata", "google-cloud-token", "home", - "jsonwebtoken", + "jsonwebtoken 9.3.0", "reqwest 0.12.5", "serde", "serde_json", @@ -2826,7 +3363,7 @@ dependencies = [ "regex", "reqwest 0.12.5", "reqwest-middleware", - "ring", + "ring 0.17.7", "serde", "serde_json", "sha2 0.10.8", @@ -2963,6 +3500,15 @@ dependencies = [ "serde", ] +[[package]] +name = "hashers" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" +dependencies = [ + "fxhash", +] + [[package]] name = "hashlink" version = "0.9.1" @@ -3385,6 +3931,12 @@ dependencies = [ "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" @@ -3467,6 +4019,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.0" @@ -3785,6 +4346,20 @@ dependencies = [ "url", ] +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.5", + "pem 1.1.1", + "ring 0.16.20", + "serde", + "serde_json", + "simple_asn1", +] + [[package]] name = "jsonwebtoken" version = "9.3.0" @@ -3793,8 +4368,8 @@ checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" dependencies = [ "base64 0.21.5", "js-sys", - "pem", - "ring", + "pem 3.0.4", + "ring 0.17.7", "serde", "serde_json", "simple_asn1", @@ -3835,13 +4410,43 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "lalrpop" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" +dependencies = [ + "ascii-canvas", + "bit-set", + "ena", + "itertools 0.11.0", + "lalrpop-util", + "petgraph", + "regex", + "regex-syntax 0.8.2", + "string_cache", + "term", + "tiny-keccak 2.0.2", + "unicode-xid 0.2.4", + "walkdir", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" +dependencies = [ + "regex-automata 0.4.7", +] + [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin", + "spin 0.9.8", ] [[package]] @@ -3878,6 +4483,16 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] + [[package]] name = "librocksdb-sys" version = "0.11.0+8.1.1" @@ -4248,7 +4863,7 @@ dependencies = [ "httparse", "memchr", "mime", - "spin", + "spin 0.9.8", "version_check", ] @@ -4276,6 +4891,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + [[package]] name = "nix" version = "0.27.1" @@ -4542,6 +5163,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 0.7.4", + "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 1.0.86", + "quote 1.0.36", + "syn 1.0.109", +] + [[package]] name = "openssl" version = "0.10.66" @@ -4684,6 +5330,12 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "ordered-float" version = "2.10.1" @@ -4783,12 +5435,41 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "password-hash" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "paste" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "path-slash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", + "hmac 0.12.1", + "password-hash", + "sha2 0.10.8", +] + [[package]] name = "pbkdf2" version = "0.12.2" @@ -4796,6 +5477,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest 0.10.7", + "hmac 0.12.1", ] [[package]] @@ -4804,6 +5486,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +[[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 = "pem" version = "3.0.4" @@ -4884,6 +5575,67 @@ dependencies = [ "indexmap 2.1.0", ] +[[package]] +name = "pharos" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" +dependencies = [ + "futures 0.3.30", + "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 0.8.5", +] + +[[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 1.0.86", + "quote 1.0.36", + "syn 2.0.72", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher 0.3.11", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher 0.3.11", +] + [[package]] name = "pin-project" version = "1.1.3" @@ -5042,6 +5794,12 @@ 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 = "pretty_assertions" version = "1.4.0" @@ -5184,6 +5942,22 @@ dependencies = [ "syn 2.0.72", ] +[[package]] +name = "proptest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +dependencies = [ + "bitflags 2.6.0", + "lazy_static", + "num-traits", + "rand 0.8.5", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.2", + "unarray", +] + [[package]] name = "prost" version = "0.12.1" @@ -5448,6 +6222,15 @@ 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 0.6.4", +] + [[package]] name = "rand_xoshiro" version = "0.6.0" @@ -5504,6 +6287,17 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + [[package]] name = "regex" version = "1.10.6" @@ -5572,6 +6366,7 @@ dependencies = [ "http 0.2.9", "http-body 0.4.6", "hyper 0.14.29", + "hyper-rustls 0.24.2", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -5581,17 +6376,21 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", "serde", "serde_json", "serde_urlencoded", "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls 0.24.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots 0.25.4", "winreg 0.50.0", ] @@ -5703,6 +6502,21 @@ dependencies = [ "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 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.7" @@ -5712,11 +6526,20 @@ dependencies = [ "cc", "getrandom", "libc", - "spin", - "untrusted", + "spin 0.9.8", + "untrusted 0.9.0", "windows-sys 0.48.0", ] +[[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.43" @@ -5732,7 +6555,7 @@ dependencies = [ "rkyv_derive", "seahash", "tinyvec", - "uuid", + "uuid 1.5.0", ] [[package]] @@ -5753,9 +6576,21 @@ 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 1.0.86", + "quote 1.0.36", + "syn 1.0.109", +] + [[package]] name = "rocksdb" version = "0.21.0" @@ -5855,7 +6690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", - "ring", + "ring 0.17.7", "rustls-webpki 0.101.7", "sct", ] @@ -5867,7 +6702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" dependencies = [ "log", - "ring", + "ring 0.17.7", "rustls-pki-types", "rustls-webpki 0.102.4", "subtle", @@ -5883,7 +6718,7 @@ dependencies = [ "aws-lc-rs", "log", "once_cell", - "ring", + "ring 0.17.7", "rustls-pki-types", "rustls-webpki 0.102.4", "subtle", @@ -5957,7 +6792,7 @@ dependencies = [ "rustls-webpki 0.102.4", "security-framework", "security-framework-sys", - "webpki-roots", + "webpki-roots 0.26.0", "winapi", ] @@ -5973,8 +6808,8 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -5984,9 +6819,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "aws-lc-rs", - "ring", + "ring 0.17.7", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -6012,6 +6847,15 @@ 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" @@ -6181,14 +7025,26 @@ 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 0.12.1", + "pbkdf2 0.11.0", + "salsa20", + "sha2 0.10.8", +] + [[package]] name = "sct" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -6306,6 +7162,12 @@ 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 = "sentry" version = "0.31.7" @@ -6411,7 +7273,7 @@ dependencies = [ "thiserror", "time", "url", - "uuid", + "uuid 1.5.0", ] [[package]] @@ -6481,6 +7343,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -6689,6 +7560,12 @@ dependencies = [ "time", ] +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "siphasher" version = "1.0.1" @@ -6712,7 +7589,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" dependencies = [ "bytecount", - "cargo_metadata", + "cargo_metadata 0.14.2", "error-chain", "glob", "pulldown-cmark", @@ -6789,7 +7666,7 @@ dependencies = [ "num-bigint 0.4.6", "num-rational", "num-traits", - "pbkdf2", + "pbkdf2 0.12.2", "pin-project", "poly1305", "rand 0.8.5", @@ -6800,7 +7677,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "sha3 0.10.8", - "siphasher", + "siphasher 1.0.1", "slab", "smallvec", "soketto 0.7.1", @@ -6839,7 +7716,7 @@ dependencies = [ "rand_chacha", "serde", "serde_json", - "siphasher", + "siphasher 1.0.1", "slab", "smol", "smoldot", @@ -6924,6 +7801,20 @@ dependencies = [ "sha1", ] +[[package]] +name = "solang-parser" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" +dependencies = [ + "itertools 0.11.0", + "lalrpop", + "lalrpop-util", + "phf", + "thiserror", + "unicode-xid 0.2.4", +] + [[package]] name = "sp-core-hashing" version = "15.0.0" @@ -6938,6 +7829,12 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spin" version = "0.9.8" @@ -7204,6 +8101,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", + "phf_shared 0.10.0", + "precomputed-hash", +] + [[package]] name = "stringprep" version = "0.1.4" @@ -7397,7 +8307,7 @@ dependencies = [ "hex", "hmac 0.12.1", "parity-scale-codec", - "pbkdf2", + "pbkdf2 0.12.2", "regex", "schnorrkel", "secrecy", @@ -7408,6 +8318,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "svm-rs" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" +dependencies = [ + "dirs", + "fs2", + "hex", + "once_cell", + "reqwest 0.11.22", + "semver", + "serde", + "serde_json", + "sha2 0.10.8", + "thiserror", + "url", + "zip", +] + [[package]] name = "syn" version = "0.15.44" @@ -7524,6 +8454,17 @@ dependencies = [ "windows-sys 0.52.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 = "termcolor" version = "1.4.1" @@ -7818,6 +8759,21 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "tokio-tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +dependencies = [ + "futures-util", + "log", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", + "tungstenite", + "webpki-roots 0.25.4", +] + [[package]] name = "tokio-util" version = "0.7.12" @@ -7832,11 +8788,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac2caab0bf757388c6c0ae23b3293fdb463fee59434529014f85e3263b995c28" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.16", +] + [[package]] name = "toml_datetime" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -7846,7 +8817,7 @@ checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.1.0", "toml_datetime", - "winnow", + "winnow 0.5.17", ] [[package]] @@ -7857,7 +8828,7 @@ checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ "indexmap 2.1.0", "toml_datetime", - "winnow", + "winnow 0.5.17", ] [[package]] @@ -7868,7 +8839,20 @@ checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap 2.1.0", "toml_datetime", - "winnow", + "winnow 0.5.17", +] + +[[package]] +name = "toml_edit" +version = "0.22.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "278f3d518e152219c994ce877758516bca5e118eaed6996192a774fb9fbf0788" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.20", ] [[package]] @@ -7983,6 +8967,16 @@ dependencies = [ "valuable", ] +[[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 = "tracing-log" version = "0.1.4" @@ -8082,6 +9076,26 @@ dependencies = [ "termcolor", ] +[[package]] +name = "tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 0.2.9", + "httparse", + "log", + "rand 0.8.5", + "rustls 0.21.12", + "sha1", + "thiserror", + "url", + "utf-8", +] + [[package]] name = "twox-hash" version = "1.6.3" @@ -8132,6 +9146,12 @@ dependencies = [ "libc", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.7.0" @@ -8218,6 +9238,12 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -8255,12 +9281,28 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[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.5.0" @@ -8486,7 +9528,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" dependencies = [ "smallvec", - "spin", + "spin 0.9.8", "wasmi_arena", "wasmi_core", "wasmparser-nostd", @@ -8539,6 +9581,12 @@ dependencies = [ "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.0" @@ -8833,6 +9881,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" @@ -8853,6 +9910,25 @@ dependencies = [ "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 0.3.30", + "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" @@ -8935,6 +10011,26 @@ dependencies = [ "syn 2.0.72", ] +[[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 0.1.5", + "crc32fast", + "crossbeam-utils", + "flate2", + "hmac 0.12.1", + "pbkdf2 0.11.0", + "sha1", + "time", + "zstd", +] + [[package]] name = "zk_evm" version = "0.131.0-rc.2" @@ -9670,6 +10766,7 @@ dependencies = [ "base58", "blake2 0.10.6", "blake2b_simd", + "ethers", "flate2", "futures 0.3.30", "hex", @@ -9677,6 +10774,7 @@ dependencies = [ "jsonrpsee 0.23.2", "parity-scale-codec", "reqwest 0.12.5", + "rlp", "scale-encode", "serde", "serde_json", @@ -9685,8 +10783,10 @@ dependencies = [ "tokio", "tracing", "zksync_config", + "zksync_contracts", "zksync_da_client", "zksync_env_config", + "zksync_eth_client", "zksync_object_store", "zksync_types", ] @@ -10026,8 +11126,10 @@ dependencies = [ name = "zksync_l1_contract_interface" version = "0.1.0" dependencies = [ + "bincode", "hex", "once_cell", + "rlp", "serde", "serde_json", "serde_with", @@ -11076,6 +12178,25 @@ dependencies = [ "zksync_types", ] +[[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.9+zstd.1.5.5" diff --git a/core/node/da_clients/Cargo.toml b/core/node/da_clients/Cargo.toml index b7e5510600fb..5b5567a8aabe 100644 --- a/core/node/da_clients/Cargo.toml +++ b/core/node/da_clients/Cargo.toml @@ -23,6 +23,8 @@ zksync_types.workspace = true zksync_object_store.workspace = true zksync_da_client.workspace = true zksync_env_config.workspace = true +zksync_eth_client.workspace = true +zksync_contracts.workspace = true futures.workspace = true # Avail dependencies @@ -41,3 +43,5 @@ subxt-signer = { workspace = true, features = ["sr25519", "native"] } # EigenDA dependencies reqwest = { version = "0.12" } http = "1" +rlp.workspace = true +ethers = { version = "2.0.0-rc.1", features = ["abigen", "etherscan"] } diff --git a/core/node/da_clients/src/blob_info.rs b/core/node/da_clients/src/blob_info.rs new file mode 100644 index 000000000000..f437b02db1b9 --- /dev/null +++ b/core/node/da_clients/src/blob_info.rs @@ -0,0 +1,221 @@ +use rlp::Decodable; +use rlp::DecoderError; +use rlp::Rlp; +use zksync_types::web3::contract::Tokenizable; +use zksync_types::web3::contract::Tokenize; +use zksync_types::ethabi::Token; +use zksync_types::U256; + +#[derive(Debug)] +pub struct G1Commitment { + pub x: Vec, + pub y: Vec, +} + +impl Decodable for G1Commitment { + fn decode(rlp: &Rlp) -> Result { + let x: Vec = rlp.val_at(0)?; // Decode first element as Vec + let y: Vec = rlp.val_at(1)?; // Decode second element as Vec + + Ok(G1Commitment { x, y }) + } +} + +impl Tokenize for G1Commitment { + fn into_tokens(self) -> Vec { + + let x = self.x.into_token(); + let y = self.y.into_token(); + + vec![x, y] + } +} + +#[derive(Debug)] +pub struct BlobQuorumParam { + pub quorum_number: u32, + pub adversary_threshold_percentage: u32, + pub confirmation_threshold_percentage: u32, + pub chunk_length: u32 +} + +impl Decodable for BlobQuorumParam { + fn decode(rlp: &Rlp) -> Result { + Ok(BlobQuorumParam { + quorum_number: rlp.val_at(0)?, + adversary_threshold_percentage: rlp.val_at(1)?, + confirmation_threshold_percentage: rlp.val_at(2)?, + chunk_length: rlp.val_at(3)?, + }) + } +} + +impl Tokenize for BlobQuorumParam { + fn into_tokens(self) -> Vec { + + let quorum_number = Token::Uint(U256::from(self.quorum_number)); + let adversary_threshold_percentage = Token::Uint(U256::from(self.adversary_threshold_percentage)); + let confirmation_threshold_percentage = Token::Uint(U256::from(self.confirmation_threshold_percentage)); + let chunk_length = Token::Uint(U256::from(self.chunk_length)); + + vec![quorum_number, adversary_threshold_percentage,confirmation_threshold_percentage,chunk_length] + } +} + +#[derive(Debug)] +pub struct BlobHeader { + pub commitment: G1Commitment, + pub data_length: u32, + pub blob_quorum_params: Vec +} + +impl Decodable for BlobHeader { + fn decode(rlp: &Rlp) -> Result { + let commitment: G1Commitment = rlp.val_at(0)?; + let data_length: u32 = rlp.val_at(1)?; + let blob_quorum_params: Vec = rlp.list_at(2)?; + + Ok(BlobHeader { + commitment, + data_length, + blob_quorum_params, + }) + } +} + +impl Tokenize for BlobHeader { + fn into_tokens(self) -> Vec { + let commitment = self.commitment.into_tokens(); + let data_length = Token::Uint(U256::from(self.data_length)); + let blob_quorum_params = self.blob_quorum_params.into_iter().map(|quorum| Token::Array(quorum.into_tokens())).collect(); + + vec![Token::Array(commitment), data_length,Token::Array(blob_quorum_params)] + } +} + +#[derive(Debug)] +pub struct BatchHeader { + pub batch_root: Vec, + pub quorum_numbers: Vec, + pub quorum_signed_percentages: Vec, + pub reference_block_number: u32 +} + +impl Decodable for BatchHeader { + fn decode(rlp: &Rlp) -> Result { + Ok(BatchHeader { + batch_root: rlp.val_at(0)?, + quorum_numbers: rlp.val_at(1)?, + quorum_signed_percentages: rlp.val_at(2)?, + reference_block_number: rlp.val_at(3)?, + }) + } +} + +impl Tokenize for BatchHeader { + fn into_tokens(self) -> Vec { + let batch_root = self.batch_root.into_token(); + let quorum_numbers = self.quorum_numbers.into_token(); + let quorum_signed_percentages = self.quorum_signed_percentages.into_token(); + let reference_block_number = Token::Uint(U256::from(self.reference_block_number)); + + vec![batch_root, quorum_numbers,quorum_signed_percentages,reference_block_number] + } +} + +#[derive(Debug)] +pub struct BatchMetadata { + pub batch_header: BatchHeader, + pub signatory_record_hash: Vec, + pub fee: Vec, + pub confirmation_block_number: u32, + pub batch_header_hash: Vec +} + +impl Decodable for BatchMetadata { + fn decode(rlp: &Rlp) -> Result { + let batch_header: BatchHeader = rlp.val_at(0)?; + + Ok(BatchMetadata { + batch_header, + signatory_record_hash: rlp.val_at(1)?, + fee: rlp.val_at(2)?, + confirmation_block_number: rlp.val_at(3)?, + batch_header_hash: rlp.val_at(4)?, + }) + } +} + +impl Tokenize for BatchMetadata { + fn into_tokens(self) -> Vec { + let batch_header = self.batch_header.into_tokens(); + let signatory_record_hash = self.signatory_record_hash.into_token(); + let fee = self.fee.into_token(); + let confirmation_block_number = Token::Uint(U256::from(self.confirmation_block_number)); + let batch_header_hash = self.batch_header_hash.into_token(); + + vec![Token::Array(batch_header), signatory_record_hash,fee,confirmation_block_number,batch_header_hash] + } +} + +#[derive(Debug)] +pub struct BlobVerificationProof { + pub batch_id: u32, + pub blob_index: u32, + pub batch_medatada: BatchMetadata, + pub inclusion_proof: Vec, + pub quorum_indexes: Vec +} + +impl Decodable for BlobVerificationProof { + fn decode(rlp: &Rlp) -> Result { + Ok(BlobVerificationProof { + batch_id: rlp.val_at(0)?, + blob_index: rlp.val_at(1)?, + batch_medatada: rlp.val_at(2)?, + inclusion_proof: rlp.val_at(3)?, + quorum_indexes: rlp.val_at(4)?, + }) + } +} + +impl Tokenize for BlobVerificationProof { + fn into_tokens(self) -> Vec { + let batch_id = Token::Uint(U256::from(self.batch_id)); + let blob_index = Token::Uint(U256::from(self.blob_index)); + let batch_medatada = self.batch_medatada.into_tokens(); + let inclusion_proof = self.inclusion_proof.into_token(); + let quorum_indexes = self.quorum_indexes.into_token(); + + vec![batch_id, blob_index,Token::Array(batch_medatada),inclusion_proof,quorum_indexes] + } +} + +#[derive(Debug)] +pub struct BlobInfo { + pub blob_header: BlobHeader, + pub blob_verification_proof: BlobVerificationProof +} + +impl Decodable for BlobInfo { + fn decode(rlp: &Rlp) -> Result { + let blob_header: BlobHeader = rlp.val_at(0)?; + let blob_verification_proof: BlobVerificationProof = rlp.val_at(1)?; + + Ok(BlobInfo { + blob_header, + blob_verification_proof, + }) + } +} + +impl Tokenize for BlobInfo { + fn into_tokens(self) -> Vec { + let blob_header = self.blob_header.into_tokens(); + let blob_verification_proof = self.blob_verification_proof.into_tokens(); + + vec![Token::Array(blob_header),Token::Array(blob_verification_proof)] + } +} + + diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index f2eff70faa33..375fb62f250d 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -1,11 +1,18 @@ use std::fmt::Debug; use async_trait::async_trait; +use rlp::decode; use zksync_config::configs::da_client::eigen_da::EigenDAConfig; use zksync_da_client::{ types::{self, DAError, InclusionData}, DataAvailabilityClient, }; +use zksync_eth_client::{ + CallFunctionArgs, ContractCallError, EthInterface, +}; +use zksync_types::{blob, Address, U256}; + +use crate::blob_info::BlobInfo; #[derive(Clone, Debug)] pub struct EigenDAClient { @@ -23,6 +30,29 @@ impl EigenDAClient { }) } } +impl EigenDAClient { + pub async fn verify_blob( + &self, + verifier_address: Address, + eth_client: &dyn EthInterface, + commitment: String, + ) -> Result { + let data = &hex::decode(commitment).unwrap()[3..]; + + let blob_info: BlobInfo = match decode(&data) { + Ok(blob_info) => blob_info, + Err(e) => panic!("Error decoding commitment: {}", e) + }; + + CallFunctionArgs::new("verifyBlob", blob_info) + .for_contract( + verifier_address, + &zksync_contracts::hyperchain_contract(), + ) + .call(eth_client) + .await + } +} #[async_trait] impl DataAvailabilityClient for EigenDAClient { @@ -45,6 +75,12 @@ impl DataAvailabilityClient for EigenDAClient { .await .map_err(to_non_retriable_da_error)? .to_vec(); + + self.verify_blob( + self.config.verifier_address, //todo + self.config.eth_client.as_ref(), //todo + hex::encode(request_id), + ); Ok(types::DispatchResponse { blob_id: hex::encode(request_id), }) diff --git a/core/node/da_clients/src/lib.rs b/core/node/da_clients/src/lib.rs index 6b2622c64e25..07bac46e923d 100644 --- a/core/node/da_clients/src/lib.rs +++ b/core/node/da_clients/src/lib.rs @@ -2,3 +2,4 @@ pub mod avail; pub mod eigen_da; pub mod no_da; pub mod object_store; +pub mod blob_info; From a8b625817cae05c10e7c446f8aa3fc41ec3623da Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:11:06 -0300 Subject: [PATCH 03/19] Add verify blob to eigenda client --- core/bin/zksync_server/src/node_builder.rs | 2 +- core/lib/config/src/configs/contracts.rs | 2 ++ core/node/da_clients/src/eigen_da.rs | 18 +++++++++--------- .../layers/da_clients/eigen_da.rs | 10 ++++++---- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index cfc499a7cdc2..9f2bc3e90dc4 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -519,7 +519,7 @@ impl MainNodeBuilder { .add_layer(ObjectStorageClientWiringLayer::new(config)); } DAClient::EigenDA(config) => { - self.node.add_layer(EigenDAWiringLayer::new(config)); + self.node.add_layer(EigenDAWiringLayer::new(config, self.contracts_config.eigenda_verifier_addr)); } } diff --git a/core/lib/config/src/configs/contracts.rs b/core/lib/config/src/configs/contracts.rs index b68720ebaefe..fa99b4139ef4 100644 --- a/core/lib/config/src/configs/contracts.rs +++ b/core/lib/config/src/configs/contracts.rs @@ -40,6 +40,7 @@ pub struct ContractsConfig { // Used by the RPC API and by the node builder in wiring the BaseTokenRatioProvider layer. pub base_token_addr: Option
, pub chain_admin_addr: Option
, + pub eigenda_verifier_addr: Option
, } impl ContractsConfig { @@ -61,6 +62,7 @@ impl ContractsConfig { base_token_addr: Some(Address::repeat_byte(0x14)), ecosystem_contracts: Some(EcosystemContracts::for_tests()), chain_admin_addr: Some(Address::repeat_byte(0x18)), + eigenda_verifier_addr: Some(Address::repeat_byte(0x19)), } } } diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index 375fb62f250d..be655f37f3fc 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -8,7 +8,7 @@ use zksync_da_client::{ DataAvailabilityClient, }; use zksync_eth_client::{ - CallFunctionArgs, ContractCallError, EthInterface, + clients::{DynClient, L1}, CallFunctionArgs, ContractCallError, EthInterface }; use zksync_types::{blob, Address, U256}; @@ -18,23 +18,25 @@ use crate::blob_info::BlobInfo; pub struct EigenDAClient { client: reqwest::Client, config: EigenDAConfig, + eth_client: Box>, + verifier_address: Address, } impl EigenDAClient { pub const BLOB_SIZE_LIMIT_IN_BYTES: usize = 2 * 1024 * 1024; // 2MB - pub async fn new(config: EigenDAConfig) -> anyhow::Result { + pub async fn new(config: EigenDAConfig, eth_client: Box>, verifier_address: Address) -> anyhow::Result { Ok(Self { client: reqwest::Client::new(), config, + eth_client, + verifier_address, }) } } impl EigenDAClient { pub async fn verify_blob( &self, - verifier_address: Address, - eth_client: &dyn EthInterface, commitment: String, ) -> Result { let data = &hex::decode(commitment).unwrap()[3..]; @@ -46,10 +48,10 @@ impl EigenDAClient { CallFunctionArgs::new("verifyBlob", blob_info) .for_contract( - verifier_address, - &zksync_contracts::hyperchain_contract(), + self.verifier_address, //todo + &zksync_contracts::hyperchain_contract(), // todo ) - .call(eth_client) + .call(&self.eth_client) .await } } @@ -77,8 +79,6 @@ impl DataAvailabilityClient for EigenDAClient { .to_vec(); self.verify_blob( - self.config.verifier_address, //todo - self.config.eth_client.as_ref(), //todo hex::encode(request_id), ); Ok(types::DispatchResponse { diff --git a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs index b7c1025309ce..4a91305f0ccc 100644 --- a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs +++ b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs @@ -11,11 +11,12 @@ use crate::{ #[derive(Debug, Default)] pub struct EigenDAWiringLayer { config: EigenDAConfig, + verifier_address: String, } impl EigenDAWiringLayer { - pub fn new(config: EigenDAConfig) -> Self { - Self { config } + pub fn new(config: EigenDAConfig, verifier_address: Address) -> Self { + Self { config, verifier_address } } } @@ -34,9 +35,10 @@ impl WiringLayer for EigenDAWiringLayer { "eigen_da_client_layer" } - async fn wire(self, _: Self::Input) -> Result { + async fn wire(self, input: Self::Input) -> Result { + let EthInterfaceResource(query_client) = input.eth_client; let client: Box = - Box::new(EigenDAClient::new(self.config).await?); + Box::new(EigenDAClient::new(self.config,query_client, self.verifier_address).await?); Ok(Self::Output { client: DAClientResource(client), From d40d0335ed0b394b28cf212b3e962b179081d148 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:11:17 -0300 Subject: [PATCH 04/19] Revert "Send uncoded commitment" This reverts commit ee302ec78c363f0384011d35c76907a9deebe93a. --- core/lib/l1_contract_interface/Cargo.toml | 5 +- .../src/i_executor/structures/blob_info.rs | 140 ------------------ .../structures/commit_batch_info.rs | 32 +--- .../src/i_executor/structures/mod.rs | 1 - 4 files changed, 9 insertions(+), 169 deletions(-) delete mode 100644 core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs diff --git a/core/lib/l1_contract_interface/Cargo.toml b/core/lib/l1_contract_interface/Cargo.toml index e7bcf19d4ca3..8b68df854e71 100644 --- a/core/lib/l1_contract_interface/Cargo.toml +++ b/core/lib/l1_contract_interface/Cargo.toml @@ -23,11 +23,8 @@ sha2.workspace = true sha3.workspace = true hex.workspace = true once_cell.workspace = true -rlp.workspace = true -serde.workspace = true -bincode.workspace = true [dev-dependencies] +serde.workspace = true serde_json.workspace = true serde_with = { workspace = true, features = ["base64", "hex"] } - diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs deleted file mode 100644 index 18a433fdc7aa..000000000000 --- a/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs +++ /dev/null @@ -1,140 +0,0 @@ -use rlp::Decodable; -use rlp::DecoderError; -use rlp::Rlp; -use serde::{Serialize, Deserialize}; - -#[derive(Debug,Serialize, Deserialize)] -struct G1Commitment { - pub x: Vec, - pub y: Vec, -} - -impl Decodable for G1Commitment { - fn decode(rlp: &Rlp) -> Result { - let x: Vec = rlp.val_at(0)?; // Decode first element as Vec - let y: Vec = rlp.val_at(1)?; // Decode second element as Vec - - Ok(G1Commitment { x, y }) - } -} - -#[derive(Debug,Serialize, Deserialize)] -struct BlobQuorumParam { - pub quorum_number: u32, - pub adversary_threshold_percentage: u32, - pub confirmation_threshold_percentage: u32, - pub chunk_length: u32 -} - -impl Decodable for BlobQuorumParam { - fn decode(rlp: &Rlp) -> Result { - Ok(BlobQuorumParam { - quorum_number: rlp.val_at(0)?, - adversary_threshold_percentage: rlp.val_at(1)?, - confirmation_threshold_percentage: rlp.val_at(2)?, - chunk_length: rlp.val_at(3)?, - }) - } -} - -#[derive(Debug,Serialize, Deserialize)] -struct BlobHeader { - pub commitment: G1Commitment, - pub data_length: u32, - pub blob_quorum_params: Vec -} - -impl Decodable for BlobHeader { - fn decode(rlp: &Rlp) -> Result { - let commitment: G1Commitment = rlp.val_at(0)?; - let data_length: u32 = rlp.val_at(1)?; - let blob_quorum_params: Vec = rlp.list_at(2)?; - - Ok(BlobHeader { - commitment, - data_length, - blob_quorum_params, - }) - } -} - -#[derive(Debug,Serialize, Deserialize)] -struct BatchHeader { - pub batch_root: Vec, - pub quorum_numbers: Vec, - pub quorum_signed_percentages: Vec, - pub reference_block_number: u32 -} - -impl Decodable for BatchHeader { - fn decode(rlp: &Rlp) -> Result { - Ok(BatchHeader { - batch_root: rlp.val_at(0)?, - quorum_numbers: rlp.val_at(1)?, - quorum_signed_percentages: rlp.val_at(2)?, - reference_block_number: rlp.val_at(3)?, - }) - } -} - -#[derive(Debug,Serialize, Deserialize)] -struct BatchMetadata { - pub batch_header: BatchHeader, - pub signatory_record_hash: Vec, - pub fee: Vec, - pub confirmation_block_number: u32, - pub batch_header_hash: Vec -} - -impl Decodable for BatchMetadata { - fn decode(rlp: &Rlp) -> Result { - let batch_header: BatchHeader = rlp.val_at(0)?; - - Ok(BatchMetadata { - batch_header, - signatory_record_hash: rlp.val_at(1)?, - fee: rlp.val_at(2)?, - confirmation_block_number: rlp.val_at(3)?, - batch_header_hash: rlp.val_at(4)?, - }) - } -} - -#[derive(Debug,Serialize, Deserialize)] -struct BlobVerificationProof { - pub batch_id: u32, - pub blob_index: u32, - pub batch_medatada: BatchMetadata, - pub inclusion_proof: Vec, - pub quorum_indexes: Vec -} - -impl Decodable for BlobVerificationProof { - fn decode(rlp: &Rlp) -> Result { - Ok(BlobVerificationProof { - batch_id: rlp.val_at(0)?, - blob_index: rlp.val_at(1)?, - batch_medatada: rlp.val_at(2)?, - inclusion_proof: rlp.val_at(3)?, - quorum_indexes: rlp.val_at(4)?, - }) - } -} - -#[derive(Debug,Serialize, Deserialize)] -pub struct BlobInfo { - pub blob_header: BlobHeader, - pub blob_verification_proof: BlobVerificationProof -} - -impl Decodable for BlobInfo { - fn decode(rlp: &Rlp) -> Result { - let blob_header: BlobHeader = rlp.val_at(0)?; - let blob_verification_proof: BlobVerificationProof = rlp.val_at(1)?; - - Ok(BlobInfo { - blob_header, - blob_verification_proof, - }) - } -} diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs index 42bcc3526a13..0d1ff91163fa 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs @@ -1,4 +1,3 @@ -use rlp::decode; use zksync_types::{ commitment::{ pre_boojum_serialize_commitments, serialize_commitments, L1BatchCommitmentMode, @@ -14,8 +13,6 @@ use crate::{ i_executor::commit::kzg::{KzgInfo, ZK_SYNC_BYTES_PER_BLOB}, Tokenizable, }; -use bincode; -use super::blob_info::BlobInfo; /// These are used by the L1 Contracts to indicate what DA layer is used for pubdata const PUBDATA_SOURCE_CALLDATA: u8 = 0; @@ -220,27 +217,14 @@ impl Tokenizable for CommitBatchInfo<'_> { } (L1BatchCommitmentMode::Validium, PubdataDA::Custom) => { let mut operator_da_input = vec![PUBDATA_SOURCE_CUSTOM]; - - let commitment = &self - .l1_batch_with_metadata - .metadata - .da_blob_id - .clone() - .unwrap_or_default(); - - let data = &hex::decode(commitment).unwrap()[3..]; - - let blob_info: BlobInfo = match decode(&data) { - Ok(blob_info) => blob_info, - Err(e) => panic!("Error decoding commitment: {}", e) - }; - - let bytes = match bincode::serialize(&blob_info) { - Ok(bytes) => bytes, - Err(e) => panic!("Error serializing commitment: {}", e) - }; - - operator_da_input.extend(bytes); + operator_da_input.extend( + &self + .l1_batch_with_metadata + .metadata + .da_blob_id + .clone() + .unwrap_or_default() + ); operator_da_input } diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs index 90c16d37c573..d1ed57e41f2e 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs @@ -2,6 +2,5 @@ mod commit_batch_info; mod stored_batch_info; -mod blob_info; pub use self::{commit_batch_info::CommitBatchInfo, stored_batch_info::StoredBatchInfo}; From a0b21d8c2d97f4f229aec84ed36d67a97717356d Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:21:01 -0300 Subject: [PATCH 05/19] Update submodule --- Cargo.lock | 2 -- contracts | 2 +- .../src/implementations/layers/da_clients/eigen_da.rs | 3 ++- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 005769ae56db..ac134d1286c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11126,10 +11126,8 @@ dependencies = [ name = "zksync_l1_contract_interface" version = "0.1.0" dependencies = [ - "bincode", "hex", "once_cell", - "rlp", "serde", "serde_json", "serde_with", diff --git a/contracts b/contracts index 071aa0e4e9d9..c3da19643d5e 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 071aa0e4e9d98f7869c38d88792386bf639b901d +Subproject commit c3da19643d5ea823006679ede6ec925b27ad1f37 diff --git a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs index 4a91305f0ccc..8ef5e68ac119 100644 --- a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs +++ b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs @@ -1,6 +1,7 @@ use zksync_config::configs::da_client::eigen_da::EigenDAConfig; use zksync_da_client::DataAvailabilityClient; use zksync_da_clients::eigen_da::EigenDAClient; +use zksync_types::Address; use crate::{ implementations::resources::da_client::DAClientResource, @@ -11,7 +12,7 @@ use crate::{ #[derive(Debug, Default)] pub struct EigenDAWiringLayer { config: EigenDAConfig, - verifier_address: String, + verifier_address: Address, } impl EigenDAWiringLayer { From 66ee57c820609f5cd05497f94b2d811e3d95a342 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 10:42:47 -0300 Subject: [PATCH 06/19] Update submodule --- contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts b/contracts index c3da19643d5e..28989078aef3 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit c3da19643d5ea823006679ede6ec925b27ad1f37 +Subproject commit 28989078aef3ff360b13aa988687f7a06c56f54a From df7be16e268eec807ce4e82c669249d63392424b Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 11:28:31 -0300 Subject: [PATCH 07/19] Fix submodule --- contracts | 2 +- core/lib/config/src/testonly.rs | 1 + core/lib/env_config/src/contracts.rs | 2 ++ core/lib/protobuf_config/src/contracts.rs | 7 +++++++ core/lib/protobuf_config/src/proto/config/contracts.proto | 1 + core/node/da_clients/src/eigen_da.rs | 4 ++-- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/contracts b/contracts index 28989078aef3..ebb94203bcb7 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 28989078aef3ff360b13aa988687f7a06c56f54a +Subproject commit ebb94203bcb75b224d74b0522d7870545a68d1e4 diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index 4a2858b9cbfc..a4640c1e0b0b 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -258,6 +258,7 @@ impl Distribution for EncodeDist { ecosystem_contracts: self.sample(rng), base_token_addr: self.sample_opt(|| rng.gen()), chain_admin_addr: self.sample_opt(|| rng.gen()), + eigenda_verifier_addr: self.sample_opt(|| rng.gen()), } } } diff --git a/core/lib/env_config/src/contracts.rs b/core/lib/env_config/src/contracts.rs index 298c43b80ccd..2f3b64db8a38 100644 --- a/core/lib/env_config/src/contracts.rs +++ b/core/lib/env_config/src/contracts.rs @@ -72,6 +72,7 @@ mod tests { }), base_token_addr: Some(SHARED_BRIDGE_ETHER_TOKEN_ADDRESS), chain_admin_addr: Some(addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff")), + eigenda_verifier_addr: None, } } @@ -98,6 +99,7 @@ CONTRACTS_STATE_TRANSITION_PROXY_ADDR="0xd90f1c081c6117241624e97cb6147257c3cb209 CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5" CONTRACTS_BASE_TOKEN_ADDR="0x0000000000000000000000000000000000000001" CONTRACTS_CHAIN_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff" +CONTRACTS_EIGENDA_VERIFIER_ADDR="" "#; lock.set_env(config); diff --git a/core/lib/protobuf_config/src/contracts.rs b/core/lib/protobuf_config/src/contracts.rs index 84c404367503..cd904b632026 100644 --- a/core/lib/protobuf_config/src/contracts.rs +++ b/core/lib/protobuf_config/src/contracts.rs @@ -107,6 +107,12 @@ impl ProtoRepr for proto::Contracts { .map(|x| parse_h160(x)) .transpose() .context("chain_admin_addr")?, + eigenda_verifier_addr: l1 + .eigenda_verifier_addr + .as_ref() + .map(|x| parse_h160(x)) + .transpose() + .context("eigenda_verifier_addr")?, }) } @@ -139,6 +145,7 @@ impl ProtoRepr for proto::Contracts { multicall3_addr: Some(format!("{:?}", this.l1_multicall3_addr)), base_token_addr: this.base_token_addr.map(|a| format!("{:?}", a)), chain_admin_addr: this.chain_admin_addr.map(|a| format!("{:?}", a)), + eigenda_verifier_addr: this.eigenda_verifier_addr.map(|a| format!("{:?}", a)), }), l2: Some(proto::L2 { testnet_paymaster_addr: this.l2_testnet_paymaster_addr.map(|a| format!("{:?}", a)), diff --git a/core/lib/protobuf_config/src/proto/config/contracts.proto b/core/lib/protobuf_config/src/proto/config/contracts.proto index f4488c7901a1..d4f8d5611601 100644 --- a/core/lib/protobuf_config/src/proto/config/contracts.proto +++ b/core/lib/protobuf_config/src/proto/config/contracts.proto @@ -17,6 +17,7 @@ message L1 { optional string multicall3_addr = 6; // required; H160 optional string base_token_addr = 7; // required; H160 optional string chain_admin_addr = 8; // required; H160 + optional string eigenda_verifier_addr = 9 ; // optional; h160 } message L2 { diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index be655f37f3fc..ab38ca7eead9 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -79,8 +79,8 @@ impl DataAvailabilityClient for EigenDAClient { .to_vec(); self.verify_blob( - hex::encode(request_id), - ); + hex::encode(request_id.clone()), + ).await?; Ok(types::DispatchResponse { blob_id: hex::encode(request_id), }) From ebee0988fb4e2a6e22f73a75b6993af5badb032f Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:46:04 -0300 Subject: [PATCH 08/19] Deploy eigenda verifier --- contracts | 2 +- .../config/src/forge_interface/deploy_ecosystem/input.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/contracts b/contracts index ebb94203bcb7..697309409563 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit ebb94203bcb75b224d74b0522d7870545a68d1e4 +Subproject commit 6973094095635397686dd404499d47d4e301c316 diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs index 30ec0eeb9c48..1db56a210ca5 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -31,6 +31,7 @@ pub struct InitialDeploymentConfig { pub validator_timelock_execution_delay: u64, pub token_weth_address: Address, pub bridgehub_create_new_chain_salt: u64, + pub eigen_service_manager: Address, } impl Default for InitialDeploymentConfig { @@ -53,6 +54,7 @@ impl Default for InitialDeploymentConfig { // toml crate u64 support is backed by i64 implementation // https://github.com/toml-rs/toml/issues/705 bridgehub_create_new_chain_salt: rand::thread_rng().gen_range(0..=i64::MAX) as u64, + eigen_service_manager: Address::from_str("0x0000000000000000000000000000000000000000").unwrap(), } } } @@ -161,6 +163,7 @@ impl DeployL1Config { priority_tx_max_gas_limit: initial_deployment_config.priority_tx_max_gas_limit, validator_timelock_execution_delay: initial_deployment_config .validator_timelock_execution_delay, + eigen_service_manager: initial_deployment_config.eigen_service_manager, }, tokens: TokensDeployL1Config { token_weth_address: initial_deployment_config.token_weth_address, @@ -194,6 +197,7 @@ pub struct ContractsDeployL1Config { pub diamond_init_minimal_l2_gas_price: u64, pub bootloader_hash: H256, pub default_aa_hash: H256, + pub eigen_service_manager: Address, } #[derive(Debug, Deserialize, Serialize, Clone)] From 4dc9e16263a0e74bd568ad03c52c0f7eeb4532ab Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:35:36 -0300 Subject: [PATCH 09/19] Add call to verify --- contracts | 2 +- core/bin/zksync_server/src/node_builder.rs | 2 +- core/lib/contracts/src/lib.rs | 9 ++++++++- core/node/da_clients/src/eigen_da.rs | 12 ++++++++---- .../implementations/layers/da_clients/eigen_da.rs | 11 +++++++++-- zk_toolbox/crates/config/src/contracts.rs | 2 ++ .../src/forge_interface/deploy_ecosystem/output.rs | 1 + 7 files changed, 30 insertions(+), 9 deletions(-) diff --git a/contracts b/contracts index 697309409563..571527746927 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 6973094095635397686dd404499d47d4e301c316 +Subproject commit 5715277469275a78b99813fb900fce14443cacb4 diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index 9f2bc3e90dc4..a6c58aa2d846 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -519,7 +519,7 @@ impl MainNodeBuilder { .add_layer(ObjectStorageClientWiringLayer::new(config)); } DAClient::EigenDA(config) => { - self.node.add_layer(EigenDAWiringLayer::new(config, self.contracts_config.eigenda_verifier_addr)); + self.node.add_layer(EigenDAWiringLayer::new(config, self.contracts_config.eigenda_verifier_addr.unwrap())); } } diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs index a60d9fbf1813..7536b3e01f04 100644 --- a/core/lib/contracts/src/lib.rs +++ b/core/lib/contracts/src/lib.rs @@ -63,7 +63,10 @@ const LOADNEXT_CONTRACT_FILE: &str = "etc/contracts-test-data/artifacts-zk/contracts/loadnext/loadnext_contract.sol/LoadnextContract.json"; const LOADNEXT_SIMPLE_CONTRACT_FILE: &str = "etc/contracts-test-data/artifacts-zk/contracts/loadnext/loadnext_contract.sol/Foo.json"; - +const EIGENDA_VERIFIER_CONTRACT_FILE: (&str, &str) = ( + "eigenda", + "EigendaVerifier.sol/EigendaVerifier.json", +); fn home_path() -> PathBuf { Workspace::locate().core() } @@ -162,6 +165,10 @@ pub fn verifier_contract() -> Contract { load_contract_for_both_compilers(VERIFIER_CONTRACT_FILE) } +pub fn eigenda_verifier_contract() -> Contract { + load_contract_for_both_compilers(EIGENDA_VERIFIER_CONTRACT_FILE) +} + #[derive(Debug, Clone)] pub struct TestContract { /// Contract bytecode to be used for sending deploy transaction. diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index ab38ca7eead9..8b57eabbdc41 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -38,7 +38,7 @@ impl EigenDAClient { pub async fn verify_blob( &self, commitment: String, - ) -> Result { + ) -> Result { let data = &hex::decode(commitment).unwrap()[3..]; let blob_info: BlobInfo = match decode(&data) { @@ -48,11 +48,14 @@ impl EigenDAClient { CallFunctionArgs::new("verifyBlob", blob_info) .for_contract( - self.verifier_address, //todo - &zksync_contracts::hyperchain_contract(), // todo + self.verifier_address, + &zksync_contracts::eigenda_verifier_contract(), ) .call(&self.eth_client) - .await + .await.map_err(|e| DAError { + error: e.into(), + is_retriable: true, + }) } } @@ -81,6 +84,7 @@ impl DataAvailabilityClient for EigenDAClient { self.verify_blob( hex::encode(request_id.clone()), ).await?; + Ok(types::DispatchResponse { blob_id: hex::encode(request_id), }) diff --git a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs index 8ef5e68ac119..f29f4e1d312f 100644 --- a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs +++ b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs @@ -1,10 +1,11 @@ use zksync_config::configs::da_client::eigen_da::EigenDAConfig; use zksync_da_client::DataAvailabilityClient; use zksync_da_clients::eigen_da::EigenDAClient; +use zksync_node_framework_derive::FromContext; use zksync_types::Address; use crate::{ - implementations::resources::da_client::DAClientResource, + implementations::resources::{da_client::DAClientResource, eth_interface::EthInterfaceResource}, wiring_layer::{WiringError, WiringLayer}, IntoContext, }; @@ -27,9 +28,15 @@ pub struct Output { pub client: DAClientResource, } +#[derive(Debug, FromContext)] +#[context(crate = crate)] +pub struct Input { + pub eth_client: EthInterfaceResource, +} + #[async_trait::async_trait] impl WiringLayer for EigenDAWiringLayer { - type Input = (); + type Input = Input; type Output = Output; fn layer_name(&self) -> &'static str { diff --git a/zk_toolbox/crates/config/src/contracts.rs b/zk_toolbox/crates/config/src/contracts.rs index 8296aa188527..43fcf3144701 100644 --- a/zk_toolbox/crates/config/src/contracts.rs +++ b/zk_toolbox/crates/config/src/contracts.rs @@ -71,6 +71,7 @@ impl ContractsConfig { .diamond_cut_data .clone_from(&deploy_l1_output.contracts_config.diamond_cut_data); self.l1.chain_admin_addr = deploy_l1_output.deployed_addresses.chain_admin; + self.l1.eigenda_verifier_addr = deploy_l1_output.deployed_addresses.eigenda_verifier_addr; } pub fn set_chain_contracts(&mut self, register_chain_output: &RegisterChainOutput) { @@ -151,6 +152,7 @@ pub struct L1Contracts { pub verifier_addr: Address, pub validator_timelock_addr: Address, pub base_token_addr: Address, + pub eigenda_verifier_addr: Address, } #[derive(Debug, Serialize, Deserialize, Clone, Default)] diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs index 7f35cf0357c2..5e51634356c3 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/output.rs @@ -48,6 +48,7 @@ pub struct DeployL1DeployedAddressesOutput { pub bridgehub: L1BridgehubOutput, pub bridges: L1BridgesOutput, pub state_transition: L1StateTransitionOutput, + pub eigenda_verifier_addr: Address, } #[derive(Debug, Deserialize, Serialize, Clone)] From 93fa37334238b2f5f225cf9b680afe54d2445b5b Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:23:55 -0300 Subject: [PATCH 10/19] Fix tokenize params --- core/node/da_clients/src/blob_info.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/node/da_clients/src/blob_info.rs b/core/node/da_clients/src/blob_info.rs index f437b02db1b9..8460fc399fda 100644 --- a/core/node/da_clients/src/blob_info.rs +++ b/core/node/da_clients/src/blob_info.rs @@ -24,8 +24,8 @@ impl Decodable for G1Commitment { impl Tokenize for G1Commitment { fn into_tokens(self) -> Vec { - let x = self.x.into_token(); - let y = self.y.into_token(); + let x = Token::Uint(U256::from_big_endian(&self.x)); + let y = Token::Uint(U256::from_big_endian(&self.y)); vec![x, y] } @@ -87,9 +87,9 @@ impl Tokenize for BlobHeader { fn into_tokens(self) -> Vec { let commitment = self.commitment.into_tokens(); let data_length = Token::Uint(U256::from(self.data_length)); - let blob_quorum_params = self.blob_quorum_params.into_iter().map(|quorum| Token::Array(quorum.into_tokens())).collect(); + let blob_quorum_params = self.blob_quorum_params.into_iter().map(|quorum| Token::Tuple(quorum.into_tokens())).collect(); - vec![Token::Array(commitment), data_length,Token::Array(blob_quorum_params)] + vec![Token::Tuple(commitment), data_length,Token::Array(blob_quorum_params)] } } @@ -114,7 +114,7 @@ impl Decodable for BatchHeader { impl Tokenize for BatchHeader { fn into_tokens(self) -> Vec { - let batch_root = self.batch_root.into_token(); + let batch_root = Token::FixedBytes(self.batch_root); let quorum_numbers = self.quorum_numbers.into_token(); let quorum_signed_percentages = self.quorum_signed_percentages.into_token(); let reference_block_number = Token::Uint(U256::from(self.reference_block_number)); @@ -149,12 +149,10 @@ impl Decodable for BatchMetadata { impl Tokenize for BatchMetadata { fn into_tokens(self) -> Vec { let batch_header = self.batch_header.into_tokens(); - let signatory_record_hash = self.signatory_record_hash.into_token(); - let fee = self.fee.into_token(); + let signatory_record_hash = Token::FixedBytes(self.signatory_record_hash); let confirmation_block_number = Token::Uint(U256::from(self.confirmation_block_number)); - let batch_header_hash = self.batch_header_hash.into_token(); - vec![Token::Array(batch_header), signatory_record_hash,fee,confirmation_block_number,batch_header_hash] + vec![Token::Tuple(batch_header), signatory_record_hash,confirmation_block_number] } } @@ -187,7 +185,7 @@ impl Tokenize for BlobVerificationProof { let inclusion_proof = self.inclusion_proof.into_token(); let quorum_indexes = self.quorum_indexes.into_token(); - vec![batch_id, blob_index,Token::Array(batch_medatada),inclusion_proof,quorum_indexes] + vec![batch_id, blob_index,Token::Tuple(batch_medatada),inclusion_proof,quorum_indexes] } } @@ -214,7 +212,7 @@ impl Tokenize for BlobInfo { let blob_header = self.blob_header.into_tokens(); let blob_verification_proof = self.blob_verification_proof.into_tokens(); - vec![Token::Array(blob_header),Token::Array(blob_verification_proof)] + vec![Token::Tuple(vec![Token::Tuple(blob_header),Token::Tuple(blob_verification_proof)])] } } From df8b5721ab284c8036110e1c354b868d46c4bcee Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 30 Sep 2024 18:36:40 -0300 Subject: [PATCH 11/19] Update contracts --- contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts b/contracts index 571527746927..aec2b24ae693 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 5715277469275a78b99813fb900fce14443cacb4 +Subproject commit aec2b24ae693a3381653c7b718c829034d879393 From d7f92c3ef16f1585af12c0fc0b8a5d76ec658e52 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:18:36 -0300 Subject: [PATCH 12/19] Remove panic --- core/node/da_clients/src/eigen_da.rs | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index 8b57eabbdc41..05d79b730a5f 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -8,7 +8,8 @@ use zksync_da_client::{ DataAvailabilityClient, }; use zksync_eth_client::{ - clients::{DynClient, L1}, CallFunctionArgs, ContractCallError, EthInterface + clients::{DynClient, L1}, + CallFunctionArgs, ContractCallError, EthInterface, }; use zksync_types::{blob, Address, U256}; @@ -25,7 +26,11 @@ pub struct EigenDAClient { impl EigenDAClient { pub const BLOB_SIZE_LIMIT_IN_BYTES: usize = 2 * 1024 * 1024; // 2MB - pub async fn new(config: EigenDAConfig, eth_client: Box>, verifier_address: Address) -> anyhow::Result { + pub async fn new( + config: EigenDAConfig, + eth_client: Box>, + verifier_address: Address, + ) -> anyhow::Result { Ok(Self { client: reqwest::Client::new(), config, @@ -35,24 +40,22 @@ impl EigenDAClient { } } impl EigenDAClient { - pub async fn verify_blob( - &self, - commitment: String, - ) -> Result { + pub async fn verify_blob(&self, commitment: String) -> Result { let data = &hex::decode(commitment).unwrap()[3..]; - let blob_info: BlobInfo = match decode(&data) { - Ok(blob_info) => blob_info, - Err(e) => panic!("Error decoding commitment: {}", e) - }; + let blob_info: BlobInfo = decode(&data).map_err(|e| DAError { + error: e.into(), + is_retriable: true, + })?; CallFunctionArgs::new("verifyBlob", blob_info) .for_contract( - self.verifier_address, + self.verifier_address, &zksync_contracts::eigenda_verifier_contract(), ) .call(&self.eth_client) - .await.map_err(|e| DAError { + .await + .map_err(|e| DAError { error: e.into(), is_retriable: true, }) @@ -81,9 +84,7 @@ impl DataAvailabilityClient for EigenDAClient { .map_err(to_non_retriable_da_error)? .to_vec(); - self.verify_blob( - hex::encode(request_id.clone()), - ).await?; + self.verify_blob(hex::encode(request_id.clone())).await?; Ok(types::DispatchResponse { blob_id: hex::encode(request_id), From e46b31ff9b9639e809ab8a7b1b271c86554ecdb2 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:36:41 -0300 Subject: [PATCH 13/19] Update contracts --- contracts | 2 +- core/node/da_clients/src/eigen_da.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts b/contracts index aec2b24ae693..9f98e7bb8973 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit aec2b24ae693a3381653c7b718c829034d879393 +Subproject commit 9f98e7bb8973c59f280c4bf177fdafff8cbfb477 diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index 05d79b730a5f..fcdcde9192da 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -40,7 +40,7 @@ impl EigenDAClient { } } impl EigenDAClient { - pub async fn verify_blob(&self, commitment: String) -> Result { + pub async fn verify_blob(&self, commitment: String) -> Result { let data = &hex::decode(commitment).unwrap()[3..]; let blob_info: BlobInfo = decode(&data).map_err(|e| DAError { From 65d3a4ea940f9774856506721600b988c66f88f4 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:30:41 -0300 Subject: [PATCH 14/19] Format code --- core/bin/zksync_server/src/node_builder.rs | 5 +- core/lib/contracts/src/lib.rs | 8 +- core/node/da_clients/src/blob_info.rs | 86 ++++++++++++------- core/node/da_clients/src/lib.rs | 2 +- .../layers/da_clients/eigen_da.rs | 11 ++- eigenda-integration.md | 2 +- .../forge_interface/deploy_ecosystem/input.rs | 3 +- 7 files changed, 76 insertions(+), 41 deletions(-) diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index e5c95d431fa2..c38c6b2ac1d8 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -524,7 +524,10 @@ impl MainNodeBuilder { .add_layer(ObjectStorageClientWiringLayer::new(config)); } (DAClient::EigenDA(config), _) => { - self.node.add_layer(EigenDAWiringLayer::new(config, self.contracts_config.eigenda_verifier_addr.unwrap())); + self.node.add_layer(EigenDAWiringLayer::new( + config, + self.contracts_config.eigenda_verifier_addr.unwrap(), + )); } } diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs index 551179d57dff..e3544b0c439b 100644 --- a/core/lib/contracts/src/lib.rs +++ b/core/lib/contracts/src/lib.rs @@ -64,10 +64,8 @@ const LOADNEXT_CONTRACT_FILE: &str = "etc/contracts-test-data/artifacts-zk/contracts/loadnext/loadnext_contract.sol/LoadnextContract.json"; const LOADNEXT_SIMPLE_CONTRACT_FILE: &str = "etc/contracts-test-data/artifacts-zk/contracts/loadnext/loadnext_contract.sol/Foo.json"; -const EIGENDA_VERIFIER_CONTRACT_FILE: (&str, &str) = ( - "eigenda", - "EigendaVerifier.sol/EigendaVerifier.json", -); +const EIGENDA_VERIFIER_CONTRACT_FILE: (&str, &str) = + ("eigenda", "EigendaVerifier.sol/EigendaVerifier.json"); fn home_path() -> PathBuf { Workspace::locate().core() } @@ -167,7 +165,7 @@ pub fn verifier_contract() -> Contract { } pub fn eigenda_verifier_contract() -> Contract { - load_contract_for_both_compilers(EIGENDA_VERIFIER_CONTRACT_FILE) + load_contract_for_both_compilers(EIGENDA_VERIFIER_CONTRACT_FILE) } #[derive(Debug, Clone)] diff --git a/core/node/da_clients/src/blob_info.rs b/core/node/da_clients/src/blob_info.rs index 8460fc399fda..f25900836cad 100644 --- a/core/node/da_clients/src/blob_info.rs +++ b/core/node/da_clients/src/blob_info.rs @@ -1,10 +1,9 @@ -use rlp::Decodable; -use rlp::DecoderError; -use rlp::Rlp; -use zksync_types::web3::contract::Tokenizable; -use zksync_types::web3::contract::Tokenize; -use zksync_types::ethabi::Token; -use zksync_types::U256; +use rlp::{Decodable, DecoderError, Rlp}; +use zksync_types::{ + ethabi::Token, + web3::contract::{Tokenizable, Tokenize}, + U256, +}; #[derive(Debug)] pub struct G1Commitment { @@ -14,8 +13,8 @@ pub struct G1Commitment { impl Decodable for G1Commitment { fn decode(rlp: &Rlp) -> Result { - let x: Vec = rlp.val_at(0)?; // Decode first element as Vec - let y: Vec = rlp.val_at(1)?; // Decode second element as Vec + let x: Vec = rlp.val_at(0)?; // Decode first element as Vec + let y: Vec = rlp.val_at(1)?; // Decode second element as Vec Ok(G1Commitment { x, y }) } @@ -23,7 +22,6 @@ impl Decodable for G1Commitment { impl Tokenize for G1Commitment { fn into_tokens(self) -> Vec { - let x = Token::Uint(U256::from_big_endian(&self.x)); let y = Token::Uint(U256::from_big_endian(&self.y)); @@ -36,7 +34,7 @@ pub struct BlobQuorumParam { pub quorum_number: u32, pub adversary_threshold_percentage: u32, pub confirmation_threshold_percentage: u32, - pub chunk_length: u32 + pub chunk_length: u32, } impl Decodable for BlobQuorumParam { @@ -52,13 +50,19 @@ impl Decodable for BlobQuorumParam { impl Tokenize for BlobQuorumParam { fn into_tokens(self) -> Vec { - let quorum_number = Token::Uint(U256::from(self.quorum_number)); - let adversary_threshold_percentage = Token::Uint(U256::from(self.adversary_threshold_percentage)); - let confirmation_threshold_percentage = Token::Uint(U256::from(self.confirmation_threshold_percentage)); + let adversary_threshold_percentage = + Token::Uint(U256::from(self.adversary_threshold_percentage)); + let confirmation_threshold_percentage = + Token::Uint(U256::from(self.confirmation_threshold_percentage)); let chunk_length = Token::Uint(U256::from(self.chunk_length)); - vec![quorum_number, adversary_threshold_percentage,confirmation_threshold_percentage,chunk_length] + vec![ + quorum_number, + adversary_threshold_percentage, + confirmation_threshold_percentage, + chunk_length, + ] } } @@ -66,7 +70,7 @@ impl Tokenize for BlobQuorumParam { pub struct BlobHeader { pub commitment: G1Commitment, pub data_length: u32, - pub blob_quorum_params: Vec + pub blob_quorum_params: Vec, } impl Decodable for BlobHeader { @@ -87,9 +91,17 @@ impl Tokenize for BlobHeader { fn into_tokens(self) -> Vec { let commitment = self.commitment.into_tokens(); let data_length = Token::Uint(U256::from(self.data_length)); - let blob_quorum_params = self.blob_quorum_params.into_iter().map(|quorum| Token::Tuple(quorum.into_tokens())).collect(); - - vec![Token::Tuple(commitment), data_length,Token::Array(blob_quorum_params)] + let blob_quorum_params = self + .blob_quorum_params + .into_iter() + .map(|quorum| Token::Tuple(quorum.into_tokens())) + .collect(); + + vec![ + Token::Tuple(commitment), + data_length, + Token::Array(blob_quorum_params), + ] } } @@ -98,7 +110,7 @@ pub struct BatchHeader { pub batch_root: Vec, pub quorum_numbers: Vec, pub quorum_signed_percentages: Vec, - pub reference_block_number: u32 + pub reference_block_number: u32, } impl Decodable for BatchHeader { @@ -119,7 +131,12 @@ impl Tokenize for BatchHeader { let quorum_signed_percentages = self.quorum_signed_percentages.into_token(); let reference_block_number = Token::Uint(U256::from(self.reference_block_number)); - vec![batch_root, quorum_numbers,quorum_signed_percentages,reference_block_number] + vec![ + batch_root, + quorum_numbers, + quorum_signed_percentages, + reference_block_number, + ] } } @@ -129,7 +146,7 @@ pub struct BatchMetadata { pub signatory_record_hash: Vec, pub fee: Vec, pub confirmation_block_number: u32, - pub batch_header_hash: Vec + pub batch_header_hash: Vec, } impl Decodable for BatchMetadata { @@ -152,7 +169,11 @@ impl Tokenize for BatchMetadata { let signatory_record_hash = Token::FixedBytes(self.signatory_record_hash); let confirmation_block_number = Token::Uint(U256::from(self.confirmation_block_number)); - vec![Token::Tuple(batch_header), signatory_record_hash,confirmation_block_number] + vec![ + Token::Tuple(batch_header), + signatory_record_hash, + confirmation_block_number, + ] } } @@ -162,7 +183,7 @@ pub struct BlobVerificationProof { pub blob_index: u32, pub batch_medatada: BatchMetadata, pub inclusion_proof: Vec, - pub quorum_indexes: Vec + pub quorum_indexes: Vec, } impl Decodable for BlobVerificationProof { @@ -185,14 +206,20 @@ impl Tokenize for BlobVerificationProof { let inclusion_proof = self.inclusion_proof.into_token(); let quorum_indexes = self.quorum_indexes.into_token(); - vec![batch_id, blob_index,Token::Tuple(batch_medatada),inclusion_proof,quorum_indexes] + vec![ + batch_id, + blob_index, + Token::Tuple(batch_medatada), + inclusion_proof, + quorum_indexes, + ] } } #[derive(Debug)] pub struct BlobInfo { pub blob_header: BlobHeader, - pub blob_verification_proof: BlobVerificationProof + pub blob_verification_proof: BlobVerificationProof, } impl Decodable for BlobInfo { @@ -212,8 +239,9 @@ impl Tokenize for BlobInfo { let blob_header = self.blob_header.into_tokens(); let blob_verification_proof = self.blob_verification_proof.into_tokens(); - vec![Token::Tuple(vec![Token::Tuple(blob_header),Token::Tuple(blob_verification_proof)])] + vec![Token::Tuple(vec![ + Token::Tuple(blob_header), + Token::Tuple(blob_verification_proof), + ])] } } - - diff --git a/core/node/da_clients/src/lib.rs b/core/node/da_clients/src/lib.rs index 07bac46e923d..e4cf987d2578 100644 --- a/core/node/da_clients/src/lib.rs +++ b/core/node/da_clients/src/lib.rs @@ -1,5 +1,5 @@ pub mod avail; +pub mod blob_info; pub mod eigen_da; pub mod no_da; pub mod object_store; -pub mod blob_info; diff --git a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs index f29f4e1d312f..1365e06f66e6 100644 --- a/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs +++ b/core/node/node_framework/src/implementations/layers/da_clients/eigen_da.rs @@ -5,7 +5,9 @@ use zksync_node_framework_derive::FromContext; use zksync_types::Address; use crate::{ - implementations::resources::{da_client::DAClientResource, eth_interface::EthInterfaceResource}, + implementations::resources::{ + da_client::DAClientResource, eth_interface::EthInterfaceResource, + }, wiring_layer::{WiringError, WiringLayer}, IntoContext, }; @@ -18,7 +20,10 @@ pub struct EigenDAWiringLayer { impl EigenDAWiringLayer { pub fn new(config: EigenDAConfig, verifier_address: Address) -> Self { - Self { config, verifier_address } + Self { + config, + verifier_address, + } } } @@ -46,7 +51,7 @@ impl WiringLayer for EigenDAWiringLayer { async fn wire(self, input: Self::Input) -> Result { let EthInterfaceResource(query_client) = input.eth_client; let client: Box = - Box::new(EigenDAClient::new(self.config,query_client, self.verifier_address).await?); + Box::new(EigenDAClient::new(self.config, query_client, self.verifier_address).await?); Ok(Self::Output { client: DAClientResource(client), diff --git a/eigenda-integration.md b/eigenda-integration.md index 4750f6783d2f..f5606512f96b 100644 --- a/eigenda-integration.md +++ b/eigenda-integration.md @@ -18,7 +18,7 @@ da_client: eigenda-proxy: image: ghcr.io/layr-labs/eigenda-proxy ports: - - "4242:4242" + - '4242:4242' command: ./eigenda-proxy --addr 0.0.0.0 --port 4242 --memstore.enabled --eigenda-max-blob-length "2MiB" ``` diff --git a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs index 8f083fe61956..f338158b60a9 100644 --- a/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs +++ b/zk_toolbox/crates/config/src/forge_interface/deploy_ecosystem/input.rs @@ -54,7 +54,8 @@ impl Default for InitialDeploymentConfig { // toml crate u64 support is backed by i64 implementation // https://github.com/toml-rs/toml/issues/705 bridgehub_create_new_chain_salt: rand::thread_rng().gen_range(0..=i64::MAX) as u64, - eigen_service_manager: Address::from_str("0x0000000000000000000000000000000000000000").unwrap(), + eigen_service_manager: Address::from_str("0x0000000000000000000000000000000000000000") + .unwrap(), } } } From 70aab5c215510f9fd15d5f433e77a8851f3647db Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 10 Oct 2024 10:30:57 -0300 Subject: [PATCH 15/19] Update contracts --- contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts b/contracts index 9f98e7bb8973..424aca7d33a1 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 9f98e7bb8973c59f280c4bf177fdafff8cbfb477 +Subproject commit 424aca7d33a102fe99267def947956730cc7b052 From 2b7fb1a1eea5580598784ecfb3c18ad0e55749fd Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:00:17 -0300 Subject: [PATCH 16/19] Complete merge --- Cargo.lock | 284 +++++++++++++++++---- core/bin/zksync_server/src/node_builder.rs | 2 +- zk_toolbox/Cargo.lock | 15 +- zk_toolbox/crates/zk_supervisor/Cargo.toml | 2 +- 4 files changed, 240 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac134d1286c4..92b38ca7d262 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -252,12 +252,43 @@ dependencies = [ "term", ] +[[package]] +name = "assert-json-diff" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "assert_matches" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" +[[package]] +name = "async-attributes" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" +dependencies = [ + "quote 1.0.36", + "syn 1.0.109", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + [[package]] name = "async-channel" version = "2.3.1" @@ -294,6 +325,21 @@ dependencies = [ "futures-lite", ] +[[package]] +name = "async-global-executor" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" +dependencies = [ + "async-channel 2.3.1", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + [[package]] name = "async-io" version = "2.3.4" @@ -335,13 +381,22 @@ dependencies = [ "futures-lite", ] +[[package]] +name = "async-object-pool" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "333c456b97c3f2d50604e8b2624253b7f787208cb72eb75e64b0ad11b221652c" +dependencies = [ + "async-std", +] + [[package]] name = "async-process" version = "2.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-io", "async-lock", "async-signal", @@ -384,6 +439,34 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "async-std" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" +dependencies = [ + "async-attributes", + "async-channel 1.9.0", + "async-global-executor", + "async-io", + "async-lock", + "async-process", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers 0.3.0", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -635,6 +718,17 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "basic-cookies" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67bd8fd42c16bdb08688243dc5f0cc117a3ca9efeeaba3a345a18a6159ad96f7" +dependencies = [ + "lalrpop", + "lalrpop-util", + "regex", +] + [[package]] name = "basic-toml" version = "0.1.4" @@ -918,7 +1012,7 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-task", "futures-io", "futures-lite", @@ -2089,18 +2183,18 @@ dependencies = [ [[package]] name = "derive_more" -version = "1.0.0-beta.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7abbfc297053be59290e3152f8cbcd52c8642e0728b69ee187d991d4c1af08d" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "1.0.0-beta.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bba3e9872d7c58ce7ef0fcf1844fcc3e23ef2a58377b50df35dd98e42a5726e" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2 1.0.86", "quote 1.0.36", @@ -2760,6 +2854,12 @@ dependencies = [ "yansi", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "event-listener" version = "4.0.3" @@ -2827,18 +2927,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "ff_ce" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b538e4231443a5b9c507caee3356f016d832cf7393d2d90f03ea3180d4e3fbc" -dependencies = [ - "byteorder", - "hex", - "rand 0.4.6", - "serde", -] - [[package]] name = "fiat-crypto" version = "0.2.3" @@ -3150,7 +3238,7 @@ version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" dependencies = [ - "gloo-timers", + "gloo-timers 0.2.6", "send_wrapper 0.4.0", ] @@ -3295,6 +3383,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gloo-timers" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "gloo-utils" version = "0.2.0" @@ -3693,6 +3793,34 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "httpmock" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08ec9586ee0910472dec1a1f0f8acf52f0fdde93aea74d70d4a3107b4be0fd5b" +dependencies = [ + "assert-json-diff", + "async-object-pool", + "async-std", + "async-trait", + "base64 0.21.5", + "basic-cookies", + "crossbeam-utils", + "form_urlencoded", + "futures-util", + "hyper 0.14.29", + "lazy_static", + "levenshtein", + "log", + "regex", + "serde", + "serde_json", + "serde_regex", + "similar", + "tokio", + "url", +] + [[package]] name = "hyper" version = "0.14.29" @@ -4410,6 +4538,15 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lalrpop" version = "0.20.2" @@ -4422,6 +4559,7 @@ dependencies = [ "itertools 0.11.0", "lalrpop-util", "petgraph", + "pico-args", "regex", "regex-syntax 0.8.2", "string_cache", @@ -4461,6 +4599,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" +[[package]] +name = "levenshtein" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760" + [[package]] name = "libc" version = "0.2.155" @@ -4638,6 +4782,9 @@ name = "log" version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +dependencies = [ + "value-bag", +] [[package]] name = "logos" @@ -5636,6 +5783,12 @@ dependencies = [ "siphasher 0.3.11", ] +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + [[package]] name = "pin-project" version = "1.1.3" @@ -5986,7 +6139,7 @@ checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" dependencies = [ "bytes", "heck 0.4.1", - "itertools 0.10.5", + "itertools 0.11.0", "log", "multimap", "once_cell", @@ -6007,7 +6160,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.11.0", "proc-macro2 1.0.86", "quote 1.0.36", "syn 2.0.72", @@ -7343,6 +7496,16 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8136f1a4ea815d7eac4101cfd0b16dc0cb5e1fe1b8609dfd728058656b7badf" +dependencies = [ + "regex", + "serde", +] + [[package]] name = "serde_spanned" version = "0.6.8" @@ -7621,7 +7784,7 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a33bd3e260892199c3ccfc487c88b2da2265080acb316cd920da72fdfd7c599f" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-executor", "async-fs", "async-io", @@ -7693,7 +7856,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5496f2d116b7019a526b1039ec2247dd172b8670633b1a64a614c9ea12c9d8c7" dependencies = [ - "async-channel", + "async-channel 2.3.1", "async-lock", "base64 0.21.5", "blake2-rfc", @@ -9318,6 +9481,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" + [[package]] name = "vcpkg" version = "0.2.15" @@ -10307,6 +10476,7 @@ dependencies = [ "ethabi", "hex", "num_enum 0.7.2", + "secrecy", "serde", "serde_json", "serde_with", @@ -10412,9 +10582,9 @@ dependencies = [ [[package]] name = "zksync_concurrency" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1c8cf6c689ab5922b52d81b775cd2d9cffbfc8fb8da65985e11b06546dfb3bf" +checksum = "a4724d51934e475c846ba9e6ed169e25587385188b928a9ecfbbf616092a1c17" dependencies = [ "anyhow", "once_cell", @@ -10449,9 +10619,9 @@ dependencies = [ [[package]] name = "zksync_consensus_bft" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c409ae915056cf9cadd9304dbc8718fa38edfcb346d06e5b3582dcd2489ef9" +checksum = "a1e7199c07aa14d9c3319839b98ad0496aac6e72327e70ded77ddb66329766db" dependencies = [ "anyhow", "async-trait", @@ -10471,20 +10641,18 @@ dependencies = [ [[package]] name = "zksync_consensus_crypto" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7baced4e811015038322dad10239f2d631d9e339e8d6b7b6e6b146bee30f41" +checksum = "a7760e7a140f16f0435fbf2ad9a4b09feaad74568d05b553751d222f4803a42e" dependencies = [ "anyhow", "blst", "ed25519-dalek", "elliptic-curve 0.13.8", - "ff_ce", "hex", "k256 0.13.3", "num-bigint 0.4.6", "num-traits", - "rand 0.4.6", "rand 0.8.5", "sha3 0.10.8", "thiserror", @@ -10494,9 +10662,9 @@ dependencies = [ [[package]] name = "zksync_consensus_executor" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b018b8a76fc2cbecb51683ce97532501c45d44cbc8bb856d1956e5998259335" +checksum = "db07f7329b29737d8fd6860b350c809ae1b56ad53e26a7d0eddf3664ccb9dacb" dependencies = [ "anyhow", "async-trait", @@ -10516,9 +10684,9 @@ dependencies = [ [[package]] name = "zksync_consensus_network" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5bb2988e41af3083cebfc11f47f2615adae8d829bf9237aa084dede9629a687" +checksum = "a89a2d60db1ccd41438d29724a8d0d57fcf9506eb4443ea4b9205fd78c9c8e59" dependencies = [ "anyhow", "async-trait", @@ -10552,9 +10720,9 @@ dependencies = [ [[package]] name = "zksync_consensus_roles" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aab4ddf62f6001903c5fe9f65afb1bdc42464928c9d1c6ce52e4d7e9944f5dc" +checksum = "96f903187836210602beba27655e111e22efb229ef90bd2a95a3d6799b31685c" dependencies = [ "anyhow", "bit-vec", @@ -10574,9 +10742,9 @@ dependencies = [ [[package]] name = "zksync_consensus_storage" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b9dbcb923fa201af03f49f70c11a923b416915d2ddf8b2de3a2e861f22898a4" +checksum = "ff43cfd03ea205c763e74362dc6ec5a4d74b6b1baef0fb134dde92a8880397f7" dependencies = [ "anyhow", "async-trait", @@ -10594,9 +10762,9 @@ dependencies = [ [[package]] name = "zksync_consensus_utils" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e69dffc0fbc7c096548c997f5ca157a490b34b3d49fd524fa3d51840f7fb22" +checksum = "1020308512c01ab80327fb874b5b61c6fd513a6b26c8a5fce3e077600da04e4b" dependencies = [ "anyhow", "rand 0.8.5", @@ -10931,8 +11099,8 @@ dependencies = [ "async-trait", "rlp", "thiserror", - "tokio", - "zksync_types", + "zksync_basic_types", + "zksync_crypto_primitives", ] [[package]] @@ -10942,6 +11110,7 @@ dependencies = [ "anyhow", "async-recursion", "async-trait", + "test-log", "thiserror", "tokio", "tracing", @@ -10957,7 +11126,7 @@ dependencies = [ [[package]] name = "zksync_external_node" -version = "24.24.0" +version = "24.28.0" dependencies = [ "anyhow", "assert_matches", @@ -11020,6 +11189,7 @@ dependencies = [ "bigdecimal", "chrono", "fraction", + "httpmock", "rand 0.8.5", "reqwest 0.12.5", "serde", @@ -11251,7 +11421,6 @@ dependencies = [ "once_cell", "pretty_assertions", "thiserror", - "tokio", "tracing", "vise", "zk_evm 0.131.0-rc.2", @@ -11298,6 +11467,7 @@ dependencies = [ "tower-http", "tracing", "vise", + "zk_evm 0.150.5", "zksync_config", "zksync_consensus_roles", "zksync_contracts", @@ -11327,7 +11497,6 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "hex", "rand 0.8.5", "secrecy", "semver", @@ -11361,6 +11530,7 @@ dependencies = [ "zksync_test_account", "zksync_types", "zksync_utils", + "zksync_vm_executor", "zksync_vm_interface", "zksync_web3_decl", ] @@ -11630,9 +11800,9 @@ dependencies = [ [[package]] name = "zksync_protobuf" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5467dfe2f845ca1fd6ceec623bbd32187589793d3c4023dcd2f5172369d198" +checksum = "1d2d9ce9b9697daae6023c8da5cfe8764690a9d9c91ff32b8e1e54a7c8301fb3" dependencies = [ "anyhow", "bit-vec", @@ -11651,9 +11821,9 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" -version = "0.1.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d35280660b11be2a4ebdf531184eb729acebfdc3368d27176ec104f8bf9c5f" +checksum = "903c23a12e160a703f9b68d0dd961daa24156af912ca1bc9efb74969f3acc645" dependencies = [ "anyhow", "heck 0.5.0", @@ -11854,6 +12024,7 @@ dependencies = [ "hex", "itertools 0.10.5", "once_cell", + "rand 0.8.5", "tempfile", "test-casing", "thiserror", @@ -11989,7 +12160,7 @@ dependencies = [ "bincode", "blake2 0.10.6", "chrono", - "derive_more 1.0.0-beta.6", + "derive_more 1.0.0", "hex", "itertools 0.10.5", "num", @@ -12000,6 +12171,7 @@ dependencies = [ "secp256k1", "serde", "serde_json", + "serde_with", "strum", "thiserror", "tokio", @@ -12066,8 +12238,8 @@ dependencies = [ [[package]] name = "zksync_vm2" -version = "0.1.0" -source = "git+https://github.com/matter-labs/vm2.git?rev=cd6136c42ec56856e0abcf2a98d1a9e120161482#cd6136c42ec56856e0abcf2a98d1a9e120161482" +version = "0.2.1" +source = "git+https://github.com/matter-labs/vm2.git?rev=a233d44bbe61dc6a758a754c3b78fe4f83e56699#a233d44bbe61dc6a758a754c3b78fe4f83e56699" dependencies = [ "enum_dispatch", "primitive-types", @@ -12078,8 +12250,8 @@ dependencies = [ [[package]] name = "zksync_vm2_interface" -version = "0.1.0" -source = "git+https://github.com/matter-labs/vm2.git?rev=cd6136c42ec56856e0abcf2a98d1a9e120161482#cd6136c42ec56856e0abcf2a98d1a9e120161482" +version = "0.2.1" +source = "git+https://github.com/matter-labs/vm2.git?rev=a233d44bbe61dc6a758a754c3b78fe4f83e56699#a233d44bbe61dc6a758a754c3b78fe4f83e56699" dependencies = [ "primitive-types", ] @@ -12109,6 +12281,7 @@ dependencies = [ "assert_matches", "async-trait", "hex", + "pretty_assertions", "serde", "serde_json", "thiserror", @@ -12131,6 +12304,7 @@ dependencies = [ "once_cell", "rand 0.8.5", "serde", + "serde_json", "tempfile", "test-casing", "tokio", diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index c38c6b2ac1d8..3cb147ebf1b0 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -523,7 +523,7 @@ impl MainNodeBuilder { self.node .add_layer(ObjectStorageClientWiringLayer::new(config)); } - (DAClient::EigenDA(config), _) => { + (DAClientConfig::EigenDA(config), _) => { self.node.add_layer(EigenDAWiringLayer::new( config, self.contracts_config.eigenda_verifier_addr.unwrap(), diff --git a/zk_toolbox/Cargo.lock b/zk_toolbox/Cargo.lock index 297ef404698f..5dbe3089d0a9 100644 --- a/zk_toolbox/Cargo.lock +++ b/zk_toolbox/Cargo.lock @@ -5165,8 +5165,9 @@ dependencies = [ [[package]] name = "sqruff-lib" -version = "0.18.2" -source = "git+https://github.com/quarylabs/sqruff#1ccf18a620b93438c0c6b4f9fc88f402f45a1b29" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "676775189e83a98fc603d59fc6d760a66895d511502a538081dac993fde1a09a" dependencies = [ "ahash", "anstyle", @@ -5199,8 +5200,9 @@ dependencies = [ [[package]] name = "sqruff-lib-core" -version = "0.18.2" -source = "git+https://github.com/quarylabs/sqruff#1ccf18a620b93438c0c6b4f9fc88f402f45a1b29" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ec5ba65376ae9ba3e3dda153668dcb6452a7212ee7b4c9d48e053eb4f0f3fa" dependencies = [ "ahash", "enum_dispatch", @@ -5219,8 +5221,9 @@ dependencies = [ [[package]] name = "sqruff-lib-dialects" -version = "0.18.2" -source = "git+https://github.com/quarylabs/sqruff#1ccf18a620b93438c0c6b4f9fc88f402f45a1b29" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00fa1cd168dad593f8f6996d805acc1fd52c6d0ad0f6f5847a9cc22a6198cfc2" dependencies = [ "ahash", "itertools 0.13.0", diff --git a/zk_toolbox/crates/zk_supervisor/Cargo.toml b/zk_toolbox/crates/zk_supervisor/Cargo.toml index 158abe4e2ec6..d343e7af43e6 100644 --- a/zk_toolbox/crates/zk_supervisor/Cargo.toml +++ b/zk_toolbox/crates/zk_supervisor/Cargo.toml @@ -29,4 +29,4 @@ futures.workspace = true types.workspace = true serde_yaml.workspace = true zksync_basic_types.workspace = true -sqruff-lib = { git = "https://github.com/quarylabs/sqruff", version = "0.18.2" } +sqruff-lib = "0.19.0" From b35a7d82c4b7c18155944be43569b9c6881e2444 Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 10 Oct 2024 16:33:58 -0300 Subject: [PATCH 17/19] Send blob info to L1 --- Cargo.lock | 1 + contracts | 2 +- core/lib/l1_contract_interface/Cargo.toml | 1 + .../src/i_executor/structures/blob_info.rs | 340 ++++++++++++++++++ .../structures/commit_batch_info.rs | 25 +- .../src/i_executor/structures/mod.rs | 1 + core/node/da_clients/src/eigen_da.rs | 2 +- 7 files changed, 362 insertions(+), 10 deletions(-) create mode 100644 core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs diff --git a/Cargo.lock b/Cargo.lock index 92b38ca7d262..02bb3189bad4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11298,6 +11298,7 @@ version = "0.1.0" dependencies = [ "hex", "once_cell", + "rlp", "serde", "serde_json", "serde_with", diff --git a/contracts b/contracts index 424aca7d33a1..3adf2e24b930 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 424aca7d33a102fe99267def947956730cc7b052 +Subproject commit 3adf2e24b9301dd954fc30ca441cdfc875c8d674 diff --git a/core/lib/l1_contract_interface/Cargo.toml b/core/lib/l1_contract_interface/Cargo.toml index 8b68df854e71..4eab89faa5c3 100644 --- a/core/lib/l1_contract_interface/Cargo.toml +++ b/core/lib/l1_contract_interface/Cargo.toml @@ -23,6 +23,7 @@ sha2.workspace = true sha3.workspace = true hex.workspace = true once_cell.workspace = true +rlp.workspace = true [dev-dependencies] serde.workspace = true diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs new file mode 100644 index 000000000000..e30e96da904a --- /dev/null +++ b/core/lib/l1_contract_interface/src/i_executor/structures/blob_info.rs @@ -0,0 +1,340 @@ +use rlp::{Decodable, DecoderError, Rlp}; +use zksync_types::{ + blob, + ethabi::Token, + web3::contract::{Tokenizable, Tokenize}, + U256, +}; + +#[derive(Debug)] +pub struct G1Commitment { + pub x: Vec, + pub y: Vec, +} + +impl G1Commitment { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + bytes.extend(&self.x.len().to_be_bytes()); + bytes.extend(&self.x); + bytes.extend(&self.y.len().to_be_bytes()); + bytes.extend(&self.y); + + bytes + } +} + +impl Decodable for G1Commitment { + fn decode(rlp: &Rlp) -> Result { + let x: Vec = rlp.val_at(0)?; // Decode first element as Vec + let y: Vec = rlp.val_at(1)?; // Decode second element as Vec + + Ok(G1Commitment { x, y }) + } +} + +impl Tokenize for G1Commitment { + fn into_tokens(self) -> Vec { + let x = Token::Uint(U256::from_big_endian(&self.x)); + let y = Token::Uint(U256::from_big_endian(&self.y)); + + vec![x, y] + } +} + +#[derive(Debug)] +pub struct BlobQuorumParam { + pub quorum_number: u32, + pub adversary_threshold_percentage: u32, + pub confirmation_threshold_percentage: u32, + pub chunk_length: u32, +} + +impl BlobQuorumParam { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + bytes.extend(&self.quorum_number.to_be_bytes()); + bytes.extend(&self.adversary_threshold_percentage.to_be_bytes()); + bytes.extend(&self.confirmation_threshold_percentage.to_be_bytes()); + bytes.extend(&self.chunk_length.to_be_bytes()); + + bytes + } +} + +impl Decodable for BlobQuorumParam { + fn decode(rlp: &Rlp) -> Result { + Ok(BlobQuorumParam { + quorum_number: rlp.val_at(0)?, + adversary_threshold_percentage: rlp.val_at(1)?, + confirmation_threshold_percentage: rlp.val_at(2)?, + chunk_length: rlp.val_at(3)?, + }) + } +} + +impl Tokenize for BlobQuorumParam { + fn into_tokens(self) -> Vec { + let quorum_number = Token::Uint(U256::from(self.quorum_number)); + let adversary_threshold_percentage = + Token::Uint(U256::from(self.adversary_threshold_percentage)); + let confirmation_threshold_percentage = + Token::Uint(U256::from(self.confirmation_threshold_percentage)); + let chunk_length = Token::Uint(U256::from(self.chunk_length)); + + vec![ + quorum_number, + adversary_threshold_percentage, + confirmation_threshold_percentage, + chunk_length, + ] + } +} + +#[derive(Debug)] +pub struct BlobHeader { + pub commitment: G1Commitment, + pub data_length: u32, + pub blob_quorum_params: Vec, +} + +impl BlobHeader { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + bytes.extend(self.commitment.into_bytes()); + bytes.extend(&self.data_length.to_be_bytes()); + bytes.extend(&self.blob_quorum_params.len().to_be_bytes()); + + for quorum in &self.blob_quorum_params { + bytes.extend(quorum.into_bytes()); + } + + bytes + } +} + +impl Decodable for BlobHeader { + fn decode(rlp: &Rlp) -> Result { + let commitment: G1Commitment = rlp.val_at(0)?; + let data_length: u32 = rlp.val_at(1)?; + let blob_quorum_params: Vec = rlp.list_at(2)?; + + Ok(BlobHeader { + commitment, + data_length, + blob_quorum_params, + }) + } +} + +impl Tokenize for BlobHeader { + fn into_tokens(self) -> Vec { + let commitment = self.commitment.into_tokens(); + let data_length = Token::Uint(U256::from(self.data_length)); + let blob_quorum_params = self + .blob_quorum_params + .into_iter() + .map(|quorum| Token::Tuple(quorum.into_tokens())) + .collect(); + + vec![ + Token::Tuple(commitment), + data_length, + Token::Array(blob_quorum_params), + ] + } +} + +#[derive(Debug)] +pub struct BatchHeader { + pub batch_root: Vec, + pub quorum_numbers: Vec, + pub quorum_signed_percentages: Vec, + pub reference_block_number: u32, +} + +impl BatchHeader { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + bytes.extend(&self.batch_root.len().to_be_bytes()); + bytes.extend(&self.batch_root); + bytes.extend(&self.quorum_numbers.len().to_be_bytes()); + bytes.extend(&self.quorum_numbers); + bytes.extend(&self.quorum_signed_percentages.len().to_be_bytes()); + bytes.extend(&self.quorum_signed_percentages); + bytes.extend(&self.reference_block_number.to_be_bytes()); + + bytes + } +} + +impl Decodable for BatchHeader { + fn decode(rlp: &Rlp) -> Result { + Ok(BatchHeader { + batch_root: rlp.val_at(0)?, + quorum_numbers: rlp.val_at(1)?, + quorum_signed_percentages: rlp.val_at(2)?, + reference_block_number: rlp.val_at(3)?, + }) + } +} + +impl Tokenize for BatchHeader { + fn into_tokens(self) -> Vec { + let batch_root = Token::FixedBytes(self.batch_root); + let quorum_numbers = self.quorum_numbers.into_token(); + let quorum_signed_percentages = self.quorum_signed_percentages.into_token(); + let reference_block_number = Token::Uint(U256::from(self.reference_block_number)); + + vec![ + batch_root, + quorum_numbers, + quorum_signed_percentages, + reference_block_number, + ] + } +} + +#[derive(Debug)] +pub struct BatchMetadata { + pub batch_header: BatchHeader, + pub signatory_record_hash: Vec, + pub fee: Vec, + pub confirmation_block_number: u32, + pub batch_header_hash: Vec, +} + +impl BatchMetadata { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + bytes.extend(self.batch_header.into_bytes()); + bytes.extend(&self.signatory_record_hash); + bytes.extend(&self.confirmation_block_number.to_be_bytes()); + + bytes + } +} + +impl Decodable for BatchMetadata { + fn decode(rlp: &Rlp) -> Result { + let batch_header: BatchHeader = rlp.val_at(0)?; + + Ok(BatchMetadata { + batch_header, + signatory_record_hash: rlp.val_at(1)?, + fee: rlp.val_at(2)?, + confirmation_block_number: rlp.val_at(3)?, + batch_header_hash: rlp.val_at(4)?, + }) + } +} + +impl Tokenize for BatchMetadata { + fn into_tokens(self) -> Vec { + let batch_header = self.batch_header.into_tokens(); + let signatory_record_hash = Token::FixedBytes(self.signatory_record_hash); + let confirmation_block_number = Token::Uint(U256::from(self.confirmation_block_number)); + + vec![ + Token::Tuple(batch_header), + signatory_record_hash, + confirmation_block_number, + ] + } +} + +#[derive(Debug)] +pub struct BlobVerificationProof { + pub batch_id: u32, + pub blob_index: u32, + pub batch_medatada: BatchMetadata, + pub inclusion_proof: Vec, + pub quorum_indexes: Vec, +} + +impl BlobVerificationProof { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + bytes.extend(&self.batch_id.to_be_bytes()); + bytes.extend(&self.blob_index.to_be_bytes()); + bytes.extend(self.batch_medatada.into_bytes()); + bytes.extend(&self.inclusion_proof.len().to_be_bytes()); + bytes.extend(&self.inclusion_proof); + bytes.extend(&self.quorum_indexes.len().to_be_bytes()); + bytes.extend(&self.quorum_indexes); + + bytes + } +} + +impl Decodable for BlobVerificationProof { + fn decode(rlp: &Rlp) -> Result { + Ok(BlobVerificationProof { + batch_id: rlp.val_at(0)?, + blob_index: rlp.val_at(1)?, + batch_medatada: rlp.val_at(2)?, + inclusion_proof: rlp.val_at(3)?, + quorum_indexes: rlp.val_at(4)?, + }) + } +} + +impl Tokenize for BlobVerificationProof { + fn into_tokens(self) -> Vec { + let batch_id = Token::Uint(U256::from(self.batch_id)); + let blob_index = Token::Uint(U256::from(self.blob_index)); + let batch_medatada = self.batch_medatada.into_tokens(); + let inclusion_proof = self.inclusion_proof.into_token(); + let quorum_indexes = self.quorum_indexes.into_token(); + + vec![ + batch_id, + blob_index, + Token::Tuple(batch_medatada), + inclusion_proof, + quorum_indexes, + ] + } +} + +#[derive(Debug)] +pub struct BlobInfo { + pub blob_header: BlobHeader, + pub blob_verification_proof: BlobVerificationProof, +} + +impl BlobInfo { + pub fn into_bytes(&self) -> Vec { + let mut bytes = vec![]; + let blob_header_bytes = self.blob_header.into_bytes(); + bytes.extend(blob_header_bytes.len().to_be_bytes()); + bytes.extend(blob_header_bytes); + let blob_verification_proof_bytes = self.blob_verification_proof.into_bytes(); + bytes.extend(blob_verification_proof_bytes); + bytes + } +} + +impl Decodable for BlobInfo { + fn decode(rlp: &Rlp) -> Result { + let blob_header: BlobHeader = rlp.val_at(0)?; + let blob_verification_proof: BlobVerificationProof = rlp.val_at(1)?; + + Ok(BlobInfo { + blob_header, + blob_verification_proof, + }) + } +} + +impl Tokenize for BlobInfo { + fn into_tokens(self) -> Vec { + let blob_header = self.blob_header.into_tokens(); + let blob_verification_proof = self.blob_verification_proof.into_tokens(); + + vec![Token::Tuple(vec![ + Token::Tuple(blob_header), + Token::Tuple(blob_verification_proof), + ])] + } +} diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs index cf2b3a0d089f..6136f20663fa 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs @@ -1,3 +1,4 @@ +use rlp::decode; use zksync_types::{ commitment::{ pre_boojum_serialize_commitments, serialize_commitments, L1BatchCommitmentMode, @@ -9,6 +10,7 @@ use zksync_types::{ ProtocolVersionId, U256, }; +use super::blob_info::BlobInfo; use crate::{ i_executor::commit::kzg::{KzgInfo, ZK_SYNC_BYTES_PER_BLOB}, Tokenizable, @@ -217,14 +219,21 @@ impl Tokenizable for CommitBatchInfo<'_> { } (L1BatchCommitmentMode::Validium, PubdataDA::Custom) => { let mut operator_da_input = vec![PUBDATA_SOURCE_CUSTOM]; - operator_da_input.extend( - &self - .l1_batch_with_metadata - .metadata - .da_blob_id - .clone() - .unwrap_or_default(), - ); + let commitment = &self + .l1_batch_with_metadata + .metadata + .da_blob_id + .clone() + .unwrap_or_default(); + + let blob_info: BlobInfo = match decode(commitment) { + Ok(info) => info, + Err(_) => return Token::Tuple(vec![]), + }; + + /*operator_da_input.extend( + &blob_info.into_bytes(), + );*/ operator_da_input } diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs index d1ed57e41f2e..ce0f203841c9 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/mod.rs @@ -1,5 +1,6 @@ //! Structures exposed by the `IExecutor.sol`. +mod blob_info; mod commit_batch_info; mod stored_batch_info; diff --git a/core/node/da_clients/src/eigen_da.rs b/core/node/da_clients/src/eigen_da.rs index fcdcde9192da..ee58159cd2e2 100644 --- a/core/node/da_clients/src/eigen_da.rs +++ b/core/node/da_clients/src/eigen_da.rs @@ -84,7 +84,7 @@ impl DataAvailabilityClient for EigenDAClient { .map_err(to_non_retriable_da_error)? .to_vec(); - self.verify_blob(hex::encode(request_id.clone())).await?; + //self.verify_blob(hex::encode(request_id.clone())).await?; Ok(types::DispatchResponse { blob_id: hex::encode(request_id), From 672c843ace50294579af27a9b727fd6490e1413b Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:06:58 -0300 Subject: [PATCH 18/19] Add blob info --- contracts | 2 +- .../src/i_executor/structures/commit_batch_info.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts b/contracts index 3adf2e24b930..3e1b3c26cad6 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 3adf2e24b9301dd954fc30ca441cdfc875c8d674 +Subproject commit 3e1b3c26cad6e667a2058f347e6d91b1c704f866 diff --git a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs index 6136f20663fa..3a5d25bab4f4 100644 --- a/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs +++ b/core/lib/l1_contract_interface/src/i_executor/structures/commit_batch_info.rs @@ -226,14 +226,14 @@ impl Tokenizable for CommitBatchInfo<'_> { .clone() .unwrap_or_default(); - let blob_info: BlobInfo = match decode(commitment) { + let data = &hex::decode(commitment).unwrap()[3..]; + + let blob_info: BlobInfo = match decode(data) { Ok(info) => info, Err(_) => return Token::Tuple(vec![]), }; - /*operator_da_input.extend( - &blob_info.into_bytes(), - );*/ + operator_da_input.extend(&blob_info.into_bytes()); operator_da_input } From f8eac20f8e07b334746a5f2d5559cc75fdc31f7a Mon Sep 17 00:00:00 2001 From: Gianbelinche <39842759+gianbelinche@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:25:39 -0300 Subject: [PATCH 19/19] Update contracts --- contracts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts b/contracts index 3e1b3c26cad6..b3e1673b9624 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 3e1b3c26cad6e667a2058f347e6d91b1c704f866 +Subproject commit b3e1673b962453dca5ad481dbf16474bd7f78e45