Skip to content

Commit

Permalink
Add mention to revert before production
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Sep 29, 2023
1 parent e11592e commit 725c38e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions evm/src/cpu/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ fn eval_packed_accumulate<P: PackedField>(
})
.sum();

// TODO: This may cause soundness issue if the recomputed gas (as u64) overflows the field size.
// This is fine as we are only using two-limbs for testing purposes (to support all cases from
// the Ethereum test suite).
// This should be changed back to a single 32-bit limb before going into production!
let gas_diff = nv.gas[1] * P::Scalar::from_canonical_u64(1 << 32) + nv.gas[0]
- (lv.gas[1] * P::Scalar::from_canonical_u64(1 << 32) + lv.gas[0]);
let constr = gas_diff - gas_used;
Expand Down Expand Up @@ -157,6 +161,10 @@ fn eval_ext_circuit_accumulate<F: RichField + Extendable<D>, const D: usize>(
},
);

// TODO: This may cause soundness issue if the recomputed gas (as u64) overflows the field size.
// This is fine as we are only using two-limbs for testing purposes (to support all cases from
// the Ethereum test suite).
// This should be changed back to a single 32-bit limb before going into production!
let nv_gas =
builder.mul_const_add_extension(F::from_canonical_u64(1 << 32), nv.gas[1], nv.gas[0]);
let lv_gas =
Expand Down
4 changes: 4 additions & 0 deletions evm/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ pub struct BlockHashes {
pub cur_hash: H256,
}

// TODO: Before going into production, `block_gas_used` and `block_gaslimit` here
// as well as `gas_used_before` / `gas_used_after` in `ExtraBlockData` should be
// updated to fit in a single 32-bit limb, as supporting 64-bit values for those
// fields is only necessary for testing purposes.
/// Metadata contained in a block header. Those are identical between
/// all state transition proofs within the same block.
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
Expand Down

0 comments on commit 725c38e

Please sign in to comment.