-
Notifications
You must be signed in to change notification settings - Fork 719
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
Storage tree differentiate between default and non-default #395
Comments
Does "empty" here mean zeroed out? Because that is also lossy. Or will the VM keep track of initialized (occupied) vs uninitialized (cleared) slots in a separate bitfield? |
The SMT already differentiates between "empty, i.e. zero bytes" and "32 bytes of zeroes," and therefore so does the VM implicitly. The proposed changes simply expose this in the instruction set. |
this is quite poggers if i say so myself |
Not familiar with what SRW and SRWQ are, I thought of a flag type system before to solve this problem (like the sign on a signed int) but then I realized that would tack on a 1 bit cost to every single slot used, might add up quickly? Im assuming thats how SRW works aswell, do you not see this as a potential problem? |
There's actually no need for any changes to the SMT because the SMT actually already differentiates between a default leaf and a zero-value non-default leaf. The extra register parameter to |
If we already have this differentiation we should absolutely surface it in |
As part of #395, this PR updates the SRW and SRWQ to allow for sequential reads for quad words and populates a provided register with whether the word was set/unset in state.
Part of Issue #395. Add clear sequential word command. Co-authored-by: Brandon Kite <brandonkite92@gmail.com> Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
Part of issue #395. Will allow for writing of sequential storage slots and will populate rB with whether the first slot was previously set. Co-authored-by: Brandon Kite <brandonkite92@gmail.com> Co-authored-by: John Adler <adlerjohn@users.noreply.github.com>
@adlerjohn should we close this issue now? The spec changes are in and the impl is done (pending sequential storage slot access). |
Yep! |
In light of the most recent exploit on Nomad (https://twitter.com/samczsun/status/1554260106107179010), there's a need to differentiate between default and non-default leaves when querying the contract storage tree.
Current Design
The default value of a leaf in the SMT is empty (i.e. zero bytes). However, when reading from storage,
0
is returned if the leaf is empty. This is lossy since it's discarding information.fuel-specs/specs/vm/instruction_set.md
Line 1444 in d19cd0e
Moreover, there's no way to reset a storage slot; writing
0
is not the same thing as writing an empty value.Proposed Changes
SRW
andSRWQ
, that will be set to a Boolean for whether the given storage slot was empty or not.The text was updated successfully, but these errors were encountered: