Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Merged
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
23 changes: 22 additions & 1 deletion zkevm-circuits/src/tx_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ pub struct TxCircuitConfig<F: Field> {
tx_table: TxTable,
tx_tag_bits: BinaryNumberConfig<TxFieldTag, 5>,

// A selector which is enabled at 2nd row
q_second: Column<Fixed>,
Comment thread
kunxian-xia marked this conversation as resolved.
tx_type: Column<Advice>,
tx_type_bits: BinaryNumberConfig<TxType, 3>,
// The associated rlp tag to lookup in the RLP table
Expand Down Expand Up @@ -194,7 +196,7 @@ impl<F: Field> SubCircuitConfig<F> for TxCircuitConfig<F> {
}: Self::ConfigArgs,
) -> Self {
let q_enable = tx_table.q_enable;

let q_second = meta.fixed_column();
let q_calldata_first = meta.fixed_column();
let q_calldata_last = meta.fixed_column();
// tag, rlp_tag, tx_type, is_none
Expand Down Expand Up @@ -314,6 +316,17 @@ impl<F: Field> SubCircuitConfig<F> for TxCircuitConfig<F> {
);

// tx_id transition
meta.create_gate("tx_id starts with 1", |meta| {
let mut cb = BaseConstraintBuilder::default();

cb.require_equal(
"tx_id == 1",
meta.query_advice(tx_table.tx_id, Rotation::cur()),
1.expr(),
);

cb.gate(meta.query_fixed(q_second, Rotation::cur()))
Comment thread
roynalnaruto marked this conversation as resolved.
});
meta.create_gate("tx_id transition", |meta| {
let mut cb = BaseConstraintBuilder::default();

Expand Down Expand Up @@ -987,6 +1000,7 @@ impl<F: Field> SubCircuitConfig<F> for TxCircuitConfig<F> {
tx_type_bits,
rlp_tag,
is_none,
q_second,
u16_table,
tx_id_is_zero,
value_is_zero,
Expand Down Expand Up @@ -1827,6 +1841,13 @@ impl<F: Field> TxCircuit<F> {
None,
)?;

region.assign_fixed(
|| "q_second",
config.q_second,
1,
|| Value::known(F::one()),
)?;

// Assign all tx fields except for call data
for (i, sign_data) in sigs.iter().enumerate() {
let tx = if i < self.txs.len() {
Expand Down