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

Commit

Permalink
fix(zkevm-circuits/begin_tx): minor refactor & todo comment
Browse files Browse the repository at this point in the history
  • Loading branch information
curryrasul committed Mar 4, 2024
1 parent 1ab9f99 commit 8996f37
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
tx.caller_address.to_word(),
create.caller_address(),
);

cb.require_equal(
"tx nonce equivalence",
tx.nonce.expr(),
create.caller_nonce(),
);

// 1. Handle contract creation transaction.
cb.condition(tx.is_create.expr(), |cb| {
cb.require_equal_word(
"call callee address equivalence",
Expand All @@ -202,21 +210,14 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
)
.to_word(),
);
});
cb.require_equal(
"tx nonce equivalence",
tx.nonce.expr(),
create.caller_nonce(),
);

// 1. Handle contract creation transaction.
cb.condition(tx.is_create.expr(), |cb| {
cb.keccak_table_lookup(
create.input_rlc(cb),
create.input_length(),
caller_nonce_hash_bytes.to_word(),
);

// cb.keccak_table_lookup(input_rlc, input_len, output);

cb.account_write(
call_callee_address.to_word(),
AccountFieldTag::Nonce,
Expand Down

0 comments on commit 8996f37

Please sign in to comment.