Repository navigation
fix(parsers-sv2): keep extension type in TLV frame header - #2433
Open
Christopherdominic wants to merge 2 commits into
Open
Christopherdominic wants to merge 2 commits into
Christopherdominic wants to merge 2 commits into
Conversation
Christopherdominic
force-pushed
the
fix/2355-tlv-frame-extension-type
branch
from
October 28, 2026 15:33
0aa7b95 to
735f6af
Compare
Contributor
Author
Christopherdominic
force-pushed
the
fix/2355-tlv-frame-extension-type
branch
from
October 28, 2026 15:37
735f6af to
eab19b1
Compare
Chibey-max
reviewed
Oct 28, 2026
Comment on lines
-107
to
110
| let extension_type: u16 = (message.channel_bit() as u16) << 15; | ||
| let extension_type = message.extension_type() | ((message.channel_bit() as u16) << 15); | ||
| let message_type = message.message_type(); | ||
|
|
||
| // Serialize the base message |
Contributor
There was a problem hiding this comment.
Bit 15 is reserved for channel_msg. Could we clear it from
extension_type() before combining it with channel_bit(), matching
update_extension_type?
Contributor
Author
There was a problem hiding this comment.
Good point, done. extension_type() is now masked with 0x7fff before the channel bit is OR-ed in, so the channel_msg flag comes from channel_bit() alone, same as update_extension_type in framing-sv2. Folded into the existing commit.
TlvList::build_frame_bytes_with_tlvs built the header's extension_type from the channel bit alone, so a message from a non-zero extension namespace was framed as a core message and the receiver parsed its payload under the wrong protocol. The header now combines IsSv2Message::extension_type() with the channel bit in the most significant bit. Bit 15 is cleared from extension_type() first, so the channel_msg flag comes from channel_bit() alone, matching framing-sv2's update_extension_type. Closes stratum-mining#2355
Christopherdominic
force-pushed
the
fix/2355-tlv-frame-extension-type
branch
from
October 28, 2026 21:47
eab19b1 to
d1a9dd0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2355
TlvList::build_frame_bytes_with_tlvswrote the frame header'sextension_typefrom the channel bit alone and ignoredmessage.extension_type(). Any message from a non-zero extension namespace was framed as a core message, so the receiver parsed its payload under the wrong protocol.The header now combines
IsSv2Message::extension_type()with the channel bit in the most significant bit, as the issue suggests.Changes
sv2/parsers-sv2/src/tlv/list.rs: usemessage.extension_type() | ((message.channel_bit() as u16) << 15)for the header.Extensions Negotiationmessage (extension type0x0001) and checks the header carries that extension type. It fails onmainand passes with this change.Compatibility
No public API changes, so no companion
sv2-appsPR is needed. Core messages are unaffected because theirextension_type()is0.