Note tag 32bit routing(#2309)#2329
Conversation
| 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"); |
There was a problem hiding this comment.
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"
);There was a problem hiding this comment.
I think this comment wasn't addressed.
…or tag length handling
| 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"); |
There was a problem hiding this comment.
I think this comment wasn't addressed.
9e70508 to
5c53c17
Compare
PhilippGackstatter
left a comment
There was a problem hiding this comment.
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.
Co-authored-by: Philipp Gackstatter <PhilippGackstatter@users.noreply.github.com>
bobbinth
left a comment
There was a problem hiding this comment.
Looks good! Thank you. I left some comments inline - but we can probably address them in a follow-up.
* 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>
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.