Skip to content

JDC: synchronize group-channel size after extranonce prefix changes #830

Description

@GitGab19

Affected applications and crates

  • JDC.
  • The existing channels-sv2 server GroupChannel API is consumed but does not require a confirmed lower-level change.

Problem

When JDC receives SetExtranoncePrefix, it updates the upstream channel, rebuilds its extranonce allocator, reallocates downstream standard and extended prefixes, and sends new prefixes downstream.

The handler computes the new full_extranonce_size but does not apply it to each downstream GroupChannel. Those group channels continue constructing jobs with the old size and therefore reserve the wrong rollable extranonce gap after the prefix length changes.

Impact

JDC can distribute coinbase/job data inconsistent with the newly advertised extranonce prefixes. Downstream shares or upstream custom jobs can become invalid, disrupting mining after a legitimate prefix update.

Expected behavior

Prefix, full extranonce size, allocator state, downstream channel state, and generated jobs must transition atomically to one validated extranonce layout.

Acceptance criteria

  • Validate the new prefix and derived full extranonce size before mutating any live state.
  • Apply the new full size to every downstream GroupChannel.
  • Update standard and extended channel prefixes consistently.
  • Ensure jobs created after the transition reserve exactly the new rollable region.
  • Define rollback or fallback behavior if any allocator or channel update fails.
  • Do not leave a mixture of old and new layouts across downstreams.
  • Cover both increases and decreases in prefix length.
  • Add tests with active standard and extended channels, followed by prefix changes and job generation.
  • Verify failed transitions preserve the prior working layout.

Loupe findings

Related sv2-apps issues and PRs

Intended PR grouping

This belongs in a JDC-local PR. No stratum companion change is currently indicated because the required group-channel setter already exists.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions