From 1659c840687e4c71e8d5f7be3f2e66785d5fd0dc Mon Sep 17 00:00:00 2001 From: koloz193 Date: Thu, 26 Oct 2023 08:44:07 -0400 Subject: [PATCH] feat(core): adding pubdata to statekeeper and merkle tree (#259) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What ❔ Setting the ground for bigger boojum changes. Adding boojum related fields to the data model and types. Extending state tree to have a concept of `StateDiffs`. ## Why ❔ We want to reduce the size of the overall boojum merge, this sets the basis for more extensive changes. These changes are all meant to be non-intrusive. ## Checklist - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [x] Tests for the changes have been added / updated. - [x] Documentation comments have been added / updated. - [x] Code has been formatted via `zk fmt` and `zk lint`. --------- Co-authored-by: “perekopskiy” --- Cargo.lock | 1 + ...18205126_l1_batches_boojum_fields.down.sql | 5 + ...1018205126_l1_batches_boojum_fields.up.sql | 6 + core/lib/dal/sqlx-data.json | 6277 +++++++++-------- core/lib/dal/src/blocks_dal.rs | 55 +- core/lib/dal/src/models/storage_block.rs | 26 + core/lib/dal/src/storage_logs_dedup_dal.rs | 13 + core/lib/merkle_tree/Cargo.toml | 1 + core/lib/merkle_tree/src/domain.rs | 77 +- core/lib/state/src/in_memory.rs | 8 + core/lib/state/src/lib.rs | 3 + core/lib/state/src/postgres/mod.rs | 10 + core/lib/state/src/rocksdb/mod.rs | 12 +- core/lib/state/src/shadow_storage.rs | 16 + core/lib/state/src/storage_view.rs | 8 + core/lib/state/src/witness.rs | 29 +- core/lib/types/src/block.rs | 5 +- core/lib/types/src/commitment.rs | 101 +- core/lib/types/src/event.rs | 314 +- core/lib/types/src/l2_to_l1_log.rs | 29 + core/lib/zksync_core/src/eth_sender/tests.rs | 1 + core/lib/zksync_core/src/genesis.rs | 5 + .../src/metadata_calculator/mod.rs | 5 + .../batch_executor/tests/tester.rs | 1 + .../src/state_keeper/io/seal_logic.rs | 1 + .../zksync_core/src/state_keeper/tests/mod.rs | 1 + 26 files changed, 3893 insertions(+), 3117 deletions(-) create mode 100644 core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.down.sql create mode 100644 core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.up.sql diff --git a/Cargo.lock b/Cargo.lock index 0768a93c721..150123dc614 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8191,6 +8191,7 @@ dependencies = [ "zksync_storage", "zksync_system_constants", "zksync_types", + "zksync_utils", ] [[package]] diff --git a/core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.down.sql b/core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.down.sql new file mode 100644 index 00000000000..69df17ae9a7 --- /dev/null +++ b/core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.down.sql @@ -0,0 +1,5 @@ +ALTER TABLE l1_batches + DROP COLUMN IF EXISTS system_logs; + +ALTER TABLE l1_batches + DROP COLUMN IF EXISTS compressed_state_diffs; diff --git a/core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.up.sql b/core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.up.sql new file mode 100644 index 00000000000..d9b782b6f4d --- /dev/null +++ b/core/lib/dal/migrations/20231018205126_l1_batches_boojum_fields.up.sql @@ -0,0 +1,6 @@ +ALTER TABLE l1_batches + ADD COLUMN IF NOT EXISTS system_logs BYTEA[] + NOT NULL DEFAULT '{}'; + +ALTER TABLE l1_batches + ADD COLUMN IF NOT EXISTS compressed_state_diffs BYTEA; diff --git a/core/lib/dal/sqlx-data.json b/core/lib/dal/sqlx-data.json index f81ffba7366..29aea31db1f 100644 --- a/core/lib/dal/sqlx-data.json +++ b/core/lib/dal/sqlx-data.json @@ -1083,6 +1083,254 @@ }, "query": "\n UPDATE witness_inputs_fri SET status =$1, updated_at = now()\n WHERE l1_batch_number = $2\n " }, + "1d1f5198cbb0b9cd70019a9b386212de294075c00ebac4dbd39fda5397dbb07c": { + "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": "compressed_state_diffs", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 36, + "type_info": "ByteaArray" + }, + { + "name": "events_queue_commitment", + "ordinal": 37, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 38, + "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, + false, + 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, compressed_state_diffs, system_logs, 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" + }, "1d3e9cd259fb70a2bc81e8344576c3fb27b47ad6cdb6751d2a9b8c8d342b7a75": { "describe": { "columns": [], @@ -1185,127 +1433,11 @@ }, "query": "UPDATE transactions SET in_mempool = FALSE WHERE in_mempool = TRUE" }, - "1f33c948d95dfb549b9de814e74c4effff504c3316df79816d619a20a2c04be3": { + "1f3e41f4ac5b1f6e735f1c422c0098ed534d9e8fe84e98b3234e893e8a2c5085": { "describe": { "columns": [ { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "l1_tx_count", - "ordinal": 1, - "type_info": "Int4" - }, - { - "name": "l2_tx_count", - "ordinal": 2, - "type_info": "Int4" - }, - { - "name": "timestamp", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "is_finished", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "fee_account_address", - "ordinal": 5, - "type_info": "Bytea" - }, - { - "name": "l2_to_l1_logs", - "ordinal": 6, - "type_info": "ByteaArray" - }, - { - "name": "l2_to_l1_messages", - "ordinal": 7, - "type_info": "ByteaArray" - }, - { - "name": "bloom", - "ordinal": 8, - "type_info": "Bytea" - }, - { - "name": "priority_ops_onchain_data", - "ordinal": 9, - "type_info": "ByteaArray" - }, - { - "name": "used_contract_hashes", - "ordinal": 10, - "type_info": "Jsonb" - }, - { - "name": "base_fee_per_gas", - "ordinal": 11, - "type_info": "Numeric" - }, - { - "name": "l1_gas_price", - "ordinal": 12, - "type_info": "Int8" - }, - { - "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": [ - "Int4" - ] - } - }, - "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 eth_commit_tx_id = $1 OR eth_prove_tx_id = $1 OR eth_execute_tx_id = $1" - }, - "1f3e41f4ac5b1f6e735f1c422c0098ed534d9e8fe84e98b3234e893e8a2c5085": { - "describe": { - "columns": [ - { - "name": "id", + "name": "id", "ordinal": 0, "type_info": "Int4" } @@ -2524,51 +2656,13 @@ }, "query": "INSERT INTO node_aggregation_witness_jobs_fri (l1_batch_number, circuit_id, depth, aggregations_url, number_of_dependent_jobs, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, 'waiting_for_proofs', now(), now())\n ON CONFLICT(l1_batch_number, circuit_id, depth)\n DO UPDATE SET updated_at=now()" }, - "334197fef9eeca55790d366ae67bbe95d77181bdfd2ad3208a32bd50585aef2d": { - "describe": { - "columns": [ - { - "name": "hashed_key", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "ByteaArray" - ] - } - }, - "query": "SELECT hashed_key FROM initial_writes WHERE hashed_key = ANY($1)" - }, - "335826f54feadf6aa30a4e7668ad3f17a2afc6bd67d4f863e3ad61fefd1bd8d2": { + "3167c62f6da5171081f6c003e64a3096829d4da94c3af48867d12d2c135f1a29": { "describe": { "columns": [ { "name": "number", "ordinal": 0, "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT MAX(number) as \"number\" FROM miniblocks" - }, - "357347157ed8ff19d223c54533c3a85bd7e64a37514d657f8d49bd6eb5be1806": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" }, { "name": "timestamp", @@ -2576,436 +2670,441 @@ "type_info": "Int8" }, { - "name": "recursion_scheduler_level_vk_hash", + "name": "is_finished", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "recursion_node_level_vk_hash", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "recursion_leaf_level_vk_hash", + "name": "l2_tx_count", "ordinal": 4, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "recursion_circuits_set_vks_hash", + "name": "fee_account_address", "ordinal": 5, "type_info": "Bytea" }, { - "name": "bootloader_code_hash", + "name": "bloom", "ordinal": 6, "type_info": "Bytea" }, { - "name": "default_account_code_hash", + "name": "priority_ops_onchain_data", "ordinal": 7, - "type_info": "Bytea" + "type_info": "ByteaArray" }, { - "name": "verifier_address", + "name": "hash", "ordinal": 8, "type_info": "Bytea" }, { - "name": "upgrade_tx_hash", + "name": "parent_hash", "ordinal": 9, "type_info": "Bytea" }, { - "name": "created_at", + "name": "commitment", "ordinal": 10, - "type_info": "Timestamp" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT * FROM protocol_versions ORDER BY id DESC LIMIT 1" - }, - "36c483775b604324eacd7e5aac591b927cc32abb89fe1b0c5cf4b0383e9bd443": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "leaf_layer_subqueues_blob_url", - "ordinal": 1, - "type_info": "Text" + "name": "compressed_write_logs", + "ordinal": 11, + "type_info": "Bytea" }, { - "name": "aggregation_outputs_blob_url", - "ordinal": 2, - "type_info": "Text" - } - ], - "nullable": [ - false, - true, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "\n SELECT l1_batch_number, leaf_layer_subqueues_blob_url, aggregation_outputs_blob_url FROM node_aggregation_witness_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND leaf_layer_subqueues_blob_url is NOT NULL\n AND aggregation_outputs_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n " - }, - "37e4a0eea7b72bd3b75c26e003f3fa62039d9b614f0f2fa3d61e8c5e95f002fd": { - "describe": { - "columns": [ + "name": "compressed_contracts", + "ordinal": 12, + "type_info": "Bytea" + }, { - "name": "max?", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT MAX(index) as \"max?\" FROM initial_writes" - }, - "38a3bdae346fdd362452af152c6886c93696dd2db561f6622f8eaf6fabb1e5be": { - "describe": { - "columns": [ + "name": "eth_prove_tx_id", + "ordinal": 13, + "type_info": "Int4" + }, { - "name": "id", - "ordinal": 0, + "name": "eth_commit_tx_id", + "ordinal": 14, "type_info": "Int4" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int4", - "Text", - "Timestamp" - ] - } - }, - "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, confirmed_at)\n VALUES ($1, 0, 0, $2, '\\x00', now(), now(), $3)\n RETURNING id" - }, - "394bbd64939d47fda4e1545e2752b208901e872b7234a5c3af456bdf429a6074": { - "describe": { - "columns": [ + }, { - "name": "tx_hash", - "ordinal": 0, + "name": "eth_execute_tx_id", + "ordinal": 15, + "type_info": "Int4" + }, + { + "name": "merkle_root_hash", + "ordinal": 16, "type_info": "Bytea" }, { - "name": "call_trace", - "ordinal": 1, + "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" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Bytea" - ] - } - }, - "query": "\n SELECT * FROM call_traces\n WHERE tx_hash = $1\n " - }, - "3a18d0d1e236d8f57e8b3b1218a24414639a7c8235ba6a514c3d03b8a1790f17": { - "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" }, { - "name": "merkle_tree_paths_blob_url", - "ordinal": 1, - "type_info": "Text" + "name": "l2_fair_gas_price", + "ordinal": 25, + "type_info": "Int8" }, { - "name": "attempts", - "ordinal": 2, - "type_info": "Int2" + "name": "rollup_last_leaf_index", + "ordinal": 26, + "type_info": "Int8" }, { - "name": "status", - "ordinal": 3, - "type_info": "Text" + "name": "zkporter_is_available", + "ordinal": 27, + "type_info": "Bool" }, { - "name": "error", - "ordinal": 4, - "type_info": "Text" + "name": "bootloader_code_hash", + "ordinal": 28, + "type_info": "Bytea" }, { - "name": "created_at", - "ordinal": 5, - "type_info": "Timestamp" + "name": "default_aa_code_hash", + "ordinal": 29, + "type_info": "Bytea" }, { - "name": "updated_at", - "ordinal": 6, - "type_info": "Timestamp" + "name": "base_fee_per_gas", + "ordinal": 30, + "type_info": "Numeric" }, { - "name": "processing_started_at", - "ordinal": 7, - "type_info": "Timestamp" + "name": "aux_data_hash", + "ordinal": 31, + "type_info": "Bytea" }, { - "name": "time_taken", - "ordinal": 8, - "type_info": "Time" + "name": "pass_through_data_hash", + "ordinal": 32, + "type_info": "Bytea" }, { - "name": "is_blob_cleaned", - "ordinal": 9, - "type_info": "Bool" + "name": "meta_parameters_hash", + "ordinal": 33, + "type_info": "Bytea" }, { "name": "protocol_version", - "ordinal": 10, + "ordinal": 34, "type_info": "Int4" }, { - "name": "picked_by", - "ordinal": 11, - "type_info": "Text" + "name": "compressed_state_diffs", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 36, + "type_info": "ByteaArray" + }, + { + "name": "events_queue_commitment", + "ordinal": 37, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 38, + "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, + false, + true, true ], "parameters": { "Left": [ - "Int8", - "Int4Array", - "Text" + "Bytea", + "Bytea", + "Int4", + "Int8" ] } }, - "query": "\n UPDATE witness_inputs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $3\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM witness_inputs_fri\n WHERE l1_batch_number <= $1\n AND status = 'queued'\n AND protocol_version = ANY($2)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING witness_inputs_fri.*\n " + "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, compressed_state_diffs, system_logs, 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" }, - "3ac1fe562e9664bbf8c02ba3090cf97a37663e228eff48fec326f74b2313daa9": { + "334197fef9eeca55790d366ae67bbe95d77181bdfd2ad3208a32bd50585aef2d": { "describe": { - "columns": [], - "nullable": [], + "columns": [ + { + "name": "hashed_key", + "ordinal": 0, + "type_info": "Bytea" + } + ], + "nullable": [ + false + ], "parameters": { "Left": [ "ByteaArray" ] } }, - "query": "DELETE FROM call_traces\n WHERE tx_hash = ANY($1)" + "query": "SELECT hashed_key FROM initial_writes WHERE hashed_key = ANY($1)" }, - "3af5a385c6636afb16e0fa5eda5373d64a76cef695dfa0b3b156e236224d32c8": { + "335826f54feadf6aa30a4e7668ad3f17a2afc6bd67d4f863e3ad61fefd1bd8d2": { "describe": { "columns": [ { - "name": "l1_batch_number", + "name": "number", "ordinal": 0, "type_info": "Int8" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT MAX(number) as \"number\" FROM miniblocks" + }, + "357347157ed8ff19d223c54533c3a85bd7e64a37514d657f8d49bd6eb5be1806": { + "describe": { + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int4" }, { - "name": "scheduler_witness", + "name": "timestamp", "ordinal": 1, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "final_node_aggregations", + "name": "recursion_scheduler_level_vk_hash", "ordinal": 2, "type_info": "Bytea" }, { - "name": "status", + "name": "recursion_node_level_vk_hash", "ordinal": 3, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "processing_started_at", + "name": "recursion_leaf_level_vk_hash", "ordinal": 4, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "time_taken", + "name": "recursion_circuits_set_vks_hash", "ordinal": 5, - "type_info": "Time" + "type_info": "Bytea" }, { - "name": "error", + "name": "bootloader_code_hash", "ordinal": 6, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "created_at", + "name": "default_account_code_hash", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "updated_at", + "name": "verifier_address", "ordinal": 8, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "attempts", + "name": "upgrade_tx_hash", "ordinal": 9, - "type_info": "Int4" - }, - { - "name": "aggregation_result_coords", - "ordinal": 10, "type_info": "Bytea" }, { - "name": "scheduler_witness_blob_url", - "ordinal": 11, - "type_info": "Text" - }, - { - "name": "final_node_aggregations_blob_url", - "ordinal": 12, - "type_info": "Text" - }, - { - "name": "is_blob_cleaned", - "ordinal": 13, - "type_info": "Bool" - }, - { - "name": "protocol_version", - "ordinal": 14, - "type_info": "Int4" + "name": "created_at", + "ordinal": 10, + "type_info": "Timestamp" } ], "nullable": [ false, false, - true, false, - true, - true, - true, false, false, false, - true, - true, - true, false, - true + false, + false, + true, + false ], "parameters": { - "Left": [ - "Interval", - "Int4", - "Int8", - "Int4Array" - ] - } - }, - "query": "\n UPDATE scheduler_witness_jobs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM scheduler_witness_jobs\n WHERE l1_batch_number <= $3\n AND\n ( status = 'queued'\n OR (status = 'in_progress' AND processing_started_at < now() - $1::interval)\n OR (status = 'failed' AND attempts < $2)\n )\n AND protocol_version = ANY($4)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING scheduler_witness_jobs.*\n " - }, - "3c582aeed32235ef175707de412a9f9129fad6ea5e87ebb85f68e20664b0da46": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int4Array", - "ByteaArray", - "Int8" - ] + "Left": [] } }, - "query": "\n UPDATE transactions\n SET \n l1_batch_number = $3,\n l1_batch_tx_index = data_table.l1_batch_tx_index,\n updated_at = now()\n FROM\n (SELECT\n UNNEST($1::int[]) AS l1_batch_tx_index,\n UNNEST($2::bytea[]) AS hash\n ) AS data_table\n WHERE transactions.hash=data_table.hash \n " + "query": "SELECT * FROM protocol_versions ORDER BY id DESC LIMIT 1" }, - "3d41f05e1d5c5a74e0605e66fe08e09f14b8bf0269e5dcde518aa08db92a3ea0": { + "36c483775b604324eacd7e5aac591b927cc32abb89fe1b0c5cf4b0383e9bd443": { "describe": { - "columns": [], - "nullable": [], + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "leaf_layer_subqueues_blob_url", + "ordinal": 1, + "type_info": "Text" + }, + { + "name": "aggregation_outputs_blob_url", + "ordinal": 2, + "type_info": "Text" + } + ], + "nullable": [ + false, + true, + true + ], "parameters": { "Left": [ "Int8" ] } }, - "query": "DELETE FROM events WHERE miniblock_number > $1" + "query": "\n SELECT l1_batch_number, leaf_layer_subqueues_blob_url, aggregation_outputs_blob_url FROM node_aggregation_witness_jobs\n WHERE status='successful' AND is_blob_cleaned=FALSE\n AND leaf_layer_subqueues_blob_url is NOT NULL\n AND aggregation_outputs_blob_url is NOT NULL\n AND updated_at < NOW() - INTERVAL '30 days'\n LIMIT $1;\n " }, - "3f6332706376ef4cadda96498872429b6ed28eca5402b03b1aa3b77b8262bccd": { + "37e4a0eea7b72bd3b75c26e003f3fa62039d9b614f0f2fa3d61e8c5e95f002fd": { "describe": { - "columns": [], - "nullable": [], + "columns": [ + { + "name": "max?", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + null + ], "parameters": { - "Left": [ - "Text" - ] + "Left": [] } }, - "query": "DELETE FROM compiler_versions WHERE compiler = $1" + "query": "SELECT MAX(index) as \"max?\" FROM initial_writes" }, - "3f671298a05f3f69a8ffb2e36d5ae79c544145fc1c289dd9e0c060dca3ec6e21": { + "38a3bdae346fdd362452af152c6886c93696dd2db561f6622f8eaf6fabb1e5be": { "describe": { - "columns": [], - "nullable": [], + "columns": [ + { + "name": "id", + "ordinal": 0, + "type_info": "Int4" + } + ], + "nullable": [ + false + ], "parameters": { "Left": [ - "ByteaArray", - "ByteaArray" + "Int4", + "Text", + "Timestamp" ] } }, - "query": "UPDATE storage SET value = u.value FROM UNNEST($1::bytea[], $2::bytea[]) AS u(key, value) WHERE u.key = hashed_key" + "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, confirmed_at)\n VALUES ($1, 0, 0, $2, '\\x00', now(), now(), $3)\n RETURNING id" }, - "400bb5f012b95f5b327a65bf8a55e61a9e41a8040f546d75b9b8aa6be45e78d5": { + "394bbd64939d47fda4e1545e2752b208901e872b7234a5c3af456bdf429a6074": { "describe": { "columns": [ { - "name": "number", + "name": "tx_hash", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "hash", + "name": "call_trace", "ordinal": 1, "type_info": "Bytea" } @@ -3016,282 +3115,252 @@ ], "parameters": { "Left": [ - "Int4", - "Int8" - ] - } - }, - "query": "SELECT number, hash FROM miniblocks WHERE protocol_version = $1 ORDER BY number DESC LIMIT $2" - }, - "40a86f39a74ab22bdcd8b40446ea063c68bfb3e930e3150212474a657e82b38f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - "Text" + "Bytea" ] } }, - "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 " + "query": "\n SELECT * FROM call_traces\n WHERE tx_hash = $1\n " }, - "430ffa460ea553cb46c25ebaf1442229cc94f10fd642366e0f827b94f5c0b9f7": { + "3a18d0d1e236d8f57e8b3b1218a24414639a7c8235ba6a514c3d03b8a1790f17": { "describe": { "columns": [ { - "name": "number", + "name": "l1_batch_number", "ordinal": 0, "type_info": "Int8" }, { - "name": "timestamp", + "name": "merkle_tree_paths_blob_url", "ordinal": 1, - "type_info": "Int8" + "type_info": "Text" }, { - "name": "is_finished", + "name": "attempts", "ordinal": 2, - "type_info": "Bool" + "type_info": "Int2" }, { - "name": "l1_tx_count", + "name": "status", "ordinal": 3, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "l2_tx_count", + "name": "error", "ordinal": 4, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "fee_account_address", + "name": "created_at", "ordinal": 5, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "bloom", + "name": "updated_at", "ordinal": 6, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "priority_ops_onchain_data", + "name": "processing_started_at", "ordinal": 7, - "type_info": "ByteaArray" + "type_info": "Timestamp" }, { - "name": "hash", + "name": "time_taken", "ordinal": 8, - "type_info": "Bytea" + "type_info": "Time" }, { - "name": "parent_hash", + "name": "is_blob_cleaned", "ordinal": 9, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "commitment", + "name": "protocol_version", "ordinal": 10, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "compressed_write_logs", + "name": "picked_by", "ordinal": 11, - "type_info": "Bytea" - }, + "type_info": "Text" + } + ], + "nullable": [ + false, + true, + false, + false, + true, + false, + false, + true, + true, + true, + true, + true + ], + "parameters": { + "Left": [ + "Int8", + "Int4Array", + "Text" + ] + } + }, + "query": "\n UPDATE witness_inputs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $3\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM witness_inputs_fri\n WHERE l1_batch_number <= $1\n AND status = 'queued'\n AND protocol_version = ANY($2)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING witness_inputs_fri.*\n " + }, + "3ac1fe562e9664bbf8c02ba3090cf97a37663e228eff48fec326f74b2313daa9": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "ByteaArray" + ] + } + }, + "query": "DELETE FROM call_traces\n WHERE tx_hash = ANY($1)" + }, + "3af5a385c6636afb16e0fa5eda5373d64a76cef695dfa0b3b156e236224d32c8": { + "describe": { + "columns": [ { - "name": "compressed_contracts", - "ordinal": 12, - "type_info": "Bytea" + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" }, { - "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, + "name": "scheduler_witness", + "ordinal": 1, "type_info": "Bytea" }, { - "name": "compressed_repeated_writes", - "ordinal": 21, + "name": "final_node_aggregations", + "ordinal": 2, "type_info": "Bytea" }, { - "name": "l2_l1_compressed_messages", - "ordinal": 22, - "type_info": "Bytea" + "name": "status", + "ordinal": 3, + "type_info": "Text" }, { - "name": "l2_l1_merkle_root", - "ordinal": 23, - "type_info": "Bytea" + "name": "processing_started_at", + "ordinal": 4, + "type_info": "Timestamp" }, { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" + "name": "time_taken", + "ordinal": 5, + "type_info": "Time" }, { - "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" + "name": "error", + "ordinal": 6, + "type_info": "Text" }, { - "name": "rollup_last_leaf_index", - "ordinal": 26, - "type_info": "Int8" + "name": "created_at", + "ordinal": 7, + "type_info": "Timestamp" }, { - "name": "zkporter_is_available", - "ordinal": 27, - "type_info": "Bool" + "name": "updated_at", + "ordinal": 8, + "type_info": "Timestamp" }, { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" + "name": "attempts", + "ordinal": 9, + "type_info": "Int4" }, { - "name": "default_aa_code_hash", - "ordinal": 29, + "name": "aggregation_result_coords", + "ordinal": 10, "type_info": "Bytea" }, { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, - { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" + "name": "scheduler_witness_blob_url", + "ordinal": 11, + "type_info": "Text" }, { - "name": "pass_through_data_hash", - "ordinal": 32, - "type_info": "Bytea" + "name": "final_node_aggregations_blob_url", + "ordinal": 12, + "type_info": "Text" }, { - "name": "meta_parameters_hash", - "ordinal": 33, - "type_info": "Bytea" + "name": "is_blob_cleaned", + "ordinal": 13, + "type_info": "Bool" }, { "name": "protocol_version", - "ordinal": 34, + "ordinal": 14, "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, + false, true ], "parameters": { - "Left": [] + "Left": [ + "Interval", + "Int4", + "Int8", + "Int4Array" + ] } }, - "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" + "query": "\n UPDATE scheduler_witness_jobs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM scheduler_witness_jobs\n WHERE l1_batch_number <= $3\n AND\n ( status = 'queued'\n OR (status = 'in_progress' AND processing_started_at < now() - $1::interval)\n OR (status = 'failed' AND attempts < $2)\n )\n AND protocol_version = ANY($4)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING scheduler_witness_jobs.*\n " }, - "433d5da4d72150cf2c1e1007ee3ff51edfa51924f4b662b8cf382f06e60fd228": { + "3c582aeed32235ef175707de412a9f9129fad6ea5e87ebb85f68e20664b0da46": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int4", - "Int8", - "Text", - "Text" + "Int4Array", + "ByteaArray", + "Int8" ] } }, - "query": "\n UPDATE node_aggregation_witness_jobs\n SET number_of_leaf_circuits = $1,\n leaf_layer_subqueues_blob_url = $3,\n aggregation_outputs_blob_url = $4,\n status = 'waiting_for_proofs',\n updated_at = now()\n WHERE l1_batch_number = $2 AND status != 'queued'\n " + "query": "\n UPDATE transactions\n SET \n l1_batch_number = $3,\n l1_batch_tx_index = data_table.l1_batch_tx_index,\n updated_at = now()\n FROM\n (SELECT\n UNNEST($1::int[]) AS l1_batch_tx_index,\n UNNEST($2::bytea[]) AS hash\n ) AS data_table\n WHERE transactions.hash=data_table.hash \n " }, - "43b5082ff7673ee3a8e8f3fafa64667fac4f7f5c8bd26a21ead6b4ba0f8fd17b": { + "3d41f05e1d5c5a74e0605e66fe08e09f14b8bf0269e5dcde518aa08db92a3ea0": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "DELETE FROM events WHERE miniblock_number > $1" + }, + "3e982e4863eef38069e755e3f20602ef9eaae859d23d86c3f230ddea8805aea7": { "describe": { "columns": [ { - "name": "hash", + "name": "index", "ordinal": 0, - "type_info": "Bytea" + "type_info": "Int8" } ], "nullable": [ @@ -3299,82 +3368,47 @@ ], "parameters": { "Left": [ - "Int8" + "Bytea" ] } }, - "query": "SELECT hash FROM miniblocks WHERE number = $1" + "query": "SELECT index FROM initial_writes WHERE hashed_key = $1" }, - "448d283cab6ae334de9676f69416974656d11563b58e0188d53ca9e0995dd287": { + "3f6332706376ef4cadda96498872429b6ed28eca5402b03b1aa3b77b8262bccd": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8Array" + "Text" ] } }, - "query": "\n UPDATE scheduler_dependency_tracker_fri\n SET status='queued'\n WHERE l1_batch_number = ANY($1)\n " + "query": "DELETE FROM compiler_versions WHERE compiler = $1" }, - "4588d998b3454d8210190c6b16116b5885f6f3e74606aec8250e6c1e8f55d242": { + "3f671298a05f3f69a8ffb2e36d5ae79c544145fc1c289dd9e0c060dca3ec6e21": { "describe": { "columns": [], "nullable": [], - "parameters": { - "Left": [] - } - }, - "query": "VACUUM storage_logs" - }, - "4ab8a25620b5400d836e1b847320d4e176629a27e1a6cb0666ab02bb55371769": { - "describe": { - "columns": [ - { - "name": "hash", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], "parameters": { "Left": [ - "Interval" + "ByteaArray", + "ByteaArray" ] } }, - "query": "DELETE FROM transactions WHERE miniblock_number IS NULL AND received_at < now() - $1::interval AND is_priority=false AND error IS NULL RETURNING hash" - }, - "4ac212a08324b9d4c3febc585109f19105b4d20aa3e290352e3c63d7ec58c5b2": { - "describe": { - "columns": [ - { - "name": "l2_address", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT l2_address FROM tokens" + "query": "UPDATE storage SET value = u.value FROM UNNEST($1::bytea[], $2::bytea[]) AS u(key, value) WHERE u.key = hashed_key" }, - "4ac92a8436108097a32e94e53f7fe99261c7c3a40dbc433c20ccea3a7d06650c": { + "400bb5f012b95f5b327a65bf8a55e61a9e41a8040f546d75b9b8aa6be45e78d5": { "describe": { "columns": [ { - "name": "hashed_key", + "name": "number", "ordinal": 0, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "value!", + "name": "hash", "ordinal": 1, "type_info": "Bytea" } @@ -3385,26 +3419,195 @@ ], "parameters": { "Left": [ - "ByteaArray" + "Int4", + "Int8" ] } }, - "query": "SELECT hashed_key, value as \"value!\" FROM storage WHERE hashed_key = ANY($1)" + "query": "SELECT number, hash FROM miniblocks WHERE protocol_version = $1 ORDER BY number DESC LIMIT $2" }, - "4aef34fb19a07dbfe2be09024d6c7fc2033a8e1570cc7f002a5c78317ff8ff3f": { + "4029dd84cde963ed8541426a659b10ccdbacbf4392664e34bfc29737aa630b28": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ "Int8", - "Int2", - "Text", "Int4", - "Int4" - ] - } - }, + "Int4", + "Int8", + "Bool", + "Bytea", + "ByteaArray", + "ByteaArray", + "Bytea", + "ByteaArray", + "Int8", + "Int8", + "Int8", + "Jsonb", + "Jsonb", + "Numeric", + "Int8", + "Int8", + "Bytea", + "Bytea", + "Int4", + "ByteaArray", + "Int8Array" + ] + } + }, + "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, system_logs, storage_refunds, 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, $22, $23, now(), now())" + }, + "40a86f39a74ab22bdcd8b40446ea063c68bfb3e930e3150212474a657e82b38f": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Text" + ] + } + }, + "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 " + }, + "433d5da4d72150cf2c1e1007ee3ff51edfa51924f4b662b8cf382f06e60fd228": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int4", + "Int8", + "Text", + "Text" + ] + } + }, + "query": "\n UPDATE node_aggregation_witness_jobs\n SET number_of_leaf_circuits = $1,\n leaf_layer_subqueues_blob_url = $3,\n aggregation_outputs_blob_url = $4,\n status = 'waiting_for_proofs',\n updated_at = now()\n WHERE l1_batch_number = $2 AND status != 'queued'\n " + }, + "43b5082ff7673ee3a8e8f3fafa64667fac4f7f5c8bd26a21ead6b4ba0f8fd17b": { + "describe": { + "columns": [ + { + "name": "hash", + "ordinal": 0, + "type_info": "Bytea" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT hash FROM miniblocks WHERE number = $1" + }, + "448d283cab6ae334de9676f69416974656d11563b58e0188d53ca9e0995dd287": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8Array" + ] + } + }, + "query": "\n UPDATE scheduler_dependency_tracker_fri\n SET status='queued'\n WHERE l1_batch_number = ANY($1)\n " + }, + "4588d998b3454d8210190c6b16116b5885f6f3e74606aec8250e6c1e8f55d242": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [] + } + }, + "query": "VACUUM storage_logs" + }, + "4ab8a25620b5400d836e1b847320d4e176629a27e1a6cb0666ab02bb55371769": { + "describe": { + "columns": [ + { + "name": "hash", + "ordinal": 0, + "type_info": "Bytea" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + "Interval" + ] + } + }, + "query": "DELETE FROM transactions WHERE miniblock_number IS NULL AND received_at < now() - $1::interval AND is_priority=false AND error IS NULL RETURNING hash" + }, + "4ac212a08324b9d4c3febc585109f19105b4d20aa3e290352e3c63d7ec58c5b2": { + "describe": { + "columns": [ + { + "name": "l2_address", + "ordinal": 0, + "type_info": "Bytea" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT l2_address FROM tokens" + }, + "4ac92a8436108097a32e94e53f7fe99261c7c3a40dbc433c20ccea3a7d06650c": { + "describe": { + "columns": [ + { + "name": "hashed_key", + "ordinal": 0, + "type_info": "Bytea" + }, + { + "name": "value!", + "ordinal": 1, + "type_info": "Bytea" + } + ], + "nullable": [ + false, + false + ], + "parameters": { + "Left": [ + "ByteaArray" + ] + } + }, + "query": "SELECT hashed_key, value as \"value!\" FROM storage WHERE hashed_key = ANY($1)" + }, + "4aef34fb19a07dbfe2be09024d6c7fc2033a8e1570cc7f002a5c78317ff8ff3f": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Int2", + "Text", + "Int4", + "Int4" + ] + } + }, "query": "\n INSERT INTO leaf_aggregation_witness_jobs_fri\n (l1_batch_number, circuit_id, closed_form_inputs_blob_url, number_of_basic_circuits, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, 'waiting_for_proofs', now(), now())\n ON CONFLICT(l1_batch_number, circuit_id)\n DO UPDATE SET updated_at=now()\n " }, "4b8597a47c0724155ad9592dc32134523bcbca11c9d82763d1bebbe17479c7b4": { @@ -4623,111 +4826,17 @@ }, "query": "\n UPDATE prover_jobs_fri\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now(),\n picked_by = $4\n WHERE id = (\n SELECT id\n FROM prover_jobs_fri\n WHERE status = 'queued'\n AND (circuit_id, aggregation_round) IN (\n SELECT * FROM UNNEST($1::smallint[], $2::smallint[])\n )\n AND protocol_version = ANY($3)\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_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 " }, - "65e2cdb70ccef97d886fb53d1bb298875e13b0ffe7b744ac5dd86433f0929eb0": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - { - "Custom": { - "kind": { - "Enum": [ - "Queued", - "ManuallySkipped", - "InProgress", - "Successful", - "Failed" - ] - }, - "name": "basic_witness_input_producer_job_status" - } - }, - "Int8", - "Time", - "Text" - ] - } - }, - "query": "UPDATE basic_witness_input_producer_jobs SET status = $1, updated_at = now(), time_taken = $3, input_blob_url = $4 WHERE l1_batch_number = $2" - }, - "665112c83ed7f126f94d1c47408de3495ee6431970e334d94ae75f853496eb48": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8" - ] - } - }, - "query": "\n UPDATE node_aggregation_witness_jobs_fri\n SET status ='failed', error= $1, updated_at = now()\n WHERE id = $2\n " - }, - "67a47f1e7d5f8dafcef94bea3f268b4baec1888c6ef11c92ab66480ecdcb9aef": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Time", - "Bytea", - "Text", - "Int8" - ] - } - }, - "query": "\n UPDATE prover_jobs\n SET status = 'successful', updated_at = now(), time_taken = $1, result = $2, proccesed_by = $3\n WHERE id = $4\n " - }, - "67ecdc69e39e689f1f23f867d31e6b8c47e9c041e18cbd84a2ad6482a9be4e74": { + "65a31949cd7f8890e9448d26a0efee852ddf59bfbbc858b51fba10048d47d27b": { "describe": { "columns": [ { - "name": "l2_to_l1_logs", + "name": "number", "ordinal": 0, - "type_info": "ByteaArray" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT l2_to_l1_logs FROM l1_batches WHERE number = $1" - }, - "67efc7ea5bd3821d8325759ed8357190f6122dd2ae503a57faf15d8b749a4361": { - "describe": { - "columns": [ + "type_info": "Int8" + }, { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [] - } - }, - "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 " - }, - "68130d145d314f1076ef6becb5fae8ec9401ac211a5bb98c9791fac93521a0c2": { - "describe": { - "columns": [ - { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "timestamp", - "ordinal": 1, + "name": "timestamp", + "ordinal": 1, "type_info": "Int8" }, { @@ -4891,18 +5000,28 @@ "type_info": "Bytea" }, { - "name": "protocol_version", + "name": "system_logs", "ordinal": 34, + "type_info": "ByteaArray" + }, + { + "name": "compressed_state_diffs", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "protocol_version", + "ordinal": 36, "type_info": "Int4" }, { "name": "events_queue_commitment", - "ordinal": 35, + "ordinal": 37, "type_info": "Bytea" }, { "name": "bootloader_initial_content_commitment", - "ordinal": 36, + "ordinal": 38, "type_info": "Bytea" } ], @@ -4941,17 +5060,114 @@ true, true, true, + false, + 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, system_logs, compressed_state_diffs, 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" + }, + "65e2cdb70ccef97d886fb53d1bb298875e13b0ffe7b744ac5dd86433f0929eb0": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + { + "Custom": { + "kind": { + "Enum": [ + "Queued", + "ManuallySkipped", + "InProgress", + "Successful", + "Failed" + ] + }, + "name": "basic_witness_input_producer_job_status" + } + }, + "Int8", + "Time", + "Text" + ] + } + }, + "query": "UPDATE basic_witness_input_producer_jobs SET status = $1, updated_at = now(), time_taken = $3, input_blob_url = $4 WHERE l1_batch_number = $2" + }, + "665112c83ed7f126f94d1c47408de3495ee6431970e334d94ae75f853496eb48": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Text", + "Int8" + ] + } + }, + "query": "\n UPDATE node_aggregation_witness_jobs_fri\n SET status ='failed', error= $1, updated_at = now()\n WHERE id = $2\n " + }, + "67a47f1e7d5f8dafcef94bea3f268b4baec1888c6ef11c92ab66480ecdcb9aef": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Time", + "Bytea", + "Text", + "Int8" + ] + } + }, + "query": "\n UPDATE prover_jobs\n SET status = 'successful', updated_at = now(), time_taken = $1, result = $2, proccesed_by = $3\n WHERE id = $4\n " + }, + "67ecdc69e39e689f1f23f867d31e6b8c47e9c041e18cbd84a2ad6482a9be4e74": { + "describe": { + "columns": [ + { + "name": "l2_to_l1_logs", + "ordinal": 0, + "type_info": "ByteaArray" + } + ], + "nullable": [ + false + ], "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, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE number = $1" + "query": "SELECT l2_to_l1_logs FROM l1_batches WHERE number = $1" + }, + "67efc7ea5bd3821d8325759ed8357190f6122dd2ae503a57faf15d8b749a4361": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [] + } + }, + "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 " }, "68a9ba78f60674bc047e4af6eb2a379725da047f2e6c06bce96a33852565cc95": { "describe": { @@ -5164,357 +5380,119 @@ }, "query": "\n SELECT protocol_version\n FROM witness_inputs\n WHERE l1_batch_number = $1\n " }, - "7091a5c10a913f053129a76299d2e6fe7081473456888d30fb41b23a01d28690": { + "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": "number", + "name": "l1_batch_number", "ordinal": 0, "type_info": "Int8" }, { - "name": "timestamp", + "name": "basic_circuits_blob_url", "ordinal": 1, - "type_info": "Int8" + "type_info": "Text" }, { - "name": "is_finished", + "name": "basic_circuits_inputs_blob_url", "ordinal": 2, - "type_info": "Bool" - }, - { - "name": "l1_tx_count", - "ordinal": 3, - "type_info": "Int4" - }, + "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 " + }, + "741b13b0a4769a30186c650a4a1b24855806a27ccd8d5a50594741842dde44ec": { + "describe": { + "columns": [ { - "name": "l2_tx_count", - "ordinal": 4, - "type_info": "Int4" + "name": "min?", + "ordinal": 0, + "type_info": "Int8" }, { - "name": "fee_account_address", - "ordinal": 5, - "type_info": "Bytea" - }, + "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": "bloom", - "ordinal": 6, - "type_info": "Bytea" - }, + "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": "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", - "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 l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE number BETWEEN $1 AND $2 ORDER BY number LIMIT $3" - }, - "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 " - }, - "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": "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, @@ -5532,352 +5510,140 @@ }, "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" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "ByteaArray" - ] - } - }, - "query": "SELECT (SELECT ARRAY[address,key] FROM storage_logs WHERE hashed_key = u.hashed_key ORDER BY miniblock_number, operation_number LIMIT 1) as \"address_and_key?\" FROM UNNEST($1::bytea[]) AS u(hashed_key)" - }, - "7889294ffe999d3c8b3b093d3add7f9b826e8259451068aeaeca0da0772648e8": { - "describe": { - "columns": [ - { - "name": "count!", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [] - } - }, - "query": "\n SELECT COUNT(*) as \"count!\"\n FROM contract_verification_requests\n WHERE status = 'queued'\n " - }, - "79420f7676acb3f17aeb538271cdb4067a342fd554adcf7bd0550b6682b4c82b": { - "describe": { - "columns": [ - { - "name": "tx_hash", - "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "call_trace", - "ordinal": 1, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT * FROM call_traces WHERE tx_hash IN (SELECT hash FROM transactions WHERE miniblock_number = $1)" - }, - "7a5aba2130fec60318266c8059d3757cd78eb6099d50486b4996fb4090c99622": { + "77d78689b5c0b631da047f21c89a607213bec507cd9cf2b5cb4ea86e1a084796": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8", "Bytea", "Bytea", - "Text", - "Text", - "Int4", - "Int4" - ] - } - }, - "query": "\n INSERT INTO leaf_aggregation_witness_jobs\n (l1_batch_number, basic_circuits, basic_circuits_inputs, basic_circuits_blob_url, basic_circuits_inputs_blob_url, number_of_basic_circuits, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, 'waiting_for_proofs', now(), now())\n " - }, - "7acba1f016450b084a5fd97199a757a471f8b8a880a800c29737f1bceae3ff46": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "merkel_tree_paths_blob_url", - "ordinal": 1, - "type_info": "Text" - } - ], - "nullable": [ - false, - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "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" - }, - "7b71d5390f82b405eab5373ba05448ed7189338da059817d158d3607efe3efd1": { - "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" - }, + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bool", + "Bytea", + "Int8", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Int8" + ] + } + }, + "query": "UPDATE l1_batches SET hash = $1, merkle_root_hash = $2, commitment = $3, default_aa_code_hash = $4, compressed_repeated_writes = $5, compressed_initial_writes = $6, l2_l1_compressed_messages = $7, l2_l1_merkle_root = $8, zkporter_is_available = $9, bootloader_code_hash = $10, rollup_last_leaf_index = $11, aux_data_hash = $12, pass_through_data_hash = $13, meta_parameters_hash = $14, compressed_state_diffs = $15, updated_at = now() WHERE number = $16" + }, + "780b30e56a3ecfb3daa5310168ac6cd9e94bd5f1d871e1eaf36fbfd463a5e7e0": { + "describe": { + "columns": [ { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, + "name": "address_and_key?", + "ordinal": 0, + "type_info": "ByteaArray" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [ + "ByteaArray" + ] + } + }, + "query": "SELECT (SELECT ARRAY[address,key] FROM storage_logs WHERE hashed_key = u.hashed_key ORDER BY miniblock_number, operation_number LIMIT 1) as \"address_and_key?\" FROM UNNEST($1::bytea[]) AS u(hashed_key)" + }, + "7889294ffe999d3c8b3b093d3add7f9b826e8259451068aeaeca0da0772648e8": { + "describe": { + "columns": [ { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" - }, + "name": "count!", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [] + } + }, + "query": "\n SELECT COUNT(*) as \"count!\"\n FROM contract_verification_requests\n WHERE status = 'queued'\n " + }, + "79420f7676acb3f17aeb538271cdb4067a342fd554adcf7bd0550b6682b4c82b": { + "describe": { + "columns": [ { - "name": "pass_through_data_hash", - "ordinal": 32, + "name": "tx_hash", + "ordinal": 0, "type_info": "Bytea" }, { - "name": "meta_parameters_hash", - "ordinal": 33, + "name": "call_trace", + "ordinal": 1, "type_info": "Bytea" - }, - { - "name": "protocol_version", - "ordinal": 34, - "type_info": "Int4" - }, + } + ], + "nullable": [ + false, + false + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT * FROM call_traces WHERE tx_hash IN (SELECT hash FROM transactions WHERE miniblock_number = $1)" + }, + "7a5aba2130fec60318266c8059d3757cd78eb6099d50486b4996fb4090c99622": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8", + "Bytea", + "Bytea", + "Text", + "Text", + "Int4", + "Int4" + ] + } + }, + "query": "\n INSERT INTO leaf_aggregation_witness_jobs\n (l1_batch_number, basic_circuits, basic_circuits_inputs, basic_circuits_blob_url, basic_circuits_inputs_blob_url, number_of_basic_circuits, protocol_version, status, created_at, updated_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, 'waiting_for_proofs', now(), now())\n " + }, + "7acba1f016450b084a5fd97199a757a471f8b8a880a800c29737f1bceae3ff46": { + "describe": { + "columns": [ { - "name": "events_queue_commitment", - "ordinal": 35, - "type_info": "Bytea" + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" }, { - "name": "bootloader_initial_content_commitment", - "ordinal": 36, - "type_info": "Bytea" + "name": "merkel_tree_paths_blob_url", + "ordinal": 1, + "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, - true, - true, - true, - true, - false, - true, - true, - true, - true, - true, true ], "parameters": { "Left": [ - "Bytea", - "Bytea", - "Int4", "Int8" ] } }, - "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" + "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": { @@ -6093,72 +5859,194 @@ }, "query": "UPDATE miniblocks SET l1_batch_number = $1 WHERE l1_batch_number IS NULL" }, - "8045a697a6a1070857b6fdc656f60ee6bab4b3a875ab98099beee227c199f818": { + "8045a697a6a1070857b6fdc656f60ee6bab4b3a875ab98099beee227c199f818": { + "describe": { + "columns": [ + { + "name": "miniblock_number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "log_index_in_miniblock", + "ordinal": 1, + "type_info": "Int4" + }, + { + "name": "log_index_in_tx", + "ordinal": 2, + "type_info": "Int4" + }, + { + "name": "tx_hash", + "ordinal": 3, + "type_info": "Bytea" + }, + { + "name": "block_hash", + "ordinal": 4, + "type_info": "Bytea" + }, + { + "name": "l1_batch_number?", + "ordinal": 5, + "type_info": "Int8" + }, + { + "name": "shard_id", + "ordinal": 6, + "type_info": "Int4" + }, + { + "name": "is_service", + "ordinal": 7, + "type_info": "Bool" + }, + { + "name": "tx_index_in_miniblock", + "ordinal": 8, + "type_info": "Int4" + }, + { + "name": "tx_index_in_l1_batch", + "ordinal": 9, + "type_info": "Int4" + }, + { + "name": "sender", + "ordinal": 10, + "type_info": "Bytea" + }, + { + "name": "key", + "ordinal": 11, + "type_info": "Bytea" + }, + { + "name": "value", + "ordinal": 12, + "type_info": "Bytea" + } + ], + "nullable": [ + false, + false, + false, + false, + null, + null, + false, + false, + false, + false, + false, + false, + false + ], + "parameters": { + "Left": [ + "Bytea" + ] + } + }, + "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" + }, + "832105952074e4ff35252d8e7973faa1b24455abc89820307db5e49a834c0718": { "describe": { "columns": [ { - "name": "miniblock_number", + "name": "number", "ordinal": 0, "type_info": "Int8" }, { - "name": "log_index_in_miniblock", + "name": "l1_tx_count", "ordinal": 1, "type_info": "Int4" }, { - "name": "log_index_in_tx", + "name": "l2_tx_count", "ordinal": 2, "type_info": "Int4" }, { - "name": "tx_hash", + "name": "timestamp", "ordinal": 3, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "block_hash", + "name": "is_finished", "ordinal": 4, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "l1_batch_number?", + "name": "fee_account_address", "ordinal": 5, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "shard_id", + "name": "l2_to_l1_logs", "ordinal": 6, - "type_info": "Int4" + "type_info": "ByteaArray" }, { - "name": "is_service", + "name": "l2_to_l1_messages", "ordinal": 7, - "type_info": "Bool" + "type_info": "ByteaArray" }, { - "name": "tx_index_in_miniblock", + "name": "bloom", "ordinal": 8, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "tx_index_in_l1_batch", + "name": "priority_ops_onchain_data", "ordinal": 9, - "type_info": "Int4" + "type_info": "ByteaArray" }, { - "name": "sender", + "name": "used_contract_hashes", "ordinal": 10, - "type_info": "Bytea" + "type_info": "Jsonb" }, { - "name": "key", + "name": "base_fee_per_gas", "ordinal": 11, - "type_info": "Bytea" + "type_info": "Numeric" }, { - "name": "value", + "name": "l1_gas_price", "ordinal": 12, + "type_info": "Int8" + }, + { + "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" + }, + { + "name": "system_logs", + "ordinal": 17, + "type_info": "ByteaArray" + }, + { + "name": "compressed_state_diffs", + "ordinal": 18, "type_info": "Bytea" } ], @@ -6167,23 +6055,29 @@ false, false, false, - null, - null, false, false, false, false, false, false, - false + false, + false, + false, + false, + true, + true, + true, + false, + true ], "parameters": { "Left": [ - "Bytea" + "Int4" ] } }, - "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_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, system_logs, compressed_state_diffs FROM l1_batches WHERE eth_commit_tx_id = $1 OR eth_prove_tx_id = $1 OR eth_execute_tx_id = $1" }, "84703029e09ab1362aa4b4177b38be594d2daf17e69508cae869647028055efb": { "describe": { @@ -6212,7 +6106,7 @@ }, "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 )" }, - "852b8d72a8dcbf620e528e983b836b2b05596eb0b7c5d7d1791080bef6a6b821": { + "85ac7fb2c4175d662c8f466e722d28b0eadcd2f252a788e366dbd05eac547b93": { "describe": { "columns": [ { @@ -6221,24 +6115,24 @@ "type_info": "Int8" }, { - "name": "l1_tx_count", + "name": "timestamp", "ordinal": 1, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "l2_tx_count", + "name": "is_finished", "ordinal": 2, - "type_info": "Int4" + "type_info": "Bool" }, { - "name": "timestamp", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "is_finished", + "name": "l2_tx_count", "ordinal": 4, - "type_info": "Bool" + "type_info": "Int4" }, { "name": "fee_account_address", @@ -6246,59 +6140,169 @@ "type_info": "Bytea" }, { - "name": "l2_to_l1_logs", + "name": "bloom", "ordinal": 6, - "type_info": "ByteaArray" + "type_info": "Bytea" }, { - "name": "l2_to_l1_messages", + "name": "priority_ops_onchain_data", "ordinal": 7, "type_info": "ByteaArray" }, { - "name": "bloom", + "name": "hash", "ordinal": 8, "type_info": "Bytea" }, { - "name": "priority_ops_onchain_data", + "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": 10, + "ordinal": 19, "type_info": "Jsonb" }, { - "name": "base_fee_per_gas", - "ordinal": 11, - "type_info": "Numeric" + "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": 12, + "ordinal": 24, "type_info": "Int8" }, { "name": "l2_fair_gas_price", - "ordinal": 13, + "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": 14, + "ordinal": 28, "type_info": "Bytea" }, { "name": "default_aa_code_hash", - "ordinal": 15, + "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": 16, + "ordinal": 34, "type_info": "Int4" + }, + { + "name": "compressed_state_diffs", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 36, + "type_info": "ByteaArray" + }, + { + "name": "events_queue_commitment", + "ordinal": 37, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 38, + "type_info": "Bytea" } ], "nullable": [ @@ -6310,23 +6314,43 @@ 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, + false, + true, true ], "parameters": { - "Left": [ - "Int8" - ] + "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 WHERE number = $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, compressed_state_diffs, system_logs, events_queue_commitment, bootloader_initial_content_commitment\n 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" }, "85c52cb09c73499507144e3a684c3230c2c71eb4f8ddef43e67fbd33de2747c8": { "describe": { @@ -6779,133 +6803,203 @@ }, "query": "SELECT l1_address FROM tokens WHERE well_known = false" }, - "9008367aad7877f269b765c4d0772d0f60689fcde6987c620fe5749a259a8db7": { - "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": [ - { - "name": "protocol_version", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - true - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT protocol_version FROM l1_batches WHERE number = $1" - }, - "95ce099fde99c57a930ed3d44f74a90d632b831360210ec7fe21b33bed1a4582": { + "8ff84e800faad1a10eedf537195d37a74a68d8020f286444824d6ccac6727003": { "describe": { "columns": [ { - "name": "id", + "name": "number", "ordinal": 0, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "nonce", + "name": "timestamp", "ordinal": 1, "type_info": "Int8" }, { - "name": "raw_tx", + "name": "is_finished", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "contract_address", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "tx_type", + "name": "l2_tx_count", "ordinal": 4, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "gas_used", + "name": "fee_account_address", "ordinal": 5, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "created_at", + "name": "bloom", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "updated_at", + "name": "priority_ops_onchain_data", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "ByteaArray" }, { - "name": "has_failed", + "name": "hash", "ordinal": 8, - "type_info": "Bool" + "type_info": "Bytea" }, { - "name": "sent_at_block", + "name": "parent_hash", "ordinal": 9, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "confirmed_eth_tx_history_id", + "name": "commitment", "ordinal": 10, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "predicted_gas_cost", + "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": "compressed_state_diffs", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 36, + "type_info": "ByteaArray" + }, + { + "name": "events_queue_commitment", + "ordinal": 37, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 38, + "type_info": "Bytea" } ], "nullable": [ @@ -6914,176 +7008,270 @@ 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, - false + true, + true, + true, + false, + true, + true ], "parameters": { "Left": [ - "Bytea", - "Int8", - "Text", - "Text", "Int8" ] } }, - "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 *" - }, - "95e0e783794ac55ab20b30366f037c313fb0d17e93d3e6ec60667ef1b4da30d5": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8Array" - ] - } - }, - "query": "\n UPDATE prover_jobs\n SET is_blob_cleaned=TRUE\n WHERE id = ANY($1);\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, compressed_state_diffs, system_logs, 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" }, - "96b1cd2bb6861064b633d597a4a09d279dbc7bcd7a810a7270da3d7941af0fff": { + "9008367aad7877f269b765c4d0772d0f60689fcde6987c620fe5749a259a8db7": { "describe": { "columns": [ { - "name": "count!", + "name": "id", "ordinal": 0, - "type_info": "Int8" + "type_info": "Int4" } ], "nullable": [ - null + false ], "parameters": { "Left": [ - "Bytea", - "Bytea" - ] - } - }, - "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" - }, - "96f6d06a49646f93ba1918080ef1efba868d506c6b51ede981e610f1b57bf88b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "ByteaArray" - ] - } - }, - "query": "DELETE FROM storage WHERE hashed_key = ANY($1)" - }, - "987fcbbd716648c7c368462643f13d8001d5c6d197add90613ae21d21fdef79b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ + "Int4", + "Int8", + "Int8", "Text", - "Int8" + "Bytea" ] } }, - "query": "UPDATE prover_jobs_fri SET status = $1, updated_at = now() WHERE id = $2" + "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" }, - "9970bb69f5ca9ab9f103e1547eb40c1d4f5dd3a540ff6f1b9724821350c9501a": { + "9051cc1a715e152afdd0c19739c76666b1a9b134e17601ef9fdf3dec5d2fc561": { "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": "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": 17, + "ordinal": 34, "type_info": "Int4" + }, + { + "name": "compressed_state_diffs", + "ordinal": 35, + "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 36, + "type_info": "ByteaArray" + }, + { + "name": "events_queue_commitment", + "ordinal": 37, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 38, + "type_info": "Bytea" } ], "nullable": [ @@ -7092,82 +7280,58 @@ 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, - false, + true, + true, + true, true, true, false, + true, true ], - "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" + "Int8", + "Int8" ] } }, - "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": "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, compressed_state_diffs, system_logs, 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" }, - "9b4d87f7d7cabe0d61f10d26bb856cce3dc7f36f521efbb6992d98937e5a91ba": { + "91db60cc4f98ebcaef1435342607da0a86fe16e20a696cb81a569772d5d5ae88": { "describe": { "columns": [ { - "name": "id", + "name": "value", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" } ], "nullable": [ @@ -7176,163 +7340,94 @@ "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": "\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 " }, - "9bf32ea710825c1f0560a7eaa89f8f097ad196755ba82d98a729a2b0d34e1aca": { + "957ceda740ffb36740acf1e3fbacf76a2ea7422dd9d76a38d745113359e4b7a6": { "describe": { "columns": [ { - "name": "successful_limit!", + "name": "protocol_version", "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "queued_limit!", - "ordinal": 1, - "type_info": "Int8" - }, - { - "name": "max_block!", - "ordinal": 2, - "type_info": "Int8" + "type_info": "Int4" } ], "nullable": [ - null, - null, - null + true ], - "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": "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 " + "query": "SELECT protocol_version FROM l1_batches WHERE number = $1" }, - "9feee3fd267dc4e58185aeae7cab798c03eefa69470e4b98716615cecf6c012a": { + "95ce099fde99c57a930ed3d44f74a90d632b831360210ec7fe21b33bed1a4582": { "describe": { "columns": [ { "name": "id", "ordinal": 0, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "contract_address", + "name": "nonce", "ordinal": 1, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "source_code", + "name": "raw_tx", "ordinal": 2, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "contract_name", + "name": "contract_address", "ordinal": 3, "type_info": "Text" }, { - "name": "zk_compiler_version", + "name": "tx_type", "ordinal": 4, "type_info": "Text" }, { - "name": "compiler_version", + "name": "gas_used", "ordinal": 5, - "type_info": "Text" + "type_info": "Int8" }, { - "name": "optimization_used", + "name": "created_at", "ordinal": 6, - "type_info": "Bool" + "type_info": "Timestamp" }, { - "name": "optimizer_mode", + "name": "updated_at", "ordinal": 7, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "constructor_arguments", + "name": "has_failed", "ordinal": 8, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "is_system", + "name": "sent_at_block", "ordinal": 9, - "type_info": "Bool" + "type_info": "Int4" + }, + { + "name": "confirmed_eth_tx_history_id", + "ordinal": 10, + "type_info": "Int4" + }, + { + "name": "predicted_gas_cost", + "ordinal": 11, + "type_info": "Int8" } ], "nullable": [ @@ -7341,254 +7436,424 @@ false, false, false, + true, false, false, - true, false, + true, + true, false ], "parameters": { "Left": [ - "Interval" + "Bytea", + "Int8", + "Text", + "Text", + "Int8" + ] + } + }, + "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 *" + }, + "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": "count!", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [ + "Bytea", + "Bytea" + ] + } + }, + "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" + }, + "96f6d06a49646f93ba1918080ef1efba868d506c6b51ede981e610f1b57bf88b": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "ByteaArray" ] } }, - "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": "DELETE FROM storage WHERE hashed_key = ANY($1)" }, - "a074cd2c23434a8e801c2c0b42e63f1657765aceabd6d8a50ef2d2299bba99ab": { + "97d81c27885fda4390ebc9789c6169cb94a449f583f7819ec74286fb0d9f81d5": { "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": "closed_form_inputs_blob_url", + "name": "l1_tx_count", "ordinal": 3, - "type_info": "Text" + "type_info": "Int4" }, { - "name": "attempts", + "name": "l2_tx_count", "ordinal": 4, - "type_info": "Int2" + "type_info": "Int4" }, { - "name": "status", + "name": "fee_account_address", "ordinal": 5, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "error", + "name": "bloom", "ordinal": 6, - "type_info": "Text" + "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": "processing_started_at", + "name": "parent_hash", "ordinal": 9, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "time_taken", + "name": "commitment", "ordinal": 10, - "type_info": "Time" + "type_info": "Bytea" }, { - "name": "is_blob_cleaned", + "name": "compressed_write_logs", "ordinal": 11, - "type_info": "Bool" + "type_info": "Bytea" }, { - "name": "number_of_basic_circuits", + "name": "compressed_contracts", "ordinal": 12, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "protocol_version", + "name": "eth_prove_tx_id", "ordinal": 13, "type_info": "Int4" }, { - "name": "picked_by", + "name": "eth_commit_tx_id", "ordinal": 14, - "type_info": "Text" + "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": "system_logs", + "ordinal": 35, + "type_info": "ByteaArray" + }, + { + "name": "compressed_state_diffs", + "ordinal": 36, + "type_info": "Bytea" + }, + { + "name": "events_queue_commitment", + "ordinal": 37, + "type_info": "Bytea" + }, + { + "name": "bootloader_initial_content_commitment", + "ordinal": 38, + "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, + false, + true, true, true ], "parameters": { "Left": [ - "Int4Array", - "Text" - ] - } - }, - "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 " - }, - "a0aa877e052e63b1c3df6fc4432eeb44f7f3930f624e66b034baa1c5d0f8bb30": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Int8", - { - "Custom": { - "kind": { - "Enum": [ - "Queued", - "ManuallySkipped", - "InProgress", - "Successful", - "Failed" - ] - }, - "name": "basic_witness_input_producer_job_status" - } - } - ] - } - }, - "query": "INSERT INTO basic_witness_input_producer_jobs (l1_batch_number, status, created_at, updated_at) VALUES ($1, $2, now(), now()) ON CONFLICT (l1_batch_number) DO NOTHING" - }, - "a19b7137403c5cdf1be5f5122ce4d297ed661fa8bdb3bc91f8a81fe9da47469e": { - "describe": { - "columns": [ - { - "name": "upgrade_tx_hash", - "ordinal": 0, - "type_info": "Bytea" - } - ], - "nullable": [ - true - ], - "parameters": { - "Left": [ - "Int4" + "Int8" ] } }, - "query": "\n SELECT upgrade_tx_hash FROM protocol_versions\n WHERE id = $1\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, system_logs, compressed_state_diffs, events_queue_commitment, bootloader_initial_content_commitment FROM l1_batches LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number WHERE number = $1" }, - "a1a6b52403c1db35c8d83d0a512ac453ecd54b34ec516027d540ee1890b40291": { + "987fcbbd716648c7c368462643f13d8001d5c6d197add90613ae21d21fdef79b": { "describe": { "columns": [], "nullable": [], "parameters": { - "Left": [ - "Int4", - "Bytea", - "Bytea", - "Bytea", - "Bytea" + "Left": [ + "Text", + "Int8" ] } }, - "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": "UPDATE prover_jobs_fri SET status = $1, updated_at = now() WHERE id = $2" }, - "a39f760d2cd879a78112e57d8611d7099802b03b7cc4933cafb4c47e133ad543": { + "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": [ @@ -7597,228 +7862,222 @@ false, false, false, + true, + true, + false, + false, false, - null, - null, false, + true, false, false, + true, + true, false, - 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" - }, - "a4f240188c1447f5b6dcef33dfcc9d00b105f62a6b4c3949a825bea979954160": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [] - } - }, - "query": "DELETE FROM basic_witness_input_producer_jobs" + "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" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT MAX(operation_number) as \"max?\" FROM storage_logs WHERE miniblock_number = $1" - }, - "a9b1a31def214f8b1441dc3ab720bd270f3991c9f1c7528256276e176d532163": { - "describe": { - "columns": [ + "type_info": "Int8" + }, { - "name": "l1_batch_number", - "ordinal": 0, + "name": "queued_limit!", + "ordinal": 1, + "type_info": "Int8" + }, + { + "name": "max_block!", + "ordinal": 2, "type_info": "Int8" } ], "nullable": [ - false + null, + null, + null ], "parameters": { - "Left": [ - "Bytea" - ] + "Left": [] } }, - "query": "SELECT l1_batch_number FROM initial_writes WHERE hashed_key = $1" + "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 " }, - "a9d96d6774af2637173d471f02995652cd4c131c05fdcb3d0e1644bcd1aa1809": { + "9d28c1be3bda0c4fb37567d4a56730e801f48fbb2abad42ea894ebd8ee40412d": { "describe": { - "columns": [ - { - "name": "proof", - "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "aggregation_result_coords", - "ordinal": 1, - "type_info": "Bytea" - } - ], - "nullable": [ - true, - true - ], + "columns": [], + "nullable": [], "parameters": { "Left": [ "Int8", - "Int8" + "Int2", + "Text", + "Int2", + "Int4", + "Int4", + "Bool", + "Int4" ] } }, - "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 " + "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 " }, - "aa1534f03679fd2d1d9e7c1da1f94cc0e2ec5fc3a0e1ac7137147533eacf0aaf": { + "9feee3fd267dc4e58185aeae7cab798c03eefa69470e4b98716615cecf6c012a": { "describe": { "columns": [ { "name": "id", "ordinal": 0, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "nonce", + "name": "contract_address", "ordinal": 1, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "raw_tx", + "name": "source_code", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "contract_address", + "name": "contract_name", "ordinal": 3, "type_info": "Text" }, { - "name": "tx_type", + "name": "zk_compiler_version", "ordinal": 4, "type_info": "Text" }, { - "name": "gas_used", + "name": "compiler_version", "ordinal": 5, - "type_info": "Int8" + "type_info": "Text" }, { - "name": "created_at", + "name": "optimization_used", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Bool" }, { - "name": "updated_at", + "name": "optimizer_mode", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "Text" }, { - "name": "has_failed", + "name": "constructor_arguments", "ordinal": 8, - "type_info": "Bool" + "type_info": "Bytea" }, { - "name": "sent_at_block", + "name": "is_system", "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" + "type_info": "Bool" } ], "nullable": [ @@ -7827,306 +8086,254 @@ false, false, false, - true, - false, false, false, true, - true, - false - ], - "parameters": { - "Left": [ - "Int8" - ] - } - }, - "query": "SELECT * FROM eth_txs \n WHERE id > (SELECT COALESCE(MAX(eth_tx_id), 0) FROM eth_txs_history)\n ORDER BY id\n LIMIT $1\n " - }, - "aa279ce3351b30788711be6c65cb99cb14304ac38f8fed6d332237ffafc7c86b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Time", - "Text", - "Int8" - ] - } - }, - "query": "UPDATE proof_compression_jobs_fri SET status = $1, updated_at = now(), time_taken = $2, l1_proof_blob_url = $3WHERE l1_batch_number = $4" - }, - "aa7ae476aed5979227887891e9be995924588aa10ccba7424d6ce58f811eaa02": { - "describe": { - "columns": [ - { - "name": "number!", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - null - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT COALESCE(MAX(number), 0) AS \"number!\" FROM l1_batches WHERE eth_prove_tx_id IS NOT NULL" - }, - "aacaeff95b9a2988167dde78200d7139ba99edfa30dbcd8a7a57f72efc676477": { - "describe": { - "columns": [ - { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ + false, false ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT number FROM l1_batches LEFT JOIN eth_txs_history AS commit_tx ON (l1_batches.eth_commit_tx_id = commit_tx.eth_tx_id) WHERE commit_tx.confirmed_at IS NOT NULL ORDER BY number DESC LIMIT 1" - }, - "ac35fb205c83d82d78983f4c9b47f56d3c91fbb2c95046555c7d60a9a2ebb446": { - "describe": { - "columns": [], - "nullable": [], "parameters": { "Left": [ - "ByteaArray", - "Int8Array", - "Int8" + "Interval" ] } }, - "query": "INSERT INTO initial_writes (hashed_key, index, l1_batch_number, created_at, updated_at) SELECT u.hashed_key, u.index, $3, now(), now() FROM UNNEST($1::bytea[], $2::bigint[]) AS u(hashed_key, index)" + "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 " }, - "ad11ec3e628ae6c64ac160d8dd689b2f64033f620e17a31469788b3ce4968ad3": { + "a074cd2c23434a8e801c2c0b42e63f1657765aceabd6d8a50ef2d2299bba99ab": { "describe": { "columns": [ { "name": "id", "ordinal": 0, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "eth_tx_id", + "name": "l1_batch_number", "ordinal": 1, - "type_info": "Int4" + "type_info": "Int8" }, { - "name": "tx_hash", + "name": "circuit_id", "ordinal": 2, - "type_info": "Text" + "type_info": "Int2" }, { - "name": "created_at", + "name": "closed_form_inputs_blob_url", "ordinal": 3, - "type_info": "Timestamp" + "type_info": "Text" }, { - "name": "updated_at", + "name": "attempts", "ordinal": 4, - "type_info": "Timestamp" + "type_info": "Int2" }, { - "name": "base_fee_per_gas", + "name": "status", "ordinal": 5, - "type_info": "Int8" + "type_info": "Text" }, { - "name": "priority_fee_per_gas", + "name": "error", "ordinal": 6, - "type_info": "Int8" + "type_info": "Text" }, { - "name": "confirmed_at", + "name": "created_at", "ordinal": 7, "type_info": "Timestamp" }, { - "name": "signed_raw_tx", + "name": "updated_at", "ordinal": 8, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "sent_at_block", + "name": "processing_started_at", "ordinal": 9, - "type_info": "Int4" + "type_info": "Timestamp" }, { - "name": "sent_at", + "name": "time_taken", "ordinal": 10, - "type_info": "Timestamp" + "type_info": "Time" + }, + { + "name": "is_blob_cleaned", + "ordinal": 11, + "type_info": "Bool" + }, + { + "name": "number_of_basic_circuits", + "ordinal": 12, + "type_info": "Int4" + }, + { + "name": "protocol_version", + "ordinal": 13, + "type_info": "Int4" + }, + { + "name": "picked_by", + "ordinal": 14, + "type_info": "Text" } ], "nullable": [ false, false, false, + true, false, false, + true, false, false, true, true, true, + true, + true, true ], "parameters": { "Left": [ - "Int4" - ] - } - }, - "query": "SELECT * FROM eth_txs_history WHERE eth_tx_id = $1 ORDER BY created_at DESC LIMIT 1" - }, - "ad4f74aa6f131df0243f4fa500ade1b98aa335bd71ed417b02361e2c697e60f8": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "Int8" + "Int4Array", + "Text" ] } }, - "query": "\n UPDATE scheduler_witness_jobs\n SET aggregation_result_coords = $1,\n updated_at = now()\n WHERE l1_batch_number = $2\n " + "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 " }, - "ae072f51b65d0b5212264be9a34027922e5aedef7e4741517ad8104bf5aa79e9": { + "a0aa877e052e63b1c3df6fc4432eeb44f7f3930f624e66b034baa1c5d0f8bb30": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8" + "Int8", + { + "Custom": { + "kind": { + "Enum": [ + "Queued", + "ManuallySkipped", + "InProgress", + "Successful", + "Failed" + ] + }, + "name": "basic_witness_input_producer_job_status" + } + } ] } }, - "query": "DELETE FROM factory_deps WHERE miniblock_number > $1" + "query": "INSERT INTO basic_witness_input_producer_jobs (l1_batch_number, status, created_at, updated_at) VALUES ($1, $2, now(), now()) ON CONFLICT (l1_batch_number) DO NOTHING" }, - "aea4e8d1b018836973d252df943a2c1988dd5f3ffc629064b87d25af8cdb8638": { + "a19b7137403c5cdf1be5f5122ce4d297ed661fa8bdb3bc91f8a81fe9da47469e": { "describe": { "columns": [ { - "name": "l1_batch_number", + "name": "upgrade_tx_hash", "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "l1_batch_tx_index", - "ordinal": 1, - "type_info": "Int4" + "type_info": "Bytea" } ], "nullable": [ - true, true ], "parameters": { "Left": [ - "Bytea" + "Int4" ] } }, - "query": "SELECT l1_batch_number, l1_batch_tx_index FROM transactions WHERE hash = $1" + "query": "\n SELECT upgrade_tx_hash FROM protocol_versions\n WHERE id = $1\n " }, - "af22ad34bde12b8d25eb85da9939d12b7bed6407d732b868eeaf2916568c8646": { + "a1a6b52403c1db35c8d83d0a512ac453ecd54b34ec516027d540ee1890b40291": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Time", - "Int8" + "Int4", + "Bytea", + "Bytea", + "Bytea", + "Bytea" ] } }, - "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status = 'successful', updated_at = now(), time_taken = $1\n WHERE l1_batch_number = $2\n " - }, - "af75db6b7e42b73ce62b28a7281e1bfa181ee0c80a85d7d8078831db5dcdb699": { - "describe": { - "columns": [ - { - "name": "l1_block_number", - "ordinal": 0, - "type_info": "Int4" - } - ], - "nullable": [ - true - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT l1_block_number FROM transactions\n WHERE priority_op_id IS NOT NULL\n ORDER BY priority_op_id DESC\n LIMIT 1" + "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" }, - "b1478907214ad20dddd4f3846fba4b0ddf1fff63ddb3b95c8999635e77c8b863": { + "a39f760d2cd879a78112e57d8611d7099802b03b7cc4933cafb4c47e133ad543": { "describe": { "columns": [ { - "name": "id", + "name": "address", "ordinal": 0, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "eth_tx_id", + "name": "topic1", "ordinal": 1, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "tx_hash", + "name": "topic2", "ordinal": 2, - "type_info": "Text" + "type_info": "Bytea" }, { - "name": "created_at", + "name": "topic3", "ordinal": 3, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "updated_at", + "name": "topic4", "ordinal": 4, - "type_info": "Timestamp" + "type_info": "Bytea" }, { - "name": "base_fee_per_gas", + "name": "value", "ordinal": 5, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "priority_fee_per_gas", + "name": "block_hash", "ordinal": 6, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "confirmed_at", + "name": "l1_batch_number?", "ordinal": 7, - "type_info": "Timestamp" + "type_info": "Int8" }, { - "name": "signed_raw_tx", + "name": "miniblock_number", "ordinal": 8, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "sent_at_block", + "name": "tx_hash", "ordinal": 9, - "type_info": "Int4" + "type_info": "Bytea" }, { - "name": "sent_at", + "name": "tx_index_in_block", "ordinal": 10, - "type_info": "Timestamp" + "type_info": "Int4" + }, + { + "name": "event_index_in_block", + "ordinal": 11, + "type_info": "Int4" + }, + { + "name": "event_index_in_tx", + "ordinal": 12, + "type_info": "Int4" } ], "nullable": [ @@ -8136,58 +8343,60 @@ false, false, false, + null, + null, false, - true, - true, - true, - true + false, + false, + false, + false ], "parameters": { "Left": [ - "Int4" + "Bytea" ] } }, - "query": "SELECT * FROM eth_txs_history WHERE eth_tx_id = $1 ORDER BY created_at DESC" + "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 " }, - "b14997f84d11d7eea89168383195c5579eed1c57bb2b416a749e2863ae6594a5": { + "a3d526a5a341618e9784fc81626143a3174709483a527879254ff8e28f210ac3": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Text", + "Int4", + "Int8", "Int8" ] } }, - "query": "\n UPDATE leaf_aggregation_witness_jobs_fri\n SET status ='failed', error= $1, updated_at = now()\n WHERE id = $2\n " + "query": "UPDATE l1_batches SET eth_execute_tx_id = $1, updated_at = now() WHERE number BETWEEN $2 AND $3" }, - "b14d9a82e6b0a4174dde61642d3abc001cd8cb80d988eb81a685255e3ce920de": { + "a42626c162a0600b9c7d22dd0d7997fa70cc95296ecc185ff9ae2e03593b07bf": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int8Array", - "ByteaArray" + "Int8" ] } }, - "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 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 " }, - "b479b7d3334f8d4566c294a44e2adb282fbc66a87be5c248c65211c2a8a07db0": { + "a4a14eb42b9acca3f93c67e5760ba700c333b5e9a38c132a3060a94c988e7f13": { "describe": { "columns": [ { - "name": "number", + "name": "hash", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" }, { - "name": "hash", + "name": "received_at", "ordinal": 1, - "type_info": "Bytea" + "type_info": "Timestamp" } ], "nullable": [ @@ -8196,253 +8405,165 @@ ], "parameters": { "Left": [ - "Int8", + "Timestamp", "Int8" ] } }, - "query": "SELECT number, hash FROM miniblocks WHERE number > $1 ORDER BY number ASC LIMIT $2" + "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" }, - "b4c576db7c762103dc6700ded458e996d2e9ef670d7b58b181dbfab02fa426ce": { + "a4f240188c1447f5b6dcef33dfcc9d00b105f62a6b4c3949a825bea979954160": { "describe": { "columns": [], "nullable": [], "parameters": { - "Left": [ - "Bytea", - "Bytea", - "Numeric", - "Numeric", - "Numeric", - "Jsonb", - "Int8", - "Numeric", - "Numeric", - "Bytea", - "Int4", - "Numeric", - "Bytea", - "Bytea", - "Int4", - "Numeric", - "Bytea", - "Timestamp" - ] + "Left": [] } }, - "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": "DELETE FROM basic_witness_input_producer_jobs" }, - "b4da918ee3b36b56d95c8834edebe65eb48ebb8270fa1e6ccf73ad354fd71134": { + "a5115658f3a53462a9570fd6676f1931604d1c17a9a2b5f1475519006aaf03ba": { "describe": { - "columns": [ - { - "name": "l1_address", - "ordinal": 0, - "type_info": "Bytea" - }, - { - "name": "l2_address", - "ordinal": 1, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false - ], + "columns": [], + "nullable": [], "parameters": { - "Left": [] + "Left": [ + "Int8", + "Text" + ] } }, - "query": "SELECT l1_address, l2_address FROM tokens WHERE well_known = true" + "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" }, - "b4f7d9b915b1feb92d0ff1982e256fbde8377e9c305aa2c919aba1cd55641d83": { + "a7abde5a53248d6e63aa998acac521194231bbe08140c9c4efa548c4f3ae17fa": { "describe": { "columns": [ { - "name": "number", + "name": "max?", "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" - }, + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "SELECT MAX(operation_number) as \"max?\" FROM storage_logs WHERE miniblock_number = $1" + }, + "a9b1a31def214f8b1441dc3ab720bd270f3991c9f1c7528256276e176d532163": { + "describe": { + "columns": [ { - "name": "compressed_repeated_writes", - "ordinal": 21, - "type_info": "Bytea" - }, + "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" + }, + "a9d96d6774af2637173d471f02995652cd4c131c05fdcb3d0e1644bcd1aa1809": { + "describe": { + "columns": [ { - "name": "l2_l1_compressed_messages", - "ordinal": 22, + "name": "proof", + "ordinal": 0, "type_info": "Bytea" }, { - "name": "l2_l1_merkle_root", - "ordinal": 23, + "name": "aggregation_result_coords", + "ordinal": 1, "type_info": "Bytea" - }, - { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" - }, + } + ], + "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": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" + "name": "id", + "ordinal": 0, + "type_info": "Int4" }, { - "name": "rollup_last_leaf_index", - "ordinal": 26, + "name": "nonce", + "ordinal": 1, "type_info": "Int8" }, { - "name": "zkporter_is_available", - "ordinal": 27, - "type_info": "Bool" + "name": "raw_tx", + "ordinal": 2, + "type_info": "Bytea" }, { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" + "name": "contract_address", + "ordinal": 3, + "type_info": "Text" }, { - "name": "default_aa_code_hash", - "ordinal": 29, - "type_info": "Bytea" + "name": "tx_type", + "ordinal": 4, + "type_info": "Text" }, { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" + "name": "gas_used", + "ordinal": 5, + "type_info": "Int8" }, { - "name": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" + "name": "created_at", + "ordinal": 6, + "type_info": "Timestamp" }, { - "name": "pass_through_data_hash", - "ordinal": 32, - "type_info": "Bytea" + "name": "updated_at", + "ordinal": 7, + "type_info": "Timestamp" }, { - "name": "meta_parameters_hash", - "ordinal": 33, - "type_info": "Bytea" + "name": "has_failed", + "ordinal": 8, + "type_info": "Bool" }, { - "name": "protocol_version", - "ordinal": 34, + "name": "sent_at_block", + "ordinal": 9, "type_info": "Int4" }, { - "name": "events_queue_commitment", - "ordinal": 35, - "type_info": "Bytea" + "name": "confirmed_eth_tx_history_id", + "ordinal": 10, + "type_info": "Int4" }, { - "name": "bootloader_initial_content_commitment", - "ordinal": 36, - "type_info": "Bytea" + "name": "predicted_gas_cost", + "ordinal": 11, + "type_info": "Int8" } ], "nullable": [ @@ -8451,49 +8572,88 @@ 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 + false ], "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" + "query": "SELECT * FROM eth_txs \n WHERE id > (SELECT COALESCE(MAX(eth_tx_id), 0) FROM eth_txs_history)\n ORDER BY id\n LIMIT $1\n " }, - "b6c8e0827b2389a14433c031332962495311562ae9652ae7e9409a4bf48dc55b": { + "aa279ce3351b30788711be6c65cb99cb14304ac38f8fed6d332237ffafc7c86b": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Text", + "Time", + "Text", + "Int8" + ] + } + }, + "query": "UPDATE proof_compression_jobs_fri SET status = $1, updated_at = now(), time_taken = $2, l1_proof_blob_url = $3WHERE l1_batch_number = $4" + }, + "aa7ae476aed5979227887891e9be995924588aa10ccba7424d6ce58f811eaa02": { + "describe": { + "columns": [ + { + "name": "number!", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + null + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT COALESCE(MAX(number), 0) AS \"number!\" FROM l1_batches WHERE eth_prove_tx_id IS NOT NULL" + }, + "aacaeff95b9a2988167dde78200d7139ba99edfa30dbcd8a7a57f72efc676477": { + "describe": { + "columns": [ + { + "name": "number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT number FROM l1_batches LEFT JOIN eth_txs_history AS commit_tx ON (l1_batches.eth_commit_tx_id = commit_tx.eth_tx_id) WHERE commit_tx.confirmed_at IS NOT NULL ORDER BY number DESC LIMIT 1" + }, + "ac35fb205c83d82d78983f4c9b47f56d3c91fbb2c95046555c7d60a9a2ebb446": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "ByteaArray", + "Int8Array", + "Int8" + ] + } + }, + "query": "INSERT INTO initial_writes (hashed_key, index, l1_batch_number, created_at, updated_at) SELECT u.hashed_key, u.index, $3, now(), now() FROM UNNEST($1::bytea[], $2::bigint[]) AS u(hashed_key, index)" + }, + "ad11ec3e628ae6c64ac160d8dd689b2f64033f620e17a31469788b3ce4968ad3": { "describe": { "columns": [ { @@ -8502,44 +8662,44 @@ "type_info": "Int4" }, { - "name": "nonce", + "name": "eth_tx_id", "ordinal": 1, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "raw_tx", + "name": "tx_hash", "ordinal": 2, - "type_info": "Bytea" + "type_info": "Text" }, { - "name": "contract_address", + "name": "created_at", "ordinal": 3, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "tx_type", + "name": "updated_at", "ordinal": 4, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "gas_used", + "name": "base_fee_per_gas", "ordinal": 5, "type_info": "Int8" }, { - "name": "created_at", + "name": "priority_fee_per_gas", "ordinal": 6, - "type_info": "Timestamp" + "type_info": "Int8" }, { - "name": "updated_at", + "name": "confirmed_at", "ordinal": 7, "type_info": "Timestamp" }, { - "name": "has_failed", + "name": "signed_raw_tx", "ordinal": 8, - "type_info": "Bool" + "type_info": "Bytea" }, { "name": "sent_at_block", @@ -8547,14 +8707,9 @@ "type_info": "Int4" }, { - "name": "confirmed_eth_tx_history_id", + "name": "sent_at", "ordinal": 10, - "type_info": "Int4" - }, - { - "name": "predicted_gas_cost", - "ordinal": 11, - "type_info": "Int8" + "type_info": "Timestamp" } ], "nullable": [ @@ -8563,90 +8718,160 @@ false, false, false, - true, - false, false, false, true, true, - false + true, + true ], "parameters": { - "Left": [] + "Left": [ + "Int4" + ] } }, - "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" + "query": "SELECT * FROM eth_txs_history WHERE eth_tx_id = $1 ORDER BY created_at DESC LIMIT 1" }, - "b6f9874059c57e5e59f3021936437e9ff71a68065dfc19c295d806d7a9aafc93": { + "ad4f74aa6f131df0243f4fa500ade1b98aa335bd71ed417b02361e2c697e60f8": { "describe": { "columns": [], "nullable": [], "parameters": { "Left": [ - "Int4", - "Int8", - "Bytea", - "Bytea", - "Bytea", "Bytea", + "Int8" + ] + } + }, + "query": "\n UPDATE scheduler_witness_jobs\n SET aggregation_result_coords = $1,\n updated_at = now()\n WHERE l1_batch_number = $2\n " + }, + "ae072f51b65d0b5212264be9a34027922e5aedef7e4741517ad8104bf5aa79e9": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Int8" + ] + } + }, + "query": "DELETE FROM factory_deps WHERE miniblock_number > $1" + }, + "aea4e8d1b018836973d252df943a2c1988dd5f3ffc629064b87d25af8cdb8638": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "l1_batch_tx_index", + "ordinal": 1, + "type_info": "Int4" + } + ], + "nullable": [ + true, + true + ], + "parameters": { + "Left": [ "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 " + "query": "SELECT l1_batch_number, l1_batch_tx_index FROM transactions WHERE hash = $1" }, - "b79f02c8663c6b99d0aa46b430de32103afa0333e8293cf8661cfc1c3f9fc12e": { + "af22ad34bde12b8d25eb85da9939d12b7bed6407d732b868eeaf2916568c8646": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Time", + "Int8" + ] + } + }, + "query": "\n UPDATE scheduler_witness_jobs_fri\n SET status = 'successful', updated_at = now(), time_taken = $1\n WHERE l1_batch_number = $2\n " + }, + "af75db6b7e42b73ce62b28a7281e1bfa181ee0c80a85d7d8078831db5dcdb699": { + "describe": { + "columns": [ + { + "name": "l1_block_number", + "ordinal": 0, + "type_info": "Int4" + } + ], + "nullable": [ + true + ], + "parameters": { + "Left": [] + } + }, + "query": "SELECT l1_block_number FROM transactions\n WHERE priority_op_id IS NOT NULL\n ORDER BY priority_op_id DESC\n LIMIT 1" + }, + "b1478907214ad20dddd4f3846fba4b0ddf1fff63ddb3b95c8999635e77c8b863": { "describe": { "columns": [ { "name": "id", "ordinal": 0, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "contract_address", + "name": "eth_tx_id", "ordinal": 1, - "type_info": "Bytea" + "type_info": "Int4" }, { - "name": "source_code", + "name": "tx_hash", "ordinal": 2, "type_info": "Text" }, { - "name": "contract_name", + "name": "created_at", "ordinal": 3, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "zk_compiler_version", + "name": "updated_at", "ordinal": 4, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "compiler_version", + "name": "base_fee_per_gas", "ordinal": 5, - "type_info": "Text" + "type_info": "Int8" }, { - "name": "optimization_used", + "name": "priority_fee_per_gas", "ordinal": 6, - "type_info": "Bool" + "type_info": "Int8" }, { - "name": "optimizer_mode", + "name": "confirmed_at", "ordinal": 7, - "type_info": "Text" + "type_info": "Timestamp" }, { - "name": "constructor_arguments", + "name": "signed_raw_tx", "ordinal": 8, "type_info": "Bytea" }, { - "name": "is_system", + "name": "sent_at_block", "ordinal": 9, - "type_info": "Bool" + "type_info": "Int4" + }, + { + "name": "sent_at", + "ordinal": 10, + "type_info": "Timestamp" } ], "nullable": [ @@ -8658,358 +8883,405 @@ false, false, true, - false, - false + true, + true, + true ], "parameters": { - "Left": [] + "Left": [ + "Int4" + ] } }, - "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": "SELECT * FROM eth_txs_history WHERE eth_tx_id = $1 ORDER BY created_at DESC" }, - "b7ab3aeee71e87c7469428ec411b410d81282ff6fed63fe5cda0e81a330d2ac5": { + "b14997f84d11d7eea89168383195c5579eed1c57bb2b416a749e2863ae6594a5": { "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 - ], + "columns": [], + "nullable": [], "parameters": { "Left": [ - "Interval", - "Int2" + "Text", + "Int8" ] } }, - "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 leaf_aggregation_witness_jobs_fri\n SET status ='failed', error= $1, updated_at = now()\n WHERE id = $2\n " }, - "b7d3b30bff2ed9aabcdaed89ebfd1f0303b70c6d5483ff9183475bb232a04f21": { + "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": "l1_batch_number", + "name": "number", "ordinal": 0, "type_info": "Int8" }, { - "name": "status", + "name": "hash", "ordinal": 1, - "type_info": "Text" - }, - { - "name": "attempts", - "ordinal": 2, - "type_info": "Int2" + "type_info": "Bytea" } ], "nullable": [ - false, false, false ], "parameters": { "Left": [ - "Interval", - "Int2" + "Int8", + "Int8" ] } }, - "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 " + "query": "SELECT number, hash FROM miniblocks WHERE number > $1 ORDER BY number ASC LIMIT $2" }, - "b944df7af612ec911170a43be846eb2f6e27163b0d3983672de2b8d5d60af640": { + "b4c576db7c762103dc6700ded458e996d2e9ef670d7b58b181dbfab02fa426ce": { "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], + "columns": [], + "nullable": [], "parameters": { "Left": [ - "Interval" + "Bytea", + "Bytea", + "Numeric", + "Numeric", + "Numeric", + "Jsonb", + "Int8", + "Numeric", + "Numeric", + "Bytea", + "Int4", + "Numeric", + "Bytea", + "Bytea", + "Int4", + "Numeric", + "Bytea", + "Timestamp" ] } }, - "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" + "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 " }, - "bc4433cdfa499830fe6a6a95759c9fbe343ac25b371c7fa980bfd1b0afc86629": { + "b4da918ee3b36b56d95c8834edebe65eb48ebb8270fa1e6ccf73ad354fd71134": { "describe": { "columns": [ { - "name": "l1_batch_number", + "name": "l1_address", "ordinal": 0, - "type_info": "Int8" + "type_info": "Bytea" + }, + { + "name": "l2_address", + "ordinal": 1, + "type_info": "Bytea" } ], "nullable": [ + false, false ], "parameters": { - "Left": [ - "Text", - "Text", - "Text" - ] + "Left": [] } }, - "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" + "query": "SELECT l1_address, l2_address FROM tokens WHERE well_known = true" }, - "bdf6109aa2625b809f9ffac5351d3693e2fbd081a0e7f25e55f74571770122d1": { + "b6c8e0827b2389a14433c031332962495311562ae9652ae7e9409a4bf48dc55b": { "describe": { "columns": [ { - "name": "number", + "name": "id", "ordinal": 0, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "timestamp", + "name": "nonce", "ordinal": 1, "type_info": "Int8" }, { - "name": "is_finished", + "name": "raw_tx", "ordinal": 2, - "type_info": "Bool" + "type_info": "Bytea" }, { - "name": "l1_tx_count", + "name": "contract_address", "ordinal": 3, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "l2_tx_count", + "name": "tx_type", "ordinal": 4, - "type_info": "Int4" + "type_info": "Text" }, { - "name": "fee_account_address", + "name": "gas_used", "ordinal": 5, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "bloom", + "name": "created_at", "ordinal": 6, - "type_info": "Bytea" + "type_info": "Timestamp" }, { - "name": "priority_ops_onchain_data", + "name": "updated_at", "ordinal": 7, - "type_info": "ByteaArray" + "type_info": "Timestamp" }, { - "name": "hash", + "name": "has_failed", "ordinal": 8, - "type_info": "Bytea" + "type_info": "Bool" }, { - "name": "parent_hash", + "name": "sent_at_block", "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, + "name": "confirmed_eth_tx_history_id", + "ordinal": 10, "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": "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": "compressed_repeated_writes", - "ordinal": 21, - "type_info": "Bytea" + "name": "id", + "ordinal": 0, + "type_info": "Int8" }, { - "name": "l2_l1_compressed_messages", - "ordinal": 22, + "name": "contract_address", + "ordinal": 1, "type_info": "Bytea" }, { - "name": "l2_l1_merkle_root", - "ordinal": 23, - "type_info": "Bytea" + "name": "source_code", + "ordinal": 2, + "type_info": "Text" }, { - "name": "l1_gas_price", - "ordinal": 24, - "type_info": "Int8" + "name": "contract_name", + "ordinal": 3, + "type_info": "Text" }, { - "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" + "name": "zk_compiler_version", + "ordinal": 4, + "type_info": "Text" }, { - "name": "rollup_last_leaf_index", - "ordinal": 26, - "type_info": "Int8" + "name": "compiler_version", + "ordinal": 5, + "type_info": "Text" }, { - "name": "zkporter_is_available", - "ordinal": 27, + "name": "optimization_used", + "ordinal": 6, "type_info": "Bool" }, { - "name": "bootloader_code_hash", - "ordinal": 28, - "type_info": "Bytea" + "name": "optimizer_mode", + "ordinal": 7, + "type_info": "Text" }, { - "name": "default_aa_code_hash", - "ordinal": 29, + "name": "constructor_arguments", + "ordinal": 8, "type_info": "Bytea" }, { - "name": "base_fee_per_gas", - "ordinal": 30, - "type_info": "Numeric" - }, + "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": "aux_data_hash", - "ordinal": 31, - "type_info": "Bytea" + "name": "id", + "ordinal": 0, + "type_info": "Int8" }, { - "name": "pass_through_data_hash", - "ordinal": 32, - "type_info": "Bytea" + "name": "status", + "ordinal": 1, + "type_info": "Text" }, { - "name": "meta_parameters_hash", - "ordinal": 33, - "type_info": "Bytea" - }, + "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": "protocol_version", - "ordinal": 34, - "type_info": "Int4" + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" }, { - "name": "events_queue_commitment", - "ordinal": 35, - "type_info": "Bytea" + "name": "status", + "ordinal": 1, + "type_info": "Text" }, { - "name": "bootloader_initial_content_commitment", - "ordinal": 36, - "type_info": "Bytea" + "name": "attempts", + "ordinal": 2, + "type_info": "Int2" } ], "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 + false ], "parameters": { "Left": [ - "Int8" + "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": "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" + "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": { @@ -9227,7 +9499,7 @@ }, "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 " }, - "c4f0135b4b5dd111832c909c0bf134e0cfdf6c93a8b8ad1f5a206652546aac5b": { + "c59d052f89ddfc3d2c07be84d6d9837adfbe2cefb10d01e09d31aa5e3364e281": { "describe": { "columns": [ { @@ -9236,24 +9508,24 @@ "type_info": "Int8" }, { - "name": "timestamp", + "name": "l1_tx_count", "ordinal": 1, - "type_info": "Int8" + "type_info": "Int4" }, { - "name": "is_finished", + "name": "l2_tx_count", "ordinal": 2, - "type_info": "Bool" + "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": "fee_account_address", @@ -9261,159 +9533,69 @@ "type_info": "Bytea" }, { - "name": "bloom", + "name": "l2_to_l1_logs", "ordinal": 6, - "type_info": "Bytea" + "type_info": "ByteaArray" }, { - "name": "priority_ops_onchain_data", + "name": "l2_to_l1_messages", "ordinal": 7, "type_info": "ByteaArray" }, { - "name": "hash", + "name": "bloom", "ordinal": 8, "type_info": "Bytea" }, { - "name": "parent_hash", + "name": "priority_ops_onchain_data", "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, + "ordinal": 10, "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": "base_fee_per_gas", + "ordinal": 11, + "type_info": "Numeric" }, { "name": "l1_gas_price", - "ordinal": 24, + "ordinal": 12, "type_info": "Int8" }, { "name": "l2_fair_gas_price", - "ordinal": 25, - "type_info": "Int8" - }, - { - "name": "rollup_last_leaf_index", - "ordinal": 26, + "ordinal": 13, "type_info": "Int8" }, - { - "name": "zkporter_is_available", - "ordinal": 27, - "type_info": "Bool" - }, { "name": "bootloader_code_hash", - "ordinal": 28, + "ordinal": 14, "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, + "ordinal": 15, "type_info": "Bytea" }, { "name": "protocol_version", - "ordinal": 34, + "ordinal": 16, "type_info": "Int4" }, { - "name": "events_queue_commitment", - "ordinal": 35, - "type_info": "Bytea" - }, - { - "name": "bootloader_initial_content_commitment", - "ordinal": 36, + "name": "compressed_state_diffs", + "ordinal": 17, "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 18, + "type_info": "ByteaArray" } ], "nullable": [ @@ -9425,35 +9607,17 @@ 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 + false ], "parameters": { "Left": [ @@ -9461,7 +9625,7 @@ ] } }, - "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" + "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, compressed_state_diffs, system_logs FROM l1_batches WHERE number = $1" }, "c604ee1dd86ac154d67ddb339da5f65ca849887d6a1068623e874f9df00cfdd1": { "describe": { @@ -10086,39 +10250,6 @@ }, "query": "\n UPDATE node_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 " }, - "dce6cfa8b3f4e3c93864d95a0c746a4df31a601cc22e59eb2c2fd747ecbb7c8a": { - "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", - "Int8Array" - ] - } - }, - "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, storage_refunds, 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, $22, now(), now())" - }, "dd330bc075a163974c59ec55ecfddd769d05801963b3e0e840e7f11e7bc6d3e9": { "describe": { "columns": [ @@ -10337,6 +10468,32 @@ }, "query": "\n UPDATE witness_inputs\n SET status = 'in_progress', attempts = attempts + 1,\n updated_at = now(), processing_started_at = now()\n WHERE l1_batch_number = (\n SELECT l1_batch_number\n FROM witness_inputs\n WHERE l1_batch_number <= $3\n AND\n ( status = 'queued'\n OR (status = 'in_progress' AND processing_started_at < now() - $1::interval)\n OR (status = 'failed' AND attempts < $2)\n )\n AND protocol_version = ANY($4)\n ORDER BY l1_batch_number ASC\n LIMIT 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING witness_inputs.*\n " }, + "e03756d19dfdf4cdffa81154e690dc7c36024dad5363e0c5440606a5a50eef53": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bytea", + "Bool", + "Bytea", + "Int8", + "Bytea", + "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, compressed_state_diffs = $14, updated_at = now() WHERE number = $15 AND hash IS NULL" + }, "e05a8c74653afc78c892ddfd08e60ab040d2b2f7c4b5ee110988eac2dd0dd90d": { "describe": { "columns": [ @@ -10396,217 +10553,103 @@ { "name": "number", "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "hash", - "ordinal": 1, - "type_info": "Bytea" - } - ], - "nullable": [ - false, - false - ], - "parameters": { - "Left": [ - "Int8", - "Int4", - "Int8" - ] - } - }, - "query": "SELECT number, hash FROM miniblocks WHERE number >= $1 and protocol_version = $2 ORDER BY number LIMIT $3" - }, - "e429061bd0f67910ad8676a34f2b89a051a6df3097c8afde81a491c342a10e3a": { - "describe": { - "columns": [ - { - "name": "l1_batch_number", - "ordinal": 0, - "type_info": "Int8" - } - ], - "nullable": [ - false - ], - "parameters": { - "Left": [ - { - "Custom": { - "kind": { - "Enum": [ - "Queued", - "ManuallySkipped", - "InProgress", - "Successful", - "Failed" - ] - }, - "name": "basic_witness_input_producer_job_status" - } - }, - { - "Custom": { - "kind": { - "Enum": [ - "Queued", - "ManuallySkipped", - "InProgress", - "Successful", - "Failed" - ] - }, - "name": "basic_witness_input_producer_job_status" - } - }, - { - "Custom": { - "kind": { - "Enum": [ - "Queued", - "ManuallySkipped", - "InProgress", - "Successful", - "Failed" - ] - }, - "name": "basic_witness_input_producer_job_status" - } - }, - "Interval", - "Int2" - ] - } - }, - "query": "UPDATE basic_witness_input_producer_jobs SET status = $1, attempts = attempts + 1, updated_at = now(), processing_started_at = now() WHERE l1_batch_number = ( SELECT l1_batch_number FROM basic_witness_input_producer_jobs WHERE status = $2 OR (status = $1 AND processing_started_at < now() - $4::interval) OR (status = $3 AND attempts < $5) ORDER BY l1_batch_number ASC LIMIT 1 FOR UPDATE SKIP LOCKED ) RETURNING basic_witness_input_producer_jobs.l1_batch_number" - }, - "e626aa2efb6ba875a12f2b4e37b0ba8052810e73fa5e2d3280f747f7b89b956f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Int8" - ] - } - }, - "query": "UPDATE proof_generation_details SET status='generated', proof_blob_url = $1, updated_at = now() WHERE l1_batch_number = $2" - }, - "e6fc424c622576166999df4487068cc1447b09464c48f379f882c45172f34a78": { - "describe": { - "columns": [ - { - "name": "number", - "ordinal": 0, - "type_info": "Int8" - }, - { - "name": "l1_tx_count", - "ordinal": 1, - "type_info": "Int4" - }, - { - "name": "l2_tx_count", - "ordinal": 2, - "type_info": "Int4" - }, - { - "name": "timestamp", - "ordinal": 3, - "type_info": "Int8" - }, - { - "name": "is_finished", - "ordinal": 4, - "type_info": "Bool" - }, - { - "name": "fee_account_address", - "ordinal": 5, - "type_info": "Bytea" - }, - { - "name": "l2_to_l1_logs", - "ordinal": 6, - "type_info": "ByteaArray" - }, - { - "name": "l2_to_l1_messages", - "ordinal": 7, - "type_info": "ByteaArray" - }, - { - "name": "bloom", - "ordinal": 8, - "type_info": "Bytea" - }, - { - "name": "priority_ops_onchain_data", - "ordinal": 9, - "type_info": "ByteaArray" - }, - { - "name": "used_contract_hashes", - "ordinal": 10, - "type_info": "Jsonb" - }, - { - "name": "base_fee_per_gas", - "ordinal": 11, - "type_info": "Numeric" - }, - { - "name": "l1_gas_price", - "ordinal": 12, - "type_info": "Int8" - }, - { - "name": "l2_fair_gas_price", - "ordinal": 13, - "type_info": "Int8" - }, - { - "name": "bootloader_code_hash", - "ordinal": 14, - "type_info": "Bytea" + "type_info": "Int8" }, { - "name": "default_aa_code_hash", - "ordinal": 15, + "name": "hash", + "ordinal": 1, "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 + false ], "parameters": { - "Left": [] + "Left": [ + "Int8", + "Int4", + "Int8" + ] + } + }, + "query": "SELECT number, hash FROM miniblocks WHERE number >= $1 and protocol_version = $2 ORDER BY number LIMIT $3" + }, + "e429061bd0f67910ad8676a34f2b89a051a6df3097c8afde81a491c342a10e3a": { + "describe": { + "columns": [ + { + "name": "l1_batch_number", + "ordinal": 0, + "type_info": "Int8" + } + ], + "nullable": [ + false + ], + "parameters": { + "Left": [ + { + "Custom": { + "kind": { + "Enum": [ + "Queued", + "ManuallySkipped", + "InProgress", + "Successful", + "Failed" + ] + }, + "name": "basic_witness_input_producer_job_status" + } + }, + { + "Custom": { + "kind": { + "Enum": [ + "Queued", + "ManuallySkipped", + "InProgress", + "Successful", + "Failed" + ] + }, + "name": "basic_witness_input_producer_job_status" + } + }, + { + "Custom": { + "kind": { + "Enum": [ + "Queued", + "ManuallySkipped", + "InProgress", + "Successful", + "Failed" + ] + }, + "name": "basic_witness_input_producer_job_status" + } + }, + "Interval", + "Int2" + ] } }, - "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" + "query": "UPDATE basic_witness_input_producer_jobs SET status = $1, attempts = attempts + 1, updated_at = now(), processing_started_at = now() WHERE l1_batch_number = ( SELECT l1_batch_number FROM basic_witness_input_producer_jobs WHERE status = $2 OR (status = $1 AND processing_started_at < now() - $4::interval) OR (status = $3 AND attempts < $5) ORDER BY l1_batch_number ASC LIMIT 1 FOR UPDATE SKIP LOCKED ) RETURNING basic_witness_input_producer_jobs.l1_batch_number" + }, + "e626aa2efb6ba875a12f2b4e37b0ba8052810e73fa5e2d3280f747f7b89b956f": { + "describe": { + "columns": [], + "nullable": [], + "parameters": { + "Left": [ + "Text", + "Int8" + ] + } + }, + "query": "UPDATE proof_generation_details SET status='generated', proof_blob_url = $1, updated_at = now() WHERE l1_batch_number = $2" }, "e900682a160af90d532da47a1222fc1d7c9962ee8996dbd9b9bb63f13820cf2b": { "describe": { @@ -10932,32 +10975,6 @@ }, "query": "\n UPDATE leaf_aggregation_witness_jobs\n SET is_blob_cleaned=TRUE\n WHERE l1_batch_number = ANY($1);\n " }, - "ee5727dc06a7385969e834556b96bbfdf12a5049a1a1c270f203ef3fa0e8cb94": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Bytea", - "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, default_aa_code_hash = $4, compressed_repeated_writes = $5, compressed_initial_writes = $6, l2_l1_compressed_messages = $7, l2_l1_merkle_root = $8, zkporter_is_available = $9, bootloader_code_hash = $10, rollup_last_leaf_index = $11, aux_data_hash = $12, pass_through_data_hash = $13, meta_parameters_hash = $14, updated_at = now() WHERE number = $15" - }, "ee74b42d1a6a52784124751dae6c7eca3fd36f5a3bb26de56efc2b810da7033a": { "describe": { "columns": [ @@ -11981,6 +11998,132 @@ }, "query": "SELECT COUNT(*) as \"count!\" FROM prover_protocol_versions WHERE id = $1" }, + "ff9c6a53717f0455089e27018e069809891249555e7ee38393927b2b25555fea": { + "describe": { + "columns": [ + { + "name": "number", + "ordinal": 0, + "type_info": "Int8" + }, + { + "name": "l1_tx_count", + "ordinal": 1, + "type_info": "Int4" + }, + { + "name": "l2_tx_count", + "ordinal": 2, + "type_info": "Int4" + }, + { + "name": "timestamp", + "ordinal": 3, + "type_info": "Int8" + }, + { + "name": "is_finished", + "ordinal": 4, + "type_info": "Bool" + }, + { + "name": "fee_account_address", + "ordinal": 5, + "type_info": "Bytea" + }, + { + "name": "l2_to_l1_logs", + "ordinal": 6, + "type_info": "ByteaArray" + }, + { + "name": "l2_to_l1_messages", + "ordinal": 7, + "type_info": "ByteaArray" + }, + { + "name": "bloom", + "ordinal": 8, + "type_info": "Bytea" + }, + { + "name": "priority_ops_onchain_data", + "ordinal": 9, + "type_info": "ByteaArray" + }, + { + "name": "used_contract_hashes", + "ordinal": 10, + "type_info": "Jsonb" + }, + { + "name": "base_fee_per_gas", + "ordinal": 11, + "type_info": "Numeric" + }, + { + "name": "l1_gas_price", + "ordinal": 12, + "type_info": "Int8" + }, + { + "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" + }, + { + "name": "compressed_state_diffs", + "ordinal": 17, + "type_info": "Bytea" + }, + { + "name": "system_logs", + "ordinal": 18, + "type_info": "ByteaArray" + } + ], + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + true, + false + ], + "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, compressed_state_diffs, system_logs FROM l1_batches ORDER BY number DESC LIMIT 1" + }, "ffc30c35b713dbde170c0369d5b9f741523778a3f396bd6fa9bfd1705fb4c8ac": { "describe": { "columns": [], diff --git a/core/lib/dal/src/blocks_dal.rs b/core/lib/dal/src/blocks_dal.rs index 1ffdba4aaa9..bec95eb4df9 100644 --- a/core/lib/dal/src/blocks_dal.rs +++ b/core/lib/dal/src/blocks_dal.rs @@ -154,7 +154,8 @@ impl BlocksDal<'_, '_> { 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 \ + l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version, \ + system_logs, compressed_state_diffs \ FROM l1_batches \ WHERE eth_commit_tx_id = $1 \ OR eth_prove_tx_id = $1 \ @@ -183,7 +184,7 @@ 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, system_logs, compressed_state_diffs, \ events_queue_commitment, bootloader_initial_content_commitment \ FROM l1_batches \ LEFT JOIN commitments ON commitments.l1_batch_number = l1_batches.number \ @@ -206,7 +207,8 @@ impl BlocksDal<'_, '_> { 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 \ + l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version, \ + compressed_state_diffs, system_logs \ FROM l1_batches \ WHERE number = $1", number.0 as i64 @@ -352,6 +354,11 @@ impl BlocksDal<'_, '_> { .iter() .map(|log| log.to_bytes().to_vec()) .collect(); + let system_logs = header + .system_logs + .iter() + .map(|log| log.to_bytes().to_vec()) + .collect::>>(); // Serialization should always succeed. let initial_bootloader_contents = serde_json::to_value(initial_bootloader_contents) @@ -373,9 +380,9 @@ impl BlocksDal<'_, '_> { 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, storage_refunds, \ - 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, $22, now(), now())", + l1_gas_price, l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version, system_logs, \ + storage_refunds, 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, $22, $23, now(), now())", header.number.0 as i64, header.l1_tx_count as i32, header.l2_tx_count as i32, @@ -403,6 +410,7 @@ impl BlocksDal<'_, '_> { .default_aa .as_bytes(), header.protocol_version.map(|v| v as i32), + &system_logs, &storage_refunds, ) .execute(transaction.conn()) @@ -545,8 +553,8 @@ impl BlocksDal<'_, '_> { l2_l1_compressed_messages = $7, l2_l1_merkle_root = $8, \ zkporter_is_available = $9, bootloader_code_hash = $10, rollup_last_leaf_index = $11, \ aux_data_hash = $12, pass_through_data_hash = $13, meta_parameters_hash = $14, \ - updated_at = now() \ - WHERE number = $15", + compressed_state_diffs = $15, updated_at = now() \ + WHERE number = $16", metadata.root_hash.as_bytes(), metadata.merkle_root_hash.as_bytes(), metadata.commitment.as_bytes(), @@ -561,6 +569,7 @@ impl BlocksDal<'_, '_> { metadata.aux_data_hash.as_bytes(), metadata.pass_through_data_hash.as_bytes(), metadata.meta_parameters_hash.as_bytes(), + metadata.state_diffs_compressed, 0, ) .execute(self.storage.conn()) @@ -583,8 +592,8 @@ impl BlocksDal<'_, '_> { 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", + compressed_state_diffs = $14, updated_at = now() \ + WHERE number = $15 AND hash IS NULL", metadata.root_hash.as_bytes(), metadata.merkle_root_hash.as_bytes(), metadata.commitment.as_bytes(), @@ -598,6 +607,7 @@ impl BlocksDal<'_, '_> { metadata.aux_data_hash.as_bytes(), metadata.pass_through_data_hash.as_bytes(), metadata.meta_parameters_hash.as_bytes(), + metadata.state_diffs_compressed, number.0 as i64, ) .instrument("save_blocks_metadata") @@ -679,8 +689,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, \ - events_queue_commitment, bootloader_initial_content_commitment \ + meta_parameters_hash, protocol_version, compressed_state_diffs, \ + system_logs, 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 \ @@ -776,8 +786,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, \ - events_queue_commitment, bootloader_initial_content_commitment \ + meta_parameters_hash, protocol_version, compressed_state_diffs, \ + system_logs, 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 \ @@ -844,7 +854,7 @@ 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, system_logs, compressed_state_diffs, protocol_version, \ events_queue_commitment, bootloader_initial_content_commitment \ FROM \ (SELECT l1_batches.*, row_number() OVER (ORDER BY number ASC) AS row_number \ @@ -885,8 +895,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, \ - events_queue_commitment, bootloader_initial_content_commitment \ + meta_parameters_hash, protocol_version, compressed_state_diffs, \ + system_logs, 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 \ @@ -964,8 +974,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, \ - events_queue_commitment, bootloader_initial_content_commitment \ + meta_parameters_hash, protocol_version, compressed_state_diffs, \ + system_logs, 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 \ @@ -1001,8 +1011,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, 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 \ + meta_parameters_hash, protocol_version, compressed_state_diffs, \ + system_logs, 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 \ @@ -1070,7 +1080,8 @@ impl BlocksDal<'_, '_> { 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 \ + l2_fair_gas_price, bootloader_code_hash, default_aa_code_hash, protocol_version, \ + compressed_state_diffs, system_logs \ FROM l1_batches \ ORDER BY number DESC \ LIMIT 1" diff --git a/core/lib/dal/src/models/storage_block.rs b/core/lib/dal/src/models/storage_block.rs index 80d8da65dc6..35a7873b562 100644 --- a/core/lib/dal/src/models/storage_block.rs +++ b/core/lib/dal/src/models/storage_block.rs @@ -43,6 +43,14 @@ pub struct StorageL1BatchHeader { pub bootloader_code_hash: Option>, pub default_aa_code_hash: Option>, pub protocol_version: Option, + + // Both `system_logs` and `compressed_state_diffs` are introduced as part of boojum and will be + // absent in all batches generated prior to boojum. + // System logs are logs generated by the VM execution, rather than directly from user transactions, + // that facilitate sending information required for committing a batch to l1. In a given batch there + // will be exactly 7 (or 8 in the event of a protocol updgrade) system logs. + pub system_logs: Vec>, + pub compressed_state_diffs: Option>, } impl From for L1BatchHeader { @@ -53,6 +61,12 @@ impl From for L1BatchHeader { .map(|raw_data| raw_data.into()) .collect(); + let system_logs: Vec<_> = l1_batch + .system_logs + .into_iter() + .map(|raw_log| L2ToL1Log::from_slice(&raw_log)) + .collect(); + L1BatchHeader { number: L1BatchNumber(l1_batch.number as u32), is_finished: l1_batch.is_finished, @@ -77,6 +91,7 @@ impl From for L1BatchHeader { ), l1_gas_price: l1_batch.l1_gas_price as u64, l2_fair_gas_price: l1_batch.l2_fair_gas_price as u64, + system_logs, protocol_version: l1_batch .protocol_version .map(|v| (v as u16).try_into().unwrap()), @@ -151,6 +166,9 @@ pub struct StorageL1Batch { pub l1_gas_price: i64, pub l2_fair_gas_price: i64, + pub system_logs: Vec>, + pub compressed_state_diffs: Option>, + pub protocol_version: Option, pub events_queue_commitment: Option>, @@ -165,6 +183,12 @@ impl From for L1BatchHeader { .map(Vec::into) .collect(); + let system_logs: Vec<_> = l1_batch + .system_logs + .into_iter() + .map(|raw_log| L2ToL1Log::from_slice(&raw_log)) + .collect(); + L1BatchHeader { number: L1BatchNumber(l1_batch.number as u32), is_finished: l1_batch.is_finished, @@ -189,6 +213,7 @@ impl From for L1BatchHeader { ), l1_gas_price: l1_batch.l1_gas_price as u64, l2_fair_gas_price: l1_batch.l2_fair_gas_price as u64, + system_logs, protocol_version: l1_batch .protocol_version .map(|v| (v as u16).try_into().unwrap()), @@ -260,6 +285,7 @@ impl TryInto for StorageL1Batch { .ok_or(StorageL1BatchConvertError::Incomplete)?, ), }, + state_diffs_compressed: self.compressed_state_diffs.unwrap_or_default(), events_queue_commitment: self.events_queue_commitment.map(|v| H256::from_slice(&v)), bootloader_initial_content_commitment: self .bootloader_initial_content_commitment diff --git a/core/lib/dal/src/storage_logs_dedup_dal.rs b/core/lib/dal/src/storage_logs_dedup_dal.rs index 2b99000a48a..8a70ceb50fe 100644 --- a/core/lib/dal/src/storage_logs_dedup_dal.rs +++ b/core/lib/dal/src/storage_logs_dedup_dal.rs @@ -118,6 +118,19 @@ impl StorageLogsDedupDal<'_, '_> { .collect() } + pub async fn get_enumeration_index_for_key(&mut self, key: StorageKey) -> Option { + sqlx::query!( + "SELECT index \ + FROM initial_writes \ + WHERE hashed_key = $1", + key.hashed_key().0.to_vec() + ) + .fetch_optional(self.storage.conn()) + .await + .unwrap() + .map(|row| row.index as u64) + } + /// Returns `hashed_keys` that are both present in the input and in `initial_writes` table. pub async fn filter_written_slots(&mut self, hashed_keys: &[H256]) -> HashSet { let hashed_keys: Vec<_> = hashed_keys.iter().map(H256::as_bytes).collect(); diff --git a/core/lib/merkle_tree/Cargo.toml b/core/lib/merkle_tree/Cargo.toml index b03fdeb697b..0fc3777d3ed 100644 --- a/core/lib/merkle_tree/Cargo.toml +++ b/core/lib/merkle_tree/Cargo.toml @@ -14,6 +14,7 @@ vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev zksync_types = { path = "../types" } zksync_crypto = { path = "../crypto" } zksync_storage = { path = "../storage", default-features = false } +zksync_utils = { path = "../utils" } leb128 = "0.2.5" once_cell = "1.17.1" diff --git a/core/lib/merkle_tree/src/domain.rs b/core/lib/merkle_tree/src/domain.rs index fb6d3d870e1..a4992e8f687 100644 --- a/core/lib/merkle_tree/src/domain.rs +++ b/core/lib/merkle_tree/src/domain.rs @@ -1,6 +1,7 @@ //! Tying the Merkle tree implementation to the problem domain. use rayon::{ThreadPool, ThreadPoolBuilder}; +use zksync_utils::h256_to_u256; use crate::{ storage::{MerkleTreeColumnFamily, PatchSet, Patched, RocksDBWrapper}, @@ -11,8 +12,8 @@ use zksync_crypto::hasher::blake2::Blake2Hasher; use zksync_storage::RocksDB; use zksync_types::{ proofs::{PrepareBasicCircuitsJob, StorageLogMetadata}, - writes::{InitialStorageWrite, RepeatedStorageWrite}, - L1BatchNumber, StorageLog, StorageLogKind, + writes::{InitialStorageWrite, RepeatedStorageWrite, StateDiffRecord}, + L1BatchNumber, StorageKey, StorageLog, StorageLogKind, U256, }; /// Metadata for the current tree state. @@ -29,6 +30,9 @@ pub struct TreeMetadata { pub repeated_writes: Vec, /// Witness information. As with `repeated_writes`, no-op updates will be omitted from Merkle paths. pub witness: Option, + /// State diffs performed in the processed L1 batch sorted by (address, key) as expected by the circuits/ + /// The information in here is an aggregation of `initial_writes` and `repeated_writes`. + pub state_diffs: Vec, } #[derive(Debug, PartialEq, Eq)] @@ -68,6 +72,11 @@ impl ZkSyncTree { instr_count = kvs.len() ); + let kvs = kvs + .iter() + .map(|(k, v)| (k.hashed_key_u256(), *v)) + .collect::>(); + let mut in_memory_tree = MerkleTree::new(PatchSet::default()); let output = in_memory_tree.extend(kvs); @@ -180,15 +189,20 @@ impl ZkSyncTree { let starting_leaf_count = self.tree.latest_root().leaf_count(); let starting_root_hash = self.tree.latest_root_hash(); + let instructions_with_hashed_keys = instructions + .iter() + .map(|(k, instr)| (k.hashed_key_u256(), *instr)) + .collect::>(); + tracing::info!( "Extending Merkle tree with batch #{l1_batch_number} with {instr_count} ops in full mode", instr_count = instructions.len() ); let output = if let Some(thread_pool) = &self.thread_pool { - thread_pool.install(|| self.tree.extend_with_proofs(instructions.clone())) + thread_pool.install(|| self.tree.extend_with_proofs(instructions_with_hashed_keys)) } else { - self.tree.extend_with_proofs(instructions.clone()) + self.tree.extend_with_proofs(instructions_with_hashed_keys) }; let mut witness = PrepareBasicCircuitsJob::new(starting_leaf_count + 1); @@ -212,7 +226,7 @@ impl ZkSyncTree { is_write: !log.base.is_read(), first_write: matches!(log.base, TreeLogEntry::Inserted { .. }), merkle_paths, - leaf_hashed_key: *key, + leaf_hashed_key: key.hashed_key_u256(), leaf_enumeration_index: match log.base { TreeLogEntry::Updated { leaf_index, .. } | TreeLogEntry::Inserted { leaf_index } @@ -246,7 +260,7 @@ impl ZkSyncTree { }; Some((key, value)) }); - let (initial_writes, repeated_writes) = Self::extract_writes(logs, kvs); + let (initial_writes, repeated_writes, state_diffs) = Self::extract_writes(logs, kvs); tracing::info!( "Processed batch #{l1_batch_number}; root hash is {root_hash}, \ @@ -263,12 +277,13 @@ impl ZkSyncTree { initial_writes, repeated_writes, witness: Some(witness), + state_diffs, } } - fn transform_logs(storage_logs: &[StorageLog]) -> Vec<(Key, TreeInstruction)> { + fn transform_logs(storage_logs: &[StorageLog]) -> Vec<(StorageKey, TreeInstruction)> { let instructions = storage_logs.iter().map(|log| { - let key = log.key.hashed_key_u256(); + let key = log.key; let instruction = match log.kind { StorageLogKind::Write => TreeInstruction::Write(log.value), StorageLogKind::Read => TreeInstruction::Read, @@ -280,18 +295,31 @@ impl ZkSyncTree { fn extract_writes( logs: impl Iterator, - kvs: impl Iterator, - ) -> (Vec, Vec) { + kvs: impl Iterator, + ) -> ( + Vec, + Vec, + Vec, + ) { let mut initial_writes = vec![]; let mut repeated_writes = vec![]; + let mut state_diffs = vec![]; for (log_entry, (key, value)) in logs.zip(kvs) { match log_entry { TreeLogEntry::Inserted { leaf_index } => { initial_writes.push(InitialStorageWrite { index: leaf_index, - key, + key: key.hashed_key_u256(), value, }); + state_diffs.push(StateDiffRecord { + address: *key.address(), + key: h256_to_u256(*key.key()), + derived_key: StorageKey::raw_hashed_key(key.address(), key.key()), + enumeration_index: 0u64, + initial_value: U256::default(), + final_value: h256_to_u256(value), + }); } TreeLogEntry::Updated { leaf_index, @@ -302,13 +330,22 @@ impl ZkSyncTree { index: leaf_index, value, }); + state_diffs.push(StateDiffRecord { + address: *key.address(), + key: h256_to_u256(*key.key()), + derived_key: StorageKey::raw_hashed_key(key.address(), key.key()), + enumeration_index: leaf_index, + initial_value: h256_to_u256(previous_value), + final_value: h256_to_u256(value), + }); } // Else we have a no-op update that must be omitted from `repeated_writes`. } TreeLogEntry::Read { .. } | TreeLogEntry::ReadMissingKey => {} } } - (initial_writes, repeated_writes) + state_diffs.sort_unstable_by_key(|rec| (rec.address, rec.key)); + (initial_writes, repeated_writes, state_diffs) } fn process_l1_batch_lightweight(&mut self, storage_logs: &[StorageLog]) -> TreeMetadata { @@ -320,12 +357,17 @@ impl ZkSyncTree { kv_count = kvs.len() ); + let kvs_with_derived_key = kvs + .iter() + .map(|(k, v)| (k.hashed_key_u256(), *v)) + .collect::>(); + let output = if let Some(thread_pool) = &self.thread_pool { - thread_pool.install(|| self.tree.extend(kvs.clone())) + thread_pool.install(|| self.tree.extend(kvs_with_derived_key.clone())) } else { - self.tree.extend(kvs.clone()) + self.tree.extend(kvs_with_derived_key.clone()) }; - let (initial_writes, repeated_writes) = + let (initial_writes, repeated_writes, state_diffs) = Self::extract_writes(output.logs.into_iter(), kvs.into_iter()); tracing::info!( @@ -344,13 +386,14 @@ impl ZkSyncTree { initial_writes, repeated_writes, witness: None, + state_diffs, } } - fn filter_write_logs(storage_logs: &[StorageLog]) -> Vec<(Key, ValueHash)> { + fn filter_write_logs(storage_logs: &[StorageLog]) -> Vec<(StorageKey, ValueHash)> { let kvs = storage_logs.iter().filter_map(|log| match log.kind { StorageLogKind::Write => { - let key = log.key.hashed_key_u256(); + let key = log.key; Some((key, log.value)) } StorageLogKind::Read => None, diff --git a/core/lib/state/src/in_memory.rs b/core/lib/state/src/in_memory.rs index 9fadc881371..87a26b238f2 100644 --- a/core/lib/state/src/in_memory.rs +++ b/core/lib/state/src/in_memory.rs @@ -118,6 +118,10 @@ impl ReadStorage for &InMemoryStorage { fn load_factory_dep(&mut self, hash: H256) -> Option> { self.factory_deps.get(&hash).cloned() } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + self.state.get(key).map(|(_, idx)| *idx) + } } impl ReadStorage for InMemoryStorage { @@ -132,4 +136,8 @@ impl ReadStorage for InMemoryStorage { fn load_factory_dep(&mut self, hash: H256) -> Option> { (&*self).load_factory_dep(hash) } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + (&*self).get_enumeration_index(key) + } } diff --git a/core/lib/state/src/lib.rs b/core/lib/state/src/lib.rs index 33376b60143..c943e48dbc1 100644 --- a/core/lib/state/src/lib.rs +++ b/core/lib/state/src/lib.rs @@ -55,6 +55,9 @@ pub trait ReadStorage: fmt::Debug { let code_key = get_known_code_key(bytecode_hash); self.read_value(&code_key) != H256::zero() } + + /// Retrieves the enumeration index for a given `key`. + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option; } /// Functionality to write to the VM storage in a batch. diff --git a/core/lib/state/src/postgres/mod.rs b/core/lib/state/src/postgres/mod.rs index 989e38f1934..8cc69f7bbbd 100644 --- a/core/lib/state/src/postgres/mod.rs +++ b/core/lib/state/src/postgres/mod.rs @@ -495,4 +495,14 @@ impl ReadStorage for PostgresStorage<'_> { latency.observe(); result } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + let mut dal = self.connection.storage_logs_dedup_dal(); + + let value = self + .rt_handle + .block_on(dal.get_enumeration_index_for_key(*key)); + + value + } } diff --git a/core/lib/state/src/rocksdb/mod.rs b/core/lib/state/src/rocksdb/mod.rs index c6a1e1243da..1964a48297f 100644 --- a/core/lib/state/src/rocksdb/mod.rs +++ b/core/lib/state/src/rocksdb/mod.rs @@ -114,10 +114,11 @@ impl RocksdbStorage { /// Creates a new storage with the provided RocksDB `path`. pub fn new(path: &Path) -> Self { + let db = RocksDB::new(path); Self { - db: RocksDB::new(path), + db, pending_patch: InMemoryStorage::default(), - enum_index_migration_chunk_size: 0, + enum_index_migration_chunk_size: 100, } } @@ -489,6 +490,13 @@ impl ReadStorage for RocksdbStorage { .get_cf(cf, hash.as_bytes()) .expect("failed to read RocksDB state value") } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + // Can safely unwrap here since it indicates that the migration has not yet ended and boojum will + // only be deployed when the migration is finished. + self.read_state_value(key) + .map(|state_value| state_value.enum_index.unwrap()) + } } #[cfg(test)] diff --git a/core/lib/state/src/shadow_storage.rs b/core/lib/state/src/shadow_storage.rs index a17629d2835..dea713ba40c 100644 --- a/core/lib/state/src/shadow_storage.rs +++ b/core/lib/state/src/shadow_storage.rs @@ -12,6 +12,8 @@ struct ShadowStorageMetrics { is_write_initial_mismatch: Counter, /// Number of mismatches when calling `load_factory_dep()` on a shadow storage. load_factory_dep_mismatch: Counter, + /// Number of mismatches when calling `get_enumeration_index` on a shadow storage. + get_enumeration_index_mismatch: Counter, } #[vise::register] @@ -88,6 +90,20 @@ impl ReadStorage for ShadowStorage<'_> { } source_value } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + let source_value = self.source_storage.get_enumeration_index(key); + let expected_value = self.to_check_storage.get_enumeration_index(key); + if source_value != expected_value { + tracing::error!( + "get_enumeration_index({:?}) -- l1_batch_number={:?} -- expected source={:?} to be equal to \ + to_check={:?}", key, self.l1_batch_number, source_value, expected_value + ); + + self.metrics.get_enumeration_index_mismatch.inc(); + } + source_value + } } // TODO: Add unit tests when we swap metrics crate; blocked by: https://linear.app/matterlabs/issue/QIT-3/rework-metrics-approach diff --git a/core/lib/state/src/storage_view.rs b/core/lib/state/src/storage_view.rs index c8054e520ad..8476be78aa9 100644 --- a/core/lib/state/src/storage_view.rs +++ b/core/lib/state/src/storage_view.rs @@ -80,6 +80,10 @@ where fn is_bytecode_known(&mut self, bytecode_hash: &H256) -> bool { (**self).is_bytecode_known(bytecode_hash) } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + (**self).get_enumeration_index(key) + } } impl StorageView { @@ -163,6 +167,10 @@ impl ReadStorage for StorageView { fn load_factory_dep(&mut self, hash: H256) -> Option> { self.storage_handle.load_factory_dep(hash) } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + self.storage_handle.get_enumeration_index(key) + } } impl WriteStorage for StorageView { diff --git a/core/lib/state/src/witness.rs b/core/lib/state/src/witness.rs index bbd750c6cb3..72aab8bbe6e 100644 --- a/core/lib/state/src/witness.rs +++ b/core/lib/state/src/witness.rs @@ -1,23 +1,39 @@ +use vise::{Counter, Metrics}; + use crate::ReadStorage; use zksync_types::{witness_block_state::WitnessBlockState, StorageKey, StorageValue, H256}; +#[derive(Debug, Metrics)] +#[metrics(prefix = "witness_storage")] +struct WitnessStorageMetrics { + /// Number of unexpected calls when calling `get_enumeration_index` on a witness storage. + get_enumeration_index_unexpected_call: Counter, +} + +#[vise::register] +static METRICS: vise::Global = vise::Global::new(); + /// [`ReadStorage`] implementation backed by binary serialized [`WitnessHashBlockState`]. /// Note that `load_factory_deps` is not used. /// FactoryDeps data is used straight inside witness generator, loaded with the blob. #[derive(Debug)] -pub struct WitnessStorage { +pub struct WitnessStorage<'a> { block_state: WitnessBlockState, + metrics: &'a WitnessStorageMetrics, } -impl WitnessStorage { +impl WitnessStorage<'_> { /// Creates a new storage with the provided witness's block state. pub fn new(block_state: WitnessBlockState) -> Self { - Self { block_state } + Self { + block_state, + metrics: &METRICS, + } } } -impl ReadStorage for WitnessStorage { +impl ReadStorage for WitnessStorage<'_> { fn read_value(&mut self, key: &StorageKey) -> StorageValue { *self .block_state @@ -33,4 +49,9 @@ impl ReadStorage for WitnessStorage { fn load_factory_dep(&mut self, _hash: H256) -> Option> { None } + + fn get_enumeration_index(&mut self, _key: &StorageKey) -> Option { + self.metrics.get_enumeration_index_unexpected_call.inc(); + None + } } diff --git a/core/lib/types/src/block.rs b/core/lib/types/src/block.rs index 40d6b8eb281..c41fdd93ed9 100644 --- a/core/lib/types/src/block.rs +++ b/core/lib/types/src/block.rs @@ -45,7 +45,7 @@ pub struct L1BatchHeader { pub l2_tx_count: u16, /// The data of the processed priority operations hash which must be sent to the smart contract. pub priority_ops_onchain_data: Vec, - /// All L2 -> L1 logs in the block. + /// All user generated L2 -> L1 logs in the block. pub l2_to_l1_logs: Vec, /// Preimages of the hashes that were sent as value of L2 logs by special system L2 contract. pub l2_to_l1_messages: Vec>, @@ -60,6 +60,8 @@ pub struct L1BatchHeader { /// The L2 gas price that the operator agrees on. pub l2_fair_gas_price: u64, pub base_system_contracts_hashes: BaseSystemContractsHashes, + /// System logs are those emitted as part of the Vm excecution. + pub system_logs: Vec, /// Version of protocol used for the L1 batch. pub protocol_version: Option, } @@ -116,6 +118,7 @@ impl L1BatchHeader { l1_gas_price: 0, l2_fair_gas_price: 0, base_system_contracts_hashes, + system_logs: vec![], protocol_version: Some(protocol_version), } } diff --git a/core/lib/types/src/commitment.rs b/core/lib/types/src/commitment.rs index 8e7da1186fa..d3a4eb6e550 100644 --- a/core/lib/types/src/commitment.rs +++ b/core/lib/types/src/commitment.rs @@ -18,7 +18,10 @@ use crate::{ ethabi::Token, l2_to_l1_log::L2ToL1Log, web3::signing::keccak256, - writes::{InitialStorageWrite, RepeatedStorageWrite}, + writes::{ + compress_state_diffs, InitialStorageWrite, RepeatedStorageWrite, StateDiffRecord, + PADDED_ENCODED_STORAGE_DIFF_LEN_BYTES, + }, H256, KNOWN_CODES_STORAGE_ADDRESS, U256, }; @@ -67,6 +70,7 @@ pub struct L1BatchMetadata { /// 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, + pub state_diffs_compressed: Vec, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -166,6 +170,38 @@ impl L1BatchWithMetadata { pub fn l1_commit_data_size(&self) -> usize { crate::ethabi::encode(&[Token::Array(vec![self.l1_commit_data()])]).len() } + + /// Packs all pubdata needed for batch commitment in boojum into one bytes array. The packing contains the + /// following: logs, messages, bytecodes, and compressed state diffs. + /// This data is currently part of calldata but will be submitted as part of the blob section post EIP-4844. + pub fn construct_pubdata(&self) -> Vec { + let mut res: Vec = vec![]; + + // Process and Pack Logs + res.extend((self.header.l2_to_l1_logs.len() as u32).to_be_bytes()); + for l2_to_l1_log in &self.header.l2_to_l1_logs { + res.extend(l2_to_l1_log.to_bytes()); + } + + // Process and Pack Msgs + res.extend((self.header.l2_to_l1_messages.len() as u32).to_be_bytes()); + for msg in &self.header.l2_to_l1_messages { + res.extend((msg.len() as u32).to_be_bytes()); + res.extend(msg); + } + + // Process and Pack Bytecodes + res.extend((self.factory_deps.len() as u32).to_be_bytes()); + for bytecode in &self.factory_deps { + res.extend((bytecode.len() as u32).to_be_bytes()); + res.extend(bytecode); + } + + // Extend with Compressed StateDiffs + res.extend(&self.metadata.state_diffs_compressed); + + res + } } impl SerializeCommitment for L2ToL1Log { @@ -199,6 +235,14 @@ impl SerializeCommitment for RepeatedStorageWrite { } } +impl SerializeCommitment for StateDiffRecord { + const SERIALIZED_SIZE: usize = PADDED_ENCODED_STORAGE_DIFF_LEN_BYTES; + + fn serialize_commitment(&self, buffer: &mut [u8]) { + buffer.copy_from_slice(&self.encode_padded()); + } +} + /// Block Output produced by Virtual Machine #[derive(Debug, Clone)] struct L1BatchAuxiliaryOutput { @@ -209,13 +253,30 @@ struct L1BatchAuxiliaryOutput { initial_writes: Vec, #[allow(dead_code)] repeated_writes: Vec, + l2_l1_logs_compressed: Vec, l2_l1_logs_linear_hash: H256, l2_l1_logs_merkle_root: H256, + + // Once cut over to boojum, these fields are no longer required as their values + // are covered by state_diffs_compressed and its hash. + // Task to remove: PLA-640 initial_writes_compressed: Vec, initial_writes_hash: H256, repeated_writes_compressed: Vec, repeated_writes_hash: H256, + + // The fields below are necessary for boojum. + system_logs_compressed: Vec, + #[allow(dead_code)] + system_logs_linear_hash: H256, + #[allow(dead_code)] + state_diffs_hash: H256, + state_diffs_compressed: Vec, + #[allow(dead_code)] + bootloader_heap_hash: H256, + #[allow(dead_code)] + events_state_queue_hash: H256, } impl L1BatchAuxiliaryOutput { @@ -223,14 +284,24 @@ impl L1BatchAuxiliaryOutput { l2_l1_logs: Vec, initial_writes: Vec, repeated_writes: Vec, + system_logs: Vec, + state_diffs: Vec, + bootloader_heap_hash: H256, + events_state_queue_hash: H256, ) -> Self { let l2_l1_logs_compressed = serialize_commitments(&l2_l1_logs); let initial_writes_compressed = serialize_commitments(&initial_writes); let repeated_writes_compressed = serialize_commitments(&repeated_writes); + let system_logs_compressed = serialize_commitments(&system_logs); + let state_diffs_packed = serialize_commitments(&state_diffs); + + let state_diffs_compressed = compress_state_diffs(state_diffs.clone()); let l2_l1_logs_linear_hash = H256::from(keccak256(&l2_l1_logs_compressed)); + let system_logs_linear_hash = H256::from(keccak256(&system_logs_compressed)); let initial_writes_hash = H256::from(keccak256(&initial_writes_compressed)); let repeated_writes_hash = H256::from(keccak256(&repeated_writes_compressed)); + let state_diffs_hash = H256::from(keccak256(&(state_diffs_packed))); let merkle_tree_leaves = l2_l1_logs_compressed[4..] .chunks(L2ToL1Log::SERIALIZED_SIZE) @@ -251,6 +322,13 @@ impl L1BatchAuxiliaryOutput { l2_l1_logs_merkle_root, initial_writes_hash, repeated_writes_hash, + system_logs_compressed, + system_logs_linear_hash, + state_diffs_hash, + state_diffs_compressed, + + bootloader_heap_hash, + events_state_queue_hash, } } @@ -342,6 +420,7 @@ pub struct L1BatchCommitmentHash { } impl L1BatchCommitment { + #[allow(clippy::too_many_arguments)] pub fn new( l2_to_l1_logs: Vec, rollup_last_leaf_index: u64, @@ -350,6 +429,10 @@ impl L1BatchCommitment { repeated_writes: Vec, bootloader_code_hash: H256, default_aa_code_hash: H256, + system_logs: Vec, + state_diffs: Vec, + bootloader_heap_hash: H256, + events_state_queue_hash: H256, ) -> Self { let meta_parameters = L1BatchMetaParameters { zkporter_is_available: ZKPORTER_IS_AVAILABLE, @@ -375,6 +458,10 @@ impl L1BatchCommitment { l2_to_l1_logs, initial_writes, repeated_writes, + system_logs, + state_diffs, + bootloader_heap_hash, + events_state_queue_hash, ), meta_parameters, } @@ -412,6 +499,14 @@ impl L1BatchCommitment { self.auxiliary_output.repeated_writes_hash } + pub fn system_logs_compressed(&self) -> &[u8] { + &self.auxiliary_output.system_logs_compressed + } + + pub fn state_diffs_compressed(&self) -> &[u8] { + &self.auxiliary_output.state_diffs_compressed + } + pub fn hash(&self) -> L1BatchCommitmentHash { let mut result = vec![]; let pass_through_data_hash = self.pass_through_data.hash(); @@ -513,6 +608,10 @@ mod tests { commitment_test.auxiliary_input.l2_l1_logs.clone(), initial_writes, commitment_test.auxiliary_input.repeated_writes.clone(), + vec![], + vec![], + H256::zero(), + H256::zero(), ); let commitment = L1BatchCommitment { diff --git a/core/lib/types/src/event.rs b/core/lib/types/src/event.rs index 1ac6bb89e9b..fccd5a43ac2 100644 --- a/core/lib/types/src/event.rs +++ b/core/lib/types/src/event.rs @@ -1,13 +1,15 @@ use crate::{ ethabi, + l2_to_l1_log::L2ToL1Log, tokens::{TokenInfo, TokenMetadata}, Address, L1BatchNumber, CONTRACT_DEPLOYER_ADDRESS, H256, KNOWN_CODES_STORAGE_ADDRESS, - L1_MESSENGER_ADDRESS, + L1_MESSENGER_ADDRESS, U256, }; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use std::fmt::Debug; -use zksync_utils::h256_to_account_address; +use zksync_basic_types::ethabi::Token; +use zksync_utils::{h256_to_account_address, u256_to_bytes_be, u256_to_h256}; #[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] pub struct VmEvent { @@ -51,6 +53,65 @@ static L1_MESSAGE_EVENT_SIGNATURE: Lazy = Lazy::new(|| { ) }); +/// Corresponds to the following solidity event: +/// ```solidity +/// struct L2ToL1Log { +/// uint8 l2ShardId; +/// bool isService; +/// uint16 txNumberInBlock; +/// address sender; +/// bytes32 key; +/// bytes32 value; +/// } +/// ``` +#[derive(Debug, Default, Clone, PartialEq)] +pub struct L1MessengerL2ToL1Log { + l2_shard_id: u8, + is_service: bool, + tx_number_in_block: u16, + sender: Address, + key: U256, + value: U256, +} + +impl L1MessengerL2ToL1Log { + pub fn packed_encoding(&self) -> Vec { + let mut res: Vec = vec![]; + res.push(self.l2_shard_id); + res.push(self.is_service as u8); + res.extend_from_slice(&self.tx_number_in_block.to_be_bytes()); + res.extend_from_slice(self.sender.as_bytes()); + res.extend(u256_to_bytes_be(&self.key)); + res.extend(u256_to_bytes_be(&self.value)); + res + } +} + +impl From for L2ToL1Log { + fn from(log: L1MessengerL2ToL1Log) -> Self { + L2ToL1Log { + shard_id: log.l2_shard_id, + is_service: log.is_service, + tx_number_in_block: log.tx_number_in_block, + sender: log.sender, + key: u256_to_h256(log.key), + value: u256_to_h256(log.value), + } + } +} + +static L1_MESSENGER_BYTECODE_PUBLICATION_EVENT_SIGNATURE: Lazy = Lazy::new(|| { + ethabi::long_signature( + "BytecodeL1PublicationRequested", + &[ethabi::ParamType::FixedBytes(32)], + ) +}); + +#[derive(Debug, PartialEq)] +pub struct L1MessengerBytecodePublicationRequest { + pub bytecode_hash: H256, +} + static BRIDGE_INITIALIZATION_SIGNATURE_OLD: Lazy = Lazy::new(|| { ethabi::long_signature( "BridgeInitialization", @@ -148,7 +209,7 @@ pub fn extract_long_l2_to_l1_messages(all_generated_events: &[VmEvent]) -> Vec Vec Vec { + let params = &[ethabi::ParamType::Tuple(vec![ + ethabi::ParamType::Uint(8), + ethabi::ParamType::Bool, + ethabi::ParamType::Uint(16), + ethabi::ParamType::Address, + ethabi::ParamType::FixedBytes(32), + ethabi::ParamType::FixedBytes(32), + ])]; + + let l1_messenger_l2_to_l1_log_event_signature = ethabi::long_signature("L2ToL1LogSent", params); + + all_generated_events + .iter() + .filter(|event| { + // Filter events from the l1 messenger contract that match the expected signature. + event.address == L1_MESSENGER_ADDRESS + && !event.indexed_topics.is_empty() + && event.indexed_topics[0] == l1_messenger_l2_to_l1_log_event_signature + }) + .map(|event| { + let tuple = ethabi::decode( + params, + &event.value, + ) + .expect("Failed to decode L2ToL1LogSent message") + .first() + .unwrap() + .clone(); + let Token::Tuple(tokens) = tuple else { + panic!("Tuple was expected, got: {}", tuple); + }; + let [ + Token::Uint(shard_id), + Token::Bool(is_service), + Token::Uint(tx_number_in_block), + Token::Address(sender), + Token::FixedBytes(key_bytes), + Token::FixedBytes(value_bytes), + ] = tokens.as_slice() else { + panic!("Invalid tuple types"); + }; + L1MessengerL2ToL1Log { + l2_shard_id: shard_id.low_u64() as u8, + is_service: *is_service, + tx_number_in_block: tx_number_in_block.low_u64() as u16, + sender: *sender, + key: U256::from_big_endian(key_bytes), + value: U256::from_big_endian(value_bytes), + } + }) + .collect() +} + +// Extracts all the bytecode publication requests +// that were emitted by the L1Messenger contract +pub fn extract_bytecode_publication_requests_from_l1_messenger( + all_generated_events: &[VmEvent], +) -> Vec { + all_generated_events + .iter() + .filter(|event| { + // Filter events from the l1 messenger contract that match the expected signature. + event.address == L1_MESSENGER_ADDRESS + && !event.indexed_topics.is_empty() + && event.indexed_topics[0] == *L1_MESSENGER_BYTECODE_PUBLICATION_EVENT_SIGNATURE + }) + .map(|event| { + let mut tokens = ethabi::decode(&[ethabi::ParamType::FixedBytes(32)], &event.value) + .expect("Failed to decode BytecodeL1PublicationRequested message"); + L1MessengerBytecodePublicationRequest { + bytecode_hash: H256::from_slice(&tokens.remove(0).into_fixed_bytes().unwrap()), + } + }) + .collect() +} + // Extract all bytecodes marked as known on the system contracts pub fn extract_bytecodes_marked_as_known(all_generated_events: &[VmEvent]) -> Vec { all_generated_events @@ -197,3 +339,169 @@ pub struct VmEventGroupKey { pub address: Address, pub topic: (u32, H256), } + +#[cfg(test)] +mod tests { + use zksync_basic_types::{ + ethabi::{self, Token}, + Address, L1BatchNumber, U256, + }; + use zksync_system_constants::{ + BOOTLOADER_ADDRESS, KNOWN_CODES_STORAGE_ADDRESS, L1_MESSENGER_ADDRESS, L2_ETH_TOKEN_ADDRESS, + }; + use zksync_utils::u256_to_h256; + + use crate::VmEvent; + + use super::{ + extract_bytecode_publication_requests_from_l1_messenger, + extract_l2tol1logs_from_l1_messenger, L1MessengerBytecodePublicationRequest, + L1MessengerL2ToL1Log, + }; + + fn create_l2_to_l1_log_sent_value( + tx_number: U256, + sender: Address, + key: U256, + value: U256, + ) -> Vec { + let mut key_arr = [0u8; 32]; + key.to_big_endian(&mut key_arr); + + let mut val_arr = [0u8; 32]; + value.to_big_endian(&mut val_arr); + + let tokens = vec![ + /*l2ShardId*/ Token::Uint(U256::from(0)), + /*isService*/ Token::Bool(true), + /*txNumberInBlock*/ Token::Uint(tx_number), + /*sender*/ Token::Address(sender), + /*key*/ Token::FixedBytes(key_arr.to_vec()), + /*value*/ Token::FixedBytes(val_arr.to_vec()), + ]; + + ethabi::encode(&tokens) + } + + fn create_byte_code_publication_req_value(hash: U256) -> Vec { + let mut hash_arr = [0u8; 32]; + hash.to_big_endian(&mut hash_arr); + + let tokens = vec![/*bytecode hash*/ Token::FixedBytes(hash_arr.to_vec())]; + + ethabi::encode(&tokens) + } + + fn create_l2_to_l1_log_vm_event( + from: Address, + tx_number: U256, + sender: Address, + key: U256, + value: U256, + ) -> VmEvent { + let l1_messenger_l2_to_l1_log_event_signature = ethabi::long_signature( + "L2ToL1LogSent", + &[ethabi::ParamType::Tuple(vec![ + ethabi::ParamType::Uint(8), + ethabi::ParamType::Bool, + ethabi::ParamType::Uint(16), + ethabi::ParamType::Address, + ethabi::ParamType::FixedBytes(32), + ethabi::ParamType::FixedBytes(32), + ])], + ); + + VmEvent { + location: (L1BatchNumber(1), 0u32), + address: from, + indexed_topics: vec![l1_messenger_l2_to_l1_log_event_signature], + value: create_l2_to_l1_log_sent_value(tx_number, sender, key, value), + } + } + + fn create_bytecode_publication_vm_event(from: Address, hash: U256) -> VmEvent { + let bytecode_publication_event_signature = ethabi::long_signature( + "BytecodeL1PublicationRequested", + &[ethabi::ParamType::FixedBytes(32)], + ); + + VmEvent { + location: (L1BatchNumber(1), 0u32), + address: from, + indexed_topics: vec![bytecode_publication_event_signature], + value: create_byte_code_publication_req_value(hash), + } + } + + #[test] + fn test_extract_l2tol1logs_from_l1_messenger() { + let expected = vec![ + L1MessengerL2ToL1Log { + l2_shard_id: 0u8, + is_service: true, + tx_number_in_block: 5u16, + sender: KNOWN_CODES_STORAGE_ADDRESS, + key: U256::from(11), + value: U256::from(19), + }, + L1MessengerL2ToL1Log { + l2_shard_id: 0u8, + is_service: true, + tx_number_in_block: 7u16, + sender: L1_MESSENGER_ADDRESS, + key: U256::from(19), + value: U256::from(93), + }, + ]; + + let events = vec![ + create_l2_to_l1_log_vm_event( + L1_MESSENGER_ADDRESS, + U256::from(5), + KNOWN_CODES_STORAGE_ADDRESS, + U256::from(11), + U256::from(19), + ), + create_l2_to_l1_log_vm_event( + BOOTLOADER_ADDRESS, + U256::from(6), + L2_ETH_TOKEN_ADDRESS, + U256::from(6), + U256::from(8), + ), + create_l2_to_l1_log_vm_event( + L1_MESSENGER_ADDRESS, + U256::from(7), + L1_MESSENGER_ADDRESS, + U256::from(19), + U256::from(93), + ), + ]; + + let logs = extract_l2tol1logs_from_l1_messenger(&events); + + assert_eq!(expected, logs); + } + + #[test] + fn test_extract_bytecode_publication_requests_from_l1_messenger() { + let expected = vec![ + L1MessengerBytecodePublicationRequest { + bytecode_hash: u256_to_h256(U256::from(1438284388)), + }, + L1MessengerBytecodePublicationRequest { + bytecode_hash: u256_to_h256(U256::from(1231014388)), + }, + ]; + + let events = vec![ + create_bytecode_publication_vm_event(L2_ETH_TOKEN_ADDRESS, U256::from(1337)), + create_bytecode_publication_vm_event(L1_MESSENGER_ADDRESS, U256::from(1438284388)), + create_bytecode_publication_vm_event(L1_MESSENGER_ADDRESS, U256::from(1231014388)), + ]; + + let logs = extract_bytecode_publication_requests_from_l1_messenger(&events); + + assert_eq!(expected, logs); + } +} diff --git a/core/lib/types/src/l2_to_l1_log.rs b/core/lib/types/src/l2_to_l1_log.rs index 8ad01b6f272..f392b0fb41b 100644 --- a/core/lib/types/src/l2_to_l1_log.rs +++ b/core/lib/types/src/l2_to_l1_log.rs @@ -52,3 +52,32 @@ impl From for L2ToL1Log { } } } + +#[cfg(test)] +mod tests { + use super::L2ToL1Log; + use zksync_basic_types::U256; + use zksync_system_constants::L1_MESSENGER_ADDRESS; + use zksync_utils::u256_to_h256; + + #[test] + fn l2_to_l1_log_to_bytes() { + let expected_log_bytes = [ + 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 8, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 19, + ]; + + let log = L2ToL1Log { + shard_id: 0u8, + is_service: false, + tx_number_in_block: 6u16, + sender: L1_MESSENGER_ADDRESS, + key: u256_to_h256(U256::from(11)), + value: u256_to_h256(U256::from(19)), + }; + + assert_eq!(expected_log_bytes, log.to_bytes()); + } +} diff --git a/core/lib/zksync_core/src/eth_sender/tests.rs b/core/lib/zksync_core/src/eth_sender/tests.rs index 25b54830eaf..ce1977512a5 100644 --- a/core/lib/zksync_core/src/eth_sender/tests.rs +++ b/core/lib/zksync_core/src/eth_sender/tests.rs @@ -494,6 +494,7 @@ fn default_l1_batch_metadata() -> L1BatchMetadata { pass_through_data_hash: Default::default(), events_queue_commitment: Some(H256::zero()), bootloader_initial_content_commitment: Some(H256::zero()), + state_diffs_compressed: vec![], } } diff --git a/core/lib/zksync_core/src/genesis.rs b/core/lib/zksync_core/src/genesis.rs index b9f2a7af780..dfd70b62c4d 100644 --- a/core/lib/zksync_core/src/genesis.rs +++ b/core/lib/zksync_core/src/genesis.rs @@ -107,6 +107,10 @@ pub async fn ensure_genesis_state( vec![], base_system_contracts_hashes.bootloader, base_system_contracts_hashes.default_aa, + vec![], + vec![], + H256::zero(), + H256::zero(), ); save_genesis_l1_batch_metadata( @@ -384,6 +388,7 @@ pub(crate) async fn save_genesis_l1_batch_metadata( pass_through_data_hash: commitment_hash.pass_through_data, events_queue_commitment: None, bootloader_initial_content_commitment: None, + state_diffs_compressed: vec![], }; storage .blocks_dal() diff --git a/core/lib/zksync_core/src/metadata_calculator/mod.rs b/core/lib/zksync_core/src/metadata_calculator/mod.rs index 05fdc5c49ed..956db116593 100644 --- a/core/lib/zksync_core/src/metadata_calculator/mod.rs +++ b/core/lib/zksync_core/src/metadata_calculator/mod.rs @@ -194,6 +194,10 @@ impl MetadataCalculator { tree_metadata.repeated_writes, header.base_system_contracts_hashes.bootloader, header.base_system_contracts_hashes.default_aa, + header.system_logs.clone(), + tree_metadata.state_diffs, + bootloader_initial_content_commitment.unwrap_or_default(), + events_queue_commitment.unwrap_or_default(), ); let commitment_hash = commitment.hash(); tracing::trace!("L1 batch commitment: {commitment:?}"); @@ -211,6 +215,7 @@ 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, + state_diffs_compressed: commitment.state_diffs_compressed().to_vec(), events_queue_commitment, bootloader_initial_content_commitment, }; diff --git a/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs b/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs index 05ef50b0ad1..84ee799fe12 100644 --- a/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs +++ b/core/lib/zksync_core/src/state_keeper/batch_executor/tests/tester.rs @@ -98,6 +98,7 @@ impl Tester { .access_storage_tagged("state_keeper") .await .unwrap(); + secondary_storage.update_from_postgres(&mut conn).await; drop(conn); 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 24b8a5bb2cf..181d2f4df8b 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 @@ -126,6 +126,7 @@ impl UpdatesManager { l2_fair_gas_price: self.fair_l2_gas_price(), base_system_contracts_hashes: self.base_system_contract_hashes(), protocol_version: Some(self.protocol_version()), + system_logs: vec![], }; let initial_bootloader_contents = 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 72e7580a41b..7c61e7de80f 100644 --- a/core/lib/zksync_core/src/state_keeper/tests/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/tests/mod.rs @@ -103,6 +103,7 @@ pub(crate) fn create_l1_batch_metadata(number: u32) -> L1BatchMetadata { pass_through_data_hash: H256::zero(), events_queue_commitment: Some(H256::zero()), bootloader_initial_content_commitment: Some(H256::zero()), + state_diffs_compressed: vec![], } }