Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
fix the read write order
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Feb 22, 2024
1 parent dacf577 commit bd0c75e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,16 +468,20 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
is_precompiled(&tx.to_or_contract_addr()) || !callee_code_hash.is_zero();
let caller_balance_sub_fee_pair = rws.next().account_balance_pair();
let must_create = tx.is_create();

let caller_balance_sub_value_pair = if !tx.value.is_zero() {
rws.next().account_balance_pair()
} else {
(zero, zero)
};
if !callee_exists && (!tx.value.is_zero() || must_create) {
callee_code_hash = rws.next().account_codehash_pair().1;
}
let mut caller_balance_sub_value_pair = (zero, zero);
let mut callee_balance_pair = (zero, zero);
if !tx.value.is_zero() {
caller_balance_sub_value_pair = rws.next().account_balance_pair();
callee_balance_pair = rws.next().account_balance_pair();
let callee_balance_pair = if !tx.value.is_zero() {
rws.next().account_balance_pair()
} else {
(zero, zero)
};

self.begin_tx.assign(region, offset, tx)?;
self.tx.assign(region, offset, tx)?;

Expand Down

0 comments on commit bd0c75e

Please sign in to comment.