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

Rename Word::zero to Word::zero_expr #1748

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
cb.account_write(
call_callee_address.to_word(),
AccountFieldTag::Nonce,
Word::one(),
Word::zero(),
Word::one_expr(),
Word::zero_expr(),
Some(&mut reversion_info),
);
for (field_tag, value) in [
(CallContextFieldTag::Depth, Word::one()),
(CallContextFieldTag::Depth, Word::one_expr()),
(
CallContextFieldTag::CallerAddress,
tx.caller_address.to_word(),
Expand All @@ -235,24 +235,24 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
CallContextFieldTag::CalleeAddress,
call_callee_address.to_word(),
),
(CallContextFieldTag::CallDataOffset, Word::zero()),
(CallContextFieldTag::CallDataOffset, Word::zero_expr()),
(
CallContextFieldTag::CallDataLength,
Word::from_lo_unchecked(tx.call_data_length.expr()),
),
(CallContextFieldTag::Value, tx.value.to_word()),
(CallContextFieldTag::IsStatic, Word::zero()),
(CallContextFieldTag::LastCalleeId, Word::zero()),
(CallContextFieldTag::IsStatic, Word::zero_expr()),
(CallContextFieldTag::LastCalleeId, Word::zero_expr()),
(
CallContextFieldTag::LastCalleeReturnDataOffset,
Word::zero(),
Word::zero_expr(),
),
(
CallContextFieldTag::LastCalleeReturnDataLength,
Word::zero(),
Word::zero_expr(),
),
(CallContextFieldTag::IsRoot, Word::one()),
(CallContextFieldTag::IsCreate, Word::one()),
(CallContextFieldTag::IsRoot, Word::one_expr()),
(CallContextFieldTag::IsCreate, Word::one_expr()),
(
CallContextFieldTag::CodeHash,
cb.curr.state.code_hash.to_word(),
Expand Down Expand Up @@ -349,7 +349,7 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
|cb| {
// Setup first call's context.
for (field_tag, value) in [
(CallContextFieldTag::Depth, Word::one()),
(CallContextFieldTag::Depth, Word::one_expr()),
(
CallContextFieldTag::CallerAddress,
tx.caller_address.to_word(),
Expand All @@ -358,23 +358,23 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {
CallContextFieldTag::CalleeAddress,
tx.callee_address.to_word(),
),
(CallContextFieldTag::CallDataOffset, Word::zero()),
(CallContextFieldTag::CallDataOffset, Word::zero_expr()),
(
CallContextFieldTag::CallDataLength,
Word::from_lo_unchecked(tx.call_data_length.expr()),
),
(CallContextFieldTag::Value, tx.value.to_word()),
(CallContextFieldTag::IsStatic, Word::zero()),
(CallContextFieldTag::LastCalleeId, Word::zero()),
(CallContextFieldTag::IsStatic, Word::zero_expr()),
(CallContextFieldTag::LastCalleeId, Word::zero_expr()),
(
CallContextFieldTag::LastCalleeReturnDataOffset,
Word::zero(),
Word::zero_expr(),
),
(
CallContextFieldTag::LastCalleeReturnDataLength,
Word::zero(),
Word::zero_expr(),
),
(CallContextFieldTag::IsRoot, Word::one()),
(CallContextFieldTag::IsRoot, Word::one_expr()),
(
CallContextFieldTag::IsCreate,
Word::from_lo_unchecked(tx.is_create.expr()),
Expand Down
14 changes: 7 additions & 7 deletions zkevm-circuits/src/evm_circuit/execution/callop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {
CallContextFieldTag::LastCalleeReturnDataOffset,
CallContextFieldTag::LastCalleeReturnDataLength,
] {
cb.call_context_lookup_write(None, field_tag, Word::zero());
cb.call_context_lookup_write(None, field_tag, Word::zero_expr());
}

// For CALL opcode, it has an extra stack pop `value` (+1) and if the value is
Expand Down Expand Up @@ -588,7 +588,7 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {
CallContextFieldTag::LastCalleeReturnDataOffset,
CallContextFieldTag::LastCalleeReturnDataLength,
] {
cb.call_context_lookup_write(None, field_tag, Word::zero());
cb.call_context_lookup_write(None, field_tag, Word::zero_expr());
}

cb.require_step_state_transition(StepStateTransition {
Expand Down Expand Up @@ -689,17 +689,17 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {
CallContextFieldTag::IsStatic,
Word::from_lo_unchecked(or::expr([is_static.expr(), is_staticcall.expr()])),
),
(CallContextFieldTag::LastCalleeId, Word::zero()),
(CallContextFieldTag::LastCalleeId, Word::zero_expr()),
(
CallContextFieldTag::LastCalleeReturnDataOffset,
Word::zero(),
Word::zero_expr(),
),
(
CallContextFieldTag::LastCalleeReturnDataLength,
Word::zero(),
Word::zero_expr(),
),
(CallContextFieldTag::IsRoot, Word::zero()),
(CallContextFieldTag::IsCreate, Word::zero()),
(CallContextFieldTag::IsRoot, Word::zero_expr()),
(CallContextFieldTag::IsCreate, Word::zero_expr()),
(
CallContextFieldTag::CodeHash,
call_gadget.callee_code_hash.to_word(),
Expand Down
10 changes: 5 additions & 5 deletions zkevm-circuits/src/evm_circuit/execution/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl<F: Field, const IS_CREATE2: bool, const S: ExecutionState> ExecutionGadget<
CallContextFieldTag::LastCalleeReturnDataOffset,
CallContextFieldTag::LastCalleeReturnDataLength,
] {
cb.call_context_lookup_write(None, field_tag, Word::zero());
cb.call_context_lookup_write(None, field_tag, Word::zero_expr());
}

cb.require_step_state_transition(StepStateTransition {
Expand Down Expand Up @@ -342,8 +342,8 @@ impl<F: Field, const IS_CREATE2: bool, const S: ExecutionState> ExecutionGadget<
cb.account_write(
contract_addr.to_word(),
AccountFieldTag::Nonce,
Word::one(),
Word::zero(),
Word::one_expr(),
Word::zero_expr(),
Some(&mut callee_reversion_info),
);

Expand Down Expand Up @@ -420,7 +420,7 @@ impl<F: Field, const IS_CREATE2: bool, const S: ExecutionState> ExecutionGadget<
CallContextFieldTag::LastCalleeReturnDataOffset,
CallContextFieldTag::LastCalleeReturnDataLength,
] {
cb.call_context_lookup_write(None, field_tag, Word::zero());
cb.call_context_lookup_write(None, field_tag, Word::zero_expr());
}
cb.require_step_state_transition(StepStateTransition {
rw_counter: Delta(cb.rw_counter_offset()),
Expand Down Expand Up @@ -463,7 +463,7 @@ impl<F: Field, const IS_CREATE2: bool, const S: ExecutionState> ExecutionGadget<
CallContextFieldTag::LastCalleeReturnDataOffset,
CallContextFieldTag::LastCalleeReturnDataLength,
] {
cb.call_context_lookup_write(None, field_tag, Word::zero());
cb.call_context_lookup_write(None, field_tag, Word::zero_expr());
}

cb.require_step_state_transition(StepStateTransition {
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/evm_circuit/execution/end_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<F: Field> ExecutionGadget<F> for EndBlockGadget<F> {
total_txs.expr() + 1.expr(),
TxContextFieldTag::CallerAddress,
None,
Word::zero(),
Word::zero_expr(),
);
// Since every tx lookup done in the EVM circuit must succeed
// and uses a unique tx_id, we know that at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl<F: Field> ExecutionGadget<F> for ErrorPrecompileFailedGadget<F> {
cb.stack_pop(cd_length.to_word());
cb.stack_pop(rd_offset.to_word());
cb.stack_pop(rd_length.to_word());
cb.stack_push(Word::zero());
cb.stack_push(Word::zero_expr());

for (field_tag, value) in [
(CallContextFieldTag::LastCalleeId, callee_call_id.expr()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<F: Field> ExecutionGadget<F> for ErrorWriteProtectionGadget<F> {
});

// current call context is readonly
cb.call_context_lookup_read(None, CallContextFieldTag::IsStatic, Word::one());
cb.call_context_lookup_read(None, CallContextFieldTag::IsStatic, Word::one_expr());

// constrain not root call as at least one previous staticcall preset.
cb.require_zero(
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/evm_circuit/execution/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<F: Field> ExecutionGadget<F> for StopGadget<F> {
);

// Call ends with STOP must be successful
cb.call_context_lookup_read(None, CallContextFieldTag::IsSuccess, Word::one());
cb.call_context_lookup_read(None, CallContextFieldTag::IsSuccess, Word::one_expr());

let is_to_end_tx = cb.next.execution_state_selector([ExecutionState::EndTx]);
cb.require_equal(
Expand Down
6 changes: 3 additions & 3 deletions zkevm-circuits/src/evm_circuit/util/common_gadget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl<F: Field> TransferToGadget<F> {
receiver_address.clone(),
AccountFieldTag::CodeHash,
cb.empty_code_hash(),
Word::zero(),
Word::zero_expr(),
reversion_info,
);
},
Expand Down Expand Up @@ -767,7 +767,7 @@ impl<F: Field, MemAddrGadget: CommonMemoryAddressGadget<F>, const IS_SUCCESS_CAL
cb.stack_push(if IS_SUCCESS_CALL {
Word::from_lo_unchecked(is_success.expr()) // is_success is bool
} else {
Word::zero()
Word::zero_expr()
});

// Recomposition of random linear combination to integer
Expand Down Expand Up @@ -1097,7 +1097,7 @@ impl<F: Field> CommonErrorGadget<F> {
let rw_counter_end_of_reversion = cb.query_word_unchecked(); // rw_counter_end_of_reversion just used for read lookup, therefore skip range check

// current call must be failed.
cb.call_context_lookup_read(None, CallContextFieldTag::IsSuccess, Word::zero());
cb.call_context_lookup_read(None, CallContextFieldTag::IsSuccess, Word::zero_expr());

cb.call_context_lookup_read(
None,
Expand Down
Loading
Loading