diff --git a/Cargo.lock b/Cargo.lock index 0e5db14b733..c478fb95bcd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,7 +677,7 @@ source = "git+https://github.com/matter-labs/bellman?branch=dev#5520aa2274afe73d dependencies = [ "arrayvec 0.7.3", "bit-vec", - "blake2s_const", + "blake2s_const 0.6.0 (git+https://github.com/matter-labs/bellman?branch=dev)", "blake2s_simd", "byteorder", "cfg-if 1.0.0", @@ -686,7 +686,30 @@ dependencies = [ "hex", "lazy_static", "num_cpus", - "pairing_ce", + "pairing_ce 0.28.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.6", + "serde", + "smallvec", + "tiny-keccak 1.5.0", +] + +[[package]] +name = "bellman_ce" +version = "0.3.2" +source = "git+https://github.com/matter-labs/bellman?branch=snark-wrapper#e01e5fa08a97a113e76ec8a69d06fe6cc2c82d17" +dependencies = [ + "arrayvec 0.7.3", + "bit-vec", + "blake2s_const 0.6.0 (git+https://github.com/matter-labs/bellman?branch=snark-wrapper)", + "blake2s_simd", + "byteorder", + "cfg-if 1.0.0", + "crossbeam 0.7.3", + "futures 0.3.28", + "hex", + "lazy_static", + "num_cpus", + "pairing_ce 0.28.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6", "serde", "smallvec", @@ -821,6 +844,16 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "blake2s_const" +version = "0.6.0" +source = "git+https://github.com/matter-labs/bellman?branch=snark-wrapper#e01e5fa08a97a113e76ec8a69d06fe6cc2c82d17" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq", +] + [[package]] name = "blake2s_simd" version = "0.5.11" @@ -903,6 +936,37 @@ dependencies = [ "zksync_types", ] +[[package]] +name = "boojum" +version = "0.1.0" +source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#2771569baab9a59690d88cee6ba9b295c8a1e4c4" +dependencies = [ + "arrayvec 0.7.3", + "bincode", + "blake2 0.10.6", + "const_format", + "convert_case 0.4.0", + "crossbeam 0.7.3", + "crypto-bigint 0.5.3", + "cs_derive 0.1.0 (git+https://github.com/matter-labs/era-boojum.git?branch=main)", + "derivative", + "ethereum-types 0.14.1", + "firestorm", + "itertools", + "lazy_static", + "num-modular", + "num_cpus", + "packed_simd", + "pairing_ce 0.28.5 (git+https://github.com/matter-labs/pairing.git)", + "rand 0.8.5", + "rayon", + "serde", + "sha2 0.10.6", + "sha3 0.10.6", + "smallvec", + "unroll", +] + [[package]] name = "brotli" version = "3.3.4" @@ -1118,12 +1182,27 @@ dependencies = [ "generic-array 0.14.7", ] +[[package]] +name = "circuit_definitions" +version = "0.1.0" +source = "git+https://github.com/matter-labs/era-zkevm_test_harness.git?branch=v1.4.0#1934433af48520ac70dc3080b0d1feba877a07c5" +dependencies = [ + "crossbeam 0.8.2", + "derivative", + "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=snark_wrapper)", + "rescue_poseidon 0.4.1 (git+https://github.com/matter-labs/rescue-poseidon.git?branch=poseidon2)", + "serde", + "snark_wrapper", + "zk_evm 1.4.0", + "zkevm_circuits", +] + [[package]] name = "circuit_testing" version = "0.1.0" source = "git+https://github.com/matter-labs/era-circuit_testing.git?branch=main#164c0adac85be39ee44bd9456b2b91cdede5af80" dependencies = [ - "bellman_ce", + "bellman_ce 0.3.2 (git+https://github.com/matter-labs/bellman?branch=dev)", ] [[package]] @@ -1230,11 +1309,11 @@ version = "0.1.0" source = "git+https://github.com/matter-labs/solidity_plonk_verifier.git?branch=dev#82f96b7156551087f1c9bfe4f0ea68845b6debfc" dependencies = [ "ethereum-types 0.14.1", - "franklin-crypto", + "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=dev)", "handlebars", "hex", "paste", - "rescue_poseidon", + "rescue_poseidon 0.4.1 (git+https://github.com/matter-labs/rescue-poseidon)", "serde", "serde_derive", "serde_json", @@ -1289,6 +1368,26 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +[[package]] +name = "const_format" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c990efc7a285731f9a4378d81aff2f0e85a2c8781a05ef0f8baa8dac54d0ff48" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e026b6ce194a874cb9cf32cd5772d1ef9767cc8fcb5765948d74f37a9d8b2bf6" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "unicode-xid 0.2.4", +] + [[package]] name = "constant_time_eq" version = "0.1.5" @@ -1591,6 +1690,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -1621,6 +1730,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "cs_derive" +version = "0.1.0" +source = "git+https://github.com/matter-labs/era-boojum.git?branch=main#2771569baab9a59690d88cee6ba9b295c8a1e4c4" +dependencies = [ + "proc-macro-error", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + [[package]] name = "cs_derive" version = "0.1.0" @@ -2084,6 +2204,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "firestorm" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c5f6c2c942da57e2aaaa84b8a521489486f14e75e7fa91dab70aba913975f98" + [[package]] name = "fixed-hash" version = "0.7.0" @@ -2154,12 +2280,44 @@ version = "0.0.5" source = "git+https://github.com/matter-labs/franklin-crypto?branch=dev#5695d07c7bc604c2c39a27712ffac171d39ee1ed" dependencies = [ "arr_macro", - "bellman_ce", + "bellman_ce 0.3.2 (git+https://github.com/matter-labs/bellman?branch=dev)", + "bit-vec", + "blake2 0.9.2", + "blake2-rfc_bellman_edition", + "blake2s_simd", + "byteorder", + "digest 0.9.0", + "hex", + "indexmap", + "itertools", + "lazy_static", + "num-bigint 0.4.3", + "num-derive 0.2.5", + "num-integer", + "num-traits", + "rand 0.4.6", + "serde", + "sha2 0.9.9", + "sha3 0.9.1", + "smallvec", + "splitmut", + "tiny-keccak 1.5.0", +] + +[[package]] +name = "franklin-crypto" +version = "0.0.5" +source = "git+https://github.com/matter-labs/franklin-crypto?branch=snark_wrapper#900332b8c2fe528b5008bb4e6bf2d3f206a9ae56" +dependencies = [ + "arr_macro", + "bellman_ce 0.3.2 (git+https://github.com/matter-labs/bellman?branch=snark-wrapper)", "bit-vec", "blake2 0.9.2", "blake2-rfc_bellman_edition", "blake2s_simd", + "boojum", "byteorder", + "derivative", "digest 0.9.0", "hex", "indexmap", @@ -4044,6 +4202,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-modular" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a5fe11d4135c3bcdf3a95b18b194afa9608a5f6ff034f5d857bc9a27fb0119" +dependencies = [ + "num-integer", + "num-traits", +] + [[package]] name = "num-rational" version = "0.3.2" @@ -4210,6 +4378,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "packed_simd" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f9f08af0c877571712e2e3e686ad79efad9657dbf0f7c3c8ba943ff6c38932d" +dependencies = [ + "cfg-if 1.0.0", + "num-traits", +] + [[package]] name = "pairing_ce" version = "0.28.5" @@ -4223,6 +4401,18 @@ dependencies = [ "serde", ] +[[package]] +name = "pairing_ce" +version = "0.28.5" +source = "git+https://github.com/matter-labs/pairing.git#d06c2a112913b0abfb75996cc29a6b6075717e99" +dependencies = [ + "byteorder", + "cfg-if 1.0.0", + "ff_ce", + "rand 0.4.6", + "serde", +] + [[package]] name = "parity-crypto" version = "0.9.0" @@ -4678,7 +4868,7 @@ version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" dependencies = [ - "unicode-xid", + "unicode-xid 0.1.0", ] [[package]] @@ -5155,6 +5345,29 @@ dependencies = [ "winreg", ] +[[package]] +name = "rescue_poseidon" +version = "0.4.1" +source = "git+https://github.com/matter-labs/rescue-poseidon.git?branch=poseidon2#09b96e7e82dadac151d8d681f017cb6a16961801" +dependencies = [ + "addchain", + "arrayvec 0.7.3", + "blake2 0.10.6", + "boojum", + "byteorder", + "derivative", + "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=snark_wrapper)", + "log", + "num-bigint 0.3.3", + "num-integer", + "num-iter", + "num-traits", + "rand 0.4.6", + "serde", + "sha3 0.9.1", + "smallvec", +] + [[package]] name = "rescue_poseidon" version = "0.4.1" @@ -5164,7 +5377,7 @@ dependencies = [ "arrayvec 0.7.3", "blake2 0.10.6", "byteorder", - "franklin-crypto", + "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=dev)", "num-bigint 0.3.3", "num-integer", "num-iter", @@ -5882,6 +6095,21 @@ name = "smallvec" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +dependencies = [ + "serde", +] + +[[package]] +name = "snark_wrapper" +version = "0.1.0" +source = "git+https://github.com/matter-labs/snark-wrapper.git?branch=main#450ea6c9f3ede11e149b86ad3a072e673f9846e7" +dependencies = [ + "boojum", + "derivative", + "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=snark_wrapper)", + "rand 0.4.6", + "rescue_poseidon 0.4.1 (git+https://github.com/matter-labs/rescue-poseidon.git?branch=poseidon2)", +] [[package]] name = "socket2" @@ -6153,7 +6381,7 @@ checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" dependencies = [ "proc-macro2 0.4.30", "quote 0.6.13", - "unicode-xid", + "unicode-xid 0.1.0", ] [[package]] @@ -6184,9 +6412,9 @@ version = "1.3.3" source = "git+https://github.com/matter-labs/era-sync_vm.git?branch=v1.3.3#3a21c8dee43c77604350fdf33c1615e25bf1dacd" dependencies = [ "arrayvec 0.7.3", - "cs_derive", + "cs_derive 0.1.0 (git+https://github.com/matter-labs/era-sync_vm.git?branch=v1.3.3)", "derivative", - "franklin-crypto", + "franklin-crypto 0.0.5 (git+https://github.com/matter-labs/franklin-crypto?branch=dev)", "hex", "itertools", "num-bigint 0.4.3", @@ -6195,7 +6423,7 @@ dependencies = [ "num-traits", "once_cell", "rand 0.4.6", - "rescue_poseidon", + "rescue_poseidon 0.4.1 (git+https://github.com/matter-labs/rescue-poseidon)", "serde", "sha2 0.10.6", "sha3 0.10.6", @@ -6776,12 +7004,28 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "unicode_categories" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unroll" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ad948c1cb799b1a70f836077721a92a35ac177d4daddf4c20a633786d4cf618" +dependencies = [ + "quote 1.0.33", + "syn 1.0.109", +] + [[package]] name = "untrusted" version = "0.7.1" @@ -7541,6 +7785,21 @@ dependencies = [ "zkevm_opcode_defs 1.3.2", ] +[[package]] +name = "zk_evm" +version = "1.4.0" +source = "git+https://github.com/matter-labs/era-zk_evm.git?branch=v1.4.0#e33a5ded1b53e35d261fdb46e6d16f2c900b217f" +dependencies = [ + "anyhow", + "lazy_static", + "num 0.4.0", + "serde", + "serde_json", + "static_assertions", + "zk_evm_abstractions", + "zkevm_opcode_defs 1.3.2", +] + [[package]] name = "zk_evm_abstractions" version = "0.1.0" @@ -7590,6 +7849,26 @@ dependencies = [ "zkevm_opcode_defs 1.3.2", ] +[[package]] +name = "zkevm_circuits" +version = "1.4.0" +source = "git+https://github.com/matter-labs/era-zkevm_circuits.git?branch=main#4fba537ccecc238e2da9c80844dc8c185e42466f" +dependencies = [ + "arrayvec 0.7.3", + "bincode", + "boojum", + "cs_derive 0.1.0 (git+https://github.com/matter-labs/era-boojum.git?branch=main)", + "derivative", + "hex", + "itertools", + "rand 0.4.6", + "rand 0.8.5", + "serde", + "serde_json", + "smallvec", + "zkevm_opcode_defs 1.3.2", +] + [[package]] name = "zkevm_opcode_defs" version = "1.3.1" @@ -7642,6 +7921,31 @@ dependencies = [ "zkevm-assembly 1.3.2", ] +[[package]] +name = "zkevm_test_harness" +version = "1.4.0" +source = "git+https://github.com/matter-labs/era-zkevm_test_harness.git?branch=v1.4.0#1934433af48520ac70dc3080b0d1feba877a07c5" +dependencies = [ + "bincode", + "circuit_definitions", + "codegen 0.2.0", + "crossbeam 0.8.2", + "derivative", + "env_logger", + "hex", + "rand 0.4.6", + "rayon", + "rescue_poseidon 0.4.1 (git+https://github.com/matter-labs/rescue-poseidon.git?branch=poseidon2)", + "serde", + "serde_json", + "smallvec", + "snark_wrapper", + "structopt", + "test-log", + "tracing", + "zkevm-assembly 1.3.2", +] + [[package]] name = "zksync" version = "0.4.0" @@ -7692,6 +7996,15 @@ dependencies = [ "zksync_types", ] +[[package]] +name = "zksync_commitment_utils" +version = "0.1.0" +dependencies = [ + "zkevm_test_harness 1.4.0", + "zksync_types", + "zksync_utils", +] + [[package]] name = "zksync_config" version = "0.1.0" @@ -7798,6 +8111,7 @@ dependencies = [ "vlog", "vm", "zksync_circuit_breaker", + "zksync_commitment_utils", "zksync_config", "zksync_contracts", "zksync_dal", @@ -8117,7 +8431,7 @@ dependencies = [ "thiserror", "tokio", "zk_evm 1.3.3", - "zkevm_test_harness", + "zkevm_test_harness 1.3.3", "zksync_basic_types", "zksync_config", "zksync_contracts", diff --git a/Cargo.toml b/Cargo.toml index 9211084819d..49039476132 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ members = [ "core/lib/contracts", "core/lib/crypto", "core/lib/circuit_breaker", + "core/lib/commitment_utils", "core/lib/dal", "core/lib/db_test_macro", "core/lib/eth_client", diff --git a/core/lib/commitment_utils/Cargo.toml b/core/lib/commitment_utils/Cargo.toml new file mode 100644 index 00000000000..801f90ea0f2 --- /dev/null +++ b/core/lib/commitment_utils/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "zksync_commitment_utils" +version = "0.1.0" +edition = "2018" +authors = ["The Matter Labs Team "] +homepage = "https://zksync.io/" +repository = "https://github.com/matter-labs/zksync-era" +license = "MIT OR Apache-2.0" +keywords = ["blockchain", "zksync"] +categories = ["cryptography"] + +[dependencies] +zksync_types = { path = "../../lib/types" } +zksync_utils = { path = "../../lib/utils" } +zkevm_test_harness = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.4.0" } diff --git a/core/lib/commitment_utils/src/lib.rs b/core/lib/commitment_utils/src/lib.rs new file mode 100644 index 00000000000..c99332009d2 --- /dev/null +++ b/core/lib/commitment_utils/src/lib.rs @@ -0,0 +1,34 @@ +//! Utils for commitment calculation. +use zkevm_test_harness::witness::utils::{ + events_queue_commitment_fixed, initial_heap_content_commitment_fixed, +}; +use zksync_types::{LogQuery, ProtocolVersionId, H256, U256, USED_BOOTLOADER_MEMORY_BYTES}; +use zksync_utils::expand_memory_contents; + +pub fn events_queue_commitment( + events_queue: &Vec, + protocol_version: ProtocolVersionId, +) -> Option { + match protocol_version { + id if id < ProtocolVersionId::Version17 => None, + ProtocolVersionId::Version17 => Some(H256(events_queue_commitment_fixed(events_queue))), + id => unimplemented!("events_queue_commitment is not implemented for {id:?}"), + } +} + +pub fn bootloader_initial_content_commitment( + initial_bootloader_contents: &[(usize, U256)], + protocol_version: ProtocolVersionId, +) -> Option { + match protocol_version { + id if id < ProtocolVersionId::Version17 => None, + ProtocolVersionId::Version17 => { + let full_bootloader_memory = + expand_memory_contents(initial_bootloader_contents, USED_BOOTLOADER_MEMORY_BYTES); + Some(H256(initial_heap_content_commitment_fixed( + &full_bootloader_memory, + ))) + } + id => unimplemented!("events_queue_commitment is not implemented for {id:?}"), + } +} diff --git a/core/lib/dal/migrations/20231013085524_boojum-block-commitments.down.sql b/core/lib/dal/migrations/20231013085524_boojum-block-commitments.down.sql new file mode 100644 index 00000000000..7d7b59063f6 --- /dev/null +++ b/core/lib/dal/migrations/20231013085524_boojum-block-commitments.down.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS commitments; +DROP TABLE IF EXISTS events_queue; diff --git a/core/lib/dal/migrations/20231013085524_boojum-block-commitments.up.sql b/core/lib/dal/migrations/20231013085524_boojum-block-commitments.up.sql new file mode 100644 index 00000000000..f704bd3eee3 --- /dev/null +++ b/core/lib/dal/migrations/20231013085524_boojum-block-commitments.up.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS commitments ( + l1_batch_number BIGINT PRIMARY KEY REFERENCES l1_batches(number) ON DELETE CASCADE, + events_queue_commitment BYTEA, + bootloader_initial_content_commitment BYTEA +); + +CREATE TABLE IF NOT EXISTS events_queue ( + l1_batch_number BIGINT PRIMARY KEY REFERENCES l1_batches(number) ON DELETE CASCADE, + serialized_events_queue JSONB NOT NULL +); diff --git a/core/lib/dal/sqlx-data.json b/core/lib/dal/sqlx-data.json index 3815fe50088..9e67a374002 100644 --- a/core/lib/dal/sqlx-data.json +++ b/core/lib/dal/sqlx-data.json @@ -734,6 +734,26 @@ }, "query": "DELETE FROM storage_logs WHERE miniblock_number > $1" }, + "191fb8c0549267b515aaa7acc199675be1ea113e9137195468bb8ce64a099ae8": { + "describe": { + "columns": [ + { + "name": "serialized_events_queue", + "ordinal": 0, + "type_info": "Jsonb" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT serialized_events_queue FROM events_queue WHERE l1_batch_number = $1" + }, "1948ab14bafbb3ba0098563f22d958c9383877788980fe51bd217987898b1c92": { "describe": { "columns": [ @@ -3062,7 +3082,7 @@ }, "query": "\n UPDATE scheduler_witness_jobs\n SET final_node_aggregations_blob_url = $2,\n status = 'waiting_for_proofs',\n updated_at = now()\n WHERE l1_batch_number = $1 AND status != 'queued'\n " }, - "419344dd86dfa0fbc73bdedd8408971ecb1b97382cf3eb4c57ed6d9ffb87ce58": { + "430ffa460ea553cb46c25ebaf1442229cc94f10fd642366e0f827b94f5c0b9f7": { "describe": { "columns": [ { @@ -3239,6 +3259,16 @@ "name": "protocol_version", "ordinal": 34, "type_info": "Int4" + }, + { + "name": "events_queue_commitment", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 36, + "type_info": "Bytea" } ], "nullable": [ @@ -3276,15 +3306,15 @@ true, true, true, + true, + true, true ], "parameters": { - "Left": [ - "Int8" - ] + "Left": [] } }, - "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM l1_batches WHERE eth_prove_tx_id IS NOT NULL AND eth_execute_tx_id IS NULL ORDER BY number LIMIT $1" + "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE number = 0 OR eth_commit_tx_id IS NOT NULL AND commitment IS NOT NULL ORDER BY number DESC LIMIT 1" }, "433d5da4d72150cf2c1e1007ee3ff51edfa51924f4b662b8cf382f06e60fd228": { "describe": { @@ -4470,6 +4500,19 @@ }, "query": "SELECT timestamp FROM l1_batches WHERE eth_commit_tx_id IS NULL AND number > 0 ORDER BY number LIMIT 1" }, + "601487490349c5eee83d6de19137b1a1079235e46c4a3f07e1eaa9db7760f586": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Jsonb" + ] + } + }, + "query": "INSERT INTO events_queue (l1_batch_number, serialized_events_queue) VALUES ($1, $2)" + }, "62e8b4afd4df9e30bfa08cb30c74ba4566fa2e9f4934b7a2777f9e90b49e8fce": { "describe": { "columns": [], @@ -4672,43 +4715,193 @@ }, "query": "\n UPDATE leaf_aggregation_witness_jobs\n SET status='queued'\n WHERE l1_batch_number IN\n (SELECT prover_jobs.l1_batch_number\n FROM prover_jobs\n JOIN leaf_aggregation_witness_jobs lawj ON prover_jobs.l1_batch_number = lawj.l1_batch_number\n WHERE lawj.status = 'waiting_for_proofs'\n AND prover_jobs.status = 'successful'\n AND prover_jobs.aggregation_round = 0\n GROUP BY prover_jobs.l1_batch_number, lawj.number_of_basic_circuits\n HAVING COUNT(*) = lawj.number_of_basic_circuits)\n RETURNING l1_batch_number;\n " }, - "697835cdd5be1b99a0f332c4c8f3245e317b0282b46e55f15e728a7642382b25": { + "68130d145d314f1076ef6becb5fae8ec9401ac211a5bb98c9791fac93521a0c2": { "describe": { "columns": [ { - "name": "id", + "name": "number", "ordinal": 0, "type_info": "Int8" }, { - "name": "l1_batch_number", + "name": "timestamp", "ordinal": 1, "type_info": "Int8" }, { - "name": "circuit_id", + "name": "is_finished", "ordinal": 2, - "type_info": "Int2" + "type_info": "Bool" }, { - "name": "aggregation_round", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Int2" + "type_info": "Int4" }, { - "name": "sequence_number", + "name": "l2_tx_count", "ordinal": 4, "type_info": "Int4" }, { - "name": "depth", + "name": "fee_account_address", "ordinal": 5, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "is_node_final_proof", + "name": "bloom", "ordinal": 6, + "type_info": "Bytea" + }, + { + "name": "priority_ops_onchain_data", + "ordinal": 7, + "type_info": "ByteaArray" + }, + { + "name": "hash", + "ordinal": 8, + "type_info": "Bytea" + }, + { + "name": "parent_hash", + "ordinal": 9, + "type_info": "Bytea" + }, + { + "name": "commitment", + "ordinal": 10, + "type_info": "Bytea" + }, + { + "name": "compressed_write_logs", + "ordinal": 11, + "type_info": "Bytea" + }, + { + "name": "compressed_contracts", + "ordinal": 12, + "type_info": "Bytea" + }, + { + "name": "eth_prove_tx_id", + "ordinal": 13, + "type_info": "Int4" + }, + { + "name": "eth_commit_tx_id", + "ordinal": 14, + "type_info": "Int4" + }, + { + "name": "eth_execute_tx_id", + "ordinal": 15, + "type_info": "Int4" + }, + { + "name": "merkle_root_hash", + "ordinal": 16, + "type_info": "Bytea" + }, + { + "name": "l2_to_l1_logs", + "ordinal": 17, + "type_info": "ByteaArray" + }, + { + "name": "l2_to_l1_messages", + "ordinal": 18, + "type_info": "ByteaArray" + }, + { + "name": "used_contract_hashes", + "ordinal": 19, + "type_info": "Jsonb" + }, + { + "name": "compressed_initial_writes", + "ordinal": 20, + "type_info": "Bytea" + }, + { + "name": "compressed_repeated_writes", + "ordinal": 21, + "type_info": "Bytea" + }, + { + "name": "l2_l1_compressed_messages", + "ordinal": 22, + "type_info": "Bytea" + }, + { + "name": "l2_l1_merkle_root", + "ordinal": 23, + "type_info": "Bytea" + }, + { + "name": "l1_gas_price", + "ordinal": 24, + "type_info": "Int8" + }, + { + "name": "l2_fair_gas_price", + "ordinal": 25, + "type_info": "Int8" + }, + { + "name": "rollup_last_leaf_index", + "ordinal": 26, + "type_info": "Int8" + }, + { + "name": "zkporter_is_available", + "ordinal": 27, "type_info": "Bool" + }, + { + "name": "bootloader_code_hash", + "ordinal": 28, + "type_info": "Bytea" + }, + { + "name": "default_aa_code_hash", + "ordinal": 29, + "type_info": "Bytea" + }, + { + "name": "base_fee_per_gas", + "ordinal": 30, + "type_info": "Numeric" + }, + { + "name": "aux_data_hash", + "ordinal": 31, + "type_info": "Bytea" + }, + { + "name": "pass_through_data_hash", + "ordinal": 32, + "type_info": "Bytea" + }, + { + "name": "meta_parameters_hash", + "ordinal": 33, + "type_info": "Bytea" + }, + { + "name": "protocol_version", + "ordinal": 34, + "type_info": "Int4" + }, + { + "name": "events_queue_commitment", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 36, + "type_info": "Bytea" } ], "nullable": [ @@ -4718,31 +4911,131 @@ false, false, false, - false + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + false, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + false, + true, + true, + true, + true, + true, + true ], "parameters": { "Left": [ - "Time", - "Text", "Int8" ] } }, - "query": "\n UPDATE prover_jobs_fri\n SET status = 'successful', updated_at = now(), time_taken = $1, proof_blob_url=$2\n WHERE id = $3\n RETURNING prover_jobs_fri.id, prover_jobs_fri.l1_batch_number, prover_jobs_fri.circuit_id,\n prover_jobs_fri.aggregation_round, prover_jobs_fri.sequence_number, prover_jobs_fri.depth,\n prover_jobs_fri.is_node_final_proof\n " + "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE number = $1" }, - "6a282084b02cddd8646e984a729b689bdb758e07096fc8cf60f68c6ec5bd6a9c": { + "68a9ba78f60674bc047e4af6eb2a379725da047f2e6c06bce96a33852565cc95": { "describe": { - "columns": [ - { - "name": "max?", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - null - ], - "parameters": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Bytea", + "Bytea" + ] + } + }, + "query": "INSERT INTO commitments (l1_batch_number, events_queue_commitment, bootloader_initial_content_commitment) VALUES ($1, $2, $3) ON CONFLICT (l1_batch_number) DO UPDATE SET events_queue_commitment = $2, bootloader_initial_content_commitment = $3" + }, + "697835cdd5be1b99a0f332c4c8f3245e317b0282b46e55f15e728a7642382b25": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "l1_batch_number", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "circuit_id", + "ordinal": 2, + "type_info": "Int2" + }, + { + "name": "aggregation_round", + "ordinal": 3, + "type_info": "Int2" + }, + { + "name": "sequence_number", + "ordinal": 4, + "type_info": "Int4" + }, + { + "name": "depth", + "ordinal": 5, + "type_info": "Int4" + }, + { + "name": "is_node_final_proof", + "ordinal": 6, + "type_info": "Bool" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ], + "parameters": { + "Left": [ + "Time", + "Text", + "Int8" + ] + } + }, + "query": "\n UPDATE prover_jobs_fri\n SET status = 'successful', updated_at = now(), time_taken = $1, proof_blob_url=$2\n WHERE id = $3\n RETURNING prover_jobs_fri.id, prover_jobs_fri.l1_batch_number, prover_jobs_fri.circuit_id,\n prover_jobs_fri.aggregation_round, prover_jobs_fri.sequence_number, prover_jobs_fri.depth,\n prover_jobs_fri.is_node_final_proof\n " + }, + "6a282084b02cddd8646e984a729b689bdb758e07096fc8cf60f68c6ec5bd6a9c": { + "describe": { + "columns": [ + { + "name": "max?", + "ordinal": 0, + "type_info": "Int4" + } + ], + "nullable": [ + null + ], + "parameters": { "Left": [] } }, @@ -4869,111 +5162,7 @@ }, "query": "\n SELECT protocol_version\n FROM witness_inputs\n WHERE l1_batch_number = $1\n " }, - "715aba794d60ce2faf937eacd9498b203dbb8e620d6d8850b9071cd72902ffbf": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "ByteaArray", - "ByteaArray", - "Int8" - ] - } - }, - "query": "INSERT INTO factory_deps (bytecode_hash, bytecode, miniblock_number, created_at, updated_at) SELECT u.bytecode_hash, u.bytecode, $3, now(), now() FROM UNNEST($1::bytea[], $2::bytea[]) AS u(bytecode_hash, bytecode) ON CONFLICT (bytecode_hash) DO NOTHING" - }, - "721367902328f9e2e5f8a99820b11d230c60553db366fc76f97c5680470bece8": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "basic_circuits_blob_url", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "basic_circuits_inputs_blob_url", - "ordinal": 2, - "type_info": "Text" - } - ], - "nullable": [ - false, - true, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT l1_batch_number, basic_circuits_blob_url, basic_circuits_inputs_blob_url FROM leaf_aggregation_witness_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND basic_circuits_blob_url is NOT NULL\n AND basic_circuits_inputs_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n " - }, - "73f0e672ff1a5e144b3034beb18271f1164e95029998d6750c6a8953f7344db5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Int4", - "Int4", - "Int8", - "Bool", - "Bytea", - "ByteaArray", - "ByteaArray", - "Bytea", - "ByteaArray", - "Int8", - "Int8", - "Int8", - "Jsonb", - "Jsonb", - "Numeric", - "Int8", - "Int8", - "Bytea", - "Bytea", - "Int4" - ] - } - }, - "query": "INSERT INTO l1_batches (number, l1_tx_count, l2_tx_count, timestamp, is_finished, fee_account_address, l2_to_l1_logs, l2_to_l1_messages, bloom, priority_ops_onchain_data, predicted_commit_gas_cost, predicted_prove_gas_cost, predicted_execute_gas_cost, initial_bootloader_heap_content, used_contract_hashes, base_fee_per_gas, l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version, created_at, updated_at ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, now(), now())" - }, - "741b13b0a4769a30186c650a4a1b24855806a27ccd8d5a50594741842dde44ec": { - "describe": { - "columns": [ - { - "name": "min?", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "max?", - "ordinal": 1, - "type_info": "Int8" - } - ], - "nullable": [ - null, - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT MIN(miniblocks.number) as \"min?\", MAX(miniblocks.number) as \"max?\" FROM miniblocks WHERE l1_batch_number = $1" - }, - "74637e3c2a52bc7c00521c38f476497792e29046fbb4bb6caa4715f017f5d828": { + "7091a5c10a913f053129a76299d2e6fe7081473456888d30fb41b23a01d28690": { "describe": { "columns": [ { @@ -5150,6 +5339,16 @@ "name": "protocol_version", "ordinal": 34, "type_info": "Int4" + }, + { + "name": "events_queue_commitment", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 36, + "type_info": "Bytea" } ], "nullable": [ @@ -5187,79 +5386,187 @@ true, true, true, + true, + true, true ], "parameters": { "Left": [ + "Int8", + "Int8", "Int8" ] } }, - "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM l1_batches WHERE eth_commit_tx_id IS NOT NULL AND eth_prove_tx_id IS NULL ORDER BY number LIMIT $1" + "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE number BETWEEN $1 AND $2 ORDER BY number LIMIT $3" }, - "751c8e5ed1fc211dbb4c7419a316c5f4e49a7f0b4f3a5c74c2abd8daebc457dd": { + "715aba794d60ce2faf937eacd9498b203dbb8e620d6d8850b9071cd72902ffbf": { "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - true - ], + "columns": [], + "nullable": [], "parameters": { "Left": [ + "ByteaArray", + "ByteaArray", "Int8" ] } }, - "query": "SELECT l1_batch_number FROM miniblocks WHERE number = $1" + "query": "INSERT INTO factory_deps (bytecode_hash, bytecode, miniblock_number, created_at, updated_at) SELECT u.bytecode_hash, u.bytecode, $3, now(), now() FROM UNNEST($1::bytea[], $2::bytea[]) AS u(bytecode_hash, bytecode) ON CONFLICT (bytecode_hash) DO NOTHING" }, - "769c021b51b9aaafdf27b4019834729047702b17b0684f7271eecd6ffdf96e7c": { + "721367902328f9e2e5f8a99820b11d230c60553db366fc76f97c5680470bece8": { "describe": { "columns": [ { "name": "l1_batch_number", "ordinal": 0, "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "\n UPDATE scheduler_witness_jobs\n SET status='queued'\n WHERE l1_batch_number IN\n (SELECT prover_jobs.l1_batch_number\n FROM prover_jobs\n JOIN scheduler_witness_jobs swj ON prover_jobs.l1_batch_number = swj.l1_batch_number\n WHERE swj.status = 'waiting_for_proofs'\n AND prover_jobs.status = 'successful'\n AND prover_jobs.aggregation_round = 2\n GROUP BY prover_jobs.l1_batch_number\n HAVING COUNT(*) = 1)\n RETURNING l1_batch_number;\n " - }, - "7717652bb4933f87cbeb7baa2e70e8e0b439663c6b15493bd2e406bed2486b42": { - "describe": { - "columns": [ + }, { - "name": "max", - "ordinal": 0, - "type_info": "Int8" + "name": "basic_circuits_blob_url", + "ordinal": 1, + "type_info": "Text" + }, + { + "name": "basic_circuits_inputs_blob_url", + "ordinal": 2, + "type_info": "Text" } ], "nullable": [ - null + false, + true, + true ], "parameters": { "Left": [ - "Numeric" + "Int8" ] } }, - "query": "SELECT max(l1_batches.number) FROM l1_batches JOIN eth_txs ON (l1_batches.eth_commit_tx_id = eth_txs.id) JOIN eth_txs_history AS commit_tx ON (eth_txs.confirmed_eth_tx_history_id = commit_tx.id) WHERE commit_tx.confirmed_at IS NOT NULL AND eth_prove_tx_id IS NOT NULL AND eth_execute_tx_id IS NULL AND EXTRACT(epoch FROM commit_tx.confirmed_at) < $1" + "query": "\n SELECT l1_batch_number, basic_circuits_blob_url, basic_circuits_inputs_blob_url FROM leaf_aggregation_witness_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND basic_circuits_blob_url is NOT NULL\n AND basic_circuits_inputs_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n " }, - "780b30e56a3ecfb3daa5310168ac6cd9e94bd5f1d871e1eaf36fbfd463a5e7e0": { + "73f0e672ff1a5e144b3034beb18271f1164e95029998d6750c6a8953f7344db5": { "describe": { - "columns": [ - { - "name": "address_and_key?", + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Int4", + "Int4", + "Int8", + "Bool", + "Bytea", + "ByteaArray", + "ByteaArray", + "Bytea", + "ByteaArray", + "Int8", + "Int8", + "Int8", + "Jsonb", + "Jsonb", + "Numeric", + "Int8", + "Int8", + "Bytea", + "Bytea", + "Int4" + ] + } + }, + "query": "INSERT INTO l1_batches (number, l1_tx_count, l2_tx_count, timestamp, is_finished, fee_account_address, l2_to_l1_logs, l2_to_l1_messages, bloom, priority_ops_onchain_data, predicted_commit_gas_cost, predicted_prove_gas_cost, predicted_execute_gas_cost, initial_bootloader_heap_content, used_contract_hashes, base_fee_per_gas, l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version, created_at, updated_at ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, now(), now())" + }, + "741b13b0a4769a30186c650a4a1b24855806a27ccd8d5a50594741842dde44ec": { + "describe": { + "columns": [ + { + "name": "min?", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "max?", + "ordinal": 1, + "type_info": "Int8" + } + ], + "nullable": [ + null, + null + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT MIN(miniblocks.number) as \"min?\", MAX(miniblocks.number) as \"max?\" FROM miniblocks WHERE l1_batch_number = $1" + }, + "751c8e5ed1fc211dbb4c7419a316c5f4e49a7f0b4f3a5c74c2abd8daebc457dd": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + true + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT l1_batch_number FROM miniblocks WHERE number = $1" + }, + "769c021b51b9aaafdf27b4019834729047702b17b0684f7271eecd6ffdf96e7c": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [] + } + }, + "query": "\n UPDATE scheduler_witness_jobs\n SET status='queued'\n WHERE l1_batch_number IN\n (SELECT prover_jobs.l1_batch_number\n FROM prover_jobs\n JOIN scheduler_witness_jobs swj ON prover_jobs.l1_batch_number = swj.l1_batch_number\n WHERE swj.status = 'waiting_for_proofs'\n AND prover_jobs.status = 'successful'\n AND prover_jobs.aggregation_round = 2\n GROUP BY prover_jobs.l1_batch_number\n HAVING COUNT(*) = 1)\n RETURNING l1_batch_number;\n " + }, + "7717652bb4933f87cbeb7baa2e70e8e0b439663c6b15493bd2e406bed2486b42": { + "describe": { + "columns": [ + { + "name": "max", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [ + "Numeric" + ] + } + }, + "query": "SELECT max(l1_batches.number) FROM l1_batches JOIN eth_txs ON (l1_batches.eth_commit_tx_id = eth_txs.id) JOIN eth_txs_history AS commit_tx ON (eth_txs.confirmed_eth_tx_history_id = commit_tx.id) WHERE commit_tx.confirmed_at IS NOT NULL AND eth_prove_tx_id IS NOT NULL AND eth_execute_tx_id IS NULL AND EXTRACT(epoch FROM commit_tx.confirmed_at) < $1" + }, + "780b30e56a3ecfb3daa5310168ac6cd9e94bd5f1d871e1eaf36fbfd463a5e7e0": { + "describe": { + "columns": [ + { + "name": "address_and_key?", "ordinal": 0, "type_info": "ByteaArray" } @@ -5363,286 +5670,192 @@ }, "query": "SELECT l1_batch_number, merkel_tree_paths_blob_url FROM witness_inputs WHERE status = 'successful' AND is_blob_cleaned = FALSE AND merkel_tree_paths_blob_url is NOT NULL AND updated_at < NOW() - INTERVAL '30 days' LIMIT $1" }, - "7b8043a59029a19a3ba2433a438e8a4fe560aba7eda57b7a63b580de2e19aacb": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Int4" - ] - } - }, - "query": "INSERT INTO witness_inputs_fri(l1_batch_number, merkle_tree_paths_blob_url, protocol_version, status, created_at, updated_at) VALUES ($1, $2, $3, 'queued', now(), now()) ON CONFLICT (l1_batch_number) DO NOTHING" - }, - "7c3e55a10c8cf90e60001bca401113fd5335ec6c4b1ffdb6d6ff063d244d23e2": { + "7b71d5390f82b405eab5373ba05448ed7189338da059817d158d3607efe3efd1": { "describe": { "columns": [ { - "name": "id", + "name": "number", "ordinal": 0, "type_info": "Int8" }, { - "name": "l1_batch_number", + "name": "timestamp", "ordinal": 1, "type_info": "Int8" }, { - "name": "circuit_type", + "name": "is_finished", "ordinal": 2, - "type_info": "Text" + "type_info": "Bool" }, { - "name": "prover_input", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "status", + "name": "l2_tx_count", "ordinal": 4, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "error", + "name": "fee_account_address", "ordinal": 5, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "processing_started_at", + "name": "bloom", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "created_at", + "name": "priority_ops_onchain_data", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "ByteaArray" }, { - "name": "updated_at", + "name": "hash", "ordinal": 8, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "time_taken", + "name": "parent_hash", "ordinal": 9, - "type_info": "Time" + "type_info": "Bytea" }, { - "name": "aggregation_round", + "name": "commitment", "ordinal": 10, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "result", + "name": "compressed_write_logs", "ordinal": 11, "type_info": "Bytea" }, { - "name": "sequence_number", + "name": "compressed_contracts", "ordinal": 12, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "attempts", + "name": "eth_prove_tx_id", "ordinal": 13, "type_info": "Int4" }, { - "name": "circuit_input_blob_url", + "name": "eth_commit_tx_id", "ordinal": 14, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "proccesed_by", + "name": "eth_execute_tx_id", "ordinal": 15, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "is_blob_cleaned", + "name": "merkle_root_hash", "ordinal": 16, - "type_info": "Bool" + "type_info": "Bytea" }, { - "name": "protocol_version", + "name": "l2_to_l1_logs", "ordinal": 17, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - true, - true, - false, - false, - false, - false, - true, - false, - false, - true, - true, - false, - true - ], - "parameters": { - "Left": [ - "TextArray", - "Int4Array" - ] - } - }, - "query": "\n UPDATE prover_jobs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE id = (\n SELECT id\n FROM prover_jobs\n WHERE circuit_type = ANY($1)\n AND status = 'queued'\n AND protocol_version = ANY($2)\n ORDER BY aggregation_round DESC, l1_batch_number ASC, id ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING prover_jobs.*\n " - }, - "7ca78be8b18638857111cdbc6117ed2c204e3eb22682d5e4553ac4f47efab6e2": { - "describe": { - "columns": [ + "type_info": "ByteaArray" + }, { - "name": "hash", - "ordinal": 0, + "name": "l2_to_l1_messages", + "ordinal": 18, + "type_info": "ByteaArray" + }, + { + "name": "used_contract_hashes", + "ordinal": 19, + "type_info": "Jsonb" + }, + { + "name": "compressed_initial_writes", + "ordinal": 20, "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE transactions\n SET l1_batch_number = NULL, miniblock_number = NULL, error = NULL, index_in_block = NULL, execution_info = '{}'\n WHERE miniblock_number > $1\n RETURNING hash\n " - }, - "7cf855c4869db43b765b92762402596f6b97b3717735b6d87a16a5776f2eca71": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Numeric", - "Timestamp" - ] - } - }, - "query": "UPDATE tokens SET usd_price = $2, usd_price_updated_at = $3, updated_at = now() WHERE l1_address = $1" - }, - "7d3a57126f111ebe51d678b91f64c34b8394df3e7b1d59ca80b6eca01c606da4": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Jsonb" - ] - } - }, - "query": "\n INSERT INTO contracts_verification_info\n (address, verification_info)\n VALUES ($1, $2)\n ON CONFLICT (address)\n DO UPDATE SET verification_info = $2\n " - }, - "7d4210089c5abb84befec962fc769b396ff7ad7da212d079bd4460f9ea4d60dc": { - "describe": { - "columns": [ + }, { - "name": "l1_batch_number?", - "ordinal": 0, + "name": "compressed_repeated_writes", + "ordinal": 21, + "type_info": "Bytea" + }, + { + "name": "l2_l1_compressed_messages", + "ordinal": 22, + "type_info": "Bytea" + }, + { + "name": "l2_l1_merkle_root", + "ordinal": 23, + "type_info": "Bytea" + }, + { + "name": "l1_gas_price", + "ordinal": 24, "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT MIN(l1_batch_number) as \"l1_batch_number?\" FROM (\n SELECT MIN(l1_batch_number) as \"l1_batch_number\"\n FROM prover_jobs\n WHERE status = 'successful' OR aggregation_round < 3\n GROUP BY l1_batch_number\n HAVING MAX(aggregation_round) < 3\n ) as inn\n " - }, - "7df997e5a203e8df350b1346863fddf26d32123159213c02e8794c39240e48dc": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "UPDATE miniblocks SET l1_batch_number = $1 WHERE l1_batch_number IS NULL" - }, - "8045a697a6a1070857b6fdc656f60ee6bab4b3a875ab98099beee227c199f818": { - "describe": { - "columns": [ + }, { - "name": "miniblock_number", - "ordinal": 0, + "name": "l2_fair_gas_price", + "ordinal": 25, "type_info": "Int8" }, { - "name": "log_index_in_miniblock", - "ordinal": 1, - "type_info": "Int4" + "name": "rollup_last_leaf_index", + "ordinal": 26, + "type_info": "Int8" }, { - "name": "log_index_in_tx", - "ordinal": 2, - "type_info": "Int4" + "name": "zkporter_is_available", + "ordinal": 27, + "type_info": "Bool" }, { - "name": "tx_hash", - "ordinal": 3, + "name": "bootloader_code_hash", + "ordinal": 28, "type_info": "Bytea" }, { - "name": "block_hash", - "ordinal": 4, + "name": "default_aa_code_hash", + "ordinal": 29, "type_info": "Bytea" }, { - "name": "l1_batch_number?", - "ordinal": 5, - "type_info": "Int8" + "name": "base_fee_per_gas", + "ordinal": 30, + "type_info": "Numeric" }, { - "name": "shard_id", - "ordinal": 6, - "type_info": "Int4" + "name": "aux_data_hash", + "ordinal": 31, + "type_info": "Bytea" }, { - "name": "is_service", - "ordinal": 7, - "type_info": "Bool" + "name": "pass_through_data_hash", + "ordinal": 32, + "type_info": "Bytea" }, { - "name": "tx_index_in_miniblock", - "ordinal": 8, - "type_info": "Int4" + "name": "meta_parameters_hash", + "ordinal": 33, + "type_info": "Bytea" }, { - "name": "tx_index_in_l1_batch", - "ordinal": 9, + "name": "protocol_version", + "ordinal": 34, "type_info": "Int4" }, { - "name": "sender", - "ordinal": 10, - "type_info": "Bytea" - }, - { - "name": "key", - "ordinal": 11, + "name": "events_queue_commitment", + "ordinal": 35, "type_info": "Bytea" }, { - "name": "value", - "ordinal": 12, + "name": "bootloader_initial_content_commitment", + "ordinal": 36, "type_info": "Bytea" } ], @@ -5651,137 +5864,156 @@ false, false, false, - null, - null, false, false, false, false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + false, false, false, - false + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + false, + true, + true, + true, + true, + true, + true ], "parameters": { "Left": [ - "Bytea" + "Bytea", + "Bytea", + "Int4", + "Int8" ] } }, - "query": "SELECT miniblock_number, log_index_in_miniblock, log_index_in_tx, tx_hash, Null::bytea as \"block_hash\", Null::bigint as \"l1_batch_number?\", shard_id, is_service, tx_index_in_miniblock, tx_index_in_l1_batch, sender, key, value FROM l2_to_l1_logs WHERE tx_hash = $1 ORDER BY log_index_in_tx ASC" + "query": "SELECT number, l1_batches.timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, l1_batches.bootloader_code_hash, l1_batches.default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number JOIN protocol_versions ON protocol_versions.id = l1_batches.protocol_version WHERE eth_commit_tx_id IS NULL AND number != 0 AND protocol_versions.bootloader_code_hash = $1 AND protocol_versions.default_account_code_hash = $2 AND commitment IS NOT NULL AND (protocol_versions.id = $3 OR protocol_versions.upgrade_tx_hash IS NULL) ORDER BY number LIMIT $4" }, - "84703029e09ab1362aa4b4177b38be594d2daf17e69508cae869647028055efb": { + "7b8043a59029a19a3ba2433a438e8a4fe560aba7eda57b7a63b580de2e19aacb": { "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "status", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - false - ], + "columns": [], + "nullable": [], "parameters": { "Left": [ + "Int8", "Text", - "Text" + "Int4" ] } }, - "query": "SELECT l1_batch_number, status FROM proof_compression_jobs_fri\n WHERE l1_batch_number = ( SELECT MIN(l1_batch_number) FROM proof_compression_jobs_fri WHERE status = $1 OR status = $2\n )" + "query": "INSERT INTO witness_inputs_fri(l1_batch_number, merkle_tree_paths_blob_url, protocol_version, status, created_at, updated_at) VALUES ($1, $2, $3, 'queued', now(), now()) ON CONFLICT (l1_batch_number) DO NOTHING" }, - "852b8d72a8dcbf620e528e983b836b2b05596eb0b7c5d7d1791080bef6a6b821": { + "7c3e55a10c8cf90e60001bca401113fd5335ec6c4b1ffdb6d6ff063d244d23e2": { "describe": { "columns": [ { - "name": "number", + "name": "id", "ordinal": 0, "type_info": "Int8" }, { - "name": "l1_tx_count", + "name": "l1_batch_number", "ordinal": 1, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "l2_tx_count", + "name": "circuit_type", "ordinal": 2, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "timestamp", + "name": "prover_input", "ordinal": 3, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "is_finished", + "name": "status", "ordinal": 4, - "type_info": "Bool" + "type_info": "Text" }, { - "name": "fee_account_address", + "name": "error", "ordinal": 5, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "l2_to_l1_logs", + "name": "processing_started_at", "ordinal": 6, - "type_info": "ByteaArray" + "type_info": "Timestamp" }, { - "name": "l2_to_l1_messages", + "name": "created_at", "ordinal": 7, - "type_info": "ByteaArray" + "type_info": "Timestamp" }, { - "name": "bloom", + "name": "updated_at", "ordinal": 8, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "priority_ops_onchain_data", + "name": "time_taken", "ordinal": 9, - "type_info": "ByteaArray" + "type_info": "Time" }, { - "name": "used_contract_hashes", + "name": "aggregation_round", "ordinal": 10, - "type_info": "Jsonb" + "type_info": "Int4" }, { - "name": "base_fee_per_gas", + "name": "result", "ordinal": 11, - "type_info": "Numeric" + "type_info": "Bytea" }, { - "name": "l1_gas_price", + "name": "sequence_number", "ordinal": 12, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "l2_fair_gas_price", + "name": "attempts", "ordinal": 13, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "bootloader_code_hash", + "name": "circuit_input_blob_url", "ordinal": 14, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "default_aa_code_hash", + "name": "proccesed_by", "ordinal": 15, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "protocol_version", + "name": "is_blob_cleaned", "ordinal": 16, + "type_info": "Bool" + }, + { + "name": "protocol_version", + "ordinal": 17, "type_info": "Int4" } ], @@ -5791,44 +6023,40 @@ false, false, false, + true, + true, false, false, false, false, - false, - false, - false, + true, false, false, true, true, + false, true ], "parameters": { "Left": [ - "Int8" + "TextArray", + "Int4Array" ] } }, - "query": "SELECT number, l1_tx_count, l2_tx_count, timestamp, is_finished, fee_account_address, l2_to_l1_logs, l2_to_l1_messages, bloom, priority_ops_onchain_data, used_contract_hashes, base_fee_per_gas, l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version FROM l1_batches WHERE number = $1" + "query": "\n UPDATE prover_jobs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE id = (\n SELECT id\n FROM prover_jobs\n WHERE circuit_type = ANY($1)\n AND status = 'queued'\n AND protocol_version = ANY($2)\n ORDER BY aggregation_round DESC, l1_batch_number ASC, id ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING prover_jobs.*\n " }, - "85c52cb09c73499507144e3a684c3230c2c71eb4f8ddef43e67fbd33de2747c8": { + "7ca78be8b18638857111cdbc6117ed2c204e3eb22682d5e4553ac4f47efab6e2": { "describe": { "columns": [ - { - "name": "timestamp", - "ordinal": 0, - "type_info": "Int8" - }, { "name": "hash", - "ordinal": 1, + "ordinal": 0, "type_info": "Bytea" } ], "nullable": [ - false, - true + false ], "parameters": { "Left": [ @@ -5836,119 +6064,144 @@ ] } }, - "query": "SELECT timestamp, hash FROM l1_batches WHERE number = $1" + "query": "UPDATE transactions\n SET l1_batch_number = NULL, miniblock_number = NULL, error = NULL, index_in_block = NULL, execution_info = '{}'\n WHERE miniblock_number > $1\n RETURNING hash\n " }, - "87e1ae393bf250f834704c940482884c9ed729a24f41d1ec07319fa0cbcc21a7": { + "7cf855c4869db43b765b92762402596f6b97b3717735b6d87a16a5776f2eca71": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8" + "Bytea", + "Numeric", + "Timestamp" ] } }, - "query": "DELETE FROM l1_batches WHERE number > $1" + "query": "UPDATE tokens SET usd_price = $2, usd_price_updated_at = $3, updated_at = now() WHERE l1_address = $1" }, - "88c49ebeb45f7208d223de59ec08a332beac765644e4f29ed855808b8f9cef91": { + "7d3a57126f111ebe51d678b91f64c34b8394df3e7b1d59ca80b6eca01c606da4": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Bytea", + "Jsonb" + ] + } + }, + "query": "\n INSERT INTO contracts_verification_info\n (address, verification_info)\n VALUES ($1, $2)\n ON CONFLICT (address)\n DO UPDATE SET verification_info = $2\n " + }, + "7d4210089c5abb84befec962fc769b396ff7ad7da212d079bd4460f9ea4d60dc": { "describe": { "columns": [ { - "name": "id", + "name": "l1_batch_number?", "ordinal": 0, "type_info": "Int8" - }, - { - "name": "circuit_input_blob_url", - "ordinal": 1, - "type_info": "Text" } ], "nullable": [ - false, - true + null ], + "parameters": { + "Left": [] + } + }, + "query": "\n SELECT MIN(l1_batch_number) as \"l1_batch_number?\" FROM (\n SELECT MIN(l1_batch_number) as \"l1_batch_number\"\n FROM prover_jobs\n WHERE status = 'successful' OR aggregation_round < 3\n GROUP BY l1_batch_number\n HAVING MAX(aggregation_round) < 3\n ) as inn\n " + }, + "7df997e5a203e8df350b1346863fddf26d32123159213c02e8794c39240e48dc": { + "describe": { + "columns": [], + "nullable": [], "parameters": { "Left": [ "Int8" ] } }, - "query": "\n SELECT id, circuit_input_blob_url FROM prover_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND circuit_input_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n " + "query": "UPDATE miniblocks SET l1_batch_number = $1 WHERE l1_batch_number IS NULL" }, - "8996a1794585dfe0f9c16a11e113831a63d5d944bc8061d7caa25ea33f12b19d": { + "8045a697a6a1070857b6fdc656f60ee6bab4b3a875ab98099beee227c199f818": { "describe": { "columns": [ { - "name": "is_priority", + "name": "miniblock_number", "ordinal": 0, - "type_info": "Bool" + "type_info": "Int8" }, { - "name": "initiator_address", + "name": "log_index_in_miniblock", "ordinal": 1, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "gas_limit", + "name": "log_index_in_tx", "ordinal": 2, - "type_info": "Numeric" + "type_info": "Int4" }, { - "name": "gas_per_pubdata_limit", + "name": "tx_hash", "ordinal": 3, - "type_info": "Numeric" + "type_info": "Bytea" }, { - "name": "received_at", + "name": "block_hash", "ordinal": 4, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "miniblock_number", + "name": "l1_batch_number?", "ordinal": 5, "type_info": "Int8" }, { - "name": "error", + "name": "shard_id", "ordinal": 6, - "type_info": "Varchar" + "type_info": "Int4" }, { - "name": "effective_gas_price", + "name": "is_service", "ordinal": 7, - "type_info": "Numeric" + "type_info": "Bool" }, { - "name": "refunded_gas", + "name": "tx_index_in_miniblock", "ordinal": 8, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "eth_commit_tx_hash?", + "name": "tx_index_in_l1_batch", "ordinal": 9, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "eth_prove_tx_hash?", + "name": "sender", "ordinal": 10, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "eth_execute_tx_hash?", + "name": "key", "ordinal": 11, - "type_info": "Text" + "type_info": "Bytea" + }, + { + "name": "value", + "ordinal": 12, + "type_info": "Bytea" } ], "nullable": [ false, false, - true, - true, false, - true, - true, - true, + false, + null, + null, + false, + false, + false, false, false, false, @@ -5960,36 +6213,36 @@ ] } }, - "query": "\n SELECT transactions.is_priority,\n transactions.initiator_address,\n transactions.gas_limit,\n transactions.gas_per_pubdata_limit,\n transactions.received_at,\n transactions.miniblock_number,\n transactions.error,\n transactions.effective_gas_price,\n transactions.refunded_gas,\n commit_tx.tx_hash as \"eth_commit_tx_hash?\",\n prove_tx.tx_hash as \"eth_prove_tx_hash?\",\n execute_tx.tx_hash as \"eth_execute_tx_hash?\"\n FROM transactions\n LEFT JOIN miniblocks ON miniblocks.number = transactions.miniblock_number\n LEFT JOIN l1_batches ON l1_batches.number = miniblocks.l1_batch_number\n LEFT JOIN eth_txs_history as commit_tx ON (l1_batches.eth_commit_tx_id = commit_tx.eth_tx_id AND commit_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as prove_tx ON (l1_batches.eth_prove_tx_id = prove_tx.eth_tx_id AND prove_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as execute_tx ON (l1_batches.eth_execute_tx_id = execute_tx.eth_tx_id AND execute_tx.confirmed_at IS NOT NULL)\n WHERE transactions.hash = $1\n " - }, - "89b124c78f4f6e86790af8ec391a2c486ce01b33cfb4492a443187b1731cae1e": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4", - "Int8", - "Int8" - ] - } - }, - "query": "UPDATE l1_batches SET eth_prove_tx_id = $1, updated_at = now() WHERE number BETWEEN $2 AND $3" + "query": "SELECT miniblock_number, log_index_in_miniblock, log_index_in_tx, tx_hash, Null::bytea as \"block_hash\", Null::bigint as \"l1_batch_number?\", shard_id, is_service, tx_index_in_miniblock, tx_index_in_l1_batch, sender, key, value FROM l2_to_l1_logs WHERE tx_hash = $1 ORDER BY log_index_in_tx ASC" }, - "8a05b6c052ace9b5a383b301f3f441536d90a96bbb791f4711304b22e02193df": { + "84703029e09ab1362aa4b4177b38be594d2daf17e69508cae869647028055efb": { "describe": { - "columns": [], - "nullable": [], + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "status", + "ordinal": 1, + "type_info": "Text" + } + ], + "nullable": [ + false, + false + ], "parameters": { "Left": [ - "Time", - "Int8" + "Text", + "Text" ] } }, - "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status = 'successful', updated_at = now(), time_taken = $1\n WHERE id = $2\n " + "query": "SELECT l1_batch_number, status FROM proof_compression_jobs_fri\n WHERE l1_batch_number = ( SELECT MIN(l1_batch_number) FROM proof_compression_jobs_fri WHERE status = $1 OR status = $2\n )" }, - "8cd540b6063f4a0c1bf4ccb3d111a0ecc341ca8b46b83544c515aa4d809ab9f1": { + "852b8d72a8dcbf620e528e983b836b2b05596eb0b7c5d7d1791080bef6a6b821": { "describe": { "columns": [ { @@ -5998,59 +6251,59 @@ "type_info": "Int8" }, { - "name": "l1_batch_number!", + "name": "l1_tx_count", "ordinal": 1, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "timestamp", + "name": "l2_tx_count", "ordinal": 2, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "l1_tx_count", + "name": "timestamp", "ordinal": 3, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "l2_tx_count", + "name": "is_finished", "ordinal": 4, - "type_info": "Int4" + "type_info": "Bool" }, { - "name": "root_hash?", + "name": "fee_account_address", "ordinal": 5, "type_info": "Bytea" }, { - "name": "commit_tx_hash?", + "name": "l2_to_l1_logs", "ordinal": 6, - "type_info": "Text" + "type_info": "ByteaArray" }, { - "name": "committed_at?", + "name": "l2_to_l1_messages", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "ByteaArray" }, { - "name": "prove_tx_hash?", + "name": "bloom", "ordinal": 8, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "proven_at?", + "name": "priority_ops_onchain_data", "ordinal": 9, - "type_info": "Timestamp" + "type_info": "ByteaArray" }, { - "name": "execute_tx_hash?", + "name": "used_contract_hashes", "ordinal": 10, - "type_info": "Text" + "type_info": "Jsonb" }, { - "name": "executed_at?", + "name": "base_fee_per_gas", "ordinal": 11, - "type_info": "Timestamp" + "type_info": "Numeric" }, { "name": "l1_gas_price", @@ -6076,32 +6329,26 @@ "name": "protocol_version", "ordinal": 16, "type_info": "Int4" - }, - { - "name": "fee_account_address?", - "ordinal": 17, - "type_info": "Bytea" } ], "nullable": [ false, - null, false, false, false, false, false, - true, false, - true, false, - true, + false, + false, + false, + false, false, false, true, true, - true, - false + true ], "parameters": { "Left": [ @@ -6109,71 +6356,35 @@ ] } }, - "query": "\n SELECT miniblocks.number,\n COALESCE(miniblocks.l1_batch_number, (SELECT (max(number) + 1) FROM l1_batches)) as \"l1_batch_number!\",\n miniblocks.timestamp,\n miniblocks.l1_tx_count,\n miniblocks.l2_tx_count,\n miniblocks.hash as \"root_hash?\",\n commit_tx.tx_hash as \"commit_tx_hash?\",\n commit_tx.confirmed_at as \"committed_at?\",\n prove_tx.tx_hash as \"prove_tx_hash?\",\n prove_tx.confirmed_at as \"proven_at?\",\n execute_tx.tx_hash as \"execute_tx_hash?\",\n execute_tx.confirmed_at as \"executed_at?\",\n miniblocks.l1_gas_price,\n miniblocks.l2_fair_gas_price,\n miniblocks.bootloader_code_hash,\n miniblocks.default_aa_code_hash,\n miniblocks.protocol_version,\n l1_batches.fee_account_address as \"fee_account_address?\"\n FROM miniblocks\n LEFT JOIN l1_batches ON miniblocks.l1_batch_number = l1_batches.number\n LEFT JOIN eth_txs_history as commit_tx ON (l1_batches.eth_commit_tx_id = commit_tx.eth_tx_id AND commit_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as prove_tx ON (l1_batches.eth_prove_tx_id = prove_tx.eth_tx_id AND prove_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as execute_tx ON (l1_batches.eth_execute_tx_id = execute_tx.eth_tx_id AND execute_tx.confirmed_at IS NOT NULL)\n WHERE miniblocks.number = $1\n " - }, - "8d3c9575e3cea3956ba84edc982fcf6e0f7667350e6c2cd6801db8400eabaf9b": { - "describe": { - "columns": [ - { - "name": "hashed_key", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT DISTINCT ON (hashed_key) hashed_key FROM (SELECT * FROM storage_logs WHERE miniblock_number > $1) inn" + "query": "SELECT number, l1_tx_count, l2_tx_count, timestamp, is_finished, fee_account_address, l2_to_l1_logs, l2_to_l1_messages, bloom, priority_ops_onchain_data, used_contract_hashes, base_fee_per_gas, l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version FROM l1_batches WHERE number = $1" }, - "8dcbaaa6186da52ca8b440b6428826288dc668af5a6fc99ef3078c8bcb38c419": { + "85c52cb09c73499507144e3a684c3230c2c71eb4f8ddef43e67fbd33de2747c8": { "describe": { "columns": [ { - "name": "l1_batch_number", + "name": "timestamp", "ordinal": 0, "type_info": "Int8" }, { - "name": "circuit_id", + "name": "hash", "ordinal": 1, - "type_info": "Int2" - }, - { - "name": "depth", - "ordinal": 2, - "type_info": "Int4" + "type_info": "Bytea" } ], "nullable": [ false, - false, - false + true ], - "parameters": { - "Left": [] - } - }, - "query": "\n UPDATE node_aggregation_witness_jobs_fri\n SET status='queued'\n WHERE (l1_batch_number, circuit_id, depth) IN\n (SELECT prover_jobs_fri.l1_batch_number, prover_jobs_fri.circuit_id, prover_jobs_fri.depth\n FROM prover_jobs_fri\n JOIN node_aggregation_witness_jobs_fri nawj ON\n prover_jobs_fri.l1_batch_number = nawj.l1_batch_number\n AND prover_jobs_fri.circuit_id = nawj.circuit_id\n AND prover_jobs_fri.depth = nawj.depth\n WHERE nawj.status = 'waiting_for_proofs'\n AND prover_jobs_fri.status = 'successful'\n AND prover_jobs_fri.aggregation_round = 2\n GROUP BY prover_jobs_fri.l1_batch_number, prover_jobs_fri.circuit_id, prover_jobs_fri.depth, nawj.number_of_dependent_jobs\n HAVING COUNT(*) = nawj.number_of_dependent_jobs)\n RETURNING l1_batch_number, circuit_id, depth;\n " - }, - "8f75c5aa615080fc02b60baccae9c49a81e282a54864ea3eb874ebe10a23eafe": { - "describe": { - "columns": [], - "nullable": [], "parameters": { "Left": [ "Int8" ] } }, - "query": "UPDATE prover_jobs_fri SET status = 'sent_to_server', updated_at = now() WHERE l1_batch_number = $1" + "query": "SELECT timestamp, hash FROM l1_batches WHERE number = $1" }, - "8fa1a390d7b11b60b3352fafc0a8a7fa15bc761b1bb902f5105fd66b2e3087f2": { + "87e1ae393bf250f834704c940482884c9ed729a24f41d1ec07319fa0cbcc21a7": { "describe": { "columns": [], "nullable": [], @@ -6183,108 +6394,24 @@ ] } }, - "query": "\n INSERT INTO scheduler_dependency_tracker_fri\n (l1_batch_number, status, created_at, updated_at)\n VALUES ($1, 'waiting_for_proofs', now(), now())\n ON CONFLICT(l1_batch_number)\n DO UPDATE SET updated_at=now()\n " - }, - "8fda20e48c41a9c1e58c8c607222a65e1409f63eba91ac99b2736ca5ebbb5ec6": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Bytea", - "Numeric", - "Numeric", - "Numeric", - "Jsonb", - "Int4", - "Bytea", - "Int4", - "Numeric", - "Bytea", - "Bytea", - "Int4", - "Numeric", - "Bytea", - "Timestamp" - ] - } - }, - "query": "\n INSERT INTO transactions\n (\n hash,\n is_priority,\n initiator_address,\n\n gas_limit,\n max_fee_per_gas,\n gas_per_pubdata_limit,\n\n data,\n upgrade_id,\n contract_address,\n l1_block_number,\n value,\n\n paymaster,\n paymaster_input,\n tx_format,\n\n l1_tx_mint,\n l1_tx_refund_recipient,\n\n received_at,\n created_at,\n updated_at\n )\n VALUES\n (\n $1, TRUE, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,\n $13, $14, $15, $16, now(), now()\n )\n ON CONFLICT (hash) DO NOTHING\n " - }, - "8fe01036cac5181aabfdc06095da291c4de6b1e0f82f846c37509bb550ef544e": { - "describe": { - "columns": [ - { - "name": "l1_address", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT l1_address FROM tokens WHERE well_known = false" + "query": "DELETE FROM l1_batches WHERE number > $1" }, - "9008367aad7877f269b765c4d0772d0f60689fcde6987c620fe5749a259a8db7": { + "88c49ebeb45f7208d223de59ec08a332beac765644e4f29ed855808b8f9cef91": { "describe": { "columns": [ { "name": "id", "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int4", - "Int8", - "Int8", - "Text", - "Bytea" - ] - } - }, - "query": "INSERT INTO eth_txs_history\n (eth_tx_id, base_fee_per_gas, priority_fee_per_gas, tx_hash, signed_raw_tx, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, now(), now())\n ON CONFLICT (tx_hash) DO NOTHING\n RETURNING id" - }, - "91db60cc4f98ebcaef1435342607da0a86fe16e20a696cb81a569772d5d5ae88": { - "describe": { - "columns": [ - { - "name": "value", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Bytea", - "Int8" - ] - } - }, - "query": "\n SELECT value\n FROM storage_logs\n WHERE storage_logs.hashed_key = $1 AND storage_logs.miniblock_number <= $2\n ORDER BY storage_logs.miniblock_number DESC, storage_logs.operation_number DESC\n LIMIT 1\n " - }, - "957ceda740ffb36740acf1e3fbacf76a2ea7422dd9d76a38d745113359e4b7a6": { - "describe": { - "columns": [ + "type_info": "Int8" + }, { - "name": "protocol_version", - "ordinal": 0, - "type_info": "Int4" + "name": "circuit_input_blob_url", + "ordinal": 1, + "type_info": "Text" } ], "nullable": [ + false, true ], "parameters": { @@ -6293,332 +6420,250 @@ ] } }, - "query": "SELECT protocol_version FROM l1_batches WHERE number = $1" + "query": "\n SELECT id, circuit_input_blob_url FROM prover_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND circuit_input_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n " }, - "95ce099fde99c57a930ed3d44f74a90d632b831360210ec7fe21b33bed1a4582": { + "8996a1794585dfe0f9c16a11e113831a63d5d944bc8061d7caa25ea33f12b19d": { "describe": { "columns": [ { - "name": "id", + "name": "is_priority", "ordinal": 0, - "type_info": "Int4" + "type_info": "Bool" }, { - "name": "nonce", + "name": "initiator_address", "ordinal": 1, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "raw_tx", + "name": "gas_limit", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Numeric" }, { - "name": "contract_address", + "name": "gas_per_pubdata_limit", "ordinal": 3, - "type_info": "Text" + "type_info": "Numeric" }, { - "name": "tx_type", + "name": "received_at", "ordinal": 4, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "gas_used", + "name": "miniblock_number", "ordinal": 5, "type_info": "Int8" }, { - "name": "created_at", + "name": "error", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Varchar" }, { - "name": "updated_at", + "name": "effective_gas_price", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "Numeric" }, { - "name": "has_failed", + "name": "refunded_gas", "ordinal": 8, - "type_info": "Bool" + "type_info": "Int8" }, { - "name": "sent_at_block", + "name": "eth_commit_tx_hash?", "ordinal": 9, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "confirmed_eth_tx_history_id", + "name": "eth_prove_tx_hash?", "ordinal": 10, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "predicted_gas_cost", + "name": "eth_execute_tx_hash?", "ordinal": 11, - "type_info": "Int8" + "type_info": "Text" } ], "nullable": [ false, false, + true, + true, false, - false, - false, + true, + true, true, false, false, false, - true, - true, false ], "parameters": { "Left": [ - "Bytea", - "Int8", - "Text", - "Text", - "Int8" + "Bytea" ] } }, - "query": "INSERT INTO eth_txs (raw_tx, nonce, tx_type, contract_address, predicted_gas_cost, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, now(), now())\n RETURNING *" + "query": "\n SELECT transactions.is_priority,\n transactions.initiator_address,\n transactions.gas_limit,\n transactions.gas_per_pubdata_limit,\n transactions.received_at,\n transactions.miniblock_number,\n transactions.error,\n transactions.effective_gas_price,\n transactions.refunded_gas,\n commit_tx.tx_hash as \"eth_commit_tx_hash?\",\n prove_tx.tx_hash as \"eth_prove_tx_hash?\",\n execute_tx.tx_hash as \"eth_execute_tx_hash?\"\n FROM transactions\n LEFT JOIN miniblocks ON miniblocks.number = transactions.miniblock_number\n LEFT JOIN l1_batches ON l1_batches.number = miniblocks.l1_batch_number\n LEFT JOIN eth_txs_history as commit_tx ON (l1_batches.eth_commit_tx_id = commit_tx.eth_tx_id AND commit_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as prove_tx ON (l1_batches.eth_prove_tx_id = prove_tx.eth_tx_id AND prove_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as execute_tx ON (l1_batches.eth_execute_tx_id = execute_tx.eth_tx_id AND execute_tx.confirmed_at IS NOT NULL)\n WHERE transactions.hash = $1\n " }, - "95e0e783794ac55ab20b30366f037c313fb0d17e93d3e6ec60667ef1b4da30d5": { + "89b124c78f4f6e86790af8ec391a2c486ce01b33cfb4492a443187b1731cae1e": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8Array" - ] - } - }, - "query": "\n UPDATE prover_jobs\n SET is_blob_cleaned=TRUE\n WHERE id = ANY($1);\n " - }, - "96b1cd2bb6861064b633d597a4a09d279dbc7bcd7a810a7270da3d7941af0fff": { - "describe": { - "columns": [ - { - "name": "count!", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Bytea", - "Bytea" + "Int4", + "Int8", + "Int8" ] } }, - "query": "SELECT COUNT(*) as \"count!\" FROM (SELECT * FROM storage_logs WHERE storage_logs.hashed_key = $1 ORDER BY storage_logs.miniblock_number DESC, storage_logs.operation_number DESC LIMIT 1) sl WHERE sl.value != $2" + "query": "UPDATE l1_batches SET eth_prove_tx_id = $1, updated_at = now() WHERE number BETWEEN $2 AND $3" }, - "96f6d06a49646f93ba1918080ef1efba868d506c6b51ede981e610f1b57bf88b": { + "8a05b6c052ace9b5a383b301f3f441536d90a96bbb791f4711304b22e02193df": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "ByteaArray" + "Time", + "Int8" ] } }, - "query": "DELETE FROM storage WHERE hashed_key = ANY($1)" + "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status = 'successful', updated_at = now(), time_taken = $1\n WHERE id = $2\n " }, - "987fcbbd716648c7c368462643f13d8001d5c6d197add90613ae21d21fdef79b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8" - ] - } - }, - "query": "UPDATE prover_jobs_fri SET status = $1, updated_at = now() WHERE id = $2" - }, - "9970bb69f5ca9ab9f103e1547eb40c1d4f5dd3a540ff6f1b9724821350c9501a": { + "8cd540b6063f4a0c1bf4ccb3d111a0ecc341ca8b46b83544c515aa4d809ab9f1": { "describe": { "columns": [ { - "name": "id", + "name": "number", "ordinal": 0, "type_info": "Int8" }, { - "name": "l1_batch_number", + "name": "l1_batch_number!", "ordinal": 1, "type_info": "Int8" }, { - "name": "circuit_type", + "name": "timestamp", "ordinal": 2, - "type_info": "Text" + "type_info": "Int8" }, { - "name": "prover_input", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "status", + "name": "l2_tx_count", "ordinal": 4, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "error", + "name": "root_hash?", "ordinal": 5, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "processing_started_at", + "name": "commit_tx_hash?", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Text" }, { - "name": "created_at", + "name": "committed_at?", "ordinal": 7, "type_info": "Timestamp" }, { - "name": "updated_at", + "name": "prove_tx_hash?", "ordinal": 8, - "type_info": "Timestamp" + "type_info": "Text" }, { - "name": "time_taken", + "name": "proven_at?", "ordinal": 9, - "type_info": "Time" + "type_info": "Timestamp" }, { - "name": "aggregation_round", + "name": "execute_tx_hash?", "ordinal": 10, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "result", + "name": "executed_at?", "ordinal": 11, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "sequence_number", + "name": "l1_gas_price", "ordinal": 12, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "attempts", + "name": "l2_fair_gas_price", "ordinal": 13, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "circuit_input_blob_url", + "name": "bootloader_code_hash", "ordinal": 14, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "proccesed_by", + "name": "default_aa_code_hash", "ordinal": 15, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "is_blob_cleaned", + "name": "protocol_version", "ordinal": 16, - "type_info": "Bool" + "type_info": "Int4" }, { - "name": "protocol_version", + "name": "fee_account_address?", "ordinal": 17, - "type_info": "Int4" + "type_info": "Bytea" } ], "nullable": [ false, + null, false, false, false, false, - true, - true, - false, false, + true, false, + true, false, true, false, false, true, true, - false, - true + true, + false ], "parameters": { "Left": [ - "Int4Array" - ] - } - }, - "query": "\n UPDATE prover_jobs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE id = (\n SELECT id\n FROM prover_jobs\n WHERE status = 'queued'\n AND protocol_version = ANY($1)\n ORDER BY aggregation_round DESC, l1_batch_number ASC, id ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING prover_jobs.*\n " - }, - "99d331d233d357302ab0cc7e3269ef9e414f0c3111785212660f471e3b4f6a04": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "ByteaArray", - "Int4Array", - "ByteaArray", - "ByteaArray", - "NumericArray", - "NumericArray", - "NumericArray", - "NumericArray", - "Int4Array", - "Int4Array", - "VarcharArray", - "NumericArray", - "JsonbArray", - "ByteaArray", - "JsonbArray", - "Int8Array", - "NumericArray", - "ByteaArray", - "ByteaArray", - "ByteaArray", "Int8" ] } }, - "query": "\n UPDATE transactions\n SET \n hash = data_table.hash,\n signature = data_table.signature,\n gas_limit = data_table.gas_limit,\n max_fee_per_gas = data_table.max_fee_per_gas,\n max_priority_fee_per_gas = data_table.max_priority_fee_per_gas,\n gas_per_pubdata_limit = data_table.gas_per_pubdata_limit,\n input = data_table.input,\n data = data_table.data,\n tx_format = data_table.tx_format,\n miniblock_number = $21,\n index_in_block = data_table.index_in_block,\n error = NULLIF(data_table.error, ''),\n effective_gas_price = data_table.effective_gas_price,\n execution_info = data_table.new_execution_info,\n refunded_gas = data_table.refunded_gas,\n value = data_table.value,\n contract_address = data_table.contract_address,\n paymaster = data_table.paymaster,\n paymaster_input = data_table.paymaster_input,\n in_mempool = FALSE,\n updated_at = now()\n FROM\n (\n SELECT data_table_temp.* FROM (\n SELECT\n UNNEST($1::bytea[]) AS initiator_address,\n UNNEST($2::int[]) AS nonce,\n UNNEST($3::bytea[]) AS hash,\n UNNEST($4::bytea[]) AS signature,\n UNNEST($5::numeric[]) AS gas_limit,\n UNNEST($6::numeric[]) AS max_fee_per_gas,\n UNNEST($7::numeric[]) AS max_priority_fee_per_gas,\n UNNEST($8::numeric[]) AS gas_per_pubdata_limit,\n UNNEST($9::int[]) AS tx_format,\n UNNEST($10::integer[]) AS index_in_block,\n UNNEST($11::varchar[]) AS error,\n UNNEST($12::numeric[]) AS effective_gas_price,\n UNNEST($13::jsonb[]) AS new_execution_info,\n UNNEST($14::bytea[]) AS input,\n UNNEST($15::jsonb[]) AS data,\n UNNEST($16::bigint[]) as refunded_gas,\n UNNEST($17::numeric[]) as value,\n UNNEST($18::bytea[]) as contract_address,\n UNNEST($19::bytea[]) as paymaster,\n UNNEST($20::bytea[]) as paymaster_input\n ) AS data_table_temp\n JOIN transactions ON transactions.initiator_address = data_table_temp.initiator_address\n AND transactions.nonce = data_table_temp.nonce\n ORDER BY transactions.hash\n ) AS data_table\n WHERE transactions.initiator_address=data_table.initiator_address\n AND transactions.nonce=data_table.nonce\n " - }, - "9aaf98668f384f634860c4acf793ff47be08975e5d09061cc26fd53dea249c55": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Bytea", - "Text", - "Int4" - ] - } - }, - "query": "\n INSERT INTO scheduler_witness_jobs\n (l1_batch_number, scheduler_witness, scheduler_witness_blob_url, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, 'waiting_for_artifacts', now(), now())\n " + "query": "\n SELECT miniblocks.number,\n COALESCE(miniblocks.l1_batch_number, (SELECT (max(number) + 1) FROM l1_batches)) as \"l1_batch_number!\",\n miniblocks.timestamp,\n miniblocks.l1_tx_count,\n miniblocks.l2_tx_count,\n miniblocks.hash as \"root_hash?\",\n commit_tx.tx_hash as \"commit_tx_hash?\",\n commit_tx.confirmed_at as \"committed_at?\",\n prove_tx.tx_hash as \"prove_tx_hash?\",\n prove_tx.confirmed_at as \"proven_at?\",\n execute_tx.tx_hash as \"execute_tx_hash?\",\n execute_tx.confirmed_at as \"executed_at?\",\n miniblocks.l1_gas_price,\n miniblocks.l2_fair_gas_price,\n miniblocks.bootloader_code_hash,\n miniblocks.default_aa_code_hash,\n miniblocks.protocol_version,\n l1_batches.fee_account_address as \"fee_account_address?\"\n FROM miniblocks\n LEFT JOIN l1_batches ON miniblocks.l1_batch_number = l1_batches.number\n LEFT JOIN eth_txs_history as commit_tx ON (l1_batches.eth_commit_tx_id = commit_tx.eth_tx_id AND commit_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as prove_tx ON (l1_batches.eth_prove_tx_id = prove_tx.eth_tx_id AND prove_tx.confirmed_at IS NOT NULL)\n LEFT JOIN eth_txs_history as execute_tx ON (l1_batches.eth_execute_tx_id = execute_tx.eth_tx_id AND execute_tx.confirmed_at IS NOT NULL)\n WHERE miniblocks.number = $1\n " }, - "9b4d87f7d7cabe0d61f10d26bb856cce3dc7f36f521efbb6992d98937e5a91ba": { + "8d3c9575e3cea3956ba84edc982fcf6e0f7667350e6c2cd6801db8400eabaf9b": { "describe": { "columns": [ { - "name": "id", + "name": "hashed_key", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" } ], "nullable": [ @@ -6626,394 +6671,416 @@ ], "parameters": { "Left": [ - "Bytea", - "Text", - "Text", - "Text", - "Text", - "Bool", - "Text", - "Bytea", - "Bool" - ] - } - }, - "query": "\n INSERT INTO contract_verification_requests (\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system,\n status,\n created_at,\n updated_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, 'queued', now(), now())\n RETURNING id\n " - }, - "9b70e9039cdc1a8c8baf9220a9d42a9b1b209ce73f74cccb9e313bcacdc3daf3": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Int4", - "Bytea", - "Int4", - "Text", - "Int4" + "Int8" ] } }, - "query": "\n INSERT INTO prover_jobs (l1_batch_number, circuit_type, sequence_number, prover_input, aggregation_round, circuit_input_blob_url, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, 'queued', now(), now())\n ON CONFLICT(l1_batch_number, aggregation_round, sequence_number) DO NOTHING\n " + "query": "SELECT DISTINCT ON (hashed_key) hashed_key FROM (SELECT * FROM storage_logs WHERE miniblock_number > $1) inn" }, - "9bf32ea710825c1f0560a7eaa89f8f097ad196755ba82d98a729a2b0d34e1aca": { + "8dcbaaa6186da52ca8b440b6428826288dc668af5a6fc99ef3078c8bcb38c419": { "describe": { "columns": [ { - "name": "successful_limit!", + "name": "l1_batch_number", "ordinal": 0, "type_info": "Int8" }, { - "name": "queued_limit!", + "name": "circuit_id", "ordinal": 1, - "type_info": "Int8" + "type_info": "Int2" }, { - "name": "max_block!", + "name": "depth", "ordinal": 2, - "type_info": "Int8" + "type_info": "Int4" } ], "nullable": [ - null, - null, - null + false, + false, + false ], "parameters": { "Left": [] } }, - "query": "\n SELECT\n (SELECT l1_batch_number\n FROM prover_jobs\n WHERE status NOT IN ('successful', 'skipped')\n ORDER BY l1_batch_number\n LIMIT 1) as \"successful_limit!\",\n \n (SELECT l1_batch_number\n FROM prover_jobs\n WHERE status <> 'queued'\n ORDER BY l1_batch_number DESC\n LIMIT 1) as \"queued_limit!\",\n\n (SELECT MAX(l1_batch_number) as \"max!\" FROM prover_jobs) as \"max_block!\"\n " + "query": "\n UPDATE node_aggregation_witness_jobs_fri\n SET status='queued'\n WHERE (l1_batch_number, circuit_id, depth) IN\n (SELECT prover_jobs_fri.l1_batch_number, prover_jobs_fri.circuit_id, prover_jobs_fri.depth\n FROM prover_jobs_fri\n JOIN node_aggregation_witness_jobs_fri nawj ON\n prover_jobs_fri.l1_batch_number = nawj.l1_batch_number\n AND prover_jobs_fri.circuit_id = nawj.circuit_id\n AND prover_jobs_fri.depth = nawj.depth\n WHERE nawj.status = 'waiting_for_proofs'\n AND prover_jobs_fri.status = 'successful'\n AND prover_jobs_fri.aggregation_round = 2\n GROUP BY prover_jobs_fri.l1_batch_number, prover_jobs_fri.circuit_id, prover_jobs_fri.depth, nawj.number_of_dependent_jobs\n HAVING COUNT(*) = nawj.number_of_dependent_jobs)\n RETURNING l1_batch_number, circuit_id, depth;\n " }, - "9c77342759fc71b12f05c2395ac36aabadab1fa64ff585d6349b8053300cf76c": { + "8f75c5aa615080fc02b60baccae9c49a81e282a54864ea3eb874ebe10a23eafe": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Bytea", - "Bytea", - "Bytea", - "Bytea", - "Bytea", - "Bytea", - "Bytea", - "Bool", - "Bytea", - "Int8", - "Bytea", - "Bytea", - "Bytea", "Int8" ] } }, - "query": "UPDATE l1_batches SET hash = $1, merkle_root_hash = $2, commitment = $3, compressed_repeated_writes = $4, compressed_initial_writes = $5, l2_l1_compressed_messages = $6, l2_l1_merkle_root = $7, zkporter_is_available = $8, parent_hash = $9, rollup_last_leaf_index = $10, aux_data_hash = $11, pass_through_data_hash = $12, meta_parameters_hash = $13, updated_at = now() WHERE number = $14 AND hash IS NULL" + "query": "UPDATE prover_jobs_fri SET status = 'sent_to_server', updated_at = now() WHERE l1_batch_number = $1" }, - "9d28c1be3bda0c4fb37567d4a56730e801f48fbb2abad42ea894ebd8ee40412d": { + "8fa1a390d7b11b60b3352fafc0a8a7fa15bc761b1bb902f5105fd66b2e3087f2": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8", - "Int2", - "Text", - "Int2", + "Int8" + ] + } + }, + "query": "\n INSERT INTO scheduler_dependency_tracker_fri\n (l1_batch_number, status, created_at, updated_at)\n VALUES ($1, 'waiting_for_proofs', now(), now())\n ON CONFLICT(l1_batch_number)\n DO UPDATE SET updated_at=now()\n " + }, + "8fda20e48c41a9c1e58c8c607222a65e1409f63eba91ac99b2736ca5ebbb5ec6": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Bytea", + "Bytea", + "Numeric", + "Numeric", + "Numeric", + "Jsonb", "Int4", + "Bytea", "Int4", - "Bool", - "Int4" + "Numeric", + "Bytea", + "Bytea", + "Int4", + "Numeric", + "Bytea", + "Timestamp" ] } }, - "query": "\n INSERT INTO prover_jobs_fri (l1_batch_number, circuit_id, circuit_blob_url, aggregation_round, sequence_number, depth, is_node_final_proof, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 'queued', now(), now())\n ON CONFLICT(l1_batch_number, aggregation_round, circuit_id, depth, sequence_number)\n DO UPDATE SET updated_at=now()\n " + "query": "\n INSERT INTO transactions\n (\n hash,\n is_priority,\n initiator_address,\n\n gas_limit,\n max_fee_per_gas,\n gas_per_pubdata_limit,\n\n data,\n upgrade_id,\n contract_address,\n l1_block_number,\n value,\n\n paymaster,\n paymaster_input,\n tx_format,\n\n l1_tx_mint,\n l1_tx_refund_recipient,\n\n received_at,\n created_at,\n updated_at\n )\n VALUES\n (\n $1, TRUE, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,\n $13, $14, $15, $16, now(), now()\n )\n ON CONFLICT (hash) DO NOTHING\n " }, - "9feee3fd267dc4e58185aeae7cab798c03eefa69470e4b98716615cecf6c012a": { + "8fe01036cac5181aabfdc06095da291c4de6b1e0f82f846c37509bb550ef544e": { "describe": { "columns": [ { - "name": "id", + "name": "l1_address", "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "contract_address", - "ordinal": 1, "type_info": "Bytea" - }, - { - "name": "source_code", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "contract_name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "zk_compiler_version", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "compiler_version", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "optimization_used", - "ordinal": 6, - "type_info": "Bool" - }, + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT l1_address FROM tokens WHERE well_known = false" + }, + "9008367aad7877f269b765c4d0772d0f60689fcde6987c620fe5749a259a8db7": { + "describe": { + "columns": [ { - "name": "optimizer_mode", - "ordinal": 7, - "type_info": "Text" - }, + "name": "id", + "ordinal": 0, + "type_info": "Int4" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Int4", + "Int8", + "Int8", + "Text", + "Bytea" + ] + } + }, + "query": "INSERT INTO eth_txs_history\n (eth_tx_id, base_fee_per_gas, priority_fee_per_gas, tx_hash, signed_raw_tx, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, now(), now())\n ON CONFLICT (tx_hash) DO NOTHING\n RETURNING id" + }, + "91db60cc4f98ebcaef1435342607da0a86fe16e20a696cb81a569772d5d5ae88": { + "describe": { + "columns": [ { - "name": "constructor_arguments", - "ordinal": 8, + "name": "value", + "ordinal": 0, "type_info": "Bytea" - }, - { - "name": "is_system", - "ordinal": 9, - "type_info": "Bool" } ], "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - false, false ], "parameters": { "Left": [ - "Interval" + "Bytea", + "Int8" ] } }, - "query": "UPDATE contract_verification_requests\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE id = (\n SELECT id FROM contract_verification_requests\n WHERE status = 'queued' OR (status = 'in_progress' AND processing_started_at < now() - $1::interval)\n ORDER BY created_at\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING id, contract_address, source_code, contract_name, zk_compiler_version, compiler_version, optimization_used,\n optimizer_mode, constructor_arguments, is_system\n " + "query": "\n SELECT value\n FROM storage_logs\n WHERE storage_logs.hashed_key = $1 AND storage_logs.miniblock_number <= $2\n ORDER BY storage_logs.miniblock_number DESC, storage_logs.operation_number DESC\n LIMIT 1\n " }, - "a074cd2c23434a8e801c2c0b42e63f1657765aceabd6d8a50ef2d2299bba99ab": { + "957ceda740ffb36740acf1e3fbacf76a2ea7422dd9d76a38d745113359e4b7a6": { + "describe": { + "columns": [ + { + "name": "protocol_version", + "ordinal": 0, + "type_info": "Int4" + } + ], + "nullable": [ + true + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT protocol_version FROM l1_batches WHERE number = $1" + }, + "95ce099fde99c57a930ed3d44f74a90d632b831360210ec7fe21b33bed1a4582": { "describe": { "columns": [ { "name": "id", "ordinal": 0, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "l1_batch_number", + "name": "nonce", "ordinal": 1, "type_info": "Int8" }, { - "name": "circuit_id", + "name": "raw_tx", "ordinal": 2, - "type_info": "Int2" + "type_info": "Bytea" }, { - "name": "closed_form_inputs_blob_url", + "name": "contract_address", "ordinal": 3, "type_info": "Text" }, { - "name": "attempts", + "name": "tx_type", "ordinal": 4, - "type_info": "Int2" - }, - { - "name": "status", - "ordinal": 5, "type_info": "Text" }, { - "name": "error", - "ordinal": 6, - "type_info": "Text" + "name": "gas_used", + "ordinal": 5, + "type_info": "Int8" }, { "name": "created_at", - "ordinal": 7, + "ordinal": 6, "type_info": "Timestamp" }, { "name": "updated_at", - "ordinal": 8, - "type_info": "Timestamp" - }, - { - "name": "processing_started_at", - "ordinal": 9, + "ordinal": 7, "type_info": "Timestamp" }, { - "name": "time_taken", - "ordinal": 10, - "type_info": "Time" - }, - { - "name": "is_blob_cleaned", - "ordinal": 11, + "name": "has_failed", + "ordinal": 8, "type_info": "Bool" }, { - "name": "number_of_basic_circuits", - "ordinal": 12, + "name": "sent_at_block", + "ordinal": 9, "type_info": "Int4" }, { - "name": "protocol_version", - "ordinal": 13, + "name": "confirmed_eth_tx_history_id", + "ordinal": 10, "type_info": "Int4" }, { - "name": "picked_by", - "ordinal": 14, - "type_info": "Text" + "name": "predicted_gas_cost", + "ordinal": 11, + "type_info": "Int8" } ], "nullable": [ false, false, false, - true, false, false, true, false, false, + false, true, true, - true, - true, - true, - true + false ], "parameters": { "Left": [ - "Int4Array", - "Text" + "Bytea", + "Int8", + "Text", + "Text", + "Int8" ] } }, - "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $2\n WHERE id = (\n SELECT id\n FROM leaf_aggregation_witness_jobs_fri\n WHERE status = 'queued'\n AND protocol_version = ANY($1)\n ORDER BY l1_batch_number ASC, id ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING leaf_aggregation_witness_jobs_fri.*\n " + "query": "INSERT INTO eth_txs (raw_tx, nonce, tx_type, contract_address, predicted_gas_cost, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, now(), now())\n RETURNING *" }, - "a19b7137403c5cdf1be5f5122ce4d297ed661fa8bdb3bc91f8a81fe9da47469e": { + "95e0e783794ac55ab20b30366f037c313fb0d17e93d3e6ec60667ef1b4da30d5": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8Array" + ] + } + }, + "query": "\n UPDATE prover_jobs\n SET is_blob_cleaned=TRUE\n WHERE id = ANY($1);\n " + }, + "96b1cd2bb6861064b633d597a4a09d279dbc7bcd7a810a7270da3d7941af0fff": { "describe": { "columns": [ { - "name": "upgrade_tx_hash", + "name": "count!", "ordinal": 0, - "type_info": "Bytea" + "type_info": "Int8" } ], "nullable": [ - true + null ], "parameters": { "Left": [ - "Int4" + "Bytea", + "Bytea" ] } }, - "query": "\n SELECT upgrade_tx_hash FROM protocol_versions\n WHERE id = $1\n " + "query": "SELECT COUNT(*) as \"count!\" FROM (SELECT * FROM storage_logs WHERE storage_logs.hashed_key = $1 ORDER BY storage_logs.miniblock_number DESC, storage_logs.operation_number DESC LIMIT 1) sl WHERE sl.value != $2" }, - "a1a6b52403c1db35c8d83d0a512ac453ecd54b34ec516027d540ee1890b40291": { + "96f6d06a49646f93ba1918080ef1efba868d506c6b51ede981e610f1b57bf88b": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int4", - "Bytea", - "Bytea", - "Bytea", - "Bytea" + "ByteaArray" ] } }, - "query": "INSERT INTO prover_fri_protocol_versions (id, recursion_scheduler_level_vk_hash, recursion_node_level_vk_hash, recursion_leaf_level_vk_hash, recursion_circuits_set_vks_hash, created_at) VALUES ($1, $2, $3, $4, $5, now()) ON CONFLICT(id) DO NOTHING" + "query": "DELETE FROM storage WHERE hashed_key = ANY($1)" }, - "a39f760d2cd879a78112e57d8611d7099802b03b7cc4933cafb4c47e133ad543": { + "987fcbbd716648c7c368462643f13d8001d5c6d197add90613ae21d21fdef79b": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Text", + "Int8" + ] + } + }, + "query": "UPDATE prover_jobs_fri SET status = $1, updated_at = now() WHERE id = $2" + }, + "9970bb69f5ca9ab9f103e1547eb40c1d4f5dd3a540ff6f1b9724821350c9501a": { "describe": { "columns": [ { - "name": "address", + "name": "id", "ordinal": 0, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "topic1", + "name": "l1_batch_number", "ordinal": 1, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "topic2", + "name": "circuit_type", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "topic3", + "name": "prover_input", "ordinal": 3, "type_info": "Bytea" }, { - "name": "topic4", + "name": "status", "ordinal": 4, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "value", + "name": "error", "ordinal": 5, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "block_hash", + "name": "processing_started_at", "ordinal": 6, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "l1_batch_number?", + "name": "created_at", "ordinal": 7, - "type_info": "Int8" + "type_info": "Timestamp" }, { - "name": "miniblock_number", + "name": "updated_at", "ordinal": 8, - "type_info": "Int8" + "type_info": "Timestamp" }, { - "name": "tx_hash", + "name": "time_taken", "ordinal": 9, - "type_info": "Bytea" + "type_info": "Time" }, { - "name": "tx_index_in_block", + "name": "aggregation_round", "ordinal": 10, "type_info": "Int4" }, { - "name": "event_index_in_block", + "name": "result", "ordinal": 11, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "event_index_in_tx", + "name": "sequence_number", "ordinal": 12, "type_info": "Int4" + }, + { + "name": "attempts", + "ordinal": 13, + "type_info": "Int4" + }, + { + "name": "circuit_input_blob_url", + "ordinal": 14, + "type_info": "Text" + }, + { + "name": "proccesed_by", + "ordinal": 15, + "type_info": "Text" + }, + { + "name": "is_blob_cleaned", + "ordinal": 16, + "type_info": "Bool" + }, + { + "name": "protocol_version", + "ordinal": 17, + "type_info": "Int4" } ], "nullable": [ @@ -7022,312 +7089,355 @@ false, false, false, + true, + true, false, - null, - null, false, false, false, + true, false, - false + false, + true, + true, + false, + true ], "parameters": { "Left": [ - "Bytea" + "Int4Array" ] } }, - "query": "\n SELECT\n address, topic1, topic2, topic3, topic4, value,\n Null::bytea as \"block_hash\", Null::bigint as \"l1_batch_number?\",\n miniblock_number, tx_hash, tx_index_in_block,\n event_index_in_block, event_index_in_tx\n FROM events\n WHERE tx_hash = $1\n ORDER BY miniblock_number ASC, event_index_in_block ASC\n " + "query": "\n UPDATE prover_jobs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE id = (\n SELECT id\n FROM prover_jobs\n WHERE status = 'queued'\n AND protocol_version = ANY($1)\n ORDER BY aggregation_round DESC, l1_batch_number ASC, id ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING prover_jobs.*\n " }, - "a3d526a5a341618e9784fc81626143a3174709483a527879254ff8e28f210ac3": { + "99d331d233d357302ab0cc7e3269ef9e414f0c3111785212660f471e3b4f6a04": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int4", - "Int8", + "ByteaArray", + "Int4Array", + "ByteaArray", + "ByteaArray", + "NumericArray", + "NumericArray", + "NumericArray", + "NumericArray", + "Int4Array", + "Int4Array", + "VarcharArray", + "NumericArray", + "JsonbArray", + "ByteaArray", + "JsonbArray", + "Int8Array", + "NumericArray", + "ByteaArray", + "ByteaArray", + "ByteaArray", "Int8" ] } }, - "query": "UPDATE l1_batches SET eth_execute_tx_id = $1, updated_at = now() WHERE number BETWEEN $2 AND $3" + "query": "\n UPDATE transactions\n SET \n hash = data_table.hash,\n signature = data_table.signature,\n gas_limit = data_table.gas_limit,\n max_fee_per_gas = data_table.max_fee_per_gas,\n max_priority_fee_per_gas = data_table.max_priority_fee_per_gas,\n gas_per_pubdata_limit = data_table.gas_per_pubdata_limit,\n input = data_table.input,\n data = data_table.data,\n tx_format = data_table.tx_format,\n miniblock_number = $21,\n index_in_block = data_table.index_in_block,\n error = NULLIF(data_table.error, ''),\n effective_gas_price = data_table.effective_gas_price,\n execution_info = data_table.new_execution_info,\n refunded_gas = data_table.refunded_gas,\n value = data_table.value,\n contract_address = data_table.contract_address,\n paymaster = data_table.paymaster,\n paymaster_input = data_table.paymaster_input,\n in_mempool = FALSE,\n updated_at = now()\n FROM\n (\n SELECT data_table_temp.* FROM (\n SELECT\n UNNEST($1::bytea[]) AS initiator_address,\n UNNEST($2::int[]) AS nonce,\n UNNEST($3::bytea[]) AS hash,\n UNNEST($4::bytea[]) AS signature,\n UNNEST($5::numeric[]) AS gas_limit,\n UNNEST($6::numeric[]) AS max_fee_per_gas,\n UNNEST($7::numeric[]) AS max_priority_fee_per_gas,\n UNNEST($8::numeric[]) AS gas_per_pubdata_limit,\n UNNEST($9::int[]) AS tx_format,\n UNNEST($10::integer[]) AS index_in_block,\n UNNEST($11::varchar[]) AS error,\n UNNEST($12::numeric[]) AS effective_gas_price,\n UNNEST($13::jsonb[]) AS new_execution_info,\n UNNEST($14::bytea[]) AS input,\n UNNEST($15::jsonb[]) AS data,\n UNNEST($16::bigint[]) as refunded_gas,\n UNNEST($17::numeric[]) as value,\n UNNEST($18::bytea[]) as contract_address,\n UNNEST($19::bytea[]) as paymaster,\n UNNEST($20::bytea[]) as paymaster_input\n ) AS data_table_temp\n JOIN transactions ON transactions.initiator_address = data_table_temp.initiator_address\n AND transactions.nonce = data_table_temp.nonce\n ORDER BY transactions.hash\n ) AS data_table\n WHERE transactions.initiator_address=data_table.initiator_address\n AND transactions.nonce=data_table.nonce\n " }, - "a42626c162a0600b9c7d22dd0d7997fa70cc95296ecc185ff9ae2e03593b07bf": { + "9aaf98668f384f634860c4acf793ff47be08975e5d09061cc26fd53dea249c55": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8" + "Int8", + "Bytea", + "Text", + "Int4" ] } }, - "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status='queued'\n WHERE l1_batch_number = $1\n AND status != 'successful'\n AND status != 'in_progress'\n " + "query": "\n INSERT INTO scheduler_witness_jobs\n (l1_batch_number, scheduler_witness, scheduler_witness_blob_url, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, 'waiting_for_artifacts', now(), now())\n " }, - "a4a14eb42b9acca3f93c67e5760ba700c333b5e9a38c132a3060a94c988e7f13": { + "9b4d87f7d7cabe0d61f10d26bb856cce3dc7f36f521efbb6992d98937e5a91ba": { "describe": { "columns": [ { - "name": "hash", + "name": "id", "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "received_at", - "ordinal": 1, - "type_info": "Timestamp" + "type_info": "Int8" } ], "nullable": [ - false, false ], "parameters": { "Left": [ - "Timestamp", - "Int8" + "Bytea", + "Text", + "Text", + "Text", + "Text", + "Bool", + "Text", + "Bytea", + "Bool" ] } }, - "query": "SELECT transactions.hash, transactions.received_at FROM transactions LEFT JOIN miniblocks ON miniblocks.number = miniblock_number WHERE received_at > $1 ORDER BY received_at ASC LIMIT $2" + "query": "\n INSERT INTO contract_verification_requests (\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system,\n status,\n created_at,\n updated_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, 'queued', now(), now())\n RETURNING id\n " }, - "a5115658f3a53462a9570fd6676f1931604d1c17a9a2b5f1475519006aaf03ba": { + "9b70e9039cdc1a8c8baf9220a9d42a9b1b209ce73f74cccb9e313bcacdc3daf3": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ "Int8", - "Text" + "Text", + "Int4", + "Bytea", + "Int4", + "Text", + "Int4" ] } }, - "query": "INSERT INTO proof_generation_details (l1_batch_number, status, proof_gen_data_blob_url, created_at, updated_at) VALUES ($1, 'ready_to_be_proven', $2, now(), now()) ON CONFLICT (l1_batch_number) DO NOTHING" + "query": "\n INSERT INTO prover_jobs (l1_batch_number, circuit_type, sequence_number, prover_input, aggregation_round, circuit_input_blob_url, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, 'queued', now(), now())\n ON CONFLICT(l1_batch_number, aggregation_round, sequence_number) DO NOTHING\n " }, - "a7abde5a53248d6e63aa998acac521194231bbe08140c9c4efa548c4f3ae17fa": { + "9bf32ea710825c1f0560a7eaa89f8f097ad196755ba82d98a729a2b0d34e1aca": { "describe": { "columns": [ { - "name": "max?", + "name": "successful_limit!", "ordinal": 0, - "type_info": "Int4" + "type_info": "Int8" + }, + { + "name": "queued_limit!", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "max_block!", + "ordinal": 2, + "type_info": "Int8" } ], "nullable": [ + null, + null, null ], + "parameters": { + "Left": [] + } + }, + "query": "\n SELECT\n (SELECT l1_batch_number\n FROM prover_jobs\n WHERE status NOT IN ('successful', 'skipped')\n ORDER BY l1_batch_number\n LIMIT 1) as \"successful_limit!\",\n \n (SELECT l1_batch_number\n FROM prover_jobs\n WHERE status <> 'queued'\n ORDER BY l1_batch_number DESC\n LIMIT 1) as \"queued_limit!\",\n\n (SELECT MAX(l1_batch_number) as \"max!\" FROM prover_jobs) as \"max_block!\"\n " + }, + "9c77342759fc71b12f05c2395ac36aabadab1fa64ff585d6349b8053300cf76c": { + "describe": { + "columns": [], + "nullable": [], "parameters": { "Left": [ + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bool", + "Bytea", + "Int8", + "Bytea", + "Bytea", + "Bytea", "Int8" ] } }, - "query": "SELECT MAX(operation_number) as \"max?\" FROM storage_logs WHERE miniblock_number = $1" + "query": "UPDATE l1_batches SET hash = $1, merkle_root_hash = $2, commitment = $3, compressed_repeated_writes = $4, compressed_initial_writes = $5, l2_l1_compressed_messages = $6, l2_l1_merkle_root = $7, zkporter_is_available = $8, parent_hash = $9, rollup_last_leaf_index = $10, aux_data_hash = $11, pass_through_data_hash = $12, meta_parameters_hash = $13, updated_at = now() WHERE number = $14 AND hash IS NULL" + }, + "9d28c1be3bda0c4fb37567d4a56730e801f48fbb2abad42ea894ebd8ee40412d": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Int2", + "Text", + "Int2", + "Int4", + "Int4", + "Bool", + "Int4" + ] + } + }, + "query": "\n INSERT INTO prover_jobs_fri (l1_batch_number, circuit_id, circuit_blob_url, aggregation_round, sequence_number, depth, is_node_final_proof, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 'queued', now(), now())\n ON CONFLICT(l1_batch_number, aggregation_round, circuit_id, depth, sequence_number)\n DO UPDATE SET updated_at=now()\n " }, - "a8878258bac2876686f1218213457edd70652e8145743b6b44a846220829bbe2": { + "9feee3fd267dc4e58185aeae7cab798c03eefa69470e4b98716615cecf6c012a": { "describe": { "columns": [ { - "name": "number", + "name": "id", "ordinal": 0, "type_info": "Int8" }, { - "name": "timestamp", + "name": "contract_address", "ordinal": 1, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "is_finished", + "name": "source_code", "ordinal": 2, - "type_info": "Bool" + "type_info": "Text" }, { - "name": "l1_tx_count", + "name": "contract_name", "ordinal": 3, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "l2_tx_count", + "name": "zk_compiler_version", "ordinal": 4, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "fee_account_address", + "name": "compiler_version", "ordinal": 5, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "bloom", + "name": "optimization_used", "ordinal": 6, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "priority_ops_onchain_data", + "name": "optimizer_mode", "ordinal": 7, - "type_info": "ByteaArray" + "type_info": "Text" }, { - "name": "hash", + "name": "constructor_arguments", "ordinal": 8, "type_info": "Bytea" }, { - "name": "parent_hash", + "name": "is_system", "ordinal": 9, - "type_info": "Bytea" - }, - { - "name": "commitment", - "ordinal": 10, - "type_info": "Bytea" - }, - { - "name": "compressed_write_logs", - "ordinal": 11, - "type_info": "Bytea" - }, - { - "name": "compressed_contracts", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "eth_prove_tx_id", - "ordinal": 13, - "type_info": "Int4" - }, - { - "name": "eth_commit_tx_id", - "ordinal": 14, - "type_info": "Int4" - }, - { - "name": "eth_execute_tx_id", - "ordinal": 15, - "type_info": "Int4" - }, + "type_info": "Bool" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + false, + false + ], + "parameters": { + "Left": [ + "Interval" + ] + } + }, + "query": "UPDATE contract_verification_requests\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE id = (\n SELECT id FROM contract_verification_requests\n WHERE status = 'queued' OR (status = 'in_progress' AND processing_started_at < now() - $1::interval)\n ORDER BY created_at\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING id, contract_address, source_code, contract_name, zk_compiler_version, compiler_version, optimization_used,\n optimizer_mode, constructor_arguments, is_system\n " + }, + "a074cd2c23434a8e801c2c0b42e63f1657765aceabd6d8a50ef2d2299bba99ab": { + "describe": { + "columns": [ { - "name": "merkle_root_hash", - "ordinal": 16, - "type_info": "Bytea" + "name": "id", + "ordinal": 0, + "type_info": "Int8" }, { - "name": "l2_to_l1_logs", - "ordinal": 17, - "type_info": "ByteaArray" + "name": "l1_batch_number", + "ordinal": 1, + "type_info": "Int8" }, { - "name": "l2_to_l1_messages", - "ordinal": 18, - "type_info": "ByteaArray" + "name": "circuit_id", + "ordinal": 2, + "type_info": "Int2" }, { - "name": "used_contract_hashes", - "ordinal": 19, - "type_info": "Jsonb" + "name": "closed_form_inputs_blob_url", + "ordinal": 3, + "type_info": "Text" }, { - "name": "compressed_initial_writes", - "ordinal": 20, - "type_info": "Bytea" + "name": "attempts", + "ordinal": 4, + "type_info": "Int2" }, { - "name": "compressed_repeated_writes", - "ordinal": 21, - "type_info": "Bytea" + "name": "status", + "ordinal": 5, + "type_info": "Text" }, { - "name": "l2_l1_compressed_messages", - "ordinal": 22, - "type_info": "Bytea" + "name": "error", + "ordinal": 6, + "type_info": "Text" }, { - "name": "l2_l1_merkle_root", - "ordinal": 23, - "type_info": "Bytea" + "name": "created_at", + "ordinal": 7, + "type_info": "Timestamp" }, { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" + "name": "updated_at", + "ordinal": 8, + "type_info": "Timestamp" }, { - "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" + "name": "processing_started_at", + "ordinal": 9, + "type_info": "Timestamp" }, { - "name": "rollup_last_leaf_index", - "ordinal": 26, - "type_info": "Int8" + "name": "time_taken", + "ordinal": 10, + "type_info": "Time" }, { - "name": "zkporter_is_available", - "ordinal": 27, + "name": "is_blob_cleaned", + "ordinal": 11, "type_info": "Bool" }, { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" - }, - { - "name": "default_aa_code_hash", - "ordinal": 29, - "type_info": "Bytea" - }, - { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, - { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" - }, - { - "name": "pass_through_data_hash", - "ordinal": 32, - "type_info": "Bytea" - }, - { - "name": "meta_parameters_hash", - "ordinal": 33, - "type_info": "Bytea" + "name": "number_of_basic_circuits", + "ordinal": 12, + "type_info": "Int4" }, { "name": "protocol_version", - "ordinal": 34, + "ordinal": 13, "type_info": "Int4" + }, + { + "name": "picked_by", + "ordinal": 14, + "type_info": "Text" } ], "nullable": [ false, false, false, - false, - false, - false, - false, - false, - true, - true, - true, - true, - true, - true, - true, - true, true, false, false, - false, - true, - true, - true, true, false, false, @@ -7335,133 +7445,342 @@ true, true, true, - false, - true, - true, true, true ], "parameters": { "Left": [ - "Bytea", - "Bytea", - "Int4", - "Int8" + "Int4Array", + "Text" ] } }, - "query": "SELECT number, l1_batches.timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, l1_batches.bootloader_code_hash, l1_batches.default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM l1_batches JOIN protocol_versions ON protocol_versions.id = l1_batches.protocol_version WHERE eth_commit_tx_id IS NULL AND number != 0 AND protocol_versions.bootloader_code_hash = $1 AND protocol_versions.default_account_code_hash = $2 AND commitment IS NOT NULL AND (protocol_versions.id = $3 OR protocol_versions.upgrade_tx_hash IS NULL) ORDER BY number LIMIT $4" + "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $2\n WHERE id = (\n SELECT id\n FROM leaf_aggregation_witness_jobs_fri\n WHERE status = 'queued'\n AND protocol_version = ANY($1)\n ORDER BY l1_batch_number ASC, id ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING leaf_aggregation_witness_jobs_fri.*\n " }, - "a9b1a31def214f8b1441dc3ab720bd270f3991c9f1c7528256276e176d532163": { + "a19b7137403c5cdf1be5f5122ce4d297ed661fa8bdb3bc91f8a81fe9da47469e": { "describe": { "columns": [ { - "name": "l1_batch_number", + "name": "upgrade_tx_hash", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" } ], "nullable": [ - false + true ], "parameters": { "Left": [ - "Bytea" + "Int4" ] } }, - "query": "SELECT l1_batch_number FROM initial_writes WHERE hashed_key = $1" + "query": "\n SELECT upgrade_tx_hash FROM protocol_versions\n WHERE id = $1\n " }, - "a9b7a880dbde4f7de5a6c2ff4009281527f2d01a547228981af3af2129ffb3f7": { + "a1a6b52403c1db35c8d83d0a512ac453ecd54b34ec516027d540ee1890b40291": { "describe": { - "columns": [ - { - "name": "count!", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], + "columns": [], + "nullable": [], "parameters": { "Left": [ + "Int4", "Bytea", - "Numeric", - "Interval", - "Interval" + "Bytea", + "Bytea", + "Bytea" ] } }, - "query": "\n SELECT COUNT(*) as \"count!\" FROM tokens\n WHERE l2_address = $1 AND\n market_volume > $2 AND now() - market_volume_updated_at < $3 AND\n usd_price > 0 AND now() - usd_price_updated_at < $4\n " + "query": "INSERT INTO prover_fri_protocol_versions (id, recursion_scheduler_level_vk_hash, recursion_node_level_vk_hash, recursion_leaf_level_vk_hash, recursion_circuits_set_vks_hash, created_at) VALUES ($1, $2, $3, $4, $5, now()) ON CONFLICT(id) DO NOTHING" }, - "a9d96d6774af2637173d471f02995652cd4c131c05fdcb3d0e1644bcd1aa1809": { + "a39f760d2cd879a78112e57d8611d7099802b03b7cc4933cafb4c47e133ad543": { "describe": { "columns": [ { - "name": "proof", + "name": "address", "ordinal": 0, "type_info": "Bytea" }, { - "name": "aggregation_result_coords", + "name": "topic1", "ordinal": 1, "type_info": "Bytea" - } - ], - "nullable": [ - true, - true - ], - "parameters": { - "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT prover_jobs.result as proof, scheduler_witness_jobs.aggregation_result_coords\n FROM prover_jobs\n INNER JOIN scheduler_witness_jobs\n ON prover_jobs.l1_batch_number = scheduler_witness_jobs.l1_batch_number\n WHERE prover_jobs.l1_batch_number >= $1 AND prover_jobs.l1_batch_number <= $2\n AND prover_jobs.aggregation_round = 3\n AND prover_jobs.status = 'successful'\n " - }, - "aa1534f03679fd2d1d9e7c1da1f94cc0e2ec5fc3a0e1ac7137147533eacf0aaf": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "nonce", - "ordinal": 1, - "type_info": "Int8" }, { - "name": "raw_tx", + "name": "topic2", "ordinal": 2, "type_info": "Bytea" }, { - "name": "contract_address", + "name": "topic3", "ordinal": 3, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "tx_type", + "name": "topic4", "ordinal": 4, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "gas_used", + "name": "value", "ordinal": 5, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "created_at", + "name": "block_hash", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "updated_at", + "name": "l1_batch_number?", + "ordinal": 7, + "type_info": "Int8" + }, + { + "name": "miniblock_number", + "ordinal": 8, + "type_info": "Int8" + }, + { + "name": "tx_hash", + "ordinal": 9, + "type_info": "Bytea" + }, + { + "name": "tx_index_in_block", + "ordinal": 10, + "type_info": "Int4" + }, + { + "name": "event_index_in_block", + "ordinal": 11, + "type_info": "Int4" + }, + { + "name": "event_index_in_tx", + "ordinal": 12, + "type_info": "Int4" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + null, + null, + false, + false, + false, + false, + false + ], + "parameters": { + "Left": [ + "Bytea" + ] + } + }, + "query": "\n SELECT\n address, topic1, topic2, topic3, topic4, value,\n Null::bytea as \"block_hash\", Null::bigint as \"l1_batch_number?\",\n miniblock_number, tx_hash, tx_index_in_block,\n event_index_in_block, event_index_in_tx\n FROM events\n WHERE tx_hash = $1\n ORDER BY miniblock_number ASC, event_index_in_block ASC\n " + }, + "a3d526a5a341618e9784fc81626143a3174709483a527879254ff8e28f210ac3": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int4", + "Int8", + "Int8" + ] + } + }, + "query": "UPDATE l1_batches SET eth_execute_tx_id = $1, updated_at = now() WHERE number BETWEEN $2 AND $3" + }, + "a42626c162a0600b9c7d22dd0d7997fa70cc95296ecc185ff9ae2e03593b07bf": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status='queued'\n WHERE l1_batch_number = $1\n AND status != 'successful'\n AND status != 'in_progress'\n " + }, + "a4a14eb42b9acca3f93c67e5760ba700c333b5e9a38c132a3060a94c988e7f13": { + "describe": { + "columns": [ + { + "name": "hash", + "ordinal": 0, + "type_info": "Bytea" + }, + { + "name": "received_at", + "ordinal": 1, + "type_info": "Timestamp" + } + ], + "nullable": [ + false, + false + ], + "parameters": { + "Left": [ + "Timestamp", + "Int8" + ] + } + }, + "query": "SELECT transactions.hash, transactions.received_at FROM transactions LEFT JOIN miniblocks ON miniblocks.number = miniblock_number WHERE received_at > $1 ORDER BY received_at ASC LIMIT $2" + }, + "a5115658f3a53462a9570fd6676f1931604d1c17a9a2b5f1475519006aaf03ba": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Text" + ] + } + }, + "query": "INSERT INTO proof_generation_details (l1_batch_number, status, proof_gen_data_blob_url, created_at, updated_at) VALUES ($1, 'ready_to_be_proven', $2, now(), now()) ON CONFLICT (l1_batch_number) DO NOTHING" + }, + "a7abde5a53248d6e63aa998acac521194231bbe08140c9c4efa548c4f3ae17fa": { + "describe": { + "columns": [ + { + "name": "max?", + "ordinal": 0, + "type_info": "Int4" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT MAX(operation_number) as \"max?\" FROM storage_logs WHERE miniblock_number = $1" + }, + "a9b1a31def214f8b1441dc3ab720bd270f3991c9f1c7528256276e176d532163": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Bytea" + ] + } + }, + "query": "SELECT l1_batch_number FROM initial_writes WHERE hashed_key = $1" + }, + "a9b7a880dbde4f7de5a6c2ff4009281527f2d01a547228981af3af2129ffb3f7": { + "describe": { + "columns": [ + { + "name": "count!", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [ + "Bytea", + "Numeric", + "Interval", + "Interval" + ] + } + }, + "query": "\n SELECT COUNT(*) as \"count!\" FROM tokens\n WHERE l2_address = $1 AND\n market_volume > $2 AND now() - market_volume_updated_at < $3 AND\n usd_price > 0 AND now() - usd_price_updated_at < $4\n " + }, + "a9d96d6774af2637173d471f02995652cd4c131c05fdcb3d0e1644bcd1aa1809": { + "describe": { + "columns": [ + { + "name": "proof", + "ordinal": 0, + "type_info": "Bytea" + }, + { + "name": "aggregation_result_coords", + "ordinal": 1, + "type_info": "Bytea" + } + ], + "nullable": [ + true, + true + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + } + }, + "query": "SELECT prover_jobs.result as proof, scheduler_witness_jobs.aggregation_result_coords\n FROM prover_jobs\n INNER JOIN scheduler_witness_jobs\n ON prover_jobs.l1_batch_number = scheduler_witness_jobs.l1_batch_number\n WHERE prover_jobs.l1_batch_number >= $1 AND prover_jobs.l1_batch_number <= $2\n AND prover_jobs.aggregation_round = 3\n AND prover_jobs.status = 'successful'\n " + }, + "aa1534f03679fd2d1d9e7c1da1f94cc0e2ec5fc3a0e1ac7137147533eacf0aaf": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int4" + }, + { + "name": "nonce", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "raw_tx", + "ordinal": 2, + "type_info": "Bytea" + }, + { + "name": "contract_address", + "ordinal": 3, + "type_info": "Text" + }, + { + "name": "tx_type", + "ordinal": 4, + "type_info": "Text" + }, + { + "name": "gas_used", + "ordinal": 5, + "type_info": "Int8" + }, + { + "name": "created_at", + "ordinal": 6, + "type_info": "Timestamp" + }, + { + "name": "updated_at", "ordinal": 7, "type_info": "Timestamp" }, @@ -7835,48 +8154,906 @@ ], "parameters": { "Left": [ - "Int4" - ] - } - }, - "query": "SELECT * FROM eth_txs_history WHERE eth_tx_id = $1 ORDER BY created_at DESC" - }, - "b14997f84d11d7eea89168383195c5579eed1c57bb2b416a749e2863ae6594a5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", + "Int4" + ] + } + }, + "query": "SELECT * FROM eth_txs_history WHERE eth_tx_id = $1 ORDER BY created_at DESC" + }, + "b14997f84d11d7eea89168383195c5579eed1c57bb2b416a749e2863ae6594a5": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Text", + "Int8" + ] + } + }, + "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status ='failed', error= $1, updated_at = now()\n WHERE id = $2\n " + }, + "b14d9a82e6b0a4174dde61642d3abc001cd8cb80d988eb81a685255e3ce920de": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8Array", + "ByteaArray" + ] + } + }, + "query": "UPDATE miniblocks SET hash = u.hash FROM UNNEST($1::bigint[], $2::bytea[]) AS u(number, hash) WHERE miniblocks.number = u.number\n " + }, + "b479b7d3334f8d4566c294a44e2adb282fbc66a87be5c248c65211c2a8a07db0": { + "describe": { + "columns": [ + { + "name": "number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "hash", + "ordinal": 1, + "type_info": "Bytea" + } + ], + "nullable": [ + false, + false + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + } + }, + "query": "SELECT number, hash FROM miniblocks WHERE number > $1 ORDER BY number ASC LIMIT $2" + }, + "b4c576db7c762103dc6700ded458e996d2e9ef670d7b58b181dbfab02fa426ce": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Bytea", + "Bytea", + "Numeric", + "Numeric", + "Numeric", + "Jsonb", + "Int8", + "Numeric", + "Numeric", + "Bytea", + "Int4", + "Numeric", + "Bytea", + "Bytea", + "Int4", + "Numeric", + "Bytea", + "Timestamp" + ] + } + }, + "query": "\n INSERT INTO transactions\n (\n hash,\n is_priority,\n initiator_address,\n\n gas_limit,\n max_fee_per_gas,\n gas_per_pubdata_limit,\n\n data,\n priority_op_id,\n full_fee,\n layer_2_tip_fee,\n contract_address,\n l1_block_number,\n value,\n\n paymaster,\n paymaster_input,\n tx_format,\n\n l1_tx_mint,\n l1_tx_refund_recipient,\n\n received_at,\n created_at,\n updated_at\n )\n VALUES\n (\n $1, TRUE, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,\n $13, $14, $15, $16, $17, $18, now(), now()\n )\n ON CONFLICT (hash) DO NOTHING\n " + }, + "b4da918ee3b36b56d95c8834edebe65eb48ebb8270fa1e6ccf73ad354fd71134": { + "describe": { + "columns": [ + { + "name": "l1_address", + "ordinal": 0, + "type_info": "Bytea" + }, + { + "name": "l2_address", + "ordinal": 1, + "type_info": "Bytea" + } + ], + "nullable": [ + false, + false + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT l1_address, l2_address FROM tokens WHERE well_known = true" + }, + "b4f7d9b915b1feb92d0ff1982e256fbde8377e9c305aa2c919aba1cd55641d83": { + "describe": { + "columns": [ + { + "name": "number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "timestamp", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "is_finished", + "ordinal": 2, + "type_info": "Bool" + }, + { + "name": "l1_tx_count", + "ordinal": 3, + "type_info": "Int4" + }, + { + "name": "l2_tx_count", + "ordinal": 4, + "type_info": "Int4" + }, + { + "name": "fee_account_address", + "ordinal": 5, + "type_info": "Bytea" + }, + { + "name": "bloom", + "ordinal": 6, + "type_info": "Bytea" + }, + { + "name": "priority_ops_onchain_data", + "ordinal": 7, + "type_info": "ByteaArray" + }, + { + "name": "hash", + "ordinal": 8, + "type_info": "Bytea" + }, + { + "name": "parent_hash", + "ordinal": 9, + "type_info": "Bytea" + }, + { + "name": "commitment", + "ordinal": 10, + "type_info": "Bytea" + }, + { + "name": "compressed_write_logs", + "ordinal": 11, + "type_info": "Bytea" + }, + { + "name": "compressed_contracts", + "ordinal": 12, + "type_info": "Bytea" + }, + { + "name": "eth_prove_tx_id", + "ordinal": 13, + "type_info": "Int4" + }, + { + "name": "eth_commit_tx_id", + "ordinal": 14, + "type_info": "Int4" + }, + { + "name": "eth_execute_tx_id", + "ordinal": 15, + "type_info": "Int4" + }, + { + "name": "merkle_root_hash", + "ordinal": 16, + "type_info": "Bytea" + }, + { + "name": "l2_to_l1_logs", + "ordinal": 17, + "type_info": "ByteaArray" + }, + { + "name": "l2_to_l1_messages", + "ordinal": 18, + "type_info": "ByteaArray" + }, + { + "name": "used_contract_hashes", + "ordinal": 19, + "type_info": "Jsonb" + }, + { + "name": "compressed_initial_writes", + "ordinal": 20, + "type_info": "Bytea" + }, + { + "name": "compressed_repeated_writes", + "ordinal": 21, + "type_info": "Bytea" + }, + { + "name": "l2_l1_compressed_messages", + "ordinal": 22, + "type_info": "Bytea" + }, + { + "name": "l2_l1_merkle_root", + "ordinal": 23, + "type_info": "Bytea" + }, + { + "name": "l1_gas_price", + "ordinal": 24, + "type_info": "Int8" + }, + { + "name": "l2_fair_gas_price", + "ordinal": 25, + "type_info": "Int8" + }, + { + "name": "rollup_last_leaf_index", + "ordinal": 26, + "type_info": "Int8" + }, + { + "name": "zkporter_is_available", + "ordinal": 27, + "type_info": "Bool" + }, + { + "name": "bootloader_code_hash", + "ordinal": 28, + "type_info": "Bytea" + }, + { + "name": "default_aa_code_hash", + "ordinal": 29, + "type_info": "Bytea" + }, + { + "name": "base_fee_per_gas", + "ordinal": 30, + "type_info": "Numeric" + }, + { + "name": "aux_data_hash", + "ordinal": 31, + "type_info": "Bytea" + }, + { + "name": "pass_through_data_hash", + "ordinal": 32, + "type_info": "Bytea" + }, + { + "name": "meta_parameters_hash", + "ordinal": 33, + "type_info": "Bytea" + }, + { + "name": "protocol_version", + "ordinal": 34, + "type_info": "Int4" + }, + { + "name": "events_queue_commitment", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 36, + "type_info": "Bytea" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + false, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + false, + true, + true, + true, + true, + true, + true + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + } + }, + "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM (SELECT l1_batches.*, row_number() OVER (ORDER BY number ASC) AS row_number FROM l1_batches WHERE eth_commit_tx_id IS NOT NULL AND l1_batches.skip_proof = TRUE AND l1_batches.number > $1 ORDER BY number LIMIT $2) inn LEFT JOIN commitments ON commitments.l1_batch_number = inn.number WHERE number - row_number = $1" + }, + "b6c8e0827b2389a14433c031332962495311562ae9652ae7e9409a4bf48dc55b": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int4" + }, + { + "name": "nonce", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "raw_tx", + "ordinal": 2, + "type_info": "Bytea" + }, + { + "name": "contract_address", + "ordinal": 3, + "type_info": "Text" + }, + { + "name": "tx_type", + "ordinal": 4, + "type_info": "Text" + }, + { + "name": "gas_used", + "ordinal": 5, + "type_info": "Int8" + }, + { + "name": "created_at", + "ordinal": 6, + "type_info": "Timestamp" + }, + { + "name": "updated_at", + "ordinal": 7, + "type_info": "Timestamp" + }, + { + "name": "has_failed", + "ordinal": 8, + "type_info": "Bool" + }, + { + "name": "sent_at_block", + "ordinal": 9, + "type_info": "Int4" + }, + { + "name": "confirmed_eth_tx_history_id", + "ordinal": 10, + "type_info": "Int4" + }, + { + "name": "predicted_gas_cost", + "ordinal": 11, + "type_info": "Int8" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + true, + false, + false, + false, + true, + true, + false + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT * FROM eth_txs WHERE confirmed_eth_tx_history_id IS NULL \n AND id <= (SELECT COALESCE(MAX(eth_tx_id), 0) FROM eth_txs_history WHERE sent_at_block IS NOT NULL)\n ORDER BY id" + }, + "b6f9874059c57e5e59f3021936437e9ff71a68065dfc19c295d806d7a9aafc93": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int4", + "Int8", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea" + ] + } + }, + "query": "INSERT INTO prover_protocol_versions\n (id, timestamp, recursion_scheduler_level_vk_hash, recursion_node_level_vk_hash,\n recursion_leaf_level_vk_hash, recursion_circuits_set_vks_hash, verifier_address, created_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, now())\n " + }, + "b79f02c8663c6b99d0aa46b430de32103afa0333e8293cf8661cfc1c3f9fc12e": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "contract_address", + "ordinal": 1, + "type_info": "Bytea" + }, + { + "name": "source_code", + "ordinal": 2, + "type_info": "Text" + }, + { + "name": "contract_name", + "ordinal": 3, + "type_info": "Text" + }, + { + "name": "zk_compiler_version", + "ordinal": 4, + "type_info": "Text" + }, + { + "name": "compiler_version", + "ordinal": 5, + "type_info": "Text" + }, + { + "name": "optimization_used", + "ordinal": 6, + "type_info": "Bool" + }, + { + "name": "optimizer_mode", + "ordinal": 7, + "type_info": "Text" + }, + { + "name": "constructor_arguments", + "ordinal": 8, + "type_info": "Bytea" + }, + { + "name": "is_system", + "ordinal": 9, + "type_info": "Bool" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + false, + false + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT id, contract_address, source_code, contract_name, zk_compiler_version, compiler_version, optimization_used,\n optimizer_mode, constructor_arguments, is_system\n FROM contract_verification_requests\n WHERE status = 'successful'\n ORDER BY id" + }, + "b7ab3aeee71e87c7469428ec411b410d81282ff6fed63fe5cda0e81a330d2ac5": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "status", + "ordinal": 1, + "type_info": "Text" + }, + { + "name": "attempts", + "ordinal": 2, + "type_info": "Int2" + } + ], + "nullable": [ + false, + false, + false + ], + "parameters": { + "Left": [ + "Interval", + "Int2" + ] + } + }, + "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING id, status, attempts\n " + }, + "b7d3b30bff2ed9aabcdaed89ebfd1f0303b70c6d5483ff9183475bb232a04f21": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "status", + "ordinal": 1, + "type_info": "Text" + }, + { + "name": "attempts", + "ordinal": 2, + "type_info": "Int2" + } + ], + "nullable": [ + false, + false, + false + ], + "parameters": { + "Left": [ + "Interval", + "Int2" + ] + } + }, + "query": "\n UPDATE witness_inputs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'in_gpu_proof' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING l1_batch_number, status, attempts\n " + }, + "b944df7af612ec911170a43be846eb2f6e27163b0d3983672de2b8d5d60af640": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Interval" + ] + } + }, + "query": "UPDATE proof_generation_details SET status = 'picked_by_prover', updated_at = now(), prover_taken_at = now() WHERE l1_batch_number = ( SELECT l1_batch_number FROM proof_generation_details WHERE status = 'ready_to_be_proven' OR (status = 'picked_by_prover' AND prover_taken_at < now() - $1::interval) ORDER BY l1_batch_number ASC LIMIT 1 FOR UPDATE SKIP LOCKED ) RETURNING proof_generation_details.l1_batch_number" + }, + "bc4433cdfa499830fe6a6a95759c9fbe343ac25b371c7fa980bfd1b0afc86629": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Text", + "Text", + "Text" + ] + } + }, + "query": "UPDATE proof_compression_jobs_fri SET status = $1, attempts = attempts + 1, updated_at = now(), processing_started_at = now(), picked_by = $3 WHERE l1_batch_number = ( SELECT l1_batch_number FROM proof_compression_jobs_fri WHERE status = $2 ORDER BY l1_batch_number ASC LIMIT 1 FOR UPDATE SKIP LOCKED ) RETURNING proof_compression_jobs_fri.l1_batch_number" + }, + "bdf6109aa2625b809f9ffac5351d3693e2fbd081a0e7f25e55f74571770122d1": { + "describe": { + "columns": [ + { + "name": "number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "timestamp", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "is_finished", + "ordinal": 2, + "type_info": "Bool" + }, + { + "name": "l1_tx_count", + "ordinal": 3, + "type_info": "Int4" + }, + { + "name": "l2_tx_count", + "ordinal": 4, + "type_info": "Int4" + }, + { + "name": "fee_account_address", + "ordinal": 5, + "type_info": "Bytea" + }, + { + "name": "bloom", + "ordinal": 6, + "type_info": "Bytea" + }, + { + "name": "priority_ops_onchain_data", + "ordinal": 7, + "type_info": "ByteaArray" + }, + { + "name": "hash", + "ordinal": 8, + "type_info": "Bytea" + }, + { + "name": "parent_hash", + "ordinal": 9, + "type_info": "Bytea" + }, + { + "name": "commitment", + "ordinal": 10, + "type_info": "Bytea" + }, + { + "name": "compressed_write_logs", + "ordinal": 11, + "type_info": "Bytea" + }, + { + "name": "compressed_contracts", + "ordinal": 12, + "type_info": "Bytea" + }, + { + "name": "eth_prove_tx_id", + "ordinal": 13, + "type_info": "Int4" + }, + { + "name": "eth_commit_tx_id", + "ordinal": 14, + "type_info": "Int4" + }, + { + "name": "eth_execute_tx_id", + "ordinal": 15, + "type_info": "Int4" + }, + { + "name": "merkle_root_hash", + "ordinal": 16, + "type_info": "Bytea" + }, + { + "name": "l2_to_l1_logs", + "ordinal": 17, + "type_info": "ByteaArray" + }, + { + "name": "l2_to_l1_messages", + "ordinal": 18, + "type_info": "ByteaArray" + }, + { + "name": "used_contract_hashes", + "ordinal": 19, + "type_info": "Jsonb" + }, + { + "name": "compressed_initial_writes", + "ordinal": 20, + "type_info": "Bytea" + }, + { + "name": "compressed_repeated_writes", + "ordinal": 21, + "type_info": "Bytea" + }, + { + "name": "l2_l1_compressed_messages", + "ordinal": 22, + "type_info": "Bytea" + }, + { + "name": "l2_l1_merkle_root", + "ordinal": 23, + "type_info": "Bytea" + }, + { + "name": "l1_gas_price", + "ordinal": 24, + "type_info": "Int8" + }, + { + "name": "l2_fair_gas_price", + "ordinal": 25, + "type_info": "Int8" + }, + { + "name": "rollup_last_leaf_index", + "ordinal": 26, + "type_info": "Int8" + }, + { + "name": "zkporter_is_available", + "ordinal": 27, + "type_info": "Bool" + }, + { + "name": "bootloader_code_hash", + "ordinal": 28, + "type_info": "Bytea" + }, + { + "name": "default_aa_code_hash", + "ordinal": 29, + "type_info": "Bytea" + }, + { + "name": "base_fee_per_gas", + "ordinal": 30, + "type_info": "Numeric" + }, + { + "name": "aux_data_hash", + "ordinal": 31, + "type_info": "Bytea" + }, + { + "name": "pass_through_data_hash", + "ordinal": 32, + "type_info": "Bytea" + }, + { + "name": "meta_parameters_hash", + "ordinal": 33, + "type_info": "Bytea" + }, + { + "name": "protocol_version", + "ordinal": 34, + "type_info": "Int4" + }, + { + "name": "events_queue_commitment", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 36, + "type_info": "Bytea" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + false, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + false, + true, + true, + true, + true, + true, + true + ], + "parameters": { + "Left": [ "Int8" ] } }, - "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status ='failed', error= $1, updated_at = now()\n WHERE id = $2\n " + "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE eth_commit_tx_id IS NOT NULL AND eth_prove_tx_id IS NULL ORDER BY number LIMIT $1" }, - "b14d9a82e6b0a4174dde61642d3abc001cd8cb80d988eb81a685255e3ce920de": { + "be824de76050461afe29dfd229e524bdf113eab3ca24208782c200531db1c940": { "describe": { - "columns": [], - "nullable": [], + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], "parameters": { "Left": [ - "Int8Array", - "ByteaArray" + "Int8", + "Int2", + "Int2", + "Int4" ] } }, - "query": "UPDATE miniblocks SET hash = u.hash FROM UNNEST($1::bigint[], $2::bytea[]) AS u(number, hash) WHERE miniblocks.number = u.number\n " + "query": "\n SELECT id from prover_jobs_fri\n WHERE l1_batch_number = $1\n AND circuit_id = $2\n AND aggregation_round = $3\n AND depth = $4\n AND status = 'successful'\n ORDER BY sequence_number ASC;\n " }, - "b479b7d3334f8d4566c294a44e2adb282fbc66a87be5c248c65211c2a8a07db0": { + "bef58e581dd0b658350dcdc15ebf7cf350cf088b60c916a15889e31ee7534907": { "describe": { "columns": [ { - "name": "number", + "name": "bytecode", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "hash", + "name": "bytecode_hash", "ordinal": 1, "type_info": "Bytea" } @@ -7887,98 +9064,64 @@ ], "parameters": { "Left": [ - "Int8", - "Int8" - ] - } - }, - "query": "SELECT number, hash FROM miniblocks WHERE number > $1 ORDER BY number ASC LIMIT $2" - }, - "b4c576db7c762103dc6700ded458e996d2e9ef670d7b58b181dbfab02fa426ce": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Bytea", - "Numeric", - "Numeric", - "Numeric", - "Jsonb", - "Int8", - "Numeric", - "Numeric", - "Bytea", - "Int4", - "Numeric", - "Bytea", - "Bytea", - "Int4", - "Numeric", - "Bytea", - "Timestamp" + "ByteaArray" ] } }, - "query": "\n INSERT INTO transactions\n (\n hash,\n is_priority,\n initiator_address,\n\n gas_limit,\n max_fee_per_gas,\n gas_per_pubdata_limit,\n\n data,\n priority_op_id,\n full_fee,\n layer_2_tip_fee,\n contract_address,\n l1_block_number,\n value,\n\n paymaster,\n paymaster_input,\n tx_format,\n\n l1_tx_mint,\n l1_tx_refund_recipient,\n\n received_at,\n created_at,\n updated_at\n )\n VALUES\n (\n $1, TRUE, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12,\n $13, $14, $15, $16, $17, $18, now(), now()\n )\n ON CONFLICT (hash) DO NOTHING\n " + "query": "SELECT bytecode, bytecode_hash FROM factory_deps WHERE bytecode_hash = ANY($1)" }, - "b4da918ee3b36b56d95c8834edebe65eb48ebb8270fa1e6ccf73ad354fd71134": { + "c178e1574d2a16cb90bcc5d5333a4f8dd2a69e0c12b4e7e108a8dcc6000669a5": { "describe": { "columns": [ { - "name": "l1_address", + "name": "protocol_version", "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "l2_address", - "ordinal": 1, - "type_info": "Bytea" + "type_info": "Int4" } ], "nullable": [ - false, - false + true ], "parameters": { - "Left": [] + "Left": [ + "Int8" + ] } }, - "query": "SELECT l1_address, l2_address FROM tokens WHERE well_known = true" + "query": "SELECT protocol_version FROM miniblocks WHERE number = $1" }, - "b6c8e0827b2389a14433c031332962495311562ae9652ae7e9409a4bf48dc55b": { + "c1e5f85be88ef0b6ab81daf8dec2011797086a7ec5aeaffe5665ebf9584bf84a": { "describe": { "columns": [ { - "name": "id", + "name": "l1_batch_number", "ordinal": 0, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "nonce", + "name": "scheduler_partial_input_blob_url", "ordinal": 1, - "type_info": "Int8" + "type_info": "Text" }, { - "name": "raw_tx", + "name": "status", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "contract_address", + "name": "processing_started_at", "ordinal": 3, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "tx_type", + "name": "time_taken", "ordinal": 4, - "type_info": "Text" + "type_info": "Time" }, { - "name": "gas_used", + "name": "error", "ordinal": 5, - "type_info": "Int8" + "type_info": "Text" }, { "name": "created_at", @@ -7991,141 +9134,61 @@ "type_info": "Timestamp" }, { - "name": "has_failed", + "name": "attempts", "ordinal": 8, - "type_info": "Bool" + "type_info": "Int2" }, { - "name": "sent_at_block", + "name": "protocol_version", "ordinal": 9, "type_info": "Int4" }, { - "name": "confirmed_eth_tx_history_id", + "name": "picked_by", "ordinal": 10, - "type_info": "Int4" - }, - { - "name": "predicted_gas_cost", - "ordinal": 11, - "type_info": "Int8" + "type_info": "Text" } ], "nullable": [ - false, - false, false, false, false, true, + true, + true, false, false, false, true, - true, - false + true ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT * FROM eth_txs WHERE confirmed_eth_tx_history_id IS NULL \n AND id <= (SELECT COALESCE(MAX(eth_tx_id), 0) FROM eth_txs_history WHERE sent_at_block IS NOT NULL)\n ORDER BY id" - }, - "b6f9874059c57e5e59f3021936437e9ff71a68065dfc19c295d806d7a9aafc93": { - "describe": { - "columns": [], - "nullable": [], "parameters": { "Left": [ - "Int4", - "Int8", - "Bytea", - "Bytea", - "Bytea", - "Bytea", - "Bytea" + "Int4Array", + "Text" ] } }, - "query": "INSERT INTO prover_protocol_versions\n (id, timestamp, recursion_scheduler_level_vk_hash, recursion_node_level_vk_hash,\n recursion_leaf_level_vk_hash, recursion_circuits_set_vks_hash, verifier_address, created_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, now())\n " + "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $2\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM scheduler_witness_jobs_fri\n WHERE status = 'queued'\n AND protocol_version = ANY($1)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING scheduler_witness_jobs_fri.*\n " }, - "b79f02c8663c6b99d0aa46b430de32103afa0333e8293cf8661cfc1c3f9fc12e": { + "c2cf96a9eb6893c5ba7d9e5418d9f24084ccd87980cb6ee05de1b3bde5c654bd": { "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "contract_address", - "ordinal": 1, - "type_info": "Bytea" - }, - { - "name": "source_code", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "contract_name", - "ordinal": 3, - "type_info": "Text" - }, - { - "name": "zk_compiler_version", - "ordinal": 4, - "type_info": "Text" - }, - { - "name": "compiler_version", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "optimization_used", - "ordinal": 6, - "type_info": "Bool" - }, - { - "name": "optimizer_mode", - "ordinal": 7, - "type_info": "Text" - }, - { - "name": "constructor_arguments", - "ordinal": 8, - "type_info": "Bytea" - }, - { - "name": "is_system", - "ordinal": 9, - "type_info": "Bool" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - false, - false - ], + "columns": [], + "nullable": [], "parameters": { - "Left": [] + "Left": [ + "ByteaArray", + "ByteaArray" + ] } }, - "query": "SELECT id, contract_address, source_code, contract_name, zk_compiler_version, compiler_version, optimization_used,\n optimizer_mode, constructor_arguments, is_system\n FROM contract_verification_requests\n WHERE status = 'successful'\n ORDER BY id" + "query": "\n INSERT INTO call_traces (tx_hash, call_trace)\n SELECT u.tx_hash, u.call_trace\n FROM UNNEST($1::bytea[], $2::bytea[])\n AS u(tx_hash, call_trace)\n " }, - "b7ab3aeee71e87c7469428ec411b410d81282ff6fed63fe5cda0e81a330d2ac5": { + "c49a6925e9462cc85a6e1cc850f2e147e0a5d990efed56f27792698e6cf9ff0c": { "describe": { "columns": [ { - "name": "id", + "name": "l1_batch_number", "ordinal": 0, "type_info": "Int8" }, @@ -8152,9 +9215,9 @@ ] } }, - "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING id, status, attempts\n " + "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING l1_batch_number, status, attempts\n " }, - "b7c3d8606c77f78897763bc8c77b7bc85ce1daf8d079402eb20dfc0a3f164834": { + "c4f0135b4b5dd111832c909c0bf134e0cfdf6c93a8b8ad1f5a206652546aac5b": { "describe": { "columns": [ { @@ -8331,6 +9394,16 @@ "name": "protocol_version", "ordinal": 34, "type_info": "Int4" + }, + { + "name": "events_queue_commitment", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 36, + "type_info": "Bytea" } ], "nullable": [ @@ -8347,307 +9420,38 @@ true, true, true, - true, - true, - true, - true, - false, - false, - false, - true, - true, - true, - true, - false, - false, - true, - true, - true, - true, - false, - true, - true, - true, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM l1_batches WHERE number = $1" - }, - "b7d3b30bff2ed9aabcdaed89ebfd1f0303b70c6d5483ff9183475bb232a04f21": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "status", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "attempts", - "ordinal": 2, - "type_info": "Int2" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Interval", - "Int2" - ] - } - }, - "query": "\n UPDATE witness_inputs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'in_gpu_proof' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING l1_batch_number, status, attempts\n " - }, - "b944df7af612ec911170a43be846eb2f6e27163b0d3983672de2b8d5d60af640": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Interval" - ] - } - }, - "query": "UPDATE proof_generation_details SET status = 'picked_by_prover', updated_at = now(), prover_taken_at = now() WHERE l1_batch_number = ( SELECT l1_batch_number FROM proof_generation_details WHERE status = 'ready_to_be_proven' OR (status = 'picked_by_prover' AND prover_taken_at < now() - $1::interval) ORDER BY l1_batch_number ASC LIMIT 1 FOR UPDATE SKIP LOCKED ) RETURNING proof_generation_details.l1_batch_number" - }, - "bc4433cdfa499830fe6a6a95759c9fbe343ac25b371c7fa980bfd1b0afc86629": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Text", - "Text", - "Text" - ] - } - }, - "query": "UPDATE proof_compression_jobs_fri SET status = $1, attempts = attempts + 1, updated_at = now(), processing_started_at = now(), picked_by = $3 WHERE l1_batch_number = ( SELECT l1_batch_number FROM proof_compression_jobs_fri WHERE status = $2 ORDER BY l1_batch_number ASC LIMIT 1 FOR UPDATE SKIP LOCKED ) RETURNING proof_compression_jobs_fri.l1_batch_number" - }, - "be824de76050461afe29dfd229e524bdf113eab3ca24208782c200531db1c940": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8", - "Int2", - "Int2", - "Int4" - ] - } - }, - "query": "\n SELECT id from prover_jobs_fri\n WHERE l1_batch_number = $1\n AND circuit_id = $2\n AND aggregation_round = $3\n AND depth = $4\n AND status = 'successful'\n ORDER BY sequence_number ASC;\n " - }, - "bef58e581dd0b658350dcdc15ebf7cf350cf088b60c916a15889e31ee7534907": { - "describe": { - "columns": [ - { - "name": "bytecode", - "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "bytecode_hash", - "ordinal": 1, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "ByteaArray" - ] - } - }, - "query": "SELECT bytecode, bytecode_hash FROM factory_deps WHERE bytecode_hash = ANY($1)" - }, - "c178e1574d2a16cb90bcc5d5333a4f8dd2a69e0c12b4e7e108a8dcc6000669a5": { - "describe": { - "columns": [ - { - "name": "protocol_version", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT protocol_version FROM miniblocks WHERE number = $1" - }, - "c1e5f85be88ef0b6ab81daf8dec2011797086a7ec5aeaffe5665ebf9584bf84a": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "scheduler_partial_input_blob_url", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "status", - "ordinal": 2, - "type_info": "Text" - }, - { - "name": "processing_started_at", - "ordinal": 3, - "type_info": "Timestamp" - }, - { - "name": "time_taken", - "ordinal": 4, - "type_info": "Time" - }, - { - "name": "error", - "ordinal": 5, - "type_info": "Text" - }, - { - "name": "created_at", - "ordinal": 6, - "type_info": "Timestamp" - }, - { - "name": "updated_at", - "ordinal": 7, - "type_info": "Timestamp" - }, - { - "name": "attempts", - "ordinal": 8, - "type_info": "Int2" - }, - { - "name": "protocol_version", - "ordinal": 9, - "type_info": "Int4" - }, - { - "name": "picked_by", - "ordinal": 10, - "type_info": "Text" - } - ], - "nullable": [ + true, + true, + true, + true, false, false, false, true, true, true, + true, false, false, + true, + true, + true, + true, false, true, + true, + true, + true, + true, true ], "parameters": { "Left": [ - "Int4Array", - "Text" - ] - } - }, - "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $2\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM scheduler_witness_jobs_fri\n WHERE status = 'queued'\n AND protocol_version = ANY($1)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING scheduler_witness_jobs_fri.*\n " - }, - "c2cf96a9eb6893c5ba7d9e5418d9f24084ccd87980cb6ee05de1b3bde5c654bd": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "ByteaArray", - "ByteaArray" - ] - } - }, - "query": "\n INSERT INTO call_traces (tx_hash, call_trace)\n SELECT u.tx_hash, u.call_trace\n FROM UNNEST($1::bytea[], $2::bytea[])\n AS u(tx_hash, call_trace)\n " - }, - "c49a6925e9462cc85a6e1cc850f2e147e0a5d990efed56f27792698e6cf9ff0c": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "status", - "ordinal": 1, - "type_info": "Text" - }, - { - "name": "attempts", - "ordinal": 2, - "type_info": "Int2" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "Interval", - "Int2" + "Int8" ] } }, - "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status = 'queued', attempts = attempts + 1, updated_at = now(), processing_started_at = now()\n WHERE (status = 'in_progress' AND processing_started_at <= now() - $1::interval AND attempts < $2)\n OR (status = 'failed' AND attempts < $2)\n RETURNING l1_batch_number, status, attempts\n " + "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE eth_prove_tx_id IS NOT NULL AND eth_execute_tx_id IS NULL ORDER BY number LIMIT $1" }, "c604ee1dd86ac154d67ddb339da5f65ca849887d6a1068623e874f9df00cfdd1": { "describe": { @@ -9103,258 +9907,33 @@ "describe": { "columns": [ { - "name": "hashed_key", - "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "l1_batch_number", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "index", - "ordinal": 2, - "type_info": "Int8" - } - ], - "nullable": [ - false, - false, - false - ], - "parameters": { - "Left": [ - "ByteaArray" - ] - } - }, - "query": "SELECT hashed_key, l1_batch_number, index FROM initial_writes WHERE hashed_key = ANY($1::bytea[])" - }, - "d5dea31f2a325bb44e8ef2cbbabbeb73fd6996a3e6cb99d62c6b97a4aa49c1ca": { - "describe": { - "columns": [ - { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "timestamp", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "is_finished", - "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "l1_tx_count", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "l2_tx_count", - "ordinal": 4, - "type_info": "Int4" - }, - { - "name": "fee_account_address", - "ordinal": 5, - "type_info": "Bytea" - }, - { - "name": "bloom", - "ordinal": 6, - "type_info": "Bytea" - }, - { - "name": "priority_ops_onchain_data", - "ordinal": 7, - "type_info": "ByteaArray" - }, - { - "name": "hash", - "ordinal": 8, - "type_info": "Bytea" - }, - { - "name": "parent_hash", - "ordinal": 9, - "type_info": "Bytea" - }, - { - "name": "commitment", - "ordinal": 10, - "type_info": "Bytea" - }, - { - "name": "compressed_write_logs", - "ordinal": 11, - "type_info": "Bytea" - }, - { - "name": "compressed_contracts", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "eth_prove_tx_id", - "ordinal": 13, - "type_info": "Int4" - }, - { - "name": "eth_commit_tx_id", - "ordinal": 14, - "type_info": "Int4" - }, - { - "name": "eth_execute_tx_id", - "ordinal": 15, - "type_info": "Int4" - }, - { - "name": "merkle_root_hash", - "ordinal": 16, - "type_info": "Bytea" - }, - { - "name": "l2_to_l1_logs", - "ordinal": 17, - "type_info": "ByteaArray" - }, - { - "name": "l2_to_l1_messages", - "ordinal": 18, - "type_info": "ByteaArray" - }, - { - "name": "used_contract_hashes", - "ordinal": 19, - "type_info": "Jsonb" - }, - { - "name": "compressed_initial_writes", - "ordinal": 20, - "type_info": "Bytea" - }, - { - "name": "compressed_repeated_writes", - "ordinal": 21, - "type_info": "Bytea" - }, - { - "name": "l2_l1_compressed_messages", - "ordinal": 22, - "type_info": "Bytea" - }, - { - "name": "l2_l1_merkle_root", - "ordinal": 23, - "type_info": "Bytea" - }, - { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" - }, - { - "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" - }, - { - "name": "rollup_last_leaf_index", - "ordinal": 26, - "type_info": "Int8" - }, - { - "name": "zkporter_is_available", - "ordinal": 27, - "type_info": "Bool" - }, - { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" - }, - { - "name": "default_aa_code_hash", - "ordinal": 29, - "type_info": "Bytea" - }, - { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, - { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" - }, - { - "name": "pass_through_data_hash", - "ordinal": 32, + "name": "hashed_key", + "ordinal": 0, "type_info": "Bytea" }, { - "name": "meta_parameters_hash", - "ordinal": 33, - "type_info": "Bytea" + "name": "l1_batch_number", + "ordinal": 1, + "type_info": "Int8" }, { - "name": "protocol_version", - "ordinal": 34, - "type_info": "Int4" + "name": "index", + "ordinal": 2, + "type_info": "Int8" } ], "nullable": [ false, false, - false, - false, - false, - false, - false, - false, - true, - true, - true, - true, - true, - true, - true, - true, - true, - false, - false, - false, - true, - true, - true, - true, - false, - false, - true, - true, - true, - true, - false, - true, - true, - true, - true + false ], "parameters": { "Left": [ - "Int8", - "Int8" + "ByteaArray" ] } }, - "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM (SELECT l1_batches.*, row_number() OVER (ORDER BY number ASC) AS row_number FROM l1_batches WHERE eth_commit_tx_id IS NOT NULL AND l1_batches.skip_proof = TRUE AND l1_batches.number > $1 ORDER BY number LIMIT $2) inn WHERE number - row_number = $1" + "query": "SELECT hashed_key, l1_batch_number, index FROM initial_writes WHERE hashed_key = ANY($1::bytea[])" }, "d6709f3ce8f08f988e10a0e0fb5c06db9488834a85066babaf3d56cf212b4ea0": { "describe": { @@ -9893,225 +10472,21 @@ { "name": "l2_fair_gas_price", "ordinal": 13, - "type_info": "Int8" - }, - { - "name": "bootloader_code_hash", - "ordinal": 14, - "type_info": "Bytea" - }, - { - "name": "default_aa_code_hash", - "ordinal": 15, - "type_info": "Bytea" - }, - { - "name": "protocol_version", - "ordinal": 16, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - true, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT number, l1_tx_count, l2_tx_count, timestamp, is_finished, fee_account_address, l2_to_l1_logs, l2_to_l1_messages, bloom, priority_ops_onchain_data, used_contract_hashes, base_fee_per_gas, l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version FROM l1_batches ORDER BY number DESC LIMIT 1" - }, - "e72e3eb79c4d306775cdae718db78f8f1f7c4a97b0abfcceac15efe1c3543fff": { - "describe": { - "columns": [ - { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "timestamp", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "is_finished", - "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "l1_tx_count", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "l2_tx_count", - "ordinal": 4, - "type_info": "Int4" - }, - { - "name": "fee_account_address", - "ordinal": 5, - "type_info": "Bytea" - }, - { - "name": "bloom", - "ordinal": 6, - "type_info": "Bytea" - }, - { - "name": "priority_ops_onchain_data", - "ordinal": 7, - "type_info": "ByteaArray" - }, - { - "name": "hash", - "ordinal": 8, - "type_info": "Bytea" - }, - { - "name": "parent_hash", - "ordinal": 9, - "type_info": "Bytea" - }, - { - "name": "commitment", - "ordinal": 10, - "type_info": "Bytea" - }, - { - "name": "compressed_write_logs", - "ordinal": 11, - "type_info": "Bytea" - }, - { - "name": "compressed_contracts", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "eth_prove_tx_id", - "ordinal": 13, - "type_info": "Int4" - }, - { - "name": "eth_commit_tx_id", - "ordinal": 14, - "type_info": "Int4" - }, - { - "name": "eth_execute_tx_id", - "ordinal": 15, - "type_info": "Int4" - }, - { - "name": "merkle_root_hash", - "ordinal": 16, - "type_info": "Bytea" - }, - { - "name": "l2_to_l1_logs", - "ordinal": 17, - "type_info": "ByteaArray" - }, - { - "name": "l2_to_l1_messages", - "ordinal": 18, - "type_info": "ByteaArray" - }, - { - "name": "used_contract_hashes", - "ordinal": 19, - "type_info": "Jsonb" - }, - { - "name": "compressed_initial_writes", - "ordinal": 20, - "type_info": "Bytea" - }, - { - "name": "compressed_repeated_writes", - "ordinal": 21, - "type_info": "Bytea" - }, - { - "name": "l2_l1_compressed_messages", - "ordinal": 22, - "type_info": "Bytea" - }, - { - "name": "l2_l1_merkle_root", - "ordinal": 23, - "type_info": "Bytea" - }, - { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" - }, - { - "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" - }, - { - "name": "rollup_last_leaf_index", - "ordinal": 26, - "type_info": "Int8" - }, - { - "name": "zkporter_is_available", - "ordinal": 27, - "type_info": "Bool" - }, - { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" - }, - { - "name": "default_aa_code_hash", - "ordinal": 29, - "type_info": "Bytea" - }, - { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, - { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "pass_through_data_hash", - "ordinal": 32, + "name": "bootloader_code_hash", + "ordinal": 14, "type_info": "Bytea" }, { - "name": "meta_parameters_hash", - "ordinal": 33, + "name": "default_aa_code_hash", + "ordinal": 15, "type_info": "Bytea" }, { "name": "protocol_version", - "ordinal": 34, + "ordinal": 16, "type_info": "Int4" } ], @@ -10124,43 +10499,21 @@ false, false, false, - true, - true, - true, - true, - true, - true, - true, - true, - true, false, false, false, - true, - true, - true, - true, false, false, - true, - true, - true, - true, false, true, true, - true, true ], "parameters": { - "Left": [ - "Int8", - "Int8", - "Int8" - ] + "Left": [] } }, - "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM l1_batches WHERE number BETWEEN $1 AND $2 ORDER BY number LIMIT $3" + "query": "SELECT number, l1_tx_count, l2_tx_count, timestamp, is_finished, fee_account_address, l2_to_l1_logs, l2_to_l1_messages, bloom, priority_ops_onchain_data, used_contract_hashes, base_fee_per_gas, l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version FROM l1_batches ORDER BY number DESC LIMIT 1" }, "e900682a160af90d532da47a1222fc1d7c9962ee8996dbd9b9bb63f13820cf2b": { "describe": { @@ -10486,228 +10839,6 @@ }, "query": "\n UPDATE leaf_aggregation_witness_jobs\n SET is_blob_cleaned=TRUE\n WHERE l1_batch_number = ANY($1);\n " }, - "ee20215e53d1467e96d3db3a95dbb9a8cbb1c9407d0c914b4168637604d91c29": { - "describe": { - "columns": [ - { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "timestamp", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "is_finished", - "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "l1_tx_count", - "ordinal": 3, - "type_info": "Int4" - }, - { - "name": "l2_tx_count", - "ordinal": 4, - "type_info": "Int4" - }, - { - "name": "fee_account_address", - "ordinal": 5, - "type_info": "Bytea" - }, - { - "name": "bloom", - "ordinal": 6, - "type_info": "Bytea" - }, - { - "name": "priority_ops_onchain_data", - "ordinal": 7, - "type_info": "ByteaArray" - }, - { - "name": "hash", - "ordinal": 8, - "type_info": "Bytea" - }, - { - "name": "parent_hash", - "ordinal": 9, - "type_info": "Bytea" - }, - { - "name": "commitment", - "ordinal": 10, - "type_info": "Bytea" - }, - { - "name": "compressed_write_logs", - "ordinal": 11, - "type_info": "Bytea" - }, - { - "name": "compressed_contracts", - "ordinal": 12, - "type_info": "Bytea" - }, - { - "name": "eth_prove_tx_id", - "ordinal": 13, - "type_info": "Int4" - }, - { - "name": "eth_commit_tx_id", - "ordinal": 14, - "type_info": "Int4" - }, - { - "name": "eth_execute_tx_id", - "ordinal": 15, - "type_info": "Int4" - }, - { - "name": "merkle_root_hash", - "ordinal": 16, - "type_info": "Bytea" - }, - { - "name": "l2_to_l1_logs", - "ordinal": 17, - "type_info": "ByteaArray" - }, - { - "name": "l2_to_l1_messages", - "ordinal": 18, - "type_info": "ByteaArray" - }, - { - "name": "used_contract_hashes", - "ordinal": 19, - "type_info": "Jsonb" - }, - { - "name": "compressed_initial_writes", - "ordinal": 20, - "type_info": "Bytea" - }, - { - "name": "compressed_repeated_writes", - "ordinal": 21, - "type_info": "Bytea" - }, - { - "name": "l2_l1_compressed_messages", - "ordinal": 22, - "type_info": "Bytea" - }, - { - "name": "l2_l1_merkle_root", - "ordinal": 23, - "type_info": "Bytea" - }, - { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" - }, - { - "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" - }, - { - "name": "rollup_last_leaf_index", - "ordinal": 26, - "type_info": "Int8" - }, - { - "name": "zkporter_is_available", - "ordinal": 27, - "type_info": "Bool" - }, - { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" - }, - { - "name": "default_aa_code_hash", - "ordinal": 29, - "type_info": "Bytea" - }, - { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, - { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" - }, - { - "name": "pass_through_data_hash", - "ordinal": 32, - "type_info": "Bytea" - }, - { - "name": "meta_parameters_hash", - "ordinal": 33, - "type_info": "Bytea" - }, - { - "name": "protocol_version", - "ordinal": 34, - "type_info": "Int4" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - true, - true, - true, - true, - true, - true, - true, - true, - true, - false, - false, - false, - true, - true, - true, - true, - false, - false, - true, - true, - true, - true, - false, - true, - true, - true, - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT number, timestamp, is_finished, l1_tx_count, l2_tx_count, fee_account_address, bloom, priority_ops_onchain_data, hash, parent_hash, commitment, compressed_write_logs, compressed_contracts, eth_prove_tx_id, eth_commit_tx_id, eth_execute_tx_id, merkle_root_hash, l2_to_l1_logs, l2_to_l1_messages, used_contract_hashes, compressed_initial_writes, compressed_repeated_writes, l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, meta_parameters_hash, protocol_version FROM l1_batches WHERE number = 0 OR eth_commit_tx_id IS NOT NULL AND commitment IS NOT NULL ORDER BY number DESC LIMIT 1" - }, "ee5727dc06a7385969e834556b96bbfdf12a5049a1a1c270f203ef3fa0e8cb94": { "describe": { "columns": [], diff --git a/core/lib/dal/src/blocks_dal.rs b/core/lib/dal/src/blocks_dal.rs index 69913a2dc14..2013eeaa4df 100644 --- a/core/lib/dal/src/blocks_dal.rs +++ b/core/lib/dal/src/blocks_dal.rs @@ -12,7 +12,8 @@ use zksync_types::{ aggregated_operations::AggregatedActionType, block::{BlockGasCount, L1BatchHeader, MiniblockHeader}, commitment::{L1BatchMetadata, L1BatchWithMetadata}, - L1BatchNumber, MiniblockNumber, ProtocolVersionId, H256, MAX_GAS_PER_PUBDATA_BYTE, U256, + L1BatchNumber, LogQuery, MiniblockNumber, ProtocolVersionId, H256, MAX_GAS_PER_PUBDATA_BYTE, + U256, }; use crate::{ @@ -182,8 +183,10 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, \ default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ + LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ WHERE number = $1", number.0 as i64 ) @@ -238,6 +241,28 @@ impl BlocksDal<'_, '_> { Ok(Some(heap)) } + pub async fn get_events_queue( + &mut self, + number: L1BatchNumber, + ) -> anyhow::Result>> { + let Some(row) = sqlx::query!( + "SELECT serialized_events_queue FROM events_queue WHERE l1_batch_number = $1", + number.0 as i64 + ) + .instrument("get_events_queue") + .report_latency() + .with_arg("number", &number) + .fetch_optional(self.storage.conn()) + .await? + else { + return Ok(None); + }; + + let events = serde_json::from_value(row.serialized_events_queue) + .context("invalid value for serialized_events_queue in the DB")?; + Ok(Some(events)) + } + pub async fn set_eth_tx_id( &mut self, number_range: ops::RangeInclusive, @@ -290,6 +315,7 @@ impl BlocksDal<'_, '_> { header: &L1BatchHeader, initial_bootloader_contents: &[(usize, U256)], predicted_block_gas: BlockGasCount, + events_queue: &[LogQuery], ) -> anyhow::Result<()> { let priority_onchain_data: Vec> = header .priority_ops_onchain_data @@ -305,12 +331,15 @@ impl BlocksDal<'_, '_> { // Serialization should always succeed. let initial_bootloader_contents = serde_json::to_value(initial_bootloader_contents) .expect("failed to serialize initial_bootloader_contents to JSON value"); + let events_queue = serde_json::to_value(events_queue) + .expect("failed to serialize events_queue to JSON value"); // Serialization should always succeed. let used_contract_hashes = serde_json::to_value(&header.used_contract_hashes) .expect("failed to serialize used_contract_hashes to JSON value"); let base_fee_per_gas = BigDecimal::from_u64(header.base_fee_per_gas) .context("block.base_fee_per_gas should fit in u64")?; + let mut transaction = self.storage.start_transaction().await?; sqlx::query!( "INSERT INTO l1_batches (\ number, l1_tx_count, l2_tx_count, \ @@ -349,8 +378,18 @@ impl BlocksDal<'_, '_> { .as_bytes(), header.protocol_version.map(|v| v as i32), ) - .execute(self.storage.conn()) + .execute(transaction.conn()) .await?; + + sqlx::query!( + "INSERT INTO events_queue (l1_batch_number, serialized_events_queue) VALUES ($1, $2)", + header.number.0 as i64, + events_queue + ) + .execute(transaction.conn()) + .await?; + transaction.commit().await?; + Ok(()) } @@ -508,6 +547,8 @@ impl BlocksDal<'_, '_> { metadata: &L1BatchMetadata, previous_root_hash: H256, ) -> anyhow::Result<()> { + let mut transaction = self.storage.start_transaction().await?; + let update_result = sqlx::query!( "UPDATE l1_batches \ SET hash = $1, merkle_root_hash = $2, commitment = $3, \ @@ -535,7 +576,23 @@ impl BlocksDal<'_, '_> { .instrument("save_blocks_metadata") .with_arg("number", &number) .report_latency() - .execute(self.storage.conn()) + .execute(transaction.conn()) + .await?; + + sqlx::query!( + "INSERT INTO commitments (l1_batch_number, events_queue_commitment, bootloader_initial_content_commitment) \ + VALUES ($1, $2, $3) \ + ON CONFLICT (l1_batch_number) DO UPDATE SET events_queue_commitment = $2, bootloader_initial_content_commitment = $3", + number.0 as i64, + metadata.events_queue_commitment.map(|h| h.0.to_vec()), + metadata + .bootloader_initial_content_commitment + .map(|h| h.0.to_vec()), + ) + .instrument("save_batch_commitments") + .with_arg("number", &number) + .report_latency() + .execute(transaction.conn()) .await?; if update_result.rows_affected() == 0 { @@ -565,7 +622,7 @@ impl BlocksDal<'_, '_> { .instrument("get_matching_blocks_metadata") .with_arg("number", &number) .report_latency() - .fetch_one(self.storage.conn()) + .fetch_one(transaction.conn()) .await? .count; @@ -577,6 +634,7 @@ impl BlocksDal<'_, '_> { metadata.l2_l1_merkle_root ); } + transaction.commit().await?; Ok(()) } @@ -594,8 +652,10 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, \ default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ + LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ WHERE number = 0 OR eth_commit_tx_id IS NOT NULL AND commitment IS NOT NULL \ ORDER BY number DESC \ LIMIT 1", @@ -689,8 +749,10 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, \ default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ + LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ WHERE eth_commit_tx_id IS NOT NULL AND eth_prove_tx_id IS NULL \ ORDER BY number LIMIT $1", limit as i32 @@ -755,7 +817,8 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, \ default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM \ (SELECT l1_batches.*, row_number() OVER (ORDER BY number ASC) AS row_number \ FROM l1_batches \ @@ -764,6 +827,7 @@ impl BlocksDal<'_, '_> { AND l1_batches.number > $1 \ ORDER BY number LIMIT $2\ ) inn \ + LEFT JOIN commitments ON commitments.l1_batch_number = inn.number \ WHERE number - row_number = $1", last_proved_block_number.0 as i32, limit as i32 @@ -794,8 +858,10 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, \ default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ + LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ WHERE eth_prove_tx_id IS NOT NULL AND eth_execute_tx_id IS NULL \ ORDER BY number LIMIT $1", limit as i32, @@ -871,8 +937,10 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, bootloader_code_hash, \ default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ + LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ WHERE number BETWEEN $1 AND $2 \ ORDER BY number LIMIT $3", expected_started_point as i32, @@ -906,8 +974,10 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages, l2_l1_merkle_root, l1_gas_price, l2_fair_gas_price, \ rollup_last_leaf_index, zkporter_is_available, l1_batches.bootloader_code_hash, \ l1_batches.default_aa_code_hash, base_fee_per_gas, aux_data_hash, pass_through_data_hash, \ - meta_parameters_hash, protocol_version \ + meta_parameters_hash, protocol_version, \ + events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ + LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ JOIN protocol_versions ON protocol_versions.id = l1_batches.protocol_version \ WHERE eth_commit_tx_id IS NULL \ AND number != 0 \ @@ -1401,7 +1471,7 @@ mod tests { header.l2_to_l1_messages.push(vec![33; 33]); conn.blocks_dal() - .insert_l1_batch(&header, &[], BlockGasCount::default()) + .insert_l1_batch(&header, &[], BlockGasCount::default(), &[]) .await .unwrap(); @@ -1449,7 +1519,7 @@ mod tests { execute: 10, }; conn.blocks_dal() - .insert_l1_batch(&header, &[], predicted_gas) + .insert_l1_batch(&header, &[], predicted_gas, &[]) .await .unwrap(); @@ -1457,7 +1527,7 @@ mod tests { header.timestamp += 100; predicted_gas += predicted_gas; conn.blocks_dal() - .insert_l1_batch(&header, &[], predicted_gas) + .insert_l1_batch(&header, &[], predicted_gas, &[]) .await .unwrap(); diff --git a/core/lib/dal/src/models/storage_block.rs b/core/lib/dal/src/models/storage_block.rs index d0077a2f7a1..80d8da65dc6 100644 --- a/core/lib/dal/src/models/storage_block.rs +++ b/core/lib/dal/src/models/storage_block.rs @@ -106,7 +106,7 @@ fn convert_base_system_contracts_hashes( } } -/// Projection of the `l1_batches` table corresponding to [`L1BatchHeader`] + [`L1BatchMetadata`]. +/// Projection of the columns corresponding to [`L1BatchHeader`] + [`L1BatchMetadata`]. // TODO(PLA-369): use `#[sqlx(flatten)]` once upgraded to newer `sqlx` #[derive(Debug, Clone, sqlx::FromRow)] pub struct StorageL1Batch { @@ -152,6 +152,9 @@ pub struct StorageL1Batch { pub l2_fair_gas_price: i64, pub protocol_version: Option, + + pub events_queue_commitment: Option>, + pub bootloader_initial_content_commitment: Option>, } impl From for L1BatchHeader { @@ -257,6 +260,10 @@ impl TryInto for StorageL1Batch { .ok_or(StorageL1BatchConvertError::Incomplete)?, ), }, + events_queue_commitment: self.events_queue_commitment.map(|v| H256::from_slice(&v)), + bootloader_initial_content_commitment: self + .bootloader_initial_content_commitment + .map(|v| H256::from_slice(&v)), }) } } diff --git a/core/lib/dal/src/storage_logs_dal.rs b/core/lib/dal/src/storage_logs_dal.rs index b0424c534fe..c41ad2b668d 100644 --- a/core/lib/dal/src/storage_logs_dal.rs +++ b/core/lib/dal/src/storage_logs_dal.rs @@ -548,7 +548,7 @@ mod tests { ); header.is_finished = true; conn.blocks_dal() - .insert_l1_batch(&header, &[], BlockGasCount::default()) + .insert_l1_batch(&header, &[], BlockGasCount::default(), &[]) .await .unwrap(); conn.blocks_dal() diff --git a/core/lib/dal/src/tests/mod.rs b/core/lib/dal/src/tests/mod.rs index fecd33f4761..78d1f934b80 100644 --- a/core/lib/dal/src/tests/mod.rs +++ b/core/lib/dal/src/tests/mod.rs @@ -290,7 +290,7 @@ async fn test_duplicate_insert_prover_jobs(connection_pool: ConnectionPool) { ); storage .blocks_dal() - .insert_l1_batch(&header, &[], Default::default()) + .insert_l1_batch(&header, &[], Default::default(), &[]) .await .unwrap(); @@ -352,7 +352,7 @@ async fn test_requeue_prover_jobs(connection_pool: ConnectionPool) { ); storage .blocks_dal() - .insert_l1_batch(&header, &[], Default::default()) + .insert_l1_batch(&header, &[], Default::default(), &[]) .await .unwrap(); @@ -415,7 +415,7 @@ async fn test_move_leaf_aggregation_jobs_from_waiting_to_queued(connection_pool: ); storage .blocks_dal() - .insert_l1_batch(&header, &[], Default::default()) + .insert_l1_batch(&header, &[], Default::default(), &[]) .await .unwrap(); @@ -495,7 +495,7 @@ async fn test_move_node_aggregation_jobs_from_waiting_to_queued(connection_pool: ); storage .blocks_dal() - .insert_l1_batch(&header, &[], Default::default()) + .insert_l1_batch(&header, &[], Default::default(), &[]) .await .unwrap(); @@ -582,7 +582,7 @@ async fn test_move_scheduler_jobs_from_waiting_to_queued(connection_pool: Connec ); storage .blocks_dal() - .insert_l1_batch(&header, &[], Default::default()) + .insert_l1_batch(&header, &[], Default::default(), &[]) .await .unwrap(); diff --git a/core/lib/mempool/src/tests.rs b/core/lib/mempool/src/tests.rs index 6de94c766d3..cb149752e2d 100644 --- a/core/lib/mempool/src/tests.rs +++ b/core/lib/mempool/src/tests.rs @@ -206,7 +206,7 @@ fn two_ready_txs() { view(mempool.next_transaction(&L2TxFilter::default())), view(mempool.next_transaction(&L2TxFilter::default())) ]), - HashSet::<(_, _)>::from_iter(vec![(account0, 0), (account1, 0)].into_iter()), + HashSet::<(_, _)>::from_iter(vec![(account0, 0), (account1, 0)]), ); } diff --git a/core/lib/merkle_tree/src/hasher/nodes.rs b/core/lib/merkle_tree/src/hasher/nodes.rs index 715e0c958fa..e4432b86b69 100644 --- a/core/lib/merkle_tree/src/hasher/nodes.rs +++ b/core/lib/merkle_tree/src/hasher/nodes.rs @@ -37,7 +37,7 @@ impl MerklePath { } } - pub(crate) fn push(&mut self, hasher: &mut HasherWithStats<'_>, maybe_hash: Option) { + pub(crate) fn push(&mut self, hasher: &HasherWithStats<'_>, maybe_hash: Option) { if let Some(hash) = maybe_hash { self.hashes.push(hash); } else if !self.hashes.is_empty() { @@ -126,7 +126,7 @@ impl InternalNodeCache { fn extend_merkle_path( &self, - hasher: &mut HasherWithStats<'_>, + hasher: &HasherWithStats<'_>, merkle_path: &mut MerklePath, nibble: u8, ) { diff --git a/core/lib/merkle_tree/src/storage/patch.rs b/core/lib/merkle_tree/src/storage/patch.rs index 5f98f3a2a66..1ba52fab538 100644 --- a/core/lib/merkle_tree/src/storage/patch.rs +++ b/core/lib/merkle_tree/src/storage/patch.rs @@ -269,7 +269,7 @@ impl WorkingPatchSet { /// Splits this patch set by the first nibble of the contained keys. pub fn split(self) -> [Self; SUBTREE_COUNT] { - let mut parts = [(); SUBTREE_COUNT].map(|_| Self { + let mut parts = [(); SUBTREE_COUNT].map(|()| Self { version: self.version, changes_by_nibble_count: vec![HashMap::new(); self.changes_by_nibble_count.len()], }); diff --git a/core/lib/merkle_tree/src/storage/tests.rs b/core/lib/merkle_tree/src/storage/tests.rs index 19006689174..64241c05b93 100644 --- a/core/lib/merkle_tree/src/storage/tests.rs +++ b/core/lib/merkle_tree/src/storage/tests.rs @@ -256,23 +256,23 @@ fn proving_keys_existence_and_absence() { let mut hasher = (&() as &dyn HashTree).into(); let (op, merkle_path) = updater.prove(&mut hasher, FIRST_KEY, &Nibbles::EMPTY); assert_matches!(op, TreeLogEntry::Read { .. }); - let merkle_path = finalize_merkle_path(merkle_path, &mut hasher); + let merkle_path = finalize_merkle_path(merkle_path, &hasher); assert!(merkle_path.is_empty()); // all adjacent hashes correspond to empty subtrees let (op, merkle_path) = updater.prove(&mut hasher, SECOND_KEY, &Nibbles::EMPTY); assert_matches!(op, TreeLogEntry::ReadMissingKey); - let merkle_path = finalize_merkle_path(merkle_path, &mut hasher); + let merkle_path = finalize_merkle_path(merkle_path, &hasher); assert_eq!(merkle_path.len(), 40); updater.insert(THIRD_KEY, H256([3; 32]), &Nibbles::EMPTY, || 2); let (op, merkle_path) = updater.prove(&mut hasher, FIRST_KEY, &Nibbles::EMPTY); assert_matches!(op, TreeLogEntry::Read { .. }); - let merkle_path = finalize_merkle_path(merkle_path, &mut hasher); + let merkle_path = finalize_merkle_path(merkle_path, &hasher); assert_eq!(merkle_path.len(), 18); // keys diverge at 18th bit let (op, merkle_path) = updater.prove(&mut hasher, SECOND_KEY, &Nibbles::EMPTY); assert_matches!(op, TreeLogEntry::ReadMissingKey); - let merkle_path = finalize_merkle_path(merkle_path, &mut hasher); + let merkle_path = finalize_merkle_path(merkle_path, &hasher); assert_eq!(merkle_path.len(), 40); assert_eq!(updater.metrics.key_reads, 2); @@ -280,7 +280,7 @@ fn proving_keys_existence_and_absence() { } // Emulate Merkle path finalization. -fn finalize_merkle_path(mut path: MerklePath, hasher: &mut HasherWithStats<'_>) -> Vec { +fn finalize_merkle_path(mut path: MerklePath, hasher: &HasherWithStats<'_>) -> Vec { for _ in 0..4 { path.push(hasher, None); } diff --git a/core/lib/state/src/test_utils.rs b/core/lib/state/src/test_utils.rs index 6ec1e9f3e9b..2e4a2281a86 100644 --- a/core/lib/state/src/test_utils.rs +++ b/core/lib/state/src/test_utils.rs @@ -106,7 +106,7 @@ pub(crate) async fn create_l1_batch( ); header.is_finished = true; conn.blocks_dal() - .insert_l1_batch(&header, &[], BlockGasCount::default()) + .insert_l1_batch(&header, &[], BlockGasCount::default(), &[]) .await .unwrap(); conn.blocks_dal() diff --git a/core/lib/types/src/commitment.rs b/core/lib/types/src/commitment.rs index abc0946fa34..a5f930058ba 100644 --- a/core/lib/types/src/commitment.rs +++ b/core/lib/types/src/commitment.rs @@ -61,6 +61,12 @@ pub struct L1BatchMetadata { pub aux_data_hash: H256, pub meta_parameters_hash: H256, pub pass_through_data_hash: H256, + /// The commitment to the final events queue state after the batch is committed. + /// Practically, it is a commitment to all events that happened on L2 during the batch execution. + pub events_queue_commitment: Option, + /// The commitment to the initial heap content of the bootloader. Practically it serves as a + /// commitment to the transactions in the batch. + pub bootloader_initial_content_commitment: Option, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] diff --git a/core/lib/types/src/priority_op_onchain_data.rs b/core/lib/types/src/priority_op_onchain_data.rs index 84ff177bbc9..a729aa27bf4 100644 --- a/core/lib/types/src/priority_op_onchain_data.rs +++ b/core/lib/types/src/priority_op_onchain_data.rs @@ -35,7 +35,7 @@ impl Eq for PriorityOpOnchainData {} impl PartialOrd for PriorityOpOnchainData { fn partial_cmp(&self, other: &Self) -> Option { - Some(self.layer_2_tip_fee.cmp(&other.layer_2_tip_fee)) + Some(self.cmp(other)) } } diff --git a/core/lib/utils/src/misc.rs b/core/lib/utils/src/misc.rs index 234d188400e..468e953f83b 100644 --- a/core/lib/utils/src/misc.rs +++ b/core/lib/utils/src/misc.rs @@ -20,6 +20,16 @@ pub fn concat_and_hash(hash1: H256, hash2: H256) -> H256 { H256(keccak256(&bytes)) } +pub fn expand_memory_contents(packed: &[(usize, U256)], memory_size_bytes: usize) -> Vec { + let mut result: Vec = vec![0; memory_size_bytes]; + + for (offset, value) in packed { + value.to_big_endian(&mut result[(offset * 32)..(offset + 1) * 32]); + } + + result.to_vec() +} + #[cfg(test)] mod tests { use super::*; diff --git a/core/lib/zksync_core/Cargo.toml b/core/lib/zksync_core/Cargo.toml index 842ac5d63ab..bd0b079bd5f 100644 --- a/core/lib/zksync_core/Cargo.toml +++ b/core/lib/zksync_core/Cargo.toml @@ -17,6 +17,7 @@ zksync_dal = { path = "../dal" } zksync_config = { path = "../config" } zksync_utils = { path = "../utils" } zksync_contracts = { path = "../contracts" } +zksync_commitment_utils = { path = "../commitment_utils" } zksync_eth_client = { path = "../eth_client" } zksync_eth_signer = { path = "../eth_signer" } zksync_mempool = { path = "../mempool" } diff --git a/core/lib/zksync_core/src/eth_sender/tests.rs b/core/lib/zksync_core/src/eth_sender/tests.rs index 9cce70b8248..815450dd596 100644 --- a/core/lib/zksync_core/src/eth_sender/tests.rs +++ b/core/lib/zksync_core/src/eth_sender/tests.rs @@ -465,6 +465,8 @@ fn default_l1_batch_metadata() -> L1BatchMetadata { aux_data_hash: Default::default(), meta_parameters_hash: Default::default(), pass_through_data_hash: Default::default(), + events_queue_commitment: Some(H256::zero()), + bootloader_initial_content_commitment: Some(H256::zero()), } } @@ -480,9 +482,9 @@ fn l1_batch_with_metadata(header: L1BatchHeader) -> L1BatchWithMetadata { async fn correct_order_for_confirmations(connection_pool: ConnectionPool) -> anyhow::Result<()> { let mut tester = EthSenderTester::new(connection_pool, vec![100; 100], true).await; insert_genesis_protocol_version(&tester).await; - let genesis_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(0)).await; - let first_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(1)).await; - let second_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(2)).await; + let genesis_l1_batch = insert_l1_batch(&tester, L1BatchNumber(0)).await; + let first_l1_batch = insert_l1_batch(&tester, L1BatchNumber(1)).await; + let second_l1_batch = insert_l1_batch(&tester, L1BatchNumber(2)).await; commit_l1_batch( &mut tester, @@ -540,9 +542,9 @@ async fn correct_order_for_confirmations(connection_pool: ConnectionPool) -> any async fn skipped_l1_batch_at_the_start(connection_pool: ConnectionPool) -> anyhow::Result<()> { let mut tester = EthSenderTester::new(connection_pool, vec![100; 100], true).await; insert_genesis_protocol_version(&tester).await; - let genesis_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(0)).await; - let first_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(1)).await; - let second_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(2)).await; + let genesis_l1_batch = insert_l1_batch(&tester, L1BatchNumber(0)).await; + let first_l1_batch = insert_l1_batch(&tester, L1BatchNumber(1)).await; + let second_l1_batch = insert_l1_batch(&tester, L1BatchNumber(2)).await; commit_l1_batch( &mut tester, @@ -575,8 +577,8 @@ async fn skipped_l1_batch_at_the_start(connection_pool: ConnectionPool) -> anyho .await; execute_l1_batches(&mut tester, vec![second_l1_batch.clone()], true).await; - let third_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(3)).await; - let fourth_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(4)).await; + let third_l1_batch = insert_l1_batch(&tester, L1BatchNumber(3)).await; + let fourth_l1_batch = insert_l1_batch(&tester, L1BatchNumber(4)).await; // DO NOT CONFIRM THIRD BLOCK let third_l1_batch_commit_tx_hash = commit_l1_batch( &mut tester, @@ -632,9 +634,9 @@ async fn skipped_l1_batch_at_the_start(connection_pool: ConnectionPool) -> anyho async fn skipped_l1_batch_in_the_middle(connection_pool: ConnectionPool) -> anyhow::Result<()> { let mut tester = EthSenderTester::new(connection_pool, vec![100; 100], true).await; insert_genesis_protocol_version(&tester).await; - let genesis_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(0)).await; - let first_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(1)).await; - let second_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(2)).await; + let genesis_l1_batch = insert_l1_batch(&tester, L1BatchNumber(0)).await; + let first_l1_batch = insert_l1_batch(&tester, L1BatchNumber(1)).await; + let second_l1_batch = insert_l1_batch(&tester, L1BatchNumber(2)).await; commit_l1_batch( &mut tester, genesis_l1_batch.clone(), @@ -659,8 +661,8 @@ async fn skipped_l1_batch_in_the_middle(connection_pool: ConnectionPool) -> anyh ) .await; - let third_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(3)).await; - let fourth_l1_batch = insert_l1_batch(&mut tester, L1BatchNumber(4)).await; + let third_l1_batch = insert_l1_batch(&tester, L1BatchNumber(3)).await; + let fourth_l1_batch = insert_l1_batch(&tester, L1BatchNumber(4)).await; // DO NOT CONFIRM THIRD BLOCK let third_l1_batch_commit_tx_hash = commit_l1_batch( &mut tester, @@ -809,7 +811,7 @@ async fn insert_genesis_protocol_version(tester: &EthSenderTester) { .await; } -async fn insert_l1_batch(tester: &mut EthSenderTester, number: L1BatchNumber) -> L1BatchHeader { +async fn insert_l1_batch(tester: &EthSenderTester, number: L1BatchNumber) -> L1BatchHeader { let mut header = L1BatchHeader::new( number, 0, @@ -824,7 +826,7 @@ async fn insert_l1_batch(tester: &mut EthSenderTester, number: L1BatchNumber) -> .storage() .await .blocks_dal() - .insert_l1_batch(&header, &[], Default::default()) + .insert_l1_batch(&header, &[], Default::default(), &[]) .await .unwrap(); tester diff --git a/core/lib/zksync_core/src/eth_watch/tests.rs b/core/lib/zksync_core/src/eth_watch/tests.rs index 32d3837fecc..d9448efbfab 100644 --- a/core/lib/zksync_core/src/eth_watch/tests.rs +++ b/core/lib/zksync_core/src/eth_watch/tests.rs @@ -40,7 +40,7 @@ impl FakeEthClientData { let eth_block = transaction.eth_block(); self.transactions .entry(eth_block.0 as u64) - .or_insert_with(Vec::new) + .or_default() .push(tx_into_log(transaction.clone())); } } @@ -49,7 +49,7 @@ impl FakeEthClientData { for (upgrade, eth_block) in upgrades { self.upgrades .entry(*eth_block) - .or_insert_with(Vec::new) + .or_default() .push(upgrade_into_log(upgrade.clone(), *eth_block)); } } diff --git a/core/lib/zksync_core/src/genesis.rs b/core/lib/zksync_core/src/genesis.rs index ccc9e949d2d..4fe31352e4b 100644 --- a/core/lib/zksync_core/src/genesis.rs +++ b/core/lib/zksync_core/src/genesis.rs @@ -292,7 +292,7 @@ pub(crate) async fn create_genesis_l1_batch( .await; transaction .blocks_dal() - .insert_l1_batch(&genesis_l1_batch_header, &[], BlockGasCount::default()) + .insert_l1_batch(&genesis_l1_batch_header, &[], BlockGasCount::default(), &[]) .await .unwrap(); transaction @@ -360,6 +360,8 @@ pub(crate) async fn save_genesis_l1_batch_metadata( aux_data_hash: commitment_hash.aux_output, meta_parameters_hash: commitment_hash.meta_parameters, pass_through_data_hash: commitment_hash.pass_through_data, + events_queue_commitment: None, + bootloader_initial_content_commitment: None, }; storage .blocks_dal() diff --git a/core/lib/zksync_core/src/metadata_calculator/helpers.rs b/core/lib/zksync_core/src/metadata_calculator/helpers.rs index 0425ce9587d..3d7246d78c5 100644 --- a/core/lib/zksync_core/src/metadata_calculator/helpers.rs +++ b/core/lib/zksync_core/src/metadata_calculator/helpers.rs @@ -231,11 +231,12 @@ impl L1BatchWithLogs { // since no new leaf indices are allocated in the tree for them, such writes are no-op on the tree side as well. let hashed_keys_for_zero_values: Vec<_> = touched_slots .iter() - .filter_map(|(key, value)| { + .filter(|(_, value)| { // Only zero values are worth checking for initial writes; non-zero values are always // written per deduplication rules. - value.is_zero().then(|| key.hashed_key()) + value.is_zero() }) + .map(|(key, _)| key.hashed_key()) .collect(); METRICS .load_changes_zero_values diff --git a/core/lib/zksync_core/src/metadata_calculator/metrics.rs b/core/lib/zksync_core/src/metadata_calculator/metrics.rs index d1431bca96c..f2bedf47229 100644 --- a/core/lib/zksync_core/src/metadata_calculator/metrics.rs +++ b/core/lib/zksync_core/src/metadata_calculator/metrics.rs @@ -17,7 +17,10 @@ use crate::metrics::{BlockStage, APP_METRICS}; pub(super) enum TreeUpdateStage { LoadChanges, Compute, - PrepareResults, + CheckConsistency, + EventsCommitment, + BootloaderCommitment, + BuildMetadata, #[metrics(name = "reestimate_block_commit_gas_cost")] ReestimateGasCost, SavePostgres, diff --git a/core/lib/zksync_core/src/metadata_calculator/mod.rs b/core/lib/zksync_core/src/metadata_calculator/mod.rs index 1951beeafbd..d5bba74ff24 100644 --- a/core/lib/zksync_core/src/metadata_calculator/mod.rs +++ b/core/lib/zksync_core/src/metadata_calculator/mod.rs @@ -16,6 +16,7 @@ use zksync_object_store::ObjectStoreFactory; use zksync_types::{ block::L1BatchHeader, commitment::{L1BatchCommitment, L1BatchMetadata}, + H256, }; mod helpers; @@ -167,6 +168,8 @@ impl MetadataCalculator { fn build_l1_batch_metadata( tree_metadata: TreeMetadata, header: &L1BatchHeader, + events_queue_commitment: Option, + bootloader_initial_content_commitment: Option, ) -> L1BatchMetadata { let merkle_root_hash = tree_metadata.root_hash; @@ -195,6 +198,8 @@ impl MetadataCalculator { aux_data_hash: commitment_hash.aux_output, meta_parameters_hash: commitment_hash.meta_parameters, pass_through_data_hash: commitment_hash.pass_through_data, + events_queue_commitment, + bootloader_initial_content_commitment, }; tracing::trace!("L1 batch metadata: {metadata:?}"); diff --git a/core/lib/zksync_core/src/metadata_calculator/tests.rs b/core/lib/zksync_core/src/metadata_calculator/tests.rs index 269b48f2820..fa8df01d909 100644 --- a/core/lib/zksync_core/src/metadata_calculator/tests.rs +++ b/core/lib/zksync_core/src/metadata_calculator/tests.rs @@ -282,7 +282,7 @@ async fn test_postgres_backup_recovery( // Re-insert the last batch without metadata immediately. storage .blocks_dal() - .insert_l1_batch(batch_without_metadata, &[], BlockGasCount::default()) + .insert_l1_batch(batch_without_metadata, &[], BlockGasCount::default(), &[]) .await .unwrap(); insert_initial_writes_for_batch(&mut storage, batch_without_metadata.number).await; @@ -307,7 +307,7 @@ async fn test_postgres_backup_recovery( for batch_header in &removed_batches { storage .blocks_dal() - .insert_l1_batch(batch_header, &[], BlockGasCount::default()) + .insert_l1_batch(batch_header, &[], BlockGasCount::default(), &[]) .await .unwrap(); insert_initial_writes_for_batch(&mut storage, batch_header.number).await; @@ -520,7 +520,7 @@ pub(super) async fn extend_db_state( storage .blocks_dal() - .insert_l1_batch(&header, &[], BlockGasCount::default()) + .insert_l1_batch(&header, &[], BlockGasCount::default(), &[]) .await .unwrap(); storage diff --git a/core/lib/zksync_core/src/metadata_calculator/updater.rs b/core/lib/zksync_core/src/metadata_calculator/updater.rs index a701486b381..c2d8b007659 100644 --- a/core/lib/zksync_core/src/metadata_calculator/updater.rs +++ b/core/lib/zksync_core/src/metadata_calculator/updater.rs @@ -5,12 +5,13 @@ use tokio::sync::watch; use std::{ops, time::Instant}; +use zksync_commitment_utils::{bootloader_initial_content_commitment, events_queue_commitment}; use zksync_config::configs::database::MerkleTreeMode; use zksync_dal::{ConnectionPool, StorageProcessor}; use zksync_health_check::HealthUpdater; use zksync_merkle_tree::domain::TreeMetadata; use zksync_object_store::ObjectStore; -use zksync_types::{block::L1BatchHeader, writes::InitialStorageWrite, L1BatchNumber, U256}; +use zksync_types::{block::L1BatchHeader, writes::InitialStorageWrite, L1BatchNumber, H256, U256}; use super::{ helpers::{AsyncTree, Delayer, L1BatchWithLogs, TreeHealthCheckDetails}, @@ -133,17 +134,31 @@ impl TreeUpdater { let ((header, metadata, object_key), next_l1_batch_data) = future::join(process_l1_batch_task, load_next_l1_batch_task).await; - let prepare_results_latency = METRICS.start_stage(TreeUpdateStage::PrepareResults); + let check_consistency_latency = METRICS.start_stage(TreeUpdateStage::CheckConsistency); Self::check_initial_writes_consistency( storage, header.number, &metadata.initial_writes, ) .await; - let metadata = MetadataCalculator::build_l1_batch_metadata(metadata, &header); - prepare_results_latency.observe(); + check_consistency_latency.observe(); + let (events_queue_commitment, bootloader_initial_content_commitment) = + self.calculate_commitments(storage, &header).await; + + let build_metadata_latency = METRICS.start_stage(TreeUpdateStage::BuildMetadata); + let metadata = MetadataCalculator::build_l1_batch_metadata( + metadata, + &header, + events_queue_commitment, + bootloader_initial_content_commitment, + ); + build_metadata_latency.observe(); + + let reestimate_gas_cost_latency = + METRICS.start_stage(TreeUpdateStage::ReestimateGasCost); MetadataCalculator::reestimate_l1_batch_commit_gas(storage, &header, &metadata).await; + reestimate_gas_cost_latency.observe(); let save_postgres_latency = METRICS.start_stage(TreeUpdateStage::SavePostgres); storage @@ -204,6 +219,47 @@ impl TreeUpdater { last_l1_batch_number + 1 } + async fn calculate_commitments( + &self, + conn: &mut StorageProcessor<'_>, + header: &L1BatchHeader, + ) -> (Option, Option) { + if self.mode == MerkleTreeMode::Full { + let events_queue_commitment_latency = + METRICS.start_stage(TreeUpdateStage::EventsCommitment); + let events_queue = conn + .blocks_dal() + .get_events_queue(header.number) + .await + .unwrap() + .unwrap(); + let events_queue_commitment = + events_queue_commitment(&events_queue, header.protocol_version.unwrap()); + events_queue_commitment_latency.observe(); + + let bootloader_commitment_latency = + METRICS.start_stage(TreeUpdateStage::BootloaderCommitment); + let initial_bootloader_contents = conn + .blocks_dal() + .get_initial_bootloader_heap(header.number) + .await + .unwrap() + .unwrap(); + let bootloader_initial_content_commitment = bootloader_initial_content_commitment( + &initial_bootloader_contents, + header.protocol_version.unwrap(), + ); + bootloader_commitment_latency.observe(); + + ( + events_queue_commitment, + bootloader_initial_content_commitment, + ) + } else { + (None, None) + } + } + async fn step( &mut self, mut storage: StorageProcessor<'_>, diff --git a/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs b/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs index ba053845149..8eeac5890a2 100644 --- a/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs +++ b/core/lib/zksync_core/src/state_keeper/io/seal_logic.rs @@ -130,12 +130,15 @@ impl UpdatesManager { let initial_bootloader_contents = finished_batch.final_bootloader_memory.unwrap_or_default(); + + let events_queue = Vec::new(); // TODO: put actual value when new VM is merged. transaction .blocks_dal() .insert_l1_batch( &l1_batch, &initial_bootloader_contents, self.l1_batch.l1_gas_count, + &events_queue, ) .await .unwrap(); diff --git a/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs b/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs index fb9ec33c54b..92b54950e5b 100644 --- a/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs +++ b/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs @@ -160,7 +160,7 @@ impl Tester { let mut storage = pool.access_storage_tagged("state_keeper").await.unwrap(); storage .blocks_dal() - .insert_l1_batch(&batch_header, &[], Default::default()) + .insert_l1_batch(&batch_header, &[], Default::default(), &[]) .await .unwrap(); storage diff --git a/core/lib/zksync_core/src/state_keeper/tests/mod.rs b/core/lib/zksync_core/src/state_keeper/tests/mod.rs index d269b1fea67..f29c3874d72 100644 --- a/core/lib/zksync_core/src/state_keeper/tests/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/tests/mod.rs @@ -102,6 +102,8 @@ pub(super) fn create_l1_batch_metadata(number: u32) -> L1BatchMetadata { aux_data_hash: H256::zero(), meta_parameters_hash: H256::zero(), pass_through_data_hash: H256::zero(), + events_queue_commitment: Some(H256::zero()), + bootloader_initial_content_commitment: Some(H256::zero()), } } diff --git a/core/lib/zksync_core/src/witness_generator/basic_circuits.rs b/core/lib/zksync_core/src/witness_generator/basic_circuits.rs index 676f3c41c38..1a4b33e3e6b 100644 --- a/core/lib/zksync_core/src/witness_generator/basic_circuits.rs +++ b/core/lib/zksync_core/src/witness_generator/basic_circuits.rs @@ -29,14 +29,13 @@ use zksync_types::{ witness::oracle::VmWitnessOracle, SchedulerCircuitInstanceWitness, }, - Address, L1BatchNumber, ProtocolVersionId, H256, U256, + Address, L1BatchNumber, ProtocolVersionId, H256, U256, USED_BOOTLOADER_MEMORY_BYTES, }; -use zksync_utils::{bytes_to_chunks, h256_to_u256, u256_to_h256}; +use zksync_utils::{bytes_to_chunks, expand_memory_contents, h256_to_u256, u256_to_h256}; use super::{ precalculated_merkle_paths_provider::PrecalculatedMerklePathsProvider, - utils::{expand_bootloader_contents, save_prover_input_artifacts}, - METRICS, + utils::save_prover_input_artifacts, METRICS, }; pub struct BasicCircuitArtifacts { @@ -431,7 +430,8 @@ pub async fn generate_witness( .await .expect("Default aa bytecode should exist"); let account_bytecode = bytes_to_chunks(&account_bytecode_bytes); - let bootloader_contents = expand_bootloader_contents(&input.initial_heap_content); + let bootloader_contents = + expand_memory_contents(&input.initial_heap_content, USED_BOOTLOADER_MEMORY_BYTES); let account_code_hash = h256_to_u256(header.base_system_contracts_hashes.default_aa); let hashes: HashSet = input diff --git a/core/lib/zksync_core/src/witness_generator/utils.rs b/core/lib/zksync_core/src/witness_generator/utils.rs index c457e3c4483..2135eddb3cc 100644 --- a/core/lib/zksync_core/src/witness_generator/utils.rs +++ b/core/lib/zksync_core/src/witness_generator/utils.rs @@ -3,18 +3,6 @@ use zksync_types::zkevm_test_harness::abstract_zksync_circuit::concrete_circuits use zksync_types::zkevm_test_harness::bellman::bn256::Bn256; use zksync_types::zkevm_test_harness::witness::oracle::VmWitnessOracle; use zksync_types::{proofs::AggregationRound, L1BatchNumber}; -use zksync_types::{U256, USED_BOOTLOADER_MEMORY_BYTES}; - -pub fn expand_bootloader_contents(packed: &[(usize, U256)]) -> Vec { - let mut result: Vec = Vec::new(); - result.resize(USED_BOOTLOADER_MEMORY_BYTES, 0); - - for (offset, value) in packed { - value.to_big_endian(&mut result[(offset * 32)..(offset + 1) * 32]); - } - - result.to_vec() -} pub async fn save_prover_input_artifacts( block_number: L1BatchNumber, diff --git a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs b/core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs index 24c61bc50b4..5e0e1bbd22d 100644 --- a/core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs +++ b/core/multivm_deps/vm_1_3_2/src/oracles/tracer/call.rs @@ -302,7 +302,6 @@ mod tests { assert_eq!(filtered_call.len(), 1); assert_eq!(filtered_call[0].calls.len(), 2); - let mut near_call = near_call; near_call.calls = vec![Call::default(), Call::default(), near_call.clone()]; call.calls = vec![Call::default(), Call::default(), near_call]; let filtered_call = filter_near_call(call); diff --git a/core/multivm_deps/vm_m6/src/oracles/tracer/call.rs b/core/multivm_deps/vm_m6/src/oracles/tracer/call.rs index fc345a64e48..8ca67145072 100644 --- a/core/multivm_deps/vm_m6/src/oracles/tracer/call.rs +++ b/core/multivm_deps/vm_m6/src/oracles/tracer/call.rs @@ -306,7 +306,6 @@ mod tests { assert_eq!(filtered_call.len(), 1); assert_eq!(filtered_call[0].calls.len(), 2); - let mut near_call = near_call; near_call.calls = vec![Call::default(), Call::default(), near_call.clone()]; call.calls = vec![Call::default(), Call::default(), near_call]; let filtered_call = filter_near_call(call); diff --git a/core/tests/cross_external_nodes_checker/src/checker.rs b/core/tests/cross_external_nodes_checker/src/checker.rs index 049553612bc..61421816c60 100644 --- a/core/tests/cross_external_nodes_checker/src/checker.rs +++ b/core/tests/cross_external_nodes_checker/src/checker.rs @@ -472,10 +472,7 @@ impl Checker { match self.mode { RpcMode::Triggered => { // Add a divergence to the list of divergences for the given EN instance. - let divergences = self - .divergences - .entry(url.to_string()) - .or_insert_with(Vec::new); + let divergences = self.divergences.entry(url.to_string()).or_default(); divergences.push(divergence.clone()); tracing::error!("{}", divergence); } diff --git a/docker/contract-verifier/Dockerfile b/docker/contract-verifier/Dockerfile index 69e3a0a7df0..86753869895 100644 --- a/docker/contract-verifier/Dockerfile +++ b/docker/contract-verifier/Dockerfile @@ -1,8 +1,18 @@ -# Will work locally only after building contracts first +# syntax=docker/dockerfile:experimental +FROM debian:bookworm-slim as builder -FROM rust:1.72-bookworm as builder +RUN apt-get update && apt-get install -y curl clang openssl libssl-dev gcc g++ \ + pkg-config build-essential libclang-dev && \ + rm -rf /var/lib/apt/lists/* + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH + +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \ + rustup install nightly-2023-07-21 && \ + rustup default nightly-2023-07-21 -RUN apt-get update && apt-get install -y clang && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/zksync COPY . . diff --git a/docker/cross-external-nodes-checker/Dockerfile b/docker/cross-external-nodes-checker/Dockerfile index 301f67e8b0a..40837169402 100644 --- a/docker/cross-external-nodes-checker/Dockerfile +++ b/docker/cross-external-nodes-checker/Dockerfile @@ -1,6 +1,17 @@ -FROM rust:1.72-bookworm as builder +# syntax=docker/dockerfile:experimental +FROM debian:bookworm-slim as builder -RUN apt-get update && apt-get install -y clang && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y curl clang openssl libssl-dev gcc g++ \ + pkg-config build-essential libclang-dev && \ + rm -rf /var/lib/apt/lists/* + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH + +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \ + rustup install nightly-2023-07-21 && \ + rustup default nightly-2023-07-21 WORKDIR /usr/src/zksync COPY . . diff --git a/docker/external-node/Dockerfile b/docker/external-node/Dockerfile index 60375216ba0..c3152b0ddf8 100644 --- a/docker/external-node/Dockerfile +++ b/docker/external-node/Dockerfile @@ -1,8 +1,18 @@ # Will work locally only after prior contracts build +# syntax=docker/dockerfile:experimental +FROM debian:bookworm-slim as builder -FROM rust:1.72-bookworm as builder +RUN apt-get update && apt-get install -y curl clang openssl libssl-dev gcc g++ \ + pkg-config build-essential libclang-dev && \ + rm -rf /var/lib/apt/lists/* -RUN apt-get update && apt-get install -y clang && rm -rf /var/lib/apt/lists/* +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH + +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \ + rustup install nightly-2023-07-21 && \ + rustup default nightly-2023-07-21 WORKDIR /usr/src/zksync COPY . . diff --git a/docker/server-v2/Dockerfile b/docker/server-v2/Dockerfile index 074e2e306ec..ff441ab4170 100644 --- a/docker/server-v2/Dockerfile +++ b/docker/server-v2/Dockerfile @@ -1,12 +1,21 @@ # Will work locally only after prior contracts build +# syntax=docker/dockerfile:experimental +FROM debian:bookworm-slim as builder -FROM rust:1.72-bookworm as builder +WORKDIR /usr/src/zksync +COPY . . -RUN apt-get update && apt-get install -y linux-libc-dev liburing-dev clang && \ +RUN apt-get update && apt-get install -y curl clang openssl libssl-dev gcc g++ \ + pkg-config build-essential libclang-dev linux-libc-dev liburing-dev && \ rm -rf /var/lib/apt/lists/* -WORKDIR /usr/src/zksync -COPY . . +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH + +RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \ + rustup install nightly-2023-07-21 && \ + rustup default nightly-2023-07-21 RUN cargo build --release --features=rocksdb/io-uring diff --git a/rust-toolchain b/rust-toolchain index 22d6771a47d..9a87fb21ccf 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.72.1 +nightly-2023-08-21