Repository navigation
Conversation
…traits The dispatcher never called it, so a policy returning false had no effect. It cannot enforce it either: an unauthorized open is answered with an OpenMiningChannel.Error, which only the implementor can send, so authorization belongs in handle_open_*_mining_channel.
Handler docs called the TLV argument tlv_data, which is named tlv_fields, and pointed at an extract_worker_identity_from_submit_shares helper that extensions_sv2 does not have.
mining.rs, common.rs and both job declaration files imported a list of names from a crate they also glob-imported.
The spec lets a client update any channel it opened, and a standard channel's SetTarget bound refers to its latest accepted UpdateChannel.
The enum predates group channels holding extended channels: no variant let a group-mode client receive the NewMiningJob its standard channels start with, or run standard and extended channels side by side. Whether a message fits a channel depends on per-channel state the implementor already tracks, so the dispatchers now route by direction only. SetCustomMiningJob and its replies stay gated on work selection, which SetupConnection negotiates.
… header AnyMessage::try_from((Header, payload)) ignored the header's payload length and channel_msg bit, so a frame whose header disagreed with its body still decoded, and an intermediary routing on the header could read it differently from the endpoint. Both now fail with dedicated ParserError variants, which parse_message_frame_with_tlvs inherits.
With no extensions negotiated, the handlers decoded the payload from the message type alone, so a frame under an extension namespace was dispatched as a core message and the header's length and channel bit were never looked at. All entry points now share one decoder that goes through AnyMessage::try_from and only reads the TLV suffix when extensions were negotiated.
parsers_sv2, handlers_sv2 and stratum-core break their public API; mining_sv2 only changes a doc comment.
| let (parsed, tlv_fields) = | ||
| parse_message_frame_with_tlvs(header, payload, &negotiated_extensions) | ||
| .map_err(Self::Error::parse_error)?; | ||
| let (parsed, tlv_fields) = crate::decode_frame(header, payload, &negotiated_extensions) |
Contributor
There was a problem hiding this comment.
With the SupportedChannelTypes gate gone, every mining message reaches the implementor regardless of connection mode. Does sv2-apps#997 add the equivalent rejections (e.g. extended-channel messages on a REQUIRES_STANDARD_JOBS connection) in Pool/JDC/tproxy? It might also be worth a short note on the dispatcher trait listing what implementors are now expected to check.
| let header = v.0; | ||
| let payload = v.1; | ||
| let (header, payload) = v; | ||
| if payload.len() != header.payload_length() { |
Contributor
There was a problem hiding this comment.
try_from((Header, payload)) now requires payload.len() == header.payload_length(). Are there callers in sv2-apps that pass a larger, reused buffer slice? Worth grepping in #997 before un-drafting.
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 #2322
Closes #2324
Closes #2325
Closes #2326
Closes #2382
Closes #2393
Closes project-loupe/audit-stratum#25
Closes project-loupe/audit-stratum#141
Closes project-loupe/audit-stratum#31
Closes project-loupe/audit-stratum#226
Closes project-loupe/audit-stratum#50
Closes project-loupe/audit-stratum#137
Closes project-loupe/audit-stratum#187
Closes project-loupe/audit-stratum#257
Closes project-loupe/audit-stratum#63
Closes project-loupe/audit-stratum#138
Closes project-loupe/audit-stratum#143
Closes project-loupe/audit-stratum#188
Closes project-loupe/audit-stratum#224
Closes project-loupe/audit-stratum#259
Closes project-loupe/audit-stratum#258
companion stratum-mining/sv2-apps#997