Implement dynamic storage opcodes in the compiler#7595
Conversation
PR SummaryHigh Risk Overview Updates codegen ( Extends Reviewed by Cursor Bugbot for commit a871f09. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
👍 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4cdd67d. Configure here.

Description
This PR is a step in implementing #7560. It adds compiler support for dynamic storage opcodes by:
asmblocks.Note that the
FuelVmInstruction::StatePreloadIR instruction returns zero if the slot is not used, but also if it is used and contains zero-sized content. The reason is that zero-sized storage types, like, e.g.StorageVec, have special semantics in the storage API and thestorage_apidoes not write zero-sized types into storage, nor reads them. Modeling the IR instruction this way preserves this semantics and allows for more efficient implementation that is actually needed in the API. (Returning both the length and the existence information would require a stack allocation and more gas expensive compilation for something that is actually not used.)This API semantics might be changed to support zero-sized types like any other types. This would be a separate breaking change and a part of Configurable and composable storage RFC.
Meanwhile, if a distinction between unused and zero-sized used slot is needed while preloading, it can be achieved by using the
SPLDopcode inasmblock.Checklist
Breaking*orNew Featurelabels where relevant.