Skip to content

Commit 56b22a6

Browse files
committed
cleanup comments
1 parent 453ff8a commit 56b22a6

19 files changed

+17
-156
lines changed

zkevm-circuits/src/evm_circuit/execution/logs.rs

-2
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ impl<F: Field> ExecutionGadget<F> for LogGadget<F> {
207207
let [memory_start, msize] =
208208
[step.rw_indices[0], step.rw_indices[1]].map(|idx| block.rws[idx].stack_value());
209209

210-
//self.mstart_word.assign(region, offset, memory_start)?;
211-
212210
let memory_address = self
213211
.memory_address
214212
.assign(region, offset, memory_start, msize)?;

zkevm-circuits/src/evm_circuit/execution/precompiles/ecrecover.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,7 @@ impl<F: Field> ExecutionGadget<F> for EcrecoverGadget<F> {
172172
.expect("sig_v is 32 bytes"),
173173
),
174174
);
175-
// cb.require_equal(
176-
// "Secp256k1::Fq modulus assigned correctly",
177-
// fq_modulus.expr(),
178-
// cb.word_rlc::<N_BYTES_WORD>(FQ_MODULUS.to_le_bytes().map(|b| b.expr())),
179-
// );
175+
180176
cb.require_equal(
181177
"Secp256k1::Fq modulus assigned correctly",
182178
cb.word_rlc::<N_BYTES_WORD>(fq_modulus.clone().limbs.map(|cell| cell.expr())),

zkevm-circuits/src/evm_circuit/execution/return_revert.rs

-2
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,6 @@ impl<F: Field> ExecutionGadget<F> for ReturnRevertGadget<F> {
413413
self.keccak_code_hash.assign_u256(
414414
region,
415415
offset,
416-
//region.word_rlc(U256::from_big_endian(&keccak_code_hash)),
417-
//TODO: from_little_endiam
418416
U256::from_big_endian(&keccak_code_hash),
419417
)?;
420418

zkevm-circuits/src/evm_circuit/execution/swap.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ impl<F: Field> ExecutionGadget<F> for SwapGadget<F> {
3232
fn configure(cb: &mut EVMConstraintBuilder<F>) -> Self {
3333
let opcode = cb.query_cell();
3434

35-
//let phase2_values = [cb.query_cell_phase2(), cb.query_cell_phase2()];
3635
let values = [cb.query_word_unchecked(), cb.query_word_unchecked()];
3736

3837
// The stack index we have to peek, deduced from the 'x' value of

zkevm-circuits/src/evm_circuit/step.rs

-22
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ pub enum ExecutionState {
8484
BLOCKCTXU64, // TIMESTAMP, NUMBER, GASLIMIT
8585
BLOCKCTXU160, // COINBASE
8686
BLOCKCTXU256, // BASEFEE, DIFFICULTY (for non-scroll)
87-
/// TIMESTAMP, NUMBER, GASLIMIT, COINBASE, DIFFICULTY, BASEFEE
88-
// BLOCKCTX,
8987
#[cfg(feature = "scroll")]
9088
DIFFICULTY, // DIFFICULTY
9189
CHAINID,
@@ -282,26 +280,6 @@ impl ExecutionState {
282280
vec![OpcodeId::DIFFICULTY, OpcodeId::BASEFEE]
283281
}
284282
}
285-
// Self::BLOCKCTX => {
286-
// if cfg!(feature = "scroll") {
287-
// vec![
288-
// OpcodeId::TIMESTAMP,
289-
// OpcodeId::NUMBER,
290-
// OpcodeId::GASLIMIT,
291-
// OpcodeId::COINBASE,
292-
// OpcodeId::DIFFICULTY,
293-
// ]
294-
// } else {
295-
// vec![
296-
// OpcodeId::TIMESTAMP,
297-
// OpcodeId::NUMBER,
298-
// OpcodeId::GASLIMIT,
299-
// OpcodeId::COINBASE,
300-
// OpcodeId::DIFFICULTY,
301-
// OpcodeId::BASEFEE,
302-
// ]
303-
// }
304-
// }
305283
#[cfg(feature = "scroll")]
306284
Self::DIFFICULTY => vec![OpcodeId::DIFFICULTY],
307285
Self::CHAINID => vec![OpcodeId::CHAINID],

zkevm-circuits/src/evm_circuit/table.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pub(crate) enum Lookup<F> {
229229
/// field_tag is Calldata, otherwise should be set to 0.
230230
index: Expression<F>,
231231
/// Value of the field.
232-
// value: Word<Expression<F>>,
232+
// value: Word<Expression<F>>, change to word in stage2
233233
value: Expression<F>,
234234
},
235235
/// Lookup to read-write table, which contains read-write access records of
@@ -457,6 +457,7 @@ impl<F: Field> Lookup<F> {
457457
number,
458458
value,
459459
} => {
460+
// used in stage2 after block table to word
460461
//vec![field_tag.clone(), number.clone(), value.lo(), value.hi()]
461462
vec![field_tag.clone(), number.clone(), value.clone()]
462463
}

zkevm-circuits/src/evm_circuit/util/common_gadget.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,6 @@ pub(crate) struct CommonCallGadget<F, MemAddrGadget, const IS_SUCCESS_CALL: bool
10641064
// phase2_callee_code_hash
10651065
pub callee_code_hash: WordCell<F>,
10661066
pub is_empty_code_hash: IsEqualWordGadget<F, WordCell<F>, Word<Expression<F>>>,
1067-
//pub is_empty_code_hash: IsEqualGadget<F>,
10681067

10691068
//pub callee_not_exists: IsZeroGadget<F>,
10701069
pub callee_not_exists: IsZeroWordGadget<F, WordCell<F>>,
@@ -1496,7 +1495,6 @@ impl<F: Field> CommonErrorGadget<F> {
14961495
) -> Self {
14971496
cb.opcode_lookup_rlc(opcode.expr(), push_rlc);
14981497

1499-
//let rw_counter_end_of_reversion = cb.query_cell();
15001498
// rw_counter_end_of_reversion just used for read lookup, therefore skip range check
15011499
let rw_counter_end_of_reversion = cb.query_word_unchecked();
15021500

@@ -1640,9 +1638,7 @@ impl<F: Field, const VALID_BYTES: usize> WordByteCapGadget<F, VALID_BYTES> {
16401638
self.lt_cap.expr()
16411639
}
16421640

1643-
// pub(crate) fn original_ref(&self) -> &Word<F> {
1644-
// self.word.original.clone()
1645-
// }
1641+
// orginal ref of word limbs
16461642
pub(crate) fn original_ref(&self) -> &Word32Cell<F> {
16471643
self.word.original_ref()
16481644
}

zkevm-circuits/src/evm_circuit/util/constraint_builder.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,6 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> {
566566
// poseidon codehash if enalbe scroll or poseidon-codehash, else keccak_hash.
567567
pub(crate) fn empty_code_hash(&self) -> Word<Expression<F>> {
568568
if cfg!(feature = "poseidon-codehash") {
569-
//let codehash = POSEIDON_CODE_HASH_EMPTY.to_word().to_scalar().unwrap();
570569
Word32::new(
571570
POSEIDON_CODE_HASH_EMPTY
572571
.to_word()
@@ -575,7 +574,6 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> {
575574
)
576575
.to_word()
577576
} else {
578-
//self.word_rlc((*EMPTY_CODE_HASH_LE).map(|byte| byte.expr()))
579577
Word32::new(EMPTY_CODE_HASH_LE.map(|byte| byte.expr())).to_word()
580578
}
581579
}
@@ -834,7 +832,7 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> {
834832
id: Expression<F>,
835833
field_tag: TxContextFieldTag,
836834
index: Option<Expression<F>>,
837-
//value: Word<Expression<F>>,
835+
//value: Word<Expression<F>>, used in stage2 for tx table to word
838836
value: Expression<F>,
839837
) {
840838
self.add_lookup(

zkevm-circuits/src/evm_circuit/util/math_gadget/modulo.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,8 @@ impl<F: Field> ModGadget<F> {
8585

8686
self.k.assign_u256(region, offset, k)?;
8787
self.a_or_zero.assign_u256(region, offset, a_or_zero)?;
88-
//let n_sum = (0..32).fold(0, |acc, idx| acc + n.byte(idx) as u64);
89-
//let a_or_zero_sum = (0..32).fold(0, |acc, idx| acc + a_or_zero.byte(idx) as u64);
90-
//self.n_is_zero.assign(region, offset, F::from(n_sum))?;
88+
9189
self.n_is_zero.assign(region, offset, word::Word::from(n))?;
92-
// self.a_or_is_zero
93-
// .assign(region, offset, F::from(a_or_zero_sum))?;
9490
self.a_or_is_zero
9591
.assign(region, offset, word::Word::from(a_or_zero))?;
9692
self.mul_add_words

zkevm-circuits/src/evm_circuit/util/math_gadget/rlp.rs

-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ impl<F: Field, const IS_CREATE2: bool> ContractCreateGadget<F, IS_CREATE2> {
411411
+ (self.caller_address_rlc(cb) * challenge_power_64)
412412
+ (self.salt_keccak_rlc(cb) * challenge_power_32)
413413
+ self.keccak_code_hash_keccak_rlc(cb)
414-
//+ self.code_hash_rlc.expr()
415414
} else {
416415
// RLC(RLP([caller_address, caller_nonce]))
417416
let challenge_power_21 = challenges[20].clone();

zkevm-circuits/src/evm_circuit/util/memory_gadget.rs

-4
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ impl<F: Field> MemoryAddressGadget<F> {
148148
memory_offset: WordCell<F>,
149149
memory_length: MemoryAddress<F>,
150150
) -> Self {
151-
// debug_assert_eq!(
152-
// CellType::StoragePhase2,
153-
// cb.curr.cell_manager.columns()[memory_offset.cell_column_index].cell_type
154-
// );
155151
let memory_length_is_zero = IsZeroGadget::construct(cb, sum::expr(&memory_length.limbs));
156152
let memory_offset_bytes = cb.query_memory_address();
157153

zkevm-circuits/src/mpt_circuit.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub struct MptCircuitConfigArgs {
5151
pub poseidon_table: PoseidonTable,
5252
/// MptTable
5353
pub mpt_table: MptTable,
54-
// Challenges
54+
// Challenges no need after word hi lo
5555
// pub challenges: Challenges,
5656
}
5757

@@ -71,7 +71,6 @@ impl SubCircuitConfig<Fr> for MptCircuitConfig<Fr> {
7171
Self::ConfigArgs {
7272
poseidon_table,
7373
mpt_table,
74-
// challenges,
7574
}: Self::ConfigArgs,
7675
) -> Self {
7776
let conf = mpt::MptCircuitConfig::configure(meta, &poseidon_table);
@@ -177,7 +176,6 @@ impl Circuit<Fr> for MptCircuit<Fr> {
177176
MptCircuitConfigArgs {
178177
poseidon_table,
179178
mpt_table,
180-
// challenges,
181179
},
182180
)
183181
};

zkevm-circuits/src/state_circuit.rs

+1-30
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ impl<F: Field> SubCircuitConfig<F> for StateCircuitConfig<F> {
130130
let id = MpiChip::configure(meta, selector, [rw_table.id], lookups);
131131
let address = MpiChip::configure(meta, selector, [rw_table.address], lookups);
132132

133-
// let storage_key = RlcChip::configure(
134-
// meta,
135-
// selector,
136-
// rw_table.storage_key,
137-
// lookups,
138-
// challenges.evm_word(),
139-
// );
140133
let storage_key = MpiChip::configure(
141134
meta,
142135
selector,
@@ -179,7 +172,6 @@ impl<F: Field> SubCircuitConfig<F> for StateCircuitConfig<F> {
179172
storage_key,
180173
rw_counter,
181174
};
182-
//let power_of_randomness: [Expression<F>; 31] =
183175
// challenges.evm_word_powers_of_randomness();
184176
let power_of_randomness: [Expression<F>; 31] = challenges.keccak_powers_of_randomness();
185177
let lexicographic_ordering = LexicographicOrderingConfig::configure(
@@ -266,15 +258,10 @@ impl<F: Field> StateCircuitConfig<F> {
266258
);
267259
let rows_len = rows.len();
268260

269-
// let mut state_root: Value<F> =
270-
// randomness.map(|randomness| rlc::value(&updates.old_root().to_le_bytes(),
271-
// randomness));
272261
let mut state_root = updates.old_root();
273262

274263
let mut start_state_root: Option<word::Word<AssignedCell<F, F>>> = None;
275264
let mut end_state_root: Option<word::Word<AssignedCell<F, F>>> = None;
276-
//let mut start_state_root: Option<AssignedCell<_, F>> = None;
277-
//let mut end_state_root: Option<AssignedCell<_, F>> = None;
278265
// annotate columns
279266
self.annotate_circuit_in_region(region);
280267

@@ -553,19 +540,6 @@ impl<F: Field> StateCircuitConfig<F> {
553540

554541
// Identify non-existing if both committed value and new value are zero and field tag is
555542
// CodeHash
556-
// let is_non_exist_inputs = randomness.map(|randomness| {
557-
// let (_, committed_value) = updates
558-
// .get(row)
559-
// .map(|u| u.value_assignments(randomness))
560-
// .unwrap_or_default();
561-
// let value = row.value_assignment(randomness);
562-
// [
563-
// F::from(row.field_tag().unwrap_or_default())
564-
// - F::from(AccountFieldTag::CodeHash as u64),
565-
// committed_value,
566-
// value,
567-
// ]
568-
// });
569543
let (committed_value, value) = {
570544
let (_, committed_value) = updates
571545
.get(row)
@@ -633,9 +607,6 @@ impl<F: Field> StateCircuitConfig<F> {
633607
) -> Result<StateCircuitExports<Assigned<F>>, Error> {
634608
let rows_len = rows.len();
635609

636-
// let mut state_root =
637-
// randomness.map(|randomness| rlc::value(&updates.old_root().to_le_bytes(),
638-
// randomness));
639610
let mut state_root = updates.old_root();
640611

641612
let mut start_state_root: Option<word::Word<AssignedCell<_, F>>> = None;
@@ -806,7 +777,7 @@ impl<F: Field> StateCircuitConfig<F> {
806777
self.initial_value,
807778
indices.len() - 1,
808779
)?;
809-
780+
// upstream rename to initial_value, disable for scroll
810781
// region.assign_advice(
811782
// || "initial_value",
812783
// column,

zkevm-circuits/src/state_circuit/constraint_builder.rs

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ pub struct Queries<F: Field> {
5454
pub id: MpiQueries<F, N_LIMBS_ID>,
5555
pub is_tag_and_id_unchanged: Expression<F>,
5656
pub address: MpiQueries<F, N_LIMBS_ACCOUNT_ADDRESS>,
57-
// upstream storage_key: MpiQueries<F, N_LIMBS_WORD>
58-
// check it later if can take upstream way.
5957
pub storage_key: MpiQueries<F, N_LIMBS_WORD>,
6058
pub initial_value: word::Word<Expression<F>>,
6159
pub initial_value_prev: word::Word<Expression<F>>,

zkevm-circuits/src/table.rs

+5-16
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,6 @@ impl CopyTable {
17341734
Self {
17351735
q_enable,
17361736
is_first: meta.advice_column(),
1737-
// id: meta.advice_column_in(SecondPhase),
17381737
id: word::Word::new([meta.advice_column(), meta.advice_column()]),
17391738
tag: BinaryNumberChip::configure(meta, q_enable, None),
17401739
addr: meta.advice_column(),
@@ -1800,7 +1799,6 @@ impl CopyTable {
18001799
let mut reader = CopyThread {
18011800
tag: copy_event.src_type,
18021801
is_rw: copy_event.is_source_rw(),
1803-
//id: number_or_hash_to_field(&copy_event.src_id, challenges.evm_word()),
18041802
id: number_or_hash_to_word(&copy_event.src_id),
18051803
front_mask: true,
18061804
addr: copy_event.src_addr,
@@ -1814,7 +1812,6 @@ impl CopyTable {
18141812
let mut writer = CopyThread {
18151813
tag: copy_event.dst_type,
18161814
is_rw: copy_event.is_destination_rw(),
1817-
//id: number_or_hash_to_field(&copy_event.dst_id, challenges.evm_word()),
18181815
id: number_or_hash_to_word(&copy_event.dst_id),
18191816
front_mask: true,
18201817
addr: copy_event.dst_addr,
@@ -1902,15 +1899,9 @@ impl CopyTable {
19021899
*value_word_bytes = [0; 32];
19031900
*value_word_prev_bytes = [0; 32];
19041901
}
1905-
// thread.word_rlc = thread.word_rlc * challenges.evm_word() + value;
1906-
// thread.word_rlc_prev = if is_read_step {
1907-
// thread.word_rlc // Reader does not change the word.
1908-
// } else {
1909-
// thread.word_word_prev * challenges.evm_word() + value_prev
1910-
// };
1902+
19111903
let word_index = (step_idx as u64 / 2) % 32;
19121904
value_word_bytes[word_index as usize] = copy_step.value;
1913-
//println!("word_index {}, value_word_bytes {:?}", word_index, value_word_bytes);
19141905

19151906
let u256_word = U256::from_big_endian(value_word_bytes);
19161907
thread.value_word = word::Word::from(u256_word).into_value();
@@ -2079,19 +2070,17 @@ impl<F: Field> LookupTable<F> for CopyTable {
20792070
vec![
20802071
meta.query_fixed(self.q_enable, Rotation::cur()),
20812072
meta.query_advice(self.is_first, Rotation::cur()),
2082-
//meta.query_advice(self.id, Rotation::cur()), // src_id
20832073
meta.query_advice(self.id.lo(), Rotation::cur()), // src_id
20842074
meta.query_advice(self.id.hi(), Rotation::cur()), // src_id
20852075
self.tag.value(Rotation::cur())(meta), // src_tag
2086-
//meta.query_advice(self.id, Rotation::next()), // dst_id
20872076
meta.query_advice(self.id.lo(), Rotation::next()), // dst_id
20882077
meta.query_advice(self.id.hi(), Rotation::next()), // dst_id
2089-
self.tag.value(Rotation::next())(meta), // dst_tag
2090-
meta.query_advice(self.addr, Rotation::cur()), // src_addr
2078+
self.tag.value(Rotation::next())(meta), // dst_tag
2079+
meta.query_advice(self.addr, Rotation::cur()), // src_addr
20912080
meta.query_advice(self.src_addr_end, Rotation::cur()), // src_addr_end
2092-
meta.query_advice(self.addr, Rotation::next()), // dst_addr
2081+
meta.query_advice(self.addr, Rotation::next()), // dst_addr
20932082
meta.query_advice(self.real_bytes_left, Rotation::cur()), // real_length
2094-
meta.query_advice(self.rlc_acc, Rotation::cur()), // rlc_acc
2083+
meta.query_advice(self.rlc_acc, Rotation::cur()), // rlc_acc
20952084
meta.query_advice(self.rw_counter, Rotation::cur()), // rw_counter
20962085
meta.query_advice(self.rwc_inc_left, Rotation::cur()), // rwc_inc_left
20972086
]

zkevm-circuits/src/tx_circuit.rs

-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ pub struct TxCircuitConfigArgs<F: Field> {
208208
pub u8_table: U8Table,
209209
/// Reusable u16 lookup table,
210210
pub u16_table: U16Table,
211-
212211
/// Challenges
213212
pub challenges: crate::util::Challenges<Expression<F>>,
214213
}

0 commit comments

Comments
 (0)