Skip to content

Commit

Permalink
begin_tx adjust rw offset when curie
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamWuGit committed May 29, 2024
1 parent 38c8978 commit 0941e1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions bus-mapping/src/circuit_input_builder/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,14 @@ impl TxL1Fee {
(tx_l1_fee % TX_L1_FEE_PRECISION as u128) as u64,
)
}

#[cfg(feature = "l1_fee_curie")]
{
// "commitScalar * l1BaseFee + blobScalar * _data.length * l1BlobBaseFee",
let tx_l1_fee = self.commit_scalar as u128 * self.base_fee as u128
+ self.blob_scalar as u128 * tx_rlp_signed_len as u128 * self.l1_blob_basefee as u128;
+ self.blob_scalar as u128
* tx_rlp_signed_len as u128
* self.l1_blob_basefee as u128;
(
(tx_l1_fee / TX_L1_FEE_PRECISION as u128) as u64,
(tx_l1_fee % TX_L1_FEE_PRECISION as u128) as u64,
Expand Down
12 changes: 9 additions & 3 deletions zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,10 +917,16 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
rws.offset_add(TxAccessListGadget::<F>::rw_delta_value(tx) as usize);

let rw = rws.next();
debug_assert_eq!(rw.tag(), RwTableTag::CallContext);
debug_assert_eq!(rw.field_tag(), Some(CallContextFieldTag::L1Fee as u64));

rws.offset_add(3);
#[cfg(not(feature = "l1_fee_curie"))]
{
debug_assert_eq!(rw.tag(), RwTableTag::CallContext);
debug_assert_eq!(rw.field_tag(), Some(CallContextFieldTag::L1Fee as u64));
rws.offset_add(3);
}

#[cfg(feature = "l1_fee_curie")]
rws.offset_add(6);

let rw = rws.next();
debug_assert_eq!(rw.tag(), RwTableTag::Account);
Expand Down

0 comments on commit 0941e1e

Please sign in to comment.