diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json index ddf856a98e26..c43a992917e1 100644 --- a/.github/release-please/manifest.json +++ b/.github/release-please/manifest.json @@ -1,5 +1,5 @@ { - "core": "25.3.0", + "core": "25.4.0", "prover": "17.1.1", "zkstack_cli": "0.1.2" } diff --git a/Cargo.lock b/Cargo.lock index c0a0a30dfc98..7ea49ce02d97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1039,7 +1039,7 @@ dependencies = [ "bitflags 2.6.0", "cexpr", "clang-sys", - "itertools 0.10.5", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -1289,9 +1289,9 @@ dependencies = [ [[package]] name = "boojum" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ec2f007ff8f90cc459f03e9f30ca1065440170f013c868823646e2e48d0234" +checksum = "4337dc7b196fc3e5e55e2857bc21638b7441429ee1a953201a9cd2be187b764e" dependencies = [ "arrayvec 0.7.6", "bincode", @@ -1690,117 +1690,26 @@ dependencies = [ [[package]] name = "circuit_encodings" -version = "0.140.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6b7cc842eadb4c250cdc6a8bc1dd97624d9f08bbe54db3e11fb23c3a72be07" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.140.0", - "zkevm_circuits 0.140.3", -] - -[[package]] -name = "circuit_encodings" -version = "0.141.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7898ffbf3cd413576b4b674fe1545a35488c67eb16bd5a4148425e42c2a2b65b" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.141.0", - "zkevm_circuits 0.141.2", -] - -[[package]] -name = "circuit_encodings" -version = "0.142.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8364ecafcc4b2c896023f8d3af952c52a500aa55f14fd268bb5d9ab07f837369" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.141.0", - "zkevm_circuits 0.141.2", -] - -[[package]] -name = "circuit_encodings" -version = "0.150.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2501cc688ef391013019495ae7035cfd54f86987e36d10f73976ce4c5d413c5a" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.150.7", - "zkevm_circuits 0.150.7", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.133.1" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb959b1f8c6bbd8be711994d182e85452a26a5d2213a709290b71c8262af1331" +checksum = "e3dcfcb4aaa17e6a81ebd2db688d980aff50aa643d9b506d4d11c84976dbc03f" dependencies = [ "derivative", - "rayon", - "serde", - "zk_evm 0.133.0", - "zksync_bellman", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.140.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa5f22311ce609d852d7d9f4943535ea4610aeb785129ae6ff83d5201c4fb387" -dependencies = [ - "circuit_encodings 0.140.3", - "derivative", - "rayon", - "serde", - "zk_evm 0.140.0", - "zksync_bellman", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.141.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c47c71d6ba83a8beb0af13af70beffd627f5497caf3d44c6f96363e788b07ea" -dependencies = [ - "circuit_encodings 0.141.2", - "derivative", - "rayon", "serde", - "zk_evm 0.141.0", - "zksync_bellman", + "zk_evm 0.150.18", + "zkevm_circuits", ] [[package]] name = "circuit_sequencer_api" -version = "0.142.2" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e264723359e6a1aad98110bdccf1ae3ad596e93e7d31da9e40f6adc07e4add54" +checksum = "d13ed70909e8390a4f2599d5a76d9ac4189e5bbbf16146d11b7999788740f291" dependencies = [ - "circuit_encodings 0.142.2", - "derivative", - "rayon", - "serde", - "zk_evm 0.141.0", - "zksync_bellman", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.150.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917d27db531fdd98a51e42ea465bc097f48cc849e7fad68d7856087d15125be1" -dependencies = [ - "circuit_encodings 0.150.7", "derivative", "rayon", "serde", + "zk_evm 0.150.18", "zksync_bellman", ] @@ -3332,9 +3241,9 @@ dependencies = [ [[package]] name = "franklin-crypto" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "971289216ea5c91872e5e0bb6989214b537bbce375d09fabea5c3ccfe031b204" +checksum = "5c128e2cf791053b3aefdd7b07d6e5ffdc7cf5dd779ca270d727a403057dfb68" dependencies = [ "arr_macro", "bit-vec", @@ -5076,7 +4985,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -6743,7 +6652,7 @@ checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.10.5", + "itertools 0.12.1", "log", "multimap", "once_cell", @@ -7318,9 +7227,9 @@ dependencies = [ [[package]] name = "rescue_poseidon" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82900c877a0ba5362ac5756efbd82c5b795dc509011c1253e2389d8708f1389d" +checksum = "b62e4ce7543582ab2df1d9544674a55897e168a23afe938a57e1547d2981a7f4" dependencies = [ "addchain", "arrayvec 0.7.6", @@ -11208,9 +11117,9 @@ dependencies = [ [[package]] name = "zk_evm" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc74fbe2b45fd19e95c59ea792c795feebdb616ebaa463f0ac567f495f47387" +checksum = "3278d0f75408ab35d25998e1124124cd108b48b2a81ed8e71e892ddc5a6be0aa" dependencies = [ "anyhow", "lazy_static", @@ -11218,7 +11127,7 @@ dependencies = [ "serde", "serde_json", "static_assertions", - "zk_evm_abstractions 0.150.7", + "zk_evm_abstractions 0.150.18", ] [[package]] @@ -11249,47 +11158,24 @@ dependencies = [ [[package]] name = "zk_evm_abstractions" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f333a3b059899df09e40deb041af881bc03e496fda5eec618ffb5e854ee7df" +checksum = "88b4e5a89cfe1594b6476be16c8c1d45f22ce12bff31c49e077b381a398edd8a" dependencies = [ "anyhow", "num_enum 0.6.1", "serde", "static_assertions", - "zkevm_opcode_defs 0.150.7", -] - -[[package]] -name = "zkevm_circuits" -version = "0.140.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c365c801e0c6eda83fbd153df45575172beb406bfb663d386f9154b4325eda" -dependencies = [ - "arrayvec 0.7.6", - "bincode", - "boojum", - "derivative", - "hex", - "itertools 0.10.5", - "rand 0.4.6", - "rand 0.8.5", - "seq-macro", - "serde", - "serde_json", - "smallvec", - "zkevm_opcode_defs 0.132.0", - "zksync_cs_derive", + "zkevm_opcode_defs 0.150.18", ] [[package]] name = "zkevm_circuits" -version = "0.141.2" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccd0352e122a4e6f0046d2163b7e692e627b23fc3264faa77331a21b65833fd" +checksum = "8b94288d2e246aecd6eecd22ef27db0d1f29a91cb4f59b9e339a45237131a9ff" dependencies = [ "arrayvec 0.7.6", - "bincode", "boojum", "derivative", "hex", @@ -11298,29 +11184,8 @@ dependencies = [ "rand 0.8.5", "seq-macro", "serde", - "serde_json", "smallvec", - "zkevm_opcode_defs 0.141.0", - "zksync_cs_derive", -] - -[[package]] -name = "zkevm_circuits" -version = "0.150.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06fb35b00699d25175a2ad447f86a9088af8b0bc698bb57086fb04c13e52eab" -dependencies = [ - "arrayvec 0.7.6", - "boojum", - "derivative", - "hex", - "itertools 0.10.5", - "rand 0.4.6", - "rand 0.8.5", - "seq-macro", - "serde", - "smallvec", - "zkevm_opcode_defs 0.150.7", + "zkevm_opcode_defs 0.150.18", "zksync_cs_derive", ] @@ -11368,9 +11233,9 @@ dependencies = [ [[package]] name = "zkevm_opcode_defs" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b83f3b279248af4ca86dec20a54127f02110b45570f3f6c1d13df49ba75c28a5" +checksum = "5bad437d4891536fdcc0054a3f04562c408817ff19d83b6c27569217692e6e74" dependencies = [ "bitflags 2.6.0", "blake2 0.10.6", @@ -11429,9 +11294,9 @@ dependencies = [ [[package]] name = "zksync_bellman" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffa03efe9bdb137a4b36b97d1a74237e18c9ae42b755163d903a9d48c1a5d80" +checksum = "6b7c0061db44757522f2d82cad02f45dc98267210ac362071234ed08e30fd4d6" dependencies = [ "arrayvec 0.7.6", "bit-vec", @@ -11493,9 +11358,7 @@ name = "zksync_commitment_generator" version = "0.1.0" dependencies = [ "anyhow", - "circuit_sequencer_api 0.140.3", - "circuit_sequencer_api 0.141.2", - "circuit_sequencer_api 0.150.7", + "circuit_encodings", "futures 0.3.31", "itertools 0.10.5", "num_cpus", @@ -11505,9 +11368,7 @@ dependencies = [ "tokio", "tracing", "vise", - "zk_evm 0.133.0", - "zk_evm 0.141.0", - "zk_evm 0.150.7", + "zk_evm 0.150.18", "zksync_contracts", "zksync_dal", "zksync_eth_client", @@ -11523,9 +11384,9 @@ dependencies = [ [[package]] name = "zksync_concurrency" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24c9a056499823227503dd9e5fb3037d93bcc3ae9b06c1ac0a47334c6283af" +checksum = "e8312ab73d3caa55775bd531795b507fa8f76bd9dabfaeb0954fe43e8fc1323b" dependencies = [ "anyhow", "once_cell", @@ -11559,9 +11420,9 @@ dependencies = [ [[package]] name = "zksync_consensus_bft" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e7ae72c257d6a4956ecb1b9d77eb082b0b31e9f47a7860d107509fb55c474d" +checksum = "fb6b0944322f30f88cd7fb22f7875435b394a135fc1b479719a18c42d9fb724d" dependencies = [ "anyhow", "async-trait", @@ -11581,9 +11442,9 @@ dependencies = [ [[package]] name = "zksync_consensus_crypto" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da303b01f24283e93f80f361bf62c3df4a761d061c8b38b4faebeebf26362fc" +checksum = "86b539960de98df3c3bd27d2d9b97de862027686bbb3bdfc5aaad5b74bb929a1" dependencies = [ "anyhow", "blst", @@ -11602,9 +11463,9 @@ dependencies = [ [[package]] name = "zksync_consensus_executor" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33cfae30ebaaa817394718fe0858dfa7c0abfa2ed800ea283c407560aac2465" +checksum = "2a75d86368579d5aa59b1baebbdc1aebca7c9234f3e3cba734db7e9bbc4880b0" dependencies = [ "anyhow", "async-trait", @@ -11624,9 +11485,9 @@ dependencies = [ [[package]] name = "zksync_consensus_network" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0129eab96f940ce24f975a27ef9408592d64da7cff51153755dedefbcf58a73" +checksum = "30f73993b7d677dfd4e4f2598dd20906e6a5f3a2168c6cab3a599c056dc5e39a" dependencies = [ "anyhow", "async-trait", @@ -11661,9 +11522,9 @@ dependencies = [ [[package]] name = "zksync_consensus_roles" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f07db2a8ec2d2cda5cb4c5ac408101e81c8fa5d95c9f3302829dafae78d11c" +checksum = "c49949546895a10431b9daec6ec4208ef0917ace006446d304b51f5b234ba462" dependencies = [ "anyhow", "bit-vec", @@ -11683,9 +11544,9 @@ dependencies = [ [[package]] name = "zksync_consensus_storage" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a42f57cc5afcee634cbd336e9e6ea891d0171352d7c0bc7d6e17f6c8faa554" +checksum = "feb0d6a54e7d8d2adeee4ba38662161e9309180ad497299092e5641db9fb1c1e" dependencies = [ "anyhow", "async-trait", @@ -11703,9 +11564,9 @@ dependencies = [ [[package]] name = "zksync_consensus_utils" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3222410c67617a86edb192e0c4bb48afc254a17052200a0a839c90e8b0378842" +checksum = "723e2a4b056cc5af192a83163c89a6951ee75c098cc5c4a4cdc435f4232d88bd" dependencies = [ "anyhow", "rand 0.8.5", @@ -11852,9 +11713,9 @@ dependencies = [ [[package]] name = "zksync_cs_derive" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5939e2df4288c263c706ff18ac718e984149223ad4289d6d957d767dcfc04c81" +checksum = "63296ce43c432d5d0111604173e874b2f2a856e1cb1c76378fa0bb5ac6018c27" dependencies = [ "proc-macro-error", "proc-macro2 1.0.92", @@ -12028,7 +11889,6 @@ dependencies = [ "assert_matches", "async-trait", "chrono", - "once_cell", "serde", "test-casing", "test-log", @@ -12091,7 +11951,7 @@ dependencies = [ [[package]] name = "zksync_external_node" -version = "25.3.0" +version = "25.4.0" dependencies = [ "anyhow", "assert_matches", @@ -12184,9 +12044,9 @@ dependencies = [ [[package]] name = "zksync_ff" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9524b06780b5e164e84b38840c7c428c739f051f35af6efc4d1285f629ceb88e" +checksum = "e6a500c97d9286f73540c26b63ae33b159bd48fec0c8bd206b4a9b4fe1217b8a" dependencies = [ "byteorder", "hex", @@ -12197,9 +12057,9 @@ dependencies = [ [[package]] name = "zksync_ff_derive" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f91e58e75d65877f09f83bc3dca8f054847ae7ec4f3e64bfa610a557edd8e8e" +checksum = "97bd48f18ebf350623093022d86be2f1ce23af332efa91890b751209aec8617a" dependencies = [ "num-bigint 0.4.6", "num-integer", @@ -12242,9 +12102,9 @@ dependencies = [ [[package]] name = "zksync_kzg" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc58af8e4e4ad1a851ffd2275e6a44ead0f15a7eaac9dc9d60a56b3b9c9b08e8" +checksum = "6384d2475e4a7e6ed4e2a703724cac1d8972d9ec40c49fdd17bf37942a81a635" dependencies = [ "boojum", "derivative", @@ -12254,7 +12114,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "zkevm_circuits 0.150.7", + "zkevm_circuits", ] [[package]] @@ -12377,11 +12237,7 @@ version = "0.1.0" dependencies = [ "anyhow", "assert_matches", - "circuit_sequencer_api 0.133.1", - "circuit_sequencer_api 0.140.3", - "circuit_sequencer_api 0.141.2", - "circuit_sequencer_api 0.142.2", - "circuit_sequencer_api 0.150.7", + "circuit_sequencer_api", "ethabi", "hex", "itertools 0.10.5", @@ -12396,7 +12252,7 @@ dependencies = [ "zk_evm 0.133.0", "zk_evm 0.140.0", "zk_evm 0.141.0", - "zk_evm 0.150.7", + "zk_evm 0.150.18", "zksync_contracts", "zksync_eth_signer", "zksync_mini_merkle_tree", @@ -12436,7 +12292,7 @@ dependencies = [ "tower-http 0.5.2", "tracing", "vise", - "zk_evm 0.150.7", + "zk_evm 0.150.18", "zksync_config", "zksync_consensus_roles", "zksync_contracts", @@ -12736,9 +12592,9 @@ dependencies = [ [[package]] name = "zksync_pairing" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8412ae5574472fa567a097e183f9a01974b99dd0b5da3bfa1bbe6c57c579aa2" +checksum = "3b91b38db3a3f0f80d8b1f2342c77751ee8d63b746268e5719abbb5dfb150a8c" dependencies = [ "byteorder", "cfg-if", @@ -12773,9 +12629,9 @@ dependencies = [ [[package]] name = "zksync_protobuf" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05755c38b134b409736008bfdfd0fdb42bfa061947be93be4c78069aa10c9b3" +checksum = "e8986ad796f8e00d8999fee72effba1a21bce40f5f877d681ac9cd89a94834d8" dependencies = [ "anyhow", "bit-vec", @@ -12794,9 +12650,9 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c3930a73ca667780be6dcd94e469d40a93fa52f4654c9ab732991b62238cb5" +checksum = "8d870b31995e3acb8e47afeb68ebeeffcf6121e70020e65b3d5d31692115d236" dependencies = [ "anyhow", "heck 0.5.0", @@ -12822,6 +12678,7 @@ dependencies = [ "serde_yaml", "tracing", "zksync_basic_types", + "zksync_concurrency", "zksync_config", "zksync_protobuf", "zksync_protobuf_build", @@ -12834,7 +12691,7 @@ version = "0.1.0" dependencies = [ "bincode", "chrono", - "circuit_sequencer_api 0.150.7", + "circuit_sequencer_api", "serde", "serde_json", "serde_with", @@ -12944,9 +12801,9 @@ dependencies = [ [[package]] name = "zksync_solidity_vk_codegen" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b310ab8a21681270e73f177ddf7974cabb7a96f0624ab8b008fd6ee1f9b4f687" +checksum = "6f03e137db1b29be36abfa1e1e682dd3864b0335c68282c8dab68c2d397b8cbd" dependencies = [ "ethereum-types", "franklin-crypto", @@ -13150,6 +13007,7 @@ dependencies = [ "once_cell", "reqwest 0.12.9", "serde_json", + "sha2 0.10.8", "tokio", "tracing", "zksync_vlog", @@ -13187,8 +13045,8 @@ source = "git+https://github.com/matter-labs/vm2.git?rev=457d8a7eea9093af9440662 dependencies = [ "enum_dispatch", "primitive-types", - "zk_evm_abstractions 0.150.7", - "zkevm_opcode_defs 0.150.7", + "zk_evm_abstractions 0.150.18", + "zkevm_opcode_defs 0.150.18", "zksync_vm2_interface", ] diff --git a/Cargo.toml b/Cargo.toml index 074d27d6574d..80e74f05c087 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -228,34 +228,31 @@ tokio-stream = "0.1.16" # We *always* pin the latest version of protocol to disallow accidental changes in the execution logic. # However, for the historical version of protocol crates, we have lax requirements. Otherwise, # Bumping a crypto dependency like `boojum` would require us to republish all the historical packages. -circuit_sequencer_api_1_3_3 = { package = "circuit_sequencer_api", version = "0.133" } -circuit_sequencer_api_1_4_0 = { package = "circuit_sequencer_api", version = "0.140" } -circuit_sequencer_api_1_4_1 = { package = "circuit_sequencer_api", version = "0.141" } -circuit_sequencer_api_1_4_2 = { package = "circuit_sequencer_api", version = "0.142" } -circuit_sequencer_api_1_5_0 = { package = "circuit_sequencer_api", version = "=0.150.7" } -crypto_codegen = { package = "zksync_solidity_vk_codegen", version = "=0.30.1" } -kzg = { package = "zksync_kzg", version = "=0.150.7" } +circuit_encodings = { package = "circuit_encodings", version = "=0.150.18" } +circuit_sequencer_api = { package = "circuit_sequencer_api", version = "=0.150.18" } +crypto_codegen = { package = "zksync_solidity_vk_codegen", version = "=0.30.11" } +kzg = { package = "zksync_kzg", version = "=0.150.18" } zk_evm = { version = "=0.133.0" } zk_evm_1_3_1 = { package = "zk_evm", version = "0.131.0-rc.2" } zk_evm_1_3_3 = { package = "zk_evm", version = "0.133" } 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.7" } +zk_evm_1_5_0 = { package = "zk_evm", version = "=0.150.18" } # New VM; pinned to a specific commit because of instability zksync_vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "457d8a7eea9093af9440662e33e598c13ba41633" } # Consensus dependencies. -zksync_concurrency = "=0.6.0" -zksync_consensus_bft = "=0.6.0" -zksync_consensus_crypto = "=0.6.0" -zksync_consensus_executor = "=0.6.0" -zksync_consensus_network = "=0.6.0" -zksync_consensus_roles = "=0.6.0" -zksync_consensus_storage = "=0.6.0" -zksync_consensus_utils = "=0.6.0" -zksync_protobuf = "=0.6.0" -zksync_protobuf_build = "=0.6.0" +zksync_concurrency = "=0.7.0" +zksync_consensus_bft = "=0.7.0" +zksync_consensus_crypto = "=0.7.0" +zksync_consensus_executor = "=0.7.0" +zksync_consensus_network = "=0.7.0" +zksync_consensus_roles = "=0.7.0" +zksync_consensus_storage = "=0.7.0" +zksync_consensus_utils = "=0.7.0" +zksync_protobuf = "=0.7.0" +zksync_protobuf_build = "=0.7.0" # "Local" dependencies zksync_multivm = { version = "0.1.0", path = "core/lib/multivm" } diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index acdd2fefb1ab..12d1169f84a3 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## [25.4.0](https://github.com/matter-labs/zksync-era/compare/core-v25.3.0...core-v25.4.0) (2024-12-19) + + +### Features + +* add support for custom genesis state ([#3259](https://github.com/matter-labs/zksync-era/issues/3259)) ([3cffdb2](https://github.com/matter-labs/zksync-era/commit/3cffdb2d5e144f2e3d8617fa22aacf6cce5998a2)) +* **consensus:** Added view_timeout to consensus config ([#3383](https://github.com/matter-labs/zksync-era/issues/3383)) ([fc02a8f](https://github.com/matter-labs/zksync-era/commit/fc02a8f1c9f0bffb438fb27769d6dced3ce14cd9)) +* Support stable compiler for VM (and some other crates) ([#3248](https://github.com/matter-labs/zksync-era/issues/3248)) ([cbee99d](https://github.com/matter-labs/zksync-era/commit/cbee99d8661b38aa6b49784c3934b8070a743fb4)) +* vm2 account validation ([#2863](https://github.com/matter-labs/zksync-era/issues/2863)) ([af149a0](https://github.com/matter-labs/zksync-era/commit/af149a01e6ce0c62d4b8a6acf9481e807ac24a8f)) + + +### Bug Fixes + +* **contract-verifier:** Fix version extraction in gh resolver ([#3378](https://github.com/matter-labs/zksync-era/issues/3378)) ([9a10dcf](https://github.com/matter-labs/zksync-era/commit/9a10dcf764e25c4e60b7ae5ddfa728c9cf576248)) + ## [25.3.0](https://github.com/matter-labs/zksync-era/compare/core-v25.2.0...core-v25.3.0) (2024-12-11) diff --git a/core/bin/block_reverter/src/main.rs b/core/bin/block_reverter/src/main.rs index 9df9bca1d8b2..eb06357c1968 100644 --- a/core/bin/block_reverter/src/main.rs +++ b/core/bin/block_reverter/src/main.rs @@ -14,42 +14,42 @@ use zksync_block_reverter::{ BlockReverter, BlockReverterEthConfig, NodeRole, }; use zksync_config::{ - configs::{GatewayChainConfig, ObservabilityConfig}, - GenesisConfig, + configs::{ + chain::NetworkConfig, wallets::Wallets, BasicWitnessInputProducerConfig, DatabaseSecrets, + GatewayChainConfig, GeneralConfig, L1Secrets, ObservabilityConfig, + ProtectiveReadsWriterConfig, + }, + ContractsConfig, DBConfig, EthConfig, GenesisConfig, PostgresConfig, }; use zksync_core_leftovers::temp_config_store::read_yaml_repr; use zksync_dal::{ConnectionPool, Core}; use zksync_env_config::{object_store::SnapshotsObjectStoreConfig, FromEnv}; use zksync_object_store::ObjectStoreFactory; +use zksync_protobuf_config::proto; use zksync_types::{Address, L1BatchNumber}; #[derive(Debug, Parser)] -#[command(author = "Matter Labs", version, about = "Block revert utility", long_about = None, subcommand_negates_reqs = true)] +#[command(author = "Matter Labs", version, about = "Block revert utility", long_about = None)] struct Cli { #[command(subcommand)] command: Command, - /// Path to yaml config. Note, that while required, - /// it is still an `Option` due to internal specifics of the `clap` crate. - #[arg(long, global = true, required = true)] + /// Path to yaml config. If set, it will be used instead of env vars + #[arg(long, global = true)] config_path: Option, - /// Path to yaml contracts config. Note, that while required, - /// it is still an `Option` due to internal specifics of the `clap` crate. - #[arg(long, global = true, required = true)] + /// Path to yaml contracts config. If set, it will be used instead of env vars + #[arg(long, global = true)] contracts_config_path: Option, - /// Path to yaml secrets config. Note, that while required, - /// it is still an `Option` due to internal specifics of the `clap` crate. - #[arg(long, global = true, required = true)] + /// Path to yaml secrets config. If set, it will be used instead of env vars + #[arg(long, global = true)] secrets_path: Option, - /// Path to yaml wallets config. Note, that while required, - /// it is still an `Option` due to internal specifics of the `clap` crate. - #[arg(long, global = true, required = true)] + /// Path to yaml wallets config. If set, it will be used instead of env vars + #[arg(long, global = true)] wallets_path: Option, - /// Path to yaml genesis config. Note, that while required, - /// it is still an `Option` due to internal specifics of the `clap` crate. - #[arg(long, global = true, required = true)] + /// Path to yaml genesis config. If set, it will be used instead of env vars + #[arg(long, global = true)] genesis_path: Option, /// Path to yaml config of the chain on top of gateway. - /// It may be `None` in case a chain is not settling on top of Gateway. + /// It should be skipped in case a chain is not settling on top of Gateway. #[arg(long, global = true)] gateway_chain_path: Option, } @@ -132,82 +132,113 @@ async fn main() -> anyhow::Result<()> { .with_opentelemetry(opentelemetry) .build(); - let general_config = read_yaml_repr::( - &opts.config_path.context("Config path missing")?, - ) - .context("failed decoding general YAML config")?; - - let wallets_config = read_yaml_repr::( - &opts.wallets_path.context("Wallets path missing")?, - ) - .context("failed decoding wallets YAML config")?; - - let genesis_config: GenesisConfig = read_yaml_repr::< - zksync_protobuf_config::proto::genesis::Genesis, - >(&opts.genesis_path.context("Genesis path missing")?) - .context("failed decoding genesis YAML config")?; - - let eth_sender = general_config - .eth - .clone() - .context("Failed to find eth config")?; - - let db_config = general_config - .db_config - .clone() - .context("Failed to find eth config")?; - let protective_reads_writer_config = general_config - .protective_reads_writer_config - .clone() - .context("Failed to find eth config")?; - let basic_witness_input_producer_config = general_config - .basic_witness_input_producer_config - .clone() - .context("Failed to find eth config")?; - let contracts = read_yaml_repr::( - &opts - .contracts_config_path - .context("Missing contracts config")?, - ) - .context("failed decoding contracts YAML config")?; - - let secrets_config = read_yaml_repr::( - &opts.secrets_path.context("Missing secrets config")?, - ) - .context("failed decoding secrets YAML config")?; - - let default_priority_fee_per_gas = eth_sender - .gas_adjuster - .context("gas_adjuster")? - .default_priority_fee_per_gas; - - let database_secrets = secrets_config - .database - .clone() - .context("Failed to find database config")?; - - let l1_secrets = secrets_config - .l1 - .clone() - .context("Failed to find l1 config")?; + let general_config: Option = if let Some(path) = opts.config_path { + Some( + read_yaml_repr::(&path) + .context("failed decoding general YAML config")?, + ) + } else { + None + }; + let wallets_config: Option = if let Some(path) = opts.wallets_path { + Some( + read_yaml_repr::(&path) + .context("failed decoding wallets YAML config")?, + ) + } else { + None + }; + let genesis_config: Option = if let Some(path) = opts.genesis_path { + Some( + read_yaml_repr::(&path) + .context("failed decoding genesis YAML config")?, + ) + } else { + None + }; - let postgres_config = general_config - .postgres_config - .clone() - .context("Failed to find postgres config")?; + let eth_sender = match &general_config { + Some(general_config) => general_config + .eth + .clone() + .context("Failed to find eth config")?, + None => EthConfig::from_env().context("EthConfig::from_env()")?, + }; + let db_config = match &general_config { + Some(general_config) => general_config + .db_config + .clone() + .context("Failed to find eth config")?, + None => DBConfig::from_env().context("DBConfig::from_env()")?, + }; + let protective_reads_writer_config = match &general_config { + Some(general_config) => general_config + .protective_reads_writer_config + .clone() + .context("Failed to find eth config")?, + None => ProtectiveReadsWriterConfig::from_env() + .context("ProtectiveReadsWriterConfig::from_env()")?, + }; + let basic_witness_input_producer_config = match &general_config { + Some(general_config) => general_config + .basic_witness_input_producer_config + .clone() + .context("Failed to find eth config")?, + None => BasicWitnessInputProducerConfig::from_env() + .context("BasicWitnessInputProducerConfig::from_env()")?, + }; + let contracts = match opts.contracts_config_path { + Some(path) => read_yaml_repr::(&path) + .context("failed decoding contracts YAML config")?, + None => ContractsConfig::from_env().context("ContractsConfig::from_env()")?, + }; + let secrets_config = if let Some(path) = opts.secrets_path { + Some( + read_yaml_repr::(&path) + .context("failed decoding secrets YAML config")?, + ) + } else { + None + }; - let zksync_network_id = genesis_config.l2_chain_id; + let gas_adjuster = eth_sender.gas_adjuster.context("gas_adjuster")?; + let default_priority_fee_per_gas = gas_adjuster.default_priority_fee_per_gas; + let settlement_mode = gas_adjuster.settlement_mode; - let settlement_mode = general_config - .eth - .context("Missing `eth` config")? - .gas_adjuster - .context("Missing `gas_adjuster` config")? - .settlement_mode; + let database_secrets = match &secrets_config { + Some(secrets_config) => secrets_config + .database + .clone() + .context("Failed to find database config")?, + None => DatabaseSecrets::from_env().context("DatabaseSecrets::from_env()")?, + }; + let l1_secrets = match &secrets_config { + Some(secrets_config) => secrets_config + .l1 + .clone() + .context("Failed to find l1 config")?, + None => L1Secrets::from_env().context("L1Secrets::from_env()")?, + }; + let postgres_config = match &general_config { + Some(general_config) => general_config + .postgres_config + .clone() + .context("Failed to find postgres config")?, + None => PostgresConfig::from_env().context("PostgresConfig::from_env()")?, + }; + let zksync_network_id = match &genesis_config { + Some(genesis_config) => genesis_config.l2_chain_id, + None => { + NetworkConfig::from_env() + .context("NetworkConfig::from_env()")? + .zksync_network_id + } + }; let (sl_rpc_url, sl_diamond_proxy, sl_validator_timelock) = if settlement_mode.is_gateway() { + // Gateway config is required to be provided by file for now. let gateway_chain_config: GatewayChainConfig = - read_yaml_repr::( + read_yaml_repr::( &opts .gateway_chain_path .context("Genesis config path not provided")?, @@ -272,12 +303,22 @@ async fn main() -> anyhow::Result<()> { nonce, } => { let sl_client = Client::http(sl_rpc_url).context("Ethereum client")?.build(); - let reverter_private_key = wallets_config - .eth_sender - .unwrap() - .operator - .private_key() - .to_owned(); + let reverter_private_key = if let Some(wallets_config) = wallets_config { + wallets_config + .eth_sender + .unwrap() + .operator + .private_key() + .to_owned() + } else { + #[allow(deprecated)] + eth_sender + .sender + .context("eth_sender_config")? + .private_key() + .context("eth_sender_config.private_key")? + .context("eth_sender_config.private_key is not set")? + }; let priority_fee_per_gas = priority_fee_per_gas.unwrap_or(default_priority_fee_per_gas); let l1_chain_id = sl_client diff --git a/core/bin/external_node/Cargo.toml b/core/bin/external_node/Cargo.toml index f56af827bc45..799108f30723 100644 --- a/core/bin/external_node/Cargo.toml +++ b/core/bin/external_node/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zksync_external_node" description = "Non-validator ZKsync node" -version = "25.3.0" # x-release-please-version +version = "25.4.0" # x-release-please-version edition.workspace = true authors.workspace = true homepage.workspace = true diff --git a/core/bin/zksync_server/src/main.rs b/core/bin/zksync_server/src/main.rs index 52c4602040da..de284a0a052c 100644 --- a/core/bin/zksync_server/src/main.rs +++ b/core/bin/zksync_server/src/main.rs @@ -10,7 +10,6 @@ use zksync_config::{ StateKeeperConfig, TimestampAsserterConfig, }, fri_prover_group::FriProverGroupConfig, - gateway::GatewayChainConfig, house_keeper::HouseKeeperConfig, BasicWitnessInputProducerConfig, ContractsConfig, DataAvailabilitySecrets, DatabaseSecrets, ExperimentalVmConfig, ExternalPriceApiClientConfig, FriProofCompressorConfig, @@ -26,7 +25,7 @@ use zksync_core_leftovers::{ temp_config_store::{read_yaml_repr, TempConfigStore}, Component, Components, }; -use zksync_env_config::{FromEnv, FromEnvVariant}; +use zksync_env_config::FromEnv; use crate::node_builder::MainNodeBuilder; @@ -57,7 +56,8 @@ struct Cli { /// Path to the yaml with contracts. If set, it will be used instead of env vars. #[arg(long)] contracts_config_path: Option, - /// Path to the yaml with contracts. If set, it will be used instead of env vars. + /// Path to the yaml with gateway contracts. Note, that at this moment, + /// env-based config is not supported for gateway-related functionality. #[arg(long)] gateway_contracts_config_path: Option, /// Path to the wallets config. If set, it will be used instead of env vars. @@ -130,31 +130,18 @@ fn main() -> anyhow::Result<()> { .context("failed decoding contracts YAML config")?, }; - let gateway_contracts_config: Option = match opt - .gateway_contracts_config_path + // We support only file based config for gateway + let gateway_contracts_config = if let Some(gateway_config_path) = + opt.gateway_contracts_config_path { - None => { - let gateway_chain_id = std::env::var("GATEWAY_CONTRACTS_GATEWAY_CHAIN_ID") - .ok() - .and_then(|x| x.parse::().ok()); - let contracts = ContractsConfig::from_env_variant("GATEWAY_".to_string()).ok(); - match (gateway_chain_id, contracts) { - (Some(gateway_chain_id), Some(contracts)) => { - Some(GatewayChainConfig::from_contracts_and_chain_id( - contracts, - gateway_chain_id.into(), - )) - } - _ => None, - } - } - Some(path) => { - let result = - read_yaml_repr::(&path) - .context("failed decoding contracts YAML config")?; - - Some(result) - } + let result = read_yaml_repr::( + &gateway_config_path, + ) + .context("failed decoding contracts YAML config")?; + + Some(result) + } else { + None }; let genesis = match opt.genesis_path { diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index 940e368b3c3b..96205eb9fbfc 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -93,7 +93,7 @@ pub struct MainNodeBuilder { wallets: Wallets, genesis_config: GenesisConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, secrets: Secrets, } @@ -103,7 +103,7 @@ impl MainNodeBuilder { wallets: Wallets, genesis_config: GenesisConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, secrets: Secrets, ) -> anyhow::Result { Ok(Self { @@ -112,7 +112,7 @@ impl MainNodeBuilder { wallets, genesis_config, contracts_config, - gateway_contracts_config, + gateway_chain_config, secrets, }) } @@ -173,7 +173,7 @@ impl MainNodeBuilder { self.node.add_layer(PKSigningEthClientLayer::new( eth_config, self.contracts_config.clone(), - self.gateway_contracts_config.clone(), + self.gateway_chain_config.clone(), wallets, )); Ok(self) @@ -185,7 +185,7 @@ impl MainNodeBuilder { let query_eth_client_layer = QueryEthClientLayer::new( genesis.l1_chain_id, eth_config.l1_rpc_url, - self.gateway_contracts_config + self.gateway_chain_config .as_ref() .map(|c| c.gateway_chain_id), eth_config.gateway_rpc_url, @@ -306,7 +306,7 @@ impl MainNodeBuilder { self.node.add_layer(EthWatchLayer::new( try_load_config!(eth_config.watcher), self.contracts_config.clone(), - self.gateway_contracts_config.clone(), + self.gateway_chain_config.clone(), self.configs .eth .as_ref() @@ -489,7 +489,7 @@ impl MainNodeBuilder { self.node.add_layer(EthTxAggregatorLayer::new( eth_sender_config, self.contracts_config.clone(), - self.gateway_contracts_config.clone(), + self.gateway_chain_config.clone(), self.genesis_config.l2_chain_id, self.genesis_config.l1_batch_commit_data_generator_mode, self.configs diff --git a/core/lib/basic_types/src/bytecode.rs b/core/lib/basic_types/src/bytecode.rs index 585ba0ef8c88..cb6b54fcf3ce 100644 --- a/core/lib/basic_types/src/bytecode.rs +++ b/core/lib/basic_types/src/bytecode.rs @@ -10,6 +10,8 @@ //! Both bytecode kinds are right-padded to consist of an integer, odd number of 32-byte words. All methods //! in this module operate on padded bytecodes unless explicitly specified otherwise. +use std::iter; + use anyhow::Context as _; use sha2::{Digest, Sha256}; @@ -68,21 +70,31 @@ pub struct BytecodeHash(H256); impl BytecodeHash { /// Hashes the provided EraVM bytecode. pub fn for_bytecode(bytecode: &[u8]) -> Self { - Self::for_generic_bytecode(BytecodeMarker::EraVm, bytecode) + Self::for_generic_bytecode(BytecodeMarker::EraVm, bytecode, bytecode.len()) } /// Hashes the provided padded EVM bytecode. - pub fn for_evm_bytecode(bytecode: &[u8]) -> Self { - Self::for_generic_bytecode(BytecodeMarker::Evm, bytecode) + pub fn for_evm_bytecode(raw_bytecode_len: usize, bytecode: &[u8]) -> Self { + Self::for_generic_bytecode(BytecodeMarker::Evm, bytecode, raw_bytecode_len) + } + + /// Hashes the provided raw EVM bytecode. + pub fn for_raw_evm_bytecode(bytecode: &[u8]) -> Self { + let padded_evm_bytecode = pad_evm_bytecode(bytecode); + Self::for_evm_bytecode(bytecode.len(), &padded_evm_bytecode) } - fn for_generic_bytecode(kind: BytecodeMarker, bytecode: &[u8]) -> Self { + fn for_generic_bytecode( + kind: BytecodeMarker, + bytecode: &[u8], + bytecode_len_in_bytes: usize, + ) -> Self { validate_bytecode(bytecode).expect("invalid bytecode"); let mut hasher = Sha256::new(); let len = match kind { - BytecodeMarker::EraVm => (bytecode.len() / 32) as u16, - BytecodeMarker::Evm => bytecode.len() as u16, + BytecodeMarker::EraVm => (bytecode_len_in_bytes / 32) as u16, + BytecodeMarker::Evm => bytecode_len_in_bytes as u16, }; hasher.update(bytecode); let result = hasher.finalize(); @@ -157,23 +169,22 @@ impl BytecodeMarker { } /// Removes padding from an EVM bytecode, returning the original EVM bytecode. -pub fn trim_padded_evm_bytecode(raw: &[u8]) -> anyhow::Result<&[u8]> { +pub fn trim_padded_evm_bytecode(bytecode_hash: BytecodeHash, raw: &[u8]) -> anyhow::Result<&[u8]> { + if bytecode_hash.marker() != BytecodeMarker::Evm { + anyhow::bail!("only EVM bytecode hashes allowed") + } validate_bytecode(raw).context("bytecode fails basic validity checks")?; - // EVM bytecodes are prefixed with a big-endian `U256` bytecode length. - let bytecode_len_bytes = raw.get(..32).context("length < 32")?; - let bytecode_len = U256::from_big_endian(bytecode_len_bytes); - let bytecode_len: usize = bytecode_len - .try_into() - .map_err(|_| anyhow::anyhow!("length ({bytecode_len}) overflow"))?; - let bytecode = raw.get(32..(32 + bytecode_len)).with_context(|| { + // Actual raw unpadded EVM bytecode length is encoded in bytecode hash + let bytecode_len: usize = bytecode_hash.len_in_bytes(); + let bytecode = raw.get(0..bytecode_len).with_context(|| { format!( - "prefixed length ({bytecode_len}) exceeds real length ({})", - raw.len() - 32 + "encoded length ({bytecode_len}) exceeds real length ({})", + raw.len() ) })?; // Since slicing above succeeded, this one is safe. - let padding = &raw[(32 + bytecode_len)..]; + let padding = &raw[bytecode_len..]; anyhow::ensure!( padding.iter().all(|&b| b == 0), "bytecode padding contains non-zero bytes" @@ -181,22 +192,42 @@ pub fn trim_padded_evm_bytecode(raw: &[u8]) -> anyhow::Result<&[u8]> { Ok(bytecode) } +/// Pads an EVM bytecode in the same ways it's done by system contracts. +pub fn pad_evm_bytecode(deployed_bytecode: &[u8]) -> Vec { + let mut padded = Vec::with_capacity(deployed_bytecode.len()); + padded.extend_from_slice(deployed_bytecode); + + // Pad to the 32-byte word boundary. + if padded.len() % 32 != 0 { + padded.extend(iter::repeat(0).take(32 - padded.len() % 32)); + } + assert_eq!(padded.len() % 32, 0); + + // Pad to contain the odd number of words. + if (padded.len() / 32) % 2 != 1 { + padded.extend_from_slice(&[0; 32]); + } + assert_eq!((padded.len() / 32) % 2, 1); + padded +} + #[doc(hidden)] // only useful for tests pub mod testonly { use const_decoder::Decoder; - pub const RAW_EVM_BYTECODE: &[u8] = &const_decoder::decode!( + pub const PADDED_EVM_BYTECODE: &[u8] = &const_decoder::decode!( Decoder::Hex, - b"00000000000000000000000000000000000000000000000000000000000001266080604052348015\ - 600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063fb5343f314604c57\ - 5b5f80fd5b604a60048036038101906046919060a6565b6066565b005b6052606f565b604051605d\ - 919060d9565b60405180910390f35b805f8190555050565b5f5481565b5f80fd5b5f819050919050\ - 565b6088816078565b81146091575f80fd5b50565b5f8135905060a0816081565b92915050565b5f\ - 6020828403121560b85760b76074565b5b5f60c3848285016094565b91505092915050565b60d381\ - 6078565b82525050565b5f60208201905060ea5f83018460cc565b9291505056fea2646970667358\ - 221220caca1247066da378f2ec77c310f2ae51576272367b4fa11cc4350af4e9ce4d0964736f6c63\ - 4300081a00330000000000000000000000000000000000000000000000000000" + b"6080604052348015600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063\ + fb5343f314604c575b5f80fd5b604a60048036038101906046919060a6565b6066565b005b605260\ + 6f565b604051605d919060d9565b60405180910390f35b805f8190555050565b5f5481565b5f80fd\ + 5b5f819050919050565b6088816078565b81146091575f80fd5b50565b5f8135905060a081608156\ + 5b92915050565b5f6020828403121560b85760b76074565b5b5f60c3848285016094565b91505092\ + 915050565b60d3816078565b82525050565b5f60208201905060ea5f83018460cc565b9291505056\ + fea2646970667358221220caca1247066da378f2ec77c310f2ae51576272367b4fa11cc4350af4e9\ + ce4d0964736f6c634300081a00330000000000000000000000000000000000000000000000000000\ + 0000000000000000000000000000000000000000000000000000000000000000" ); + pub const PROCESSED_EVM_BYTECODE: &[u8] = &const_decoder::decode!( Decoder::Hex, b"6080604052348015600e575f80fd5b50600436106030575f3560e01c8063816898ff146034578063\ @@ -213,7 +244,7 @@ pub mod testonly { #[cfg(test)] mod tests { use super::{ - testonly::{PROCESSED_EVM_BYTECODE, RAW_EVM_BYTECODE}, + testonly::{PADDED_EVM_BYTECODE, PROCESSED_EVM_BYTECODE}, *, }; @@ -223,14 +254,20 @@ mod tests { assert_eq!(bytecode_hash.marker(), BytecodeMarker::EraVm); assert_eq!(bytecode_hash.len_in_bytes(), 32); - let bytecode_hash = BytecodeHash::for_evm_bytecode(&[0; 32]); + let bytecode_hash = BytecodeHash::for_raw_evm_bytecode(&[0; 32]); + assert_eq!(bytecode_hash.marker(), BytecodeMarker::Evm); + assert_eq!(bytecode_hash.len_in_bytes(), 32); + + let bytecode_hash = BytecodeHash::for_evm_bytecode(32, &[0; 96]); assert_eq!(bytecode_hash.marker(), BytecodeMarker::Evm); assert_eq!(bytecode_hash.len_in_bytes(), 32); } #[test] fn preparing_evm_bytecode() { - let prepared = trim_padded_evm_bytecode(RAW_EVM_BYTECODE).unwrap(); + let bytecode_hash = + BytecodeHash::for_evm_bytecode(PROCESSED_EVM_BYTECODE.len(), &PADDED_EVM_BYTECODE); + let prepared = trim_padded_evm_bytecode(bytecode_hash, PADDED_EVM_BYTECODE).unwrap(); assert_eq!(prepared, PROCESSED_EVM_BYTECODE); } } diff --git a/core/lib/config/src/configs/consensus.rs b/core/lib/config/src/configs/consensus.rs index 7f5a0f56aa17..17359f188a70 100644 --- a/core/lib/config/src/configs/consensus.rs +++ b/core/lib/config/src/configs/consensus.rs @@ -126,6 +126,9 @@ pub struct ConsensusConfig { /// Maximal allowed size of the payload in bytes. pub max_payload_size: usize, + /// View timeout duration in milliseconds. + pub view_timeout: Option, + /// Maximal allowed size of the sync-batch payloads in bytes. /// /// The batch consists of block payloads and a Merkle proof of inclusion on L1 (~1kB), @@ -155,6 +158,10 @@ pub struct ConsensusConfig { } impl ConsensusConfig { + pub fn view_timeout(&self) -> time::Duration { + self.view_timeout.unwrap_or(time::Duration::seconds(2)) + } + pub fn rpc(&self) -> RpcConfig { self.rpc.clone().unwrap_or_default() } diff --git a/core/lib/config/src/configs/contracts.rs b/core/lib/config/src/configs/contracts.rs index da84945583e7..f6bd02f2dfae 100644 --- a/core/lib/config/src/configs/contracts.rs +++ b/core/lib/config/src/configs/contracts.rs @@ -48,9 +48,9 @@ pub struct ContractsConfig { pub ecosystem_contracts: Option, // Used by the RPC API and by the node builder in wiring the BaseTokenRatioProvider layer. pub base_token_addr: Option
, - pub base_token_asset_id: Option, + pub l1_base_token_asset_id: Option, - pub predeployed_l2_wrapped_base_token_address: Option
, + pub l2_predeployed_wrapped_base_token_address: Option
, pub chain_admin_addr: Option
, pub l2_da_validator_addr: Option
, @@ -75,8 +75,8 @@ impl ContractsConfig { l2_timestamp_asserter_addr: Some(Address::repeat_byte(0x19)), governance_addr: Address::repeat_byte(0x13), base_token_addr: Some(Address::repeat_byte(0x14)), - base_token_asset_id: Some(H256::repeat_byte(0x15)), - predeployed_l2_wrapped_base_token_address: Some(Address::repeat_byte(0x1b)), + l1_base_token_asset_id: Some(H256::repeat_byte(0x15)), + l2_predeployed_wrapped_base_token_address: Some(Address::repeat_byte(0x1b)), ecosystem_contracts: Some(EcosystemContracts::for_tests()), chain_admin_addr: Some(Address::repeat_byte(0x18)), l2_da_validator_addr: Some(Address::repeat_byte(0x1a)), diff --git a/core/lib/config/src/configs/eth_sender.rs b/core/lib/config/src/configs/eth_sender.rs index 223dd1281838..91e7fb20509e 100644 --- a/core/lib/config/src/configs/eth_sender.rs +++ b/core/lib/config/src/configs/eth_sender.rs @@ -41,7 +41,6 @@ impl EthConfig { pubdata_sending_mode: PubdataSendingMode::Calldata, tx_aggregation_paused: false, tx_aggregation_only_prove_and_execute: false, - priority_tree_start_index: Some(0), time_in_mempool_in_l1_blocks_cap: 1800, }), gas_adjuster: Some(GasAdjusterConfig { @@ -118,8 +117,6 @@ pub struct SenderConfig { /// special mode specifically for gateway migration to decrease number of non-executed batches #[serde(default = "SenderConfig::default_tx_aggregation_only_prove_and_execute")] pub tx_aggregation_only_prove_and_execute: bool, - /// Index of the priority operation to start building the `PriorityMerkleTree` from. - pub priority_tree_start_index: Option, /// Cap of time in mempool for price calculations #[serde(default = "SenderConfig::default_time_in_mempool_in_l1_blocks_cap")] pub time_in_mempool_in_l1_blocks_cap: u32, diff --git a/core/lib/config/src/configs/gateway.rs b/core/lib/config/src/configs/gateway.rs index 6501c5efadb2..3afa69de7cd8 100644 --- a/core/lib/config/src/configs/gateway.rs +++ b/core/lib/config/src/configs/gateway.rs @@ -28,7 +28,7 @@ pub struct GatewayChainConfig { pub validator_timelock_addr: Address, pub multicall3_addr: Address, pub diamond_proxy_addr: Address, - // TODO: there is no "governace" for a chain, only an admin, we + // TODO(EVM-921): there is no "governace" for a chain, only an admin, we // need to figure out what we mean here pub chain_admin_addr: Option
, pub governance_addr: Address, diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index 3c2535aeae8f..333e792b87f0 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -267,8 +267,8 @@ impl Distribution for EncodeDist { l1_multicall3_addr: rng.gen(), ecosystem_contracts: self.sample(rng), base_token_addr: self.sample_opt(|| rng.gen()), - base_token_asset_id: self.sample_opt(|| rng.gen()), - predeployed_l2_wrapped_base_token_address: self.sample_opt(|| rng.gen()), + l1_base_token_asset_id: self.sample_opt(|| rng.gen()), + l2_predeployed_wrapped_base_token_address: self.sample_opt(|| rng.gen()), chain_admin_addr: self.sample_opt(|| rng.gen()), l2_da_validator_addr: self.sample_opt(|| rng.gen()), } @@ -419,7 +419,6 @@ impl Distribution for EncodeDist { pubdata_sending_mode: PubdataSendingMode::Calldata, tx_aggregation_paused: false, tx_aggregation_only_prove_and_execute: false, - priority_tree_start_index: self.sample(rng), time_in_mempool_in_l1_blocks_cap: self.sample(rng), } } @@ -812,6 +811,7 @@ impl Distribution for EncodeDist { server_addr: self.sample(rng), public_addr: Host(self.sample(rng)), max_payload_size: self.sample(rng), + view_timeout: self.sample(rng), max_batch_size: self.sample(rng), gossip_dynamic_inbound_limit: self.sample(rng), gossip_static_inbound: self diff --git a/core/lib/contract_verifier/src/lib.rs b/core/lib/contract_verifier/src/lib.rs index 284d9921a674..43da4127b809 100644 --- a/core/lib/contract_verifier/src/lib.rs +++ b/core/lib/contract_verifier/src/lib.rs @@ -14,7 +14,7 @@ use tokio::time; use zksync_dal::{contract_verification_dal::DeployedContractData, ConnectionPool, Core, CoreDal}; use zksync_queued_job_processor::{async_trait, JobProcessor}; use zksync_types::{ - bytecode::{trim_padded_evm_bytecode, BytecodeMarker}, + bytecode::{trim_padded_evm_bytecode, BytecodeHash, BytecodeMarker}, contract_verification_api::{ self as api, CompilationArtifacts, VerificationIncomingRequest, VerificationInfo, VerificationRequest, @@ -257,8 +257,12 @@ impl ContractVerifier { let deployed_bytecode = match bytecode_marker { BytecodeMarker::EraVm => deployed_contract.bytecode.as_slice(), - BytecodeMarker::Evm => trim_padded_evm_bytecode(&deployed_contract.bytecode) - .context("invalid stored EVM bytecode")?, + BytecodeMarker::Evm => trim_padded_evm_bytecode( + BytecodeHash::try_from(deployed_contract.bytecode_hash) + .context("Invalid bytecode hash")?, + &deployed_contract.bytecode, + ) + .context("invalid stored EVM bytecode")?, }; if artifacts.deployed_bytecode() != deployed_bytecode { diff --git a/core/lib/contract_verifier/src/tests/mod.rs b/core/lib/contract_verifier/src/tests/mod.rs index f66732675ce6..2ffb51ceb30a 100644 --- a/core/lib/contract_verifier/src/tests/mod.rs +++ b/core/lib/contract_verifier/src/tests/mod.rs @@ -1,9 +1,6 @@ //! Tests for the contract verifier. -use std::{ - collections::{HashMap, HashSet}, - iter, -}; +use std::collections::{HashMap, HashSet}; use test_casing::{test_casing, Product}; use tokio::sync::watch; @@ -11,7 +8,7 @@ use zksync_dal::Connection; use zksync_node_test_utils::{create_l1_batch, create_l2_block}; use zksync_types::{ address_to_h256, - bytecode::BytecodeHash, + bytecode::{pad_evm_bytecode, BytecodeHash}, contract_verification_api::{CompilerVersions, SourceCodeData, VerificationIncomingRequest}, get_code_key, get_known_code_key, l2::L2Tx, @@ -114,28 +111,6 @@ impl TestContract { } } -/// Pads an EVM bytecode in the same ways it's done by system contracts. -fn pad_evm_bytecode(deployed_bytecode: &[u8]) -> Vec { - let mut padded = Vec::with_capacity(deployed_bytecode.len() + 32); - let len = U256::from(deployed_bytecode.len()); - padded.extend_from_slice(&[0; 32]); - len.to_big_endian(&mut padded); - padded.extend_from_slice(deployed_bytecode); - - // Pad to the 32-byte word boundary. - if padded.len() % 32 != 0 { - padded.extend(iter::repeat(0).take(32 - padded.len() % 32)); - } - assert_eq!(padded.len() % 32, 0); - - // Pad to contain the odd number of words. - if (padded.len() / 32) % 2 != 1 { - padded.extend_from_slice(&[0; 32]); - } - assert_eq!((padded.len() / 32) % 2, 1); - padded -} - async fn mock_deployment( storage: &mut Connection<'_, Core>, address: Address, @@ -163,7 +138,7 @@ async fn mock_evm_deployment( factory_deps: vec![], }; let bytecode = pad_evm_bytecode(deployed_bytecode); - let bytecode_hash = BytecodeHash::for_evm_bytecode(&bytecode).value(); + let bytecode_hash = BytecodeHash::for_evm_bytecode(deployed_bytecode.len(), &bytecode).value(); mock_deployment_inner(storage, address, bytecode_hash, bytecode, deployment).await; } diff --git a/core/lib/contracts/src/lib.rs b/core/lib/contracts/src/lib.rs index 766439ee3204..d3d5d06ba4aa 100644 --- a/core/lib/contracts/src/lib.rs +++ b/core/lib/contracts/src/lib.rs @@ -202,7 +202,7 @@ pub fn l2_rollup_da_validator_bytecode() -> Vec { /// Reads bytecode from the path RELATIVE to the Cargo workspace location. pub fn read_bytecode(relative_path: impl AsRef + std::fmt::Debug) -> Vec { - read_bytecode_from_path(relative_path).expect("Exists") + read_bytecode_from_path(relative_path).expect("Failed to open file") } pub fn eth_contract() -> Contract { diff --git a/core/lib/env_config/src/contracts.rs b/core/lib/env_config/src/contracts.rs index 454b1951b79f..f8ec5ccea3d3 100644 --- a/core/lib/env_config/src/contracts.rs +++ b/core/lib/env_config/src/contracts.rs @@ -1,43 +1,25 @@ use zksync_config::{configs::EcosystemContracts, ContractsConfig}; -use crate::{envy_load, FromEnv, FromEnvVariant}; +use crate::{envy_load, FromEnv}; impl FromEnv for EcosystemContracts { fn from_env() -> anyhow::Result { - Self::from_env_variant("".to_string()) - } -} -impl FromEnvVariant for EcosystemContracts { - fn from_env_variant(variant: String) -> anyhow::Result { Ok(Self { - bridgehub_proxy_addr: std::env::var(format!( - "{variant}CONTRACTS_BRIDGEHUB_PROXY_ADDR" - ))? - .parse()?, - state_transition_proxy_addr: std::env::var(format!( - "{variant}CONTRACTS_STATE_TRANSITION_PROXY_ADDR" - ))? - .parse()?, - transparent_proxy_admin_addr: std::env::var(format!( - "{variant}CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR" - ))? - .parse()?, - l1_bytecodes_supplier_addr: Some( - std::env::var(format!("{variant}CONTRACTS_L1_BYTECODE_SUPPLIER_ADDR"))?.parse()?, - ), + bridgehub_proxy_addr: std::env::var("CONTRACTS_BRIDGEHUB_PROXY_ADDR")?.parse()?, + state_transition_proxy_addr: std::env::var("CONTRACTS_STATE_TRANSITION_PROXY_ADDR")? + .parse()?, + transparent_proxy_admin_addr: std::env::var("CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR")? + .parse()?, + l1_bytecodes_supplier_addr: std::env::var("CONTRACTS_L1_BYTECODE_SUPPLIER_ADDR")? + .parse() + .ok(), }) } } impl FromEnv for ContractsConfig { fn from_env() -> anyhow::Result { - Self::from_env_variant("".to_string()) - } -} -impl FromEnvVariant for ContractsConfig { - fn from_env_variant(variant: String) -> anyhow::Result { - let mut contracts: ContractsConfig = - envy_load("contracts", &format!("{variant}CONTRACTS_"))?; + let mut contracts: ContractsConfig = envy_load("contracts", "CONTRACTS_")?; // Note: we are renaming the bridge, the address remains the same // These two config variables should always have the same value. // TODO(EVM-578): double check and potentially forbid both of them being `None`. @@ -56,7 +38,7 @@ impl FromEnvVariant for ContractsConfig { panic!("L2 erc20 bridge address and L2 shared bridge address are different."); } } - contracts.ecosystem_contracts = EcosystemContracts::from_env_variant(variant).ok(); + contracts.ecosystem_contracts = EcosystemContracts::from_env().ok(); Ok(contracts) } } @@ -99,13 +81,13 @@ mod tests { )), }), base_token_addr: Some(SHARED_BRIDGE_ETHER_TOKEN_ADDRESS), - base_token_asset_id: Some( + l1_base_token_asset_id: Some( H256::from_str( "0x0000000000000000000000000000000000000001000000000000000000000000", ) .unwrap(), ), - predeployed_l2_wrapped_base_token_address: Some(addr( + l2_predeployed_wrapped_base_token_address: Some(addr( "0x35ea7f92f4c5f433efe15284e99c040110cf6299", )), chain_admin_addr: Some(addr("0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff")), @@ -138,8 +120,8 @@ CONTRACTS_BRIDGEHUB_PROXY_ADDR="0x35ea7f92f4c5f433efe15284e99c040110cf6297" CONTRACTS_STATE_TRANSITION_PROXY_ADDR="0xd90f1c081c6117241624e97cb6147257c3cb2097" CONTRACTS_TRANSPARENT_PROXY_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347e5" CONTRACTS_BASE_TOKEN_ADDR="0x0000000000000000000000000000000000000001" -CONTRACTS_BASE_TOKEN_ASSET_ID="0x0000000000000000000000000000000000000001000000000000000000000000" -CONTRACTS_PREDEPLOYED_L2_WETH_TOKEN_ADDRESS="0x35ea7f92f4c5f433efe15284e99c040110cf6299" +CONTRACTS_L1_BASE_TOKEN_ASSET_ID="0x0000000000000000000000000000000000000001000000000000000000000000" +CONTRACTS_L2_PREDEPLOYED_WRAPPED_BASE_TOKEN_ADDRESS="0x35ea7f92f4c5f433efe15284e99c040110cf6299" CONTRACTS_L2_NATIVE_TOKEN_VAULT_PROXY_ADDR="0xfc073319977e314f251eae6ae6be76b0b3baeecf" CONTRACTS_PREDEPLOYED_L2_WRAPPED_BASE_TOKEN_ADDRESS="0x35ea7f92f4c5f433efe15284e99c040110cf6299" CONTRACTS_CHAIN_ADMIN_ADDR="0xdd6fa5c14e7550b4caf2aa2818d24c69cbc347ff" diff --git a/core/lib/env_config/src/eth_sender.rs b/core/lib/env_config/src/eth_sender.rs index 08143eec56a1..f849ade8cfd0 100644 --- a/core/lib/env_config/src/eth_sender.rs +++ b/core/lib/env_config/src/eth_sender.rs @@ -74,7 +74,6 @@ mod tests { pubdata_sending_mode: PubdataSendingMode::Calldata, tx_aggregation_only_prove_and_execute: false, tx_aggregation_paused: false, - priority_tree_start_index: None, time_in_mempool_in_l1_blocks_cap: 2000, }), gas_adjuster: Some(GasAdjusterConfig { diff --git a/core/lib/env_config/src/lib.rs b/core/lib/env_config/src/lib.rs index eca003fd59cd..325288056b35 100644 --- a/core/lib/env_config/src/lib.rs +++ b/core/lib/env_config/src/lib.rs @@ -39,10 +39,6 @@ pub trait FromEnv: Sized { fn from_env() -> anyhow::Result; } -pub trait FromEnvVariant: Sized { - fn from_env_variant(variant_prefix: String) -> anyhow::Result; -} - /// Convenience function that loads the structure from the environment variable given the prefix. /// Panics if the config cannot be loaded from the environment variables. pub fn envy_load(name: &str, prefix: &str) -> anyhow::Result { diff --git a/core/lib/multivm/Cargo.toml b/core/lib/multivm/Cargo.toml index 128e6fc0c4af..107a168e305a 100644 --- a/core/lib/multivm/Cargo.toml +++ b/core/lib/multivm/Cargo.toml @@ -18,11 +18,7 @@ zk_evm_1_3_3.workspace = true zk_evm_1_3_1.workspace = true zksync_vm2.workspace = true -circuit_sequencer_api_1_3_3.workspace = true -circuit_sequencer_api_1_4_0.workspace = true -circuit_sequencer_api_1_4_1.workspace = true -circuit_sequencer_api_1_4_2.workspace = true -circuit_sequencer_api_1_5_0.workspace = true +circuit_sequencer_api.workspace = true zksync_types.workspace = true zksync_contracts.workspace = true diff --git a/core/lib/multivm/src/glue/types/vm/vm_block_result.rs b/core/lib/multivm/src/glue/types/vm/vm_block_result.rs index c4eb0b1741aa..1cbb9f261ad2 100644 --- a/core/lib/multivm/src/glue/types/vm/vm_block_result.rs +++ b/core/lib/multivm/src/glue/types/vm/vm_block_result.rs @@ -1,8 +1,6 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries as sort_storage_access_queries_1_3_3; -use itertools::Itertools; -use zk_evm_1_3_1::aux_structures::LogQuery as LogQuery_1_3_1; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::l2_to_l1_log::UserL2ToL1Log; use crate::{ @@ -11,6 +9,7 @@ use crate::{ CurrentExecutionState, ExecutionResult, Refunds, VmExecutionLogs, VmExecutionResultAndLogs, VmExecutionStatistics, }, + utils::glue_log_query, }; // Note: In version after vm `VmVirtualBlocks` the bootloader memory knowledge is encapsulated into the VM. @@ -21,18 +20,12 @@ use crate::{ impl GlueFrom for crate::interface::FinishedL1Batch { fn glue_from(value: crate::vm_m5::vm_instance::VmBlockResult) -> Self { let storage_log_queries = value.full_result.storage_log_queries.clone(); - let deduplicated_storage_logs: Vec = sort_storage_access_queries_1_3_3( - &storage_log_queries + let deduplicated_storage_logs = sort_storage_access_queries( + storage_log_queries .iter() - .map(|log| { - GlueInto::::glue_into(log.log_query) - }) - .collect_vec(), + .map(|log| glue_log_query(log.log_query)), ) - .1 - .into_iter() - .map(GlueInto::::glue_into) - .collect(); + .1; crate::interface::FinishedL1Batch { block_tip_execution_result: VmExecutionResultAndLogs { @@ -78,18 +71,12 @@ impl GlueFrom for crate::interface::Fi impl GlueFrom for crate::interface::FinishedL1Batch { fn glue_from(value: crate::vm_m6::vm_instance::VmBlockResult) -> Self { let storage_log_queries = value.full_result.storage_log_queries.clone(); - let deduplicated_storage_logs: Vec = sort_storage_access_queries_1_3_3( - &storage_log_queries + let deduplicated_storage_logs = sort_storage_access_queries( + storage_log_queries .iter() - .map(|log| { - GlueInto::::glue_into(log.log_query) - }) - .collect_vec(), + .map(|log| glue_log_query(log.log_query)), ) - .1 - .into_iter() - .map(GlueInto::::glue_into) - .collect(); + .1; crate::interface::FinishedL1Batch { block_tip_execution_result: VmExecutionResultAndLogs { @@ -135,11 +122,12 @@ impl GlueFrom for crate::interface::Fi impl GlueFrom for crate::interface::FinishedL1Batch { fn glue_from(value: crate::vm_1_3_2::vm_instance::VmBlockResult) -> Self { let storage_log_queries = value.full_result.storage_log_queries.clone(); - let deduplicated_storage_logs = - circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries( - storage_log_queries.iter().map(|log| &log.log_query), - ) - .1; + let deduplicated_storage_logs = sort_storage_access_queries( + storage_log_queries + .iter() + .map(|log| glue_log_query(log.log_query)), + ) + .1; crate::interface::FinishedL1Batch { block_tip_execution_result: VmExecutionResultAndLogs { diff --git a/core/lib/multivm/src/lib.rs b/core/lib/multivm/src/lib.rs index fc4085d9b021..202d7ce95d14 100644 --- a/core/lib/multivm/src/lib.rs +++ b/core/lib/multivm/src/lib.rs @@ -2,7 +2,7 @@ #![warn(unused_extern_crates)] #![warn(unused_imports)] -pub use circuit_sequencer_api_1_5_0 as circuit_sequencer_api_latest; +pub use circuit_sequencer_api as circuit_sequencer_api_latest; pub use zk_evm_1_5_0 as zk_evm_latest; pub use zksync_types::vm::VmVersion; pub use zksync_vm_interface as interface; diff --git a/core/lib/multivm/src/tracers/mod.rs b/core/lib/multivm/src/tracers/mod.rs index 35224d993a17..b888c3730118 100644 --- a/core/lib/multivm/src/tracers/mod.rs +++ b/core/lib/multivm/src/tracers/mod.rs @@ -1,6 +1,9 @@ pub use self::{ - call_tracer::CallTracer, multivm_dispatcher::TracerDispatcher, prestate_tracer::PrestateTracer, - storage_invocation::StorageInvocations, validator::ValidationTracer, + call_tracer::CallTracer, + multivm_dispatcher::TracerDispatcher, + prestate_tracer::PrestateTracer, + storage_invocation::StorageInvocations, + validator::{ValidationTracer, TIMESTAMP_ASSERTER_FUNCTION_SELECTOR}, }; mod call_tracer; diff --git a/core/lib/multivm/src/tracers/validator/mod.rs b/core/lib/multivm/src/tracers/validator/mod.rs index 88249467a575..c1dd311d9fd3 100644 --- a/core/lib/multivm/src/tracers/validator/mod.rs +++ b/core/lib/multivm/src/tracers/validator/mod.rs @@ -5,6 +5,7 @@ use std::{ }; use once_cell::sync::OnceCell; +pub use vm_latest::TIMESTAMP_ASSERTER_FUNCTION_SELECTOR; use zksync_system_constants::{ ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS, CONTRACT_DEPLOYER_ADDRESS, L2_BASE_TOKEN_ADDRESS, MSG_VALUE_SIMULATOR_ADDRESS, SYSTEM_CONTEXT_ADDRESS, @@ -13,10 +14,7 @@ use zksync_types::{ address_to_u256, u256_to_h256, vm::VmVersion, web3::keccak256, AccountTreeId, Address, StorageKey, H256, U256, }; -use zksync_vm_interface::{ - tracer::{TimestampAsserterParams, ValidationTraces}, - L1BatchEnv, -}; +use zksync_vm_interface::tracer::{TimestampAsserterParams, ValidationTraces}; use self::types::{NewTrustedValidationItems, ValidationTracerMode}; use crate::{ @@ -54,7 +52,7 @@ pub struct ValidationTracer { computational_gas_limit: u32, timestamp_asserter_params: Option, vm_version: VmVersion, - l1_batch_env: L1BatchEnv, + l1_batch_timestamp: u64, pub result: Arc>, pub traces: Arc>, _marker: PhantomData H>, @@ -65,7 +63,7 @@ type ValidationRoundResult = Result ValidationTracer { const MAX_ALLOWED_SLOT_OFFSET: u32 = 127; - pub fn new(params: ValidationParams, vm_version: VmVersion, l1_batch_env: L1BatchEnv) -> Self { + pub fn new(params: ValidationParams, vm_version: VmVersion, l1_batch_timestamp: u64) -> Self { Self { validation_mode: ValidationTracerMode::NoValidation, auxilary_allowed_slots: Default::default(), @@ -83,7 +81,7 @@ impl ValidationTracer { result: Arc::new(OnceCell::new()), traces: Arc::new(Mutex::new(ValidationTraces::default())), _marker: Default::default(), - l1_batch_env, + l1_batch_timestamp, } } diff --git a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs index 3c819384137f..5588dd144e95 100644 --- a/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs +++ b/core/lib/multivm/src/tracers/validator/vm_latest/mod.rs @@ -1,6 +1,6 @@ use zk_evm_1_5_0::{ tracing::{BeforeExecutionData, VmLocalStateData}, - zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode}, + zkevm_opcode_defs::{ContextOpcode, FarCallABI, LogOpcode, Opcode, RetOpcode}, }; use zksync_system_constants::KECCAK256_PRECOMPILE_ADDRESS; use zksync_types::{ @@ -116,8 +116,7 @@ impl ValidationTracer { // using self.l1_batch_env.timestamp is ok here because the tracer is always // used in a oneshot execution mode if end - < self.l1_batch_env.timestamp - + params.min_time_till_end.as_secs() + < self.l1_batch_timestamp + params.min_time_till_end.as_secs() { return Err( ViolatedValidationRule::TimestampAssertionCloseToRangeEnd, @@ -168,6 +167,13 @@ impl ValidationTracer { }); } } + + Opcode::Ret(RetOpcode::Panic) + if state.vm_local_state.callstack.current.ergs_remaining == 0 => + { + // Actual gas limit was reached, not the validation gas limit. + return Err(ViolatedValidationRule::TookTooManyComputationalGas(0)); + } _ => {} } diff --git a/core/lib/multivm/src/utils/mod.rs b/core/lib/multivm/src/utils/mod.rs index 21d83cca8468..7bb907efc9b8 100644 --- a/core/lib/multivm/src/utils/mod.rs +++ b/core/lib/multivm/src/utils/mod.rs @@ -5,12 +5,27 @@ use zksync_types::{ }; pub use self::deduplicator::{ModifiedSlot, StorageWritesDeduplicator}; -use crate::interface::L1BatchEnv; +use crate::{ + glue::{GlueFrom, GlueInto}, + interface::L1BatchEnv, +}; pub(crate) mod bytecode; mod deduplicator; pub(crate) mod events; +/// Allows to convert `LogQuery` between two different versions, even if they don't provide +/// direct conversion between each other. +/// It transforms the input query to the `LogQuery` from `zksync_types` (for which most of the +/// `zk_evm` versions provide conversion) and then converts it to the target version. +pub fn glue_log_query(l: L) -> R +where + L: GlueInto, + R: GlueFrom, +{ + R::glue_from(l.glue_into()) +} + /// Calculates the base fee and gas per pubdata for the given L1 gas price. pub fn derive_base_fee_and_gas_per_pubdata( batch_fee_input: BatchFeeInput, @@ -535,9 +550,9 @@ pub fn get_max_new_factory_deps(version: VmVersion) -> usize { } VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::MAX_NEW_FACTORY_DEPS, VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::MAX_NEW_FACTORY_DEPS, - version @ VmVersion::Vm1_5_0SmallBootloaderMemory - | version @ VmVersion::Vm1_5_0IncreasedBootloaderMemory - | version @ VmVersion::VmGateway => { + version @ (VmVersion::Vm1_5_0SmallBootloaderMemory + | VmVersion::Vm1_5_0IncreasedBootloaderMemory + | VmVersion::VmGateway) => { crate::vm_latest::constants::get_max_new_factory_deps(version.try_into().unwrap()) } } diff --git a/core/lib/multivm/src/versions/shadow/mod.rs b/core/lib/multivm/src/versions/shadow/mod.rs index a335d0fe5906..1ad5bdba5a7b 100644 --- a/core/lib/multivm/src/versions/shadow/mod.rs +++ b/core/lib/multivm/src/versions/shadow/mod.rs @@ -25,7 +25,7 @@ use crate::{ mod tests; type ReferenceVm = vm_latest::Vm, HistoryEnabled>; -type ShadowedFastVm = crate::vm_instance::ShadowedFastVm; +type ShadowedFastVm = crate::vm_instance::ShadowedFastVm; fn hash_block(block_env: L2BlockEnv, tx_hashes: &[H256]) -> H256 { let mut hasher = L2BlockHasher::new( diff --git a/core/lib/multivm/src/versions/testonly/account_validation_rules.rs b/core/lib/multivm/src/versions/testonly/account_validation_rules.rs new file mode 100644 index 000000000000..b2beb050ad41 --- /dev/null +++ b/core/lib/multivm/src/versions/testonly/account_validation_rules.rs @@ -0,0 +1,59 @@ +use assert_matches::assert_matches; +use zksync_test_contracts::TestContract; +use zksync_types::{u256_to_h256, AccountTreeId, Address, StorageKey}; +use zksync_vm_interface::tracer::ViolatedValidationRule; + +use super::{ + get_empty_storage, require_eip712::make_aa_transaction, tester::VmTesterBuilder, + ContractToDeploy, TestedVm, TestedVmForValidation, +}; +use crate::interface::TxExecutionMode; + +/// Checks that every limitation imposed on account validation results in an appropriate error. +/// The actual misbehavior cases are found in "validation-rule-breaker.sol". +pub(crate) fn test_account_validation_rules() { + assert_matches!(test_rule::(0), None); + assert_matches!( + test_rule::(1), + Some(ViolatedValidationRule::TouchedDisallowedStorageSlots(_, _)) + ); + assert_matches!( + test_rule::(2), + Some(ViolatedValidationRule::CalledContractWithNoCode(_)) + ); + assert_matches!(test_rule::(3), None); + assert_matches!( + test_rule::(4), + Some(ViolatedValidationRule::TookTooManyComputationalGas(_)) + ) +} + +fn test_rule(rule: u32) -> Option { + let aa_address = Address::repeat_byte(0x10); + let beneficiary_address = Address::repeat_byte(0x20); + + // Set the type of misbehaviour of the AA contract + let mut storage_with_rule_break_set = get_empty_storage(); + storage_with_rule_break_set.set_value( + StorageKey::new(AccountTreeId::new(aa_address), u256_to_h256(0.into())), + u256_to_h256(rule.into()), + ); + + let bytecode = TestContract::validation_test().bytecode.to_vec(); + let mut vm = VmTesterBuilder::new() + .with_empty_in_memory_storage() + .with_custom_contracts(vec![ + ContractToDeploy::account(bytecode, aa_address).funded() + ]) + .with_storage(storage_with_rule_break_set) + .with_execution_mode(TxExecutionMode::VerifyExecute) + .with_rich_accounts(1) + .build::(); + + let private_account = vm.rich_accounts[0].clone(); + + vm.vm.run_validation( + make_aa_transaction(aa_address, beneficiary_address, &private_account), + 55, + ) +} diff --git a/core/lib/multivm/src/versions/testonly/evm_emulator.rs b/core/lib/multivm/src/versions/testonly/evm_emulator.rs index b979efe360db..bcf6eccfdf5d 100644 --- a/core/lib/multivm/src/versions/testonly/evm_emulator.rs +++ b/core/lib/multivm/src/versions/testonly/evm_emulator.rs @@ -76,7 +76,8 @@ impl EvmTestBuilder { let mut system_env = default_system_env(); if self.deploy_emulator { let evm_bytecode: Vec<_> = (0..32).collect(); - let evm_bytecode_hash = BytecodeHash::for_evm_bytecode(&evm_bytecode).value(); + let evm_bytecode_hash = + BytecodeHash::for_evm_bytecode(evm_bytecode.len(), &evm_bytecode).value(); storage.set_value( get_known_code_key(&evm_bytecode_hash), H256::from_low_u64_be(1), @@ -131,7 +132,8 @@ pub(crate) fn test_tracing_evm_contract_deployment() { let args = [Token::Bytes((0..32).collect())]; let evm_bytecode = ethabi::encode(&args); - let expected_bytecode_hash = BytecodeHash::for_evm_bytecode(&evm_bytecode).value(); + let expected_bytecode_hash = + BytecodeHash::for_evm_bytecode(evm_bytecode.len(), &evm_bytecode).value(); let execute = Execute::for_deploy(expected_bytecode_hash, vec![0; 32], &args); let deploy_tx = account.get_l2_tx_for_execute(execute, None); let (_, vm_result) = vm @@ -148,7 +150,8 @@ pub(crate) fn test_tracing_evm_contract_deployment() { // "Deploy" a bytecode in another transaction and check that the first tx doesn't interfere with the returned `dynamic_factory_deps`. let args = [Token::Bytes((0..32).rev().collect())]; let evm_bytecode = ethabi::encode(&args); - let expected_bytecode_hash = BytecodeHash::for_evm_bytecode(&evm_bytecode).value(); + let expected_bytecode_hash = + BytecodeHash::for_evm_bytecode(evm_bytecode.len(), &evm_bytecode).value(); let execute = Execute::for_deploy(expected_bytecode_hash, vec![0; 32], &args); let deploy_tx = account.get_l2_tx_for_execute(execute, None); let (_, vm_result) = vm @@ -324,7 +327,8 @@ pub(crate) fn test_mock_emulator_with_deployment(revert: bool) { let mock_emulator_abi = &TestContract::mock_evm_emulator().abi; let new_evm_bytecode = vec![0xfe; 96]; - let new_evm_bytecode_hash = BytecodeHash::for_evm_bytecode(&new_evm_bytecode).value(); + let new_evm_bytecode_hash = + BytecodeHash::for_evm_bytecode(new_evm_bytecode.len(), &new_evm_bytecode).value(); let test_fn = mock_emulator_abi.function("testDeploymentAndCall").unwrap(); let test_tx = account.get_l2_tx_for_execute( @@ -402,7 +406,10 @@ pub(crate) fn test_mock_emulator_with_recursive_deployment() { let bytecodes: HashMap<_, _> = (0_u8..10) .map(|byte| { let bytecode = vec![byte; 32]; - (BytecodeHash::for_evm_bytecode(&bytecode).value(), bytecode) + ( + BytecodeHash::for_evm_bytecode(bytecode.len(), &bytecode).value(), + bytecode, + ) }) .collect(); let test_fn = mock_emulator_abi @@ -448,7 +455,10 @@ fn test_mock_emulator_with_partial_reverts_and_rng(rng: &mut impl let all_bytecodes: HashMap<_, _> = (0_u8..10) .map(|_| { let bytecode = vec![rng.gen(); 32]; - (BytecodeHash::for_evm_bytecode(&bytecode).value(), bytecode) + ( + BytecodeHash::for_evm_bytecode(bytecode.len(), &bytecode).value(), + bytecode, + ) }) .collect(); let should_revert: Vec<_> = (0..10).map(|_| rng.gen::()).collect(); diff --git a/core/lib/multivm/src/versions/testonly/l1_messenger.rs b/core/lib/multivm/src/versions/testonly/l1_messenger.rs index 668455d26729..c8b7b6bd8ed0 100644 --- a/core/lib/multivm/src/versions/testonly/l1_messenger.rs +++ b/core/lib/multivm/src/versions/testonly/l1_messenger.rs @@ -88,7 +88,6 @@ pub(crate) fn test_rollup_da_output_hash_match() { // Firstly, deploy tx. It should publish the bytecode of the "test contract" let counter_bytecode = TestContract::counter().bytecode; - let tx = account.get_deploy_tx(counter_bytecode, None, TxType::L2).tx; // We do not use compression here, to have the bytecode published in full. let (_, result) = vm diff --git a/core/lib/multivm/src/versions/testonly/mod.rs b/core/lib/multivm/src/versions/testonly/mod.rs index f593f656c87b..8f24c849272d 100644 --- a/core/lib/multivm/src/versions/testonly/mod.rs +++ b/core/lib/multivm/src/versions/testonly/mod.rs @@ -24,12 +24,15 @@ use zksync_vm_interface::{ pubdata::PubdataBuilder, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, }; -pub(super) use self::tester::{TestedVm, VmTester, VmTesterBuilder}; +pub(super) use self::tester::{ + validation_params, TestedVm, TestedVmForValidation, VmTester, VmTesterBuilder, +}; use crate::{ interface::storage::InMemoryStorage, pubdata_builders::FullPubdataBuilder, vm_latest::constants::BATCH_COMPUTATIONAL_GAS_LIMIT, }; +pub(super) mod account_validation_rules; pub(super) mod block_tip; pub(super) mod bootloader; pub(super) mod bytecode_publishing; diff --git a/core/lib/multivm/src/versions/testonly/precompiles.rs b/core/lib/multivm/src/versions/testonly/precompiles.rs index e525bd627646..dee60686a4f0 100644 --- a/core/lib/multivm/src/versions/testonly/precompiles.rs +++ b/core/lib/multivm/src/versions/testonly/precompiles.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_5_0::geometry_config::get_geometry_config; +use circuit_sequencer_api::geometry_config::ProtocolGeometry; use zksync_test_contracts::TestContract; use zksync_types::{Address, Execute}; @@ -41,7 +41,9 @@ pub(crate) fn test_keccak() { assert!(!exec_result.result.is_failed(), "{exec_result:#?}"); let keccak_count = exec_result.statistics.circuit_statistic.keccak256 - * get_geometry_config().cycles_per_keccak256_circuit as f32; + * ProtocolGeometry::V1_5_0 + .config() + .cycles_per_keccak256_circuit as f32; assert!(keccak_count >= 1000.0, "{keccak_count}"); } @@ -77,7 +79,7 @@ pub(crate) fn test_sha256() { assert!(!exec_result.result.is_failed(), "{exec_result:#?}"); let sha_count = exec_result.statistics.circuit_statistic.sha256 - * get_geometry_config().cycles_per_sha256_circuit as f32; + * ProtocolGeometry::V1_5_0.config().cycles_per_sha256_circuit as f32; assert!(sha_count >= 1000.0, "{sha_count}"); } @@ -106,6 +108,8 @@ pub(crate) fn test_ecrecover() { assert!(!exec_result.result.is_failed(), "{exec_result:#?}"); let ecrecover_count = exec_result.statistics.circuit_statistic.ecrecover - * get_geometry_config().cycles_per_ecrecover_circuit as f32; + * ProtocolGeometry::V1_5_0 + .config() + .cycles_per_ecrecover_circuit as f32; assert!((ecrecover_count - 1.0).abs() < 1e-4, "{ecrecover_count}"); } diff --git a/core/lib/multivm/src/versions/testonly/require_eip712.rs b/core/lib/multivm/src/versions/testonly/require_eip712.rs index 7a934c570aea..2f17a3e7823e 100644 --- a/core/lib/multivm/src/versions/testonly/require_eip712.rs +++ b/core/lib/multivm/src/versions/testonly/require_eip712.rs @@ -1,6 +1,6 @@ use ethabi::Token; use zksync_eth_signer::TransactionParameters; -use zksync_test_contracts::TestContract; +use zksync_test_contracts::{Account, TestContract}; use zksync_types::{ fee::Fee, l2::L2Tx, transaction_request::TransactionRequest, Address, Eip712Domain, Execute, L2ChainId, Nonce, Transaction, U256, @@ -30,7 +30,6 @@ pub(crate) fn test_require_eip712() { .with_rich_accounts(1) .build::(); assert_eq!(vm.get_eth_balance(beneficiary_address), U256::from(0)); - let chain_id: u32 = 270; let mut private_account = vm.rich_accounts[0].clone(); // First, let's set the owners of the AA account to the `private_address`. @@ -97,7 +96,30 @@ pub(crate) fn test_require_eip712() { vm.get_eth_balance(private_account.address) ); - // // Now send the 'classic' EIP712 transaction + // Now send the 'classic' EIP712 transaction + + let transaction: Transaction = + make_aa_transaction(aa_address, beneficiary_address, &private_account).into(); + vm.vm.push_transaction(transaction); + vm.vm.execute(InspectExecutionMode::OneTx); + + assert_eq!( + vm.get_eth_balance(beneficiary_address), + U256::from(916375026) + ); + assert_eq!( + private_account_balance, + vm.get_eth_balance(private_account.address) + ); +} + +pub(crate) fn make_aa_transaction( + aa_address: Address, + beneficiary_address: Address, + private_account: &Account, +) -> L2Tx { + let chain_id: u32 = 270; + let tx_712 = L2Tx::new( Some(beneficiary_address), vec![], @@ -130,16 +152,5 @@ pub(crate) fn test_require_eip712() { let mut l2_tx = L2Tx::from_request(aa_txn_request, 100000, false).unwrap(); l2_tx.set_input(encoded_tx, aa_hash); - let transaction: Transaction = l2_tx.into(); - vm.vm.push_transaction(transaction); - vm.vm.execute(InspectExecutionMode::OneTx); - - assert_eq!( - vm.get_eth_balance(beneficiary_address), - U256::from(916375026) - ); - assert_eq!( - private_account_balance, - vm.get_eth_balance(private_account.address) - ); + l2_tx } diff --git a/core/lib/multivm/src/versions/testonly/tester/mod.rs b/core/lib/multivm/src/versions/testonly/tester/mod.rs index d3cf2d6f782f..c29f2dbbf8f3 100644 --- a/core/lib/multivm/src/versions/testonly/tester/mod.rs +++ b/core/lib/multivm/src/versions/testonly/tester/mod.rs @@ -3,6 +3,7 @@ use std::{collections::HashSet, fmt, rc::Rc}; use zksync_contracts::BaseSystemContracts; use zksync_test_contracts::{Account, TestContract, TxType}; use zksync_types::{ + l2::L2Tx, utils::{deployed_address_create, storage_key_for_eth_balance}, writes::StateDiffRecord, Address, L1BatchNumber, StorageKey, Transaction, H256, U256, @@ -14,6 +15,7 @@ use crate::{ interface::{ pubdata::{PubdataBuilder, PubdataInput}, storage::{InMemoryStorage, StoragePtr, StorageView}, + tracer::{ValidationParams, ViolatedValidationRule}, CurrentExecutionState, InspectExecutionMode, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterfaceExt, VmInterfaceHistoryEnabled, @@ -231,3 +233,22 @@ pub(crate) trait TestedVm: /// Returns pubdata input. fn pubdata_input(&self) -> PubdataInput; } + +pub(crate) trait TestedVmForValidation { + fn run_validation(&mut self, tx: L2Tx, timestamp: u64) -> Option; +} + +pub(crate) fn validation_params(tx: &L2Tx, system: &SystemEnv) -> ValidationParams { + let user_address = tx.common_data.initiator_address; + let paymaster_address = tx.common_data.paymaster_params.paymaster; + ValidationParams { + user_address, + paymaster_address, + trusted_slots: Default::default(), + trusted_addresses: Default::default(), + // field `trustedAddress` of ValidationRuleBreaker + trusted_address_slots: [(Address::repeat_byte(0x10), 2.into())].into(), + computational_gas_limit: system.default_validation_computational_gas_limit, + timestamp_asserter_params: None, + } +} diff --git a/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs index 3c10bd8c48be..f0be10d72077 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs @@ -1,12 +1,12 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_3_3::aux_structures::Timestamp; use zksync_types::{StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use crate::{ interface::{storage::WriteStorage, VmEvent}, - utils::bytecode::bytecode_len_in_bytes, + utils::{bytecode::bytecode_len_in_bytes, glue_log_query}, vm_1_3_2::{history_recorder::HistoryMode, oracles::storage::storage_key_of_log, VmInstance}, }; @@ -71,16 +71,20 @@ impl VmInstance { .state .storage .storage_log_queries_after_timestamp(from_timestamp); - let (_, deduplicated_logs) = - sort_storage_access_queries(storage_logs.iter().map(|log| &log.log_query)); + let (_, deduplicated_logs) = sort_storage_access_queries( + storage_logs.iter().map(|log| glue_log_query(log.log_query)), + ); deduplicated_logs .into_iter() .filter_map(|log| { if log.rw_flag { - let key = storage_key_of_log(&log); + let key = storage_key_of_log(&glue_log_query(log)); let pre_paid = pre_paid_before_tx(&key); - let to_pay_by_user = self.state.storage.base_price_for_write(&log); + let to_pay_by_user = self + .state + .storage + .base_price_for_write(&glue_log_query(log)); if to_pay_by_user > pre_paid { Some(to_pay_by_user - pre_paid) diff --git a/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs index 0a84d02a96f9..eb2cbd058a7f 100644 --- a/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use itertools::Itertools; use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_capacity.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_capacity.rs index a32328bbc18c..5ef359248b85 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_capacity.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/circuits_capacity.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_4_1::{geometry_config::get_geometry_config, toolset::GeometryConfig}; +use circuit_sequencer_api::geometry_config::{GeometryConfig, ProtocolGeometry}; use crate::{interface::CircuitStatistic, utils::CircuitCycleStatistic}; @@ -40,7 +40,7 @@ pub(crate) const UMA_READ_RAM_CYCLES: u32 = 3; pub(crate) const PRECOMPILE_RAM_CYCLES: u32 = 1; pub(crate) const PRECOMPILE_LOG_DEMUXER_CYCLES: u32 = 1; -const GEOMETRY_CONFIG: GeometryConfig = get_geometry_config(); +const GEOMETRY_CONFIG: GeometryConfig = ProtocolGeometry::V1_4_1.config(); pub(crate) fn circuit_statistic_from_cycles(cycles: CircuitCycleStatistic) -> CircuitStatistic { CircuitStatistic { diff --git a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs index a51c5ce46197..344cacbd903e 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/tracers/pubdata_tracer.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use circuit_sequencer_api_1_4_1::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_4_1::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, @@ -24,6 +24,7 @@ use crate::{ extract_bytecode_publication_requests_from_l1_messenger, extract_l2tol1logs_from_l1_messenger, }, + glue_log_query, }, vm_1_4_1::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, @@ -130,7 +131,7 @@ impl PubdataTracer { storage .storage_log_queries_after_timestamp(Timestamp(0)) .iter() - .map(|log| &log.log_query), + .map(|log| glue_log_query(log.log_query)), ) .1 .into_iter() diff --git a/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs index 9c3ecd9741a3..cc1ec75d51c2 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_4_1::{ aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, diff --git a/core/lib/multivm/src/versions/vm_1_4_1/vm.rs b/core/lib/multivm/src/versions/vm_1_4_1/vm.rs index af483feedd7e..7f17f65cac07 100644 --- a/core/lib/multivm/src/versions/vm_1_4_1/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_4_1/vm.rs @@ -1,6 +1,6 @@ use std::rc::Rc; -use circuit_sequencer_api_1_4_1::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::{ l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, Transaction, @@ -15,7 +15,7 @@ use crate::{ FinishedL1Batch, L1BatchEnv, L2BlockEnv, PushTransactionResult, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, }, - utils::events::extract_l2tol1logs_from_l1_messenger, + utils::{events::extract_l2tol1logs_from_l1_messenger, glue_log_query}, vm_1_4_1::{ bootloader_state::BootloaderState, old_vm::events::merge_events, @@ -60,8 +60,12 @@ impl Vm { let storage_log_queries = self.state.storage.get_final_log_queries(); - let deduped_storage_log_queries = - sort_storage_access_queries(storage_log_queries.iter().map(|log| &log.log_query)).1; + let deduped_storage_log_queries = sort_storage_access_queries( + storage_log_queries + .iter() + .map(|log| glue_log_query(log.log_query)), + ) + .1; CurrentExecutionState { events, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/constants.rs b/core/lib/multivm/src/versions/vm_1_4_2/constants.rs index 65abb389eee6..fad67596bd5a 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/constants.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/constants.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_4_2::{BLOB_CHUNK_SIZE, ELEMENTS_PER_4844_BLOCK}; +use circuit_sequencer_api::{BLOB_CHUNK_SIZE, ELEMENTS_PER_4844_BLOCK}; use zk_evm_1_4_1::aux_structures::MemoryPage; pub use zk_evm_1_4_1::zkevm_opcode_defs::system_params::{ ERGS_PER_CIRCUIT, INITIAL_STORAGE_WRITE_PUBDATA_BYTES, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_capacity.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_capacity.rs index 974e07577213..e56d57246982 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_capacity.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/circuits_capacity.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_4_2::{geometry_config::get_geometry_config, toolset::GeometryConfig}; +use circuit_sequencer_api::geometry_config::{GeometryConfig, ProtocolGeometry}; use crate::{interface::CircuitStatistic, utils::CircuitCycleStatistic}; @@ -41,7 +41,7 @@ pub(crate) const UMA_READ_RAM_CYCLES: u32 = 3; pub(crate) const PRECOMPILE_RAM_CYCLES: u32 = 1; pub(crate) const PRECOMPILE_LOG_DEMUXER_CYCLES: u32 = 1; -const GEOMETRY_CONFIG: GeometryConfig = get_geometry_config(); +const GEOMETRY_CONFIG: GeometryConfig = ProtocolGeometry::V1_4_2.config(); pub(crate) fn circuit_statistic_from_cycles(cycles: CircuitCycleStatistic) -> CircuitStatistic { CircuitStatistic { diff --git a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs index 58318f5d845e..8f9bbb94b9d4 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/tracers/pubdata_tracer.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use circuit_sequencer_api_1_4_2::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_4_1::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, @@ -24,6 +24,7 @@ use crate::{ extract_bytecode_publication_requests_from_l1_messenger, extract_l2tol1logs_from_l1_messenger, }, + glue_log_query, }, vm_1_4_2::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, @@ -150,7 +151,7 @@ impl PubdataTracer { storage .storage_log_queries_after_timestamp(Timestamp(0)) .iter() - .map(|log| &log.log_query), + .map(|log| glue_log_query(log.log_query)), ) .1 .into_iter() diff --git a/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs index 52a0dc61d740..00833e4e5e89 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_4_1::{ aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, diff --git a/core/lib/multivm/src/versions/vm_1_4_2/vm.rs b/core/lib/multivm/src/versions/vm_1_4_2/vm.rs index e7c8e7acdd95..ce649c221f39 100644 --- a/core/lib/multivm/src/versions/vm_1_4_2/vm.rs +++ b/core/lib/multivm/src/versions/vm_1_4_2/vm.rs @@ -1,6 +1,6 @@ use std::{mem, rc::Rc}; -use circuit_sequencer_api_1_4_2::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::{ l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, Transaction, @@ -15,7 +15,7 @@ use crate::{ FinishedL1Batch, L1BatchEnv, L2BlockEnv, PushTransactionResult, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, }, - utils::events::extract_l2tol1logs_from_l1_messenger, + utils::{events::extract_l2tol1logs_from_l1_messenger, glue_log_query}, vm_1_4_2::{ bootloader_state::BootloaderState, old_vm::events::merge_events, @@ -60,8 +60,12 @@ impl Vm { let storage_log_queries = self.state.storage.get_final_log_queries(); - let deduped_storage_log_queries = - sort_storage_access_queries(storage_log_queries.iter().map(|log| &log.log_query)).1; + let deduped_storage_log_queries = sort_storage_access_queries( + storage_log_queries + .iter() + .map(|log| glue_log_query(log.log_query)), + ) + .1; CurrentExecutionState { events, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_capacity.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_capacity.rs index a9e5e17e7973..bcc0ec48be0a 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_capacity.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/circuits_capacity.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_4_0::{geometry_config::get_geometry_config, toolset::GeometryConfig}; +use circuit_sequencer_api::geometry_config::{GeometryConfig, ProtocolGeometry}; use crate::{interface::CircuitStatistic, utils::CircuitCycleStatistic}; @@ -40,7 +40,7 @@ pub(crate) const UMA_READ_RAM_CYCLES: u32 = 3; pub(crate) const PRECOMPILE_RAM_CYCLES: u32 = 1; pub(crate) const PRECOMPILE_LOG_DEMUXER_CYCLES: u32 = 1; -const GEOMETRY_CONFIG: GeometryConfig = get_geometry_config(); +const GEOMETRY_CONFIG: GeometryConfig = ProtocolGeometry::V1_4_0.config(); pub(crate) fn circuit_statistic_from_cycles(cycles: CircuitCycleStatistic) -> CircuitStatistic { CircuitStatistic { diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs index 6396d143b401..c442f5705d2e 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/tracers/pubdata_tracer.rs @@ -1,6 +1,6 @@ use std::marker::PhantomData; -use circuit_sequencer_api_1_4_0::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_4_0::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, @@ -24,6 +24,7 @@ use crate::{ extract_bytecode_publication_requests_from_l1_messenger, extract_l2tol1logs_from_l1_messenger, }, + glue_log_query, }, vm_boojum_integration::{ bootloader_state::{utils::apply_pubdata_to_memory, BootloaderState}, @@ -121,7 +122,7 @@ impl PubdataTracer { storage .storage_log_queries_after_timestamp(Timestamp(0)) .iter() - .map(|log| &log.log_query), + .map(|log| glue_log_query(log.log_query)), ) .1 .into_iter() diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs index dc41926c4485..f225a91506ee 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_4_0::{ aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, diff --git a/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs b/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs index 43c9900486db..42129ab5a9e6 100644 --- a/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs +++ b/core/lib/multivm/src/versions/vm_boojum_integration/vm.rs @@ -1,6 +1,6 @@ use std::rc::Rc; -use circuit_sequencer_api_1_4_0::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::{ l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, Transaction, @@ -15,7 +15,7 @@ use crate::{ FinishedL1Batch, L1BatchEnv, L2BlockEnv, PushTransactionResult, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, }, - utils::events::extract_l2tol1logs_from_l1_messenger, + utils::{events::extract_l2tol1logs_from_l1_messenger, glue_log_query}, vm_boojum_integration::{ bootloader_state::BootloaderState, old_vm::events::merge_events, @@ -60,8 +60,12 @@ impl Vm { let storage_log_queries = self.state.storage.get_final_log_queries(); - let deduped_storage_log_queries = - sort_storage_access_queries(storage_log_queries.iter().map(|log| &log.log_query)).1; + let deduped_storage_log_queries = sort_storage_access_queries( + storage_log_queries + .iter() + .map(|log| glue_log_query(log.log_query)), + ) + .1; CurrentExecutionState { events, diff --git a/core/lib/multivm/src/versions/vm_fast/bootloader_state/state.rs b/core/lib/multivm/src/versions/vm_fast/bootloader_state/state.rs index 5fb8a9eb4d7c..be4f2881297d 100644 --- a/core/lib/multivm/src/versions/vm_fast/bootloader_state/state.rs +++ b/core/lib/multivm/src/versions/vm_fast/bootloader_state/state.rs @@ -206,6 +206,7 @@ impl BootloaderState { pubdata_builder, pubdata_information, self.protocol_version, + self.subversion, ); initial_memory } diff --git a/core/lib/multivm/src/versions/vm_fast/bootloader_state/utils.rs b/core/lib/multivm/src/versions/vm_fast/bootloader_state/utils.rs index 9fad4ddce45a..08ca72a4fb1a 100644 --- a/core/lib/multivm/src/versions/vm_fast/bootloader_state/utils.rs +++ b/core/lib/multivm/src/versions/vm_fast/bootloader_state/utils.rs @@ -152,8 +152,8 @@ pub(crate) fn apply_pubdata_to_memory( pubdata_builder: &dyn PubdataBuilder, pubdata_information: &PubdataInput, protocol_version: ProtocolVersionId, + subversion: MultiVmSubversion, ) { - let subversion = MultiVmSubversion::try_from(VmVersion::from(protocol_version)).unwrap(); let (l1_messenger_pubdata_start_slot, pubdata) = match subversion { MultiVmSubversion::SmallBootloaderMemory | MultiVmSubversion::IncreasedBootloaderMemory => { // Skipping two slots as they will be filled by the bootloader itself: diff --git a/core/lib/multivm/src/versions/vm_fast/bytecode.rs b/core/lib/multivm/src/versions/vm_fast/bytecode.rs index 4dc52951c16c..aec5ed9ae301 100644 --- a/core/lib/multivm/src/versions/vm_fast/bytecode.rs +++ b/core/lib/multivm/src/versions/vm_fast/bytecode.rs @@ -7,7 +7,7 @@ use crate::{ utils::bytecode, }; -impl Vm { +impl Vm { /// Checks the last transaction has successfully published compressed bytecodes and returns `true` if there is at least one is still unknown. pub(crate) fn has_unpublished_bytecodes(&mut self) -> bool { self.bootloader_state diff --git a/core/lib/multivm/src/versions/vm_fast/hook.rs b/core/lib/multivm/src/versions/vm_fast/hook.rs index 8d385f94f3e1..b138c6d496d9 100644 --- a/core/lib/multivm/src/versions/vm_fast/hook.rs +++ b/core/lib/multivm/src/versions/vm_fast/hook.rs @@ -1,8 +1,8 @@ -#[derive(Debug)] +#[derive(Debug, Copy, Clone)] pub(crate) enum Hook { AccountValidationEntered, PaymasterValidationEntered, - AccountValidationExited, + ValidationExited, ValidationStepEnded, TxHasEnded, DebugLog, @@ -22,7 +22,7 @@ impl Hook { match hook { 0 => Hook::AccountValidationEntered, 1 => Hook::PaymasterValidationEntered, - 2 => Hook::AccountValidationExited, + 2 => Hook::ValidationExited, 3 => Hook::ValidationStepEnded, 4 => Hook::TxHasEnded, 5 => Hook::DebugLog, diff --git a/core/lib/multivm/src/versions/vm_fast/mod.rs b/core/lib/multivm/src/versions/vm_fast/mod.rs index 840653b63b08..dca575138553 100644 --- a/core/lib/multivm/src/versions/vm_fast/mod.rs +++ b/core/lib/multivm/src/versions/vm_fast/mod.rs @@ -1,19 +1,21 @@ pub use zksync_vm2::interface; pub(crate) use self::version::FastVmVersion; -pub use self::vm::Vm; +pub use self::{ + tracers::{FullValidationTracer, ValidationTracer}, + vm::Vm, +}; mod bootloader_state; mod bytecode; -mod circuits_tracer; mod events; -mod evm_deploy_tracer; mod glue; mod hook; mod initial_bootloader_memory; mod refund; #[cfg(test)] mod tests; +mod tracers; mod transaction_data; mod utils; mod version; diff --git a/core/lib/multivm/src/versions/vm_fast/tests/account_validation_rules.rs b/core/lib/multivm/src/versions/vm_fast/tests/account_validation_rules.rs new file mode 100644 index 000000000000..fa4b634a22f6 --- /dev/null +++ b/core/lib/multivm/src/versions/vm_fast/tests/account_validation_rules.rs @@ -0,0 +1,7 @@ +use super::TestedFastVm; +use crate::versions::testonly::account_validation_rules::test_account_validation_rules; + +#[test] +fn test_account_validation_rules_fast() { + test_account_validation_rules::>(); +} diff --git a/core/lib/multivm/src/versions/vm_fast/tests/mod.rs b/core/lib/multivm/src/versions/vm_fast/tests/mod.rs index 2093d0ec496f..e148444922ba 100644 --- a/core/lib/multivm/src/versions/vm_fast/tests/mod.rs +++ b/core/lib/multivm/src/versions/vm_fast/tests/mod.rs @@ -1,22 +1,25 @@ use std::{any::Any, collections::HashSet, fmt, rc::Rc}; use zksync_types::{ - h256_to_u256, writes::StateDiffRecord, StorageKey, Transaction, H160, H256, U256, + h256_to_u256, l2::L2Tx, writes::StateDiffRecord, StorageKey, Transaction, H160, H256, U256, }; -use zksync_vm2::interface::{Event, HeapId, StateInterface}; +use zksync_vm2::interface::{Event, HeapId, StateInterface, Tracer}; use zksync_vm_interface::{ pubdata::{PubdataBuilder, PubdataInput}, storage::ReadStorage, - CurrentExecutionState, L2BlockEnv, VmExecutionMode, VmExecutionResultAndLogs, VmInterface, + tracer::ViolatedValidationRule, + CurrentExecutionState, InspectExecutionMode, L2BlockEnv, VmExecutionMode, + VmExecutionResultAndLogs, VmInterface, }; -use super::{circuits_tracer::CircuitsTracer, Vm}; +use super::{FullValidationTracer, ValidationTracer, Vm}; use crate::{ interface::storage::{ImmutableStorageView, InMemoryStorage}, - versions::testonly::TestedVm, - vm_fast::evm_deploy_tracer::{DynamicBytecodes, EvmDeployTracer}, + versions::testonly::{validation_params, TestedVm, TestedVmForValidation}, + vm_fast::tracers::WithBuiltinTracers, }; +mod account_validation_rules; mod block_tip; mod bootloader; mod bytecode_publishing; @@ -80,7 +83,13 @@ impl PartialEq for VmStateDump { } } -impl TestedVm for Vm> { +pub(crate) type TestedFastVm = Vm, Tr, Val>; + +impl TestedVm for TestedFastVm +where + Tr: 'static + Tracer + Default + fmt::Debug, + Val: 'static + ValidationTracer + fmt::Debug, +{ type StateDump = VmStateDump; fn dump_state(&self) -> Self::StateDump { @@ -126,13 +135,9 @@ impl TestedVm for Vm> { } fn manually_decommit(&mut self, code_hash: H256) -> bool { - let mut tracer = ( - ((), CircuitsTracer::default()), - EvmDeployTracer::new(DynamicBytecodes::default()), - ); let (_, is_fresh) = self.inner.world_diff_mut().decommit_opcode( &mut self.world, - &mut tracer, + &mut WithBuiltinTracers::mock(), h256_to_u256(code_hash), ); is_fresh @@ -174,3 +179,13 @@ impl TestedVm for Vm> { self.bootloader_state.get_pubdata_information().clone() } } + +impl TestedVmForValidation for Vm, (), FullValidationTracer> { + fn run_validation(&mut self, tx: L2Tx, timestamp: u64) -> Option { + let validation_params = validation_params(&tx, &self.system_env); + self.push_transaction(tx.into()); + let mut tracer = ((), FullValidationTracer::new(validation_params, timestamp)); + self.inspect(&mut tracer, InspectExecutionMode::OneTx); + tracer.1.validation_error() + } +} diff --git a/core/lib/multivm/src/versions/vm_fast/circuits_tracer.rs b/core/lib/multivm/src/versions/vm_fast/tracers/circuits.rs similarity index 97% rename from core/lib/multivm/src/versions/vm_fast/circuits_tracer.rs rename to core/lib/multivm/src/versions/vm_fast/tracers/circuits.rs index 9c1c0b7dfb7f..5acf6c490abf 100644 --- a/core/lib/multivm/src/versions/vm_fast/circuits_tracer.rs +++ b/core/lib/multivm/src/versions/vm_fast/tracers/circuits.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_5_0::{geometry_config::get_geometry_config, toolset::GeometryConfig}; +use circuit_sequencer_api::geometry_config::{GeometryConfig, ProtocolGeometry}; use zksync_vm2::interface::{ CycleStats, GlobalStateInterface, Opcode, OpcodeType, ShouldStop, Tracer, }; @@ -164,4 +164,4 @@ impl CircuitsTracer { } } -const GEOMETRY_CONFIG: GeometryConfig = get_geometry_config(); +const GEOMETRY_CONFIG: GeometryConfig = ProtocolGeometry::V1_5_0.config(); diff --git a/core/lib/multivm/src/versions/vm_fast/evm_deploy_tracer.rs b/core/lib/multivm/src/versions/vm_fast/tracers/evm_deploy.rs similarity index 66% rename from core/lib/multivm/src/versions/vm_fast/evm_deploy_tracer.rs rename to core/lib/multivm/src/versions/vm_fast/tracers/evm_deploy.rs index c443c99ccf9a..1202b5b94dd2 100644 --- a/core/lib/multivm/src/versions/vm_fast/evm_deploy_tracer.rs +++ b/core/lib/multivm/src/versions/vm_fast/tracers/evm_deploy.rs @@ -8,14 +8,14 @@ use zksync_vm2::interface::{ CallframeInterface, CallingMode, GlobalStateInterface, Opcode, OpcodeType, ShouldStop, Tracer, }; -use super::utils::read_fat_pointer; +use crate::vm_fast::utils::read_fat_pointer; /// Container for dynamic bytecodes added by [`EvmDeployTracer`]. #[derive(Debug, Clone, Default)] -pub(super) struct DynamicBytecodes(Rc>>>); +pub(crate) struct DynamicBytecodes(Rc>>>); impl DynamicBytecodes { - pub(super) fn map(&self, hash: U256, f: impl FnOnce(&[u8]) -> R) -> Option { + pub(crate) fn map(&self, hash: U256, f: impl FnOnce(&[u8]) -> R) -> Option { self.0.borrow().get(&hash).map(|code| f(code)) } @@ -37,8 +37,10 @@ pub(super) struct EvmDeployTracer { impl EvmDeployTracer { pub(super) fn new(bytecodes: DynamicBytecodes) -> Self { - let tracked_signature = - ethabi::short_signature("publishEVMBytecode", &[ethabi::ParamType::Bytes]); + let tracked_signature = ethabi::short_signature( + "publishEVMBytecode", + &[ethabi::ParamType::Uint(256), ethabi::ParamType::Bytes], + ); Self { tracked_signature, bytecodes, @@ -61,13 +63,26 @@ impl EvmDeployTracer { return; } - match ethabi::decode(&[ethabi::ParamType::Bytes], data) { + match ethabi::decode( + &[ethabi::ParamType::Uint(256), ethabi::ParamType::Bytes], + data, + ) { Ok(decoded) => { // `unwrap`s should be safe since the function signature is checked above. - let published_bytecode = decoded.into_iter().next().unwrap().into_bytes().unwrap(); - let bytecode_hash = - BytecodeHash::for_evm_bytecode(&published_bytecode).value_u256(); - self.bytecodes.insert(bytecode_hash, published_bytecode); + let mut decoded_iter = decoded.into_iter(); + let raw_bytecode_len = decoded_iter.next().unwrap().into_uint().unwrap().try_into(); + match raw_bytecode_len { + Ok(raw_bytecode_len) => { + let published_bytecode = decoded_iter.next().unwrap().into_bytes().unwrap(); + let bytecode_hash = + BytecodeHash::for_evm_bytecode(raw_bytecode_len, &published_bytecode) + .value_u256(); + self.bytecodes.insert(bytecode_hash, published_bytecode); + } + Err(err) => { + tracing::error!("Invalid bytecode len in `publishEVMBytecode` call: {err}") + } + } } Err(err) => tracing::error!("Unable to decode `publishEVMBytecode` call: {err}"), } diff --git a/core/lib/multivm/src/versions/vm_fast/tracers/mod.rs b/core/lib/multivm/src/versions/vm_fast/tracers/mod.rs new file mode 100644 index 000000000000..3d9602536743 --- /dev/null +++ b/core/lib/multivm/src/versions/vm_fast/tracers/mod.rs @@ -0,0 +1,86 @@ +//! Tracers for the fast VM. + +use zksync_vm2::interface::{CycleStats, GlobalStateInterface, OpcodeType, ShouldStop, Tracer}; + +pub(super) use self::evm_deploy::DynamicBytecodes; +pub use self::validation::{FullValidationTracer, ValidationTracer}; +use self::{circuits::CircuitsTracer, evm_deploy::EvmDeployTracer}; +use crate::interface::CircuitStatistic; + +mod circuits; +mod evm_deploy; +mod validation; + +#[derive(Debug)] +pub(super) struct WithBuiltinTracers { + pub external: Ext, + pub validation: Val, + circuits: CircuitsTracer, + evm_deploy_tracer: EvmDeployTracer, +} + +impl WithBuiltinTracers { + pub(super) fn new(external: Tr, validation: Val, dynamic_bytecodes: DynamicBytecodes) -> Self { + Self { + external, + validation, + circuits: CircuitsTracer::default(), + evm_deploy_tracer: EvmDeployTracer::new(dynamic_bytecodes), + } + } + + pub(super) fn circuit_statistic(&self) -> CircuitStatistic { + self.circuits.circuit_statistic() + } +} + +#[cfg(test)] +impl WithBuiltinTracers { + pub(super) fn mock() -> Self { + Self::new(Tr::default(), Val::default(), DynamicBytecodes::default()) + } +} + +impl Tracer for WithBuiltinTracers { + #[inline(always)] + fn before_instruction(&mut self, state: &mut S) { + self.validation.before_instruction::(state); + self.external.before_instruction::(state); + self.circuits.before_instruction::(state); + self.evm_deploy_tracer.before_instruction::(state); + } + + #[inline(always)] + fn after_instruction( + &mut self, + state: &mut S, + ) -> ShouldStop { + if matches!( + self.validation.after_instruction::(state), + ShouldStop::Stop + ) { + return ShouldStop::Stop; + } + if matches!( + self.external.after_instruction::(state), + ShouldStop::Stop + ) { + return ShouldStop::Stop; + } + if matches!( + self.circuits.after_instruction::(state), + ShouldStop::Stop + ) { + return ShouldStop::Stop; + } + self.evm_deploy_tracer.after_instruction::(state) + } + + #[inline(always)] + fn on_extra_prover_cycles(&mut self, stats: CycleStats) { + self.validation.on_extra_prover_cycles(stats); + self.external.on_extra_prover_cycles(stats); + self.circuits.on_extra_prover_cycles(stats); + self.evm_deploy_tracer.on_extra_prover_cycles(stats); + } +} diff --git a/core/lib/multivm/src/versions/vm_fast/tracers/validation.rs b/core/lib/multivm/src/versions/vm_fast/tracers/validation.rs new file mode 100644 index 000000000000..52b0a4747b7d --- /dev/null +++ b/core/lib/multivm/src/versions/vm_fast/tracers/validation.rs @@ -0,0 +1,296 @@ +use std::collections::HashSet; + +use zk_evm_1_3_1::address_to_u256; +use zksync_types::{ + u256_to_address, Address, ACCOUNT_CODE_STORAGE_ADDRESS, BOOTLOADER_ADDRESS, + CONTRACT_DEPLOYER_ADDRESS, KECCAK256_PRECOMPILE_ADDRESS, L2_BASE_TOKEN_ADDRESS, + MSG_VALUE_SIMULATOR_ADDRESS, SYSTEM_CONTEXT_ADDRESS, U256, +}; +use zksync_vm2::interface::{ + CallframeInterface, GlobalStateInterface, Opcode::*, OpcodeType, ReturnType::*, ShouldStop, + Tracer, +}; +use zksync_vm_interface::tracer::{ + TimestampAsserterParams, ValidationParams, ValidationTraces, ViolatedValidationRule, +}; + +use crate::{tracers::TIMESTAMP_ASSERTER_FUNCTION_SELECTOR, vm_fast::utils::read_fat_pointer}; + +/// [`Tracer`] used for account validation per [EIP-4337] and [EIP-7562]. +/// +/// [EIP-4337]: https://eips.ethereum.org/EIPS/eip-4337 +/// [EIP-7562]: https://eips.ethereum.org/EIPS/eip-7562 +pub trait ValidationTracer: Tracer + Default { + /// Should the execution stop after validation is complete? + const STOP_AFTER_VALIDATION: bool; + /// Hook called when account validation is entered. + fn account_validation_entered(&mut self); + /// Hook called when account validation is exited. + fn validation_exited(&mut self); +} + +impl ValidationTracer for () { + const STOP_AFTER_VALIDATION: bool = false; + fn account_validation_entered(&mut self) {} + fn validation_exited(&mut self) {} +} + +/// Account abstraction exposes a chain to denial of service attacks because someone who fails to +/// authenticate does not pay for the failed transaction. Otherwise, people could empty other's +/// wallets for free! +/// +/// If some address repeatedly posts transactions that validate during preliminary checks but fail +/// to validate during the actual execution, that address is considered a spammer. However, when +/// the spam comes from multiple addresses, that doesn't work. +/// +/// We want to ensure that a spammer has to pay for every account that fails validation. This is +/// achieved by limiting what the code of a custom account is allowed to do. If we allowed access +/// to things like time, a validation that fails in the sequencer could be crafted for free, so we +/// don't. +/// +/// However, we want to give access to storage. A spammer has to pay for changing storage but +/// could change just one storage slot to invalidate transactions from many accounts. To prevent +/// that, we make sure that the storage slots accessed by different accounts are disjoint by only +/// allowing access to storage in the account itself and slots derived from the account's address. +/// +/// Our rules are an extension of the rules are outlined in [EIP-7562]. +/// +/// This tracer enforces the rules by checking what the code does at runtime, even though the +/// properties checked are supposed to always hold for a well-written custom account. Proving +/// that a contract adheres to the rules ahead of time would be challenging or even impossible, +/// considering that contracts that the code depends on may get upgraded. +/// +/// [EIP-7562]: https://eips.ethereum.org/EIPS/eip-7562 +#[derive(Debug, Default)] +pub struct FullValidationTracer { + in_validation: bool, + add_return_value_to_allowed_slots: bool, + + slots_obtained_via_keccak: HashSet, + trusted_addresses: HashSet
, + + user_address: Address, + trusted_storage: HashSet<(Address, U256)>, + /// These location's values are added to [Self::trusted_addresses] to support upgradeable proxies. + storage_containing_trusted_addresses: HashSet<(Address, U256)>, + timestamp_asserter_params: Option, + l1_batch_timestamp: u64, + + validation_error: Option, + traces: ValidationTraces, +} + +impl ValidationTracer for FullValidationTracer { + const STOP_AFTER_VALIDATION: bool = true; + + fn account_validation_entered(&mut self) { + self.in_validation = true; + } + + fn validation_exited(&mut self) { + self.in_validation = false; + } +} + +impl Tracer for FullValidationTracer { + fn before_instruction(&mut self, state: &mut S) { + if !self.in_validation { + return; + } + + match OP::VALUE { + // Out of gas once means out of gas for the whole validation, as the EIP forbids handling out of gas errors + Ret(Panic) if state.current_frame().gas() == 0 => { + self.set_error(ViolatedValidationRule::TookTooManyComputationalGas(0)) + } + + ContextMeta => self.set_error(ViolatedValidationRule::TouchedDisallowedContext), + + StorageRead => { + let address = state.current_frame().address(); + let caller = state.current_frame().caller(); + + // Can unwrap because the instruction pointer does not point to a panic instruction + let pc = state.current_frame().program_counter().unwrap(); + let word = pc / 4; + let part = pc % 4; + let instruction = + state.current_frame().read_contract_code(word).0[3 - part as usize]; + let slot = state.read_register((instruction >> 16) as u8 & 0b1111).0; + + if self + .storage_containing_trusted_addresses + .contains(&(address, slot)) + { + self.trusted_addresses + .insert(u256_to_address(&state.get_storage(address, slot))); + } else if !self.is_valid_storage_read( + address, + caller, + slot, + state.get_storage(address, slot), + ) { + self.set_error(ViolatedValidationRule::TouchedDisallowedStorageSlots( + address, slot, + )) + } + } + + _ => {} + } + } + + fn after_instruction( + &mut self, + state: &mut S, + ) -> ShouldStop { + if !self.in_validation { + return ShouldStop::Continue; + } + + if self.validation_error.is_some() { + return ShouldStop::Stop; + } + + match OP::VALUE { + FarCall(_) => { + // Intercept calls to keccak, whitelist storage slots corresponding to the hash + let code_address = state.current_frame().code_address(); + if code_address == KECCAK256_PRECOMPILE_ADDRESS { + let calldata = read_fat_pointer(state, state.read_register(1).0); + if calldata.len() != 64 { + return ShouldStop::Continue; + } + + // Solidity mappings store values at the keccak256 hash of `key ++ slot_of_mapping` + let (key, mapping) = calldata.split_at(32); + + let mapping_is_allowed = + self.slots_obtained_via_keccak.contains(&mapping.into()); + + if U256::from(key) == address_to_u256(&self.user_address) || mapping_is_allowed + { + self.add_return_value_to_allowed_slots = true; + } + } else if code_address != self.user_address + && state + .get_storage(ACCOUNT_CODE_STORAGE_ADDRESS, address_to_u256(&code_address)) + .is_zero() + { + self.set_error(ViolatedValidationRule::CalledContractWithNoCode( + code_address, + )); + return ShouldStop::Stop; + } + + if let Some(ref params) = self.timestamp_asserter_params { + if code_address == params.address { + let calldata = read_fat_pointer(state, state.read_register(1).0); + if calldata.len() == 68 + && calldata[..4] == TIMESTAMP_ASSERTER_FUNCTION_SELECTOR + { + // start and end need to be capped to u64::MAX to avoid overflow + let start = U256::from_big_endian( + &calldata[calldata.len() - 64..calldata.len() - 32], + ) + .try_into() + .unwrap_or(u64::MAX); + let end = U256::from_big_endian(&calldata[calldata.len() - 32..]) + .try_into() + .unwrap_or(u64::MAX); + + // using self.l1_batch_env.timestamp is ok here because the tracer is always + // used in a oneshot execution mode + if end < self.l1_batch_timestamp + params.min_time_till_end.as_secs() { + self.set_error( + ViolatedValidationRule::TimestampAssertionCloseToRangeEnd, + ); + return ShouldStop::Stop; + } + + self.traces.apply_timestamp_asserter_range(start..end); + } + } + } + } + Ret(kind) => { + if self.add_return_value_to_allowed_slots && kind == Normal { + let return_value = read_fat_pointer(state, state.read_register(1).0); + self.slots_obtained_via_keccak + .insert(return_value.as_slice().into()); + } + self.add_return_value_to_allowed_slots = false; + } + _ => {} + } + + ShouldStop::Continue + } +} + +impl FullValidationTracer { + pub fn new(params: ValidationParams, l1_batch_timestamp: u64) -> Self { + let ValidationParams { + user_address, + trusted_slots, + trusted_addresses, + trusted_address_slots, + timestamp_asserter_params, + .. + } = params; + Self { + user_address, + trusted_storage: trusted_slots, + trusted_addresses, + storage_containing_trusted_addresses: trusted_address_slots, + l1_batch_timestamp, + timestamp_asserter_params, + + ..Self::default() + } + } + + fn is_valid_storage_read( + &self, + address: Address, + caller: Address, + slot: U256, + value: U256, + ) -> bool { + // allow reading own slots + address == self.user_address + // allow reading slot + || slot == address_to_u256(&self.user_address) + || self.slots_obtained_via_keccak.contains(&slot) + // some storage locations are always allowed + || self.trusted_addresses.contains(&address) + || self.trusted_storage.contains(&(address, slot)) + // certain system contracts are allowed to transfer ETH + || address == L2_BASE_TOKEN_ADDRESS + && (caller == MSG_VALUE_SIMULATOR_ADDRESS + || caller == CONTRACT_DEPLOYER_ADDRESS + || caller == BOOTLOADER_ADDRESS) + // allow getting chain_id + || address == SYSTEM_CONTEXT_ADDRESS && slot == U256::zero() + // allow reading code hashes of existing contracts + || address == ACCOUNT_CODE_STORAGE_ADDRESS && !value.is_zero() + // allow TimestampAsserter to do its job + || self.timestamp_asserter_params.as_ref() + .map(|p| p.address == caller) + .unwrap_or_default() + } + + fn set_error(&mut self, error: ViolatedValidationRule) { + if self.validation_error.is_none() { + self.validation_error = Some(error); + } + } + + pub fn validation_error(&self) -> Option { + self.validation_error.clone() + } + + pub fn traces(&self) -> ValidationTraces { + self.traces.clone() + } +} diff --git a/core/lib/multivm/src/versions/vm_fast/vm.rs b/core/lib/multivm/src/versions/vm_fast/vm.rs index e2439c4c8060..6b14409a2e08 100644 --- a/core/lib/multivm/src/versions/vm_fast/vm.rs +++ b/core/lib/multivm/src/versions/vm_fast/vm.rs @@ -27,10 +27,9 @@ use zksync_vm2::{ use super::{ bootloader_state::{BootloaderState, BootloaderStateSnapshot}, bytecode::compress_bytecodes, - circuits_tracer::CircuitsTracer, - evm_deploy_tracer::{DynamicBytecodes, EvmDeployTracer}, hook::Hook, initial_bootloader_memory::bootloader_initial_memory, + tracers::{DynamicBytecodes, ValidationTracer, WithBuiltinTracers}, transaction_data::TransactionData, }; use crate::{ @@ -59,8 +58,6 @@ use crate::{ VmVersion, }; -type FullTracer = ((Tr, CircuitsTracer), EvmDeployTracer); - #[derive(Debug)] struct VmRunResult { execution_result: ExecutionResult, @@ -86,15 +83,18 @@ impl VmRunResult { } } +type InnerVm = + VirtualMachine, World>>; + /// Fast VM wrapper. /// -/// The wrapper is parametric by the storage and tracer types. Besides the [`Tracer`] trait, a tracer must have `'static` lifetime -/// and implement [`Default`] (the latter is necessary to complete batches). [`CircuitsTracer`] is currently always enabled; -/// you don't need to specify it explicitly. -pub struct Vm { - pub(super) world: World>, - pub(super) inner: VirtualMachine, World>>, - gas_for_account_validation: u32, +/// The wrapper is parametric by the storage and tracer types. Besides the [`Tracer`] trait, the tracer must implement [`Default`] +/// (the latter is necessary to complete batches). Validation is encapsulated in a separate type param. It should be set to `()` +/// for "standard" validation (not stopping after validation; no validation-specific checks), or [`FullValidationTracer`](super::FullValidationTracer) +/// for full validation (stopping after validation; validation-specific checks). +pub struct Vm { + pub(super) world: World>, + pub(super) inner: InnerVm, pub(super) bootloader_state: BootloaderState, pub(super) batch_env: L1BatchEnv, pub(super) system_env: SystemEnv, @@ -104,7 +104,7 @@ pub struct Vm { enforced_state_diffs: Option>, } -impl Vm { +impl Vm { pub fn custom(batch_env: L1BatchEnv, system_env: SystemEnv, storage: S) -> Self { let vm_version: FastVmVersion = VmVersion::from(system_env.version) .try_into() @@ -162,7 +162,6 @@ impl Vm { let mut this = Self { world: World::new(storage, program_cache), inner, - gas_for_account_validation: system_env.default_validation_computational_gas_limit, bootloader_state: BootloaderState::new( system_env.execution_mode, bootloader_memory.clone(), @@ -180,13 +179,218 @@ impl Vm { this } + fn get_hook_params(&self) -> [U256; 3] { + (get_vm_hook_params_start_position(self.vm_version.into()) + ..get_vm_hook_params_start_position(self.vm_version.into()) + VM_HOOK_PARAMS_COUNT) + .map(|word| self.read_word_from_bootloader_heap(word as usize)) + .collect::>() + .try_into() + .unwrap() + } + + fn get_tx_result(&self) -> U256 { + let tx_idx = self.bootloader_state.current_tx(); + let slot = get_result_success_first_slot(self.vm_version.into()) as usize + tx_idx; + self.read_word_from_bootloader_heap(slot) + } + + fn get_debug_log(&self) -> (String, String) { + let hook_params = self.get_hook_params(); + let mut msg = u256_to_h256(hook_params[0]).as_bytes().to_vec(); + // Trim 0 byte padding at the end. + while msg.last() == Some(&0) { + msg.pop(); + } + + let data = hook_params[1]; + let msg = String::from_utf8(msg).expect("Invalid debug message"); + + // For long data, it is better to use hex-encoding for greater readability + let data_str = if data > U256::from(u64::MAX) { + format!("0x{data:x}") + } else { + data.to_string() + }; + (msg, data_str) + } + + /// Should only be used when the bootloader is executing (e.g., when handling hooks). + pub(crate) fn read_word_from_bootloader_heap(&self, word: usize) -> U256 { + let start_address = word as u32 * 32; + self.inner.read_heap_u256(HeapId::FIRST, start_address) + } + + fn read_bytes_from_heap(&self, ptr: FatPointer) -> Vec { + assert_eq!(ptr.offset, 0); + (ptr.start..ptr.start + ptr.length) + .map(|addr| self.inner.read_heap_byte(ptr.memory_page, addr)) + .collect() + } + + pub(crate) fn has_previous_far_calls(&mut self) -> bool { + let callframe_count = self.inner.number_of_callframes(); + (1..callframe_count).any(|i| !self.inner.callframe(i).is_near_call()) + } + + /// Should only be used when the bootloader is executing (e.g., when handling hooks). + pub(crate) fn write_to_bootloader_heap( + &mut self, + memory: impl IntoIterator, + ) { + assert!( + !self.has_previous_far_calls(), + "Cannot write to bootloader heap when not in root call frame" + ); + + for (slot, value) in memory { + let start_address = slot as u32 * 32; + self.inner + .write_heap_u256(HeapId::FIRST, start_address, value); + } + } + + pub(crate) fn insert_bytecodes<'a>(&mut self, bytecodes: impl IntoIterator) { + for code in bytecodes { + let hash = BytecodeHash::for_bytecode(code).value_u256(); + self.world.bytecode_cache.insert(hash, code.into()); + } + } + + pub(crate) fn push_transaction_inner( + &mut self, + tx: zksync_types::Transaction, + refund: u64, + with_compression: bool, + ) { + let tx: TransactionData = tx.into(); + let overhead = tx.overhead_gas(); + + self.insert_bytecodes(tx.factory_deps.iter().map(|dep| &dep[..])); + + let compressed_bytecodes = if is_l1_tx_type(tx.tx_type) || !with_compression { + // L1 transactions do not need compression + vec![] + } else { + compress_bytecodes(&tx.factory_deps, |hash| { + self.inner + .world_diff() + .get_storage_state() + .get(&(KNOWN_CODES_STORAGE_ADDRESS, h256_to_u256(hash))) + .map(|x| !x.is_zero()) + .unwrap_or_else(|| self.world.storage.is_bytecode_known(&hash)) + }) + }; + + let trusted_ergs_limit = tx.trusted_ergs_limit(); + + let memory = self.bootloader_state.push_tx( + tx, + overhead, + refund, + compressed_bytecodes, + trusted_ergs_limit, + self.system_env.chain_id, + ); + + self.write_to_bootloader_heap(memory); + } + + #[cfg(test)] + pub(super) fn enforce_state_diffs(&mut self, diffs: Vec) { + self.enforced_state_diffs = Some(diffs); + } + + fn compute_state_diffs(&mut self) -> Vec { + #[cfg(test)] + if let Some(enforced_diffs) = self.enforced_state_diffs.take() { + return enforced_diffs; + } + + let storage = &mut self.world.storage; + let diffs = + self.inner + .world_diff() + .get_storage_changes() + .map(move |((address, key), change)| { + let storage_key = + StorageKey::new(AccountTreeId::new(address), u256_to_h256(key)); + StateDiffRecord { + address, + key, + derived_key: LogQuery::derive_final_address_for_params(&address, &key), + enumeration_index: storage + .get_enumeration_index(&storage_key) + .unwrap_or_default(), + initial_value: change.before, + final_value: change.after, + } + }); + diffs + .filter(|diff| diff.address != L1_MESSENGER_ADDRESS) + .collect() + } + + pub(crate) fn decommitted_hashes(&self) -> impl Iterator + '_ { + self.inner.world_diff().decommitted_hashes() + } + + pub(super) fn gas_remaining(&mut self) -> u32 { + self.inner.current_frame().gas() + } + + // visible for testing + pub(super) fn get_current_execution_state(&self) -> CurrentExecutionState { + let world_diff = self.inner.world_diff(); + let vm = &self.inner; + let events = merge_events(vm.events(), self.batch_env.number); + + let user_l2_to_l1_logs = extract_l2tol1logs_from_l1_messenger(&events) + .into_iter() + .map(Into::into) + .map(UserL2ToL1Log) + .collect(); + + CurrentExecutionState { + events, + deduplicated_storage_logs: world_diff + .get_storage_changes() + .map(|((address, key), change)| StorageLog { + key: StorageKey::new(AccountTreeId::new(address), u256_to_h256(key)), + value: u256_to_h256(change.after), + kind: StorageLogKind::RepeatedWrite, // Initialness doesn't matter here + }) + .collect(), + used_contract_hashes: self.decommitted_hashes().collect(), + system_logs: vm.l2_to_l1_logs().map(GlueInto::glue_into).collect(), + user_l2_to_l1_logs, + storage_refunds: world_diff.storage_refunds().to_vec(), + pubdata_costs: world_diff.pubdata_costs().to_vec(), + } + } +} + +struct AccountValidationGasSplit { + gas_given: u32, + gas_hidden: u32, +} + +impl Vm +where + S: ReadStorage, + Tr: Tracer + Default, + Val: ValidationTracer, +{ fn run( &mut self, execution_mode: VmExecutionMode, - tracer: &mut FullTracer, + tracer: &mut WithBuiltinTracers, track_refunds: bool, pubdata_builder: Option<&dyn PubdataBuilder>, ) -> VmRunResult { + let mut gas_left_for_account_validation = + self.system_env.default_validation_computational_gas_limit; + let mut account_validation_gas_split = None; + let mut refunds = Refunds { gas_refunded: 0, operator_suggested_refund: 0, @@ -228,10 +432,47 @@ impl Vm { } }; - match Hook::from_u32(hook) { - Hook::AccountValidationEntered | Hook::AccountValidationExited => { - // TODO (PLA-908): implement account validation + let hook = Hook::from_u32(hook); + match hook { + Hook::AccountValidationEntered => { + assert!( + account_validation_gas_split.is_none(), + "Account validation can't be nested" + ); + tracer.validation.account_validation_entered(); + + let gas = self.gas_remaining(); + let gas_given = gas.min(gas_left_for_account_validation); + account_validation_gas_split = Some(AccountValidationGasSplit { + gas_given, + gas_hidden: gas - gas_given, + }); + // As long as gasleft is allowed during account validation, + // the VM must not be used in the sequencer because a malicious + // account cause proving failure by checking if gasleft > 100k + self.inner.current_frame().set_gas(gas_given); + } + + Hook::ValidationExited => { + tracer.validation.validation_exited(); + + if let Some(AccountValidationGasSplit { + gas_given, + gas_hidden, + }) = account_validation_gas_split.take() + { + let gas_left = self.inner.current_frame().gas(); + gas_left_for_account_validation -= gas_given - gas_left; + self.inner.current_frame().set_gas(gas_left + gas_hidden); + } } + + Hook::ValidationStepEnded => { + if Val::STOP_AFTER_VALIDATION { + break (ExecutionResult::Success { output: vec![] }, true); + } + } + Hook::TxHasEnded => { if let VmExecutionMode::OneTx = execution_mode { // The bootloader may invoke `TxHasEnded` hook without posting a tx result previously. One case when this can happen @@ -356,6 +597,10 @@ impl Vm { state_diffs: self.compute_state_diffs(), }; + // Save the pubdata for the future initial bootloader memory building + self.bootloader_state + .set_pubdata_input(pubdata_input.clone()); + // Apply the pubdata to the current memory let mut memory_to_apply = vec![]; @@ -364,14 +609,12 @@ impl Vm { pubdata_builder.expect("`pubdata_builder` is required to finish batch"), &pubdata_input, self.system_env.version, + self.vm_version.into(), ); self.write_to_bootloader_heap(memory_to_apply); - - // Save the pubdata for the future initial bootloader memory building - self.bootloader_state.set_pubdata_input(pubdata_input); } - Hook::PaymasterValidationEntered | Hook::ValidationStepEnded => { /* unused */ } + Hook::PaymasterValidationEntered => { /* unused */ } Hook::DebugLog => { let (log, log_arg) = self.get_debug_log(); let last_tx = self.bootloader_state.last_l2_block().txs.last(); @@ -392,198 +635,9 @@ impl Vm { } } - fn get_hook_params(&self) -> [U256; 3] { - (get_vm_hook_params_start_position(self.vm_version.into()) - ..get_vm_hook_params_start_position(self.vm_version.into()) + VM_HOOK_PARAMS_COUNT) - .map(|word| self.read_word_from_bootloader_heap(word as usize)) - .collect::>() - .try_into() - .unwrap() - } - - fn get_tx_result(&self) -> U256 { - let tx_idx = self.bootloader_state.current_tx(); - let slot = get_result_success_first_slot(self.vm_version.into()) as usize + tx_idx; - self.read_word_from_bootloader_heap(slot) - } - - fn get_debug_log(&self) -> (String, String) { - let hook_params = self.get_hook_params(); - let mut msg = u256_to_h256(hook_params[0]).as_bytes().to_vec(); - // Trim 0 byte padding at the end. - while msg.last() == Some(&0) { - msg.pop(); - } - - let data = hook_params[1]; - let msg = String::from_utf8(msg).expect("Invalid debug message"); - - // For long data, it is better to use hex-encoding for greater readability - let data_str = if data > U256::from(u64::MAX) { - format!("0x{data:x}") - } else { - data.to_string() - }; - (msg, data_str) - } - - /// Should only be used when the bootloader is executing (e.g., when handling hooks). - pub(crate) fn read_word_from_bootloader_heap(&self, word: usize) -> U256 { - let start_address = word as u32 * 32; - self.inner.read_heap_u256(HeapId::FIRST, start_address) - } - - fn read_bytes_from_heap(&self, ptr: FatPointer) -> Vec { - assert_eq!(ptr.offset, 0); - (ptr.start..ptr.start + ptr.length) - .map(|addr| self.inner.read_heap_byte(ptr.memory_page, addr)) - .collect() - } - - pub(crate) fn has_previous_far_calls(&mut self) -> bool { - let callframe_count = self.inner.number_of_callframes(); - (1..callframe_count).any(|i| !self.inner.callframe(i).is_near_call()) - } - - /// Should only be used when the bootloader is executing (e.g., when handling hooks). - pub(crate) fn write_to_bootloader_heap( - &mut self, - memory: impl IntoIterator, - ) { - assert!( - !self.has_previous_far_calls(), - "Cannot write to bootloader heap when not in root call frame" - ); - - for (slot, value) in memory { - let start_address = slot as u32 * 32; - self.inner - .write_heap_u256(HeapId::FIRST, start_address, value); - } - } - - pub(crate) fn insert_bytecodes<'a>(&mut self, bytecodes: impl IntoIterator) { - for code in bytecodes { - let hash = BytecodeHash::for_bytecode(code).value_u256(); - self.world.bytecode_cache.insert(hash, code.into()); - } - } - - pub(crate) fn push_transaction_inner( - &mut self, - tx: zksync_types::Transaction, - refund: u64, - with_compression: bool, - ) { - let tx: TransactionData = tx.into(); - let overhead = tx.overhead_gas(); - - self.insert_bytecodes(tx.factory_deps.iter().map(|dep| &dep[..])); - - let compressed_bytecodes = if is_l1_tx_type(tx.tx_type) || !with_compression { - // L1 transactions do not need compression - vec![] - } else { - compress_bytecodes(&tx.factory_deps, |hash| { - self.inner - .world_diff() - .get_storage_state() - .get(&(KNOWN_CODES_STORAGE_ADDRESS, h256_to_u256(hash))) - .map(|x| !x.is_zero()) - .unwrap_or_else(|| self.world.storage.is_bytecode_known(&hash)) - }) - }; - - let trusted_ergs_limit = tx.trusted_ergs_limit(); - - let memory = self.bootloader_state.push_tx( - tx, - overhead, - refund, - compressed_bytecodes, - trusted_ergs_limit, - self.system_env.chain_id, - ); - - self.write_to_bootloader_heap(memory); - } - - #[cfg(test)] - pub(super) fn enforce_state_diffs(&mut self, diffs: Vec) { - self.enforced_state_diffs = Some(diffs); - } - - fn compute_state_diffs(&mut self) -> Vec { - #[cfg(test)] - if let Some(enforced_diffs) = self.enforced_state_diffs.take() { - return enforced_diffs; - } - - let storage = &mut self.world.storage; - let diffs = - self.inner - .world_diff() - .get_storage_changes() - .map(move |((address, key), change)| { - let storage_key = - StorageKey::new(AccountTreeId::new(address), u256_to_h256(key)); - StateDiffRecord { - address, - key, - derived_key: LogQuery::derive_final_address_for_params(&address, &key), - enumeration_index: storage - .get_enumeration_index(&storage_key) - .unwrap_or_default(), - initial_value: change.before, - final_value: change.after, - } - }); - diffs - .filter(|diff| diff.address != L1_MESSENGER_ADDRESS) - .collect() - } - - pub(crate) fn decommitted_hashes(&self) -> impl Iterator + '_ { - self.inner.world_diff().decommitted_hashes() - } - - pub(super) fn gas_remaining(&mut self) -> u32 { - self.inner.current_frame().gas() - } - - // visible for testing - pub(super) fn get_current_execution_state(&self) -> CurrentExecutionState { - let world_diff = self.inner.world_diff(); - let vm = &self.inner; - let events = merge_events(vm.events(), self.batch_env.number); - - let user_l2_to_l1_logs = extract_l2tol1logs_from_l1_messenger(&events) - .into_iter() - .map(Into::into) - .map(UserL2ToL1Log) - .collect(); - - CurrentExecutionState { - events, - deduplicated_storage_logs: world_diff - .get_storage_changes() - .map(|((address, key), change)| StorageLog { - key: StorageKey::new(AccountTreeId::new(address), u256_to_h256(key)), - value: u256_to_h256(change.after), - kind: StorageLogKind::RepeatedWrite, // Initialness doesn't matter here - }) - .collect(), - used_contract_hashes: self.decommitted_hashes().collect(), - system_logs: vm.l2_to_l1_logs().map(GlueInto::glue_into).collect(), - user_l2_to_l1_logs, - storage_refunds: world_diff.storage_refunds().to_vec(), - pubdata_costs: world_diff.pubdata_costs().to_vec(), - } - } - pub(crate) fn inspect_inner( &mut self, - tracer: &mut Tr, + tracer: &mut (Tr, Val), execution_mode: VmExecutionMode, pubdata_builder: Option<&dyn PubdataBuilder>, ) -> VmExecutionResultAndLogs { @@ -596,19 +650,18 @@ impl Vm { let start = self.inner.world_diff().snapshot(); let gas_before = self.gas_remaining(); + let (external, validation) = mem::take(tracer); + let mut full_tracer = + WithBuiltinTracers::new(external, validation, self.world.dynamic_bytecodes.clone()); - let mut full_tracer = ( - (mem::take(tracer), CircuitsTracer::default()), - EvmDeployTracer::new(self.world.dynamic_bytecodes.clone()), - ); let result = self.run( execution_mode, &mut full_tracer, track_refunds, pubdata_builder, ); - let ((external_tracer, circuits_tracer), _) = full_tracer; - *tracer = external_tracer; // place the tracer back + let circuit_statistic = full_tracer.circuit_statistic(); + *tracer = (full_tracer.external, full_tracer.validation); let ignore_world_diff = matches!(execution_mode, VmExecutionMode::OneTx) && result.should_ignore_vm_logs(); @@ -681,7 +734,7 @@ impl Vm { gas_remaining, computational_gas_used: gas_used, // since 1.5.0, this always has the same value as `gas_used` pubdata_published: result.pubdata_published, - circuit_statistic: circuits_tracer.circuit_statistic(), + circuit_statistic, contracts_used: 0, cycles_used: 0, total_log_queries: 0, @@ -692,10 +745,11 @@ impl Vm { } } -impl VmFactory> for Vm, Tr> +impl VmFactory> for Vm, Tr, Val> where S: ReadStorage, - Tr: Tracer + Default + 'static, + Tr: Tracer + Default, + Val: ValidationTracer, { fn new( batch_env: L1BatchEnv, @@ -707,8 +761,13 @@ where } } -impl VmInterface for Vm { - type TracerDispatcher = Tr; +impl VmInterface for Vm +where + S: ReadStorage, + Tr: Tracer + Default, + Val: ValidationTracer, +{ + type TracerDispatcher = (Tr, Val); fn push_transaction(&mut self, tx: Transaction) -> PushTransactionResult<'_> { self.push_transaction_inner(tx, 0, true); @@ -731,7 +790,7 @@ impl VmInterface for Vm { fn inspect_transaction_with_bytecode_compression( &mut self, tracer: &mut Self::TracerDispatcher, - tx: zksync_types::Transaction, + tx: Transaction, with_compression: bool, ) -> (BytecodeCompressionResult<'_>, VmExecutionResultAndLogs) { self.push_transaction_inner(tx, 0, with_compression); @@ -754,7 +813,7 @@ impl VmInterface for Vm { fn finish_batch(&mut self, pubdata_builder: Rc) -> FinishedL1Batch { let result = self.inspect_inner( - &mut Tr::default(), + &mut Default::default(), VmExecutionMode::Batch, Some(pubdata_builder.as_ref()), ); @@ -783,10 +842,14 @@ impl VmInterface for Vm { #[derive(Debug)] struct VmSnapshot { bootloader_snapshot: BootloaderStateSnapshot, - gas_for_account_validation: u32, } -impl VmInterfaceHistoryEnabled for Vm { +impl VmInterfaceHistoryEnabled for Vm +where + S: ReadStorage, + Tr: Tracer + Default, + Val: ValidationTracer, +{ fn make_snapshot(&mut self) { assert!( self.snapshot.is_none(), @@ -796,19 +859,16 @@ impl VmInterfaceHistoryEnabled f self.inner.make_snapshot(); self.snapshot = Some(VmSnapshot { bootloader_snapshot: self.bootloader_state.get_snapshot(), - gas_for_account_validation: self.gas_for_account_validation, }); } fn rollback_to_the_latest_snapshot(&mut self) { let VmSnapshot { bootloader_snapshot, - gas_for_account_validation, } = self.snapshot.take().expect("no snapshots to rollback to"); self.inner.rollback(); self.bootloader_state.apply_snapshot(bootloader_snapshot); - self.gas_for_account_validation = gas_for_account_validation; } fn pop_snapshot_no_rollback(&mut self) { @@ -817,19 +877,18 @@ impl VmInterfaceHistoryEnabled f } } -impl VmTrackingContracts for Vm { +impl VmTrackingContracts for Vm +where + Self: VmInterface, +{ fn used_contract_hashes(&self) -> Vec { self.decommitted_hashes().map(u256_to_h256).collect() } } -impl fmt::Debug for Vm { +impl fmt::Debug for Vm { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Vm") - .field( - "gas_for_account_validation", - &self.gas_for_account_validation, - ) .field("bootloader_state", &self.bootloader_state) .field("storage", &self.world.storage) .field("program_cache", &self.world.program_cache) diff --git a/core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs index 2719853e0024..8897ed2dc6e0 100644 --- a/core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs +++ b/core/lib/multivm/src/versions/vm_latest/bootloader_state/state.rs @@ -213,6 +213,7 @@ impl BootloaderState { pubdata_builder, pubdata_information, self.protocol_version, + self.subversion, ); initial_memory } diff --git a/core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs b/core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs index a1d45334e9bf..3766e53c73f0 100644 --- a/core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs +++ b/core/lib/multivm/src/versions/vm_latest/bootloader_state/utils.rs @@ -155,8 +155,8 @@ pub(crate) fn apply_pubdata_to_memory( pubdata_builder: &dyn PubdataBuilder, pubdata_information: &PubdataInput, protocol_version: ProtocolVersionId, + subversion: MultiVmSubversion, ) { - let subversion = MultiVmSubversion::try_from(VmVersion::from(protocol_version)).unwrap(); let (l1_messenger_pubdata_start_slot, pubdata) = match subversion { MultiVmSubversion::SmallBootloaderMemory | MultiVmSubversion::IncreasedBootloaderMemory => { // Skipping two slots as they will be filled by the bootloader itself: diff --git a/core/lib/multivm/src/versions/vm_latest/constants.rs b/core/lib/multivm/src/versions/vm_latest/constants.rs index a91090f21a69..f454ced06227 100644 --- a/core/lib/multivm/src/versions/vm_latest/constants.rs +++ b/core/lib/multivm/src/versions/vm_latest/constants.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_5_0::{BLOB_CHUNK_SIZE, ELEMENTS_PER_4844_BLOCK}; +use circuit_sequencer_api::{BLOB_CHUNK_SIZE, ELEMENTS_PER_4844_BLOCK}; use zk_evm_1_5_0::aux_structures::MemoryPage; pub use zk_evm_1_5_0::zkevm_opcode_defs::system_params::{ ERGS_PER_CIRCUIT, INITIAL_STORAGE_WRITE_PUBDATA_BYTES, diff --git a/core/lib/multivm/src/versions/vm_latest/tests/account_validation_rules.rs b/core/lib/multivm/src/versions/vm_latest/tests/account_validation_rules.rs new file mode 100644 index 000000000000..8ee6c06c1c69 --- /dev/null +++ b/core/lib/multivm/src/versions/vm_latest/tests/account_validation_rules.rs @@ -0,0 +1,8 @@ +use crate::{ + versions::testonly::account_validation_rules::test_account_validation_rules, vm_latest::Vm, +}; + +#[test] +fn test_account_validation_rules_legacy() { + test_account_validation_rules::>(); +} diff --git a/core/lib/multivm/src/versions/vm_latest/tests/mod.rs b/core/lib/multivm/src/versions/vm_latest/tests/mod.rs index aac3b1655b3a..0a89ddb0bf50 100644 --- a/core/lib/multivm/src/versions/vm_latest/tests/mod.rs +++ b/core/lib/multivm/src/versions/vm_latest/tests/mod.rs @@ -1,6 +1,7 @@ use std::{ collections::{HashMap, HashSet}, rc::Rc, + sync::Arc, }; use zk_evm_1_5_0::{ @@ -9,19 +10,24 @@ use zk_evm_1_5_0::{ zkevm_opcode_defs::{ContractCodeSha256Format, VersionedHashLen32}, }; use zksync_types::{ - bytecode::BytecodeHash, writes::StateDiffRecord, StorageKey, StorageValue, Transaction, H256, - U256, + bytecode::BytecodeHash, l2::L2Tx, vm::VmVersion, writes::StateDiffRecord, StorageKey, + StorageValue, Transaction, H256, U256, }; +use zksync_vm_interface::VmInterface; -use super::{HistoryEnabled, Vm}; +use super::{HistoryEnabled, ToTracerPointer, Vm}; use crate::{ interface::{ pubdata::{PubdataBuilder, PubdataInput}, storage::{InMemoryStorage, ReadStorage, StorageView, WriteStorage}, + tracer::ViolatedValidationRule, CurrentExecutionState, L2BlockEnv, VmExecutionMode, VmExecutionResultAndLogs, }, + tracers::ValidationTracer, utils::bytecode::bytes_to_be_words, - versions::testonly::{filter_out_base_system_contracts, TestedVm}, + versions::testonly::{ + filter_out_base_system_contracts, validation_params, TestedVm, TestedVmForValidation, + }, vm_latest::{ constants::BOOTLOADER_HEAP_PAGE, old_vm::{event_sink::InMemoryEventSink, history_recorder::HistoryRecorder}, @@ -36,6 +42,7 @@ mod bootloader; mod default_aa; // TODO - fix this test // `mod invalid_bytecode;` +mod account_validation_rules; mod block_tip; mod bytecode_publishing; mod call_tracer; @@ -195,6 +202,27 @@ impl TestedVm for TestedLatestVm { } } +impl TestedVmForValidation for TestedLatestVm { + fn run_validation(&mut self, tx: L2Tx, timestamp: u64) -> Option { + let validation_params = validation_params(&tx, &self.system_env); + self.push_transaction(tx.into()); + + let tracer = ValidationTracer::::new( + validation_params, + VmVersion::Vm1_5_0IncreasedBootloaderMemory, + timestamp, + ); + let mut failures = tracer.get_result(); + + self.inspect_inner( + &mut tracer.into_tracer_pointer().into(), + VmExecutionMode::OneTx, + None, + ); + Arc::make_mut(&mut failures).take() + } +} + #[derive(Clone, Debug)] pub(crate) struct ModifiedKeysMap(HashMap); diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_capacity.rs b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_capacity.rs index 0977a323d191..58cbf45407d5 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/circuits_capacity.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/circuits_capacity.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_5_0::{geometry_config::get_geometry_config, toolset::GeometryConfig}; +use circuit_sequencer_api::geometry_config::{GeometryConfig, ProtocolGeometry}; use crate::{interface::CircuitStatistic, utils::CircuitCycleStatistic}; @@ -52,7 +52,7 @@ pub(crate) const PRECOMPILE_LOG_DEMUXER_CYCLES: u32 = 1; pub(crate) const LOG_DECOMMIT_RAM_CYCLES: u32 = 1; pub(crate) const LOG_DECOMMIT_DECOMMITTER_SORTER_CYCLES: u32 = 1; -const GEOMETRY_CONFIG: GeometryConfig = get_geometry_config(); +const GEOMETRY_CONFIG: GeometryConfig = ProtocolGeometry::V1_5_0.config(); pub(crate) fn circuit_statistic_from_cycles(cycles: CircuitCycleStatistic) -> CircuitStatistic { CircuitStatistic { diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/evm_deploy_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/evm_deploy_tracer.rs index 2e6ab8089eb0..dd03a9427efa 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/evm_deploy_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/evm_deploy_tracer.rs @@ -27,14 +27,16 @@ use crate::{ #[derive(Debug)] pub(crate) struct EvmDeployTracer { tracked_signature: [u8; 4], - pending_bytecodes: Vec>, + pending_bytecodes: Vec<(usize, Vec)>, _phantom: PhantomData, } impl EvmDeployTracer { pub(crate) fn new() -> Self { - let tracked_signature = - ethabi::short_signature("publishEVMBytecode", &[ethabi::ParamType::Bytes]); + let tracked_signature = ethabi::short_signature( + "publishEVMBytecode", + &[ethabi::ParamType::Uint(256), ethabi::ParamType::Bytes], + ); Self { tracked_signature, @@ -77,10 +79,23 @@ impl DynTracer> for EvmDeployTracer { return; } - match ethabi::decode(&[ethabi::ParamType::Bytes], data) { + match ethabi::decode( + &[ethabi::ParamType::Uint(256), ethabi::ParamType::Bytes], + data, + ) { Ok(decoded) => { - let published_bytecode = decoded.into_iter().next().unwrap().into_bytes().unwrap(); - self.pending_bytecodes.push(published_bytecode); + let mut decoded_iter = decoded.into_iter(); + let raw_bytecode_len = decoded_iter.next().unwrap().into_uint().unwrap().try_into(); + match raw_bytecode_len { + Ok(raw_bytecode_len) => { + let published_bytecode = decoded_iter.next().unwrap().into_bytes().unwrap(); + self.pending_bytecodes + .push((raw_bytecode_len, published_bytecode)); + } + Err(err) => { + tracing::error!("Invalid bytecode len in `publishEVMBytecode` call: {err}") + } + } } Err(err) => tracing::error!("Unable to decode `publishEVMBytecode` call: {err}"), } @@ -94,8 +109,9 @@ impl VmTracer for EvmDeployTracer { _bootloader_state: &mut BootloaderState, ) -> TracerExecutionStatus { let timestamp = Timestamp(state.local_state.timestamp); - for published_bytecode in mem::take(&mut self.pending_bytecodes) { - let hash = BytecodeHash::for_evm_bytecode(&published_bytecode).value_u256(); + for (raw_bytecode_len, published_bytecode) in mem::take(&mut self.pending_bytecodes) { + let hash = + BytecodeHash::for_evm_bytecode(raw_bytecode_len, &published_bytecode).value_u256(); let as_words = bytes_to_be_words(&published_bytecode); state .decommittment_processor diff --git a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs index 3698914630dd..31309e6ff062 100644 --- a/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs +++ b/core/lib/multivm/src/versions/vm_latest/tracers/pubdata_tracer.rs @@ -1,6 +1,6 @@ use std::{marker::PhantomData, rc::Rc}; -use circuit_sequencer_api_1_5_0::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_5_0::{ aux_structures::Timestamp, tracing::{BeforeExecutionData, VmLocalStateData}, @@ -162,7 +162,7 @@ impl PubdataTracer { storage .storage_log_queries_after_timestamp(Timestamp(0)) .iter() - .map(|log| &log.log_query), + .map(|log| log.log_query), ) .1 .into_iter() @@ -242,6 +242,7 @@ impl VmTracer for PubdataTracer { .as_ref(), &pubdata_input, bootloader_state.protocol_version(), + self.subversion, ); // Save the pubdata for the future initial bootloader memory building diff --git a/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs index 03f306f36c52..63f06f4fd846 100644 --- a/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_latest/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_5_0::{ aux_structures::{MemoryPage, PubdataCost, Timestamp}, block_properties::BlockProperties, diff --git a/core/lib/multivm/src/versions/vm_latest/vm.rs b/core/lib/multivm/src/versions/vm_latest/vm.rs index 5e01e548916c..3914bfca17a2 100644 --- a/core/lib/multivm/src/versions/vm_latest/vm.rs +++ b/core/lib/multivm/src/versions/vm_latest/vm.rs @@ -1,6 +1,6 @@ use std::{collections::HashMap, rc::Rc}; -use circuit_sequencer_api_1_5_0::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::{ h256_to_u256, l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log}, @@ -124,7 +124,7 @@ impl Vm { let storage_log_queries = self.state.storage.get_final_log_queries(); let deduped_storage_log_queries = - sort_storage_access_queries(storage_log_queries.iter().map(|log| &log.log_query)).1; + sort_storage_access_queries(storage_log_queries.iter().map(|log| log.log_query)).1; CurrentExecutionState { events, diff --git a/core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs index 8eca2ef5cd86..0cf208e2a40e 100644 --- a/core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs @@ -1,14 +1,13 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; -use itertools::Itertools; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_3_1::aux_structures::{LogQuery, Timestamp}; use zksync_types::{StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use crate::{ glue::GlueInto, interface::VmEvent, - utils::bytecode::bytecode_len_in_bytes, + utils::{bytecode::bytecode_len_in_bytes, glue_log_query}, vm_m5::{ oracles::storage::storage_key_of_log, storage::Storage, utils::collect_storage_log_queries_after_timestamp, vm_instance::VmInstance, @@ -86,16 +85,11 @@ impl VmInstance { // To allow calling the `vm-1.3.3`s. method, the `v1.3.1`'s `LogQuery` has to be converted // to the `vm-1.3.3`'s `LogQuery`. Then, we need to convert it back. let deduplicated_logs: Vec = sort_storage_access_queries( - &storage_logs - .iter() - .map(|log| { - GlueInto::::glue_into(log.log_query) - }) - .collect_vec(), + storage_logs.iter().map(|log| glue_log_query(log.log_query)), ) .1 .into_iter() - .map(GlueInto::::glue_into) + .map(glue_log_query) .collect(); deduplicated_logs diff --git a/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs index 87a6b7ee0797..c74ddcb25e5f 100644 --- a/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_3_1::{ abstractions::{MAX_HEAP_PAGE_SIZE_IN_WORDS, MAX_MEMORY_BYTES}, aux_structures::{MemoryPage, Timestamp}, diff --git a/core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs b/core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs index 97bf290a2162..fb3e82a28243 100644 --- a/core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs +++ b/core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs @@ -1,14 +1,13 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; -use itertools::Itertools; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zk_evm_1_3_1::aux_structures::{LogQuery, Timestamp}; use zksync_types::{StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS}; use crate::{ glue::GlueInto, interface::VmEvent, - utils::bytecode::bytecode_len_in_bytes, + utils::{bytecode::bytecode_len_in_bytes, glue_log_query}, vm_m6::{ history_recorder::HistoryMode, oracles::storage::storage_key_of_log, storage::Storage, utils::collect_storage_log_queries_after_timestamp, VmInstance, @@ -80,16 +79,11 @@ impl VmInstance { // To allow calling the `vm-1.3.3`s. method, the `v1.3.1`'s `LogQuery` has to be converted // to the `vm-1.3.3`'s `LogQuery`. Then, we need to convert it back. let deduplicated_logs: Vec = sort_storage_access_queries( - &storage_logs - .iter() - .map(|log| { - GlueInto::::glue_into(log.log_query) - }) - .collect_vec(), + storage_logs.iter().map(|log| glue_log_query(log.log_query)), ) .1 .into_iter() - .map(GlueInto::::glue_into) + .map(glue_log_query) .collect(); deduplicated_logs diff --git a/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs b/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs index de0a28a00a5d..248e0fcf0401 100644 --- a/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs +++ b/core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_3_1::{ abstractions::{MAX_HEAP_PAGE_SIZE_IN_WORDS, MAX_MEMORY_BYTES}, aux_structures::{MemoryPage, Timestamp}, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs index 6776bc37c9d5..1c31c63d6893 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, diff --git a/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs b/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs index 81b0c52cce5e..bfe35b1189f8 100644 --- a/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs +++ b/core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs @@ -1,6 +1,6 @@ use std::rc::Rc; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::{l2_to_l1_log::UserL2ToL1Log, Transaction}; use zksync_vm_interface::{pubdata::PubdataBuilder, InspectExecutionMode}; @@ -12,6 +12,7 @@ use crate::{ FinishedL1Batch, L1BatchEnv, L2BlockEnv, PushTransactionResult, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, }, + utils::glue_log_query, vm_latest::HistoryEnabled, vm_refunds_enhancement::{ bootloader_state::BootloaderState, @@ -56,8 +57,12 @@ impl Vm { let storage_log_queries = self.state.storage.get_final_log_queries(); - let deduped_storage_log_queries = - sort_storage_access_queries(storage_log_queries.iter().map(|log| &log.log_query)).1; + let deduped_storage_log_queries = sort_storage_access_queries( + storage_log_queries + .iter() + .map(|log| glue_log_query(log.log_query)), + ) + .1; CurrentExecutionState { events, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs index 59aa837cd8fb..28d80b3d1116 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/tracers/refunds.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use vise::{Buckets, EncodeLabelSet, EncodeLabelValue, Family, Histogram, Metrics}; use zk_evm_1_3_3::{ aux_structures::Timestamp, @@ -18,7 +18,7 @@ use crate::{ L1BatchEnv, Refunds, VmEvent, VmExecutionResultAndLogs, }, tracers::dynamic::vm_1_3_3::DynTracer, - utils::bytecode::bytecode_len_in_bytes, + utils::{bytecode::bytecode_len_in_bytes, glue_log_query}, vm_virtual_blocks::{ bootloader_state::BootloaderState, constants::{BOOTLOADER_HEAP_PAGE, OPERATOR_REFUNDS_OFFSET, TX_GAS_LIMIT_OFFSET}, @@ -372,15 +372,15 @@ fn pubdata_published_for_writes( .storage .storage_log_queries_after_timestamp(from_timestamp); let (_, deduplicated_logs) = - sort_storage_access_queries(storage_logs.iter().map(|log| &log.log_query)); + sort_storage_access_queries(storage_logs.iter().map(|log| glue_log_query(log.log_query))); deduplicated_logs .into_iter() .filter_map(|log| { if log.rw_flag { - let key = storage_key_of_log(&log); + let key = storage_key_of_log(&glue_log_query(log)); let pre_paid = pre_paid_before_tx(&key); - let to_pay_by_user = state.storage.base_price_for_write(&log); + let to_pay_by_user = state.storage.base_price_for_write(&glue_log_query(log)); if to_pay_by_user > pre_paid { Some(to_pay_by_user - pre_paid) diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs index d1509bd016d8..c7ab344849f2 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/types/internals/vm_state.rs @@ -1,4 +1,4 @@ -use circuit_sequencer_api_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER; +use circuit_sequencer_api::INITIAL_MONOTONIC_CYCLE_COUNTER; use zk_evm_1_3_3::{ aux_structures::{MemoryPage, Timestamp}, block_properties::BlockProperties, diff --git a/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs b/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs index a2d18e10de44..cc255f550c55 100644 --- a/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs +++ b/core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs @@ -1,6 +1,6 @@ use std::rc::Rc; -use circuit_sequencer_api_1_3_3::sort_storage_access::sort_storage_access_queries; +use circuit_sequencer_api::sort_storage_access::sort_storage_access_queries; use zksync_types::{l2_to_l1_log::UserL2ToL1Log, Transaction}; use zksync_vm_interface::{pubdata::PubdataBuilder, InspectExecutionMode}; @@ -12,6 +12,7 @@ use crate::{ FinishedL1Batch, L1BatchEnv, L2BlockEnv, PushTransactionResult, SystemEnv, VmExecutionMode, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, }, + utils::glue_log_query, vm_latest::HistoryEnabled, vm_virtual_blocks::{ bootloader_state::BootloaderState, @@ -56,8 +57,12 @@ impl Vm { let storage_log_queries = self.state.storage.get_final_log_queries(); - let deduped_storage_log_queries = - sort_storage_access_queries(storage_log_queries.iter().map(|log| &log.log_query)).1; + let deduped_storage_log_queries = sort_storage_access_queries( + storage_log_queries + .iter() + .map(|log| glue_log_query(log.log_query)), + ) + .1; CurrentExecutionState { events, diff --git a/core/lib/multivm/src/vm_instance.rs b/core/lib/multivm/src/vm_instance.rs index 9de99a7eb116..97af38ea0347 100644 --- a/core/lib/multivm/src/vm_instance.rs +++ b/core/lib/multivm/src/vm_instance.rs @@ -1,7 +1,6 @@ use std::{mem, rc::Rc}; use zksync_types::{vm::VmVersion, ProtocolVersionId, Transaction}; -use zksync_vm2::interface::Tracer; use zksync_vm_interface::{pubdata::PubdataBuilder, InspectExecutionMode}; use crate::{ @@ -14,8 +13,8 @@ use crate::{ VmMemoryMetrics, }, tracers::TracerDispatcher, - vm_fast::FastVmVersion, - vm_latest::HistoryEnabled, + vm_fast::{self, interface::Tracer, FastVmVersion}, + vm_latest::{self, HistoryEnabled}, }; /// Enumeration encompassing all supported legacy VM versions. @@ -35,7 +34,7 @@ pub enum LegacyVmInstance { VmBoojumIntegration(crate::vm_boojum_integration::Vm, H>), Vm1_4_1(crate::vm_1_4_1::Vm, H>), Vm1_4_2(crate::vm_1_4_2::Vm, H>), - Vm1_5_0(crate::vm_latest::Vm, H>), + Vm1_5_0(vm_latest::Vm, H>), } macro_rules! dispatch_legacy_vm { @@ -191,29 +190,29 @@ impl LegacyVmInstance { Self::Vm1_4_2(vm) } VmVersion::Vm1_5_0SmallBootloaderMemory => { - let vm = crate::vm_latest::Vm::new_with_subversion( + let vm = vm_latest::Vm::new_with_subversion( l1_batch_env, system_env, storage_view, - crate::vm_latest::MultiVmSubversion::SmallBootloaderMemory, + vm_latest::MultiVmSubversion::SmallBootloaderMemory, ); Self::Vm1_5_0(vm) } VmVersion::Vm1_5_0IncreasedBootloaderMemory => { - let vm = crate::vm_latest::Vm::new_with_subversion( + let vm = vm_latest::Vm::new_with_subversion( l1_batch_env, system_env, storage_view, - crate::vm_latest::MultiVmSubversion::IncreasedBootloaderMemory, + vm_latest::MultiVmSubversion::IncreasedBootloaderMemory, ); Self::Vm1_5_0(vm) } VmVersion::VmGateway => { - let vm = crate::vm_latest::Vm::new_with_subversion( + let vm = vm_latest::Vm::new_with_subversion( l1_batch_env, system_env, storage_view, - crate::vm_latest::MultiVmSubversion::Gateway, + vm_latest::MultiVmSubversion::Gateway, ); Self::Vm1_5_0(vm) } @@ -227,19 +226,19 @@ impl LegacyVmInstance { } /// Fast VM shadowed by the latest legacy VM. -pub type ShadowedFastVm = ShadowVm< +pub type ShadowedFastVm = ShadowVm< S, - crate::vm_latest::Vm, HistoryEnabled>, - crate::vm_fast::Vm, Tr>, + vm_latest::Vm, HistoryEnabled>, + vm_fast::Vm, Tr, Val>, >; /// Fast VM variants. #[derive(Debug)] -pub enum FastVmInstance { +pub enum FastVmInstance { /// Fast VM running in isolation. - Fast(crate::vm_fast::Vm, Tr>), + Fast(vm_fast::Vm, Tr, Val>), /// Fast VM shadowed by the latest legacy VM. - Shadowed(ShadowedFastVm), + Shadowed(ShadowedFastVm), } macro_rules! dispatch_fast_vm { @@ -251,10 +250,15 @@ macro_rules! dispatch_fast_vm { }; } -impl VmInterface for FastVmInstance { +impl VmInterface for FastVmInstance +where + S: ReadStorage, + Tr: Tracer + Default, + Val: vm_fast::ValidationTracer, +{ type TracerDispatcher = ( - crate::vm_latest::TracerDispatcher, HistoryEnabled>, - Tr, + vm_latest::TracerDispatcher, HistoryEnabled>, + (Tr, Val), ); fn push_transaction(&mut self, tx: Transaction) -> PushTransactionResult<'_> { @@ -299,8 +303,11 @@ impl VmInterface for FastVmInsta } } -impl VmInterfaceHistoryEnabled - for FastVmInstance +impl VmInterfaceHistoryEnabled for FastVmInstance +where + S: ReadStorage, + Tr: Tracer + Default, + Val: vm_fast::ValidationTracer, { fn make_snapshot(&mut self) { dispatch_fast_vm!(self.make_snapshot()); @@ -315,18 +322,19 @@ impl VmInterfaceHistoryEnabled } } -impl FastVmInstance { +impl FastVmInstance +where + S: ReadStorage, + Tr: Tracer + Default, + Val: vm_fast::ValidationTracer, +{ /// Creates an isolated fast VM. pub fn fast( l1_batch_env: L1BatchEnv, system_env: SystemEnv, storage_view: StoragePtr>, ) -> Self { - Self::Fast(crate::vm_fast::Vm::new( - l1_batch_env, - system_env, - storage_view, - )) + Self::Fast(vm_fast::Vm::new(l1_batch_env, system_env, storage_view)) } /// Creates a shadowed fast VM. diff --git a/core/lib/protobuf_config/Cargo.toml b/core/lib/protobuf_config/Cargo.toml index 92d9bd53978c..2d910430863b 100644 --- a/core/lib/protobuf_config/Cargo.toml +++ b/core/lib/protobuf_config/Cargo.toml @@ -16,6 +16,7 @@ links = "zksync_protobuf_config_proto" serde_json.workspace = true serde_yaml.workspace = true zksync_basic_types.workspace = true +zksync_concurrency.workspace = true zksync_config.workspace = true zksync_protobuf.workspace = true zksync_types.workspace = true diff --git a/core/lib/protobuf_config/src/consensus.rs b/core/lib/protobuf_config/src/consensus.rs index 2219b6a82ea8..567224acd4a6 100644 --- a/core/lib/protobuf_config/src/consensus.rs +++ b/core/lib/protobuf_config/src/consensus.rs @@ -1,5 +1,6 @@ use anyhow::Context as _; use zksync_basic_types::L2ChainId; +use zksync_concurrency::time; use zksync_config::configs::consensus::{ AttesterPublicKey, ConsensusConfig, GenesisSpec, Host, NodePublicKey, ProtocolVersion, RpcConfig, ValidatorPublicKey, WeightedAttester, WeightedValidator, @@ -154,6 +155,11 @@ impl ProtoRepr for proto::Config { .context("server_addr")?, public_addr: Host(required(&self.public_addr).context("public_addr")?.clone()), max_payload_size, + view_timeout: self + .view_timeout + .as_ref() + .map(|x| time::Duration::read(x).context("view_timeout")) + .transpose()?, max_batch_size, gossip_dynamic_inbound_limit: required(&self.gossip_dynamic_inbound_limit) .and_then(|x| Ok((*x).try_into()?)) @@ -187,6 +193,7 @@ impl ProtoRepr for proto::Config { server_addr: Some(this.server_addr.to_string()), public_addr: Some(this.public_addr.0.clone()), max_payload_size: Some(this.max_payload_size.try_into().unwrap()), + view_timeout: this.view_timeout.as_ref().map(ProtoFmt::build), max_batch_size: Some(this.max_batch_size.try_into().unwrap()), gossip_dynamic_inbound_limit: Some( this.gossip_dynamic_inbound_limit.try_into().unwrap(), diff --git a/core/lib/protobuf_config/src/contracts.rs b/core/lib/protobuf_config/src/contracts.rs index 3ef1bd871dad..12cbf996697b 100644 --- a/core/lib/protobuf_config/src/contracts.rs +++ b/core/lib/protobuf_config/src/contracts.rs @@ -117,18 +117,18 @@ impl ProtoRepr for proto::Contracts { .map(|x| parse_h160(x)) .transpose() .context("base_token_addr")?, - base_token_asset_id: l1 + l1_base_token_asset_id: l1 .base_token_asset_id .as_ref() .map(|x| parse_h256(x)) .transpose() .context("base_token_asset_id")?, - predeployed_l2_wrapped_base_token_address: l2 - .predeployed_l2_wrapped_base_token_address + l2_predeployed_wrapped_base_token_address: l2 + .predeployed_wrapped_base_token_address .as_ref() .map(|x| parse_h160(x)) .transpose() - .context("predeployed_l2_wrapped_base_token_address")?, + .context("l2 predeployed_wrapped_base_token_address")?, chain_admin_addr: l1 .chain_admin_addr .as_ref() @@ -175,7 +175,7 @@ impl ProtoRepr for proto::Contracts { default_upgrade_addr: Some(format!("{:?}", this.default_upgrade_addr)), multicall3_addr: Some(format!("{:?}", this.l1_multicall3_addr)), base_token_addr: this.base_token_addr.map(|a| format!("{:?}", a)), - base_token_asset_id: this.base_token_asset_id.map(|x| format!("{:?}", x)), + base_token_asset_id: this.l1_base_token_asset_id.map(|x| format!("{:?}", x)), chain_admin_addr: this.chain_admin_addr.map(|a| format!("{:?}", a)), }), l2: Some(proto::L2 { @@ -184,8 +184,8 @@ impl ProtoRepr for proto::Contracts { legacy_shared_bridge_addr: this .l2_legacy_shared_bridge_addr .map(|a| format!("{:?}", a)), - predeployed_l2_wrapped_base_token_address: this - .predeployed_l2_wrapped_base_token_address + predeployed_wrapped_base_token_address: this + .l2_predeployed_wrapped_base_token_address .map(|x| format!("{:?}", x)), timestamp_asserter_addr: this .l2_timestamp_asserter_addr diff --git a/core/lib/protobuf_config/src/eth.rs b/core/lib/protobuf_config/src/eth.rs index a50b452ccd16..ea508e3fbcb3 100644 --- a/core/lib/protobuf_config/src/eth.rs +++ b/core/lib/protobuf_config/src/eth.rs @@ -125,7 +125,6 @@ impl ProtoRepr for proto::Sender { .parse(), tx_aggregation_only_prove_and_execute: self.tx_aggregation_paused.unwrap_or(false), tx_aggregation_paused: self.tx_aggregation_only_prove_and_execute.unwrap_or(false), - priority_tree_start_index: self.priority_op_start_index.map(|x| x as usize), time_in_mempool_in_l1_blocks_cap: self .time_in_mempool_in_l1_blocks_cap .unwrap_or(Self::Type::default_time_in_mempool_in_l1_blocks_cap()), @@ -156,7 +155,6 @@ impl ProtoRepr for proto::Sender { ), tx_aggregation_only_prove_and_execute: Some(this.tx_aggregation_only_prove_and_execute), tx_aggregation_paused: Some(this.tx_aggregation_paused), - priority_op_start_index: this.priority_tree_start_index.map(|x| x as u64), time_in_mempool_in_l1_blocks_cap: Some(this.time_in_mempool_in_l1_blocks_cap), } } diff --git a/core/lib/protobuf_config/src/proto/config/contracts.proto b/core/lib/protobuf_config/src/proto/config/contracts.proto index a1d6310572ce..febbc981478b 100644 --- a/core/lib/protobuf_config/src/proto/config/contracts.proto +++ b/core/lib/protobuf_config/src/proto/config/contracts.proto @@ -26,7 +26,7 @@ message L2 { optional string da_validator_addr = 2; // optional; H160 optional string legacy_shared_bridge_addr = 3; // optional; H160 optional string timestamp_asserter_addr = 4; // optional; H160 - optional string predeployed_l2_wrapped_base_token_address = 5; // optional; H160 + optional string predeployed_wrapped_base_token_address = 5; // optional; H160 } message Bridge { diff --git a/core/lib/protobuf_config/src/proto/config/eth_sender.proto b/core/lib/protobuf_config/src/proto/config/eth_sender.proto index 4a9bad0acc10..28d247b5ce2f 100644 --- a/core/lib/protobuf_config/src/proto/config/eth_sender.proto +++ b/core/lib/protobuf_config/src/proto/config/eth_sender.proto @@ -54,7 +54,6 @@ message Sender { optional bool tx_aggregation_paused = 20; // required optional bool tx_aggregation_only_prove_and_execute = 21; // required optional uint32 time_in_mempool_in_l1_blocks_cap = 22; // optional - optional uint64 priority_op_start_index = 23; // optional } message GasAdjuster { diff --git a/core/lib/protobuf_config/src/proto/config/genesis.proto b/core/lib/protobuf_config/src/proto/config/genesis.proto index 2e9ebc82f25e..808bcee4799b 100644 --- a/core/lib/protobuf_config/src/proto/config/genesis.proto +++ b/core/lib/protobuf_config/src/proto/config/genesis.proto @@ -31,4 +31,5 @@ message Genesis { optional string evm_emulator_hash = 13; // optional; h256 optional string custom_genesis_state_path = 14; // optional; reserved 11; reserved "shared_bridge"; + reserved 15; reserved "sl_chain_id"; } diff --git a/core/lib/protobuf_config/src/proto/core/consensus.proto b/core/lib/protobuf_config/src/proto/core/consensus.proto index 9b0d69e7270c..0b915603cc67 100644 --- a/core/lib/protobuf_config/src/proto/core/consensus.proto +++ b/core/lib/protobuf_config/src/proto/core/consensus.proto @@ -87,6 +87,9 @@ message Config { // Maximal allowed size of the sync batches. optional uint64 max_batch_size = 10; // required; bytes + // View timeout for the consensus protocol. + optional std.Duration view_timeout = 13; // optional + // Inbound connections that should be unconditionally accepted on the gossip network. repeated string gossip_static_inbound = 5; // required; NodePublicKey diff --git a/core/lib/prover_interface/Cargo.toml b/core/lib/prover_interface/Cargo.toml index 50671fb3acb4..3ed8a9ff558f 100644 --- a/core/lib/prover_interface/Cargo.toml +++ b/core/lib/prover_interface/Cargo.toml @@ -16,7 +16,7 @@ zksync_object_store.workspace = true zksync_types.workspace = true # We can use the newest api to send proofs to L1. -circuit_sequencer_api_1_5_0.workspace = true +circuit_sequencer_api.workspace = true serde.workspace = true strum = { workspace = true, features = ["derive"] } diff --git a/core/lib/prover_interface/src/outputs.rs b/core/lib/prover_interface/src/outputs.rs index 60a9eaba760b..b6422473cea3 100644 --- a/core/lib/prover_interface/src/outputs.rs +++ b/core/lib/prover_interface/src/outputs.rs @@ -1,6 +1,6 @@ use core::fmt; -use circuit_sequencer_api_1_5_0::proof::FinalProof; +use circuit_sequencer_api::proof::FinalProof; use serde::{Deserialize, Serialize}; use serde_with::{hex::Hex, serde_as}; use zksync_object_store::{serialize_using_bincode, Bucket, StoredObject}; diff --git a/core/lib/prover_interface/tests/job_serialization.rs b/core/lib/prover_interface/tests/job_serialization.rs index ead59749abe3..d170520798d1 100644 --- a/core/lib/prover_interface/tests/job_serialization.rs +++ b/core/lib/prover_interface/tests/job_serialization.rs @@ -1,6 +1,6 @@ //! Integration tests for object store serialization of job objects. -use circuit_sequencer_api_1_5_0::proof::FinalProof; +use circuit_sequencer_api::proof::FinalProof; use tokio::fs; use zksync_object_store::{Bucket, MockObjectStore}; use zksync_prover_interface::{ diff --git a/core/lib/state/src/storage_overrides.rs b/core/lib/state/src/storage_overrides.rs deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/core/lib/test_contracts/contracts/custom-account/validation-rule-breaker.sol b/core/lib/test_contracts/contracts/custom-account/validation-rule-breaker.sol new file mode 100644 index 000000000000..45961f705be7 --- /dev/null +++ b/core/lib/test_contracts/contracts/custom-account/validation-rule-breaker.sol @@ -0,0 +1,149 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 + +pragma solidity ^0.8.0; + +import "./Constants.sol"; +import "./TransactionHelper.sol"; + +import "./SystemContractsCaller.sol"; + +import "./interfaces/IAccount.sol"; + +contract ValidationRuleBreaker is IAccount { + using TransactionHelper for Transaction; + + uint32 public typeOfRuleBreak; + address public trustedAddress = address(0x800a); + + constructor() { + typeOfRuleBreak = 0; + } + + function setTypeOfRuleBreak(uint32 _typeOfRuleBreak) external { + typeOfRuleBreak = _typeOfRuleBreak; + } + + function validateTransaction( + bytes32 _txHash, + bytes32 _suggestedSignedTxHash, + Transaction calldata _transaction + ) external payable override returns (bytes4 magic) { + // By default we consider the transaction as successful + magic = VALIDATION_SUCCESS_MAGIC; + + if (typeOfRuleBreak == 1) { + // The balance of another account may not be read + // I'm writing assertions because otherwise the compiler would optimize away the access + require(BOOTLOADER_FORMAL_ADDRESS.balance != 0); + } else if (typeOfRuleBreak == 2) { + // May not call an EOA + address(1234567890).call(""); + } else if (typeOfRuleBreak == 3) { + // This should succeed because a trustedAddress is marked as a slot that grants access to the address it contains + require(trustedAddress == address(0x800a)); + require(BOOTLOADER_FORMAL_ADDRESS.balance != 0); + } else if (typeOfRuleBreak == 4) { + // This should still fail; EIP-4337 defines out of gas as an immediate failure + address(this).call( + abi.encodeWithSignature("_runOutOfGasButCatchThePanic()") + ); + } + + _validateTransaction(_suggestedSignedTxHash, _transaction); + } + + function _runOutOfGasButCatchThePanic() external { + address(this).call( + abi.encodeWithSignature("_runOutOfGasButCatchThePanic()") + ); + } + + function _validateTransaction( + bytes32 _suggestedSignedTxHash, + Transaction calldata _transaction + ) internal { + SystemContractsCaller.systemCallWithPropagatedRevert( + uint32(gasleft()), + address(NONCE_HOLDER_SYSTEM_CONTRACT), + 0, + abi.encodeCall( + INonceHolder.incrementMinNonceIfEquals, + (_transaction.nonce) + ) + ); + } + + function executeTransaction( + bytes32, + bytes32, + Transaction calldata _transaction + ) external payable override { + _execute(_transaction); + } + + function executeTransactionFromOutside( + Transaction calldata _transaction + ) external payable override { + _validateTransaction(bytes32(0), _transaction); + _execute(_transaction); + } + + function _execute(Transaction calldata _transaction) internal { + address to = address(uint160(_transaction.to)); + uint256 value = _transaction.reserved[1]; + bytes memory data = _transaction.data; + + if (to == address(DEPLOYER_SYSTEM_CONTRACT)) { + // We allow calling ContractDeployer with any calldata + SystemContractsCaller.systemCallWithPropagatedRevert( + uint32(gasleft()), + to, + uint128(_transaction.reserved[1]), // By convention, reserved[1] is `value` + _transaction.data + ); + } else { + bool success; + assembly { + success := call( + gas(), + to, + value, + add(data, 0x20), + mload(data), + 0, + 0 + ) + } + require(success); + } + } + + // Here, the user pays the bootloader for the transaction + function payForTransaction( + bytes32, + bytes32, + Transaction calldata _transaction + ) external payable { + bool success = _transaction.payToTheBootloader(); + require(success, "Failed to pay the fee to the operator"); + } + + // Here, the user should prepare for the transaction to be paid for by a paymaster + // Here, the account should set the allowance for the smart contracts + function prepareForPaymaster( + bytes32, + bytes32, + Transaction calldata _transaction + ) external payable { + _transaction.processPaymasterInput(); + } + + fallback() external payable { + // fallback of default AA shouldn't be called by bootloader under no circumstances + assert(msg.sender != BOOTLOADER_FORMAL_ADDRESS); + + // If the contract is called directly, behave like an EOA + } + + receive() external payable {} +} diff --git a/core/lib/test_contracts/contracts/mock-evm/mock-evm.sol b/core/lib/test_contracts/contracts/mock-evm/mock-evm.sol index 3a7ee40db228..61cd483a5f7d 100644 --- a/core/lib/test_contracts/contracts/mock-evm/mock-evm.sol +++ b/core/lib/test_contracts/contracts/mock-evm/mock-evm.sol @@ -38,7 +38,7 @@ contract MockKnownCodeStorage { evmBytecodeHash = _bytecodeHash; } - function publishEVMBytecode(bytes calldata _bytecode) external { + function publishEVMBytecode(uint256 _bytecodeLen, bytes calldata _bytecode) external { bytes32 hash = evmBytecodeHash; require(hash != bytes32(0), "EVM bytecode hash not set"); @@ -85,7 +85,7 @@ contract MockContractDeployer { bytes calldata _input ) external payable returns (address) { KNOWN_CODE_STORAGE_CONTRACT.setEVMBytecodeHash(_salt); - KNOWN_CODE_STORAGE_CONTRACT.publishEVMBytecode(_input); + KNOWN_CODE_STORAGE_CONTRACT.publishEVMBytecode(_input.length, _input); address newAddress = address(uint160(msg.sender) + 1); ACCOUNT_CODE_STORAGE_CONTRACT.storeAccountConstructedCodeHash(newAddress, _salt); return newAddress; @@ -101,7 +101,7 @@ contract MockContractDeployer { bytes calldata _input ) external payable returns (address newAddress) { KNOWN_CODE_STORAGE_CONTRACT.setEVMBytecodeHash(_bytecodeHash); - KNOWN_CODE_STORAGE_CONTRACT.publishEVMBytecode(_input); + KNOWN_CODE_STORAGE_CONTRACT.publishEVMBytecode(_input.length, _input); bytes32 hash = keccak256( bytes.concat(CREATE2_PREFIX, bytes32(uint256(uint160(msg.sender))), _salt, _bytecodeHash) diff --git a/core/lib/test_contracts/src/contracts.rs b/core/lib/test_contracts/src/contracts.rs index 36d758c46de2..a997f70f6870 100644 --- a/core/lib/test_contracts/src/contracts.rs +++ b/core/lib/test_contracts/src/contracts.rs @@ -115,6 +115,12 @@ impl TestContract { &CONTRACT } + pub fn validation_test() -> &'static Self { + static CONTRACT: Lazy = + Lazy::new(|| TestContract::new(raw::custom_account::ValidationRuleBreaker)); + &CONTRACT + } + /// Returns a contract testing precompiles. pub fn precompiles_test() -> &'static Self { static CONTRACT: Lazy = diff --git a/core/lib/utils/Cargo.toml b/core/lib/utils/Cargo.toml index 216f3b12d426..fb08afc59b70 100644 --- a/core/lib/utils/Cargo.toml +++ b/core/lib/utils/Cargo.toml @@ -20,6 +20,7 @@ futures.workspace = true reqwest = { workspace = true, features = ["blocking"] } serde_json.workspace = true once_cell.workspace = true +sha2.workspace = true [dev-dependencies] tokio = { workspace = true, features = ["macros", "rt"] } diff --git a/core/lib/vm_executor/src/batch/factory.rs b/core/lib/vm_executor/src/batch/factory.rs index ed0b4a37ee68..59b610426669 100644 --- a/core/lib/vm_executor/src/batch/factory.rs +++ b/core/lib/vm_executor/src/batch/factory.rs @@ -37,7 +37,7 @@ pub trait BatchTracer: fmt::Debug + 'static + Send + Sealed { const TRACE_CALLS: bool; /// Tracer for the fast VM. #[doc(hidden)] - type Fast: vm_fast::interface::Tracer + Default + 'static; + type Fast: vm_fast::interface::Tracer + Default; } impl Sealed for () {} @@ -228,7 +228,7 @@ impl BatchVm { with_compression, ), Self::Fast(vm) => { - let mut tracer = (legacy_tracer.into(), ::default()); + let mut tracer = (legacy_tracer.into(), Default::default()); vm.inspect_transaction_with_bytecode_compression(&mut tracer, tx, with_compression) } }; diff --git a/core/lib/vm_executor/src/oneshot/mod.rs b/core/lib/vm_executor/src/oneshot/mod.rs index 0dfdb67bff52..e52a88e3e9c5 100644 --- a/core/lib/vm_executor/src/oneshot/mod.rs +++ b/core/lib/vm_executor/src/oneshot/mod.rs @@ -17,9 +17,9 @@ use once_cell::sync::OnceCell; use zksync_multivm::{ interface::{ executor::{OneshotExecutor, TransactionValidator}, - storage::{ReadStorage, StorageView, StorageWithOverrides}, + storage::{ReadStorage, StorageView, StorageWithOverrides, WriteStorage}, tracer::{ValidationError, ValidationParams, ValidationTraces}, - utils::{DivergenceHandler, ShadowVm}, + utils::{DivergenceHandler, ShadowMut, ShadowVm}, Call, ExecutionResult, InspectExecutionMode, OneshotEnv, OneshotTracingParams, OneshotTransactionExecutionResult, StoredL2BlockEnv, TxExecutionArgs, TxExecutionMode, VmFactory, VmInterface, @@ -27,9 +27,10 @@ use zksync_multivm::{ is_supported_by_fast_vm, tracers::{CallTracer, StorageInvocations, TracerDispatcher, ValidationTracer}, utils::adjust_pubdata_price_for_tx, + vm_fast, vm_latest::{HistoryDisabled, HistoryEnabled}, zk_evm_latest::ethereum_types::U256, - FastVmInstance, HistoryMode, LegacyVmInstance, MultiVmTracer, + FastVmInstance, HistoryMode, LegacyVmInstance, MultiVmTracer, VmVersion, }; use zksync_types::{ block::pack_block_info, @@ -180,7 +181,11 @@ where let l1_batch_env = env.l1_batch.clone(); let sandbox = VmSandbox { - fast_vm_mode: FastVmMode::Old, + fast_vm_mode: if !is_supported_by_fast_vm(env.system.version) { + FastVmMode::Old // the fast VM doesn't support old protocol versions + } else { + self.fast_vm_mode + }, panic_on_divergence: self.panic_on_divergence, storage, env, @@ -189,31 +194,35 @@ where }; tokio::task::spawn_blocking(move || { - let validation_tracer = ValidationTracer::::new( - validation_params, - sandbox.env.system.version.into(), - l1_batch_env, - ); - let mut validation_result = validation_tracer.get_result(); - let validation_traces = validation_tracer.get_traces(); - let tracers = vec![validation_tracer.into_tracer_pointer()]; - - let exec_result = sandbox.execute_in_vm(|vm, transaction| { - let Vm::Legacy(vm) = vm else { - unreachable!("Fast VM is never used for validation yet"); - }; - vm.push_transaction(transaction); - vm.inspect(&mut tracers.into(), InspectExecutionMode::OneTx) - }); - let validation_result = Arc::make_mut(&mut validation_result) - .take() - .map_or(Ok(()), Err); - - match (exec_result.result, validation_result) { - (_, Err(violated_rule)) => Err(ValidationError::ViolatedRule(violated_rule)), - (ExecutionResult::Halt { reason }, _) => Err(ValidationError::FailedTx(reason)), - _ => Ok(validation_traces.lock().unwrap().clone()), - } + let version = sandbox.env.system.version.into(); + let batch_timestamp = l1_batch_env.timestamp; + + sandbox.execute_in_vm(|vm, transaction| match vm { + Vm::Legacy(vm) => { + vm.push_transaction(transaction); + validate_legacy(vm, version, validation_params, batch_timestamp) + } + + Vm::Fast(FastVmInstance::Fast(vm)) => { + vm.push_transaction(transaction); + validate_fast(vm, validation_params, batch_timestamp) + } + + Vm::Fast(FastVmInstance::Shadowed(vm)) => { + vm.push_transaction(transaction); + vm.get_custom_mut("validation result", |vm| match vm { + ShadowMut::Main(vm) => validate_legacy::<_, HistoryEnabled>( + vm, + version, + validation_params.clone(), + batch_timestamp, + ), + ShadowMut::Shadow(vm) => { + validate_fast(vm, validation_params.clone(), batch_timestamp) + } + }) + } + }) }) .await .context("VM execution panicked") @@ -221,12 +230,12 @@ where } #[derive(Debug)] -enum Vm { +enum Vm { Legacy(LegacyVmInstance), - Fast(FastVmInstance), + Fast(FastVmInstance), } -impl Vm { +impl Vm { fn inspect_transaction_with_bytecode_compression( &mut self, missed_storage_invocation_limit: usize, @@ -252,7 +261,7 @@ impl Vm { missed_storage_invocation_limit, None, ); - let mut full_tracer = (legacy_tracers.into(), ()); + let mut full_tracer = (legacy_tracers.into(), ((), ())); vm.inspect_transaction_with_bytecode_compression( &mut full_tracer, tx, @@ -282,6 +291,57 @@ impl Vm { } } +fn validate_fast( + vm: &mut vm_fast::Vm, + validation_params: ValidationParams, + batch_timestamp: u64, +) -> Result { + let validation = vm_fast::FullValidationTracer::new(validation_params, batch_timestamp); + let mut tracer = ((), validation); + let result_and_logs = vm.inspect(&mut tracer, InspectExecutionMode::OneTx); + if let Some(violation) = tracer.1.validation_error() { + return Err(ValidationError::ViolatedRule(violation)); + } + + match result_and_logs.result { + ExecutionResult::Halt { reason } => Err(ValidationError::FailedTx(reason)), + ExecutionResult::Revert { .. } => { + unreachable!("Revert can only happen at the end of a transaction") + } + ExecutionResult::Success { .. } => Ok(tracer.1.traces()), + } +} + +fn validate_legacy( + vm: &mut impl VmInterface>>, + version: VmVersion, + validation_params: ValidationParams, + batch_timestamp: u64, +) -> Result +where + S: WriteStorage, + H: 'static + HistoryMode, + ValidationTracer: MultiVmTracer, +{ + let validation_tracer = ValidationTracer::::new(validation_params, version, batch_timestamp); + let mut validation_result = validation_tracer.get_result(); + let validation_traces = validation_tracer.get_traces(); + let validation_tracer: Box> = validation_tracer.into_tracer_pointer(); + let tracers = TracerDispatcher::from(validation_tracer); + + let exec_result = vm.inspect(&mut tracers.into(), InspectExecutionMode::OneTx); + + let validation_result = Arc::make_mut(&mut validation_result) + .take() + .map_or(Ok(()), Err); + + match (exec_result.result, validation_result) { + (_, Err(violated_rule)) => Err(ValidationError::ViolatedRule(violated_rule)), + (ExecutionResult::Halt { reason }, _) => Err(ValidationError::FailedTx(reason)), + _ => Ok(validation_traces.lock().unwrap().clone()), + } +} + /// Full parameters necessary to instantiate a VM for oneshot execution. #[derive(Debug)] struct VmSandbox { @@ -342,11 +402,14 @@ impl VmSandbox { } } - /// This method is blocking. - fn execute_in_vm( + fn execute_in_vm( mut self, - action: impl FnOnce(&mut Vm>, Transaction) -> T, - ) -> T { + action: impl FnOnce(&mut Vm, Tr, Val>, Transaction) -> T, + ) -> T + where + Tr: vm_fast::interface::Tracer + Default, + Val: vm_fast::ValidationTracer, + { Self::setup_storage( &mut self.storage, &self.execution_args, diff --git a/core/lib/vm_interface/src/types/tracer.rs b/core/lib/vm_interface/src/types/tracer.rs index 1c3f65f443ef..168834f28cef 100644 --- a/core/lib/vm_interface/src/types/tracer.rs +++ b/core/lib/vm_interface/src/types/tracer.rs @@ -71,7 +71,7 @@ pub struct TimestampAsserterParams { } /// Rules that can be violated when validating a transaction. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub enum ViolatedValidationRule { /// The transaction touched disallowed storage slots during validation. TouchedDisallowedStorageSlots(Address, U256), @@ -112,7 +112,7 @@ impl fmt::Display for ViolatedValidationRule { } /// Errors returned when validating a transaction. -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub enum ValidationError { /// VM execution was halted during validation. FailedTx(Halt), @@ -124,7 +124,7 @@ pub enum ValidationError { /// For instance, the `timestamp_asserter_range` represent the range within which the transaction might make /// assertions on `block.timestamp`. This information is crucial for the caller, as expired transactions should /// be excluded from the mempool. -#[derive(Debug, Clone, Default)] +#[derive(Debug, Clone, Default, PartialEq)] pub struct ValidationTraces { pub timestamp_asserter_range: Option>, } diff --git a/core/lib/vm_interface/src/utils/shadow.rs b/core/lib/vm_interface/src/utils/shadow.rs index 0883971f4de8..d6a6d16c77a0 100644 --- a/core/lib/vm_interface/src/utils/shadow.rs +++ b/core/lib/vm_interface/src/utils/shadow.rs @@ -13,6 +13,7 @@ use super::dump::{DumpingVm, VmDump}; use crate::{ pubdata::PubdataBuilder, storage::{ReadStorage, StoragePtr, StorageView}, + tracer::{ValidationError, ValidationTraces}, BytecodeCompressionResult, CurrentExecutionState, FinishedL1Batch, InspectExecutionMode, L1BatchEnv, L2BlockEnv, PushTransactionResult, SystemEnv, VmExecutionResultAndLogs, VmFactory, VmInterface, VmInterfaceHistoryEnabled, VmTrackingContracts, @@ -224,6 +225,14 @@ impl CheckDivergence for FinishedL1Batch { } } +impl CheckDivergence for Result { + fn check_divergence(&self, other: &Self) -> DivergenceErrors { + let mut errors = DivergenceErrors::new(); + errors.check_match("validation result", self, other); + errors + } +} + /// Shadowed VM that executes 2 VMs for each operation and compares their outputs. /// /// If a divergence is detected, the VM state is dumped using [a pluggable handler](Self::set_dump_handler()), @@ -238,7 +247,6 @@ impl ShadowVm where S: ReadStorage, Main: VmTrackingContracts, - Shadow: VmInterface, { /// Sets the divergence handler to be used by this VM. pub fn set_divergence_handler(&mut self, handler: DivergenceHandler) { @@ -247,6 +255,18 @@ where } } + /// Dumps the current VM state. + pub fn dump_state(&self) -> VmDump { + self.main.dump_state() + } +} + +impl ShadowVm +where + S: ReadStorage, + Main: VmTrackingContracts, + Shadow: VmInterface, +{ /// Mutable ref is not necessary, but it automatically drops potential borrows. fn report(&mut self, err: DivergenceErrors) { self.report_shared(err); @@ -260,11 +280,6 @@ where .report(err, self.main.dump_state()); } - /// Dumps the current VM state. - pub fn dump_state(&self) -> VmDump { - self.main.dump_state() - } - /// Gets the specified value from both the main and shadow VM, checking whether it matches on both. pub fn get(&self, name: &str, mut action: impl FnMut(ShadowRef<'_, Main, Shadow>) -> R) -> R where @@ -330,7 +345,6 @@ impl ShadowVm where S: ReadStorage, Main: VmFactory> + VmTrackingContracts, - Shadow: VmInterface, { /// Creates a VM with a custom shadow storage. pub fn with_custom_shadow( diff --git a/core/lib/vm_interface/src/vm.rs b/core/lib/vm_interface/src/vm.rs index 2c25d729e318..f347bb54f550 100644 --- a/core/lib/vm_interface/src/vm.rs +++ b/core/lib/vm_interface/src/vm.rs @@ -22,7 +22,6 @@ use crate::{ }; pub trait VmInterface { - /// Lifetime is used to be able to define `Option<&mut _>` as a dispatcher. type TracerDispatcher: Default; /// Pushes a transaction to bootloader memory for future execution with bytecode compression (if it's supported by the VM). diff --git a/core/node/api_server/src/web3/namespaces/eth.rs b/core/node/api_server/src/web3/namespaces/eth.rs index 2765de2c2892..f71b66b416e0 100644 --- a/core/node/api_server/src/web3/namespaces/eth.rs +++ b/core/node/api_server/src/web3/namespaces/eth.rs @@ -6,7 +6,7 @@ use zksync_types::{ state_override::StateOverride, BlockId, BlockNumber, FeeHistory, GetLogsFilter, Transaction, TransactionId, TransactionReceipt, TransactionVariant, }, - bytecode::{trim_padded_evm_bytecode, BytecodeMarker}, + bytecode::{trim_padded_evm_bytecode, BytecodeHash, BytecodeMarker}, l2::{L2Tx, TransactionType}, transaction_request::CallRequest, u256_to_h256, @@ -404,14 +404,22 @@ impl EthNamespace { // Check if the bytecode is an EVM bytecode, and if so, pre-process it correspondingly. let marker = BytecodeMarker::new(contract_code.bytecode_hash); let prepared_bytecode = if marker == Some(BytecodeMarker::Evm) { - trim_padded_evm_bytecode(&contract_code.bytecode) - .with_context(|| { + trim_padded_evm_bytecode( + BytecodeHash::try_from(contract_code.bytecode_hash).with_context(|| { format!( - "malformed EVM bytecode at address {address:?}, hash = {:?}", + "Invalid bytecode hash at address {address:?}: {:?}", contract_code.bytecode_hash ) - })? - .to_vec() + })?, + &contract_code.bytecode, + ) + .with_context(|| { + format!( + "malformed EVM bytecode at address {address:?}, hash = {:?}", + contract_code.bytecode_hash + ) + })? + .to_vec() } else { contract_code.bytecode }; diff --git a/core/node/api_server/src/web3/namespaces/unstable/utils.rs b/core/node/api_server/src/web3/namespaces/unstable/utils.rs index 2d3187fab6b8..b1071aee28c4 100644 --- a/core/node/api_server/src/web3/namespaces/unstable/utils.rs +++ b/core/node/api_server/src/web3/namespaces/unstable/utils.rs @@ -1,12 +1,11 @@ use zksync_dal::{Connection, Core, CoreDal, DalError}; -use zksync_multivm::circuit_sequencer_api_latest::boojum::ethereum_types::U256; use zksync_system_constants::{ message_root::{CHAIN_COUNT_KEY, CHAIN_INDEX_TO_ID_KEY, CHAIN_TREE_KEY}, L2_MESSAGE_ROOT_ADDRESS, }; use zksync_types::{ h256_to_u256, l2_to_l1_log::CHAIN_ID_LEAF_PADDING, u256_to_h256, web3::keccak256, - AccountTreeId, L2BlockNumber, StorageKey, H256, + AccountTreeId, L2BlockNumber, StorageKey, H256, U256, }; use zksync_web3_decl::error::Web3Error; diff --git a/core/node/api_server/src/web3/tests/mod.rs b/core/node/api_server/src/web3/tests/mod.rs index f447f135917a..9c5730a23386 100644 --- a/core/node/api_server/src/web3/tests/mod.rs +++ b/core/node/api_server/src/web3/tests/mod.rs @@ -34,7 +34,7 @@ use zksync_types::{ api, block::{pack_block_info, L2BlockHasher, L2BlockHeader}, bytecode::{ - testonly::{PROCESSED_EVM_BYTECODE, RAW_EVM_BYTECODE}, + testonly::{PADDED_EVM_BYTECODE, PROCESSED_EVM_BYTECODE}, BytecodeHash, }, fee_model::{BatchFeeInput, FeeParams}, @@ -1171,14 +1171,16 @@ impl GetBytecodeTest { at_block: L2BlockNumber, address: Address, ) -> anyhow::Result<()> { - let evm_bytecode_hash = BytecodeHash::for_evm_bytecode(RAW_EVM_BYTECODE).value(); + let evm_bytecode_hash = + BytecodeHash::for_evm_bytecode(PROCESSED_EVM_BYTECODE.len(), PADDED_EVM_BYTECODE) + .value(); let code_log = StorageLog::new_write_log(get_code_key(&address), evm_bytecode_hash); connection .storage_logs_dal() .append_storage_logs(at_block, &[code_log]) .await?; - let factory_deps = HashMap::from([(evm_bytecode_hash, RAW_EVM_BYTECODE.to_vec())]); + let factory_deps = HashMap::from([(evm_bytecode_hash, PADDED_EVM_BYTECODE.to_vec())]); connection .factory_deps_dal() .insert_factory_deps(at_block, &factory_deps) diff --git a/core/node/commitment_generator/Cargo.toml b/core/node/commitment_generator/Cargo.toml index f0b4046bab42..8a1af52e589d 100644 --- a/core/node/commitment_generator/Cargo.toml +++ b/core/node/commitment_generator/Cargo.toml @@ -20,13 +20,9 @@ zksync_eth_client.workspace = true zksync_contracts.workspace = true zksync_multivm.workspace = true zksync_system_constants.workspace = true -circuit_sequencer_api_1_4_0.workspace = true -circuit_sequencer_api_1_4_1.workspace = true -circuit_sequencer_api_1_5_0.workspace = true +circuit_encodings.workspace = true zk_evm_1_5_0.workspace = true -zk_evm_1_4_1.workspace = true -zk_evm_1_3_3.workspace = true tokio = { workspace = true, features = ["time"] } futures.workspace = true diff --git a/core/node/commitment_generator/src/utils.rs b/core/node/commitment_generator/src/utils.rs index cc44d7a03c71..b0a0562d8ec5 100644 --- a/core/node/commitment_generator/src/utils.rs +++ b/core/node/commitment_generator/src/utils.rs @@ -4,14 +4,6 @@ use std::fmt; use anyhow::Context; use itertools::Itertools; -use zk_evm_1_3_3::{ - aux_structures::Timestamp as Timestamp_1_3_3, - zk_evm_abstractions::queries::LogQuery as LogQuery_1_3_3, -}; -use zk_evm_1_4_1::{ - aux_structures::Timestamp as Timestamp_1_4_1, - zk_evm_abstractions::queries::LogQuery as LogQuery_1_4_1, -}; use zk_evm_1_5_0::{ aux_structures::Timestamp as Timestamp_1_5_0, zk_evm_abstractions::queries::LogQuery as LogQuery_1_5_0, @@ -22,7 +14,6 @@ use zksync_multivm::{interface::VmEvent, utils::get_used_bootloader_memory_bytes use zksync_system_constants::message_root::{AGG_TREE_HEIGHT_KEY, AGG_TREE_NODES_KEY}; use zksync_types::{ address_to_u256, h256_to_u256, u256_to_h256, - vm::VmVersion, web3::keccak256, zk_evm_types::{LogQuery, Timestamp}, AccountTreeId, L1BatchNumber, ProtocolVersionId, StorageKey, EVENT_WRITER_ADDRESS, H256, @@ -54,37 +45,15 @@ impl CommitmentComputer for RealCommitmentComputer { fn events_queue_commitment( &self, events_queue: &[LogQuery], - protocol_version: ProtocolVersionId, + _protocol_version: ProtocolVersionId, ) -> anyhow::Result { - match VmVersion::from(protocol_version) { - VmVersion::VmBoojumIntegration => Ok(H256( - circuit_sequencer_api_1_4_0::commitments::events_queue_commitment_fixed( - &events_queue - .iter() - .map(|x| to_log_query_1_3_3(*x)) - .collect(), - ), - )), - VmVersion::Vm1_4_1 | VmVersion::Vm1_4_2 => Ok(H256( - circuit_sequencer_api_1_4_1::commitments::events_queue_commitment_fixed( - &events_queue - .iter() - .map(|x| to_log_query_1_4_1(*x)) - .collect(), - ), - )), - VmVersion::Vm1_5_0SmallBootloaderMemory - | VmVersion::Vm1_5_0IncreasedBootloaderMemory - | VmVersion::VmGateway => Ok(H256( - circuit_sequencer_api_1_5_0::commitments::events_queue_commitment_fixed( - &events_queue - .iter() - .map(|x| to_log_query_1_5_0(*x)) - .collect(), - ), - )), - _ => anyhow::bail!("Unsupported protocol version: {protocol_version:?}"), - } + let commitment = circuit_encodings::commitments::events_queue_commitment_fixed( + &events_queue + .iter() + .map(|x| to_log_query_1_5_0(*x)) + .collect(), + ); + Ok(H256(commitment)) } fn bootloader_initial_content_commitment( @@ -100,27 +69,10 @@ impl CommitmentComputer for RealCommitmentComputer { let full_bootloader_memory = expand_memory_contents(initial_bootloader_contents, expanded_memory_size); - - match VmVersion::from(protocol_version) { - VmVersion::VmBoojumIntegration => Ok(H256( - circuit_sequencer_api_1_4_0::commitments::initial_heap_content_commitment_fixed( - &full_bootloader_memory, - ), - )), - VmVersion::Vm1_4_1 | VmVersion::Vm1_4_2 => Ok(H256( - circuit_sequencer_api_1_4_1::commitments::initial_heap_content_commitment_fixed( - &full_bootloader_memory, - ), - )), - VmVersion::Vm1_5_0SmallBootloaderMemory - | VmVersion::Vm1_5_0IncreasedBootloaderMemory - | VmVersion::VmGateway => Ok(H256( - circuit_sequencer_api_1_5_0::commitments::initial_heap_content_commitment_fixed( - &full_bootloader_memory, - ), - )), - _ => unreachable!(), - } + let commitment = circuit_encodings::commitments::initial_heap_content_commitment_fixed( + &full_bootloader_memory, + ); + Ok(H256(commitment)) } } @@ -133,37 +85,6 @@ fn expand_memory_contents(packed: &[(usize, U256)], memory_size_bytes: usize) -> result } -fn to_log_query_1_3_3(log_query: LogQuery) -> LogQuery_1_3_3 { - LogQuery_1_3_3 { - timestamp: Timestamp_1_3_3(log_query.timestamp.0), - tx_number_in_block: log_query.tx_number_in_block, - aux_byte: log_query.aux_byte, - shard_id: log_query.shard_id, - address: log_query.address, - key: log_query.key, - read_value: log_query.read_value, - written_value: log_query.written_value, - rw_flag: log_query.rw_flag, - rollback: log_query.rollback, - is_service: log_query.is_service, - } -} - -fn to_log_query_1_4_1(log_query: LogQuery) -> LogQuery_1_4_1 { - LogQuery_1_4_1 { - timestamp: Timestamp_1_4_1(log_query.timestamp.0), - tx_number_in_block: log_query.tx_number_in_block, - aux_byte: log_query.aux_byte, - shard_id: log_query.shard_id, - address: log_query.address, - key: log_query.key, - read_value: log_query.read_value, - written_value: log_query.written_value, - rw_flag: log_query.rw_flag, - rollback: log_query.rollback, - is_service: log_query.is_service, - } -} fn to_log_query_1_5_0(log_query: LogQuery) -> LogQuery_1_5_0 { LogQuery_1_5_0 { diff --git a/core/node/consensus/src/config.rs b/core/node/consensus/src/config.rs index 4ad7a551ab42..2cb6045151bd 100644 --- a/core/node/consensus/src/config.rs +++ b/core/node/consensus/src/config.rs @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, HashMap}; use anyhow::Context as _; use secrecy::{ExposeSecret as _, Secret}; -use zksync_concurrency::{limiter, net, time}; +use zksync_concurrency::net; use zksync_config::{ configs, configs::consensus::{ConsensusConfig, ConsensusSecrets, Host, NodePublicKey}, @@ -152,11 +152,6 @@ pub(super) fn executor( let mut rpc = executor::RpcConfig::default(); rpc.get_block_rate = cfg.rpc().get_block_rate(); - // Disable batch syncing, because it is not implemented. - rpc.get_batch_rate = limiter::Rate { - burst: 0, - refresh: time::Duration::ZERO, - }; let debug_page = cfg.debug_page_addr.map(|addr| network::debug_page::Config { addr, @@ -169,6 +164,7 @@ pub(super) fn executor( server_addr: cfg.server_addr, public_addr: net::Host(cfg.public_addr.0.clone()), max_payload_size: cfg.max_payload_size, + view_timeout: cfg.view_timeout(), node_key: node_key(secrets) .context("node_key")? .context("missing node_key")?, diff --git a/core/node/consensus/src/testonly.rs b/core/node/consensus/src/testonly.rs index 479ca1f244cc..1a4da71f85a0 100644 --- a/core/node/consensus/src/testonly.rs +++ b/core/node/consensus/src/testonly.rs @@ -149,6 +149,7 @@ fn make_config( public_addr: config::Host(cfg.public_addr.0.clone()), max_payload_size: usize::MAX, max_batch_size: usize::MAX, + view_timeout: None, gossip_dynamic_inbound_limit: cfg.gossip.dynamic_inbound_limit, gossip_static_inbound: cfg .gossip diff --git a/core/node/contract_verification_server/src/tests.rs b/core/node/contract_verification_server/src/tests.rs index c5c1d88b3d0c..88b14db68733 100644 --- a/core/node/contract_verification_server/src/tests.rs +++ b/core/node/contract_verification_server/src/tests.rs @@ -54,7 +54,7 @@ async fn mock_deploy_contract( ) { let bytecode_hash = match kind { BytecodeMarker::EraVm => BytecodeHash::for_bytecode(&[0; 32]).value(), - BytecodeMarker::Evm => BytecodeHash::for_evm_bytecode(&[0; 96]).value(), + BytecodeMarker::Evm => BytecodeHash::for_evm_bytecode(0, &[0; 96]).value(), }; let deploy_log = StorageLog::new_write_log(get_code_key(&address), bytecode_hash); storage diff --git a/core/node/eth_sender/Cargo.toml b/core/node/eth_sender/Cargo.toml index cefcfa535f55..2f95bf54e176 100644 --- a/core/node/eth_sender/Cargo.toml +++ b/core/node/eth_sender/Cargo.toml @@ -36,6 +36,5 @@ tracing.workspace = true [dev-dependencies] test-casing.workspace = true zksync_node_test_utils.workspace = true -once_cell.workspace = true assert_matches.workspace = true test-log.workspace = true diff --git a/core/node/eth_sender/src/aggregator.rs b/core/node/eth_sender/src/aggregator.rs index d67fe4df5c78..9aa7a1013164 100644 --- a/core/node/eth_sender/src/aggregator.rs +++ b/core/node/eth_sender/src/aggregator.rs @@ -2,7 +2,8 @@ use std::sync::Arc; use zksync_config::configs::eth_sender::{ProofSendingMode, SenderConfig}; use zksync_contracts::BaseSystemContractsHashes; -use zksync_dal::{Connection, Core, CoreDal, DalError}; +use zksync_dal::{Connection, ConnectionPool, Core, CoreDal}; +use zksync_eth_client::{BoundEthInterface, EthInterface}; use zksync_l1_contract_interface::i_executor::methods::{ExecuteBatches, ProveBatches}; use zksync_mini_merkle_tree::MiniMerkleTree; use zksync_object_store::{ObjectStore, ObjectStoreError}; @@ -16,7 +17,8 @@ use zksync_types::{ protocol_version::{L1VerifierConfig, ProtocolSemanticVersion}, pubdata_da::PubdataSendingMode, settlement::SettlementMode, - Address, L1BatchNumber, ProtocolVersionId, + web3::CallRequest, + Address, L1BatchNumber, ProtocolVersionId, U256, }; use super::{ @@ -26,6 +28,7 @@ use super::{ TimestampDeadlineCriterion, }, }; +use crate::EthSenderError; #[derive(Debug)] pub struct Aggregator { @@ -34,6 +37,8 @@ pub struct Aggregator { execute_criteria: Vec>, config: SenderConfig, blob_store: Arc, + pool: ConnectionPool, + sl_client: Box, /// If we are operating in 4844 mode we need to wait for commit transaction /// to get included before sending the respective prove and execute transactions. /// In non-4844 mode of operation we operate with the single address and this @@ -42,7 +47,8 @@ pub struct Aggregator { operate_4844_mode: bool, pubdata_da: PubdataSendingMode, commitment_mode: L1BatchCommitmentMode, - priority_merkle_tree: MiniMerkleTree, + priority_merkle_tree: Option>, + priority_tree_start_index: Option, } impl Aggregator { @@ -51,21 +57,13 @@ impl Aggregator { blob_store: Arc, custom_commit_sender_addr: Option
, commitment_mode: L1BatchCommitmentMode, - connection: &mut Connection<'_, Core>, + pool: ConnectionPool, + sl_client: Box, settlement_mode: SettlementMode, ) -> anyhow::Result { let pubdata_da = config.pubdata_sending_mode; - let priority_tree_start_index = config.priority_tree_start_index.unwrap_or(0); - let priority_op_hashes = connection - .transactions_dal() - .get_l1_transactions_hashes(priority_tree_start_index) - .await - .map_err(DalError::generalize)?; - let priority_merkle_tree = - MiniMerkleTree::::from_hashes(KeccakHasher, priority_op_hashes.into_iter(), None); - - let operate_4844_mode = + let operate_4844_mode: bool = custom_commit_sender_addr.is_some() && !settlement_mode.is_gateway(); // We do not have a reliable lower bound for gas needed to execute batches on gateway so we do not aggregate. @@ -148,7 +146,10 @@ impl Aggregator { operate_4844_mode, pubdata_da, commitment_mode, - priority_merkle_tree, + priority_merkle_tree: None, + priority_tree_start_index: None, + pool, + sl_client, }) } @@ -158,14 +159,14 @@ impl Aggregator { base_system_contracts_hashes: BaseSystemContractsHashes, protocol_version_id: ProtocolVersionId, l1_verifier_config: L1VerifierConfig, - ) -> Option { + ) -> Result, EthSenderError> { let Some(last_sealed_l1_batch_number) = storage .blocks_dal() .get_sealed_l1_batch_number() .await .unwrap() else { - return None; // No L1 batches in Postgres; no operations are ready yet + return Ok(None); // No L1 batches in Postgres; no operations are ready yet }; if let Some(op) = self @@ -174,24 +175,114 @@ impl Aggregator { self.config.max_aggregated_blocks_to_execute as usize, last_sealed_l1_batch_number, ) - .await + .await? { - Some(AggregatedOperation::Execute(op)) + Ok(Some(AggregatedOperation::Execute(op))) } else if let Some(op) = self .get_proof_operation(storage, last_sealed_l1_batch_number, l1_verifier_config) .await { - Some(AggregatedOperation::PublishProofOnchain(op)) + Ok(Some(AggregatedOperation::PublishProofOnchain(op))) } else { - self.get_commit_operation( - storage, - self.config.max_aggregated_blocks_to_commit as usize, - last_sealed_l1_batch_number, - base_system_contracts_hashes, - protocol_version_id, + Ok(self + .get_commit_operation( + storage, + self.config.max_aggregated_blocks_to_commit as usize, + last_sealed_l1_batch_number, + base_system_contracts_hashes, + protocol_version_id, + ) + .await) + } + } + + async fn query_no_params_method(&self, method_name: &str) -> Result { + let data = self + .sl_client + .contract() + .function(method_name) + .unwrap() + .encode_input(&[]) + .unwrap(); + + // Dereference the box to get a reference to the trait object: + let bound_ref: &dyn BoundEthInterface = &*self.sl_client; + + // Now call `as_ref()` from `AsRef` explicitly: + let eth_interface: &dyn EthInterface = AsRef::::as_ref(bound_ref); + + let result = eth_interface + .call_contract_function( + CallRequest { + data: Some(data.into()), + to: Some(self.sl_client.contract_addr()), + ..CallRequest::default() + }, + None, ) - .await + .await?; + + Ok(self + .sl_client + .contract() + .function(method_name) + .unwrap() + .decode_output(&result.0) + .unwrap()[0] + .clone() + .into_uint() + .unwrap()) + } + + async fn get_or_init_priority_tree_start_index( + &mut self, + ) -> Result, EthSenderError> { + if self.priority_tree_start_index.is_none() { + let packed_semver = self.query_no_params_method("getProtocolVersion").await?; + + // We always expect the provided version to be correct, so we panic if it is not + let version = ProtocolVersionId::try_from_packed_semver(packed_semver).unwrap(); + + // For pre-gateway versions the index is not supported. + if version.is_pre_gateway() { + return Ok(None); + } + + let priority_tree_start_index = self + .query_no_params_method("getPriorityTreeStartIndex") + .await?; + + self.priority_tree_start_index = Some(priority_tree_start_index.as_usize()); } + + Ok(self.priority_tree_start_index) + } + + async fn get_or_init_tree( + &mut self, + priority_tree_start_index: usize, + ) -> &mut MiniMerkleTree { + if self.priority_merkle_tree.is_none() { + // We unwrap here since it is only invoked during initialization + let mut connection = self.pool.connection_tagged("eth_sender").await.unwrap(); + + // We unwrap here since it is only invoked only once during initialization + let priority_op_hashes = connection + .transactions_dal() + .get_l1_transactions_hashes(priority_tree_start_index) + .await + .unwrap(); + let priority_merkle_tree = MiniMerkleTree::::from_hashes( + KeccakHasher, + priority_op_hashes.into_iter(), + None, + ); + + self.priority_merkle_tree = Some(priority_merkle_tree); + }; + + // It is known that the `self.priority_merkle_tree` is initialized, so it is safe to unwrap here + self.priority_merkle_tree.as_mut().unwrap() } async fn get_execute_operations( @@ -199,7 +290,7 @@ impl Aggregator { storage: &mut Connection<'_, Core>, limit: usize, last_sealed_l1_batch: L1BatchNumber, - ) -> Option { + ) -> Result, EthSenderError> { let max_l1_batch_timestamp_millis = self .config .l1_batch_min_age_before_execute_seconds @@ -209,53 +300,62 @@ impl Aggregator { .get_ready_for_execute_l1_batches(limit, max_l1_batch_timestamp_millis) .await .unwrap(); - let l1_batches = extract_ready_subrange( + let Some(l1_batches) = extract_ready_subrange( storage, &mut self.execute_criteria, ready_for_execute_batches, last_sealed_l1_batch, ) - .await?; + .await + else { + return Ok(None); + }; + + let Some(priority_tree_start_index) = self.get_or_init_priority_tree_start_index().await? + else { + // The index is not yet applicable to the current system, so we + // return empty priority operations' proofs. + let length = l1_batches.len(); + return Ok(Some(ExecuteBatches { + l1_batches, + priority_ops_proofs: vec![Default::default(); length], + })); + }; + + let priority_merkle_tree = self.get_or_init_tree(priority_tree_start_index).await; - let priority_tree_start_index = self.config.priority_tree_start_index.unwrap_or(0); let mut priority_ops_proofs = vec![]; - for batch in l1_batches.iter() { - let first_priority_op_id_option = match storage + for batch in &l1_batches { + let first_priority_op_id_option = storage .blocks_dal() .get_batch_first_priority_op_id(batch.header.number) .await .unwrap() - { - // Batch has no priority ops, no proofs to send - None => None, - // We haven't started to use the priority tree in the contracts yet - Some(id) if id < priority_tree_start_index => None, - Some(id) => Some(id), - }; + .filter(|id| *id >= priority_tree_start_index); let count = batch.header.l1_tx_count as usize; if let Some(first_priority_op_id_in_batch) = first_priority_op_id_option { - let priority_tree_start_index = self.config.priority_tree_start_index.unwrap_or(0); let new_l1_tx_hashes = storage .transactions_dal() .get_l1_transactions_hashes( - priority_tree_start_index + self.priority_merkle_tree.length(), + priority_tree_start_index + priority_merkle_tree.length(), ) .await .unwrap(); for hash in new_l1_tx_hashes { - self.priority_merkle_tree.push_hash(hash); + priority_merkle_tree.push_hash(hash); } - self.priority_merkle_tree.trim_start( + // We cache paths for priority transactions that happened in the previous batches. + // For this we absorb all the elements up to `first_priority_op_id_in_batch`.` + priority_merkle_tree.trim_start( first_priority_op_id_in_batch // global index - priority_tree_start_index // first index when tree is activated - - self.priority_merkle_tree.start_index(), // first index in the tree + - priority_merkle_tree.start_index(), // first index in the tree ); - let (_, left, right) = self - .priority_merkle_tree - .merkle_root_and_paths_for_range(..count); - let hashes = self.priority_merkle_tree.hashes_prefix(count); + let (_, left, right) = + priority_merkle_tree.merkle_root_and_paths_for_range(..count); + let hashes = priority_merkle_tree.hashes_prefix(count); priority_ops_proofs.push(PriorityOpsMerkleProof { left_path: left.into_iter().map(Option::unwrap_or_default).collect(), right_path: right.into_iter().map(Option::unwrap_or_default).collect(), @@ -266,10 +366,10 @@ impl Aggregator { } } - Some(ExecuteBatches { + Ok(Some(ExecuteBatches { l1_batches, priority_ops_proofs, - }) + })) } async fn get_commit_operation( diff --git a/core/node/eth_sender/src/eth_tx_aggregator.rs b/core/node/eth_sender/src/eth_tx_aggregator.rs index dbef6da7b47b..aec88b90be60 100644 --- a/core/node/eth_sender/src/eth_tx_aggregator.rs +++ b/core/node/eth_sender/src/eth_tx_aggregator.rs @@ -406,7 +406,7 @@ impl EthTxAggregator { protocol_version_id, l1_verifier_config, ) - .await + .await? { if self.config.tx_aggregation_paused { tracing::info!( diff --git a/core/node/eth_sender/src/tester.rs b/core/node/eth_sender/src/tester.rs index 2fb489fe55f2..e7d9f2ac87e7 100644 --- a/core/node/eth_sender/src/tester.rs +++ b/core/node/eth_sender/src/tester.rs @@ -244,13 +244,13 @@ impl EthSenderTester { None }; - let mut connection = connection_pool.connection().await.unwrap(); let aggregator = Aggregator::new( aggregator_config.clone(), MockObjectStore::arc(), custom_commit_sender_addr, commitment_mode, - &mut connection, + connection_pool.clone(), + gateway.clone(), SettlementMode::SettlesToL1, ) .await @@ -417,10 +417,7 @@ impl EthSenderTester { .await, ]; let operation = AggregatedOperation::Execute(ExecuteBatches { - priority_ops_proofs: l1_batch_headers - .iter() - .map(|_| Default::default()) - .collect(), + priority_ops_proofs: vec![Default::default(); l1_batch_headers.len()], l1_batches: l1_batch_headers .into_iter() .map(l1_batch_with_metadata) diff --git a/core/node/eth_watch/src/lib.rs b/core/node/eth_watch/src/lib.rs index ff3aa44b7a9d..59f441457139 100644 --- a/core/node/eth_watch/src/lib.rs +++ b/core/node/eth_watch/src/lib.rs @@ -254,9 +254,9 @@ async fn get_chain_specific_upgrade_params( let TokenMetadata { name, symbol, .. } = l1_client.get_base_token_metadata().await?; Ok(ZkChainSpecificUpgradeData::from_partial_components( - contracts_config.base_token_asset_id, + contracts_config.l1_base_token_asset_id, contracts_config.l2_legacy_shared_bridge_addr, - contracts_config.predeployed_l2_wrapped_base_token_address, + contracts_config.l2_predeployed_wrapped_base_token_address, contracts_config.base_token_addr, Some(name), Some(symbol), diff --git a/core/node/genesis/src/utils.rs b/core/node/genesis/src/utils.rs index a838673aa0f1..711b7e7b83d4 100644 --- a/core/node/genesis/src/utils.rs +++ b/core/node/genesis/src/utils.rs @@ -99,7 +99,7 @@ pub fn get_deduped_log_queries(storage_logs: &[StorageLog]) -> Vec { }) .collect(); - let deduped_log_queries: Vec = sort_storage_access_queries(&log_queries) + let deduped_log_queries: Vec = sort_storage_access_queries(log_queries) .1 .into_iter() .map(|log_query| LogQuery { diff --git a/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs b/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs index ec7d627c6d95..09209dcfd225 100644 --- a/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs +++ b/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs @@ -1,7 +1,7 @@ use anyhow::Context; use zksync_circuit_breaker::l1_txs::FailedL1TransactionChecker; use zksync_config::configs::{eth_sender::EthConfig, gateway::GatewayChainConfig, ContractsConfig}; -use zksync_db_connection::error::DalError; +use zksync_dal::DalError; use zksync_eth_client::BoundEthInterface; use zksync_eth_sender::{Aggregator, EthTxAggregator}; use zksync_types::{commitment::L1BatchCommitmentMode, settlement::SettlementMode, L2ChainId}; @@ -45,7 +45,7 @@ use crate::{ pub struct EthTxAggregatorLayer { eth_sender_config: EthConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, zksync_network_id: L2ChainId, l1_batch_commit_data_generator_mode: L1BatchCommitmentMode, settlement_mode: SettlementMode, @@ -77,7 +77,7 @@ impl EthTxAggregatorLayer { pub fn new( eth_sender_config: EthConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, zksync_network_id: L2ChainId, l1_batch_commit_data_generator_mode: L1BatchCommitmentMode, settlement_mode: SettlementMode, @@ -85,7 +85,7 @@ impl EthTxAggregatorLayer { Self { eth_sender_config, contracts_config, - gateway_contracts_config, + gateway_chain_config, zksync_network_id, l1_batch_commit_data_generator_mode, settlement_mode, @@ -109,24 +109,19 @@ impl WiringLayer for EthTxAggregatorLayer { self.settlement_mode.is_gateway() ); tracing::info!("Contracts: {:?}", self.contracts_config); - tracing::info!("Gateway contracts: {:?}", self.gateway_contracts_config); + tracing::info!("Gateway contracts: {:?}", self.gateway_chain_config); // Get resources. let (validator_timelock_addr, multicall3_addr, diamond_proxy_addr) = if self.settlement_mode.is_gateway() { + let gateway_chain_config = self + .gateway_chain_config + .as_ref() + .context("gateway_chain_config")?; ( - self.gateway_contracts_config - .clone() - .unwrap() - .validator_timelock_addr, - self.gateway_contracts_config - .clone() - .unwrap() - .multicall3_addr, - self.gateway_contracts_config - .clone() - .unwrap() - .diamond_proxy_addr, + gateway_chain_config.validator_timelock_addr, + gateway_chain_config.multicall3_addr, + gateway_chain_config.diamond_proxy_addr, ) } else { ( @@ -137,9 +132,12 @@ impl WiringLayer for EthTxAggregatorLayer { }; let eth_client = if self.settlement_mode.is_gateway() { - input.eth_client_gateway.unwrap().0 + input + .eth_client_gateway + .context("eth_client_gateway missing")? + .0 } else { - input.eth_client.unwrap().0 + input.eth_client.context("eth_client missing")?.0 }; let master_pool = input.master_pool.get().await.unwrap(); let replica_pool = input.replica_pool.get().await.unwrap(); @@ -153,20 +151,16 @@ impl WiringLayer for EthTxAggregatorLayer { .map(BoundEthInterface::sender_account); let config = self.eth_sender_config.sender.context("sender")?; - let mut connection = replica_pool - .connection_tagged("eth_sender") - .await - .map_err(DalError::generalize)?; let aggregator = Aggregator::new( config.clone(), object_store, eth_client_blobs_addr, self.l1_batch_commit_data_generator_mode, - &mut connection, + replica_pool.clone(), + eth_client.clone(), self.settlement_mode, ) .await?; - drop(connection); let eth_tx_aggregator = EthTxAggregator::new( master_pool.clone(), diff --git a/core/node/node_framework/src/implementations/layers/eth_watch.rs b/core/node/node_framework/src/implementations/layers/eth_watch.rs index 48207b118ada..da0e26355cf2 100644 --- a/core/node/node_framework/src/implementations/layers/eth_watch.rs +++ b/core/node/node_framework/src/implementations/layers/eth_watch.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use zksync_config::{configs::gateway::GatewayChainConfig, ContractsConfig, EthWatchConfig}; use zksync_contracts::chain_admin_contract; use zksync_eth_watch::{EthHttpQueryClient, EthWatch, L2EthClient}; @@ -22,7 +23,7 @@ use crate::{ pub struct EthWatchLayer { eth_watch_config: EthWatchConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, settlement_mode: SettlementMode, chain_id: L2ChainId, } @@ -46,14 +47,14 @@ impl EthWatchLayer { pub fn new( eth_watch_config: EthWatchConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, settlement_mode: SettlementMode, chain_id: L2ChainId, ) -> Self { Self { eth_watch_config, contracts_config, - gateway_contracts_config, + gateway_chain_config, settlement_mode, chain_id, } @@ -74,19 +75,19 @@ impl WiringLayer for EthWatchLayer { let client = input.eth_client.0; let sl_diamond_proxy_addr = if self.settlement_mode.is_gateway() { - self.gateway_contracts_config + self.gateway_chain_config .clone() - .unwrap() + .context("Lacking `gateway_contracts_config`")? .diamond_proxy_addr } else { self.contracts_config.diamond_proxy_addr }; tracing::info!( - "Diamond proxy address ethereum: {}", + "Diamond proxy address ethereum: {:#?}", self.contracts_config.diamond_proxy_addr ); tracing::info!( - "Diamond proxy address settlement_layer: {}", + "Diamond proxy address settlement_layer: {:#?}", sl_diamond_proxy_addr ); @@ -108,7 +109,7 @@ impl WiringLayer for EthWatchLayer { let sl_l2_client: Option> = if let Some(gateway_client) = input.gateway_client { - let contracts_config = self.gateway_contracts_config.unwrap(); + let contracts_config = self.gateway_chain_config.unwrap(); Some(Box::new(EthHttpQueryClient::new( gateway_client.0, contracts_config.diamond_proxy_addr, diff --git a/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs b/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs index c3788fa782bc..bcc01c20cc42 100644 --- a/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs +++ b/core/node/node_framework/src/implementations/layers/pk_signing_eth_client.rs @@ -19,7 +19,7 @@ use crate::{ pub struct PKSigningEthClientLayer { eth_sender_config: EthConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, wallets: wallets::EthSender, } @@ -43,13 +43,13 @@ impl PKSigningEthClientLayer { pub fn new( eth_sender_config: EthConfig, contracts_config: ContractsConfig, - gateway_contracts_config: Option, + gateway_chain_config: Option, wallets: wallets::EthSender, ) -> Self { Self { eth_sender_config, contracts_config, - gateway_contracts_config, + gateway_chain_config, wallets, } } @@ -97,21 +97,19 @@ impl WiringLayer for PKSigningEthClientLayer { ); BoundEthInterfaceForBlobsResource(Box::new(signing_client_for_blobs)) }); - let signing_client_for_gateway = if input.gateway_client.is_some() { - if self - .gateway_contracts_config - .clone() - .is_some_and(|v| v.gateway_chain_id.0 != 0_u64) - { + + let signing_client_for_gateway = if let (Some(client), Some(gateway_contracts)) = + (&input.gateway_client, self.gateway_chain_config.as_ref()) + { + if gateway_contracts.gateway_chain_id.0 != 0u64 { let private_key = self.wallets.operator.private_key(); - let GatewayEthInterfaceResource(gateway_client) = input.gateway_client.unwrap(); - let gateway_contracts = self.gateway_contracts_config.unwrap(); + let GatewayEthInterfaceResource(gateway_client) = client; let signing_client_for_blobs = PKSigningClient::new_raw( private_key.clone(), gateway_contracts.diamond_proxy_addr, gas_adjuster_config.default_priority_fee_per_gas, gateway_contracts.gateway_chain_id, - gateway_client, + gateway_client.clone(), ); Some(BoundEthInterfaceForL2Resource(Box::new( signing_client_for_blobs, diff --git a/core/node/node_sync/src/tree_data_fetcher/provider/tests.rs b/core/node/node_sync/src/tree_data_fetcher/provider/tests.rs index 5b6988c8825f..14ab34bab10d 100644 --- a/core/node/node_sync/src/tree_data_fetcher/provider/tests.rs +++ b/core/node/node_sync/src/tree_data_fetcher/provider/tests.rs @@ -413,7 +413,7 @@ async fn using_different_settlement_layers() { .batch_details(number, &get_last_l2_block(&mut storage, number).await) .await .unwrap() - .unwrap_or_else(|_| panic!("no root hash for batch #{number}")); + .unwrap_or_else(|err| panic!("no root hash for batch #{number}: {err:?}")); assert_eq!(root_hash, H256::repeat_byte(number.0 as u8)); let past_l1_batch = provider.past_l1_batch.unwrap(); diff --git a/core/node/node_sync/src/validate_chain_ids_task.rs b/core/node/node_sync/src/validate_chain_ids_task.rs index d5d6c9677038..9dcdba9134c8 100644 --- a/core/node/node_sync/src/validate_chain_ids_task.rs +++ b/core/node/node_sync/src/validate_chain_ids_task.rs @@ -48,9 +48,8 @@ impl ValidateChainIdsTask { l1_client: Option>>, expected: Option, ) -> anyhow::Result<()> { - let (l1_client, expected) = match (l1_client, expected) { - (Some(l1_client), Some(expected)) => (l1_client, expected), - _ => return Ok(()), + let (Some(l1_client), Some(expected)) = (l1_client, expected) else { + return Ok(()); }; loop { diff --git a/core/node/state_keeper/src/io/tests/mod.rs b/core/node/state_keeper/src/io/tests/mod.rs index 536efe82804a..39c9552c2fc5 100644 --- a/core/node/state_keeper/src/io/tests/mod.rs +++ b/core/node/state_keeper/src/io/tests/mod.rs @@ -447,7 +447,7 @@ async fn processing_dynamic_factory_deps_when_sealing_l2_block() { .map(|byte| { let evm_bytecode = vec![byte; 96]; ( - BytecodeHash::for_evm_bytecode(&evm_bytecode).value(), + BytecodeHash::for_raw_evm_bytecode(&evm_bytecode).value(), evm_bytecode, ) }) diff --git a/core/tests/vm-benchmark/src/vm.rs b/core/tests/vm-benchmark/src/vm.rs index e69e7ca1e909..a4b61ee54809 100644 --- a/core/tests/vm-benchmark/src/vm.rs +++ b/core/tests/vm-benchmark/src/vm.rs @@ -113,12 +113,11 @@ impl CountInstructions for Fast { } let (system_env, l1_batch_env) = test_env(); - let mut vm = - vm_fast::Vm::<_, InstructionCount>::custom(l1_batch_env, system_env, &*STORAGE); + let mut vm = vm_fast::Vm::custom(l1_batch_env, system_env, &*STORAGE); vm.push_transaction(tx.clone()); - let mut tracer = InstructionCount(0); + let mut tracer = (InstructionCount(0), ()); vm.inspect(&mut tracer, InspectExecutionMode::OneTx); - tracer.0 + tracer.0 .0 } } diff --git a/infrastructure/zk/src/contract.ts b/infrastructure/zk/src/contract.ts index ba9fe08041db..943248cdd5a2 100644 --- a/infrastructure/zk/src/contract.ts +++ b/infrastructure/zk/src/contract.ts @@ -216,10 +216,12 @@ export async function erc20BridgeFinish(args: any[] = []): Promise { export async function registerHyperchain({ baseTokenName, - deploymentMode + deploymentMode, + allowEvmEmulator }: { baseTokenName?: string; deploymentMode?: DeploymentMode; + allowEvmEmulator?: boolean; }): Promise { await utils.confirmAction(); @@ -241,7 +243,8 @@ export async function registerHyperchain({ privateKey ? `--private-key ${privateKey}` : '', baseTokenName ? `--base-token-name ${baseTokenName}` : '', deploymentMode == DeploymentMode.Validium ? '--validium-mode' : '', - tokenMultiplierSetterAddress ? `--token-multiplier-setter-address ${tokenMultiplierSetterAddress}` : '' + tokenMultiplierSetterAddress ? `--token-multiplier-setter-address ${tokenMultiplierSetterAddress}` : '', + allowEvmEmulator ? '--allow-evm-emulation' : '' ]; await utils.spawn(`yarn l1-contracts register-hyperchain ${args.join(' ')} | tee registerHyperchain.log`); const deployLog = fs.readFileSync('registerHyperchain.log').toString(); diff --git a/infrastructure/zk/src/init.ts b/infrastructure/zk/src/init.ts index 6dbad67b489c..71ae7e1d7469 100644 --- a/infrastructure/zk/src/init.ts +++ b/infrastructure/zk/src/init.ts @@ -106,14 +106,19 @@ type InitHyperchainOptions = { baseTokenName?: string; localLegacyBridgeTesting?: boolean; deploymentMode: DeploymentMode; + allowEvmEmulator?: boolean; }; const initHyperchain = async ({ includePaymaster, baseTokenName, localLegacyBridgeTesting, - deploymentMode + deploymentMode, + allowEvmEmulator }: InitHyperchainOptions): Promise => { - await announced('Registering Hyperchain', contract.registerHyperchain({ baseTokenName, deploymentMode })); + await announced( + 'Registering Hyperchain', + contract.registerHyperchain({ baseTokenName, deploymentMode, allowEvmEmulator }) + ); await announced('Reloading env', env.reload()); await announced('Running server genesis setup', server.genesisFromSources()); await announced( @@ -146,6 +151,7 @@ type InitDevCmdActionOptions = InitSetupOptions & { validiumMode?: boolean; localLegacyBridgeTesting?: boolean; shouldCheckPostgres: boolean; // Whether to perform `cargo sqlx prepare --check` + allowEvmEmulator?: boolean; }; export const initDevCmdAction = async ({ skipEnvSetup, @@ -157,7 +163,8 @@ export const initDevCmdAction = async ({ runObservability, validiumMode, localLegacyBridgeTesting, - shouldCheckPostgres + shouldCheckPostgres, + allowEvmEmulator }: InitDevCmdActionOptions): Promise => { if (localLegacyBridgeTesting) { await makeEraChainIdSameAsCurrent(); @@ -181,7 +188,8 @@ export const initDevCmdAction = async ({ includePaymaster: true, baseTokenName, localLegacyBridgeTesting, - deploymentMode + deploymentMode, + allowEvmEmulator }); if (localLegacyBridgeTesting) { await makeEraAddressSameAsCurrent(); @@ -214,13 +222,15 @@ type InitHyperCmdActionOptions = { baseTokenName?: string; runObservability: boolean; deploymentMode: DeploymentMode; + allowEvmEmulator?: boolean; }; export const initHyperCmdAction = async ({ skipSetupCompletely, bumpChainId, baseTokenName, runObservability, - deploymentMode + deploymentMode, + allowEvmEmulator }: InitHyperCmdActionOptions): Promise => { if (bumpChainId) { config.bumpChainId(); @@ -237,7 +247,8 @@ export const initHyperCmdAction = async ({ await initHyperchain({ includePaymaster: true, baseTokenName, - deploymentMode + deploymentMode, + allowEvmEmulator }); }; @@ -254,6 +265,7 @@ export const initCommand = new Command('init') 'used to test LegacyBridge compatibily. The chain will have the same id as the era chain id, while eraChainId in L2SharedBridge will be 0' ) .option('--should-check-postgres', 'Whether to perform cargo sqlx prepare --check during database setup', true) + .option('--allow-evm-emulator', 'allow deployment of EVM contracts (not supported yet)') .description('Deploys the shared bridge and registers a hyperchain locally, as quickly as possible.') .action(initDevCmdAction); @@ -278,4 +290,5 @@ initCommand .option('--base-token-name ', 'base token name') .option('--validium-mode', 'deploy contracts in Validium mode') .option('--run-observability', 'run observability suite') + .option('--allow-evm-emulator', 'allow deployment of EVM contracts (not supported yet)') .action(initHyperCmdAction); diff --git a/prover/Cargo.lock b/prover/Cargo.lock index 22fd362f8006..2c5d77a274d4 100644 --- a/prover/Cargo.lock +++ b/prover/Cargo.lock @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" [[package]] name = "arr_macro" @@ -241,7 +241,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -252,7 +252,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -323,10 +323,10 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "itoa", "matchit", @@ -341,7 +341,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper 1.0.2", "tokio", - "tower 0.5.1", + "tower 0.5.2", "tower-layer", "tower-service", "tracing", @@ -356,7 +356,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "mime", @@ -441,9 +441,9 @@ dependencies = [ [[package]] name = "bigdecimal" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f850665a0385e070b64c38d2354e6c104c8479c59868d1e48a0c13ee2c7a1c1" +checksum = "7f31f3af01c5c65a07985c804d3366560e6fa7883d640a122819b14ec327482c" dependencies = [ "autocfg", "libm", @@ -480,17 +480,17 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.89", + "syn 2.0.90", "which", ] [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ - "bit-vec", + "bit-vec 0.8.0", ] [[package]] @@ -502,6 +502,12 @@ dependencies = [ "serde", ] +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + [[package]] name = "bitflags" version = "1.3.2" @@ -619,9 +625,9 @@ dependencies = [ [[package]] name = "boojum" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ec2f007ff8f90cc459f03e9f30ca1065440170f013c868823646e2e48d0234" +checksum = "4337dc7b196fc3e5e55e2857bc21638b7441429ee1a953201a9cd2be187b764e" dependencies = [ "arrayvec 0.7.6", "bincode", @@ -651,9 +657,9 @@ dependencies = [ [[package]] name = "boojum-cuda" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b63a717789f92f16fd566c78655d64017c690be59e473c3e769080c975a1f9e" +checksum = "380468fadcba5dcc4021f18f4516a7aa4f4d0ec598c76cd7e7c5f2ff6a56733f" dependencies = [ "boojum", "cmake", @@ -661,6 +667,7 @@ dependencies = [ "era_cudart_sys", "itertools 0.13.0", "lazy_static", + "snark_wrapper", ] [[package]] @@ -683,14 +690,14 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "bstr" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" +checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" dependencies = [ "memchr", "regex-automata 0.4.9", @@ -739,15 +746,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cc" -version = "1.2.1" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ "jobserver", "libc", @@ -783,9 +790,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -798,11 +805,11 @@ dependencies = [ [[package]] name = "circuit_definitions" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76be9ee6e75f1f948d175ab9820ecc7189f72154c95ca503a1974012356f5363" +checksum = "931448074d9dad8aa7cf8f8f8d67101d4b2aac4d1f4699708b0744a9c000fc0b" dependencies = [ - "circuit_encodings 0.150.7", + "circuit_encodings", "crossbeam", "derivative", "seq-macro", @@ -812,117 +819,26 @@ dependencies = [ [[package]] name = "circuit_encodings" -version = "0.140.3" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6b7cc842eadb4c250cdc6a8bc1dd97624d9f08bbe54db3e11fb23c3a72be07" +checksum = "e3dcfcb4aaa17e6a81ebd2db688d980aff50aa643d9b506d4d11c84976dbc03f" dependencies = [ "derivative", "serde", - "zk_evm 0.140.0", - "zkevm_circuits 0.140.3", -] - -[[package]] -name = "circuit_encodings" -version = "0.141.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7898ffbf3cd413576b4b674fe1545a35488c67eb16bd5a4148425e42c2a2b65b" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.141.0", - "zkevm_circuits 0.141.2", -] - -[[package]] -name = "circuit_encodings" -version = "0.142.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8364ecafcc4b2c896023f8d3af952c52a500aa55f14fd268bb5d9ab07f837369" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.141.0", - "zkevm_circuits 0.141.2", -] - -[[package]] -name = "circuit_encodings" -version = "0.150.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2501cc688ef391013019495ae7035cfd54f86987e36d10f73976ce4c5d413c5a" -dependencies = [ - "derivative", - "serde", - "zk_evm 0.150.7", - "zkevm_circuits 0.150.7", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.133.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb959b1f8c6bbd8be711994d182e85452a26a5d2213a709290b71c8262af1331" -dependencies = [ - "derivative", - "rayon", - "serde", - "zk_evm 0.133.0", - "zksync_bellman", + "zk_evm 0.150.18", + "zkevm_circuits", ] [[package]] name = "circuit_sequencer_api" -version = "0.140.3" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa5f22311ce609d852d7d9f4943535ea4610aeb785129ae6ff83d5201c4fb387" +checksum = "d13ed70909e8390a4f2599d5a76d9ac4189e5bbbf16146d11b7999788740f291" dependencies = [ - "circuit_encodings 0.140.3", - "derivative", - "rayon", - "serde", - "zk_evm 0.140.0", - "zksync_bellman", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.141.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c47c71d6ba83a8beb0af13af70beffd627f5497caf3d44c6f96363e788b07ea" -dependencies = [ - "circuit_encodings 0.141.2", - "derivative", - "rayon", - "serde", - "zk_evm 0.141.0", - "zksync_bellman", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.142.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e264723359e6a1aad98110bdccf1ae3ad596e93e7d31da9e40f6adc07e4add54" -dependencies = [ - "circuit_encodings 0.142.2", - "derivative", - "rayon", - "serde", - "zk_evm 0.141.0", - "zksync_bellman", -] - -[[package]] -name = "circuit_sequencer_api" -version = "0.150.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917d27db531fdd98a51e42ea465bc097f48cc849e7fad68d7856087d15125be1" -dependencies = [ - "circuit_encodings 0.150.7", "derivative", "rayon", "serde", + "zk_evm 0.150.18", "zksync_bellman", ] @@ -948,15 +864,15 @@ dependencies = [ "bitflags 1.3.2", "strsim 0.8.0", "textwrap", - "unicode-width", + "unicode-width 0.1.14", "vec_map", ] [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -964,9 +880,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -983,14 +899,14 @@ dependencies = [ "heck 0.5.0", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cmake" @@ -1018,12 +934,12 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -1053,15 +969,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", - "lazy_static", "libc", - "unicode-width", - "windows-sys 0.52.0", + "once_cell", + "unicode-width 0.2.0", + "windows-sys 0.59.0", ] [[package]] @@ -1087,18 +1003,18 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const_format" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c655d81ff1114fb0dcdea9225ea9f0cc712a6f8d189378e82bdf62a473a64b" +checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.33" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff1a44b93f47b1bac19a27932f5c591e43d1ba357ee4f61526c8a25603f0eb1" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", @@ -1194,18 +1110,18 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -1222,18 +1138,18 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" @@ -1292,7 +1208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1329,7 +1245,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1377,7 +1293,7 @@ dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", "strsim 0.11.1", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1399,7 +1315,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1480,7 +1396,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", "unicode-xid 0.2.6", ] @@ -1493,7 +1409,7 @@ dependencies = [ "console", "shell-words", "tempfile", - "thiserror", + "thiserror 1.0.69", "zeroize", ] @@ -1538,7 +1454,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1631,7 +1547,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1694,9 +1610,9 @@ dependencies = [ [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "encoding_rs" @@ -1724,7 +1640,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1736,7 +1652,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1790,9 +1706,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "era_cudart" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad950752eeb44f8938be405b95a1630f82e903f4a7adda355d92aad135fcd382" +checksum = "ac345935bc5d367922a8e44f8b9b8f909f564b4cdc922567e9d3fe6b0fafab28" dependencies = [ "bitflags 2.6.0", "era_cudart_sys", @@ -1801,21 +1717,21 @@ dependencies = [ [[package]] name = "era_cudart_sys" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c38607d52509b5db97cc4447c8644d6c5ca84f22ff8a9254f984669b1eb82ed4" +checksum = "50eca396c549365468fa210b0c9c4a38895e4bff4ae5ce6f6626c337010de143" dependencies = [ "serde_json", ] [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1842,7 +1758,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.10.8", - "thiserror", + "thiserror 1.0.69", "uint", ] @@ -1886,9 +1802,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener", "pin-project-lite", @@ -1896,9 +1812,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "ff" @@ -2024,12 +1940,12 @@ dependencies = [ [[package]] name = "franklin-crypto" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "971289216ea5c91872e5e0bb6989214b537bbce375d09fabea5c3ccfe031b204" +checksum = "5c128e2cf791053b3aefdd7b07d6e5ffdc7cf5dd779ca270d727a403057dfb68" dependencies = [ "arr_macro", - "bit-vec", + "bit-vec 0.6.3", "blake2 0.9.2", "blake2-rfc_bellman_edition", "blake2s_simd", @@ -2158,7 +2074,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2253,7 +2169,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2299,7 +2215,7 @@ dependencies = [ "reqwest 0.12.9", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "tracing", @@ -2313,7 +2229,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04f945a208886a13d07636f38fb978da371d0abc3e34bad338124b9f8c135a8f" dependencies = [ "reqwest 0.12.9", - "thiserror", + "thiserror 1.0.69", "tokio", ] @@ -2343,7 +2259,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "tracing", @@ -2393,7 +2309,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2411,8 +2327,8 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http 1.1.0", - "indexmap 2.6.0", + "http 1.2.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2476,7 +2392,7 @@ dependencies = [ "base64 0.21.7", "bytes", "headers-core", - "http 1.1.0", + "http 1.2.0", "httpdate", "mime", "sha1", @@ -2488,7 +2404,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" dependencies = [ - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -2547,11 +2463,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2578,9 +2494,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -2605,7 +2521,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.2.0", ] [[package]] @@ -2616,7 +2532,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "pin-project-lite", ] @@ -2651,9 +2567,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -2675,15 +2591,15 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", "futures-util", "h2 0.4.7", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "httparse", "httpdate", @@ -2703,8 +2619,8 @@ dependencies = [ "bytes", "futures-util", "headers", - "http 1.1.0", - "hyper 1.5.1", + "http 1.2.0", + "hyper 1.5.2", "hyper-rustls", "hyper-util", "pin-project-lite", @@ -2721,8 +2637,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", - "http 1.1.0", - "hyper 1.5.1", + "http 1.2.0", + "hyper 1.5.2", "hyper-util", "log", "rustls", @@ -2739,7 +2655,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "pin-project-lite", "tokio", @@ -2753,7 +2669,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.31", + "hyper 0.14.32", "native-tls", "tokio", "tokio-native-tls", @@ -2767,7 +2683,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "native-tls", "tokio", @@ -2784,9 +2700,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.5.2", "pin-project-lite", "socket2", "tokio", @@ -2932,7 +2848,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2997,7 +2913,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3012,9 +2928,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -3125,7 +3041,7 @@ dependencies = [ "combine", "jni-sys", "log", - "thiserror", + "thiserror 1.0.69", "walkdir", ] @@ -3146,10 +3062,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -3162,7 +3079,7 @@ dependencies = [ "jsonptr", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3177,7 +3094,7 @@ dependencies = [ "pest_derive", "regex", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3217,14 +3134,14 @@ dependencies = [ "futures-channel", "futures-util", "gloo-net", - "http 1.1.0", + "http 1.2.0", "jsonrpsee-core", "pin-project", "rustls", "rustls-pki-types", "rustls-platform-verifier", "soketto", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-rustls", "tokio-util", @@ -3244,7 +3161,7 @@ dependencies = [ "bytes", "futures-timer", "futures-util", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", "jsonrpsee-types", @@ -3252,7 +3169,7 @@ dependencies = [ "rustc-hash", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", @@ -3268,7 +3185,7 @@ dependencies = [ "async-trait", "base64 0.22.1", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-rustls", "hyper-util", "jsonrpsee-core", @@ -3277,7 +3194,7 @@ dependencies = [ "rustls-platform-verifier", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tower 0.4.13", "tracing", @@ -3294,7 +3211,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3304,10 +3221,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c465fbe385238e861fdc4d1c85e04ada6c1fd246161d26385c1b311724d2af" dependencies = [ "beef", - "http 1.1.0", + "http 1.2.0", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3327,7 +3244,7 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c28759775f5cb2f1ea9667672d3fe2b0e701d1f4b7b67954e60afe7fd058b5e" dependencies = [ - "http 1.1.0", + "http 1.2.0", "jsonrpsee-client-transport", "jsonrpsee-core", "jsonrpsee-types", @@ -3422,10 +3339,10 @@ dependencies = [ "either", "futures 0.3.31", "home", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-http-proxy", "hyper-rustls", "hyper-timeout", @@ -3440,10 +3357,10 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-util", - "tower 0.5.1", + "tower 0.5.2", "tower-http", "tracing", ] @@ -3456,14 +3373,14 @@ checksum = "f42346d30bb34d1d7adc5c549b691bce7aa3a1e60254e68fab7e2d7b26fe3d77" dependencies = [ "chrono", "form_urlencoded", - "http 1.1.0", + "http 1.2.0", "json-patch", "k8s-openapi", "schemars", "serde", "serde-value", "serde_json", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -3476,7 +3393,7 @@ dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", "serde_json", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3501,7 +3418,7 @@ dependencies = [ "pin-project", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-util", "tracing", @@ -3524,15 +3441,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.166" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", "windows-targets 0.52.6", @@ -3575,7 +3492,7 @@ checksum = "612ed4ea9ce5acfb5d26339302528a5e1e59dfed95e9e11af3c083236ff1d15d" dependencies = [ "libc", "neli", - "thiserror", + "thiserror 1.0.69", "windows-sys 0.48.0", ] @@ -3615,7 +3532,7 @@ dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", "regex-syntax 0.6.29", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3678,8 +3595,8 @@ checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ "miette-derive", "once_cell", - "thiserror", - "unicode-width", + "thiserror 1.0.69", + "unicode-width 0.1.14", ] [[package]] @@ -3690,7 +3607,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3717,20 +3634,19 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", ] [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "wasi", "windows-sys 0.52.0", @@ -3991,7 +3907,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4003,7 +3919,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4056,7 +3972,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4088,7 +4004,7 @@ dependencies = [ "js-sys", "once_cell", "pin-project-lite", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -4111,7 +4027,7 @@ checksum = "ad31e9de44ee3538fb9d64fe3376c1362f406162434609e79aea2a41a0af78ab" dependencies = [ "async-trait", "bytes", - "http 1.1.0", + "http 1.2.0", "opentelemetry", "reqwest 0.12.9", ] @@ -4124,14 +4040,14 @@ checksum = "6b925a602ffb916fb7421276b86756027b37ee708f9dce2dbdcc51739f07e727" dependencies = [ "async-trait", "futures-core", - "http 1.1.0", + "http 1.2.0", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", "opentelemetry_sdk", - "prost 0.13.3", + "prost 0.13.4", "reqwest 0.12.9", - "thiserror", + "thiserror 1.0.69", "tokio", "tonic", ] @@ -4144,7 +4060,7 @@ checksum = "30ee9f20bff9c984511a02f082dc8ede839e4a9bf15cc2487c8d6fea5ad850d9" dependencies = [ "opentelemetry", "opentelemetry_sdk", - "prost 0.13.3", + "prost 0.13.4", "tonic", ] @@ -4170,7 +4086,7 @@ dependencies = [ "percent-encoding", "rand 0.8.5", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-stream", ] @@ -4186,9 +4102,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.8.2" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae99c7fa6dd38c7cafe1ec085e804f8f555a2f8659b0dbe03f1f9963a9b51092" +checksum = "e5ca711d8b83edbb00b44d504503cd247c9c0bd8b0fa2694f2a1a3d8165379ce" dependencies = [ "log", "serde", @@ -4215,29 +4131,28 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.7.0" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be4817d39f3272f69c59fe05d0535ae6456c2dc2fa1ba02910296c7e0a5c590" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec 0.7.6", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive", - "rustversion", "serde", ] [[package]] name = "parity-scale-codec-derive" -version = "3.7.0" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8781a75c6205af67215f382092b6e0a4ff3734798523e69073d4bcd294ec767b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 1.0.109", ] [[package]] @@ -4302,20 +4217,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror", + "thiserror 2.0.7", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" dependencies = [ "pest", "pest_generator", @@ -4323,22 +4238,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" dependencies = [ "pest", "pest_meta", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "pest_meta" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" dependencies = [ "once_cell", "pest", @@ -4352,7 +4267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.6.0", + "indexmap 2.7.0", ] [[package]] @@ -4372,7 +4287,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4483,7 +4398,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2 1.0.92", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4595,17 +4510,17 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", - "bit-vec", + "bit-vec 0.8.0", "bitflags 2.6.0", "lazy_static", "num-traits", @@ -4630,12 +4545,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +checksum = "2c0fef6c4230e4ccf618a35c59d7ede15dea37de8427500f50aff708806e42ec" dependencies = [ "bytes", - "prost-derive 0.13.3", + "prost-derive 0.13.4", ] [[package]] @@ -4655,7 +4570,7 @@ dependencies = [ "prost 0.12.6", "prost-types", "regex", - "syn 2.0.89", + "syn 2.0.90", "tempfile", ] @@ -4669,20 +4584,20 @@ dependencies = [ "itertools 0.12.1", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "prost-derive" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +checksum = "157c5a9d7ea5c2ed2d9fb8f495b64759f7816c7eaea54ba3978f0d63000162e3" dependencies = [ "anyhow", "itertools 0.13.0", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4722,7 +4637,7 @@ dependencies = [ "prost-reflect", "prost-types", "protox-parse", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -4734,7 +4649,7 @@ dependencies = [ "logos", "miette", "prost-types", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -4746,7 +4661,7 @@ dependencies = [ "bincode", "chrono", "circuit_definitions", - "clap 4.5.21", + "clap 4.5.23", "colored", "dialoguer", "hex", @@ -4940,9 +4855,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags 2.6.0", ] @@ -5014,7 +4929,7 @@ dependencies = [ "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-tls 0.5.0", "ipnet", "js-sys", @@ -5053,10 +4968,10 @@ dependencies = [ "futures-core", "futures-util", "h2 0.4.7", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-rustls", "hyper-tls 0.6.0", "hyper-util", @@ -5095,18 +5010,18 @@ checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", - "http 1.1.0", + "http 1.2.0", "reqwest 0.12.9", "serde", - "thiserror", + "thiserror 1.0.69", "tower-service", ] [[package]] name = "rescue_poseidon" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82900c877a0ba5362ac5756efbd82c5b795dc509011c1253e2389d8708f1389d" +checksum = "b62e4ce7543582ab2df1d9544674a55897e168a23afe938a57e1547d2981a7f4" dependencies = [ "addchain", "arrayvec 0.7.6", @@ -5267,22 +5182,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "aws-lc-rs", "log", @@ -5339,9 +5254,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" [[package]] name = "rustls-platform-verifier" @@ -5445,7 +5360,7 @@ dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", "serde_derive_internals", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5563,9 +5478,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" [[package]] name = "send_wrapper" @@ -5675,7 +5590,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "time", "url", "uuid", @@ -5689,9 +5604,9 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -5708,13 +5623,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5725,7 +5640,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5792,7 +5707,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "itoa", "ryu", "serde", @@ -5894,12 +5809,11 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] name = "shivini" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2ac4440b6c23005c43a81cf064b9aa123fbeb992ac91cd04c7d485abb1fbea" +checksum = "2673af97e7ea5aef8d1d2ad395e3833a2a9fd8aca6361c2516c44734c0ed92e2" dependencies = [ "bincode", - "blake2 0.10.6", "boojum", "boojum-cuda", "circuit_definitions", @@ -5907,9 +5821,9 @@ dependencies = [ "era_cudart", "era_cudart_sys", "hex", + "itertools 0.13.0", "rand 0.8.5", "serde", - "sha2 0.10.8", "smallvec", ] @@ -5962,7 +5876,7 @@ checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" dependencies = [ "num-bigint 0.4.6", "num-traits", - "thiserror", + "thiserror 1.0.69", "time", ] @@ -5986,20 +5900,21 @@ dependencies = [ [[package]] name = "snark_wrapper" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5dfdc3eed51d79541adff827593743750fe6626a65006814f8cfa4273371de" +checksum = "74645922ea9e18fbd4b6ae9c58e6a7080403edd81e558b610cf5b9dc60a90351" dependencies = [ "derivative", "rand 0.4.6", "rescue_poseidon", + "serde", ] [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -6007,9 +5922,9 @@ dependencies = [ [[package]] name = "soketto" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37468c595637c10857701c990f93a40ce0e357cedb0953d1c26c8d8027f9bb53" +checksum = "2e859df029d160cb88608f5d7df7fb4753fd20fdfb4de5644f3d8b8440841721" dependencies = [ "base64 0.22.1", "bytes", @@ -6101,7 +6016,7 @@ dependencies = [ "hashbrown 0.14.5", "hashlink", "hex", - "indexmap 2.6.0", + "indexmap 2.7.0", "ipnetwork", "log", "memchr", @@ -6115,7 +6030,7 @@ dependencies = [ "sha2 0.10.8", "smallvec", "sqlformat", - "thiserror", + "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", @@ -6132,7 +6047,7 @@ dependencies = [ "quote 1.0.37", "sqlx-core", "sqlx-macros-core", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6155,7 +6070,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.89", + "syn 2.0.90", "tempfile", "tokio", "url", @@ -6201,7 +6116,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.69", "tracing", "whoami", ] @@ -6244,7 +6159,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 1.0.69", "tracing", "whoami", ] @@ -6357,7 +6272,7 @@ dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", "rustversion", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6390,9 +6305,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", @@ -6422,7 +6337,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6520,7 +6435,7 @@ checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6529,7 +6444,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -6538,7 +6453,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" +dependencies = [ + "thiserror-impl 2.0.7", ] [[package]] @@ -6549,7 +6473,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" +dependencies = [ + "proc-macro2 1.0.92", + "quote 1.0.37", + "syn 2.0.90", ] [[package]] @@ -6573,9 +6508,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", @@ -6594,9 +6529,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ "num-conv", "time-core", @@ -6647,9 +6582,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -6671,7 +6606,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6686,20 +6621,19 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -6708,9 +6642,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -6744,7 +6678,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "toml_datetime", "winnow 0.5.40", ] @@ -6755,7 +6689,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "toml_datetime", "winnow 0.6.20", ] @@ -6772,15 +6706,15 @@ dependencies = [ "base64 0.22.1", "bytes", "h2 0.4.7", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-timeout", "hyper-util", "percent-encoding", "pin-project", - "prost 0.13.3", + "prost 0.13.4", "socket2", "tokio", "tokio-stream", @@ -6812,14 +6746,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.2", "tokio", "tokio-util", "tower-layer", @@ -6836,7 +6770,7 @@ dependencies = [ "base64 0.22.1", "bitflags 2.6.0", "bytes", - "http 1.1.0", + "http 1.2.0", "http-body 1.0.1", "mime", "pin-project-lite", @@ -6877,7 +6811,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6921,9 +6855,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -6931,9 +6865,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -6969,7 +6903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7031,9 +6965,9 @@ checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" @@ -7068,6 +7002,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -7110,9 +7050,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.10.1" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" dependencies = [ "base64 0.22.1", "log", @@ -7210,7 +7150,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "671d3b894d5d0849f0a597f56bf071f42d4f2a1cbcf2f78ca21f870ab7c0cc2b" dependencies = [ - "hyper 0.14.31", + "hyper 0.14.32", "once_cell", "tokio", "tracing", @@ -7225,7 +7165,7 @@ checksum = "6a511871dc5de990a3b2a0e715facfbc5da848c0c0395597a1415029fb7c250a" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7270,9 +7210,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -7281,36 +7221,36 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote 1.0.37", "wasm-bindgen-macro-support", @@ -7318,22 +7258,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-streams" @@ -7350,9 +7290,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -7692,7 +7632,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -7714,7 +7654,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7734,7 +7674,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -7755,7 +7695,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7777,7 +7717,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2 1.0.92", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7848,9 +7788,9 @@ dependencies = [ [[package]] name = "zk_evm" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc74fbe2b45fd19e95c59ea792c795feebdb616ebaa463f0ac567f495f47387" +checksum = "3278d0f75408ab35d25998e1124124cd108b48b2a81ed8e71e892ddc5a6be0aa" dependencies = [ "anyhow", "lazy_static", @@ -7858,7 +7798,7 @@ dependencies = [ "serde", "serde_json", "static_assertions", - "zk_evm_abstractions 0.150.7", + "zk_evm_abstractions 0.150.18", ] [[package]] @@ -7889,22 +7829,22 @@ dependencies = [ [[package]] name = "zk_evm_abstractions" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37f333a3b059899df09e40deb041af881bc03e496fda5eec618ffb5e854ee7df" +checksum = "88b4e5a89cfe1594b6476be16c8c1d45f22ce12bff31c49e077b381a398edd8a" dependencies = [ "anyhow", "num_enum 0.6.1", "serde", "static_assertions", - "zkevm_opcode_defs 0.150.7", + "zkevm_opcode_defs 0.150.18", ] [[package]] name = "zkevm-assembly" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf011a0c83cbfb175f1e60811f0e0cd56551c9e35df596a762556662c638deb9" +checksum = "b4fdb2b380c43157160ec5f3f4f6912c6c9923e2a00886e79b7f5464f59108a7" dependencies = [ "env_logger 0.9.3", "hex", @@ -7916,59 +7856,15 @@ dependencies = [ "sha3 0.10.8", "smallvec", "structopt", - "thiserror", - "zkevm_opcode_defs 0.150.7", -] - -[[package]] -name = "zkevm_circuits" -version = "0.140.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c365c801e0c6eda83fbd153df45575172beb406bfb663d386f9154b4325eda" -dependencies = [ - "arrayvec 0.7.6", - "bincode", - "boojum", - "derivative", - "hex", - "itertools 0.10.5", - "rand 0.4.6", - "rand 0.8.5", - "seq-macro", - "serde", - "serde_json", - "smallvec", - "zkevm_opcode_defs 0.132.0", - "zksync_cs_derive", -] - -[[package]] -name = "zkevm_circuits" -version = "0.141.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccd0352e122a4e6f0046d2163b7e692e627b23fc3264faa77331a21b65833fd" -dependencies = [ - "arrayvec 0.7.6", - "bincode", - "boojum", - "derivative", - "hex", - "itertools 0.10.5", - "rand 0.4.6", - "rand 0.8.5", - "seq-macro", - "serde", - "serde_json", - "smallvec", - "zkevm_opcode_defs 0.141.0", - "zksync_cs_derive", + "thiserror 1.0.69", + "zkevm_opcode_defs 0.150.18", ] [[package]] name = "zkevm_circuits" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06fb35b00699d25175a2ad447f86a9088af8b0bc698bb57086fb04c13e52eab" +checksum = "8b94288d2e246aecd6eecd22ef27db0d1f29a91cb4f59b9e339a45237131a9ff" dependencies = [ "arrayvec 0.7.6", "boojum", @@ -7980,7 +7876,7 @@ dependencies = [ "seq-macro", "serde", "smallvec", - "zkevm_opcode_defs 0.150.7", + "zkevm_opcode_defs 0.150.18", "zksync_cs_derive", ] @@ -8028,9 +7924,9 @@ dependencies = [ [[package]] name = "zkevm_opcode_defs" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b83f3b279248af4ca86dec20a54127f02110b45570f3f6c1d13df49ba75c28a5" +checksum = "5bad437d4891536fdcc0054a3f04562c408817ff19d83b6c27569217692e6e74" dependencies = [ "bitflags 2.6.0", "blake2 0.10.6", @@ -8045,13 +7941,14 @@ dependencies = [ [[package]] name = "zkevm_test_harness" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c801aa17e9009699aacf654588d6adfaeeb8a490b2d9121847c201e2766803" +checksum = "9bd2de75d0bf68137ba150e05dd5d36baad03e682e06b8616643c72b3fcce05d" dependencies = [ "bincode", "circuit_definitions", - "circuit_sequencer_api 0.150.7", + "circuit_encodings", + "circuit_sequencer_api", "codegen", "crossbeam", "derivative", @@ -8072,9 +7969,9 @@ dependencies = [ [[package]] name = "zksync-gpu-ffi" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5688dc060456f6c1e790d589f3abd6d9e9a11eb393d7383fbeb23b55961951e0" +checksum = "bc1f77eb5f1a513357e53fba148f46a03fdbea222dc71f270123984059c285bf" dependencies = [ "cmake", "crossbeam", @@ -8087,11 +7984,11 @@ dependencies = [ [[package]] name = "zksync-gpu-prover" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5714848e6f8361820346483246dd68b4e7fb05ec41dd6610a8b53fb5c3ca7f3a" +checksum = "3cc0c452445a120c5928e0ac89d47242f407b303ee819e3b7b2a97f6ce7491e4" dependencies = [ - "bit-vec", + "bit-vec 0.6.3", "cfg-if", "crossbeam", "franklin-crypto", @@ -8104,9 +8001,9 @@ dependencies = [ [[package]] name = "zksync-wrapper-prover" -version = "0.151.1" +version = "0.152.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a6a1863818d939d445c53af57e53c222f11c2c94b9a94c3612dd938a3d983c" +checksum = "972dc1059d4a97ad075ab5a3589722b16d22c5241ba6e711ac18a73195aa6584" dependencies = [ "circuit_definitions", "zkevm_test_harness", @@ -8129,19 +8026,19 @@ dependencies = [ "serde_with", "sha2 0.10.8", "strum", - "thiserror", + "thiserror 1.0.69", "tiny-keccak 2.0.2", "url", ] [[package]] name = "zksync_bellman" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffa03efe9bdb137a4b36b97d1a74237e18c9ae42b755163d903a9d48c1a5d80" +checksum = "6b7c0061db44757522f2d82cad02f45dc98267210ac362071234ed08e30fd4d6" dependencies = [ "arrayvec 0.7.6", - "bit-vec", + "bit-vec 0.6.3", "blake2s_simd", "byteorder", "cfg-if", @@ -8164,7 +8061,7 @@ dependencies = [ "anyhow", "async-trait", "bincode", - "clap 4.5.21", + "clap 4.5.23", "shivini", "tokio", "tokio-util", @@ -8209,16 +8106,16 @@ dependencies = [ [[package]] name = "zksync_concurrency" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24c9a056499823227503dd9e5fb3037d93bcc3ae9b06c1ac0a47334c6283af" +checksum = "e8312ab73d3caa55775bd531795b507fa8f76bd9dabfaeb0954fe43e8fc1323b" dependencies = [ "anyhow", "once_cell", "pin-project", "rand 0.8.5", "sha3 0.10.8", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "tracing", @@ -8244,9 +8141,9 @@ dependencies = [ [[package]] name = "zksync_consensus_crypto" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da303b01f24283e93f80f361bf62c3df4a761d061c8b38b4faebeebf26362fc" +checksum = "86b539960de98df3c3bd27d2d9b97de862027686bbb3bdfc5aaad5b74bb929a1" dependencies = [ "anyhow", "blst", @@ -8258,25 +8155,25 @@ dependencies = [ "num-traits", "rand 0.8.5", "sha3 0.10.8", - "thiserror", + "thiserror 1.0.69", "tracing", "zeroize", ] [[package]] name = "zksync_consensus_roles" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f07db2a8ec2d2cda5cb4c5ac408101e81c8fa5d95c9f3302829dafae78d11c" +checksum = "c49949546895a10431b9daec6ec4208ef0917ace006446d304b51f5b234ba462" dependencies = [ "anyhow", - "bit-vec", + "bit-vec 0.6.3", "hex", "num-bigint 0.4.6", "prost 0.12.6", "rand 0.8.5", "serde", - "thiserror", + "thiserror 1.0.69", "tracing", "zksync_concurrency", "zksync_consensus_crypto", @@ -8287,15 +8184,15 @@ dependencies = [ [[package]] name = "zksync_consensus_storage" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a42f57cc5afcee634cbd336e9e6ea891d0171352d7c0bc7d6e17f6c8faa554" +checksum = "feb0d6a54e7d8d2adeee4ba38662161e9309180ad497299092e5641db9fb1c1e" dependencies = [ "anyhow", "async-trait", "prost 0.12.6", "rand 0.8.5", - "thiserror", + "thiserror 1.0.69", "tracing", "vise", "zksync_concurrency", @@ -8307,13 +8204,13 @@ dependencies = [ [[package]] name = "zksync_consensus_utils" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3222410c67617a86edb192e0c4bb48afc254a17052200a0a839c90e8b0378842" +checksum = "723e2a4b056cc5af192a83163c89a6951ee75c098cc5c4a4cdc435f4232d88bd" dependencies = [ "anyhow", "rand 0.8.5", - "thiserror", + "thiserror 1.0.69", "zksync_concurrency", ] @@ -8356,15 +8253,15 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "thiserror", + "thiserror 1.0.69", "zksync_basic_types", ] [[package]] name = "zksync_cs_derive" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5939e2df4288c263c706ff18ac718e984149223ad4289d6d957d767dcfc04c81" +checksum = "63296ce43c432d5d0111604173e874b2f2a856e1cb1c76378fa0bb5ac6018c27" dependencies = [ "proc-macro-error", "proc-macro2 1.0.92", @@ -8388,7 +8285,7 @@ dependencies = [ "serde_json", "sqlx", "strum", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "vise", @@ -8416,7 +8313,7 @@ dependencies = [ "serde", "serde_json", "sqlx", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "vise", @@ -8441,7 +8338,7 @@ dependencies = [ "async-trait", "jsonrpsee", "rlp", - "thiserror", + "thiserror 1.0.69", "tracing", "vise", "zksync_config", @@ -8457,16 +8354,16 @@ version = "0.1.0" dependencies = [ "async-trait", "rlp", - "thiserror", + "thiserror 1.0.69", "zksync_basic_types", "zksync_crypto_primitives", ] [[package]] name = "zksync_ff" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9524b06780b5e164e84b38840c7c428c739f051f35af6efc4d1285f629ceb88e" +checksum = "e6a500c97d9286f73540c26b63ae33b159bd48fec0c8bd206b4a9b4fe1217b8a" dependencies = [ "byteorder", "hex", @@ -8477,9 +8374,9 @@ dependencies = [ [[package]] name = "zksync_ff_derive" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f91e58e75d65877f09f83bc3dca8f054847ae7ec4f3e64bfa610a557edd8e8e" +checksum = "97bd48f18ebf350623093022d86be2f1ce23af332efa91890b751209aec8617a" dependencies = [ "num-bigint 0.4.6", "num-integer", @@ -8492,9 +8389,9 @@ dependencies = [ [[package]] name = "zksync_kzg" -version = "0.150.7" +version = "0.150.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc58af8e4e4ad1a851ffd2275e6a44ead0f15a7eaac9dc9d60a56b3b9c9b08e8" +checksum = "6384d2475e4a7e6ed4e2a703724cac1d8972d9ec40c49fdd17bf37942a81a635" dependencies = [ "boojum", "derivative", @@ -8504,7 +8401,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "zkevm_circuits 0.150.7", + "zkevm_circuits", ] [[package]] @@ -8538,23 +8435,19 @@ name = "zksync_multivm" version = "0.1.0" dependencies = [ "anyhow", - "circuit_sequencer_api 0.133.1", - "circuit_sequencer_api 0.140.3", - "circuit_sequencer_api 0.141.2", - "circuit_sequencer_api 0.142.2", - "circuit_sequencer_api 0.150.7", + "circuit_sequencer_api", "ethabi", "hex", "itertools 0.10.5", "once_cell", - "thiserror", + "thiserror 1.0.69", "tracing", "vise", "zk_evm 0.131.0-rc.2", "zk_evm 0.133.0", "zk_evm 0.140.0", "zk_evm 0.141.0", - "zk_evm 0.150.7", + "zk_evm 0.150.18", "zksync_contracts", "zksync_mini_merkle_tree", "zksync_system_constants", @@ -8573,7 +8466,7 @@ dependencies = [ "flate2", "google-cloud-auth", "google-cloud-storage", - "http 1.1.0", + "http 1.2.0", "prost 0.12.6", "rand 0.8.5", "reqwest 0.12.9", @@ -8588,9 +8481,9 @@ dependencies = [ [[package]] name = "zksync_pairing" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8412ae5574472fa567a097e183f9a01974b99dd0b5da3bfa1bbe6c57c579aa2" +checksum = "3b91b38db3a3f0f80d8b1f2342c77751ee8d63b746268e5719abbb5dfb150a8c" dependencies = [ "byteorder", "cfg-if", @@ -8606,8 +8499,8 @@ dependencies = [ "anyhow", "async-trait", "bincode", - "circuit_sequencer_api 0.150.7", - "clap 4.5.21", + "circuit_sequencer_api", + "clap 4.5.23", "ctrlc", "futures 0.3.31", "reqwest 0.12.9", @@ -8635,12 +8528,12 @@ dependencies = [ [[package]] name = "zksync_protobuf" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05755c38b134b409736008bfdfd0fdb42bfa061947be93be4c78069aa10c9b3" +checksum = "e8986ad796f8e00d8999fee72effba1a21bce40f5f877d681ac9cd89a94834d8" dependencies = [ "anyhow", - "bit-vec", + "bit-vec 0.6.3", "once_cell", "prost 0.12.6", "prost-reflect", @@ -8656,9 +8549,9 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c3930a73ca667780be6dcd94e469d40a93fa52f4654c9ab732991b62238cb5" +checksum = "8d870b31995e3acb8e47afeb68ebeeffcf6121e70020e65b3d5d31692115d236" dependencies = [ "anyhow", "heck 0.5.0", @@ -8668,7 +8561,7 @@ dependencies = [ "prost-reflect", "protox", "quote 1.0.37", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8684,6 +8577,7 @@ dependencies = [ "serde_yaml", "tracing", "zksync_basic_types", + "zksync_concurrency", "zksync_config", "zksync_protobuf", "zksync_protobuf_build", @@ -8744,7 +8638,7 @@ dependencies = [ "anyhow", "async-trait", "circuit_definitions", - "clap 4.5.21", + "clap 4.5.23", "ctrlc", "futures 0.3.31", "local-ip-address", @@ -8777,7 +8671,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-trait", - "clap 4.5.21", + "clap 4.5.23", "ctrlc", "futures 0.3.31", "log", @@ -8830,7 +8724,7 @@ name = "zksync_prover_interface" version = "0.1.0" dependencies = [ "chrono", - "circuit_sequencer_api 0.150.7", + "circuit_sequencer_api", "serde", "serde_with", "strum", @@ -8846,7 +8740,7 @@ dependencies = [ "anyhow", "async-trait", "axum", - "clap 4.5.21", + "clap 4.5.23", "ctrlc", "serde", "tokio", @@ -8882,6 +8776,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", + "boojum-cuda", "circuit_definitions", "futures 0.3.31", "hex", @@ -8913,9 +8808,9 @@ dependencies = [ [[package]] name = "zksync_solidity_vk_codegen" -version = "0.30.1" +version = "0.30.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b310ab8a21681270e73f177ddf7974cabb7a96f0624ab8b008fd6ee1f9b4f687" +checksum = "6f03e137db1b29be36abfa1e1e682dd3864b0335c68282c8dab68c2d397b8cbd" dependencies = [ "ethereum-types", "franklin-crypto", @@ -8958,7 +8853,7 @@ dependencies = [ "serde_json", "serde_with", "strum", - "thiserror", + "thiserror 1.0.69", "tracing", "zksync_basic_types", "zksync_contracts", @@ -8978,6 +8873,7 @@ dependencies = [ "once_cell", "reqwest 0.12.9", "serde_json", + "sha2 0.10.8", "tokio", "tracing", "zksync_vlog", @@ -8989,7 +8885,7 @@ version = "0.1.0" dependencies = [ "anyhow", "circuit_definitions", - "clap 4.5.21", + "clap 4.5.23", "indicatif", "proptest", "toml_edit 0.14.4", @@ -9017,7 +8913,7 @@ dependencies = [ "sentry", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "time", "tokio", "tracing", @@ -9035,8 +8931,8 @@ source = "git+https://github.com/matter-labs/vm2.git?rev=457d8a7eea9093af9440662 dependencies = [ "enum_dispatch", "primitive-types", - "zk_evm_abstractions 0.150.7", - "zkevm_opcode_defs 0.150.7", + "zk_evm_abstractions 0.150.18", + "zkevm_opcode_defs 0.150.18", "zksync_vm2_interface", ] @@ -9057,7 +8953,7 @@ dependencies = [ "hex", "pretty_assertions", "serde", - "thiserror", + "thiserror 1.0.69", "tracing", "zksync_contracts", "zksync_system_constants", @@ -9077,7 +8973,7 @@ dependencies = [ "rustls", "serde", "serde_json", - "thiserror", + "thiserror 1.0.69", "tokio", "tracing", "vise", @@ -9130,7 +9026,7 @@ dependencies = [ "anyhow", "async-trait", "bincode", - "clap 4.5.21", + "clap 4.5.23", "ctrlc", "tokio", "tracing", diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 15e819d77f7d..aea458cb9e48 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -67,13 +67,14 @@ url = "2.5.2" vise = "0.2.0" # Proving dependencies -circuit_definitions = "=0.150.7" -circuit_sequencer_api = "=0.150.7" -zkevm_test_harness = "=0.150.7" +circuit_definitions = "=0.150.18" +circuit_sequencer_api = "=0.150.18" +zkevm_test_harness = "=0.150.18" # GPU proving dependencies -wrapper_prover = { package = "zksync-wrapper-prover", version = "=0.151.1" } -shivini = "=0.151.1" +wrapper_prover = { package = "zksync-wrapper-prover", version = "=0.152.9" } +shivini = "=0.152.9" +boojum-cuda = "=0.152.9" # Core workspace dependencies zksync_multivm = { path = "../core/lib/multivm", version = "0.1.0" } diff --git a/prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs b/prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs index cfd588c26662..9817362c9fea 100644 --- a/prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs +++ b/prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs @@ -1,6 +1,6 @@ #[cfg(feature = "gpu")] pub mod gpu_prover { - use std::{collections::HashMap, sync::Arc, time::Instant}; + use std::{alloc::Global, collections::HashMap, sync::Arc, time::Instant}; use anyhow::Context as _; use shivini::{ @@ -174,7 +174,7 @@ pub mod gpu_prover { DefaultTranscript, DefaultTreeHasher, NoPow, - _, + Global, >( &gpu_proof_config, &witness_vector, diff --git a/prover/crates/bin/prover_fri/src/lib.rs b/prover/crates/bin/prover_fri/src/lib.rs index 39757795d980..76a97f119f4b 100644 --- a/prover/crates/bin/prover_fri/src/lib.rs +++ b/prover/crates/bin/prover_fri/src/lib.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] // We have to use generic const exprs. -#![feature(generic_const_exprs)] +#![feature(generic_const_exprs, allocator_api)] mod metrics; pub mod prover_job_processor; pub mod utils; diff --git a/prover/crates/bin/prover_fri/src/main.rs b/prover/crates/bin/prover_fri/src/main.rs index cbba8d0ddb4f..d464cb630be2 100644 --- a/prover/crates/bin/prover_fri/src/main.rs +++ b/prover/crates/bin/prover_fri/src/main.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] // We have to use generic const exprs. -#![feature(generic_const_exprs)] +#![feature(generic_const_exprs, allocator_api)] use std::{future::Future, sync::Arc, time::Duration}; diff --git a/prover/crates/bin/witness_generator/src/rounds/basic_circuits/mod.rs b/prover/crates/bin/witness_generator/src/rounds/basic_circuits/mod.rs index adb2bf72d04f..233e59877cb8 100644 --- a/prover/crates/bin/witness_generator/src/rounds/basic_circuits/mod.rs +++ b/prover/crates/bin/witness_generator/src/rounds/basic_circuits/mod.rs @@ -4,7 +4,7 @@ use async_trait::async_trait; use circuit_definitions::zkevm_circuits::scheduler::{ block_header::BlockAuxilaryOutputWitness, input::SchedulerCircuitInstanceWitness, }; -use zksync_multivm::circuit_sequencer_api_latest::boojum::{ +use zkevm_test_harness::boojum::{ field::goldilocks::{GoldilocksExt2, GoldilocksField}, gadgets::recursion::recursive_tree_hasher::CircuitGoldilocksPoseidon2Sponge, }; diff --git a/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs b/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs index 31dc54814103..348ba1dcd996 100644 --- a/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs +++ b/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs @@ -11,11 +11,11 @@ use circuit_definitions::{ }; use tokio::sync::Semaphore; use tracing::Instrument; -use zkevm_test_harness::witness::oracle::WitnessGenerationArtifact; +use zkevm_test_harness::{ + boojum::field::goldilocks::GoldilocksField, witness::oracle::WitnessGenerationArtifact, +}; use zksync_multivm::{ - circuit_sequencer_api_latest::{ - boojum::field::goldilocks::GoldilocksField, geometry_config::get_geometry_config, - }, + circuit_sequencer_api_latest::geometry_config::ProtocolGeometry, interface::storage::StorageView, vm_latest::{constants::MAX_CYCLES_FOR_TX, HistoryDisabled, StorageOracle as VmStorageOracle}, zk_evm_latest::ethereum_types::Address, @@ -52,7 +52,7 @@ pub(super) async fn generate_witness( input.merkle_paths, input.previous_batch_metadata.root_hash.0, ); - let geometry_config = get_geometry_config(); + let geometry_config = ProtocolGeometry::V1_5_0.config(); let mut hasher = DefaultHasher::new(); geometry_config.hash(&mut hasher); tracing::info!( diff --git a/prover/crates/lib/circuit_prover_service/src/lib.rs b/prover/crates/lib/circuit_prover_service/src/lib.rs index 0d7b146cc43b..bbf1f9733f6f 100644 --- a/prover/crates/lib/circuit_prover_service/src/lib.rs +++ b/prover/crates/lib/circuit_prover_service/src/lib.rs @@ -1,5 +1,5 @@ #![allow(incomplete_features)] // Crypto code uses generic const exprs -#![feature(generic_const_exprs)] +#![feature(generic_const_exprs, allocator_api)] mod gpu_circuit_prover; pub mod job_runner; mod metrics; diff --git a/prover/crates/lib/circuit_prover_service/src/types/circuit.rs b/prover/crates/lib/circuit_prover_service/src/types/circuit.rs index 19c05666b2c5..264daba63b7d 100644 --- a/prover/crates/lib/circuit_prover_service/src/types/circuit.rs +++ b/prover/crates/lib/circuit_prover_service/src/types/circuit.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::{alloc::Global, sync::Arc}; use anyhow::Context; use shivini::{gpu_proof_config::GpuProofConfig, gpu_prove_from_external_witness_data}; @@ -84,7 +84,7 @@ impl Circuit { let span = tracing::info_span!("prove_base_circuit").entered(); let gpu_proof_config = GpuProofConfig::from_base_layer_circuit(circuit); let boojum_proof_config = base_layer_proof_config(); - let proof = gpu_prove_from_external_witness_data::( + let proof = gpu_prove_from_external_witness_data::( &gpu_proof_config, &witness_vector, boojum_proof_config, @@ -113,7 +113,7 @@ impl Circuit { let span = tracing::info_span!("prove_recursive_circuit").entered(); let gpu_proof_config = GpuProofConfig::from_recursive_layer_circuit(circuit); let boojum_proof_config = recursion_layer_proof_config(); - let proof = gpu_prove_from_external_witness_data::( + let proof = gpu_prove_from_external_witness_data::( &gpu_proof_config, &witness_vector, boojum_proof_config, diff --git a/prover/crates/lib/keystore/Cargo.toml b/prover/crates/lib/keystore/Cargo.toml index 4d9addc26bc0..8dac09b782c0 100644 --- a/prover/crates/lib/keystore/Cargo.toml +++ b/prover/crates/lib/keystore/Cargo.toml @@ -17,6 +17,7 @@ zksync_prover_fri_types.workspace = true zkevm_test_harness.workspace = true circuit_definitions = { workspace = true, features = ["log_tracing"] } shivini = { workspace = true, optional = true } +boojum-cuda = { workspace = true, optional = true } anyhow.workspace = true tracing.workspace = true @@ -32,4 +33,4 @@ futures = { workspace = true, features = ["compat"] } [features] default = [] -gpu = ["shivini"] +gpu = ["shivini", "boojum-cuda"] diff --git a/prover/crates/lib/keystore/src/lib.rs b/prover/crates/lib/keystore/src/lib.rs index 7e60e3fa29cd..543b7b18ffe5 100644 --- a/prover/crates/lib/keystore/src/lib.rs +++ b/prover/crates/lib/keystore/src/lib.rs @@ -1,6 +1,8 @@ #![feature(allocator_api)] use serde::{Deserialize, Serialize}; +#[cfg(feature = "gpu")] +use shivini::cs::GpuSetup; use zkevm_test_harness::compute_setups::CircuitSetupData; use zksync_prover_fri_types::circuit_definitions::boojum::{ algebraic_props::{round_function::AbsorptionModeOverwrite, sponge::GenericAlgebraicSponge}, @@ -19,8 +21,6 @@ use zksync_prover_fri_types::circuit_definitions::boojum::{ }, implementations::poseidon2::Poseidon2Goldilocks, }; -#[cfg(feature = "gpu")] -use {shivini::cs::GpuSetup, std::alloc::Global}; pub mod commitment_utils; pub mod keystore; @@ -84,11 +84,12 @@ impl From for GoldilocksProverSetupData { #[cfg(feature = "gpu")] #[derive(Debug, Serialize, Deserialize)] #[serde(bound = "F: serde::Serialize + serde::de::DeserializeOwned")] -pub struct GpuProverSetupData> { - pub setup: GpuSetup, +pub struct GpuProverSetupData> +{ + pub setup: GpuSetup, #[serde(bound( - serialize = "H::Output: serde::Serialize", - deserialize = "H::Output: serde::de::DeserializeOwned" + serialize = ">::Output: serde::Serialize", + deserialize = ">::Output: serde::de::DeserializeOwned" ))] pub vk: VerificationKey, pub finalization_hint: FinalizationHintsForProver, diff --git a/prover/crates/lib/keystore/src/setup_data_generator.rs b/prover/crates/lib/keystore/src/setup_data_generator.rs index c4790d67feaa..0bbd6cb5d14d 100644 --- a/prover/crates/lib/keystore/src/setup_data_generator.rs +++ b/prover/crates/lib/keystore/src/setup_data_generator.rs @@ -5,13 +5,17 @@ use std::collections::HashMap; use anyhow::Context as _; use zkevm_test_harness::{ - compute_setups::{generate_circuit_setup_data, CircuitSetupData}, + compute_setups::{ + generate_circuit_setup_data, light::generate_light_circuit_setup_data, CircuitSetupData, + }, data_source::SetupDataSource, }; use zksync_prover_fri_types::ProverServiceDataKey; #[cfg(feature = "gpu")] use { - crate::GpuProverSetupData, shivini::cs::setup::GpuSetup, shivini::ProverContext, + crate::GpuProverSetupData, + boojum_cuda::poseidon2::GLHasher, + shivini::{cs::gpu_setup_and_vk_from_base_setup_vk_params_and_hints, ProverContext}, zksync_prover_fri_types::circuit_definitions::boojum::worker::Worker, }; @@ -25,7 +29,7 @@ pub fn generate_setup_data_common( ) -> anyhow::Result { let mut data_source = keystore.load_keys_to_data_source()?; let circuit_setup_data = generate_circuit_setup_data( - circuit.is_base_layer(), + circuit.round as u8, // TODO: Actually it's called "ProvingStage" now circuit.circuit_id, &mut data_source, ) @@ -151,20 +155,29 @@ impl SetupDataGenerator for GPUSetupDataGenerator { { let _context = ProverContext::create().context("failed initializing gpu prover context")?; - let circuit_setup_data = generate_setup_data_common(&self.keystore, circuit)?; - let worker = Worker::new(); - let gpu_setup_data = GpuSetup::from_setup_and_hints( - circuit_setup_data.setup_base, - circuit_setup_data.setup_tree, - circuit_setup_data.vars_hint.clone(), - circuit_setup_data.wits_hint, - &worker, + let mut data_source = self.keystore.load_keys_to_data_source()?; + let circuit_setup_data = generate_light_circuit_setup_data( + circuit.round as u8, + circuit.circuit_id, + &mut data_source, ) - .context("failed creating GPU base layer setup data")?; + .unwrap(); + + let worker = Worker::new(); + // TODO: add required assertions + let (gpu_setup_data, vk) = + gpu_setup_and_vk_from_base_setup_vk_params_and_hints::( + circuit_setup_data.setup_base, + circuit_setup_data.vk_geometry, + circuit_setup_data.vars_hint.clone(), + circuit_setup_data.wits_hint, + &worker, + ) + .context("failed creating GPU base layer setup data")?; let gpu_prover_setup_data = GpuProverSetupData { setup: gpu_setup_data, - vk: circuit_setup_data.vk, + vk: vk.clone(), finalization_hint: circuit_setup_data.finalization_hint, }; // Serialization should always succeed. diff --git a/prover/setup-data-gpu-keys.json b/prover/setup-data-gpu-keys.json index 4acc51b9add0..8a3bdeb262c1 100644 --- a/prover/setup-data-gpu-keys.json +++ b/prover/setup-data-gpu-keys.json @@ -1,5 +1,5 @@ { - "us": "gs://matterlabs-setup-data-us/ffc5da2-gpu/", - "europe": "gs://matterlabs-setup-data-europe/ffc5da2-gpu/", - "asia": "gs://matterlabs-setup-data-asia/ffc5da2-gpu/" + "us": "gs://matterlabs-setup-data-us/dc3bba7-gpu/", + "europe": "gs://matterlabs-setup-data-europe/dc3bba7-gpu/", + "asia": "gs://matterlabs-setup-data-asia/dc3bba7-gpu/" } diff --git a/zkstack_cli/Cargo.lock b/zkstack_cli/Cargo.lock index 0de098ff9a6f..342c61e20d15 100644 --- a/zkstack_cli/Cargo.lock +++ b/zkstack_cli/Cargo.lock @@ -7192,9 +7192,9 @@ dependencies = [ [[package]] name = "zksync_concurrency" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c24c9a056499823227503dd9e5fb3037d93bcc3ae9b06c1ac0a47334c6283af" +checksum = "e8312ab73d3caa55775bd531795b507fa8f76bd9dabfaeb0954fe43e8fc1323b" dependencies = [ "anyhow", "once_cell", @@ -7225,9 +7225,9 @@ dependencies = [ [[package]] name = "zksync_consensus_crypto" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da303b01f24283e93f80f361bf62c3df4a761d061c8b38b4faebeebf26362fc" +checksum = "86b539960de98df3c3bd27d2d9b97de862027686bbb3bdfc5aaad5b74bb929a1" dependencies = [ "anyhow", "blst", @@ -7246,9 +7246,9 @@ dependencies = [ [[package]] name = "zksync_consensus_roles" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f07db2a8ec2d2cda5cb4c5ac408101e81c8fa5d95c9f3302829dafae78d11c" +checksum = "c49949546895a10431b9daec6ec4208ef0917ace006446d304b51f5b234ba462" dependencies = [ "anyhow", "bit-vec", @@ -7268,9 +7268,9 @@ dependencies = [ [[package]] name = "zksync_consensus_utils" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3222410c67617a86edb192e0c4bb48afc254a17052200a0a839c90e8b0378842" +checksum = "723e2a4b056cc5af192a83163c89a6951ee75c098cc5c4a4cdc435f4232d88bd" dependencies = [ "anyhow", "rand", @@ -7347,9 +7347,9 @@ dependencies = [ [[package]] name = "zksync_protobuf" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f05755c38b134b409736008bfdfd0fdb42bfa061947be93be4c78069aa10c9b3" +checksum = "e8986ad796f8e00d8999fee72effba1a21bce40f5f877d681ac9cd89a94834d8" dependencies = [ "anyhow", "bit-vec", @@ -7368,9 +7368,9 @@ dependencies = [ [[package]] name = "zksync_protobuf_build" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c3930a73ca667780be6dcd94e469d40a93fa52f4654c9ab732991b62238cb5" +checksum = "8d870b31995e3acb8e47afeb68ebeeffcf6121e70020e65b3d5d31692115d236" dependencies = [ "anyhow", "heck", @@ -7396,6 +7396,7 @@ dependencies = [ "serde_yaml", "tracing", "zksync_basic_types", + "zksync_concurrency", "zksync_config", "zksync_protobuf", "zksync_protobuf_build", @@ -7452,6 +7453,7 @@ dependencies = [ "once_cell", "reqwest 0.12.9", "serde_json", + "sha2", "tokio", "tracing", "zksync_vlog", diff --git a/zkstack_cli/Cargo.toml b/zkstack_cli/Cargo.toml index bad5ebf1ec76..0e4b43bc66b7 100644 --- a/zkstack_cli/Cargo.toml +++ b/zkstack_cli/Cargo.toml @@ -19,7 +19,6 @@ repository = "https://github.com/matter-labs/zksync-era/tree/main/zkstack_cli/" description = "ZK Stack CLI is a set of tools for working with zk stack." keywords = ["zk", "cryptography", "blockchain", "ZKStack", "ZKsync"] - [workspace.dependencies] # Local dependencies common = { path = "crates/common" } @@ -32,11 +31,11 @@ zksync_config = { path = "../core/lib/config" } zksync_protobuf_config = { path = "../core/lib/protobuf_config" } zksync_basic_types = { path = "../core/lib/basic_types" } zksync_system_constants = { path = "../core/lib/constants" } -zksync_consensus_roles = "=0.6.0" -zksync_consensus_crypto = "=0.6.0" -zksync_consensus_utils = "=0.6.0" -zksync_protobuf = "=0.6.0" -zksync_protobuf_build = "=0.6.0" +zksync_consensus_roles = "=0.7.0" +zksync_consensus_crypto = "=0.7.0" +zksync_consensus_utils = "=0.7.0" +zksync_protobuf = "=0.7.0" +zksync_protobuf_build = "=0.7.0" zksync_types = { path = "../core/lib/types" } zksync_web3_decl = { path = "../core/lib/web3_decl" } zksync_eth_client = { path = "../core/lib/eth_client" } diff --git a/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs b/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs index 39ba23ac8c55..465bec2c740f 100644 --- a/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs +++ b/zkstack_cli/crates/config/src/forge_interface/register_chain/input.rs @@ -62,6 +62,7 @@ pub struct ChainL1Config { pub base_token_gas_price_multiplier_denominator: u64, pub governance_security_council_address: Address, pub governance_min_delay: u64, + pub allow_evm_emulator: bool, } impl ZkStackConfig for RegisterChainL1Config {} @@ -116,6 +117,7 @@ impl RegisterChainL1Config { == L1BatchCommitmentMode::Validium, validator_sender_operator_commit_eth: wallets_config.operator.address, validator_sender_operator_blobs_eth: wallets_config.blob_operator.address, + allow_evm_emulator: chain_config.evm_emulator, }, owner_address: wallets_config.governor.address, governance: contracts.l1.governance_addr, diff --git a/zkstack_cli/crates/config/src/forge_interface/script_params.rs b/zkstack_cli/crates/config/src/forge_interface/script_params.rs index 5cb80a49536c..8100478ebbc0 100644 --- a/zkstack_cli/crates/config/src/forge_interface/script_params.rs +++ b/zkstack_cli/crates/config/src/forge_interface/script_params.rs @@ -100,3 +100,9 @@ pub const FINALIZE_UPGRADE_SCRIPT_PARAMS: ForgeScriptParams = ForgeScriptParams output: "script-out/gateway-finalize-upgrade.toml", script_path: "deploy-scripts/upgrade/FinalizeUpgrade.s.sol", }; + +pub const ENABLE_EVM_EMULATOR_PARAMS: ForgeScriptParams = ForgeScriptParams { + input: "script-config/enable-evm-emulator.toml", + output: "script-out/output-enable-evm-emulator.toml", + script_path: "deploy-scripts/EnableEvmEmulator.s.sol", +}; diff --git a/zkstack_cli/crates/config/src/genesis.rs b/zkstack_cli/crates/config/src/genesis.rs index 2d9ac7fcdc66..e457f3d1924c 100644 --- a/zkstack_cli/crates/config/src/genesis.rs +++ b/zkstack_cli/crates/config/src/genesis.rs @@ -1,6 +1,5 @@ use std::path::Path; -use anyhow::Context as _; use xshell::Shell; use zksync_basic_types::L1ChainId; pub use zksync_config::GenesisConfig; @@ -20,14 +19,6 @@ pub fn update_from_chain_config( // TODO(EVM-676): for now, the settlement layer is always the same as the L1 network genesis.l1_chain_id = L1ChainId(config.l1_network.chain_id()); genesis.l1_batch_commit_data_generator_mode = config.l1_batch_commit_data_generator_mode; - genesis.evm_emulator_hash = if config.evm_emulator { - Some(genesis.evm_emulator_hash.context( - "impossible to initialize a chain with EVM emulator: the template genesis config \ - does not contain EVM emulator hash", - )?) - } else { - None - }; Ok(()) } diff --git a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh index cafbd31a1f9d..f0320d9cf89e 100644 --- a/zkstack_cli/crates/zkstack/completion/_zkstack.zsh +++ b/zkstack_cli/crates/zkstack/completion/_zkstack.zsh @@ -634,7 +634,7 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(convert-to-gateway) +(enable-evm-emulator) _arguments "${_arguments_options[@]}" : \ '--verify=[Verify deployed contracts]' \ '--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ @@ -644,7 +644,6 @@ _arguments "${_arguments_options[@]}" : \ '*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ '--chain=[Chain to use]:CHAIN:_default' \ '--resume[]' \ -'--zksync[]' \ '-v[Verbose mode]' \ '--verbose[Verbose mode]' \ '--ignore-prerequisites[Ignores prerequisites checks]' \ @@ -652,63 +651,6 @@ _arguments "${_arguments_options[@]}" : \ '--help[Print help (see more with '\''--help'\'')]' \ && ret=0 ;; -(migrate-to-gateway) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--gateway-chain-name=[]:GATEWAY_CHAIN_NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'--zksync[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(migrate-from-gateway) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--gateway-chain-name=[]:GATEWAY_CHAIN_NAME:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'--zksync[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -&& ret=0 -;; -(gateway-upgrade) -_arguments "${_arguments_options[@]}" : \ -'--verify=[Verify deployed contracts]' \ -'--verifier=[Verifier to use]:VERIFIER:(etherscan sourcify blockscout oklink)' \ -'--verifier-url=[Verifier URL, if using a custom provider]:VERIFIER_URL:_default' \ -'--verifier-api-key=[Verifier API key]:VERIFIER_API_KEY:_default' \ -'*-a+[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'*--additional-args=[List of additional arguments that can be passed through the CLI]:ADDITIONAL_ARGS:_default' \ -'--chain=[Chain to use]:CHAIN:_default' \ -'--resume[]' \ -'--zksync[]' \ -'-v[Verbose mode]' \ -'--verbose[Verbose mode]' \ -'--ignore-prerequisites[Ignores prerequisites checks]' \ -'-h[Print help (see more with '\''--help'\'')]' \ -'--help[Print help (see more with '\''--help'\'')]' \ -':chain_upgrade_stage:(adapt-config prepare-stage1 schedule-stage1 finalize-stage1 finalize-stage2 keep-up-stage2 set-l2weth-for-chain)' \ -&& ret=0 -;; (help) _arguments "${_arguments_options[@]}" : \ ":: :_zkstack__chain__help_commands" \ @@ -809,19 +751,7 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; -(convert-to-gateway) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate-to-gateway) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate-from-gateway) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(gateway-upgrade) +(enable-evm-emulator) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; @@ -2826,19 +2756,7 @@ _arguments "${_arguments_options[@]}" : \ _arguments "${_arguments_options[@]}" : \ && ret=0 ;; -(convert-to-gateway) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate-to-gateway) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(migrate-from-gateway) -_arguments "${_arguments_options[@]}" : \ -&& ret=0 -;; -(gateway-upgrade) +(enable-evm-emulator) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; @@ -3369,10 +3287,7 @@ _zkstack__chain_commands() { 'deploy-upgrader:Deploy Default Upgrader' \ 'deploy-paymaster:Deploy paymaster smart contract' \ 'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'convert-to-gateway:Prepare chain to be an eligible gateway' \ -'migrate-to-gateway:Migrate chain to gateway' \ -'migrate-from-gateway:Migrate chain from gateway' \ -'gateway-upgrade:Upgrade to the protocol version that supports Gateway' \ +'enable-evm-emulator:Enable EVM emulation on chain (Not supported yet)' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'zkstack chain commands' commands "$@" @@ -3427,10 +3342,10 @@ _zkstack__chain__deploy-upgrader_commands() { local commands; commands=() _describe -t commands 'zkstack chain deploy-upgrader commands' commands "$@" } -(( $+functions[_zkstack__chain__gateway-upgrade_commands] )) || -_zkstack__chain__gateway-upgrade_commands() { +(( $+functions[_zkstack__chain__enable-evm-emulator_commands] )) || +_zkstack__chain__enable-evm-emulator_commands() { local commands; commands=() - _describe -t commands 'zkstack chain gateway-upgrade commands' commands "$@" + _describe -t commands 'zkstack chain enable-evm-emulator commands' commands "$@" } (( $+functions[_zkstack__chain__genesis_commands] )) || _zkstack__chain__genesis_commands() { @@ -3491,10 +3406,7 @@ _zkstack__chain__help_commands() { 'deploy-upgrader:Deploy Default Upgrader' \ 'deploy-paymaster:Deploy paymaster smart contract' \ 'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'convert-to-gateway:Prepare chain to be an eligible gateway' \ -'migrate-to-gateway:Migrate chain to gateway' \ -'migrate-from-gateway:Migrate chain from gateway' \ -'gateway-upgrade:Upgrade to the protocol version that supports Gateway' \ +'enable-evm-emulator:Enable EVM emulation on chain (Not supported yet)' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'zkstack chain help commands' commands "$@" @@ -3549,10 +3461,10 @@ _zkstack__chain__help__deploy-upgrader_commands() { local commands; commands=() _describe -t commands 'zkstack chain help deploy-upgrader commands' commands "$@" } -(( $+functions[_zkstack__chain__help__gateway-upgrade_commands] )) || -_zkstack__chain__help__gateway-upgrade_commands() { +(( $+functions[_zkstack__chain__help__enable-evm-emulator_commands] )) || +_zkstack__chain__help__enable-evm-emulator_commands() { local commands; commands=() - _describe -t commands 'zkstack chain help gateway-upgrade commands' commands "$@" + _describe -t commands 'zkstack chain help enable-evm-emulator commands' commands "$@" } (( $+functions[_zkstack__chain__help__genesis_commands] )) || _zkstack__chain__help__genesis_commands() { @@ -4844,10 +4756,7 @@ _zkstack__help__chain_commands() { 'deploy-upgrader:Deploy Default Upgrader' \ 'deploy-paymaster:Deploy paymaster smart contract' \ 'update-token-multiplier-setter:Update Token Multiplier Setter address on L1' \ -'convert-to-gateway:Prepare chain to be an eligible gateway' \ -'migrate-to-gateway:Migrate chain to gateway' \ -'migrate-from-gateway:Migrate chain from gateway' \ -'gateway-upgrade:Upgrade to the protocol version that supports Gateway' \ +'enable-evm-emulator:Enable EVM emulation on chain (Not supported yet)' \ ) _describe -t commands 'zkstack help chain commands' commands "$@" } @@ -4901,10 +4810,10 @@ _zkstack__help__chain__deploy-upgrader_commands() { local commands; commands=() _describe -t commands 'zkstack help chain deploy-upgrader commands' commands "$@" } -(( $+functions[_zkstack__help__chain__gateway-upgrade_commands] )) || -_zkstack__help__chain__gateway-upgrade_commands() { +(( $+functions[_zkstack__help__chain__enable-evm-emulator_commands] )) || +_zkstack__help__chain__enable-evm-emulator_commands() { local commands; commands=() - _describe -t commands 'zkstack help chain gateway-upgrade commands' commands "$@" + _describe -t commands 'zkstack help chain enable-evm-emulator commands' commands "$@" } (( $+functions[_zkstack__help__chain__genesis_commands] )) || _zkstack__help__chain__genesis_commands() { diff --git a/zkstack_cli/crates/zkstack/completion/zkstack.fish b/zkstack_cli/crates/zkstack/completion/zkstack.fish index fe65907f3922..19434f21762e 100644 --- a/zkstack_cli/crates/zkstack/completion/zkstack.fish +++ b/zkstack_cli/crates/zkstack/completion/zkstack.fish @@ -153,28 +153,26 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_se complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "setup-observability" -d 'Setup observability for the ecosystem, downloading Grafana dashboards from the era-observability repo' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "gateway-upgrade" -d 'Gateway version upgrade' complete -c zkstack -n "__fish_zkstack_using_subcommand ecosystem; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -s h -l help -d 'Print help' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "build-transactions" -d 'Create unsigned transactions for chain deployment' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "genesis" -d 'Run server genesis' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "register-chain" -d 'Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note: After completion, L2 governor can accept ownership by running `accept-chain-ownership`' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "deploy-l2-contracts" -d 'Deploy all L2 contracts (executed by L1 governor)' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "accept-chain-ownership" -d 'Accept ownership of L2 chain (executed by L2 governor). This command should be run after `register-chain` to accept ownership of newly created DiamondProxy contract' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "deploy-consensus-registry" -d 'Deploy L2 consensus registry' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "deploy-multicall3" -d 'Deploy L2 multicall3' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "deploy-timestamp-asserter" -d 'Deploy L2 TimestampAsserter' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "convert-to-gateway" -d 'Prepare chain to be an eligible gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "migrate-to-gateway" -d 'Migrate chain to gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "migrate-from-gateway" -d 'Migrate chain from gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "gateway-upgrade" -d 'Upgrade to the protocol version that supports Gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -l chain -d 'Chain to use' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -s v -l verbose -d 'Verbose mode' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -l ignore-prerequisites -d 'Ignores prerequisites checks' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -s h -l help -d 'Print help' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "build-transactions" -d 'Create unsigned transactions for chain deployment' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "genesis" -d 'Run server genesis' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "register-chain" -d 'Register a new chain on L1 (executed by L1 governor). This command deploys and configures Governance, ChainAdmin, and DiamondProxy contracts, registers chain with BridgeHub and sets pending admin for DiamondProxy. Note: After completion, L2 governor can accept ownership by running `accept-chain-ownership`' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "deploy-l2-contracts" -d 'Deploy all L2 contracts (executed by L1 governor)' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "accept-chain-ownership" -d 'Accept ownership of L2 chain (executed by L2 governor). This command should be run after `register-chain` to accept ownership of newly created DiamondProxy contract' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "initialize-bridges" -d 'Initialize bridges on L2' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "deploy-consensus-registry" -d 'Deploy L2 consensus registry' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "deploy-multicall3" -d 'Deploy L2 multicall3' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "deploy-timestamp-asserter" -d 'Deploy L2 TimestampAsserter' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "enable-evm-emulator" -d 'Enable EVM emulation on chain (Not supported yet)' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and not __fish_seen_subcommand_from create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l chain-name -r complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l chain-id -d 'Chain ID' -r complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from create" -l prover-mode -d 'Prover options' -r -f -a "{no-proofs\t'',gpu\t''}" @@ -338,52 +336,16 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_s complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from update-token-multiplier-setter" -s v -l verbose -d 'Verbose mode' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from update-token-multiplier-setter" -l ignore-prerequisites -d 'Ignores prerequisites checks' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from update-token-multiplier-setter" -s h -l help -d 'Print help (see more with \'--help\')' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l verifier-url -d 'Verifier URL, if using a custom provider' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l verifier-api-key -d 'Verifier API key' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l resume -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l zksync -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from convert-to-gateway" -s h -l help -d 'Print help (see more with \'--help\')' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l verifier-url -d 'Verifier URL, if using a custom provider' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l verifier-api-key -d 'Verifier API key' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l gateway-chain-name -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l resume -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l zksync -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-to-gateway" -s h -l help -d 'Print help (see more with \'--help\')' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l verifier-url -d 'Verifier URL, if using a custom provider' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l verifier-api-key -d 'Verifier API key' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l gateway-chain-name -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l resume -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l zksync -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from migrate-from-gateway" -s h -l help -d 'Print help (see more with \'--help\')' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l verifier-url -d 'Verifier URL, if using a custom provider' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l verifier-api-key -d 'Verifier API key' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l chain -d 'Chain to use' -r -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l resume -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l zksync -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -s v -l verbose -d 'Verbose mode' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -l ignore-prerequisites -d 'Ignores prerequisites checks' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from gateway-upgrade" -s h -l help -d 'Print help (see more with \'--help\')' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l verify -d 'Verify deployed contracts' -r -f -a "{true\t'',false\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l verifier -d 'Verifier to use' -r -f -a "{etherscan\t'',sourcify\t'',blockscout\t'',oklink\t''}" +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l verifier-url -d 'Verifier URL, if using a custom provider' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l verifier-api-key -d 'Verifier API key' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -s a -l additional-args -d 'List of additional arguments that can be passed through the CLI' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l chain -d 'Chain to use' -r +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l resume +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -s v -l verbose -d 'Verbose mode' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -l ignore-prerequisites -d 'Ignores prerequisites checks' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from enable-evm-emulator" -s h -l help -d 'Print help (see more with \'--help\')' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "create" -d 'Create a new chain, setting the necessary configurations for later initialization' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "build-transactions" -d 'Create unsigned transactions for chain deployment' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "init" -d 'Initialize chain, deploying necessary contracts and performing on-chain operations' @@ -397,10 +359,7 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_s complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "convert-to-gateway" -d 'Prepare chain to be an eligible gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "migrate-to-gateway" -d 'Migrate chain to gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "migrate-from-gateway" -d 'Migrate chain from gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "gateway-upgrade" -d 'Upgrade to the protocol version that supports Gateway' +complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "enable-evm-emulator" -d 'Enable EVM emulation on chain (Not supported yet)' complete -c zkstack -n "__fish_zkstack_using_subcommand chain; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and not __fish_seen_subcommand_from database test clean snapshot lint fmt prover contracts config-writer send-transactions status generate-genesis help" -l chain -d 'Chain to use' -r complete -c zkstack -n "__fish_zkstack_using_subcommand dev; and not __fish_seen_subcommand_from database test clean snapshot lint fmt prover contracts config-writer send-transactions status generate-genesis help" -s v -l verbose -d 'Verbose mode' @@ -830,10 +789,7 @@ complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_su complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "deploy-upgrader" -d 'Deploy Default Upgrader' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "deploy-paymaster" -d 'Deploy paymaster smart contract' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "update-token-multiplier-setter" -d 'Update Token Multiplier Setter address on L1' -complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "convert-to-gateway" -d 'Prepare chain to be an eligible gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "migrate-to-gateway" -d 'Migrate chain to gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "migrate-from-gateway" -d 'Migrate chain from gateway' -complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "gateway-upgrade" -d 'Upgrade to the protocol version that supports Gateway' +complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from chain" -f -a "enable-evm-emulator" -d 'Enable EVM emulation on chain (Not supported yet)' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from dev" -f -a "database" -d 'Database related commands' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from dev" -f -a "test" -d 'Run tests' complete -c zkstack -n "__fish_zkstack_using_subcommand help; and __fish_seen_subcommand_from dev" -f -a "clean" -d 'Clean artifacts' diff --git a/zkstack_cli/crates/zkstack/completion/zkstack.sh b/zkstack_cli/crates/zkstack/completion/zkstack.sh index 43fe8e7de771..251f4fc94055 100644 --- a/zkstack_cli/crates/zkstack/completion/zkstack.sh +++ b/zkstack_cli/crates/zkstack/completion/zkstack.sh @@ -87,8 +87,8 @@ _zkstack() { zkstack__chain,deploy-upgrader) cmd="zkstack__chain__deploy__upgrader" ;; - zkstack__chain,gateway-upgrade) - cmd="zkstack__chain__gateway__upgrade" + zkstack__chain,enable-evm-emulator) + cmd="zkstack__chain__enable__evm__emulator" ;; zkstack__chain,genesis) cmd="zkstack__chain__genesis" @@ -159,8 +159,8 @@ _zkstack() { zkstack__chain__help,deploy-upgrader) cmd="zkstack__chain__help__deploy__upgrader" ;; - zkstack__chain__help,gateway-upgrade) - cmd="zkstack__chain__help__gateway__upgrade" + zkstack__chain__help,enable-evm-emulator) + cmd="zkstack__chain__help__enable__evm__emulator" ;; zkstack__chain__help,genesis) cmd="zkstack__chain__help__genesis" @@ -816,8 +816,8 @@ _zkstack() { zkstack__help__chain,deploy-upgrader) cmd="zkstack__help__chain__deploy__upgrader" ;; - zkstack__help__chain,gateway-upgrade) - cmd="zkstack__help__chain__gateway__upgrade" + zkstack__help__chain,enable-evm-emulator) + cmd="zkstack__help__chain__enable__evm__emulator" ;; zkstack__help__chain,genesis) cmd="zkstack__help__chain__genesis" @@ -1171,7 +1171,7 @@ _zkstack() { return 0 ;; zkstack__chain) - opts="-v -h --verbose --chain --ignore-prerequisites --help create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" + opts="-v -h --verbose --chain --ignore-prerequisites --help create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1693,6 +1693,48 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + zkstack__chain__enable__evm__emulator) + opts="-a -v -h --verify --verifier --verifier-url --verifier-api-key --resume --additional-args --verbose --chain --ignore-prerequisites --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --verify) + COMPREPLY=($(compgen -W "true false" -- "${cur}")) + return 0 + ;; + --verifier) + COMPREPLY=($(compgen -W "etherscan sourcify blockscout oklink" -- "${cur}")) + return 0 + ;; + --verifier-url) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --verifier-api-key) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --additional-args) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + -a) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + --chain) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; zkstack__chain__genesis) opts="-d -d -v -h --server-db-url --server-db-name --dev --dont-drop --verbose --chain --ignore-prerequisites --help init-database server help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then @@ -1820,7 +1862,7 @@ _zkstack() { return 0 ;; zkstack__chain__help) - opts="create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade help" + opts="create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1973,7 +2015,7 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__chain__help__gateway__upgrade) + zkstack__chain__help__enable__evm__emulator) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) @@ -5908,7 +5950,7 @@ _zkstack() { return 0 ;; zkstack__help__chain) - opts="create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter convert-to-gateway migrate-to-gateway migrate-from-gateway gateway-upgrade" + opts="create build-transactions init genesis register-chain deploy-l2-contracts accept-chain-ownership initialize-bridges deploy-consensus-registry deploy-multicall3 deploy-timestamp-asserter deploy-upgrader deploy-paymaster update-token-multiplier-setter enable-evm-emulator" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -6061,7 +6103,7 @@ _zkstack() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; - zkstack__help__chain__gateway__upgrade) + zkstack__help__chain__enable__evm__emulator) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs b/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs new file mode 100644 index 000000000000..a6bbd2c9dc70 --- /dev/null +++ b/zkstack_cli/crates/zkstack/src/commands/chain/enable_evm_emulator.rs @@ -0,0 +1,49 @@ +use anyhow::Context; +use common::{forge::ForgeScriptArgs, logger}; +use config::{traits::ReadConfigWithBasePath, EcosystemConfig, GenesisConfig}; +use xshell::Shell; + +use crate::{ + enable_evm_emulator::enable_evm_emulator, + messages::{ + MSG_CHAIN_NOT_INITIALIZED, MSG_EVM_EMULATOR_ENABLED, MSG_EVM_EMULATOR_HASH_MISSING_ERR, + MSG_L1_SECRETS_MUST_BE_PRESENTED, + }, +}; + +pub async fn run(args: ForgeScriptArgs, shell: &Shell) -> anyhow::Result<()> { + let ecosystem_config = EcosystemConfig::from_file(shell)?; + let chain_config = ecosystem_config + .load_current_chain() + .context(MSG_CHAIN_NOT_INITIALIZED)?; + + let default_genesis_config = GenesisConfig::read_with_base_path( + shell, + EcosystemConfig::default_configs_path(&chain_config.link_to_code), + )?; + + let has_evm_emulation_support = default_genesis_config.evm_emulator_hash.is_some(); + anyhow::ensure!(has_evm_emulation_support, MSG_EVM_EMULATOR_HASH_MISSING_ERR); + + let contracts = chain_config.get_contracts_config()?; + let secrets = chain_config.get_secrets_config()?; + let l1_rpc_url = secrets + .l1 + .context(MSG_L1_SECRETS_MUST_BE_PRESENTED)? + .l1_rpc_url + .expose_str() + .to_string(); + + enable_evm_emulator( + shell, + &ecosystem_config, + contracts.l1.chain_admin_addr, + &chain_config.get_wallets_config()?.governor, + contracts.l1.diamond_proxy_addr, + &args, + l1_rpc_url, + ) + .await?; + logger::success(MSG_EVM_EMULATOR_ENABLED); + Ok(()) +} diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs index 91ffb9508a53..0a53894911b3 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/init/mod.rs @@ -22,6 +22,7 @@ use crate::{ set_token_multiplier_setter::set_token_multiplier_setter, setup_legacy_bridge::setup_legacy_bridge, }, + enable_evm_emulator::enable_evm_emulator, messages::{ msg_initializing_chain, MSG_ACCEPTING_ADMIN_SPINNER, MSG_CHAIN_INITIALIZED, MSG_CHAIN_NOT_FOUND_ERR, MSG_DA_PAIR_REGISTRATION_SPINNER, MSG_DEPLOYING_PAYMASTER, @@ -113,7 +114,7 @@ pub async fn init( contracts_config.l1.chain_admin_addr, &chain_config.get_wallets_config()?.governor, contracts_config.l1.diamond_proxy_addr, - &init_args.forge_args.clone(), + &init_args.forge_args, init_args.l1_rpc_url.clone(), ) .await?; @@ -146,6 +147,20 @@ pub async fn init( spinner.finish(); } + // Enable EVM emulation if needed (run by L2 Governor) + if chain_config.evm_emulator { + enable_evm_emulator( + shell, + ecosystem_config, + contracts_config.l1.chain_admin_addr, + &chain_config.get_wallets_config()?.governor, + contracts_config.l1.diamond_proxy_addr, + &init_args.forge_args, + init_args.l1_rpc_url.clone(), + ) + .await?; + } + // Deploy L2 contracts: L2SharedBridge, L2DefaultUpgrader, ... (run by L1 Governor) deploy_l2_contracts::deploy_l2_contracts( shell, diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs index 31bbd7290e54..07216c0e461b 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/mod.rs @@ -21,6 +21,7 @@ pub mod convert_to_gateway; pub mod create; pub mod deploy_l2_contracts; pub mod deploy_paymaster; +mod enable_evm_emulator; pub mod gateway_upgrade; pub mod genesis; pub mod init; @@ -79,6 +80,8 @@ pub enum ChainCommands { MigrateFromGateway(MigrateFromGatewayArgs), /// Upgrade to the protocol version that supports Gateway GatewayUpgrade(GatewayUpgradeArgs), + /// Enable EVM emulation on chain (Not supported yet) + EnableEvmEmulator(ForgeScriptArgs), } pub(crate) async fn run(shell: &Shell, args: ChainCommands) -> anyhow::Result<()> { @@ -112,5 +115,6 @@ pub(crate) async fn run(shell: &Shell, args: ChainCommands) -> anyhow::Result<() ChainCommands::MigrateToGateway(args) => migrate_to_gateway::run(args, shell).await, ChainCommands::MigrateFromGateway(args) => migrate_from_gateway::run(args, shell).await, ChainCommands::GatewayUpgrade(args) => gateway_upgrade::run(args, shell).await, + ChainCommands::EnableEvmEmulator(args) => enable_evm_emulator::run(args, shell).await, } } diff --git a/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs b/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs new file mode 100644 index 000000000000..bda1bfb3fc81 --- /dev/null +++ b/zkstack_cli/crates/zkstack/src/enable_evm_emulator.rs @@ -0,0 +1,52 @@ +use common::{ + forge::{Forge, ForgeScript, ForgeScriptArgs}, + spinner::Spinner, + wallets::Wallet, +}; +use config::{forge_interface::script_params::ENABLE_EVM_EMULATOR_PARAMS, EcosystemConfig}; +use ethers::{abi::parse_abi, contract::BaseContract, types::Address}; +use xshell::Shell; + +use crate::{ + messages::MSG_ENABLING_EVM_EMULATOR, + utils::forge::{check_the_balance, fill_forge_private_key, WalletOwner}, +}; + +pub async fn enable_evm_emulator( + shell: &Shell, + ecosystem_config: &EcosystemConfig, + admin: Address, + governor: &Wallet, + target_address: Address, + forge_args: &ForgeScriptArgs, + l1_rpc_url: String, +) -> anyhow::Result<()> { + let enable_evm_emulator_contract = BaseContract::from( + parse_abi(&["function chainAllowEvmEmulation(address chainAdmin, address target) public"]) + .unwrap(), + ); + let calldata = enable_evm_emulator_contract + .encode("chainAllowEvmEmulation", (admin, target_address)) + .unwrap(); + let foundry_contracts_path = ecosystem_config.path_to_l1_foundry(); + let forge = Forge::new(&foundry_contracts_path) + .script(&ENABLE_EVM_EMULATOR_PARAMS.script(), forge_args.clone()) + .with_ffi() + .with_rpc_url(l1_rpc_url) + .with_broadcast() + .with_calldata(&calldata); + enable_evm_inner(shell, governor, forge).await +} + +async fn enable_evm_inner( + shell: &Shell, + governor: &Wallet, + mut forge: ForgeScript, +) -> anyhow::Result<()> { + forge = fill_forge_private_key(forge, Some(governor), WalletOwner::Governor)?; + check_the_balance(&forge).await?; + let spinner = Spinner::new(MSG_ENABLING_EVM_EMULATOR); + forge.run(shell)?; + spinner.finish(); + Ok(()) +} diff --git a/zkstack_cli/crates/zkstack/src/main.rs b/zkstack_cli/crates/zkstack/src/main.rs index 8a115201fc81..ff4589a99cc5 100644 --- a/zkstack_cli/crates/zkstack/src/main.rs +++ b/zkstack_cli/crates/zkstack/src/main.rs @@ -23,6 +23,7 @@ pub mod accept_ownership; mod commands; mod consts; mod defaults; +pub mod enable_evm_emulator; pub mod external_node; mod messages; mod utils; diff --git a/zkstack_cli/crates/zkstack/src/messages.rs b/zkstack_cli/crates/zkstack/src/messages.rs index b69d5706130d..0ea7a687c7e9 100644 --- a/zkstack_cli/crates/zkstack/src/messages.rs +++ b/zkstack_cli/crates/zkstack/src/messages.rs @@ -86,6 +86,7 @@ pub(super) const MSG_CHAIN_INITIALIZED: &str = "Chain initialized successfully"; pub(super) const MSG_CHAIN_CONFIGS_INITIALIZED: &str = "Chain configs were initialized"; pub(super) const MSG_CHAIN_OWNERSHIP_TRANSFERRED: &str = "Chain ownership was transferred successfully"; +pub(super) const MSG_EVM_EMULATOR_ENABLED: &str = "EVM emulator enabled successfully"; pub(super) const MSG_CHAIN_REGISTERED: &str = "Chain registraion was successful"; pub(super) const MSG_DISTRIBUTING_ETH_SPINNER: &str = "Distributing eth..."; pub(super) const MSG_MINT_BASE_TOKEN_SPINNER: &str = @@ -274,6 +275,9 @@ pub(super) const MSG_SERVER_URING_HELP: &str = "Enables uring support for RocksD /// Accept ownership related messages pub(super) const MSG_ACCEPTING_GOVERNANCE_SPINNER: &str = "Accepting governance..."; +/// EVM emulator related messages +pub(super) const MSG_ENABLING_EVM_EMULATOR: &str = "Enabling EVM emulator..."; + /// Containers related messages pub(super) const MSG_STARTING_CONTAINERS: &str = "Starting containers"; pub(super) const MSG_STARTING_DOCKER_CONTAINERS_SPINNER: &str =