Skip to content

Commit

Permalink
Merge pull request #539 from helium/andymck/subscriber-id-in-dataevent
Browse files Browse the repository at this point in the history
support subscriber id in data events
  • Loading branch information
jeffgrunewald authored Jun 12, 2023
2 parents 99d3567 + 6add2bb commit b7a11c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions file_store/src/mobile_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pub struct DataTransferEvent {
pub download_bytes: u64,
pub radio_access_technology: DataTransferRadioAccessTechnology,
pub event_id: String,
pub subscriber_id: Vec<u8>,
pub payer: PublicKeyBinary,
pub timestamp: DateTime<Utc>,
pub signature: Vec<u8>,
Expand All @@ -73,6 +74,7 @@ impl TryFrom<DataTransferEventProto> for DataTransferEvent {
upload_bytes: v.upload_bytes,
download_bytes: v.download_bytes,
radio_access_technology,
subscriber_id: v.subscriber_id,
event_id: v.event_id,
payer: v.payer.into(),
timestamp,
Expand Down
2 changes: 2 additions & 0 deletions file_store/src/mobile_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct ValidDataTransferSession {
pub payer: PublicKeyBinary,
pub upload_bytes: u64,
pub download_bytes: u64,
pub subscriber_id: Option<Vec<u8>>,
pub num_dcs: u64,
pub first_timestamp: DateTime<Utc>,
pub last_timestamp: DateTime<Utc>,
Expand All @@ -28,6 +29,7 @@ impl TryFrom<proto::ValidDataTransferSession> for ValidDataTransferSession {
fn try_from(v: proto::ValidDataTransferSession) -> Result<Self> {
Ok(Self {
payer: v.payer.into(),
subscriber_id: (!v.subscriber_id.is_empty()).then_some(v.subscriber_id),
pub_key: v.pub_key.into(),
upload_bytes: v.upload_bytes,
download_bytes: v.download_bytes,
Expand Down
1 change: 1 addition & 0 deletions mobile_packet_verifier/src/burner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ where
payer: session.payer.into(),
upload_bytes: session.uploaded_bytes as u64,
download_bytes: session.downloaded_bytes as u64,
subscriber_id: vec![],
num_dcs,
first_timestamp: session.first_timestamp.encode_timestamp_millis(),
last_timestamp: session.last_timestamp.encode_timestamp_millis(),
Expand Down
2 changes: 2 additions & 0 deletions mobile_verifier/src/reward_shares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ mod test {
payer,
upload_bytes: 0, // Unused
download_bytes: 0, // Unused
subscriber_id: None,
num_dcs: 2,
first_timestamp: DateTime::default(),
last_timestamp: DateTime::default(),
Expand Down Expand Up @@ -350,6 +351,7 @@ mod test {
payer: payer.clone(),
upload_bytes: 0,
download_bytes: 0,
subscriber_id: None,
num_dcs: 4444444444444445,
first_timestamp: DateTime::default(),
last_timestamp: DateTime::default(),
Expand Down

0 comments on commit b7a11c8

Please sign in to comment.