-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
210 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
core/node/commitment_generator/src/commitment_post_processor.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use std::fmt; | ||
|
||
use zksync_types::{ | ||
commitment::{L1BatchAuxiliaryOutput, L1BatchCommitment}, | ||
H256, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub struct ValidiumCommitmentPostProcessor; | ||
|
||
#[derive(Debug)] | ||
pub struct RollupCommitmentPostProcessor; | ||
|
||
/// Definition of trait handling post processing the L1BatchCommitment depending on the DA solution | ||
/// being utilized. | ||
pub trait CommitmentPostProcessor: 'static + fmt::Debug + Send + Sync { | ||
fn post_process_commitment(&self, commitment: L1BatchCommitment) -> L1BatchCommitment; | ||
} | ||
|
||
impl CommitmentPostProcessor for ValidiumCommitmentPostProcessor { | ||
fn post_process_commitment(&self, mut commitment: L1BatchCommitment) -> L1BatchCommitment { | ||
let aux_output = match commitment.aux_output() { | ||
L1BatchAuxiliaryOutput::PostBoojum { | ||
common, | ||
system_logs_linear_hash, | ||
state_diffs_compressed, | ||
state_diffs_hash, | ||
aux_commitments, | ||
blob_linear_hashes, | ||
blob_commitments, | ||
} => L1BatchAuxiliaryOutput::PostBoojum { | ||
common, | ||
system_logs_linear_hash, | ||
state_diffs_compressed, | ||
state_diffs_hash, | ||
aux_commitments, | ||
blob_linear_hashes: vec![H256::zero(); blob_linear_hashes.len()], | ||
blob_commitments: vec![H256::zero(); blob_commitments.len()], | ||
}, | ||
_ => commitment.aux_output(), | ||
}; | ||
|
||
commitment.auxiliary_output = aux_output; | ||
commitment | ||
} | ||
} | ||
|
||
impl CommitmentPostProcessor for RollupCommitmentPostProcessor { | ||
fn post_process_commitment(&self, commitment: L1BatchCommitment) -> L1BatchCommitment { | ||
commitment | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.