From 7a9224b5164b98e1c58e62b7c83ebc684fbaa302 Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Tue, 1 Jul 2025 13:29:06 +0300 Subject: [PATCH 1/5] Add carrier_transfer_info --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- file_store/src/usage_counts.rs | 7 +++++-- ingest/tests/common/mod.rs | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6cd64b2fc..23266c81d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3449,7 +3449,7 @@ dependencies = [ [[package]] name = "helium-proto" version = "0.1.0" -source = "git+https://github.com/helium/proto?branch=master#be78e091a37f2707c5ac97d118589beb671e4a91" +source = "git+https://www.github.com/helium/proto.git?branch=data-transfer-carrier#4d579a3aa35ec20c908e49775b36d85f0f33a86d" dependencies = [ "bytes", "prost", diff --git a/Cargo.toml b/Cargo.toml index 98b8de21b..ac77e650b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,5 +132,5 @@ anchor-lang = { git = "https://github.com/madninja/anchor.git", branch = "madnin # helium-proto = { path = "../proto" } # beacon = { path = "../proto/beacon" } -# [patch.'https://github.com/helium/proto'] -# helium-proto = { git = "https://www.github.com/helium/proto.git", branch = "bbalser/deprecate-radio-reward-v1" } +[patch.'https://github.com/helium/proto'] +helium-proto = { git = "https://www.github.com/helium/proto.git", branch = "data-transfer-carrier" } diff --git a/file_store/src/usage_counts.rs b/file_store/src/usage_counts.rs index c96c52db2..89fd77e38 100644 --- a/file_store/src/usage_counts.rs +++ b/file_store/src/usage_counts.rs @@ -9,8 +9,8 @@ use chrono::{DateTime, Utc}; use h3o::CellIndex; use helium_crypto::PublicKeyBinary; use helium_proto::services::poc_mobile::{ - HexUsageStatsIngestReportV1, HexUsageStatsReqV1, RadioUsageStatsIngestReportV1, - RadioUsageStatsReqV1, + HexUsageStatsIngestReportV1, HexUsageStatsReqV1, RadioUsageCarrierTransferInfo, + RadioUsageStatsIngestReportV1, RadioUsageStatsReqV1, }; use serde::{Deserialize, Serialize}; @@ -40,6 +40,7 @@ pub struct RadioUsageStatsReq { pub epoch_end_timestamp: DateTime, pub timestamp: DateTime, pub carrier_mapping_key: PublicKeyBinary, + pub carrier_transfer_info: Vec, } impl MsgDecode for HexUsageStatsReq { @@ -137,6 +138,7 @@ impl TryFrom for RadioUsageStatsReq { epoch_end_timestamp, timestamp, carrier_mapping_key: v.carrier_mapping_key.into(), + carrier_transfer_info: v.carrier_transfer_info, }) } } @@ -159,6 +161,7 @@ impl From for RadioUsageStatsReqV1 { epoch_end_timestamp, timestamp, carrier_mapping_key: v.carrier_mapping_key.into(), + carrier_transfer_info: v.carrier_transfer_info, signature: vec![], } } diff --git a/ingest/tests/common/mod.rs b/ingest/tests/common/mod.rs index d037546a9..a2d5987cb 100644 --- a/ingest/tests/common/mod.rs +++ b/ingest/tests/common/mod.rs @@ -422,6 +422,7 @@ impl TestClient { epoch_end_timestamp: 0, timestamp: 0, carrier_mapping_key: self.key_pair.public_key().to_vec(), + carrier_transfer_info: vec![], signature: vec![], }; From c28b0beca22c9a01d60ce13a6976ac3451fd5054 Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Wed, 2 Jul 2025 17:14:47 +0300 Subject: [PATCH 2/5] Trigger CI --- ingest/tests/common/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ingest/tests/common/mod.rs b/ingest/tests/common/mod.rs index a2d5987cb..d9a75d0d9 100644 --- a/ingest/tests/common/mod.rs +++ b/ingest/tests/common/mod.rs @@ -421,8 +421,8 @@ impl TestClient { epoch_start_timestamp: 0, epoch_end_timestamp: 0, timestamp: 0, - carrier_mapping_key: self.key_pair.public_key().to_vec(), carrier_transfer_info: vec![], + carrier_mapping_key: self.key_pair.public_key().to_vec(), signature: vec![], }; From 2ae000baae5d03f92c96d582dce01fb8a85badf7 Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Thu, 3 Jul 2025 11:10:09 +0300 Subject: [PATCH 3/5] Remove unnecessary grpc message cloning --- ingest/src/server_mobile.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ingest/src/server_mobile.rs b/ingest/src/server_mobile.rs index 81c362c5e..48d8d2b6f 100644 --- a/ingest/src/server_mobile.rs +++ b/ingest/src/server_mobile.rs @@ -524,7 +524,7 @@ where let (verified_pubkey, event) = self .verify_public_key(event.carrier_mapping_key.as_ref()) .and_then(|public_key| self.verify_network(public_key)) - .and_then(|public_key| self.verify_signature(public_key, event.clone()))?; + .and_then(|public_key| self.verify_signature(public_key, event))?; self.verify_known_carrier_key(verified_pubkey).await?; let report = HexUsageStatsIngestReportV1 { @@ -550,7 +550,7 @@ where let (verified_pubkey, event) = self .verify_public_key(event.carrier_mapping_key.as_ref()) .and_then(|public_key| self.verify_network(public_key)) - .and_then(|public_key| self.verify_signature(public_key, event.clone()))?; + .and_then(|public_key| self.verify_signature(public_key, event))?; self.verify_known_carrier_key(verified_pubkey).await?; let report = RadioUsageStatsIngestReportV1 { From 21b3389280f2ff40c92b62982f44187b5641f4c6 Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Thu, 3 Jul 2025 15:51:53 +0300 Subject: [PATCH 4/5] Add carrier_transfer_info to testcase --- ingest/tests/common/mod.rs | 10 ++++++---- ingest/tests/mobile_ingest.rs | 12 +++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ingest/tests/common/mod.rs b/ingest/tests/common/mod.rs index d9a75d0d9..4d1b8cdd4 100644 --- a/ingest/tests/common/mod.rs +++ b/ingest/tests/common/mod.rs @@ -8,9 +8,9 @@ use helium_proto::services::poc_mobile::{ BanIngestReportV1, BanReqV1, BanRespV1, CellHeartbeatReqV1, CellHeartbeatRespV1, DataTransferEvent, DataTransferRadioAccessTechnology, DataTransferSessionIngestReportV1, DataTransferSessionReqV1, DataTransferSessionRespV1, HexUsageStatsIngestReportV1, - HexUsageStatsReqV1, HexUsageStatsResV1, RadioUsageStatsIngestReportV1, RadioUsageStatsReqV1, - RadioUsageStatsResV1, UniqueConnectionsIngestReportV1, UniqueConnectionsReqV1, - UniqueConnectionsRespV1, + HexUsageStatsReqV1, HexUsageStatsResV1, RadioUsageCarrierTransferInfo, + RadioUsageStatsIngestReportV1, RadioUsageStatsReqV1, RadioUsageStatsResV1, + UniqueConnectionsIngestReportV1, UniqueConnectionsReqV1, UniqueConnectionsRespV1, }; use helium_proto::services::{ mobile_config::NetworkKeyRole, @@ -401,6 +401,7 @@ impl TestClient { Ok(res.into_inner()) } + #[allow(clippy::too_many_arguments)] pub async fn submit_radio_usage_req( &mut self, hotspot_pubkey: PublicKeyBinary, @@ -409,6 +410,7 @@ impl TestClient { offload_user_count: u64, service_provider_transfer_bytes: u64, offload_transfer_bytes: u64, + carrier_transfer_info: Vec, ) -> anyhow::Result { let mut req = RadioUsageStatsReqV1 { hotspot_pubkey: hotspot_pubkey.into(), @@ -421,7 +423,7 @@ impl TestClient { epoch_start_timestamp: 0, epoch_end_timestamp: 0, timestamp: 0, - carrier_transfer_info: vec![], + carrier_transfer_info, carrier_mapping_key: self.key_pair.public_key().to_vec(), signature: vec![], }; diff --git a/ingest/tests/mobile_ingest.rs b/ingest/tests/mobile_ingest.rs index 958534428..fbfd24f31 100644 --- a/ingest/tests/mobile_ingest.rs +++ b/ingest/tests/mobile_ingest.rs @@ -1,7 +1,9 @@ use chrono::{TimeZone, Utc}; use common::generate_keypair; use helium_crypto::PublicKeyBinary; -use helium_proto::services::poc_mobile::DataTransferRadioAccessTechnology; +use helium_proto::services::poc_mobile::{ + DataTransferRadioAccessTechnology, RadioUsageCarrierTransferInfo, +}; use std::str::FromStr; mod common; @@ -153,6 +155,11 @@ async fn submit_radio_usage_report() -> anyhow::Result<()> { const OFFLOAD_USER_COUNT: u64 = 12; const SERVICE_PROVIDER_TRANSFER_BYTES: u64 = 13; const OFFLOAD_TRANSFER_BYTES: u64 = 14; + let radio_usage_carrier_info = RadioUsageCarrierTransferInfo { + carrier_id: 1, + transfer_bytes: OFFLOAD_TRANSFER_BYTES, + user_count: 2, + }; let res = client .submit_radio_usage_req( @@ -162,6 +169,7 @@ async fn submit_radio_usage_report() -> anyhow::Result<()> { OFFLOAD_USER_COUNT, SERVICE_PROVIDER_TRANSFER_BYTES, OFFLOAD_TRANSFER_BYTES, + vec![radio_usage_carrier_info.clone()], ) .await; @@ -188,6 +196,8 @@ async fn submit_radio_usage_report() -> anyhow::Result<()> { event.service_provider_transfer_bytes ); assert_eq!(OFFLOAD_TRANSFER_BYTES, event.offload_transfer_bytes); + assert_eq!(OFFLOAD_TRANSFER_BYTES, event.offload_transfer_bytes); + assert_eq!(vec![radio_usage_carrier_info], event.carrier_transfer_info); } } } From dc4a8e432a3ddc46b89f8e5f33722683f60a27cb Mon Sep 17 00:00:00 2001 From: Anatolii Kurotych Date: Tue, 8 Jul 2025 13:15:06 +0300 Subject: [PATCH 5/5] Update helium-proto --- Cargo.lock | 18 +++++++++--------- Cargo.toml | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 23266c81d..9e61e5d5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1430,17 +1430,17 @@ checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" [[package]] name = "beacon" version = "0.1.0" -source = "git+https://github.com/helium/proto?branch=master#be78e091a37f2707c5ac97d118589beb671e4a91" +source = "git+https://github.com/helium/proto?branch=master#2ebbdb1772ffed9fcde2b6a7de5aa7b2afeca1a6" dependencies = [ "base64 0.22.1", "byteorder", "helium-proto", "prost", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand 0.7.3", + "rand_chacha 0.2.2", "rust_decimal", "serde", - "sha2 0.9.9", + "sha2 0.10.9", "thiserror 1.0.69", ] @@ -3449,7 +3449,7 @@ dependencies = [ [[package]] name = "helium-proto" version = "0.1.0" -source = "git+https://www.github.com/helium/proto.git?branch=data-transfer-carrier#4d579a3aa35ec20c908e49775b36d85f0f33a86d" +source = "git+https://github.com/helium/proto?branch=master#2ebbdb1772ffed9fcde2b6a7de5aa7b2afeca1a6" dependencies = [ "bytes", "prost", @@ -5866,7 +5866,7 @@ checksum = "22505a5c94da8e3b7c2996394d1c933236c4d743e81a410bcca4e6989fc066a4" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.10.5", + "itertools 0.12.1", "log", "multimap", "once_cell", @@ -5886,7 +5886,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" dependencies = [ "anyhow", - "itertools 0.10.5", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.101", @@ -10807,7 +10807,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if", - "rand 0.8.5", + "rand 0.7.3", "static_assertions", ] @@ -11699,7 +11699,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "sha2 0.9.9", + "sha2 0.10.9", "thiserror 1.0.69", "twox-hash", "xorf", diff --git a/Cargo.toml b/Cargo.toml index ac77e650b..98b8de21b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,5 +132,5 @@ anchor-lang = { git = "https://github.com/madninja/anchor.git", branch = "madnin # helium-proto = { path = "../proto" } # beacon = { path = "../proto/beacon" } -[patch.'https://github.com/helium/proto'] -helium-proto = { git = "https://www.github.com/helium/proto.git", branch = "data-transfer-carrier" } +# [patch.'https://github.com/helium/proto'] +# helium-proto = { git = "https://www.github.com/helium/proto.git", branch = "bbalser/deprecate-radio-reward-v1" }