-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
good first issueGood for newcomersGood for newcomersrustIssues that affect or pull requests that update Rust codeIssues that affect or pull requests that update Rust code
Milestone
Description
After #2442 we have equivalent miden_protocol::block::account_tree::account_id_to_smt_key and TransactionAdviceInputs::account_id_map_key implementations. Maybe we should improve this with a dedicated type, for example:
/// The account ID as the key in the [`AccountTree`] and advice map in [`TransactionAdviceInputs`].
pub struct AccountIdKey(AccountId);
impl AccountIdKey {
// Returns `[0, 0, account_id_suffix, account_id_prefix]`.
pub fn as_word(&self) -> Word { ... }
// Converts `[0, 0, account_id_suffix, account_id_prefix]` to Self.
pub fn from_word(word: Word) -> Result<Self, todo!()> { ... }
pub fn to_leaf_index(&self) -> LeafIndex<{ AccountTree::DEPTH }> { ... }
}
impl From<AccountId> for AccountIdKey { ... }And then we can remove:
TransactionAdviceInputs::account_id_map_keymiden_protocol::block::account_tree::{account_id_to_smt_key, smt_key_to_account_id, account_id_to_smt_index}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomersrustIssues that affect or pull requests that update Rust codeIssues that affect or pull requests that update Rust code