Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
lispc committed Jul 18, 2023
1 parent 795894c commit 81c0fc3
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 30 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ edition = "2021"
[dependencies]
halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_02_02" }

aggregator = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc" }
bus-mapping = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc" }
eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc" }
zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc", default-features = false, features = ["test","scroll","scroll-trace","shanghai"] }
mpt-zktrie = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc" }
mock = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc" }
aggregator = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop" }
bus-mapping = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop" }
eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop" }
zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop", default-features = false, features = ["test","scroll","scroll-trace","shanghai"] }
mpt-zktrie = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop" }
mock = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop" }

snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop" }
snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop" }
Expand Down
1 change: 1 addition & 0 deletions prover/src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub fn parse_trace_path_from_mode(mode: &str) -> &'static str {
"greeter" => "./tests/traces/greeter/setValue.json",
"single" => "./tests/traces/erc20/1_transfer.json",
"multiple" => "./tests/traces/erc20/10_transfer.json",
"multiswap" => "./tests/extra_traces/12_swap.json",
"native" => "./tests/traces/native/transfer.json",
"dao" => "./tests/traces/dao/dao-propose.json",
"nft" => "./tests/traces/nft/mint.json",
Expand Down
2 changes: 1 addition & 1 deletion prover/src/zkevm/capacity_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl CircuitCapacityChecker {
}
let traces = txs;
let state = self.state.as_mut().unwrap();
update_state(state, traces, self.light_mode, false)?;
update_state(state, traces, self.light_mode)?;
let witness_block =
block_traces_to_witness_block_with_updated_state(traces, state, self.light_mode)?;
let rows = calculate_row_usage_of_witness_block(&witness_block)?;
Expand Down
10 changes: 4 additions & 6 deletions prover/src/zkevm/circuit/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,17 @@ pub fn update_state(
zktrie_state: &mut ZktrieState,
block_traces: &[BlockTrace],
light_mode: bool,
overwrite: bool,
) -> Result<()> {
log::debug!("building partial statedb");
let account_proofs = block_traces.iter().rev().flat_map(|block| {
let account_proofs = block_traces.iter().flat_map(|block| {
log::trace!("account proof for block {:?}:", block.header.number);
block.storage_trace.proofs.iter().flat_map(|kv_map| {
kv_map
.iter()
.map(|(k, bts)| (k, bts.iter().map(Bytes::as_ref)))
})
});
let storage_proofs = block_traces.iter().rev().flat_map(|block| {
let storage_proofs = block_traces.iter().flat_map(|block| {
log::trace!("storage proof for block {:?}:", block.header.number);
block
.storage_trace
Expand All @@ -149,7 +148,7 @@ pub fn update_state(
.map(move |(sk, bts)| (k, sk, bts.iter().map(Bytes::as_ref)))
})
});
let additional_proofs = block_traces.iter().rev().flat_map(|block| {
let additional_proofs = block_traces.iter().flat_map(|block| {
log::trace!("storage proof for block {:?}:", block.header.number);
log::trace!("additional proof for block {:?}:", block.header.number);
block
Expand All @@ -162,7 +161,6 @@ pub fn update_state(
account_proofs.clone(),
storage_proofs.clone(),
additional_proofs.clone(),
overwrite,
)?;
if !light_mode {
zktrie_state.update_nodes_from_proofs(account_proofs, storage_proofs, additional_proofs)?;
Expand All @@ -182,7 +180,7 @@ pub fn block_traces_to_witness_block(block_traces: &[BlockTrace]) -> Result<Bloc
block_traces[0].storage_trace.root_before
};
let mut state = ZktrieState::construct(old_root);
update_state(&mut state, block_traces, false, true)?;
update_state(&mut state, block_traces, false)?;
block_traces_to_witness_block_with_updated_state(block_traces, &mut state, false)
}

Expand Down
1 change: 1 addition & 0 deletions prover/tests/extra_traces/12_swap.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions prover/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ fn test_load_params() {
.unwrap();
}

#[ignore]
#[test]
fn test_capacity_checker() {
init_env_and_log("integration");
let trace_path = parse_trace_path_from_mode("multiple");
let trace_path = parse_trace_path_from_mode("multiswap");
let batch = vec![get_block_trace_from_file(trace_path)];
log::info!("estimating circuit rows tx by tx");

Expand Down
2 changes: 1 addition & 1 deletion types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.4.0"
edition = "2021"

[dependencies]
eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "feat/state/ccc" }
eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits.git", branch = "develop" }
base64 = "0.13.0"
blake2 = "0.10.3"
ethers-core = "0.17.0"
Expand Down
6 changes: 3 additions & 3 deletions utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ function simple_tests() {

function replace_zkevm_circuits_branch() {
#FROM=feat/deploy_at_existed_acc
FROM=develop
TO=feat/state/ccc
gsed -i 's#zkevm-circuits.git", branch = "'$FROM'#zkevm-circuits.git", branch = "'$TO'#' */Cargo.toml
FROM=feat/state/ccc
TO=develop
sed -i 's#zkevm-circuits.git", branch = "'$FROM'#zkevm-circuits.git", branch = "'$TO'#' */Cargo.toml
cargo update -p zkevm-circuits
cargo update -p eth-types
git diff */Cargo.toml Cargo.lock
Expand Down

0 comments on commit 81c0fc3

Please sign in to comment.