Skip to content

Commit

Permalink
fix proof diff measurement (changed with new proof rollback mechanism)
Browse files Browse the repository at this point in the history
  • Loading branch information
librelois committed Apr 19, 2023
1 parent d59476b commit e7de773
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/block-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ where
let parent_hash = self.parent_hash;
let extrinsics = &mut self.extrinsics;
let version = self.version;
let proof_before = self
.api.proof_recorder().map(|pr| pr.estimate_encoded_size()).unwrap_or(0);

self.api.execute_in_transaction(|api| {
let res = if version < 6 {
Expand All @@ -233,8 +235,9 @@ where
Ok(Ok(_)) => {
// Verify that the transaction exectuion was not exhaust the proof size limit
if let Some(proof_diff_limit) = ensure_proof_limit {
let proof_diff =
let proof_after =
api.proof_recorder().map(|pr| pr.estimate_encoded_size()).unwrap_or(0);
let proof_diff = proof_after - proof_before;

if proof_diff > proof_diff_limit {
// The execution of the transaction results in exceeding the limits,
Expand Down

0 comments on commit e7de773

Please sign in to comment.