fix: skip value slot normalization for new account's deltas#2075
Merged
fix: skip value slot normalization for new account's deltas#2075
Conversation
mmagician
approved these changes
Nov 7, 2025
| exec.memory::get_init_nonce eq.0 or | ||
| # => [was_changed, INIT_VALUE', CURRENT_VALUE, slot_idx, RATE, RATE, PERM] | ||
|
|
||
| # only include in delta if the slot's value has changed |
Collaborator
There was a problem hiding this comment.
nit: should this comment be updated too?
crates/miden-lib/asm/kernels/transaction/lib/account_delta.masm
Outdated
Show resolved
Hide resolved
Comment on lines
+872
to
+875
| /// Tests that creating a new account with a slot whose value is empty is correctly included in the | ||
| /// delta and not normalized away. | ||
| #[tokio::test] | ||
| async fn delta_for_new_account_retains_empty_value_storage_slots() -> anyhow::Result<()> { |
Collaborator
There was a problem hiding this comment.
I tested this on next by:
$ git restore -s origin/pgackst-fix-new-account-delta crates/miden-testing/src/kernel_tests/tx/test_account_delta.rs
$ cargo test delta_for_new_account_retains_empty_value_storage_slotsand it fails with the error reported in #2072.
👍🏼
Co-authored-by: Marti <marti@miden.team>
bobbinth
approved these changes
Nov 8, 2025
| # more generally, we want the delta for a new account to include all its newly added values, | ||
| # regardless of the exact value, because the initial delta for an account must represent its | ||
| # full state | ||
| exec.memory::get_init_nonce eq.0 or |
Contributor
There was a problem hiding this comment.
Not for this PR: but we use the check init_nonce == 0 in a few places now and I wonder if we should add something like memory::is_account_new procedure.
This was referenced Nov 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Skip value slot normalization for new account's deltas to avoid removing storage slots whose value is validly
Word::empty.This affects:
StorageDeltaTrackerto skip normalization when the account is new,initial_value != current_valuecomparison.closes #2072