Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
245796d
Implement Address struct with encoding/decoding methods
CreeptoGengar Jan 12, 2026
56231b1
Add AddressId enum with associated methods
CreeptoGengar Jan 12, 2026
a67fb40
Add AddressInterface enum for account procedures
CreeptoGengar Jan 12, 2026
e603f71
Create routing_parameters.rs
CreeptoGengar Jan 12, 2026
7240619
Refactor address module and clean up code
CreeptoGengar Jan 12, 2026
ffb48f5
Update Address reference in type.rs documentation
CreeptoGengar Jan 12, 2026
2fa6705
Change visibility of network ID methods to public
CreeptoGengar Jan 12, 2026
ffb0b80
Refactor from_bech32_byte_iter to use generic iterator
CreeptoGengar Jan 12, 2026
c610cef
Refactor from_bech32_byte_iter for better efficiency
CreeptoGengar Jan 12, 2026
7395086
Clarify re-exported items in lib.rs
CreeptoGengar Jan 12, 2026
37e2c32
Change visibility of account ID functions to public
CreeptoGengar Jan 12, 2026
edbfff8
Add address module to miden-standards library
CreeptoGengar Jan 12, 2026
31b1d80
Add bech32 dependency with specific features
CreeptoGengar Jan 12, 2026
53285cf
Delete crates/miden-protocol/src/address/address_id.rs
CreeptoGengar Jan 12, 2026
4d05ed7
Delete crates/miden-protocol/src/address/interface.rs
CreeptoGengar Jan 12, 2026
c00ebfd
Delete crates/miden-protocol/src/address/routing_parameters.rs
CreeptoGengar Jan 12, 2026
3df0744
feat: move standard note scripts into standard library (#2255)
Farukest Jan 12, 2026
671a7f2
Add 'bech32' dependency to Cargo.lock
CreeptoGengar Jan 13, 2026
fdcd011
Simplify address type documentation
CreeptoGengar Jan 13, 2026
f67da58
Update documentation for NoteTag construction methods
CreeptoGengar Jan 13, 2026
1919279
Remove deprecated NoteTag::from_local_account_id usage
CreeptoGengar Jan 15, 2026
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- [BREAKING] Renamed `AccountProcedureInfo` into `AccountProcedureRoot` and remove storage offset and size ([#2162](https://github.com/0xMiden/miden-base/pull/2162)).
- [BREAKING] Made `AccountProcedureIndexMap` construction infallible ([#2163](https://github.com/0xMiden/miden-base/pull/2163)).
- [BREAKING] Renamed `tracked_procedure_roots_slot` to `trigger_procedure_roots_slot` in ACL auth components for naming consistency ([#2166](https://github.com/0xMiden/miden-base/pull/2166)).
- [BREAKING] Refactor `miden-objects` and `miden-lib` into `miden-protocol` and `miden-standards` ([#2184](https://github.com/0xMiden/miden-base/pull/2184), [#2191](https://github.com/0xMiden/miden-base/pull/2191), [#2197](https://github.com/0xMiden/miden-base/pull/2197)).
- [BREAKING] Refactor `miden-objects` and `miden-lib` into `miden-protocol` and `miden-standards` ([#2184](https://github.com/0xMiden/miden-base/pull/2184), [#2191](https://github.com/0xMiden/miden-base/pull/2191), [#2197](https://github.com/0xMiden/miden-base/pull/2197), [#2255](https://github.com/0xMiden/miden-base/pull/2255)).
- [BREAKING] Migrated to `miden-vm` v0.20 and `miden-crypto` v0.19 ([#2158](https://github.com/0xMiden/miden-base/pull/2158)).
- [BREAKING] Refactored `AccountStorageDelta` to use a new `StorageSlotDelta` type ([#2182](https://github.com/0xMiden/miden-base/pull/2182)).
- [BREAKING] Removed OLD_MAP_ROOT from being returned when calling [`native_account::set_map_item`](crates/miden-lib/asm/miden/native_account.masm) ([#2194](https://github.com/0xMiden/miden-base/pull/2194)).
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions crates/miden-protocol/src/account/account_id/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ mod id_version;
use alloc::string::{String, ToString};
use core::fmt;

use bech32::primitives::decode::ByteIter;
pub use id_version::AccountIdVersion;
use miden_core::Felt;
use miden_core::utils::{ByteReader, Deserializable, Serializable};
Expand Down Expand Up @@ -341,7 +340,9 @@ impl AccountId {
}

/// Decodes the data from the bech32 byte iterator into an [`AccountId`].
pub(crate) fn from_bech32_byte_iter(byte_iter: ByteIter<'_>) -> Result<Self, AccountIdError> {
pub fn from_bech32_byte_iter(
byte_iter: impl Iterator<Item = u8>,
) -> Result<Self, AccountIdError> {
AccountIdV0::from_bech32_byte_iter(byte_iter).map(AccountId::V0)
}

Expand Down
22 changes: 12 additions & 10 deletions crates/miden-protocol/src/account/account_id/v0/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::fmt;
use core::hash::Hash;

use bech32::Bech32m;
use bech32::primitives::decode::{ByteIter, CheckedHrpstring};
use bech32::primitives::decode::CheckedHrpstring;
use miden_crypto::utils::hex_to_bytes;
pub use prefix::AccountIdPrefixV0;

Expand Down Expand Up @@ -272,21 +272,23 @@ impl AccountIdV0 {
}

/// Decodes the data from the bech32 byte iterator into an [`AccountId`].
pub(crate) fn from_bech32_byte_iter(byte_iter: ByteIter<'_>) -> Result<Self, AccountIdError> {
// The _remaining_ length of the iterator must be the serialized size of the account ID.
if byte_iter.len() != Self::SERIALIZED_SIZE {
pub(crate) fn from_bech32_byte_iter(
byte_iter: impl Iterator<Item = u8>,
) -> Result<Self, AccountIdError> {
// Collect the iterator into a Vec to check length and iterate
let bytes: Vec<u8> = byte_iter.collect();

// The length must be the serialized size of the account ID.
if bytes.len() != Self::SERIALIZED_SIZE {
return Err(AccountIdError::Bech32DecodeError(Bech32Error::InvalidDataLength {
expected: Self::SERIALIZED_SIZE,
actual: byte_iter.len(),
actual: bytes.len(),
}));
}

// Every byte is guaranteed to be overwritten since we've checked the length of the
// iterator.
// Convert Vec to array
let mut id_bytes = [0_u8; Self::SERIALIZED_SIZE];
for (i, byte) in byte_iter.enumerate() {
id_bytes[i] = byte;
}
id_bytes.copy_from_slice(&bytes);

let account_id = Self::try_from(id_bytes)?;

Expand Down
Loading