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

Commit

Permalink
expand receiver creation args
Browse files Browse the repository at this point in the history
  • Loading branch information
ChihChengLiang committed Mar 5, 2024
1 parent 7449289 commit f8773e2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
4 changes: 3 additions & 1 deletion zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
region,
offset,
&mut rws,
(callee_exists, tx.value, tx.is_create()),
callee_exists,
tx.value,
tx.is_create(),
Some(gas_fee),
)?;
self.begin_tx.assign(region, offset, tx)?;
Expand Down
9 changes: 2 additions & 7 deletions zkevm-circuits/src/evm_circuit/execution/callop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,8 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {

// conditionally assign
if is_call && is_precheck_ok {
self.transfer.assign(
region,
offset,
&mut rws,
(callee_exists, value, false),
None,
)?;
self.transfer
.assign(region, offset, &mut rws, callee_exists, value, false, None)?;
}

self.opcode
Expand Down
4 changes: 3 additions & 1 deletion zkevm-circuits/src/evm_circuit/execution/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,9 @@ impl<F: Field, const IS_CREATE2: bool, const S: ExecutionState> ExecutionGadget<
region,
offset,
&mut rws,
(!callee_prev_code_hash.is_zero(), value, true),
!callee_prev_code_hash.is_zero(),
value,
true,
None,
)?;
}
Expand Down
4 changes: 3 additions & 1 deletion zkevm-circuits/src/evm_circuit/execution/end_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ impl<F: Field> ExecutionGadget<F> for EndTxGadget<F> {
region,
offset,
&mut rws,
(!coinbase_code_hash_prev.is_zero(), coinbase_reward, false),
!coinbase_code_hash_prev.is_zero(),
coinbase_reward,
false,
)?;
self.is_persistent.assign(
region,
Expand Down
10 changes: 7 additions & 3 deletions zkevm-circuits/src/evm_circuit/util/common_gadget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ impl<F: Field> TransferToGadget<F> {
region: &mut CachedRegion<'_, '_, F>,
offset: usize,
rws: &mut StepRws,
(receiver_exists, value, is_create): (bool, U256, bool),
receiver_exists: bool,
value: U256,
is_create: bool,
) -> Result<(), Error> {
if !receiver_exists && (!value.is_zero() || is_create) {
// receiver's code_hash
Expand Down Expand Up @@ -533,7 +535,9 @@ impl<F: Field, const WITH_FEE: bool> TransferGadget<F, WITH_FEE> {
region: &mut CachedRegion<'_, '_, F>,
offset: usize,
rws: &mut StepRws,
(receiver_exists, value, is_create): (bool, U256, bool),
receiver_exists: bool,
value: U256,
is_create: bool,
gas_fee: Option<U256>,
) -> Result<(), Error> {
if WITH_FEE {
Expand All @@ -559,7 +563,7 @@ impl<F: Field, const WITH_FEE: bool> TransferGadget<F, WITH_FEE> {
sender_balance_sub_value.0,
)?;
self.receiver
.assign(region, offset, rws, (receiver_exists, value, is_create))?;
.assign(region, offset, rws, receiver_exists, value, is_create)?;
self.value_is_zero
.assign_value(region, offset, Value::known(WordLoHi::from(value)))?;
Ok(())
Expand Down

0 comments on commit f8773e2

Please sign in to comment.