Skip to content

Commit 9e77a87

Browse files
authored
fix: fix unit tests CI (#4296)
## What ❔ <!-- What are the changes this PR brings about? --> <!-- Example: This PR adds a PR template to the repo. --> <!-- (For bigger PRs adding more context is appreciated) --> ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- The `Why` has to be clear to non-Matter Labs entities running their own ZK Chain --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Is this a breaking change? - [ ] Yes - [ ] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`.
1 parent 7b6a060 commit 9e77a87

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

core/lib/dal/src/consensus/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn payload(rng: &mut impl Rng, protocol_version: ProtocolVersionId) -> Payload {
7979

8080
fn interop_root(rng: &mut impl Rng) -> InteropRoot {
8181
InteropRoot {
82-
chain_id: L2ChainId::new(rng.gen()).unwrap(),
82+
chain_id: L2ChainId::new(rng.gen::<u32>().into()).unwrap(),
8383
block_number: rng.gen(),
8484
sides: (0..10).map(|_| rng.gen()).collect(),
8585
}

core/lib/multivm/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ tracing.workspace = true
3636
vise.workspace = true
3737
ethabi.workspace = true
3838

39+
[features]
40+
test-utils = []
41+
3942
[dev-dependencies]
4043
assert_matches.workspace = true
4144
pretty_assertions.workspace = true

core/lib/multivm/src/versions/vm_latest/bootloader/utils.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
use zksync_types::{ethabi, h256_to_u256, InteropRoot, ProtocolVersionId, U256};
22

33
use super::tx::BootloaderTx;
4+
#[cfg(any(test, feature = "test-utils"))]
5+
use crate::versions::vm_latest::constants::get_current_number_of_roots_in_block_offset;
46
use crate::{
57
interface::{
68
pubdata::{PubdataBuilder, PubdataInput},
@@ -213,6 +215,13 @@ fn apply_interop_root_number_in_block_number(
213215
let first_empty_slot = get_interop_blocks_begin_offset(subversion) + block_index_in_batch;
214216
let number_of_interop_roots_plus_one: U256 = (number_of_interop_roots + 1).into();
215217
memory.push((first_empty_slot, number_of_interop_roots_plus_one));
218+
// FIXME: Needed to write the block index in batch to the bootloader memory
219+
// This value is directly set by the bootloader, so we only need to write it in test mode
220+
#[cfg(any(test, feature = "test-utils"))]
221+
memory.extend(vec![(
222+
get_current_number_of_roots_in_block_offset(subversion),
223+
block_index_in_batch.into(),
224+
)]);
216225
}
217226

218227
fn bootloader_memory_input(

core/node/state_keeper/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ serde.workspace = true
4444
hex.workspace = true
4545

4646
[dev-dependencies]
47+
zksync_multivm = { workspace = true, features = ["test-utils"] }
4748
assert_matches.workspace = true
4849
rand.workspace = true
4950
tempfile.workspace = true

0 commit comments

Comments
 (0)