diff --git a/Cargo.lock b/Cargo.lock index 5bd800853c2a..5c79a6d497db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,27 +270,29 @@ checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "ark-bn254" -version = "0.4.0" -source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" dependencies = [ "ark-ec", - "ark-ff 0.4.2", - "ark-std 0.4.0", + "ark-ff 0.5.0", + "ark-std 0.5.0", ] [[package]] name = "ark-ec" -version = "0.4.2" -source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" dependencies = [ "ahash 0.8.11", - "ark-ff 0.4.2", + "ark-ff 0.5.0", "ark-poly", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "itertools 0.13.0", "num-bigint 0.4.6", "num-integer", @@ -335,6 +337,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "arrayvec 0.7.6", + "digest 0.10.7", + "educe", + "itertools 0.13.0", + "num-bigint 0.4.6", + "num-traits", + "paste", + "zeroize", +] + [[package]] name = "ark-ff-asm" version = "0.3.0" @@ -354,6 +376,16 @@ dependencies = [ "syn 2.0.85", ] +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote 1.0.37", + "syn 2.0.85", +] + [[package]] name = "ark-ff-macros" version = "0.3.0" @@ -378,18 +410,32 @@ dependencies = [ "syn 2.0.85", ] +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "proc-macro2 1.0.89", + "quote 1.0.37", + "syn 2.0.85", +] + [[package]] name = "ark-poly" -version = "0.4.2" -source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" dependencies = [ "ahash 0.8.11", - "ark-ff 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", "educe", "fnv", - "hashbrown 0.14.5", + "hashbrown 0.15.0", ] [[package]] @@ -407,17 +453,30 @@ name = "ark-serialize" version = "0.4.2" source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" dependencies = [ - "ark-serialize-derive", "ark-std 0.4.0", "arrayvec 0.7.6", "digest 0.10.7", "num-bigint 0.4.6", ] +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive", + "ark-std 0.5.0", + "arrayvec 0.7.6", + "digest 0.10.7", + "num-bigint 0.4.6", +] + [[package]] name = "ark-serialize-derive" -version = "0.4.2" -source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2 1.0.89", "quote 1.0.37", @@ -443,6 +502,16 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + [[package]] name = "arr_macro" version = "0.1.3" @@ -1033,15 +1102,15 @@ dependencies = [ [[package]] name = "basic_bootloader" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", "crypto", "either", "evm_interpreter", "hex", - "iwasm", "iwasm_ee", + "iwasm_interpreter", "ruint", "seq-macro", "system_hooks", @@ -1051,21 +1120,25 @@ dependencies = [ [[package]] name = "basic_system" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "ark-bn254", "ark-ec", - "ark-ff 0.4.2", - "ark-serialize 0.4.2", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", "arrayvec 0.7.6", + "cfg-if", + "const_for", "crypto", "either", "evm_interpreter", "hex", - "iwasm", "iwasm_ee", + "iwasm_interpreter", "miniz_nostd_compression", "ruint", + "secp256k1 0.1.0", + "serde", "storage_models", "system_hooks", "zk_ee", @@ -1990,6 +2063,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const_for" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c50fcfdf972929aff202c16b80086aa3cfc6a3a820af714096c58c7c1d0582" + [[package]] name = "const_format" version = "0.2.33" @@ -2196,7 +2275,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "blake2 0.10.6", "k256 0.13.4", @@ -3039,7 +3118,7 @@ dependencies = [ [[package]] name = "evm_interpreter" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", "crypto", @@ -3207,17 +3286,19 @@ dependencies = [ [[package]] name = "forward_system" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", "basic_bootloader", "basic_system", + "bincode", "crypto", "either", "evm_interpreter", "hex", "ruint", "seq-macro", + "serde", "system_hooks", "zk_ee", ] @@ -4052,15 +4133,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "host_specification" -version = "0.1.0" -source = "git+https://github.com/matter-labs/iwasm.git#848d9dd5fd1bacba66e0f04a27cfd9736dc4164a" -dependencies = [ - "num-derive 0.4.2", - "num-traits", -] - [[package]] name = "hostname" version = "0.3.1" @@ -4557,24 +4629,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] -name = "iwasm" +name = "iwasm_ee" version = "0.1.0" -source = "git+https://github.com/matter-labs/iwasm.git#848d9dd5fd1bacba66e0f04a27cfd9736dc4164a" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", + "crypto", + "iwasm_interpreter", + "iwasm_specification", + "ruint", + "zk_ee", ] [[package]] -name = "iwasm_ee" +name = "iwasm_interpreter" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", - "crypto", - "host_specification", - "iwasm", - "ruint", - "zk_ee", +] + +[[package]] +name = "iwasm_specification" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" +dependencies = [ + "num-derive 0.4.2", + "num-traits", ] [[package]] @@ -5463,7 +5544,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_nostd_compression" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "adler", ] @@ -7937,6 +8018,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "secp256k1" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" +dependencies = [ + "cfg-if", + "const_for", + "crypto", +] + [[package]] name = "secp256k1" version = "0.27.0" @@ -9032,7 +9123,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "storage_models" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", "either", @@ -9424,7 +9515,7 @@ dependencies = [ [[package]] name = "system_hooks" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "crypto", "ruint", @@ -11001,7 +11092,7 @@ dependencies = [ [[package]] name = "zk_ee" version = "0.1.0" -source = "git+https://github.com/matter-labs/zk_ee?branch=rb-zk-os-integration#3417f30dc4e6249a450eed47c12df052c249ecec" +source = "git+https://github.com/matter-labs/zk_ee?branch=main#093413eb07869cc024b315f52f22952630eca78a" dependencies = [ "arrayvec 0.7.6", "bitflags 2.6.0", @@ -11009,6 +11100,7 @@ dependencies = [ "crypto", "derivative", "ruint", + "serde", ] [[package]] @@ -11665,7 +11757,7 @@ dependencies = [ "blake2 0.10.6", "hex", "rand 0.8.5", - "secp256k1", + "secp256k1 0.27.0", "serde", "serde_json", "sha2 0.10.8", @@ -11719,7 +11811,7 @@ dependencies = [ "reqwest 0.12.9", "ripemd", "scale-encode", - "secp256k1", + "secp256k1 0.27.0", "serde", "serde_json", "sha2 0.10.8", @@ -12862,7 +12954,7 @@ dependencies = [ "async-trait", "envy", "reqwest 0.12.9", - "secp256k1", + "secp256k1 0.27.0", "serde", "thiserror", "tokio", @@ -13178,3 +13270,13 @@ dependencies = [ "cc", "pkg-config", ] + +[[patch.unused]] +name = "ark-bn254" +version = "0.4.0" +source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" + +[[patch.unused]] +name = "ark-ec" +version = "0.4.2" +source = "git+https://github.com/arkworks-rs/algebra.git#b33df5cce2d54cf4c9248e4b229c7d6708fa9375" diff --git a/Cargo.toml b/Cargo.toml index db6ff347feeb..ded8aa8980e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -241,10 +241,10 @@ zk_evm_1_4_0 = { package = "zk_evm", version = "0.140" } zk_evm_1_4_1 = { package = "zk_evm", version = "0.141" } zk_evm_1_5_0 = { package = "zk_evm", version = "=0.150.17" } -zk_os_forward_system = {package = "forward_system", git="https://github.com/matter-labs/zk_ee", branch = "rb-zk-os-integration" } -zk_ee = { package = "zk_ee", git="https://github.com/matter-labs/zk_ee", branch = "rb-zk-os-integration" } -zk_os_basic_system = { package = "basic_system", git="https://github.com/matter-labs/zk_ee", branch = "rb-zk-os-integration" } -zk_os_system_hooks = { package = "system_hooks", git="https://github.com/matter-labs/zk_ee", branch = "rb-zk-os-integration" } +zk_os_forward_system = {package = "forward_system", git="https://github.com/matter-labs/zk_ee", branch = "main" } +zk_ee = { package = "zk_ee", git="https://github.com/matter-labs/zk_ee", branch = "main" } +zk_os_basic_system = { package = "basic_system", git="https://github.com/matter-labs/zk_ee", branch = "main" } +zk_os_system_hooks = { package = "system_hooks", git="https://github.com/matter-labs/zk_ee", branch = "main" } # New VM; pinned to a specific commit because of instability zksync_vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "457d8a7eea9093af9440662e33e598c13ba41633" } diff --git a/ZkStack.yaml b/ZkStack.yaml index a7757431a843..1ec61776e70e 100644 --- a/ZkStack.yaml +++ b/ZkStack.yaml @@ -1,6 +1,6 @@ name: zk l1_network: Localhost -link_to_code: /Users/romanbrodetskiy/src/zksync-2-dev/. +link_to_code: /Users/antond/Desktop/zk_os_playground/zksync-era/. bellman_cuda_dir: null chains: ./chains config: ./configs/ diff --git a/core/node/api_server/src/execution_sandbox/execute.rs b/core/node/api_server/src/execution_sandbox/execute.rs index 07f1e35bba16..5ad2011b8c62 100644 --- a/core/node/api_server/src/execution_sandbox/execute.rs +++ b/core/node/api_server/src/execution_sandbox/execute.rs @@ -153,8 +153,9 @@ impl SandboxExecutor { // todo: gas let context = BatchContext { - eip1559_basefee: U256::from(1), + eip1559_basefee: U256::from(0), ergs_price: U256::from(1), + gas_per_pubdata: Default::default(), block_number: (env.l1_batch.number.0 + 1) as u64, timestamp: SystemTime::now() .duration_since(UNIX_EPOCH) diff --git a/core/node/zkos_state_keeper/src/keeper.rs b/core/node/zkos_state_keeper/src/keeper.rs index f1f7bffc924f..1f09b23f012f 100644 --- a/core/node/zkos_state_keeper/src/keeper.rs +++ b/core/node/zkos_state_keeper/src/keeper.rs @@ -108,6 +108,7 @@ impl ZkosStateKeeper { //todo: gas eip1559_basefee: U256::from(1), ergs_price: U256::from(1), + gas_per_pubdata: Default::default(), block_number: pending_block_number.0 as u64, timestamp: (millis_since_epoch() / 1000) as u64, }; @@ -186,11 +187,12 @@ impl ZkosStateKeeper { async fn fund_dev_wallets_if_needed(connection: &mut Connection<'_, Core>, pending_block_number: &mut L2BlockNumber) { for address in &[ "0x27FBEc0B5D2A2B89f77e4D3648bBBBCF11784bdE", - "0x2eF0972bd8AFc29d63b2412508ce5e20219b9A8c" + "0x2eF0972bd8AFc29d63b2412508ce5e20219b9A8c", + "0xBC989fDe9e54cAd2aB4392Af6dF60f04873A033A" ] { let address = B160::from_str(address).unwrap(); let key = address_into_special_storage_key(&address); - let balance = bytes32_to_h256(Bytes32::from_u256_be(U256::from(170000000))); + let balance = bytes32_to_h256(Bytes32::from_u256_be(U256::from_str("1700000000000000000").unwrap()));; let flat_key = bytes32_to_h256(derive_flat_storage_key(&NOMINAL_TOKEN_BALANCE_STORAGE_ADDRESS, &key)); let r = connection diff --git a/rust-toolchain b/rust-toolchain index bc5d1d6bbd8e..1c59919435e0 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2024-08-01" +channel = "nightly-2024-11-11"