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_key
miden_protocol::block::account_tree::{account_id_to_smt_key, smt_key_to_account_id, account_id_to_smt_index}
After #2442 we have equivalent
miden_protocol::block::account_tree::account_id_to_smt_keyandTransactionAdviceInputs::account_id_map_keyimplementations. Maybe we should improve this with a dedicated type, for example: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}