diff --git a/integration-tests/Cargo.lock b/integration-tests/Cargo.lock index ca2fbf1fa..b65ac56c2 100644 --- a/integration-tests/Cargo.lock +++ b/integration-tests/Cargo.lock @@ -465,7 +465,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "5.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -639,7 +639,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", ] @@ -757,7 +757,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -848,7 +848,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "codec_sv2" version = "5.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -867,7 +867,7 @@ checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "common_messages_sv2" version = "7.2.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1126,7 +1126,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "1.1.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" [[package]] name = "digest" @@ -1255,7 +1255,7 @@ dependencies = [ [[package]] name = "extensions_sv2" version = "0.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1321,7 +1321,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "6.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1506,7 +1506,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -1857,7 +1857,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "7.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -2024,7 +2024,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -2077,7 +2077,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "1.4.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", "chacha20poly1305", @@ -2233,7 +2233,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2994,7 +2994,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -3017,7 +3017,7 @@ dependencies = [ [[package]] name = "stratum_translation" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -3042,7 +3042,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" version = "4.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin_hashes 0.3.2", @@ -3090,7 +3090,7 @@ dependencies = [ [[package]] name = "template_distribution_sv2" version = "5.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] diff --git a/miner-apps/Cargo.lock b/miner-apps/Cargo.lock index 3c299193f..4f04a0bee 100644 --- a/miner-apps/Cargo.lock +++ b/miner-apps/Cargo.lock @@ -273,7 +273,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "5.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -428,7 +428,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", ] @@ -540,7 +540,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -610,7 +610,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "codec_sv2" version = "5.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -638,7 +638,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "7.2.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -806,7 +806,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "1.1.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" [[package]] name = "digest" @@ -935,7 +935,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "extensions_sv2" version = "0.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -996,7 +996,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "6.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1131,7 +1131,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -1534,7 +1534,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "7.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1654,7 +1654,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1694,7 +1694,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "1.4.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", "chacha20poly1305", @@ -1818,7 +1818,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2460,7 +2460,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -2483,7 +2483,7 @@ dependencies = [ [[package]] name = "stratum_translation" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -2508,7 +2508,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" version = "4.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin_hashes 0.3.2", @@ -2555,7 +2555,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "template_distribution_sv2" version = "5.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] diff --git a/miner-apps/jd-client/src/lib/channel_manager/downstream_message_handler.rs b/miner-apps/jd-client/src/lib/channel_manager/downstream_message_handler.rs index e4fa18706..6f231bfe1 100644 --- a/miner-apps/jd-client/src/lib/channel_manager/downstream_message_handler.rs +++ b/miner-apps/jd-client/src/lib/channel_manager/downstream_message_handler.rs @@ -988,7 +988,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; info!("SubmitSharesStandard on downstream channel: {} ✅", success); messages.push((downstream.downstream_id, Mining::SubmitSharesSuccess(success)).into()); @@ -1022,7 +1022,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; messages.push(( downstream.downstream_id, @@ -1253,7 +1253,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; info!("SubmitSharesExtended on downstream channel: {} ✅", success); messages.push((downstream.downstream_id, Mining::SubmitSharesSuccess(success)).into()); @@ -1285,7 +1285,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; is_downstream_share_valid = true; messages.push(( 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 0a6521bee..dbd53e00d 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 @@ -544,10 +544,8 @@ impl HandleMiningMessagesFromServerAsync for ChannelManager { self.channel_manager_data.super_safe_lock(|data| { // if None, upstream is not currently available, so we skip accounting update if let Some(upstream_channel) = data.upstream_channel.as_mut() { - upstream_channel.on_share_acknowledgement( - msg.new_submits_accepted_count, - msg.new_shares_sum as f64, - ); + upstream_channel + .on_share_acknowledgement(msg.new_submits_accepted_count, msg.new_shares_sum); } }); diff --git a/miner-apps/jd-client/src/lib/monitoring.rs b/miner-apps/jd-client/src/lib/monitoring.rs index 0e4469af0..2d9ce07d3 100644 --- a/miner-apps/jd-client/src/lib/monitoring.rs +++ b/miner-apps/jd-client/src/lib/monitoring.rs @@ -42,7 +42,8 @@ impl ServerMonitoring for ChannelManager { shares_submitted: share_accounting.get_validated_shares(), shares_rejected, shares_rejected_by_reason, - share_work_sum: share_accounting.get_share_work_sum(), + acknowledged_work_sum: share_accounting.get_acknowledged_work_sum(), + validated_work_sum: share_accounting.get_validated_work_sum(), best_diff: share_accounting.get_best_diff(), blocks_found: share_accounting.get_blocks_found(), }); diff --git a/miner-apps/translator/src/lib/monitoring.rs b/miner-apps/translator/src/lib/monitoring.rs index ee6039fdc..65734bf20 100644 --- a/miner-apps/translator/src/lib/monitoring.rs +++ b/miner-apps/translator/src/lib/monitoring.rs @@ -49,7 +49,8 @@ impl ServerMonitoring for ChannelManager { shares_submitted: share_accounting.get_validated_shares(), shares_rejected, shares_rejected_by_reason, - share_work_sum: share_accounting.get_share_work_sum(), + acknowledged_work_sum: share_accounting.get_acknowledged_work_sum(), + validated_work_sum: share_accounting.get_validated_work_sum(), best_diff: share_accounting.get_best_diff(), blocks_found: share_accounting.get_blocks_found(), }); @@ -86,7 +87,8 @@ impl ServerMonitoring for ChannelManager { shares_submitted: share_accounting.get_validated_shares(), shares_rejected, shares_rejected_by_reason, - share_work_sum: share_accounting.get_share_work_sum(), + acknowledged_work_sum: share_accounting.get_acknowledged_work_sum(), + validated_work_sum: share_accounting.get_validated_work_sum(), best_diff: share_accounting.get_best_diff(), blocks_found: share_accounting.get_blocks_found(), }); @@ -158,12 +160,12 @@ mod tests { .extended_channels .get_mut(&AGGREGATED_CHANNEL_ID) .unwrap() - .on_share_acknowledgement(2, 10.0); + .on_share_acknowledgement(2, 10); manager .extended_channels .get_mut(&7) .unwrap() - .on_share_acknowledgement(5, 25.0); + .on_share_acknowledgement(5, 25); let server = manager.get_server(); let aggregated = server.extended_channels.first().unwrap(); @@ -171,6 +173,7 @@ mod tests { assert_eq!(server.extended_channels.len(), 1); assert_eq!(aggregated.channel_id, 42); assert_eq!(aggregated.shares_acknowledged, 2); - assert_eq!(aggregated.share_work_sum, 10.0); + assert_eq!(aggregated.acknowledged_work_sum, 10); + assert_eq!(aggregated.validated_work_sum, 0.0); } } diff --git a/miner-apps/translator/src/lib/sv2/channel_manager/mining_message_handler.rs b/miner-apps/translator/src/lib/sv2/channel_manager/mining_message_handler.rs index 508eb4a87..f613d680e 100644 --- a/miner-apps/translator/src/lib/sv2/channel_manager/mining_message_handler.rs +++ b/miner-apps/translator/src/lib/sv2/channel_manager/mining_message_handler.rs @@ -500,7 +500,7 @@ impl HandleMiningMessagesFromServerAsync for ChannelManager { // if None, the channel may be closed/missing, so we ignore this accounting update if let Some(mut ch) = self.extended_channels.get_mut(&key) { - ch.on_share_acknowledgement(m.new_submits_accepted_count, m.new_shares_sum as f64); + ch.on_share_acknowledgement(m.new_submits_accepted_count, m.new_shares_sum); } Ok(()) diff --git a/pool-apps/Cargo.lock b/pool-apps/Cargo.lock index 7dac0cc98..6afdb9370 100644 --- a/pool-apps/Cargo.lock +++ b/pool-apps/Cargo.lock @@ -273,7 +273,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "5.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -419,7 +419,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", ] @@ -531,7 +531,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -601,7 +601,7 @@ checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "codec_sv2" version = "5.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -629,7 +629,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "7.2.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -797,7 +797,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "1.1.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" [[package]] name = "digest" @@ -926,7 +926,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "extensions_sv2" version = "0.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -987,7 +987,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "6.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -1122,7 +1122,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -1524,7 +1524,7 @@ dependencies = [ [[package]] name = "job_declaration_sv2" version = "7.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1644,7 +1644,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1684,7 +1684,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "1.4.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", "chacha20poly1305", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2467,7 +2467,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -2534,7 +2534,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "template_distribution_sv2" version = "5.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] diff --git a/pool-apps/pool/src/lib/channel_manager/mining_message_handler.rs b/pool-apps/pool/src/lib/channel_manager/mining_message_handler.rs index 84cb76e2f..2bf7bb8f3 100644 --- a/pool-apps/pool/src/lib/channel_manager/mining_message_handler.rs +++ b/pool-apps/pool/src/lib/channel_manager/mining_message_handler.rs @@ -584,7 +584,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; info!("SubmitSharesStandard: {} ✅", success); messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into()); @@ -617,7 +617,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into()); } @@ -783,7 +783,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; info!("SubmitSharesExtended: {} ✅", success); messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into()); @@ -815,7 +815,7 @@ impl HandleMiningMessagesFromClientAsync for ChannelManager { channel_id, last_sequence_number: share_accounting.get_last_share_sequence_number(), new_submits_accepted_count: share_accounting.get_last_batch_accepted(), - new_shares_sum: share_accounting.get_last_batch_work_sum() as u64, + new_shares_sum: share_accounting.get_last_batch_work_sum(), }; messages.push((downstream_id, Mining::SubmitSharesSuccess(success)).into()); } diff --git a/stratum-apps/Cargo.lock b/stratum-apps/Cargo.lock index 43f3a1844..04010ac9c 100644 --- a/stratum-apps/Cargo.lock +++ b/stratum-apps/Cargo.lock @@ -202,7 +202,7 @@ checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" [[package]] name = "binary_sv2" version = "5.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "buffer_sv2", "derive_codec_sv2", @@ -332,7 +332,7 @@ dependencies = [ [[package]] name = "buffer_sv2" version = "3.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", ] @@ -404,7 +404,7 @@ dependencies = [ [[package]] name = "channels_sv2" version = "6.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -428,7 +428,7 @@ dependencies = [ [[package]] name = "codec_sv2" version = "5.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -441,7 +441,7 @@ dependencies = [ [[package]] name = "common_messages_sv2" version = "7.2.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -602,7 +602,7 @@ dependencies = [ [[package]] name = "derive_codec_sv2" version = "1.1.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" [[package]] name = "digest" @@ -698,7 +698,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "extensions_sv2" version = "0.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -749,7 +749,7 @@ dependencies = [ [[package]] name = "framing_sv2" version = "6.0.1" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "buffer_sv2", @@ -903,7 +903,7 @@ dependencies = [ [[package]] name = "handlers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -1226,7 +1226,7 @@ checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "job_declaration_sv2" version = "7.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1331,7 +1331,7 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mining_sv2" version = "10.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] @@ -1371,7 +1371,7 @@ dependencies = [ [[package]] name = "noise_sv2" version = "1.4.2" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "aes-gcm", "chacha20poly1305", @@ -1480,7 +1480,7 @@ dependencies = [ [[package]] name = "parsers_sv2" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "common_messages_sv2", @@ -2080,7 +2080,7 @@ dependencies = [ [[package]] name = "stratum-core" version = "0.4.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -2103,7 +2103,7 @@ dependencies = [ [[package]] name = "stratum_translation" version = "0.3.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin", @@ -2122,7 +2122,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sv1_api" version = "4.0.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", "bitcoin_hashes 0.3.2", @@ -2190,7 +2190,7 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "template_distribution_sv2" version = "5.1.0" -source = "git+https://github.com/stratum-mining/stratum?branch=main#7af1b737065ce238b8e39d846edac05c0abe143f" +source = "git+https://github.com/stratum-mining/stratum?branch=main#d283cb9ff5df8ca636604da62799b95d4ed0ed7f" dependencies = [ "binary_sv2", ] diff --git a/stratum-apps/src/monitoring/client.rs b/stratum-apps/src/monitoring/client.rs index a8b4a02b2..cdf0c048c 100644 --- a/stratum-apps/src/monitoring/client.rs +++ b/stratum-apps/src/monitoring/client.rs @@ -24,7 +24,7 @@ pub struct ExtendedChannelInfo { pub last_share_sequence_number: u32, pub best_diff: f64, pub last_batch_accepted: u32, - pub last_batch_work_sum: f64, + pub last_batch_work_sum: u64, pub share_batch_size: usize, pub blocks_found: u32, } @@ -45,7 +45,7 @@ pub struct StandardChannelInfo { pub last_share_sequence_number: u32, pub best_diff: f64, pub last_batch_accepted: u32, - pub last_batch_work_sum: f64, + pub last_batch_work_sum: u64, pub share_batch_size: usize, pub blocks_found: u32, } @@ -161,7 +161,7 @@ mod tests { last_share_sequence_number: 5, best_diff: 50.0, last_batch_accepted: 3, - last_batch_work_sum: 30.0, + last_batch_work_sum: 30, share_batch_size: 10, blocks_found: 0, } @@ -182,7 +182,7 @@ mod tests { last_share_sequence_number: 8, best_diff: 80.0, last_batch_accepted: 5, - last_batch_work_sum: 50.0, + last_batch_work_sum: 50, share_batch_size: 20, blocks_found: 0, } diff --git a/stratum-apps/src/monitoring/http_server.rs b/stratum-apps/src/monitoring/http_server.rs index 85d7f3ed8..4ba493c6c 100644 --- a/stratum-apps/src/monitoring/http_server.rs +++ b/stratum-apps/src/monitoring/http_server.rs @@ -811,7 +811,7 @@ mod tests { last_share_sequence_number: 5, best_diff: 50.0, last_batch_accepted: 3, - last_batch_work_sum: 30.0, + last_batch_work_sum: 30, share_batch_size: 10, blocks_found: 0, } @@ -835,7 +835,7 @@ mod tests { last_share_sequence_number: 8, best_diff: 80.0, last_batch_accepted: 5, - last_batch_work_sum: 50.0, + last_batch_work_sum: 50, share_batch_size: 20, blocks_found: 0, } @@ -857,7 +857,8 @@ mod tests { shares_acknowledged: 10, shares_rejected: 0, shares_rejected_by_reason: HashMap::new(), - share_work_sum: 100.0, + acknowledged_work_sum: 100, + validated_work_sum: 100.0, shares_submitted: 12, best_diff: 50.0, blocks_found: 0, @@ -878,7 +879,8 @@ mod tests { shares_submitted: 22, shares_rejected: 1, shares_rejected_by_reason: HashMap::from([("duplicate-share".to_string(), 1)]), - share_work_sum: 200.0, + acknowledged_work_sum: 200, + validated_work_sum: 200.0, best_diff: 80.0, blocks_found: 0, } diff --git a/stratum-apps/src/monitoring/openapi.json b/stratum-apps/src/monitoring/openapi.json index 96c69ec99..3f2df775b 100644 --- a/stratum-apps/src/monitoring/openapi.json +++ b/stratum-apps/src/monitoring/openapi.json @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"SRI Monitoring API","description":"HTTP JSON API for monitoring SV2 applications","contact":{"name":"The Stratum V2 Developers"},"license":{"name":"MIT OR Apache-2.0","identifier":"MIT OR Apache-2.0"},"version":"0.1.0"},"paths":{"/api/v1/clients":{"get":{"tags":["clients"],"summary":"Get all Sv2 clients (downstream) - returns metadata only, use /clients/{id}/channels for\nchannels","operationId":"handle_clients","parameters":[{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"List of Sv2 clients (metadata only)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv2ClientsResponse"}}}},"404":{"description":"Sv2 clients monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/clients/{client_id}":{"get":{"tags":["clients"],"summary":"Get a single Sv2 client by ID - returns metadata only, use /clients/{id}/channels for channels","operationId":"handle_client_by_id","parameters":[{"name":"client_id","in":"path","description":"Sv2 Client ID","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Sv2 client metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv2ClientResponse"}}}},"404":{"description":"Sv2 client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/clients/{client_id}/channels":{"get":{"tags":["clients"],"summary":"Get channels for a specific Sv2 client (paginated)","operationId":"handle_client_channels","parameters":[{"name":"client_id","in":"path","description":"Sv2 Client ID","required":true,"schema":{"type":"integer","minimum":0}},{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"Sv2 client channels (paginated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv2ClientChannelsResponse"}}}},"404":{"description":"Sv2 client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/global":{"get":{"tags":["global"],"summary":"Get global statistics","description":"Returns aggregated statistics for the server (upstream) and clients (downstream).\nFields are omitted from the response if that type of monitoring is not enabled.\n\n**Typical responses:**\n- **Pool/JDC**: `server` + `clients` (Sv2 downstream)\n- **tProxy**: `server` + `sv1_clients` (Sv1 miners)","operationId":"handle_global","responses":{"200":{"description":"Global statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalInfo"}}}}}}},"/api/v1/health":{"get":{"tags":["health"],"summary":"Health check endpoint","operationId":"handle_health","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/server":{"get":{"tags":["server"],"summary":"Get server (upstream) metadata - use /server/channels for channel details","operationId":"handle_server","responses":{"200":{"description":"Server metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerResponse"}}}},"404":{"description":"Server monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/server/channels":{"get":{"tags":["server"],"summary":"Get server channels (paginated)","operationId":"handle_server_channels","parameters":[{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"Server channels (paginated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerChannelsResponse"}}}},"404":{"description":"Server monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/sv1/clients":{"get":{"tags":["sv1"],"summary":"Get Sv1 clients (Translator Proxy only)","operationId":"handle_sv1_clients","parameters":[{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"List of Sv1 clients","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv1ClientsResponse"}}}},"404":{"description":"Sv1 monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/sv1/clients/{client_id}":{"get":{"tags":["sv1"],"summary":"Get a single Sv1 client by ID","operationId":"handle_sv1_client_by_id","parameters":[{"name":"client_id","in":"path","description":"Sv1 client ID","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Sv1 client details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv1ClientInfo"}}}},"404":{"description":"Sv1 client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"ExtendedChannelInfo":{"type":"object","description":"Information about an extended channel","required":["channel_id","user_identity","nominal_hashrate","stable_hashrate","target_hex","requested_max_target_hex","extranonce_prefix_hex","full_extranonce_size","rollable_extranonce_size","expected_shares_per_minute","shares_accepted","share_work_sum","last_share_sequence_number","best_diff","last_batch_accepted","last_batch_work_sum","share_batch_size","blocks_found"],"properties":{"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"expected_shares_per_minute":{"type":"number","format":"float"},"extranonce_prefix_hex":{"type":"string"},"full_extranonce_size":{"type":"integer","minimum":0},"last_batch_accepted":{"type":"integer","format":"int32","minimum":0},"last_batch_work_sum":{"type":"number","format":"double"},"last_share_sequence_number":{"type":"integer","format":"int32","minimum":0},"nominal_hashrate":{"type":"number","format":"float"},"requested_max_target_hex":{"type":"string"},"rollable_extranonce_size":{"type":"integer","format":"int32","minimum":0},"share_batch_size":{"type":"integer","minimum":0},"share_work_sum":{"type":"number","format":"double"},"shares_accepted":{"type":"integer","format":"int32","minimum":0},"stable_hashrate":{"type":"boolean"},"target_hex":{"type":"string"},"user_identity":{"type":"string"}}},"GlobalInfo":{"type":"object","description":"Global statistics from `/api/v1/global` endpoint\n\nFields are `Option` to distinguish \"not monitored\" (`None`) from \"monitored but empty\" (`Some`\nwith zeros).\n\nTypical configurations:\n- **Pool/JDC**: `server` and `sv2_clients` are `Some`, `sv1_clients` is `None`\n- **tProxy**: `server` and `sv1_clients` are `Some`, `sv2_clients` is `None`","required":["uptime_secs"],"properties":{"server":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ServerSummary","description":"Server (upstream) summary - `None` if server monitoring is not enabled"}]},"sv1_clients":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Sv1ClientsSummary","description":"Sv1 clients summary - `None` if Sv1 monitoring is not enabled (e.g., Pool/JDC)"}]},"sv2_clients":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Sv2ClientsSummary","description":"Sv2 clients (downstream) summary - `None` if Sv2 client monitoring is not enabled (e.g.,\ntProxy)"}]},"uptime_secs":{"type":"integer","format":"int64","description":"Uptime in seconds since the application started","minimum":0}}},"HealthResponse":{"type":"object","required":["status","timestamp"],"properties":{"status":{"type":"string"},"timestamp":{"type":"integer","format":"int64","minimum":0}}},"ServerChannelsResponse":{"type":"object","required":["offset","limit","total_extended","total_standard","extended_channels","standard_channels"],"properties":{"extended_channels":{"type":"array","items":{"$ref":"#/components/schemas/ServerExtendedChannelInfo"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"standard_channels":{"type":"array","items":{"$ref":"#/components/schemas/ServerStandardChannelInfo"}},"total_extended":{"type":"integer","minimum":0},"total_standard":{"type":"integer","minimum":0}}},"ServerExtendedChannelInfo":{"type":"object","description":"Information about an extended channel opened with the server","required":["channel_id","user_identity","target_hex","extranonce_prefix_hex","full_extranonce_size","rollable_extranonce_size","version_rolling","shares_acknowledged","shares_submitted","shares_rejected","shares_rejected_by_reason","share_work_sum","best_diff","blocks_found"],"properties":{"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"extranonce_prefix_hex":{"type":"string"},"full_extranonce_size":{"type":"integer","minimum":0},"nominal_hashrate":{"type":["number","null"],"format":"float","description":"None when vardiff is disabled and hashrate cannot be reliably tracked"},"rollable_extranonce_size":{"type":"integer","format":"int32","minimum":0},"share_work_sum":{"type":"number","format":"double"},"shares_acknowledged":{"type":"integer","format":"int32","minimum":0},"shares_rejected":{"type":"integer","format":"int32","minimum":0},"shares_rejected_by_reason":{"type":"object","additionalProperties":{"type":"integer","format":"int32","minimum":0},"propertyNames":{"type":"string"}},"shares_submitted":{"type":"integer","format":"int32","minimum":0},"target_hex":{"type":"string"},"user_identity":{"type":"string"},"version_rolling":{"type":"boolean"}}},"ServerResponse":{"type":"object","required":["extended_channels_count","standard_channels_count","total_hashrate"],"properties":{"extended_channels_count":{"type":"integer","minimum":0},"standard_channels_count":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"ServerStandardChannelInfo":{"type":"object","description":"Information about a standard channel opened with the server","required":["channel_id","user_identity","target_hex","extranonce_prefix_hex","shares_acknowledged","shares_submitted","shares_rejected","shares_rejected_by_reason","share_work_sum","best_diff","blocks_found"],"properties":{"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"extranonce_prefix_hex":{"type":"string"},"nominal_hashrate":{"type":["number","null"],"format":"float","description":"None when vardiff is disabled and hashrate cannot be reliably tracked"},"share_work_sum":{"type":"number","format":"double"},"shares_acknowledged":{"type":"integer","format":"int32","minimum":0},"shares_rejected":{"type":"integer","format":"int32","minimum":0},"shares_rejected_by_reason":{"type":"object","additionalProperties":{"type":"integer","format":"int32","minimum":0},"propertyNames":{"type":"string"}},"shares_submitted":{"type":"integer","format":"int32","minimum":0},"target_hex":{"type":"string"},"user_identity":{"type":"string"}}},"ServerSummary":{"type":"object","description":"Aggregate information about the server connection","required":["total_channels","extended_channels","standard_channels","total_hashrate"],"properties":{"extended_channels":{"type":"integer","minimum":0},"standard_channels":{"type":"integer","minimum":0},"total_channels":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"StandardChannelInfo":{"type":"object","description":"Information about a standard channel","required":["channel_id","user_identity","nominal_hashrate","stable_hashrate","target_hex","requested_max_target_hex","extranonce_prefix_hex","expected_shares_per_minute","shares_accepted","share_work_sum","last_share_sequence_number","best_diff","last_batch_accepted","last_batch_work_sum","share_batch_size","blocks_found"],"properties":{"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"expected_shares_per_minute":{"type":"number","format":"float"},"extranonce_prefix_hex":{"type":"string"},"last_batch_accepted":{"type":"integer","format":"int32","minimum":0},"last_batch_work_sum":{"type":"number","format":"double"},"last_share_sequence_number":{"type":"integer","format":"int32","minimum":0},"nominal_hashrate":{"type":"number","format":"float"},"requested_max_target_hex":{"type":"string"},"share_batch_size":{"type":"integer","minimum":0},"share_work_sum":{"type":"number","format":"double"},"shares_accepted":{"type":"integer","format":"int32","minimum":0},"stable_hashrate":{"type":"boolean"},"target_hex":{"type":"string"},"user_identity":{"type":"string"}}},"Sv1ClientInfo":{"type":"object","description":"Information about a single SV1 client connection","required":["client_id","authorized_worker_name","user_identity","target_hex","stable_hashrate","extranonce1_hex","extranonce2_len"],"properties":{"authorized_worker_name":{"type":"string"},"channel_id":{"type":["integer","null"],"format":"int32","minimum":0},"client_id":{"type":"integer","minimum":0},"extranonce1_hex":{"type":"string"},"extranonce2_len":{"type":"integer","minimum":0},"hashrate":{"type":["number","null"],"format":"float"},"stable_hashrate":{"type":"boolean"},"target_hex":{"type":"string"},"user_identity":{"type":"string"},"version_rolling_mask":{"type":["string","null"]},"version_rolling_min_bit":{"type":["string","null"]}}},"Sv1ClientsResponse":{"type":"object","required":["offset","limit","total","items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Sv1ClientInfo"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0}}},"Sv1ClientsSummary":{"type":"object","description":"Aggregate information about SV1 client connections","required":["total_clients","total_hashrate"],"properties":{"total_clients":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"Sv2ClientChannelsResponse":{"type":"object","required":["client_id","offset","limit","total_extended","total_standard","extended_channels","standard_channels"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels":{"type":"array","items":{"$ref":"#/components/schemas/ExtendedChannelInfo"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"standard_channels":{"type":"array","items":{"$ref":"#/components/schemas/StandardChannelInfo"}},"total_extended":{"type":"integer","minimum":0},"total_standard":{"type":"integer","minimum":0}}},"Sv2ClientInfo":{"type":"object","description":"Full information about a single Sv2 client including all channels","required":["client_id","extended_channels","standard_channels"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels":{"type":"array","items":{"$ref":"#/components/schemas/ExtendedChannelInfo"}},"standard_channels":{"type":"array","items":{"$ref":"#/components/schemas/StandardChannelInfo"}}}},"Sv2ClientMetadata":{"type":"object","description":"Sv2 client metadata without channel arrays (for listings)","required":["client_id","extended_channels_count","standard_channels_count","total_hashrate"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels_count":{"type":"integer","minimum":0},"standard_channels_count":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"Sv2ClientResponse":{"type":"object","required":["client_id","extended_channels_count","standard_channels_count","total_hashrate"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels_count":{"type":"integer","minimum":0},"standard_channels_count":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"Sv2ClientsResponse":{"type":"object","required":["offset","limit","total","items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Sv2ClientMetadata"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0}}},"Sv2ClientsSummary":{"type":"object","description":"Aggregate information about all Sv2 clients","required":["total_clients","total_channels","extended_channels","standard_channels","total_hashrate"],"properties":{"extended_channels":{"type":"integer","minimum":0},"standard_channels":{"type":"integer","minimum":0},"total_channels":{"type":"integer","minimum":0},"total_clients":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}}}},"tags":[{"name":"health","description":"Health check endpoints"},{"name":"global","description":"Global statistics"},{"name":"server","description":"Server (upstream) monitoring"},{"name":"clients","description":"Clients (downstream) monitoring"},{"name":"sv1","description":"Sv1 clients monitoring (Translator Proxy only)"}]} +{"openapi":"3.1.0","info":{"title":"SRI Monitoring API","description":"HTTP JSON API for monitoring SV2 applications","contact":{"name":"The Stratum V2 Developers"},"license":{"name":"MIT OR Apache-2.0","identifier":"MIT OR Apache-2.0"},"version":"0.1.0"},"paths":{"/api/v1/clients":{"get":{"tags":["clients"],"summary":"Get all Sv2 clients (downstream) - returns metadata only, use /clients/{id}/channels for\nchannels","operationId":"handle_clients","parameters":[{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"List of Sv2 clients (metadata only)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv2ClientsResponse"}}}},"404":{"description":"Sv2 clients monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/clients/{client_id}":{"get":{"tags":["clients"],"summary":"Get a single Sv2 client by ID - returns metadata only, use /clients/{id}/channels for channels","operationId":"handle_client_by_id","parameters":[{"name":"client_id","in":"path","description":"Sv2 Client ID","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Sv2 client metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv2ClientResponse"}}}},"404":{"description":"Sv2 client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/clients/{client_id}/channels":{"get":{"tags":["clients"],"summary":"Get channels for a specific Sv2 client (paginated)","operationId":"handle_client_channels","parameters":[{"name":"client_id","in":"path","description":"Sv2 Client ID","required":true,"schema":{"type":"integer","minimum":0}},{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"Sv2 client channels (paginated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv2ClientChannelsResponse"}}}},"404":{"description":"Sv2 client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/global":{"get":{"tags":["global"],"summary":"Get global statistics","description":"Returns aggregated statistics for the server (upstream) and clients (downstream).\nFields are omitted from the response if that type of monitoring is not enabled.\n\n**Typical responses:**\n- **Pool/JDC**: `server` + `clients` (Sv2 downstream)\n- **tProxy**: `server` + `sv1_clients` (Sv1 miners)","operationId":"handle_global","responses":{"200":{"description":"Global statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalInfo"}}}}}}},"/api/v1/health":{"get":{"tags":["health"],"summary":"Health check endpoint","operationId":"handle_health","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/server":{"get":{"tags":["server"],"summary":"Get server (upstream) metadata - use /server/channels for channel details","operationId":"handle_server","responses":{"200":{"description":"Server metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerResponse"}}}},"404":{"description":"Server monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/server/channels":{"get":{"tags":["server"],"summary":"Get server channels (paginated)","operationId":"handle_server_channels","parameters":[{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"Server channels (paginated)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerChannelsResponse"}}}},"404":{"description":"Server monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/sv1/clients":{"get":{"tags":["sv1"],"summary":"Get Sv1 clients (Translator Proxy only)","operationId":"handle_sv1_clients","parameters":[{"name":"offset","in":"query","description":"Offset for pagination (default: 0)","required":false,"schema":{"type":"integer","minimum":0}},{"name":"limit","in":"query","description":"Limit for pagination (default: 25, max: 100)","required":false,"schema":{"type":["integer","null"],"minimum":0}}],"responses":{"200":{"description":"List of Sv1 clients","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv1ClientsResponse"}}}},"404":{"description":"Sv1 monitoring not available","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/sv1/clients/{client_id}":{"get":{"tags":["sv1"],"summary":"Get a single Sv1 client by ID","operationId":"handle_sv1_client_by_id","parameters":[{"name":"client_id","in":"path","description":"Sv1 client ID","required":true,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Sv1 client details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Sv1ClientInfo"}}}},"404":{"description":"Sv1 client not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"ExtendedChannelInfo":{"type":"object","description":"Information about an extended channel","required":["channel_id","user_identity","nominal_hashrate","stable_hashrate","target_hex","requested_max_target_hex","extranonce_prefix_hex","full_extranonce_size","rollable_extranonce_size","expected_shares_per_minute","shares_accepted","share_work_sum","last_share_sequence_number","best_diff","last_batch_accepted","last_batch_work_sum","share_batch_size","blocks_found"],"properties":{"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"expected_shares_per_minute":{"type":"number","format":"float"},"extranonce_prefix_hex":{"type":"string"},"full_extranonce_size":{"type":"integer","minimum":0},"last_batch_accepted":{"type":"integer","format":"int32","minimum":0},"last_batch_work_sum":{"type":"integer","format":"int64","minimum":0},"last_share_sequence_number":{"type":"integer","format":"int32","minimum":0},"nominal_hashrate":{"type":"number","format":"float"},"requested_max_target_hex":{"type":"string"},"rollable_extranonce_size":{"type":"integer","format":"int32","minimum":0},"share_batch_size":{"type":"integer","minimum":0},"share_work_sum":{"type":"number","format":"double"},"shares_accepted":{"type":"integer","format":"int32","minimum":0},"stable_hashrate":{"type":"boolean"},"target_hex":{"type":"string"},"user_identity":{"type":"string"}}},"GlobalInfo":{"type":"object","description":"Global statistics from `/api/v1/global` endpoint\n\nFields are `Option` to distinguish \"not monitored\" (`None`) from \"monitored but empty\" (`Some`\nwith zeros).\n\nTypical configurations:\n- **Pool/JDC**: `server` and `sv2_clients` are `Some`, `sv1_clients` is `None`\n- **tProxy**: `server` and `sv1_clients` are `Some`, `sv2_clients` is `None`","required":["uptime_secs"],"properties":{"server":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ServerSummary","description":"Server (upstream) summary - `None` if server monitoring is not enabled"}]},"sv1_clients":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Sv1ClientsSummary","description":"Sv1 clients summary - `None` if Sv1 monitoring is not enabled (e.g., Pool/JDC)"}]},"sv2_clients":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/Sv2ClientsSummary","description":"Sv2 clients (downstream) summary - `None` if Sv2 client monitoring is not enabled (e.g.,\ntProxy)"}]},"uptime_secs":{"type":"integer","format":"int64","description":"Uptime in seconds since the application started","minimum":0}}},"HealthResponse":{"type":"object","required":["status","timestamp"],"properties":{"status":{"type":"string"},"timestamp":{"type":"integer","format":"int64","minimum":0}}},"ServerChannelsResponse":{"type":"object","required":["offset","limit","total_extended","total_standard","extended_channels","standard_channels"],"properties":{"extended_channels":{"type":"array","items":{"$ref":"#/components/schemas/ServerExtendedChannelInfo"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"standard_channels":{"type":"array","items":{"$ref":"#/components/schemas/ServerStandardChannelInfo"}},"total_extended":{"type":"integer","minimum":0},"total_standard":{"type":"integer","minimum":0}}},"ServerExtendedChannelInfo":{"type":"object","description":"Information about an extended channel opened with the server","required":["channel_id","user_identity","target_hex","extranonce_prefix_hex","full_extranonce_size","rollable_extranonce_size","version_rolling","shares_acknowledged","shares_submitted","shares_rejected","shares_rejected_by_reason","acknowledged_work_sum","validated_work_sum","best_diff","blocks_found"],"properties":{"acknowledged_work_sum":{"type":"integer","format":"int64","description":"Work acknowledged by upstream via `SubmitSharesSuccess.new_shares_sum`.","minimum":0},"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"extranonce_prefix_hex":{"type":"string"},"full_extranonce_size":{"type":"integer","minimum":0},"nominal_hashrate":{"type":["number","null"],"format":"float","description":"None when vardiff is disabled and hashrate cannot be reliably tracked"},"rollable_extranonce_size":{"type":"integer","format":"int32","minimum":0},"shares_acknowledged":{"type":"integer","format":"int32","minimum":0},"shares_rejected":{"type":"integer","format":"int32","minimum":0},"shares_rejected_by_reason":{"type":"object","additionalProperties":{"type":"integer","format":"int32","minimum":0},"propertyNames":{"type":"string"}},"shares_submitted":{"type":"integer","format":"int32","minimum":0},"target_hex":{"type":"string"},"user_identity":{"type":"string"},"validated_work_sum":{"type":"number","format":"double","description":"Work locally validated by the client channel."},"version_rolling":{"type":"boolean"}}},"ServerResponse":{"type":"object","required":["extended_channels_count","standard_channels_count","total_hashrate"],"properties":{"extended_channels_count":{"type":"integer","minimum":0},"standard_channels_count":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"ServerStandardChannelInfo":{"type":"object","description":"Information about a standard channel opened with the server","required":["channel_id","user_identity","target_hex","extranonce_prefix_hex","shares_acknowledged","shares_submitted","shares_rejected","shares_rejected_by_reason","acknowledged_work_sum","validated_work_sum","best_diff","blocks_found"],"properties":{"acknowledged_work_sum":{"type":"integer","format":"int64","description":"Work acknowledged by upstream via `SubmitSharesSuccess.new_shares_sum`.","minimum":0},"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"extranonce_prefix_hex":{"type":"string"},"nominal_hashrate":{"type":["number","null"],"format":"float","description":"None when vardiff is disabled and hashrate cannot be reliably tracked"},"shares_acknowledged":{"type":"integer","format":"int32","minimum":0},"shares_rejected":{"type":"integer","format":"int32","minimum":0},"shares_rejected_by_reason":{"type":"object","additionalProperties":{"type":"integer","format":"int32","minimum":0},"propertyNames":{"type":"string"}},"shares_submitted":{"type":"integer","format":"int32","minimum":0},"target_hex":{"type":"string"},"user_identity":{"type":"string"},"validated_work_sum":{"type":"number","format":"double","description":"Work locally validated by the client channel."}}},"ServerSummary":{"type":"object","description":"Aggregate information about the server connection","required":["total_channels","extended_channels","standard_channels","total_hashrate"],"properties":{"extended_channels":{"type":"integer","minimum":0},"standard_channels":{"type":"integer","minimum":0},"total_channels":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"StandardChannelInfo":{"type":"object","description":"Information about a standard channel","required":["channel_id","user_identity","nominal_hashrate","stable_hashrate","target_hex","requested_max_target_hex","extranonce_prefix_hex","expected_shares_per_minute","shares_accepted","share_work_sum","last_share_sequence_number","best_diff","last_batch_accepted","last_batch_work_sum","share_batch_size","blocks_found"],"properties":{"best_diff":{"type":"number","format":"double"},"blocks_found":{"type":"integer","format":"int32","minimum":0},"channel_id":{"type":"integer","format":"int32","minimum":0},"expected_shares_per_minute":{"type":"number","format":"float"},"extranonce_prefix_hex":{"type":"string"},"last_batch_accepted":{"type":"integer","format":"int32","minimum":0},"last_batch_work_sum":{"type":"integer","format":"int64","minimum":0},"last_share_sequence_number":{"type":"integer","format":"int32","minimum":0},"nominal_hashrate":{"type":"number","format":"float"},"requested_max_target_hex":{"type":"string"},"share_batch_size":{"type":"integer","minimum":0},"share_work_sum":{"type":"number","format":"double"},"shares_accepted":{"type":"integer","format":"int32","minimum":0},"stable_hashrate":{"type":"boolean"},"target_hex":{"type":"string"},"user_identity":{"type":"string"}}},"Sv1ClientInfo":{"type":"object","description":"Information about a single SV1 client connection","required":["client_id","authorized_worker_name","user_identity","target_hex","stable_hashrate","extranonce1_hex","extranonce2_len"],"properties":{"authorized_worker_name":{"type":"string"},"channel_id":{"type":["integer","null"],"format":"int32","minimum":0},"client_id":{"type":"integer","minimum":0},"extranonce1_hex":{"type":"string"},"extranonce2_len":{"type":"integer","minimum":0},"hashrate":{"type":["number","null"],"format":"float"},"stable_hashrate":{"type":"boolean"},"target_hex":{"type":"string"},"user_identity":{"type":"string"},"version_rolling_mask":{"type":["string","null"]},"version_rolling_min_bit":{"type":["string","null"]}}},"Sv1ClientsResponse":{"type":"object","required":["offset","limit","total","items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Sv1ClientInfo"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0}}},"Sv1ClientsSummary":{"type":"object","description":"Aggregate information about SV1 client connections","required":["total_clients","total_hashrate"],"properties":{"total_clients":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"Sv2ClientChannelsResponse":{"type":"object","required":["client_id","offset","limit","total_extended","total_standard","extended_channels","standard_channels"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels":{"type":"array","items":{"$ref":"#/components/schemas/ExtendedChannelInfo"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"standard_channels":{"type":"array","items":{"$ref":"#/components/schemas/StandardChannelInfo"}},"total_extended":{"type":"integer","minimum":0},"total_standard":{"type":"integer","minimum":0}}},"Sv2ClientInfo":{"type":"object","description":"Full information about a single Sv2 client including all channels","required":["client_id","extended_channels","standard_channels"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels":{"type":"array","items":{"$ref":"#/components/schemas/ExtendedChannelInfo"}},"standard_channels":{"type":"array","items":{"$ref":"#/components/schemas/StandardChannelInfo"}}}},"Sv2ClientMetadata":{"type":"object","description":"Sv2 client metadata without channel arrays (for listings)","required":["client_id","extended_channels_count","standard_channels_count","total_hashrate"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels_count":{"type":"integer","minimum":0},"standard_channels_count":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"Sv2ClientResponse":{"type":"object","required":["client_id","extended_channels_count","standard_channels_count","total_hashrate"],"properties":{"client_id":{"type":"integer","minimum":0},"extended_channels_count":{"type":"integer","minimum":0},"standard_channels_count":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}},"Sv2ClientsResponse":{"type":"object","required":["offset","limit","total","items"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Sv2ClientMetadata"}},"limit":{"type":"integer","minimum":0},"offset":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0}}},"Sv2ClientsSummary":{"type":"object","description":"Aggregate information about all Sv2 clients","required":["total_clients","total_channels","extended_channels","standard_channels","total_hashrate"],"properties":{"extended_channels":{"type":"integer","minimum":0},"standard_channels":{"type":"integer","minimum":0},"total_channels":{"type":"integer","minimum":0},"total_clients":{"type":"integer","minimum":0},"total_hashrate":{"type":"number","format":"float"}}}}},"tags":[{"name":"health","description":"Health check endpoints"},{"name":"global","description":"Global statistics"},{"name":"server","description":"Server (upstream) monitoring"},{"name":"clients","description":"Clients (downstream) monitoring"},{"name":"sv1","description":"Sv1 clients monitoring (Translator Proxy only)"}]} diff --git a/stratum-apps/src/monitoring/server.rs b/stratum-apps/src/monitoring/server.rs index 26a2d32f7..5c19d4384 100644 --- a/stratum-apps/src/monitoring/server.rs +++ b/stratum-apps/src/monitoring/server.rs @@ -23,7 +23,10 @@ pub struct ServerExtendedChannelInfo { pub shares_submitted: u32, pub shares_rejected: u32, pub shares_rejected_by_reason: HashMap, - pub share_work_sum: f64, + /// Work acknowledged by upstream via `SubmitSharesSuccess.new_shares_sum`. + pub acknowledged_work_sum: u64, + /// Work locally validated by the client channel. + pub validated_work_sum: f64, pub best_diff: f64, pub blocks_found: u32, } @@ -41,7 +44,10 @@ pub struct ServerStandardChannelInfo { pub shares_submitted: u32, pub shares_rejected: u32, pub shares_rejected_by_reason: HashMap, - pub share_work_sum: f64, + /// Work acknowledged by upstream via `SubmitSharesSuccess.new_shares_sum`. + pub acknowledged_work_sum: u64, + /// Work locally validated by the client channel. + pub validated_work_sum: f64, pub best_diff: f64, pub blocks_found: u32, } @@ -122,7 +128,8 @@ mod tests { shares_acknowledged: 10, shares_rejected: 0, shares_rejected_by_reason: HashMap::new(), - share_work_sum: 100.0, + acknowledged_work_sum: 100, + validated_work_sum: 100.0, shares_submitted: 12, best_diff: 50.0, blocks_found: 0, @@ -143,7 +150,8 @@ mod tests { shares_submitted: 22, shares_rejected: 1, shares_rejected_by_reason: HashMap::from([("duplicate-share".to_string(), 1)]), - share_work_sum: 200.0, + acknowledged_work_sum: 200, + validated_work_sum: 200.0, best_diff: 80.0, blocks_found: 0, }