Skip to content

feat: implement AccountPatch::merge#3082

Merged
PhilippGackstatter merged 49 commits into
nextfrom
pgackst-patch-merge
Jun 15, 2026
Merged

feat: implement AccountPatch::merge#3082
PhilippGackstatter merged 49 commits into
nextfrom
pgackst-patch-merge

Conversation

@PhilippGackstatter

@PhilippGackstatter PhilippGackstatter commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements AccountPatch::merge, which combines a follow-up patch into an existing one with patch semantics: storage and vault entries in other overwrite their counterparts in self, and the merged final nonce becomes other's. The merge is rejected if the two patches apply to different accounts, if both carry a final nonce and other's is not exactly one greater than self's, if both are full-state patches, or if a storage slot is used as two different slot types.
  • Tightens AccountPatch::new to reject patches that carry account code but no final_nonce via the new AccountPatchError::CodeRequiresNonceUpdate: a patch with code represents account creation, which is a state-changing transaction and per tx kernel rules must increment the nonce.

part of #2630

PhilippGackstatter and others added 4 commits June 11, 2026 11:44
Per review feedback, serialize removed entries as bare `AssetVaultKey`
and added entries as `Asset`, letting `Asset` own the fungible vs.
non-fungible split instead of duplicating that logic in the patch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@PhilippGackstatter PhilippGackstatter added the pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority label Jun 11, 2026
@PhilippGackstatter PhilippGackstatter changed the title feat: added AccountPatch::merge feat: implement AccountPatch::merge Jun 11, 2026
@PhilippGackstatter PhilippGackstatter marked this pull request as ready for review June 11, 2026 16:15

@bobbinth bobbinth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left one comment with potential simplification inline.

Comment thread crates/miden-protocol/src/account/patch/mod.rs Outdated
Base automatically changed from pgackst-patch-serialization to next June 15, 2026 07:35
@PhilippGackstatter PhilippGackstatter added this pull request to the merge queue Jun 15, 2026
Merged via the queue into next with commit cccfd7d Jun 15, 2026
20 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-patch-merge branch June 15, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-from-maintainers PRs that come from internal contributors or integration partners. They should be given priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants