Skip to content

Commit

Permalink
bugfix: incr_nonce and set_code should not be part of the public API
Browse files Browse the repository at this point in the history
  • Loading branch information
hackaugusto committed Jul 3, 2024
1 parent 15b07a3 commit 5f9641a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
24 changes: 0 additions & 24 deletions miden-lib/asm/miden/contracts/wallets/basic.masm
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,3 @@ export.send_asset.1
# prepare the stack for return - stack has 6 elements too many
movupw.3 dropw swap drop swap drop
end

#! Increments the account nonce by the provided value.
#!
#! Stack: [value]
#! Output: []
#!
#! - value is the value to increment the nonce by. value can be at most 2^32 - 1 otherwise this
#! procedure panics.
export.incr_nonce
exec.account::incr_nonce
# => []
end

#! Sets the code of the account the transaction is being executed against. This procedure can only
#! executed on regular accounts with updatable code. Otherwise, this procedure fails.
#!
#! Stack: [CODE_ROOT]
#! Output: []
#!
#! - CODE_ROOT is the hash of the code to set.
export.set_code
exec.account::set_code
# => []
end
10 changes: 8 additions & 2 deletions objects/src/testing/account_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ impl AccountCode {
end
# acct proc 2
#
# NOTE: Procedure expose for testing purposes only. This procedure should not be part of the
# account's public API. An account must increment its nonce when its state change, but for a
# production account code implementation, the increment is expected to be done together with
# the transaction authencation. That is to say, the nonce is increment iff the transaction
# contains a valid signature.
export.incr_nonce
exec.wallet::incr_nonce
exec.account::incr_nonce
end
# acct proc 3
Expand All @@ -102,7 +108,7 @@ impl AccountCode {
# acct proc 5
export.set_code
exec.wallet::set_code
exec.account::set_code
end
# acct proc 6
Expand Down

0 comments on commit 5f9641a

Please sign in to comment.