diff --git a/bitcoin-core-sv2/Cargo.toml b/bitcoin-core-sv2/Cargo.toml index 6c6897588..ad957e860 100644 --- a/bitcoin-core-sv2/Cargo.toml +++ b/bitcoin-core-sv2/Cargo.toml @@ -27,4 +27,4 @@ bitcoin_capnp_types_v31 = { package = "bitcoin-capnp-types", version = "0.2.1" } # fetching from github enables synchronizing development workflows across sv2-apps and stratum repos # it MUST be changed before bitcoin-core-sv2 is published to crates.io # with the proper version of stratum-core being fetched from crates.io as well -stratum-core = { git = "https://github.com/stratum-mining/stratum", branch = "main" } +stratum-core = { git = "https://github.com/bit-aloo/stratum", branch = "2026-08-06-noise-sv2-hardening" } diff --git a/integration-tests/Cargo.lock b/integration-tests/Cargo.lock index 376cff657..8efdce5ba 100644 --- a/integration-tests/Cargo.lock +++ b/integration-tests/Cargo.lock @@ -1025,7 +1025,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -1210,7 +1210,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "aes-gcm", ] @@ -1347,7 +1347,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -1460,7 +1460,7 @@ dependencies = [ [[package]] name = "codec_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1489,7 +1489,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "9.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1790,7 +1790,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" [[package]] name = "digest" @@ -1969,7 +1969,7 @@ dependencies = [ [[package]] name = "extensions_sv2" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -2042,7 +2042,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -2263,7 +2263,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2825,7 +2825,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -3070,7 +3070,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "12.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -3123,7 +3123,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "chacha20poly1305", "rand 0.8.6", @@ -3284,7 +3284,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -4397,7 +4397,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -4420,7 +4420,7 @@ dependencies = [ [[package]] name = "stratum_translation" version = "0.5.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -4467,7 +4467,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -4535,7 +4535,7 @@ dependencies = [ [[package]] name = "template_distribution_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] diff --git a/miner-apps/Cargo.lock b/miner-apps/Cargo.lock index a267f2071..5a793b694 100644 --- a/miner-apps/Cargo.lock +++ b/miner-apps/Cargo.lock @@ -839,7 +839,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -1005,7 +1005,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "aes-gcm", ] @@ -1136,7 +1136,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -1228,7 +1228,7 @@ dependencies = [ [[package]] name = "codec_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1266,7 +1266,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "9.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1476,7 +1476,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" [[package]] name = "digest" @@ -1644,7 +1644,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "extensions_sv2" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1883,7 +1883,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2405,7 +2405,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -2597,7 +2597,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "12.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -2637,7 +2637,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "chacha20poly1305", "rand 0.8.5", @@ -2766,7 +2766,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -3770,7 +3770,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -3793,7 +3793,7 @@ dependencies = [ [[package]] name = "stratum_translation" version = "0.5.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -3840,7 +3840,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -3896,7 +3896,7 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" [[package]] name = "template_distribution_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] diff --git a/miner-apps/jd-client/src/lib/channel_manager/upstream_message_handler.rs b/miner-apps/jd-client/src/lib/channel_manager/upstream_message_handler.rs index 09ff04917..b8c66f883 100644 --- a/miner-apps/jd-client/src/lib/channel_manager/upstream_message_handler.rs +++ b/miner-apps/jd-client/src/lib/channel_manager/upstream_message_handler.rs @@ -273,7 +273,9 @@ impl HandleMiningMessagesFromServerOwnedAsync for ChannelManager { downstream .group_channel .with(|group_channel| group_channel.set_full_extranonce_size(full_extranonce_size)) - .map_err(JDCError::shutdown) + .map_err(JDCError::shutdown)? + .map_err(JDCError::shutdown)?; + Ok::<(), Self::Error>(()) })?; info!("Extended mining channel successfully initialized"); diff --git a/pool-apps/Cargo.lock b/pool-apps/Cargo.lock index 2ed767dcc..ada625481 100644 --- a/pool-apps/Cargo.lock +++ b/pool-apps/Cargo.lock @@ -273,7 +273,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -430,7 +430,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "aes-gcm", ] @@ -542,7 +542,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -612,7 +612,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "codec_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -640,7 +640,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "9.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -808,7 +808,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" [[package]] name = "digest" @@ -937,7 +937,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "extensions_sv2" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -998,7 +998,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1133,7 +1133,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -1533,7 +1533,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1653,7 +1653,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "12.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1693,7 +1693,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "chacha20poly1305", "rand", @@ -1816,7 +1816,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2475,7 +2475,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -2542,7 +2542,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "template_distribution_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] diff --git a/stratum-apps/Cargo.lock b/stratum-apps/Cargo.lock index 3a3d46895..401e5b851 100644 --- a/stratum-apps/Cargo.lock +++ b/stratum-apps/Cargo.lock @@ -774,7 +774,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -940,7 +940,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "aes-gcm", ] @@ -1071,7 +1071,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -1117,7 +1117,7 @@ dependencies = [ [[package]] name = "codec_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1140,7 +1140,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "9.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1341,7 +1341,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" [[package]] name = "digest" @@ -1482,7 +1482,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "extensions_sv2" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -1540,7 +1540,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "8.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1711,7 +1711,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2140,7 +2140,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -2328,7 +2328,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "12.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] @@ -2368,7 +2368,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "2.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "chacha20poly1305", "rand 0.8.5", @@ -2491,7 +2491,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -3441,7 +3441,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.6.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -3464,7 +3464,7 @@ dependencies = [ [[package]] name = "stratum_translation" version = "0.5.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -3505,7 +3505,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", "bitcoin", @@ -3561,7 +3561,7 @@ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" [[package]] name = "template_distribution_sv2" version = "7.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#268022034c18c11259350fe863c8f105d2dbb64e" +source = "git+https://github.com/bit-aloo/stratum?branch=2026-08-06-noise-sv2-hardening#67681edba31586b2c494437a73e1206a2affb539" dependencies = [ "binary_sv2", ] diff --git a/stratum-apps/Cargo.toml b/stratum-apps/Cargo.toml index 93d1490b4..332b8d2c6 100644 --- a/stratum-apps/Cargo.toml +++ b/stratum-apps/Cargo.toml @@ -17,7 +17,7 @@ keywords = ["stratum", "mining", "bitcoin", "protocol", "sv2"] # fetching from github enables synchronizing development workflows across sv2-apps and stratum repos # it MUST be changed before stratum-apps is published to crates.io # with the proper version of stratum-core being fetched from crates.io as well -stratum-core = { git = "https://github.com/stratum-mining/stratum", branch = "main", optional = true } +stratum-core = { git = "https://github.com/bit-aloo/stratum", branch = "2026-08-06-noise-sv2-hardening", optional = true } bitcoin-core-sv2 = { package = "bitcoin_core_sv2", version = "0.5.0", path = "../bitcoin-core-sv2", optional = true } # External dependencies needed by the modules diff --git a/stratum-apps/src/network_helpers/noise_stream.rs b/stratum-apps/src/network_helpers/noise_stream.rs index 392d4345e..ce03f19c6 100644 --- a/stratum-apps/src/network_helpers/noise_stream.rs +++ b/stratum-apps/src/network_helpers/noise_stream.rs @@ -13,7 +13,10 @@ use std::time::Duration; use crate::network_helpers::Error; use stratum_core::{ binary_sv2::{Deserialize, GetSize, Serialize}, - codec_sv2::{HandshakeRole, NoiseEncoder, StandardNoiseDecoder, State}, + codec_sv2::{ + HandshakeRole, NoiseEncoder, StandardNoiseDecoder, State, TransportDecryptState, + TransportEncryptState, + }, noise_sv2::INITIATOR_EXPECTED_HANDSHAKE_MESSAGE_SIZE, }; use tokio::net::{ @@ -54,7 +57,7 @@ pub struct NoiseTcpReadHalf< > { reader: OwnedReadHalf, decoder: StandardNoiseDecoder, - state: State, + state: TransportDecryptState, current_frame_buf: Vec, bytes_read: usize, } @@ -68,7 +71,7 @@ pub struct NoiseTcpWriteHalf< > { writer: OwnedWriteHalf, encoder: NoiseEncoder, - state: State, + state: TransportEncryptState, } impl NoiseTcpStream @@ -92,89 +95,84 @@ where let mut decoder = StandardNoiseDecoder::::new(); let mut encoder = NoiseEncoder::::new(); - let mut state = State::initialized(role.clone()); - - match role { - HandshakeRole::Initiator(_) => { - let mut responder_state = State::not_initialized(&role); - let first_msg = state.step_0()?; - send_message(&mut writer, first_msg.into(), &mut state, &mut encoder).await?; - debug!("First handshake message sent"); - - loop { - match receive_message(&mut reader, &mut responder_state, &mut decoder, timeout) - .await - { - Ok(second_msg) => { - debug!("Second handshake message received"); - let handshake_frame: HandShakeFrame = second_msg + let mut peer_state = State::not_initialized(&role); + let is_initiator = matches!(role, HandshakeRole::Initiator(_)); + let mut state = State::initialized(role); + + if is_initiator { + let first_msg = state.step_0()?; + send_message(&mut writer, first_msg.into(), &mut state, &mut encoder).await?; + debug!("First handshake message sent"); + + loop { + match receive_message(&mut reader, &mut peer_state, &mut decoder, timeout).await { + Ok(second_msg) => { + debug!("Second handshake message received"); + let handshake_frame: HandShakeFrame = second_msg + .try_into() + .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; + let payload: [u8; INITIATOR_EXPECTED_HANDSHAKE_MESSAGE_SIZE] = + handshake_frame + .get_payload_when_handshaking() .try_into() .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; - let payload: [u8; INITIATOR_EXPECTED_HANDSHAKE_MESSAGE_SIZE] = - handshake_frame - .get_payload_when_handshaking() - .try_into() - .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; - let transport_state = state.step_2(payload)?; - state = transport_state; - break; - } - Err(Error::CodecError(stratum_core::codec_sv2::Error::MissingBytes(_))) => { - debug!("Waiting for more bytes during handshake"); - } - Err(e) => { - error!("Handshake failed with upstream: {:?}", e); - return Err(e); - } + let transport_state = state.step_2(payload)?; + state = transport_state; + break; + } + Err(Error::CodecError(stratum_core::codec_sv2::Error::MissingBytes(_))) => { + debug!("Waiting for more bytes during handshake"); + } + Err(e) => { + error!("Handshake failed with upstream: {:?}", e); + return Err(e); } } } - HandshakeRole::Responder(_) => { - let mut initiator_state = State::not_initialized(&role); - - loop { - match receive_message(&mut reader, &mut initiator_state, &mut decoder, timeout) - .await - { - Ok(first_msg) => { - debug!("First handshake message received"); - let handshake_frame: HandShakeFrame = first_msg - .try_into() - .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; - let payload: [u8; ELLSWIFT_ENCODING_SIZE] = handshake_frame - .get_payload_when_handshaking() - .try_into() - .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; - let (second_msg, transport_state) = state.step_1(payload)?; - send_message(&mut writer, second_msg.into(), &mut state, &mut encoder) - .await?; - debug!("Second handshake message sent"); - state = transport_state; - break; - } - Err(Error::CodecError(stratum_core::codec_sv2::Error::MissingBytes(_))) => { - debug!("Waiting for more bytes during handshake"); - } - Err(e) => { - error!("Handshake failed with downstream: {:?}", e); - return Err(e); - } + } else { + loop { + match receive_message(&mut reader, &mut peer_state, &mut decoder, timeout).await { + Ok(first_msg) => { + debug!("First handshake message received"); + let handshake_frame: HandShakeFrame = first_msg + .try_into() + .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; + let payload: [u8; ELLSWIFT_ENCODING_SIZE] = handshake_frame + .get_payload_when_handshaking() + .try_into() + .map_err(|_| Error::HandshakeRemoteInvalidMessage)?; + let (second_msg, transport_state) = state.step_1(payload)?; + send_message(&mut writer, second_msg.into(), &mut state, &mut encoder) + .await?; + debug!("Second handshake message sent"); + state = transport_state; + break; + } + Err(Error::CodecError(stratum_core::codec_sv2::Error::MissingBytes(_))) => { + debug!("Waiting for more bytes during handshake"); + } + Err(e) => { + error!("Handshake failed with downstream: {:?}", e); + return Err(e); } } } - }; + } + // Give each half only the direction it uses: the writer encrypts, the reader decrypts. + let (encrypt_state, decrypt_state) = state.split_transport()?; + Ok(Self { reader: NoiseTcpReadHalf { reader, decoder, - state: state.clone(), + state: decrypt_state, current_frame_buf: vec![], bytes_read: 0, }, writer: NoiseTcpWriteHalf { writer, encoder, - state, + state: encrypt_state, }, }) } @@ -195,7 +193,7 @@ where /// /// Not cancellation-safe: A canceled write may cause partial writes or state corruption. pub async fn write_frame(&mut self, frame: StandardEitherFrame) -> Result<(), Error> { - let buf = self.encoder.encode(frame, &mut self.state)?; + let buf = self.encoder.encode_transport(frame, &mut self.state)?; self.writer .write_all(buf.as_ref()) .await @@ -210,7 +208,7 @@ where /// - `Ok(false)` if the socket is not ready (would block). /// - `Err(_)` on socket or encoding errors. pub fn try_write_frame(&mut self, frame: StandardEitherFrame) -> Result { - let buf = self.encoder.encode(frame, &mut self.state)?; + let buf = self.encoder.encode_transport(frame, &mut self.state)?; match self.writer.try_write(buf.as_ref()) { Ok(n) if n == buf.len() => Ok(true), @@ -270,7 +268,7 @@ where self.bytes_read = 0; - match self.decoder.next_frame(&mut self.state) { + match self.decoder.next_transport_frame(&mut self.state) { Ok(frame) => return Ok(frame), Err(stratum_core::codec_sv2::Error::MissingBytes(_)) => { tokio::task::yield_now().await; @@ -315,7 +313,7 @@ where self.bytes_read = 0; - match self.decoder.next_frame(&mut self.state) { + match self.decoder.next_transport_frame(&mut self.state) { Ok(frame) => Ok(Some(frame)), Err(stratum_core::codec_sv2::Error::MissingBytes(_)) => Ok(None), Err(e) => Err(Error::CodecError(e)),