github stratum-mining/stratum v1.13.0

5 hours ago

General release information

Highlights of this release:

This release closes the buffer_sv2, codec_sv2 and framing_sv2 audit trackers with a hardening pass over the buffer pool and the codec, renames Mining and Template Distribution message fields to follow the spec cleanup, and lets channels_sv2 server channels serve application-supplied jobs. Every published crate that changed takes an incompatible version bump, except noise_sv2, which only gains a re-export.

Notable highlights include:

  • mining_sv2 and template_distribution_sv2 message fields were renamed to match the spec: SetTarget.maximum_target is now target, UpdateChannel.maximum_target is max_target, min_ntime is ntime_start on NewMiningJob, NewExtendedMiningJob, SetNewPrevHash and SetCustomMiningJob, and the TDP SetNewPrevHash / SubmitSolution header fields are ntime_start, ntime and nonce. The invalid-min-ntime error code became invalid-ntime-start. Nothing changes on the wire.
  • buffer_sv2 received an extensive hardening pass over the pool: slot bookkeeping and mode switches were fixed, pool memory is kept alive while a slice points into it, slices are copied on clone, capacities are checked without overflowing, and the API now separates reserving space from committing written bytes. get_writable, get_data_by_ref, danger_set_start, droppable and the Write trait were removed. A randomized model test exercises slice lifetimes against the pool.
  • codec_sv2 and framing_sv2 close their audit trackers: encoders reject frames whose encoded length a header cannot declare, MessageFrame::encode_into errors on a payload shorter than its header declares, and the noise decoder decrypts the header and each payload chunk as soon as it is buffered instead of holding up to 16 MiB of ciphertext. Decoded::Incomplete and Decrypted::Incomplete no longer carry a byte count, SerializedFrame::from_parts was removed, and every encoder and decoder gained a with_capacity constructor.
  • channels_sv2 server channels can now serve prebuilt jobs: a PrebuiltJob carrying the NewExtendedMiningJob wire fields (including its own ntime_start) goes into on_prebuilt_job on group, standard and extended channels, and activate_future_job(job_id, chain_tip) activates a future job without a Template Distribution message. Standard jobs now keep their coinbase bytes and expose get_origin instead of get_template.
  • channels_sv2 fixed several share and job defects: standard jobs installed from a group channel no longer duplicate the template's coinbase outputs, a reused job_id in add_future_job now releases the replaced job's extranonce prefixes and keeps the future-job cap honest, BlockFound work credit is capped at the difficulty the hash proved, a block-finding share now counts toward best_diff, set_target refuses a target above the channel's max_target, and get_job_target(job_id) exposes the per-job target a share is validated against.
  • channels_sv2 coinbase handling: the witness reserved value, marker and flag are only added when the template carries a witness commitment, so blocks found on templates without one are no longer rejected as unexpected-witness, and try_strip_bip141 refuses coinbases with more than one input.
  • binary_sv2 validates F32 values during serialization (NaN, infinities and negative values return Error::InvalidF32) and bounds the Debug output of Seq0255 and Seq064K.
  • parsers_sv2 rejects TLV values longer than the length field can declare: Tlv::new returns a Result, and TlvError gains ValueTooLong and LengthMismatch.
  • sv1_api serializes version-rolling.min-bit-count in mining.configure as a JSON integer, as BIP 310 requires.
  • noise_sv2 re-exports the aead Buffer trait as AeadBuffer.
  • Fuzzing: structured generators cover the SV2 data types and every common, job declaration, mining and template distribution message.

Crate changes

stratum-core
crate version was bumped from 0.6.0 to 0.7.0

channels_sv2
crate version was bumped from 8.0.0 to 9.0.0

binary_sv2
crate version was bumped from 7.0.0 to 8.0.0

buffer_sv2
crate version was bumped from 3.0.1 to 4.0.0

codec_sv2
crate version was bumped from 7.0.0 to 8.0.0

framing_sv2
crate version was bumped from 8.0.0 to 9.0.0

noise_sv2
crate version was bumped from 2.0.0 to 2.1.0

sv1_api
crate version was bumped from 6.0.0 to 7.0.0

stratum_translation
crate version was bumped from 0.5.0 to 0.6.0

parsers_sv2
crate version was bumped from 0.6.0 to 0.7.0

handlers_sv2
crate version was bumped from 0.6.0 to 0.7.0

extensions_sv2
crate version was bumped from 0.3.0 to 0.4.0

common_messages_sv2
crate version was bumped from 9.0.0 to 10.0.0

mining_sv2
crate version was bumped from 12.0.0 to 13.0.0

job_declaration_sv2
crate version was bumped from 10.0.0 to 11.0.0

template_distribution_sv2
crate version was bumped from 7.0.0 to 8.0.0

What's Changed

  • Patch stratum-core in the sv2-apps workspace root by @bit-aloo in #2401
  • rename message fields, aligning with spec cleanup by @plebhash in #2368
  • fix(sv1_api): serialize configure min-bit-count as integer by @cfilipescu in #2369
  • channels_sv2: fix group -> standard job creation by @plebhash in #2411
  • docs(agents): define a schema for issues triaged from audit findings by @plebhash in #2417
  • fix(channels_sv2): handle a reused job_id in add_future_job by @Jolah1 in #2420
  • docs(agents): keep the fix out of audit issues by @plebhash in #2423
  • buffer_sv2 hardening by @bit-aloo in #2408
  • fix(parsers-sv2)!: reject TLV values the length field cannot declare by @Christopherdominic in #2431
  • codec-sv2, framing-sv2: bound encoded frames and decrypt noise chunks as they arrive by @bit-aloo in #2427
  • fix(binary-sv2): bound sequence Debug output by @Chibey-max in #2428
  • add generators to fuzz target by @lucasbalieiro in #2350
  • feat(channels_sv2)!: serve prebuilt jobs on server channels by @plebhash in #2445
  • fix(channels-sv2): cap BlockFound work credit at proven difficulty by @plebhash in #2406
  • fix(mining_sv2, job_declaration_sv2): correct two Display format strings by @amartya1523 in #2449
  • docs: point example links at sv2/ and fix the channel_msg bit wording by @amartya1523 in #2450
  • feat(channels-sv2): add get_job_target to server channels by @plebhash in #2455
  • fix(channels-sv2): refuse set_target above the channel's max_target by @plebhash in #2456
  • docs(channels-sv2): clarify version rolling policy by @Christopherdominic in #2429
  • fix(channels_sv2): count a block-finding share toward best_diff by @amartya1523 in #2447
  • fix(channels_sv2)!: let a prebuilt job carry its own ntime_start by @plebhash in #2452
  • fix(channels_sv2)!: coinbase witness handling gaps by @Jolah1 in #2457
  • feat(binary-sv2)!: validate F32 values during serialization by @lucasbalieiro in #2436

New Contributors

Full Changelog: v1.12.0...v1.13.0

Don't miss a new stratum release

NewReleases is sending notifications on new releases.