Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Long story short:
EXTCODECOPY
is cheaper for reads bigger than 1 word (https://www.evm.codes/#3c?fork=cancun - the caveat is that data will be write-once )Reads:
https://zefram.xyz/posts/how-i-almost-cheesed-the-evm/
https://github.com/0xsequence/sstore2
Ideas:
(a) We could have facets read their configuration from contract code - this will only be efficient for big configs (not sure if we have such configs). The effect here could also be achieved by "flattening" the config into immutable variables.
(b) Create a "fork" of the diamond standard where the diamond storage is replaced by a contract-code-storage. This could lead to us reading the jump location for diamond dispatch + facet configurations in one go using EXTCODECOPY and avoiding the cost of multiple SLOADs.