From 415fa6e9d70431329489b9e53ec05ad17f016613 Mon Sep 17 00:00:00 2001 From: "Claude (Opus)" Date: Fri, 21 Aug 2026 06:55:37 +0000 Subject: [PATCH 1/2] refactor(protocol): read only native account state in validate_new_account validate_new_account read the account ID, nonce and vault root through the active account, even though it only ever validates the native account. The native variants of all three already exist, so switch to them and leave the active accessors for the procedures that genuinely serve foreign accounts. Co-Authored-By: Claude Opus 5 (1M context) --- .../asm/kernels/transaction-core/src/prologue.masm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm b/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm index ec8260d13c..76203a4267 100644 --- a/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm +++ b/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm @@ -287,8 +287,8 @@ end #! the case when it is created, or when slots are added or removed (currently unimplemented). #! So, it should be sufficient to do this here instead of in save_account_storage_data. #! -#! Validates that the account the transaction is being executed against satisfies the criteria -#! for a new account. +#! Validates that the native account, which is the account the transaction is being executed +#! against, satisfies the criteria for a new account. #! #! Applies the following validation to the new account: #! - assert that the account ID uses the supported version and is otherwise valid. @@ -305,11 +305,12 @@ end #! Outputs: [] proc validate_new_account # Assert the account ID of the account is valid - exec.memory::get_account_id exec.account_id::validate + exec.memory::get_native_account_id exec.account_id::validate # => [] # Assert the account nonce is 0 - exec.memory::get_account_nonce eq.0 assert.err=ERR_PROLOGUE_NEW_ACCOUNT_NONCE_MUST_BE_ZERO + exec.memory::get_native_account_nonce eq.0 + assert.err=ERR_PROLOGUE_NEW_ACCOUNT_NONCE_MUST_BE_ZERO # => [] # Assert the reserved element of the account header word is 0 @@ -320,7 +321,7 @@ proc validate_new_account # Assert the initial vault is empty # --------------------------------------------------------------------------------------------- # get the account vault root - exec.memory::get_account_vault_root + exec.memory::get_native_account_vault_root # => [ACCT_VAULT_ROOT] # push empty vault root onto stack From 6f19b8ecdaba7c6b558309b4f2f776b5157b90e5 Mon Sep 17 00:00:00 2001 From: Marti Date: Fri, 21 Aug 2026 10:07:20 +0200 Subject: [PATCH 2/2] Update crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm --- .../asm/kernels/transaction-core/src/prologue.masm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm b/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm index 76203a4267..c4bb7e9ed5 100644 --- a/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm +++ b/crates/miden-protocol/asm/kernels/transaction-core/src/prologue.masm @@ -287,8 +287,7 @@ end #! the case when it is created, or when slots are added or removed (currently unimplemented). #! So, it should be sufficient to do this here instead of in save_account_storage_data. #! -#! Validates that the native account, which is the account the transaction is being executed -#! against, satisfies the criteria for a new account. +#! Validates that the native account satisfies the criteria for a new account. #! #! Applies the following validation to the new account: #! - assert that the account ID uses the supported version and is otherwise valid.