Skip to content

Commit

Permalink
Assert block commitment
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Nov 23, 2020
1 parent 5484b69 commit 002d151
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions core/lib/circuit/src/witness/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,5 +788,14 @@ pub fn build_block_witness<'a>(
block.new_root_hash
);
witness_accum.calculate_pubdata_commitment();

let mut block_commitment = block.block_commitment.as_bytes().to_vec();
block_commitment[0] = block_commitment[0] & (0xffu8 >> 3);
let block_commitment = fr_from_bytes(block_commitment);
assert_eq!(
witness_accum.pubdata_commitment.unwrap(),
block_commitment,
"witness accumulator and server different commitment"
);
Ok(witness_accum)
}

0 comments on commit 002d151

Please sign in to comment.