Skip to content

Note tag 32bit routing(#2309)#2329

Merged
PhilippGackstatter merged 16 commits into0xMiden:nextfrom
swaploard:note-tag-32bit-routing(#2309)
Jan 29, 2026
Merged

Note tag 32bit routing(#2309)#2329
PhilippGackstatter merged 16 commits into0xMiden:nextfrom
swaploard:note-tag-32bit-routing(#2309)

Conversation

@swaploard
Copy link
Copy Markdown
Contributor

Refactor NoteTag account targets to contain up to 32 bits (#2309)

This PR completes the refactor discussed after #2285 by allowing NoteTag account targets to use the full 32-bit space, while keeping RoutingParameters constrained to a representable format.

Comment on lines +281 to +288
let len = 32;

let tag = NoteTag::with_custom_account_target(account_id, len)?;

let prefix = account_id.prefix().as_u64();
let expected = (prefix >> (64 - len)) as u32;

assert_eq!(tag.as_u32(), expected, "full 32-bit tag should match account prefix");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here regarding using the previous test setup as it's harder to understand now. All we need here is a simple assertion:

 assert_eq!(
    (account_id.prefix().as_u64() >> 32) as u32,
    tag.as_u32(),
    "32 most significant bits should match"
);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment wasn't addressed.

Comment on lines +281 to +288
let len = 32;

let tag = NoteTag::with_custom_account_target(account_id, len)?;

let prefix = account_id.prefix().as_u64();
let expected = (prefix >> (64 - len)) as u32;

assert_eq!(tag.as_u32(), expected, "full 32-bit tag should match account prefix");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment wasn't addressed.

@swaploard swaploard force-pushed the note-tag-32bit-routing(#2309) branch from 9e70508 to 5c53c17 Compare January 28, 2026 11:21
Copy link
Copy Markdown
Contributor

@PhilippGackstatter PhilippGackstatter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

We usually try to avoid force pushing after review have started. The latest force push has rolled back a few suggestions I committed earlier. I have now pushed some other fixes, like for build_note_tag_for_network_account.

Let's wait for another review before merging this.

bobbinth and others added 2 commits January 28, 2026 15:36
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you. I left some comments inline - but we can probably address them in a follow-up.

@PhilippGackstatter PhilippGackstatter merged commit d194aa4 into 0xMiden:next Jan 29, 2026
15 checks passed
afa7789 pushed a commit to afa7789/miden-base that referenced this pull request Mar 9, 2026
* feat: update note tag length to support up to 32 bits for network accounts

* chore: update changelog for note tag length support up to 32 bits

* refactor: remove unused NoteTag references and update related logic for tag length handling

* refactor: update note tag length to support up to 32 bits for network

* refactor: simplify changelog entry for note tag length update

* refactor: clarify note tag construction details for account targeting

* refactor: update note tag length references to use MAX_ACCOUNT_TARGET_TAG_LENGTH

* refactor: update assertion for account target tag to check 32 most significant bits

* refactor: improve documentation for routing parameters attachment in Address

* chore: small improvements

* Apply suggestion from @PhilippGackstatter

Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>

---------

Co-authored-by: Bobbin Threadbare <43513081+bobbinth@users.noreply.github.com>
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants