Skip to content

JDS refactor - #299

Merged
plebhash merged 17 commits into
stratum-mining:mainfrom
plebhash:2026-02-03-jd-server-sv2
Mar 19, 2026
Merged

plebhash merged 17 commits into
stratum-mining:mainfrom
plebhash:2026-02-03-jd-server-sv2

Conversation

@plebhash

@plebhash plebhash commented Feb 26, 2026 •

Copy link
Copy Markdown
Member

close #24

  • jd_server_sv2
  • bitcoin_core_sv2
  • pool_sv2 leveraging jd_server_sv2
  • integration tests

@plebhash
plebhash force-pushed the 2026-02-03-jd-server-sv2 branch 5 times, most recently from e7d7bdd to 40f2a41 Compare February 27, 2026 14:31
@plebhash
plebhash force-pushed the 2026-02-03-jd-server-sv2 branch 3 times, most recently from 06d8930 to 1d84c3d Compare March 6, 2026 18:19
Comment thread pool-apps/jd-server/src/lib/job_declarator/downstream/mod.rs Outdated
Comment thread pool-apps/jd-server/src/lib/job_declarator/downstream/mod.rs Outdated
Comment thread pool-apps/jd-server/src/lib/job_declarator/mod.rs Outdated
Comment thread pool-apps/jd-server/src/lib/job_declarator/mod.rs Outdated
Comment thread pool-apps/jd-server/src/lib/job_declarator/mod.rs Outdated
Comment thread pool-apps/jd-server/Cargo.toml Outdated
Comment thread pool-apps/jd-server/Cargo.toml
Comment thread stratum-apps/Cargo.toml Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renaming pool-config.toml.template -> pool-jds-config.toml.template

and making embedded-jds as default

not sure if it's the right move, @lucasbalieiro @GitGab19 please sanity check?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is gonna break other things on the build process.

And also will probably need to adapt some tricks to run the apps with/without JDP. As we do with the --profile nowadays

If it gets too complex to explain, I'll post a commit so you can cherry-pick it.

I'm still checking the fallout

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah please share commit

# Protocol Extensions Configuration
# Extensions that the pool supports (will accept if requested by clients)
# Comment/uncomment to enable/disable specific extensions:
supported_extensions = [

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if this is needed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed this is not needed

@plebhash
plebhash force-pushed the 2026-02-03-jd-server-sv2 branch from e8a35c3 to cbfa504 Compare March 8, 2026 22:19
@plebhash

plebhash commented Mar 8, 2026

Copy link
Copy Markdown
Member Author

@lucasbalieiro can you please do a sanity check on cbfa504?

@plebhash

plebhash commented Mar 8, 2026 •

Copy link
Copy Markdown
Member Author

so far I haven't added any new integration tests... might add some before we merge this (open to suggestions)

but marking it as ready for review... hopefully CI should be all green now

@plebhash
plebhash marked this pull request as ready for review March 8, 2026 22:20
@plebhash
plebhash force-pushed the 2026-02-03-jd-server-sv2 branch from cbfa504 to afae806 Compare March 10, 2026 14:53
@plebhash
plebhash force-pushed the 2026-02-03-jd-server-sv2 branch 4 times, most recently from 2dadb44 to ea5cc2b Compare March 10, 2026 15:22
@plebhash

plebhash commented Mar 11, 2026 •

Copy link
Copy Markdown
Member Author

the issue @lucasbalieiro reported on today's dev call is a potential race-condition bug on libmultiprocess

In this PR, pool_sv2 now spawns both BitcoinCoreSv2TDP and BitcoinCoreSv2JDP in the same process (two independent IPC client lifecycles). This pattern seems relevant to triggering this bug.

I created this gist and asked @Sjors to reproduce, triage and sanity-check before we report to libmultiprocess repo

it's non-deterministic and more easily reproducible via docker than cargo run

moving forward, we have a few options:

  • introduce aggressive refactors on bitcoin_core_sv2 (plus jd_server_sv2, pool_sv2, translator_sv2 and integration_tests_sv2 as a consequence) with a workaround that makes sure this bug is not triggered
  • harden Docker lifecycle/restart behavior to reduce bug likelihood in normal runs (partial mitigation, not root fix)

personally speaking, I'd lean towards the second option

whenever it gets fixed (either on v31 or some backport v30.3 or v31.1), hopefully we won't have to worry about it anymore

@GitGab19

Copy link
Copy Markdown
Member

I also think we could proceed with the second option, even though it's still not clear to me how we can harden it on docker side (cc @lucasbalieiro).

@Sjors

Sjors commented Mar 11, 2026 •

Copy link
Copy Markdown
Contributor

The gist refers to the 30.x Bitcoin Core branch, which has known crash issues (when the client disconnects mid wait). The fixes are in master, and I'm not sure if they will be back-ported or if it's better to wait for v31.

Maybe use master on CI until a 31.x branch exists?

@plebhash
plebhash force-pushed the 2026-02-03-jd-server-sv2 branch from f55eb8a to 9664800 Compare March 18, 2026 23:50

@bit-aloo bit-aloo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK

@Sjors

Sjors commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

If DeclareMiningJob had a reference to current chain tip header [...], we could get more refined error_codes

You could still do that, albeit less elegant: if the node rejects the block, check the tip again.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: JDS

5 participants