diff --git a/Cargo.lock b/Cargo.lock index 6cd64b2fc..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://github.com/helium/proto?branch=master#be78e091a37f2707c5ac97d118589beb671e4a91" +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/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/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 { diff --git a/ingest/tests/common/mod.rs b/ingest/tests/common/mod.rs index d037546a9..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,6 +423,7 @@ impl TestClient { epoch_start_timestamp: 0, epoch_end_timestamp: 0, timestamp: 0, + 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); } } }