Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.
Merged
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
2 changes: 1 addition & 1 deletion geth-utils/l2geth/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/holiman/uint256 v1.2.0
github.com/imdario/mergo v0.3.15
github.com/scroll-tech/go-ethereum v1.10.14-0.20230831061745-fb38e6f91ef9
github.com/scroll-tech/go-ethereum v1.10.14-0.20230831124140-1886e26ca628
)

require (
Expand Down
2 changes: 2 additions & 0 deletions geth-utils/l2geth/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ github.com/scroll-tech/go-ethereum v1.10.14-0.20230827145523-9be082146425 h1:xyK
github.com/scroll-tech/go-ethereum v1.10.14-0.20230827145523-9be082146425/go.mod h1:DiN3p2inoXOxGffxSswDKqWjQ7bU+Mp0c9v0XQXKmaA=
github.com/scroll-tech/go-ethereum v1.10.14-0.20230831061745-fb38e6f91ef9 h1:hx07yqoiJNSCyfiIVrhMUry7c60z6UOXgsSFlILrgAg=
github.com/scroll-tech/go-ethereum v1.10.14-0.20230831061745-fb38e6f91ef9/go.mod h1:DiN3p2inoXOxGffxSswDKqWjQ7bU+Mp0c9v0XQXKmaA=
github.com/scroll-tech/go-ethereum v1.10.14-0.20230831124140-1886e26ca628 h1:6onjmb7sdIPbjcZKkS7bczukMvpO1DHvbWjx3m33KdU=
github.com/scroll-tech/go-ethereum v1.10.14-0.20230831124140-1886e26ca628/go.mod h1:DiN3p2inoXOxGffxSswDKqWjQ7bU+Mp0c9v0XQXKmaA=
github.com/scroll-tech/zktrie v0.6.0 h1:xLrMAO31Yo2BiPg1jtYKzcjpEFnXy8acbB7iIsyshPs=
github.com/scroll-tech/zktrie v0.6.0/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/tests/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ async fn test_circuit_all_block() {
let builder = builder.unwrap().0;
if builder.block.txs.is_empty() {
log::info!("skip empty block");
return;
// skip empty block
continue;
}

let block = block_convert::<Fr>(&builder.block, &builder.code_db).unwrap();
Expand Down
8 changes: 6 additions & 2 deletions testool/src/statetest/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ use bus_mapping::{
circuit_input_builder::{CircuitInputBuilder, CircuitsParams, PrecompileEcParams},
state_db::CodeDB,
};

#[cfg(feature = "scroll")]
use eth_types::ToBigEndian;
use eth_types::{
geth_types, geth_types::TxType, Address, Bytes, GethExecTrace, ToBigEndian, ToWord, H256, U256,
U64,
geth_types, geth_types::TxType, Address, Bytes, GethExecTrace, ToWord, H256, U256, U64,
};
use ethers_core::{
types::{transaction::eip2718::TypedTransaction, TransactionRequest},
Expand Down Expand Up @@ -71,6 +73,7 @@ impl StateTestError {
// Avoid lint `variant is never constructed` if no feature skip-self-destruct.
let _ = StateTestError::SkipTestSelfDestruct;
let _ = StateTestError::SkipTestDifficulty;
let _ = StateTestError::SkipTestBalanceOverflow;

matches!(
self,
Expand Down Expand Up @@ -548,6 +551,7 @@ pub fn run_test(

let (_, trace_config, post) = into_traceconfig(st.clone());

#[cfg(feature = "scroll")]
for acc in trace_config.accounts.values() {
if acc.balance.to_be_bytes()[0] != 0u8 {
return Err(StateTestError::SkipTestBalanceOverflow);
Expand Down
28 changes: 16 additions & 12 deletions zkevm-circuits/src/pi_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ use halo2_proofs::{
plonk::{Advice, Column, ConstraintSystem, Error, Selector},
poly::Rotation,
};
use once_cell::sync::Lazy;

use crate::{
evm_circuit::param::{N_BYTES_ACCOUNT_ADDRESS, N_BYTES_U64, N_BYTES_WORD},
Expand All @@ -61,15 +60,18 @@ use halo2_proofs::circuit::{Cell, RegionIndex};
use halo2_proofs::{circuit::SimpleFloorPlanner, plonk::Circuit};
use itertools::Itertools;

pub(crate) static COINBASE: Lazy<Address> = Lazy::new(|| {
fn get_coinbase_constant() -> Address {
let default_coinbase = if cfg!(feature = "scroll") {
Address::from_str("0x5300000000000000000000000000000000000005").unwrap()
} else {
Address::zero()
};
read_env_var("COINBASE", default_coinbase)
});
pub(crate) static DIFFICULTY: Lazy<Word> = Lazy::new(|| read_env_var("DIFFICULTY", Word::zero()));
}

fn get_difficulty_constant() -> Word {
read_env_var("DIFFICULTY", Word::zero())
}

/// PublicData contains all the values that the PiCircuit receives as input
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -153,15 +155,17 @@ impl PublicData {
let result = iter::empty()
.chain(self.block_ctxs.ctxs.iter().flat_map(|(block_num, block)| {
// sanity check on coinbase & difficulty
let coinbase = get_coinbase_constant();
assert_eq!(
*COINBASE, block.coinbase,
coinbase, block.coinbase,
"[block {}] COINBASE const: {}, block.coinbase: {}",
block_num, *COINBASE, block.coinbase
block_num, coinbase, block.coinbase
);
let difficulty = get_difficulty_constant();
assert_eq!(
*DIFFICULTY, block.difficulty,
difficulty, block.difficulty,
"[block {}] DIFFICULTY const: {}, block.difficulty: {}",
block_num, *DIFFICULTY, block.difficulty
block_num, difficulty, block.difficulty
);

let num_all_txs = num_all_txs_in_blocks
Expand Down Expand Up @@ -227,8 +231,8 @@ impl BlockContext {
fn padding(chain_id: u64) -> Self {
Self {
chain_id,
coinbase: *COINBASE,
difficulty: *DIFFICULTY,
coinbase: get_coinbase_constant(),
difficulty: get_difficulty_constant(),
gas_limit: 0,
number: Default::default(),
timestamp: Default::default(),
Expand Down Expand Up @@ -1040,7 +1044,7 @@ impl<F: Field> PiCircuitConfig<F> {
let cells = self.assign_field_in_pi_ext(
region,
&mut offset,
&(*COINBASE).to_fixed_bytes(),
&get_coinbase_constant().to_fixed_bytes(),
&mut rpi_rlc_acc,
&mut rpi_length_acc,
false,
Expand All @@ -1054,7 +1058,7 @@ impl<F: Field> PiCircuitConfig<F> {
let cells = self.assign_field_in_pi_ext(
region,
&mut offset,
&(*DIFFICULTY).to_be_bytes(),
&get_difficulty_constant().to_be_bytes(),
&mut rpi_rlc_acc,
&mut rpi_length_acc,
false,
Expand Down