Skip to content

Commit 1bd4e0e

Browse files
committed
Fix tests!
1 parent a815c3f commit 1bd4e0e

File tree

1 file changed

+21
-4
lines changed
  • core/node/node_sync/src/batch_status_updater

1 file changed

+21
-4
lines changed

core/node/node_sync/src/batch_status_updater/tests.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use zksync_contracts::BaseSystemContractsHashes;
99
use zksync_node_genesis::{insert_genesis_batch, GenesisParams};
1010
use zksync_node_test_utils::{create_l1_batch, create_l2_block, prepare_recovery_snapshot};
1111
use zksync_types::{
12-
web3::{Log, TransactionReceipt},
13-
L2BlockNumber,
12+
block::L1BatchTreeData, commitment::L1BatchCommitmentArtifacts, web3::{Log, TransactionReceipt}, L2BlockNumber
1413
};
1514
use zksync_web3_decl::client::{MockClient, L1};
1615

@@ -33,6 +32,25 @@ async fn seal_l1_batch(storage: &mut Connection<'_, Core>, number: L1BatchNumber
3332
.insert_mock_l1_batch(&l1_batch)
3433
.await
3534
.unwrap();
35+
36+
storage
37+
.blocks_dal()
38+
.save_l1_batch_tree_data(number, &L1BatchTreeData{
39+
hash: H256::zero(),
40+
rollup_last_leaf_index: 0,
41+
})
42+
.await
43+
.unwrap();
44+
45+
storage
46+
.blocks_dal()
47+
.save_l1_batch_commitment_artifacts(
48+
number,
49+
&L1BatchCommitmentArtifacts::default(),
50+
)
51+
.await
52+
.unwrap();
53+
3654
storage
3755
.blocks_dal()
3856
.mark_l2_blocks_as_executed_in_l1_batch(number)
@@ -249,7 +267,6 @@ impl MockSlClient {
249267
let mut batch_number_bytes = [0u8; 4];
250268
batch_number_bytes.copy_from_slice(&bytes[28..32]);
251269
let batch_number = u32::from_be_bytes(batch_number_bytes);
252-
println!("Returning mock tx for batch {} type {}", batch_number, tx_type);
253270

254271
let topics: Vec<H256> = match tx_type {
255272
1 => {
@@ -260,7 +277,7 @@ impl MockSlClient {
260277
2 => {
261278
// BlocksVerification (index_topic_1 uint256 previousLastVerifiedBlock, index_topic_2 uint256 currentLastVerifiedBlock
262279
let event = contract.event("BlocksVerification").unwrap();
263-
vec![event.signature(), H256::from_low_u64_be(batch_number.into()), H256::from_low_u64_be(batch_number.into())]
280+
vec![event.signature(), H256::from_low_u64_be((batch_number - 1).into()), H256::from_low_u64_be(batch_number.into())]
264281
}
265282
3 => {
266283
// BlockExecution (index_topic_1 uint256 blockNumber, index_topic_2 bytes32 blockHash, index_topic_3 bytes32 commitment)

0 commit comments

Comments
 (0)