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

zktrie part3: include zktrie witness in block trace; add demo for generating witness data for mpt circuit #123

Merged
merged 13 commits into from
Jul 15, 2022

Conversation

noel2004
Copy link
Member

@noel2004 noel2004 commented Jun 28, 2022

This code would allow some witness data used by mpt circuit being added into the block result. It would be controlled by cmd paramete trace.mptwitness=<output scheme>. The output scheme would be a number indicating the order of ops sequence (see below) and by default it is 0, which means there is no any output.

For the storage state transistion inside a block, there would be many possible op sequence for mpt circuit to provide. For example, it would be the the "natrual" sequence, which collect ops in the order they were involved by the op codes executed in each tx; (the output scheme is 1.) or the "state" sequence like they are ordered in the rw table. (the output scheme is 2.)

Notice we consider the code here would be just a "demo" because to output an op sequence which would be completly consistent with the purposed scheme which connect storage and state circuit. The logic are currently implied in busmapping and it should not be duplicated in l2geth.

@lispc lispc changed the title WIP: add demo for generating witness data for mpt circuit WIP zktrie part3/3 add demo for generating witness data for mpt circuit Jun 28, 2022
@lispc lispc changed the title WIP zktrie part3/3 add demo for generating witness data for mpt circuit WIP zktrie part3/3 include zktrie witness in block trace; add demo for generating witness data for mpt circuit Jun 28, 2022
@lispc
Copy link

lispc commented Jun 28, 2022

we should gen_zktrie_witness_from_block_result to goroller later but now adding zktrie witness into blockresult is the most convenient way for the overall procedure at the cost of some computing overhead on l2geth

@lispc
Copy link

lispc commented Jul 5, 2022

@noel2004 it this branch still WIP?

@noel2004
Copy link
Member Author

noel2004 commented Jul 5, 2022

@noel2004 it this branch still WIP?

Yes. Another orderer, which would generate ops with the same order in rw table, is underway. It would be put on today.

@noel2004 noel2004 changed the title WIP zktrie part3/3 include zktrie witness in block trace; add demo for generating witness data for mpt circuit zktrie part3/3 include zktrie witness in block trace; add demo for generating witness data for mpt circuit Jul 5, 2022
@noel2004
Copy link
Member Author

noel2004 commented Jul 5, 2022

Current the witness can be genreated with order respect to rw table. I may have made some redudant "read" op for each account being accessed for do not consider more knowledge on each operation inside evm. However, it would sitll work well if we have adopted the new lookup scheme currently under discussed.

To enable this feature, use argument --trace.mptwitness=2 when launching geth

lispc
lispc previously approved these changes Jul 5, 2022
@lispc lispc changed the title zktrie part3/3 include zktrie witness in block trace; add demo for generating witness data for mpt circuit zktrie part3: include zktrie witness in block trace; add demo for generating witness data for mpt circuit Jul 7, 2022
cmd/utils/flags.go Outdated Show resolved Hide resolved
cmd/geth/main.go Outdated Show resolved Hide resolved
common/hexutil/hexutil.go Show resolved Hide resolved
core/blockchain.go Show resolved Hide resolved
@0xmountaintop
Copy link

Overall looks good to me now.

Just some nitpicks.

@scroll-dev scroll-dev merged commit 3682e05 into zkrollup Jul 15, 2022
@scroll-dev scroll-dev deleted the l2witness/witnessdemo branch July 15, 2022 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants