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

core: store the chunked code directly in the database #121

Draft
wants to merge 4 commits into
base: verkle-trie-post-merge
Choose a base branch
from

Conversation

gballet
Copy link
Owner

@gballet gballet commented Aug 9, 2022

This is the 3rd attempt at storing the code chunking into the database in order to speed-up verkle tree execution. Instead of creating two different code paths between chunked/not chunked, this approach simply assumes that the binary payload stored in the DB is already chunked code. So it is the responsibility of the contract-creation code to chunk it once and for all.

It introduces a few helper functions to help manage chunked code and make the conversion from "linear" to "chunked" space simpler:

  • A chunk iterator;
  • AtPC, a method to take a "linear space" program counter and return the byte in a chunked space;

Ideally, there should be a Code interface, that would be implemented by both ChunkedCode and LinearCode. I'll leave the verkle branch some time to mature before I propose this interface in the main repository.

TODO

  • Fix test for EXTCODECOPY
  • Condrieu test
  • Conversion test

@gballet gballet force-pushed the verkle/use-chunked-code-in-db branch from 1aded37 to b14ec6e Compare August 9, 2022 18:27
@gballet
Copy link
Owner Author

gballet commented Aug 12, 2022

This PR is on hold. More performance has been squeezed out by refactoring the code to ensure that tree keys for chunks are not computed more than once, and the result are found in #123. Other locations now present lower-hanging fruits so this PR will be left as is, due to its extraordinary complexity.

The current state: the PR mostly works, except that the code isn't chunked when calling CREATE (it is chunked when the init code of a tx is called). Trying to fix this has triggered breakeages in CODECOPY. No further investigation has been made, since CODECOPY will be greatly modified by #123 anyway.

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.

1 participant