Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(metadata-calculator): Save commitment for pre-boojum #481

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion core/lib/dal/src/blocks_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ impl BlocksDal<'_, '_> {
number: L1BatchNumber,
metadata: &L1BatchMetadata,
previous_root_hash: H256,
protocol_version: ProtocolVersionId,
) -> anyhow::Result<()> {
let mut transaction = self.storage.start_transaction().await?;

Expand Down Expand Up @@ -614,7 +615,7 @@ impl BlocksDal<'_, '_> {
.execute(transaction.conn())
.await?;

if metadata.events_queue_commitment.is_some() {
if metadata.events_queue_commitment.is_some() || protocol_version.is_pre_boojum() {
// Save `commitment`, `aux_data_hash`, `events_queue_commitment`, `bootloader_initial_content_commitment`.
sqlx::query!(
"INSERT INTO commitments (l1_batch_number, events_queue_commitment, bootloader_initial_content_commitment) \
Expand Down
1 change: 1 addition & 0 deletions core/lib/zksync_core/src/eth_sender/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ async fn insert_l1_batch(tester: &EthSenderTester, number: L1BatchNumber) -> L1B
header.number,
&default_l1_batch_metadata(),
Default::default(),
Default::default(),
)
.await
.unwrap();
Expand Down
7 changes: 6 additions & 1 deletion core/lib/zksync_core/src/metadata_calculator/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,12 @@ impl TreeUpdater {
let save_postgres_latency = METRICS.start_stage(TreeUpdateStage::SavePostgres);
storage
.blocks_dal()
.save_l1_batch_metadata(l1_batch_number, &metadata, previous_root_hash)
.save_l1_batch_metadata(
l1_batch_number,
&metadata,
previous_root_hash,
header.protocol_version.unwrap(),
)
.await
.unwrap();
// ^ Note that `save_l1_batch_metadata()` will not blindly overwrite changes if L1 batch
Expand Down
7 changes: 6 additions & 1 deletion core/lib/zksync_core/src/state_keeper/io/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,12 @@ async fn test_miniblock_and_l1_batch_processing(
// Save metadata for the genesis L1 batch so that we don't hang in `seal_l1_batch`.
let metadata = create_l1_batch_metadata(0);
conn.blocks_dal()
.save_l1_batch_metadata(L1BatchNumber(0), &metadata, H256::zero())
.save_l1_batch_metadata(
L1BatchNumber(0),
&metadata,
H256::zero(),
ProtocolVersionId::latest(),
)
.await
.unwrap();
drop(conn);
Expand Down
7 changes: 6 additions & 1 deletion core/lib/zksync_core/src/sync_layer/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ async fn mock_l1_batch_hash_computation(pool: ConnectionPool, number: u32) {
let metadata = create_l1_batch_metadata(number);
storage
.blocks_dal()
.save_l1_batch_metadata(L1BatchNumber(1), &metadata, H256::zero())
.save_l1_batch_metadata(
L1BatchNumber(1),
&metadata,
H256::zero(),
ProtocolVersionId::latest(),
)
.await
.unwrap();
break;
Expand Down