Skip to content

Commit

Permalink
Merge pull request #409 from helium/macpie/verification_mapping
Browse files Browse the repository at this point in the history
Add verified_subscriber_mapping_event_v1
  • Loading branch information
jeffgrunewald authored Aug 13, 2024
2 parents fdef2c6 + 12434d1 commit 2916bcd
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ macro_rules! serde_enum {
where
S: serde::ser::Serializer,
{
let v = $type::from_i32(*v)
.ok_or_else(|| serde::ser::Error::custom(format!("invalid enum value: {v}")))?;
let v = $type::try_from(*v)
.map_err(|_| serde::ser::Error::custom(format!("invalid enum value: {v}")))?;
serializer.serialize_str(&v.to_string())
}

Expand Down
45 changes: 44 additions & 1 deletion src/service/poc_mobile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ service poc_mobile {
rpc submit_sp_boosted_rewards_banned_radio(
service_provider_boosted_rewards_banned_radio_req_v1)
returns (service_provider_boosted_rewards_banned_radio_resp_v1);
rpc submit_subscriber_verified_mapping_event(
subscriber_verified_mapping_event_req_v1)
returns (subscriber_verified_mapping_event_res_v1);
}

message file_info {
Expand Down Expand Up @@ -552,10 +555,12 @@ message gateway_reward {
}

message subscriber_reward {
// id of the subscriber to which the reward will be credited
/// id of the subscriber to which the reward will be credited
bytes subscriber_id = 1;
/// Amount in bones credited to the subscriber for location sharing
uint64 discovery_location_amount = 2;
/// Amount in bones credited to the subscriber for verification mapping
uint64 verification_mapping_amount = 3;
}

message service_provider_reward {
Expand Down Expand Up @@ -756,3 +761,41 @@ verified_service_provider_boosted_rewards_banned_radio_ingest_report_v1 {
// epoch
uint64 timestamp = 3;
}

message subscriber_verified_mapping_event_req_v1 {
/// The id of the discovery mapping enabled subscriber
bytes subscriber_id = 1;
/// The accumulated mapping points the subscriber has earned this epoch
uint64 total_reward_points = 2;
/// Unix timestamp in milliseconds of when the mapping reward event was
/// generated
uint64 timestamp = 3;
/// Pubkey of verification mapping event service
bytes carrier_mapping_key = 4;
/// Signed payload of the verification mapping event service
bytes signature = 5;
}

message subscriber_verified_mapping_event_res_v1 { string id = 1; }

message subscriber_verified_mapping_event_ingest_report_v1 {
// Timestamp in milliseconds since unix epoch
uint64 received_timestamp = 1;
// the verified report
subscriber_verified_mapping_event_req_v1 report = 2;
}

enum subscriber_verified_mapping_event_verification_status {
svme_valid = 0;
svme_invalid_subscriber_id = 1;
svme_invalid_carrier_key = 2;
}

message verified_subscriber_verified_mapping_event_ingest_report_v1 {
// the verified report
subscriber_verified_mapping_event_ingest_report_v1 report = 1;
// the status determined by the verification
subscriber_verified_mapping_event_verification_status status = 2;
// Timestamp in milliseconds since unix epoch
uint64 timestamp = 3;
}

0 comments on commit 2916bcd

Please sign in to comment.