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] Optimize for zktrie state #962

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open

[Feat] Optimize for zktrie state #962

wants to merge 22 commits into from

Conversation

noel2004
Copy link
Member

@noel2004 noel2004 commented Aug 3, 2024

This PR has induced (1) preimage of merkle nodes (2) a new "flatten" format in storageTrace. It can help circuit to be able to handle l2 trace with less effort (no poseidon hash needed for verifying block's state, to speedup ccc ~15% more).

In l2trace API, the default format is the new (flatten) one while there is a new option StorageProofFormat can switch to the legacy format:

  • by default, the trace output would not change

  • if StorageProofFormat is "flatten", API would output new "flatten" format, like

curl --location --request GET 'http://localhost:8545' --header 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "method": "scroll_getBlockTraceByNumberOrHash", "params": ["0x7a71b4", {"StorageProofFormat": "flatten"}], "id": 1}'
  • if StorageProofFormat is "union", API would output a "union" format, as a "union" of bot old format and the new "flatten" proof, it is used for debugging

@lispc
Copy link

lispc commented Aug 17, 2024

TODO:

add some basic desc.

From my reading, currently it actually fill all (union of old and new storage) need data, then finally in "ApplyFilter" nuke one of them? It may be ok as long as it will not bring too much runtime overhead. ( i guess no, since these fields don't involve extra disk io or poseidon hash?)

btw i think on top of this pr, i could just change lines of codes to emit a "union format trace" which include old storage proofs and new storage proofs? (so then old rust codes use it as old trace, new rust codes use it as new trace). Btw i prefer we have 3 mode (old / new / union) to give us more flexiblity for testing https://github.com/scroll-tech/go-ethereum/pull/962/files#r1720773656. "new(or named 'flatten')" be default

@noel2004 noel2004 marked this pull request as ready for review August 21, 2024 13:39
@lispc
Copy link

lispc commented Aug 21, 2024

what about set default to 'legacy' now? if not, it is not convenient to merge it now. There are third party chunk provers. Using 'flatten' as default will break a lot.

@noel2004
Copy link
Member Author

what about set default to 'legacy' now? if not, it is not convenient to merge it now. There are third party chunk provers. Using 'flatten' as default will break a lot.

done

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.

2 participants