-
Notifications
You must be signed in to change notification settings - Fork 115
feat: implement API changes for named storage slots #2025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3660c4d
368a3b6
93aeb3b
dd30279
a8845e9
326df51
ffdaa41
8b29817
dcdf55b
9d49150
3629f05
5243e39
b26bd46
f6e0add
9ada60c
d8acfcf
d8e643e
4822684
09ffc89
e854f2c
f0fc368
ffc25de
2ca79f9
95afca4
b537a92
21b63a6
15a3a60
751bee6
740b050
80a9fcb
a9b95ba
493ae34
4f4757e
5d1aad3
6bad1d6
918b896
ea4c2b8
9d1bf44
434b8de
765197f
eb9625c
ceb94dc
f6674a7
267c5da
c475f8a
97587fe
cca8873
984843a
3dd0c1f
9a36413
b714383
415957a
f6f8736
2f237b1
75d4a62
b225168
caf71e1
0d47d86
a45432d
dfd5b4a
eeb84aa
9720868
57cb691
b043b6b
7091727
f046eda
f826fc5
083b3f7
8a8862a
f0ad0fc
928cc9a
15e00c2
16b9b0e
eaf5076
4454a79
7345c4d
ca3a9d8
f168150
b59bbf1
86e0d48
5a2e394
f7ff2ae
354aa0a
5a47937
113b25d
3f66be0
f34d6fc
c11c924
94c483d
3566253
611a1a5
a2d5777
b6d1b69
2e3c6a3
9725652
d476cb1
5674023
914e3fd
b3d0801
6c2af04
c827b3f
4ed6b06
8bc08b7
596f476
3de4ba5
0613d45
0e05126
f0b2e99
7a7a9d2
0a08e94
3bd82b9
ca61fd7
70d9f9c
3a1f884
5bc8c52
3888f16
0a3447a
02c2aa3
426d6a2
383c5fd
8dda2fc
945d8bc
ddf0450
7e29d4c
f442c3a
ca5ae76
aee125a
4dbb71b
c4725b0
ed6decd
f73ce80
365d062
8e3618b
b72626a
27fa924
69ca866
5c65f9d
6f98492
6ec7858
e081dce
8e80819
ef84a43
6bde672
dd9cb43
dd85a8c
2b97e34
bcbeeca
f67d24f
5661d74
fe294ff
1588fba
ec2443e
4437026
a3f247f
9d13331
5c89e45
4109cff
ce78327
b6d4399
6e2f63c
a7bafea
2313630
f595bb3
81cc1e0
63d2c95
b88427c
b664821
a7aaa99
c79a928
7ec39aa
d610940
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,19 +29,19 @@ const AUTH_UNAUTHORIZED_EVENT = event("miden::auth::unauthorized") | |
| # number of approvers are stored as: | ||
| # [default_threshold, num_approvers, 0, 0]. | ||
| # The threshold is guaranteed to be less than or equal to num_approvers. | ||
| const THRESHOLD_CONFIG_SLOT = 0 | ||
| const THRESHOLD_CONFIG_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::threshold_config") | ||
|
|
||
| # The slot in this component's storage layout where the public keys map is stored. | ||
| # Map entries: [key_index, 0, 0, 0] => APPROVER_PUBLIC_KEY | ||
| const PUBLIC_KEYS_MAP_SLOT = 1 | ||
| const APPROVER_PUBLIC_KEYS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::approver_public_keys") | ||
|
|
||
| # The slot in this component's storage layout where executed transactions are stored. | ||
| # Map entries: transaction_message => [is_executed, 0, 0, 0] | ||
| const EXECUTED_TXS_SLOT = 2 | ||
| const EXECUTED_TXS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::executed_transactions") | ||
|
|
||
| # The slot in this component's storage layout where procedure thresholds are stored. | ||
| # Map entries: PROC_ROOT => [proc_threshold, 0, 0, 0] | ||
| const.PROC_THRESHOLD_ROOTS_SLOT=3 | ||
| const PROC_THRESHOLD_ROOTS_SLOT = word("miden::standards::auth::ecdsa_k256_keccak_multisig::procedure_thresholds") | ||
|
|
||
| # Executed Transaction Flag Constant | ||
| const IS_EXECUTED_FLAG = [1, 0, 0, 0] | ||
|
|
@@ -69,8 +69,8 @@ proc assert_new_tx(msg: BeWord) | |
| swapw | ||
| # => [MSG, IS_EXECUTED_FLAG] | ||
|
|
||
| push.EXECUTED_TXS_SLOT | ||
| # => [index, MSG, IS_EXECUTED_FLAG] | ||
| push.EXECUTED_TXS_SLOT[0..2] | ||
| # => [txs_slot_prefix, txs_slot_suffix, MSG, IS_EXECUTED_FLAG] | ||
|
|
||
| # Set the key value pair in the map to mark transaction as executed | ||
| exec.native_account::set_map_item | ||
|
|
@@ -115,8 +115,8 @@ proc cleanup_pubkey_mapping(init_num_of_approvers: u32, new_num_of_approvers: u3 | |
| padw swapw | ||
| # => [[0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers] | ||
|
|
||
| push.PUBLIC_KEYS_MAP_SLOT | ||
| # => [pub_key_slot_idx, [0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers] | ||
| push.APPROVER_PUBLIC_KEYS_SLOT[0..2] | ||
| # => [pub_key_slot_prefix, pub_key_slot_suffix, [0, 0, 0, i-1], EMPTY_WORD, i-1, new_num_of_approvers] | ||
|
|
||
| exec.native_account::set_map_item | ||
| # => [OLD_MAP_ROOT, OLD_MAP_VALUE, i-1, new_num_of_approvers] | ||
|
|
@@ -178,8 +178,8 @@ pub proc update_signers_and_threshold.2(multisig_config_hash: BeWord) | |
| eq.0 assertz.err=ERR_ZERO_IN_MULTISIG_CONFIG | ||
| # => [MULTISIG_CONFIG, pad(12)] | ||
|
|
||
| push.THRESHOLD_CONFIG_SLOT | ||
| # => [slot, MULTISIG_CONFIG, pad(12)] | ||
| push.THRESHOLD_CONFIG_SLOT[0..2] | ||
| # => [config_slot_prefix, config_slot_suffix, MULTISIG_CONFIG, pad(12)] | ||
|
|
||
| exec.native_account::set_item | ||
| # => [OLD_THRESHOLD_CONFIG, pad(12)] | ||
|
|
@@ -205,8 +205,8 @@ pub proc update_signers_and_threshold.2(multisig_config_hash: BeWord) | |
| swapw | ||
| # => [[0, 0, 0, i-1], PUB_KEY, i-1, pad(12)] | ||
|
|
||
| push.PUBLIC_KEYS_MAP_SLOT | ||
| # => [pub_key_slot_idx, [0, 0, 0, i-1], PUB_KEY, i-1, pad(12)] | ||
| push.APPROVER_PUBLIC_KEYS_SLOT[0..2] | ||
| # => [pub_key_slot_prefix, pub_key_slot_suffix, [0, 0, 0, i-1], PUB_KEY, i-1, pad(12)] | ||
|
|
||
| exec.native_account::set_map_item | ||
| # => [OLD_MAP_ROOT, OLD_MAP_VALUE, i-1, pad(12)] | ||
|
|
@@ -277,8 +277,8 @@ proc compute_transaction_threshold.1(default_threshold: u32) -> u32 | |
| if.true | ||
| # => [PROC_ROOT, num_procedures-1, transaction_threshold] | ||
|
|
||
| push.PROC_THRESHOLD_ROOTS_SLOT | ||
| # => [PROC_THRESHOLD_ROOTS_SLOT, PROC_ROOT, num_procedures-1, transaction_threshold] | ||
| push.PROC_THRESHOLD_ROOTS_SLOT[0..2] | ||
| # => [proc_roots_slot_prefix, proc_roots_slot_suffix, PROC_ROOT, num_procedures-1, transaction_threshold] | ||
|
|
||
| # 2b. get the override proc_threshold of that procedure | ||
| # if the procedure has no override threshold, the returned map item will be [0, 0, 0, 0] | ||
|
|
@@ -372,8 +372,8 @@ pub proc auth_tx_ecdsa_k256_keccak_multisig.1(salt: BeWord) | |
|
|
||
| # ------ Verifying approver signatures ------ | ||
|
|
||
| push.THRESHOLD_CONFIG_SLOT | ||
| # => [index, TX_SUMMARY_COMMITMENT] | ||
| push.THRESHOLD_CONFIG_SLOT[0..2] | ||
| # => [config_slot_prefix, config_slot_suffix, TX_SUMMARY_COMMITMENT] | ||
|
|
||
| exec.active_account::get_initial_item | ||
| # => [0, 0, num_of_approvers, default_threshold, TX_SUMMARY_COMMITMENT] | ||
|
|
@@ -384,8 +384,8 @@ pub proc auth_tx_ecdsa_k256_keccak_multisig.1(salt: BeWord) | |
| swap movdn.5 | ||
| # => [num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold] | ||
|
|
||
| push.PUBLIC_KEYS_MAP_SLOT | ||
| # => [pub_key_slot_idx, num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold] | ||
| push.APPROVER_PUBLIC_KEYS_SLOT[0..2] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using Probably it's an overkill, this feature will require some changes in the VM, but could be nice to have something like that.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kind of agree, yes. I think it would already be sufficient to be able to define a sliced constant: And then you could simply do: But not sure it's worth adding. |
||
| # => [pub_key_slot_prefix, pub_key_slot_suffix, num_of_approvers, TX_SUMMARY_COMMITMENT, default_threshold] | ||
|
|
||
| exec.::miden::auth::ecdsa_k256_keccak::verify_signatures | ||
| # => [num_verified_signatures, TX_SUMMARY_COMMITMENT, default_threshold] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.