Skip to content

spec incompatibilities #2150

@plebhash

Description

@plebhash

channel_msg bits

stratum-mining/sv2-spec#185 reported some ways in which the spec was setting channel_msg to some messages in an inconsistent way

stratum-mining/sv2-spec#196 is fixing the spec (should be merged before we tackle this issue)

we need to fix it here accordingly:

these should be true

pub const CHANNEL_BIT_SET_CUSTOM_MINING_JOB: bool = false;
pub const CHANNEL_BIT_SET_CUSTOM_MINING_JOB_ERROR: bool = false;
pub const CHANNEL_BIT_SET_CUSTOM_MINING_JOB_SUCCESS: bool = false;

this should be false:

pub const CHANNEL_BIT_PUSH_SOLUTION: bool = true;


PushSolution field ordering

(there's nothing wrong with spec here, SRI is just non-compliant since the beginning)

spec defines the following order for the PushSolution fields:

  • extranonce
  • prev_hash
  • nonce
  • ntime
  • nbits
  • version

while job_declaration_sv2 crate defines the message with ntime vs nonce fields swapped

pub struct PushSolution<'decoder> {
/// Full extranonce that forms a valid submission.
pub extranonce: B032<'decoder>,
/// Previous block hash.
pub prev_hash: U256<'decoder>,
/// Contains the time the block was constructed as a Unix timestamp.
pub ntime: u32,
/// Nonce of the block.
pub nonce: u32,
/// The bits field is compact representation of the target at the time the block was mined.
pub nbits: u32,
/// The version field in a Bitcoin header initially indicated protocol rule changes. [`BIP9`]
/// altered its use by turning it into a bit vector for coordinated soft fork signaling.
/// [`BIP320`] further refined its purpose by dedicating 16 bits(starting from 13 to 28) of the
/// version field for general-purpose miner use, ensuring that such usage doesn't interfere
/// with the soft fork signaling mechanism defined by [`BIP9`].
///
/// [`BIP9`]: https://en.bitcoin.it/wiki/BIP_0009
/// [`BIP320`]: https://en.bitcoin.it/wiki/BIP_0320
pub version: u32,
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Blocked ⛔

Status

Blocked ⛔

Relationships

None yet

Development

No branches or pull requests

Issue actions