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

optimization idea: global code chunking cache #479

Open
gballet opened this issue Aug 29, 2024 · 0 comments
Open

optimization idea: global code chunking cache #479

gballet opened this issue Aug 29, 2024 · 0 comments

Comments

@gballet
Copy link
Owner

gballet commented Aug 29, 2024

As described in #123 and #57, there is a DoS issue with calling (EXT)CODECOPY multiple times on a large contract (i.e. when the code size is becoming large, potentially larger than the current 24kb limit)

This would be circumvented by using a conversion cache, but unlike the way it's done in #123, we could have a global cache so that the conversion is only done once for multiple calls to EXTCODECOPY and even across many calls to the contract.

The DoS vector isn't actually very big, because when executing EXTCODECOPY, we only touch the chunk range and no chunkification occurs. So the chunking could be done on a background thread as it's only needed when building the witness at the end. Right now, it's taken from the tree, but we might want to save space and not store the chunks in the tree either. In that case, we will need to regenerate the code in the background.

This is therefore not an urgent issue, it's left here to be considered once we decide not to store the chunks in the tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant