Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verified_subscriber_mapping_event_v1 #409

Merged
merged 22 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
44 changes: 43 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,40 @@ 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;
}
Loading