Phase 0: SV2 foundation — fork deps, stratum-core, config#23
Open
average-gary wants to merge 12 commits intomainfrom
Open
Phase 0: SV2 foundation — fork deps, stratum-core, config#23average-gary wants to merge 12 commits intomainfrom
average-gary wants to merge 12 commits intomainfrom
Conversation
Update Cargo.toml to use average-gary/p2pool-v2 sv2-support branch which includes the stratum-core dependency and Sv2Config struct. Add commented-out [stratum_sv2] section to config.toml and docker/config-example.toml. The section is optional and disabled by default for full backward compatibility. Closes #1
Rebase p2pool-v2 fork onto upstream main (70 commits), then fix hydrapool to match the new API surface: - ChainStore -> ChainStoreHandle (renamed + new StoreWriter pipeline) - .store() -> .chain_store_handle() on StratumServerBuilder - start_notify() now takes ChainStoreHandle + miner_pubkey - commands::run() is now async (hydrapool_cli needs #[tokio::main])
Enable the new 'sv2' cargo feature on p2poolv2_lib, which gates stratum-core and all SV2 code behind a compile-time feature flag. The stratum-core dependency now uses average-gary/stratum:feature-flag-subprotocols with only the 'mining' subprotocol (excludes job_declaration and template_distribution).
- Parse SV2 config, validate authority keypair - Start SV2 connection registry + job distributor actors - Launch Noise NX accept loop on configured port - Clone emissions_tx so SV2 shares feed into same PPLNS pipeline - Add SV2 graceful shutdown handling - handshake_rx is unused pending per-connection message loop
- Import and use Sv2ConnectionContext, handle_sv2_connection, start_channel_manager - Build Sv2ConnectionContext with connections, channels, job_distributor, emissions_tx, chain_store, validate_addresses, network - Spawn handler loop that receives HandshakeResults and spawns handle_sv2_connection per connection - Replace placeholder '_handshake_rx' with active handler dispatch - Update Cargo.lock to ec704078 (handler.rs commit)
- Pass Sv2JobDistributorHandle to start_notify() so GBT templates are forwarded to SV2 miners via the same pipeline as SV1 - Move start_notify() spawn to after SV2 block so the handle is available - Update Cargo.lock to p2pool-v2 478e36d (template feed + vardiff + share_commitment) - Add EXPOSE 3333/3334 to Dockerfile, add 3334 port mapping to docker-compose - Fix config comments: Noise NX keys are REQUIRED (not optional) - Add SV2 endpoint to docker/README.md - Fix docker-compose.dev.yml network name mismatch (p2pool_network -> hydrapool_network)
Add Docker-based interop test that runs the SRI mining-device (CPU SV2 miner) against Hydrapool's SV2 server on a Bitcoin regtest network. New files: - docker/docker-compose.interop.yml: bitcoind + hydrapool + mining-device - docker/Dockerfile.mining-device: builds SRI mining-device from source - docker/interop/config-regtest.toml: Hydrapool config with SV2 enabled - docker/interop/bitcoin-regtest.conf: Bitcoin Core regtest settings - scripts/test-interop-sv2.sh: automated test script with keypair gen - docs/sv2-interop.md: compatibility matrix and testing documentation Also updates Cargo.lock to latest p2pool-v2 sv2-support commit (7210da5) which includes all 14 SV2 integration tests.
- Use signet network (p2poolv2_lib doesn't support regtest genesis) - Shorten pool_signature to 'hydrapool-sv2' (16-char limit) - Use verified Noise NX keypair instead of broken key derivation - Remove auth from healthcheck (auth_user/auth_token are None) - Update Cargo.lock to p2pool-v2 2eb5240 (SetNewPrevHash before NewMiningJob fix)
Pipe docker compose logs directly into grep instead of capturing 50MB+ into a bash variable. Disable pipefail locally in pool_log_has() to prevent SIGPIPE errors when grep -q exits early. Detect mining-device exit to avoid 120s wait timeout. All 5 SV2 lifecycle phases now pass.
Update Cargo.lock to latest p2pool-v2 sv2-support (9736403) which includes three critical SV2 fixes: - Send all jobs as future jobs (min_ntime=None) for SRI compatibility - Send all job messages before any SetNewPrevHash (ordering fix) - Skip standard channel messages for extended-only connections Add testnet4 deployment configs: - config-testnet4.toml: hydrapool pool config with SRI default keys - translator-testnet4.toml: SRI translator proxy config (SV1:34255 → SV2:3334)
The SV2 spec (Section 4.7) defines the URI scheme as stratum2+tcp://, not noise+tcp://. Noise NX encryption is implicit in the protocol.
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.
Summary
average-gary/p2pool-v2sv2-supportbranch (forked fromp2poolv2/p2poolv2atv0.7.0)stratum-corev0.2.0 dependency top2poolv2_libwithwith_buffer_poolfeaturestratum_sv2module stub with smoke tests for all key SV2 typesSv2Configstruct with serde deserialization, defaults, validation, and builder methods[stratum_sv2]config section toconfig.tomlanddocker/config-example.tomlChanges
p2pool-v2 fork (
average-gary/p2pool-v2@sv2-support)Cargo.toml: addstratum-coreto workspace depsp2poolv2_lib/Cargo.toml: addstratum-coredepp2poolv2_lib/src/lib.rs: addstratum_sv2modulep2poolv2_lib/src/stratum_sv2/mod.rs: smoke test importing Noise, Mining Protocol messages, binary codecp2poolv2_lib/src/config.rs: addSv2Configstruct +stratum_sv2: Option<Sv2Config>field onConfig+ builder methods + 11 unit testsconfig.toml: add commented SV2 sectionhydrapool (this PR)
Cargo.toml: point 4 deps at fork branchconfig.toml+docker/config-example.toml: add commented SV2 config sectionTesting
All 388 existing p2poolv2_lib tests pass, plus 12 new tests (11 config + 1 smoke).
cargo checkpasses on both repos.Closes
Closes #1, #2, #3
Project
Stratum v2 Mining Protocol Support