Skip to content
Open
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
7 changes: 6 additions & 1 deletion ethexe/consensus/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ pub fn prepare_chain_for_batch_commitment(db: &Database) -> BatchCommitment {
db.set_code_valid(code_commitment1.id, code_commitment1.valid);
db.set_code_valid(code_commitment2.id, code_commitment2.valid);

// Sort transitions by actor_id to match `squash_transitions_by_actor` output
// (which uses BTreeMap, producing actor_id-sorted results).
let mut transitions = [transitions1, transitions2].concat();
transitions.sort_by_key(|t| t.actor_id);

BatchCommitment {
block_hash: block3.hash,
timestamp: block3.header.timestamp,
previous_batch: Digest::zero(),
expiry: 1,
chain_commitment: Some(ChainCommitment {
transitions: [transitions1, transitions2].concat(),
transitions,
head_announce: db.top_announce_hash(block3.hash),
}),
code_commitments: vec![code_commitment1, code_commitment2],
Expand Down
6 changes: 5 additions & 1 deletion ethexe/consensus/src/validator/batch/filler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ impl BatchFiller {
}
}

pub fn into_parts(self) -> BatchParts {
pub fn into_parts(mut self) -> BatchParts {
if let Some(chain) = &mut self.parts.chain_commitment {
chain.transitions =
super::utils::squash_transitions_by_actor(std::mem::take(&mut chain.transitions));
}
self.parts
}

Expand Down
3 changes: 3 additions & 0 deletions ethexe/consensus/src/validator/batch/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ impl BatchCommitmentManager {
break;
}
}
chain_commitment.transitions = super::utils::squash_transitions_by_actor(
std::mem::take(&mut chain_commitment.transitions),
);
batch_parts.chain_commitment = Some(chain_commitment);
}

Expand Down
Loading
Loading