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
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
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
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
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
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
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
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
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