Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- [BREAKING] Added cycle counts to notes returned by `NoteConsumptionInfo` and removed public fields from related types ([#2772](https://github.com/0xMiden/miden-base/issues/2772)).
- [BREAKING] Removed unused `payback_attachment` from `SwapNoteStorage` and `attachment` from `MintNoteStorage` ([#2789](https://github.com/0xMiden/protocol/pull/2789)).
- Automatically enable `concurrent` feature in `miden-tx` for `std` context ([#2791](https://github.com/0xMiden/protocol/pull/2791)).
- Add foundations for `AuthMultisigSmart` ([#2806])(https://github.com/0xMiden/protocol/pull/2806)

### Fixes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# The MASM code of the Multi-Signature Smart Authentication Component.
#
# See the `AuthMultisigSmart` Rust type's documentation for more details.

use miden::standards::auth::multisig
use miden::standards::auth::multisig_smart

pub use multisig::get_threshold_and_num_approvers
pub use multisig::get_signer_at
pub use multisig::is_signer
pub use multisig_smart::set_procedure_policy
pub use multisig_smart::update_signers_and_threshold


#! Authenticate a transaction using multisig smart-policy rules.
#!
#! Inputs:
#! Operand stack: [SALT]
#! Outputs:
#! Operand stack: []
#!
#! Invocation: call
@auth_script
pub proc auth_tx_multisig_smart(salt: word)
exec.multisig_smart::auth_tx
# => [TX_SUMMARY_COMMITMENT]

exec.multisig::assert_new_tx
# => []
end
29 changes: 10 additions & 19 deletions crates/miden-standards/asm/standards/auth/multisig.masm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use miden::protocol::active_account
use miden::protocol::auth::AUTH_UNAUTHORIZED_EVENT
use miden::protocol::native_account
use miden::standards::auth
use miden::standards::auth::signature
use miden::core::word

# Local Memory Addresses
Expand Down Expand Up @@ -114,7 +115,7 @@ proc cleanup_pubkey_and_scheme_id_mapping(init_num_of_approvers: u32, new_num_of
# => [i-1, new_num_of_approvers]

# clear scheme id at APPROVER_MAP_KEY(i-1)
dup exec.create_approver_map_key
dup exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, i-1, new_num_of_approvers]

padw swapw
Expand All @@ -130,7 +131,7 @@ proc cleanup_pubkey_and_scheme_id_mapping(init_num_of_approvers: u32, new_num_of
# => [i-1, new_num_of_approvers]

# clear public key at APPROVER_MAP_KEY(i-1)
dup exec.create_approver_map_key
dup exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, i-1, new_num_of_approvers]

padw swapw
Expand All @@ -153,18 +154,8 @@ proc cleanup_pubkey_and_scheme_id_mapping(init_num_of_approvers: u32, new_num_of
drop drop
end

#! Builds the storage map key for a signer index.
#!
#! Inputs: [key_index]
#! Outputs: [APPROVER_MAP_KEY]
proc create_approver_map_key
push.0.0.0 movup.3
# => [[key_index, 0, 0, 0]]
# => [APPROVER_MAP_KEY]
end

#! Asserts that all configured per-procedure threshold overrides are less than or equal to
#! number of approvers
#! Asserts that all configured per-procedure threshold overrides are less than or equal to
#! number of approvers.
#!
#! Inputs: [num_approvers]
#! Outputs: []
Expand Down Expand Up @@ -289,7 +280,7 @@ pub proc update_signers_and_threshold(multisig_config_hash: word)
sub.1
# => [i-1, pad(12)]

dup exec.create_approver_map_key
dup exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, i-1, pad(12)]

padw adv_loadw
Expand All @@ -312,7 +303,7 @@ pub proc update_signers_and_threshold(multisig_config_hash: word)
exec.auth::signature::assert_supported_scheme_word
# => [SCHEME_ID_WORD, i-1, pad(12)]

dup.4 exec.create_approver_map_key
dup.4 exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, SCHEME_ID_WORD, i-1, pad(12)]

push.APPROVER_SCHEME_ID_SLOT[0..2]
Expand Down Expand Up @@ -511,7 +502,7 @@ pub proc get_signer_at
dup
# => [index, index]

exec.create_approver_map_key
exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, index]

push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
Expand All @@ -523,7 +514,7 @@ pub proc get_signer_at
movup.4
# => [index, PUB_KEY]

exec.create_approver_map_key
exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, PUB_KEY]

push.APPROVER_SCHEME_ID_SLOT[0..2]
Expand Down Expand Up @@ -574,7 +565,7 @@ pub proc is_signer(pub_key: word) -> felt
dup loc_store.CURRENT_SIGNER_INDEX_LOC
# => [i-1, PUB_KEY]

exec.create_approver_map_key
exec.signature::create_approver_map_key
# => [APPROVER_MAP_KEY, PUB_KEY]

push.APPROVER_PUBLIC_KEYS_SLOT[0..2]
Expand Down
Loading
Loading