Skip to content

optimization idea: global code chunking cache #479

@gballet

Description

@gballet

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions