Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] make supercircuit test applying l2trace #767

Merged
merged 50 commits into from
Aug 25, 2023

Conversation

noel2004
Copy link
Member

@noel2004 noel2004 commented Aug 15, 2023

In scroll feature, this PR directly connect the l2trace generated by l2geth_util with supercircuit

It has induced some utilities inside scroll-prover before and some refactoring on the zktrie crate.

With this PR the circuit builder in bus-mapping now support a building route from l2 trace

Notice it contains some breaking changes for scroll-prover

@noel2004 noel2004 force-pushed the feat/supercircuit_test_by_l2trace branch from 8414b07 to bc57a83 Compare August 15, 2023 07:04
@noel2004 noel2004 marked this pull request as ready for review August 15, 2023 13:50
@noel2004 noel2004 requested a review from lispc August 15, 2023 13:50
@noel2004 noel2004 marked this pull request as ready for review August 16, 2023 12:11
@noel2004
Copy link
Member Author

Has to disabled the doc-test in busmapping: #782

@lispc
Copy link

lispc commented Aug 24, 2023

log::debug!(
            "building zktrie state for block {:?}, old root {}",
            l2_trace.header.number,
            hex::encode(old_root),
        );

        let mpt_init_state = ZktrieState::from_trace_with_additional(
            old_root,
            Self::collect_account_proofs(&l2_trace.storage_trace),
            Self::collect_storage_proofs(&l2_trace.storage_trace),
            l2_trace
                .storage_trace
                .deletion_proofs
                .iter()
                .map(Bytes::as_ref),
        )
        .unwrap();

        log::debug!(
            "building partial statedb done, root {}",
            hex::encode(mpt_init_state.root())
        );

these lines cost ~35ms. Too much. This is the reason why ccc becomes much slower. I will refactor this.

inside update_nodes_from_proofs, this line zk_db.add_node_bytes(bytes).unwrap() is slow. Some poseidon computation is applied here.

one solution is like my previous code, use light_mode to skip filling zktrie mem db. Another solution is to provide hash results inside trace (if it is free), and avoid doing poseidon again in Rust.

@lispc lispc merged commit 2a6cc04 into develop Aug 25, 2023
16 checks passed
@lispc lispc deleted the feat/supercircuit_test_by_l2trace branch August 25, 2023 03:26
@lispc lispc restored the feat/supercircuit_test_by_l2trace branch August 25, 2023 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants