Skip to content

feat: BeginTx and EndTx support taiko's 1559 #33

feat: BeginTx and EndTx support taiko's 1559

feat: BeginTx and EndTx support taiko's 1559 #33

Triggered via pull request August 10, 2023 07:31
Status Failure
Total duration 18s
Artifacts

openai-review.yml

on: pull_request
OpenAI PR Comment
8s
OpenAI PR Comment
Fit to window
Zoom out
Zoom in

Annotations

2 errors
OpenAI PR Comment
Unable to process file command 'env' successfully.
OpenAI PR Comment
Invalid format 'GIT_PATCH_OUTPUT=From 4da9a362b1e89e70834e856808153b6725be3b2c Mon Sep 17 00:00:00 2001 From: johntaiko <[email protected]> Date: Mon, 31 Jul 2023 10:40:05 +0000 Subject: [PATCH 01/23] feat: BeginTx and EndTx support taiko's 1559 --- bus-mapping/src/circuit_input_builder.rs | 6 ++ .../src/circuit_input_builder/block.rs | 5 ++ .../protocol_instance.rs | 44 +--------- bus-mapping/src/evm/opcodes/begin_end_tx.rs | 19 +++++ bus-mapping/src/mock.rs | 1 + .../src/integration_test_circuits.rs | 4 +- integration-tests/src/lib.rs | 1 + zkevm-circuits/src/anchor_tx_circuit.rs | 3 +- zkevm-circuits/src/anchor_tx_circuit/dev.rs | 3 +- .../src/evm_circuit/execution/begin_tx.rs | 27 +++--- .../src/evm_circuit/execution/end_tx.rs | 82 +++++++++++++++---- zkevm-circuits/src/table/pi_table.rs | 11 +-- zkevm-circuits/src/table/tx_table.rs | 4 + zkevm-circuits/src/taiko_pi_circuit.rs | 2 +- zkevm-circuits/src/taiko_super_circuit.rs | 4 +- .../src/taiko_super_circuit/test.rs | 5 +- zkevm-circuits/src/witness.rs | 4 +- zkevm-circuits/src/witness/block.rs | 62 ++++++++++++-- zkevm-circuits/src/witness/tx.rs | 22 +++++ 19 files changed, 216 insertions(+), 93 deletions(-) rename {zkevm-circuits/src/witness => bus-mapping/src/circuit_input_builder}/protocol_instance.rs (75%) diff --git a/bus-mapping/src/circuit_input_builder.rs b/bus-mapping/src/circuit_input_builder.rs index 0b4c0ae3a8..f94fa3f263 100644 --- a/bus-mapping/src/circuit_input_builder.rs +++ b/bus-mapping/src/circuit_input_builder.rs @@ -6,6 +6,7 @@ mod block; mod call; mod execution; mod input_state_ref; +mod protocol_instance; #[cfg(test)] mod tracer_tests; mod transaction; @@ -34,6 +35,7 @@ pub use execution::{ pub use input_state_ref::CircuitInputStateRef; use itertools::Itertools; use log::warn; +pub use protocol_instance::{left_shift, MetaHash, ProtocolInstance, ANCHOR_TX_METHOD_SIGNATURE}; use std::collections::HashMap; pub use transaction::{Transaction, TransactionContext}; @@ -409,6 +411,7 @@ pub struct BuilderClient<P: JsonRpcClient> { cli: GethClient<P>, chain_id: Word, circuits_params: CircuitsParams, + protocol_instance: ProtocolInstance, } /// Get State Accesses from TxExecTraces @@ -468,6 +471,7 @@ impl<P: JsonRpcClient> BuilderClient<P> { pub async fn new( client: GethClient<P>, circuits_params: CircuitsParams, + protocol_instance: ProtocolInstance, ) -> Result<Self, Error> { let chain_id = client.get_chain_id().await?; @@ -475,6 +479,7 @@ impl<P: JsonRpcClient> BuilderClient<P> { cli: client, chain_id: chain_id.into(), circuits_params, + protocol_instance, }) } @@ -615,6 +620,7 @@ impl<P: JsonRpcClient> BuilderClient<P> { prev_state_root, eth_block, self.circuits_params, + self.protocol_instance.clone(), )?; let mut builder = CircuitInputBuilder::new(sdb, code_db, block); builder.handle_block_with_anchor(eth_block, geth_traces, has_anchor_tx)?; diff --git a/bus-mapping/src/circuit_input_builder/block.rs b/bus-mapping/src/circuit_input_builder/block.rs index 650c7344bc..85ba424e8f 100644 --- a/bus-mapping/src/circuit_input_builder/block.rs +++ b/bus-mapping/src/circuit_input_builder/block.rs @@ -2,6 +2,7 @@ use super::{ execution::ExecState, transaction::Transaction, CircuitsParams, CopyEvent, ExecStep, ExpEvent, + ProtocolInstance, }; use crate::{ operation::{OperationContainer, RWCounter}, @@ -90,6 +91,8 @@ pub struct Block { pub circuits_params: CircuitsParams, /// Original block from geth pub eth_block: eth_types::Block<eth_types::Transaction>, + /// Protocol instance from protocol + pub protocol_instance: ProtocolInstance, } impl Block { @@ -100,6 +103,7 @@ impl Block { prev_state_root: Word, eth_block: &eth_types::Block<eth_types::Transaction>, circuits_params: CircuitsParams, + protocol_instance: ProtocolInstance, ) -> Result<Self, Error> { if eth_block.base_fee_per_gas.is_none() { // FIXME: resolve this once we have proper EIP-1559 support @@ -141,6 +145,7 @@ impl Block { sha3_inputs: Vec::new(), circuits_params, eth_block: eth_block.clone(), + protocol_instance, }) } diff --git a/zkevm-circuits/src/witness/protocol_instance.rs b/bus-mapping/src