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

Commit

Permalink
fix(anchor): calldata with fixed 32B
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaiko committed Jul 6, 2023
1 parent 0a6299f commit 20de536
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion circuit-benchmarks/src/super_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fn gen_application_snark(
max_keccak_rows: 0,
};
let protocol_instance = ProtocolInstance {
anchor_gas_cost: 150000,
anchor_gas_limit: 150000,
..Default::default()
};
let (_, super_circuit, _, _) = SuperCircuit::<_>::build(
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/src/anchor_tx_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ impl<F: Field> AnchorTxCircuitConfig<F> {
for (tag, value) in [
(
TxFieldTag::Gas,
Value::known(F::from(protocol_instance.anchor_gas_cost)),
Value::known(F::from(protocol_instance.anchor_gas_limit)),
),
(
TxFieldTag::GasPrice,
Expand Down
6 changes: 3 additions & 3 deletions zkevm-circuits/src/anchor_tx_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub(crate) fn add_anchor_tx<const NACC: usize, FTx>(
FTx: FnOnce(Vec<&mut MockTransaction>, [MockAccount; NACC]),
{
txs[0]
.gas(protocol_instance.anchor_gas_cost.to_word())
.gas(protocol_instance.anchor_gas_limit.to_word())
.gas_price(ANCHOR_TX_GAS_PRICE.to_word())
.from(*GOLDEN_TOUCH_ADDRESS)
.to(protocol_instance.l2_contract)
Expand Down Expand Up @@ -237,7 +237,7 @@ fn anchor_tx_circuit_unusable_rows() {
#[test]
fn anchor_test() {
let protocol_instance = ProtocolInstance {
anchor_gas_cost: 150000,
anchor_gas_limit: 150000,
..Default::default()
};
let block = gen_block::<1>(2, 200, protocol_instance, sign_tx);
Expand All @@ -247,7 +247,7 @@ fn anchor_test() {
#[test]
fn anchor_test_when_sign_r_is_gx2() {
let protocol_instance = ProtocolInstance {
anchor_gas_cost: 150000,
anchor_gas_limit: 150000,
..Default::default()
};
let msg_hash = *N - *GX1_MUL_PRIVATEKEY;
Expand Down
6 changes: 3 additions & 3 deletions zkevm-circuits/src/taiko_super_circuit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn block_2tx(protocol_instance: &ProtocolInstance) -> GethData {
#[test]
fn serial_test_super_circuit_1tx_1max_tx() {
let protocol_instance = ProtocolInstance {
anchor_gas_cost: 150000,
anchor_gas_limit: 150000,
..Default::default()
};
let block = block_1tx(&protocol_instance);
Expand All @@ -186,7 +186,7 @@ fn serial_test_super_circuit_1tx_1max_tx() {
#[test]
fn taiko_serial_test_super_circuit_1tx_3max_tx() {
let protocol_instance = ProtocolInstance {
anchor_gas_cost: 150000,
anchor_gas_limit: 150000,
..Default::default()
};
let block = block_1tx(&protocol_instance);
Expand All @@ -206,7 +206,7 @@ fn taiko_serial_test_super_circuit_1tx_3max_tx() {
#[test]
fn taiko_serial_test_super_circuit_2tx_3max_tx() {
let protocol_instance = ProtocolInstance {
anchor_gas_cost: 150000,
anchor_gas_limit: 150000,
..Default::default()
};
let block = block_2tx(&protocol_instance);
Expand Down
14 changes: 10 additions & 4 deletions zkevm-circuits/src/witness/protocol_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub struct ProtocolInstance {
/// maxBytesPerTxList
pub max_bytes_per_tx_list: u64,

/// anchor gas cost
pub anchor_gas_cost: u64,
/// anchor gas limit
pub anchor_gas_limit: u64,
}

/// l1 meta hash
Expand Down Expand Up @@ -151,11 +151,17 @@ impl ProtocolInstance {
],
[
Value::known(F::from(PiFieldTag::L1Height as u64)),
Value::known(F::from(self.meta_hash.l1_height)),
rlc_be_bytes(
&self.meta_hash.l1_height.to_word().to_be_bytes(),
randomness,
),
],
[
Value::known(F::from(PiFieldTag::ParentGasUsed as u64)),
Value::known(F::from(self.parent_gas_used as u64)),
rlc_be_bytes(
&(self.parent_gas_used as u64).to_word().to_be_bytes(),
randomness,
),
],
]
}
Expand Down

0 comments on commit 20de536

Please sign in to comment.