After #2285 is done, AccountStorageMode::Network should have been removed, and once that happens, we can simplify the NoteTag::with_account_target API further and use the full 32 bits of a note tag instead of at most 30 bits.
One difficulty is that RoutingParameters relies on NoteTag::MAX_ACCOUNT_TARGET_TAG_LENGTH to be 30 since its 5-bit format can only encode 2^5 = 32 values, and 31 is reserved to signal the absence of a note tag.
The potential solutions are:
- Allow up to 32 bits in
RoutingParameters::note_tag_len and:
- Reduce address interface from 11 to 10 bits and increase note tag from 5 to 6 bits.
- This would waste quite a bit of available space for the note tag.
- Move note tag length encoding to a separate byte, making more room. This means two bytes in total for address interface and note tag, instead of one as now.
- This wastes even more space.
- Continue enforcing that at most 30 bits can be encoded in
RoutingParameters::note_tag_len even though the NoteTag itself can support up to 32.
My preference is the latter option:
- 30 bits in a note tag already sufficiently reduce the set of potential target accounts.
- Network notes targeted at accounts are no longer identified by the note tag, so the requirement for having it be as precise as possible is no longer relevant.
- Leaves the address as small as it is.
So the tasks would be:
Context: #2219 (comment)
After #2285 is done,
AccountStorageMode::Networkshould have been removed, and once that happens, we can simplify theNoteTag::with_account_targetAPI further and use the full 32 bits of a note tag instead of at most 30 bits.One difficulty is that
RoutingParametersrelies onNoteTag::MAX_ACCOUNT_TARGET_TAG_LENGTHto be 30 since its 5-bit format can only encode 2^5 = 32 values, and31is reserved to signal the absence of a note tag.The potential solutions are:
RoutingParameters::note_tag_lenand:RoutingParameters::note_tag_leneven though theNoteTagitself can support up to 32.My preference is the latter option:
So the tasks would be:
NoteTagaccount targets to allow for up to 32 bits.RoutingParameters::MAX_NOTE_TAG_LENGTH = 30and use it to enforce max note tag len, instead of relying onNoteTag::MAX_ACCOUNT_TARGET_TAG_LENGTHwhich would be 32 at that point.Context: #2219 (comment)