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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ test-heavy: ## Run heavy tests serially to avoid OOM

test: test-light test-heavy ## Run tests for all the workspace members

test_doc: ## Test the docs
test-doc: ## Test the docs
@cargo test --release --all --all-features --doc

test_benches: ## Compiles the benchmarks
test-benches: ## Compiles the benchmarks
@cargo test --verbose --release --all-features -p circuit-benchmarks --no-run

test-all: fmt doc clippy test_doc test_benches test ## Run all the CI checks locally (in your actual toolchain)
test-all: fmt doc clippy test-doc test-benches test ## Run all the CI checks locally (in your actual toolchain)

super_bench: ## Run Super Circuit benchmarks
@cargo test --profile bench bench_super_circuit_prover -p circuit-benchmarks --features benches -- --nocapture
Expand Down
27 changes: 27 additions & 0 deletions bus-mapping/src/circuit_input_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,33 @@ impl<'a> CircuitInputBuilder {
self.block_ctx.rwc,
self.block_ctx.cumulative_gas_used
);
for account_post_state in &geth_trace.account_after {
let account_post_state: eth_types::l2_types::AccountProofWrapper =
account_post_state.clone();
if let Some(address) = account_post_state.address {
let local_acc = self.sdb.get_account(&address).1;
log::trace!("local acc {local_acc:?}, trace acc {account_post_state:?}");
if local_acc.balance != account_post_state.balance.unwrap() {
log::error!("incorrect balance")
}
if local_acc.nonce != account_post_state.nonce.unwrap().into() {
log::error!("incorrect nonce")
}
if local_acc.code_hash != account_post_state.poseidon_code_hash.unwrap() {
log::error!("incorrect poseidon_code_hash")
}
if local_acc.keccak_code_hash != account_post_state.keccak_code_hash.unwrap() {
log::error!("incorrect keccak_code_hash")
}
if let Some(storage) = account_post_state.storage {
let k = storage.key.unwrap();
let local_v = self.sdb.get_storage(&address, &k).1;
if *local_v != storage.value.unwrap() {
log::error!("incorrect storage for k = {k}");
}
}
}
}
}
if handle_rwc_reversion {
self.set_value_ops_call_context_rwc_eor();
Expand Down
1 change: 1 addition & 0 deletions bus-mapping/src/circuit_input_builder/tracer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl CircuitInputBuilderTx {
failed: false,
return_value: "".to_owned(),
struct_logs: vec![geth_step.clone()],
account_after: vec![],
},
false,
)
Expand Down
1 change: 1 addition & 0 deletions bus-mapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
//!
//! let geth_steps: Vec<GethExecStep> = serde_json::from_str(input_trace).unwrap();
//! let geth_trace = GethExecTrace {
//! account_after: Vec::new(),
//! l1_fee: 0,
//! return_value: "".to_string(),
//! gas: Gas(block.eth_block.transactions[0].gas.as_u64()),
Expand Down
5 changes: 3 additions & 2 deletions eth-types/src/l2_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ impl From<&ExecutionResult> for GethExecTrace {
failed: e.failed,
return_value: e.return_value.clone(),
struct_logs,
account_after: e.account_after.clone(),
}
}
}
Expand Down Expand Up @@ -267,7 +268,7 @@ impl ExtraData {
}

/// account wrapper for account status
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq)]
#[doc(hidden)]
pub struct AccountProofWrapper {
pub address: Option<Address>,
Expand All @@ -281,7 +282,7 @@ pub struct AccountProofWrapper {
}

/// storage wrapper for storage status
#[derive(Serialize, Deserialize, Clone, Debug)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[doc(hidden)]
pub struct StorageProofWrapper {
pub key: Option<U256>,
Expand Down
5 changes: 5 additions & 0 deletions eth-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ pub struct GethExecTrace {
/// Vector of geth execution steps of the trace.
#[serde(rename = "structLogs")]
pub struct_logs: Vec<GethExecStep>,
#[serde(rename = "accountAfter", default)]
/// List of accounts' (coinbase etc) status AFTER execution
/// Only viable for scroll mode
pub account_after: Vec<crate::l2_types::AccountProofWrapper>,
}

#[macro_export]
Expand Down Expand Up @@ -599,6 +603,7 @@ mod tests {
gas: Gas(26809),
failed: false,
return_value: "".to_owned(),
account_after: Vec::new(),
struct_logs: vec![
GethExecStep {
pc: ProgramCounter(0),
Expand Down
2 changes: 1 addition & 1 deletion testool/src/statetest/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
str::FromStr,
};

/// https://github.com/ethereum/tests/pull/857 "set default gasPrice to 10"
/// <https://github.com/ethereum/tests/pull/857> "set default gasPrice to 10"
pub const DEFAULT_BASE_FEE: u32 = 10;

#[derive(PartialEq, Eq, Debug, Clone)]
Expand Down