From 5b0206a6280c82c6b1be28824f3f5e2d7f7c1813 Mon Sep 17 00:00:00 2001 From: Michael Jeffrey Date: Thu, 17 Oct 2024 12:17:30 -0700 Subject: [PATCH 1/2] Update Service Provider Promotions for updated flow - Remove promotion_reward_v1 messages and reports - Remove promotion_fund_v1 messages and reports - Simplify promotion_reward for NFT usage - Add endpoint to mobile-config for listing all service provider promotions - Add Promotion Reward as MobileRewardShare type - Write service provider promotions in mobile rewards manifest --- src/lib.rs | 2 +- src/reward_manifest.proto | 14 ++++++-- src/service/mobile_config.proto | 17 ++++++++++ src/service/poc_mobile.proto | 59 +++------------------------------ src/service_provider.proto | 14 -------- 5 files changed, 34 insertions(+), 72 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2c1d585b..0984b9e7 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ pub mod services { use crate::{ BlockchainRegionParamsV1, BlockchainTokenTypeV1, BlockchainTxn, BoostedHexInfoV1, DataRate, Decimal, EntropyReportV1, GatewayStakingMode, MapperAttach, Region, RoutingAddress, - ServiceProvider, + ServiceProvider, ServiceProviderPromotions, }; pub mod iot_config { diff --git a/src/reward_manifest.proto b/src/reward_manifest.proto index fdab8cb6..d1386d0e 100644 --- a/src/reward_manifest.proto +++ b/src/reward_manifest.proto @@ -8,14 +8,22 @@ import "service_provider.proto"; message mobile_reward_data { Decimal poc_bones_per_reward_share = 1; Decimal boosted_poc_bones_per_reward_share = 2; - // repeated service_provider_allocation sp_allocations = 3; + repeated service_provider_promotions service_provider_promotions = 3; } -message service_provider_allocation { +message service_provider_promotions { + message promotion { + string entity = 1; + uint64 start_ts = 2; + uint64 end_ts = 3; + uint32 shares = 4; + } + service_provider service_provider = 1; - // The percentage of the SP rewards that are allocated to the incentive fun, + // The percentage of the SP rewards that are allocated to the incentive fund, // in basis points uint32 incentive_escrow_fund_bps = 2; + repeated promotion promotions = 3; } message iot_reward_data { diff --git a/src/service/mobile_config.proto b/src/service/mobile_config.proto index 24ed41eb..e6306ea5 100644 --- a/src/service/mobile_config.proto +++ b/src/service/mobile_config.proto @@ -3,6 +3,8 @@ syntax = "proto3"; package helium.mobile_config; import "hex_boosting.proto"; +import "service_provider.proto"; +import "reward_manifest.proto"; // ------------------------------------------------------------------ // Message Definitions @@ -247,6 +249,19 @@ message boosted_hex_info_stream_res_v1 { bytes signature = 4; } +message carrier_incentive_promotion_list_req_v1 { + // unix epoch timestamp in seconds + uint64 timestamp = 1; + bytes signer = 2; + bytes signature = 3; +} + +message carrier_incentive_promotion_list_res_v1 { + bytes signer = 1; + bytes signature = 2; + repeated service_provider_promotions service_provider_promotions = 3; +} + // ------------------------------------------------------------------ // Service Definitions // ------------------------------------------------------------------ @@ -271,6 +286,8 @@ service carrier_service { // Retrieve an entity key for the specified helium pubkey rpc key_to_entity(carrier_key_to_entity_req_v1) returns (carrier_key_to_entity_res_v1); + rpc list_incentive_promotions(carrier_incentive_promotion_list_req_v1) + returns (carrier_incentive_promotion_list_res_v1); } service authorization { diff --git a/src/service/poc_mobile.proto b/src/service/poc_mobile.proto index 0e95ffb2..ff5b4094 100644 --- a/src/service/poc_mobile.proto +++ b/src/service/poc_mobile.proto @@ -280,48 +280,6 @@ message verified_subscriber_location_ingest_report_v1 { uint64 timestamp = 3; } -message promotion_reward_req_v1 { - // Entity to be rewarded - oneof entity { - // Subscriber reward - bytes subscriber_id = 1; - // Gateway reward - bytes gateway_key = 2; - } - // Shares rewarded to the subscriber - uint64 shares = 3; - // Timestamp in seconds since the unix epoch - uint64 timestamp = 4; - // Pubkey of the carrier for which the entity is attached - bytes carrier_pub_key = 5; - // Signed payload of the request - bytes signature = 6; -} - -message promotion_reward_resp_v1 { string id = 1; } - -message promotion_reward_ingest_report_v1 { - // Timestamp in milliseconds since the unix epoch - uint64 received_timestamp = 1; - promotion_reward_req_v1 report = 2; -} - -enum promotion_reward_status { - promotion_reward_status_valid = 0; - promotion_reward_status_invalid_subscriber_id = 1; - promotion_reward_status_invalid_gateway_key = 2; - promotion_reward_status_invalid_carrier_key = 3; -} - -message verified_promotion_reward_v1 { - promotion_reward_ingest_report_v1 report = 1; - // Status of the report - promotion_reward_status status = 2; - // Timestamp at which verification was determined, in milliseconds since - // the unix epoch - uint64 timestamp = 3; -} - service poc_mobile { rpc submit_speedtest(speedtest_req_v1) returns (speedtest_resp_v1); rpc submit_cell_heartbeat(cell_heartbeat_req_v1) @@ -345,8 +303,6 @@ service poc_mobile { rpc submit_subscriber_verified_mapping_event( subscriber_verified_mapping_event_req_v1) returns (subscriber_verified_mapping_event_res_v1); - rpc submit_promotion_reward(promotion_reward_req_v1) - returns (promotion_reward_resp_v1); } message file_info { @@ -615,17 +571,12 @@ message subscriber_reward { } message promotion_reward { - // Entity given the reward - oneof entity { - // Subscriber reward - bytes subscriber_id = 1; - // Gateway reward - bytes gateway_key = 2; - } + // Name of the promotion NFT + string entity = 1; // Amount in bones given by the service provider - uint64 service_provider_amount = 3; + uint64 service_provider_amount = 2; // Amount in bones matched by the network - uint64 matched_amount = 4; + uint64 matched_amount = 3; } message service_provider_reward { @@ -666,7 +617,7 @@ message mobile_reward_share { service_provider_reward service_provider_reward = 6; unallocated_reward unallocated_reward = 7; radio_reward_v2 radio_reward_v2 = 8; - // promotion_reward promotion_reward = 9; + promotion_reward promotion_reward = 9; } } diff --git a/src/service_provider.proto b/src/service_provider.proto index ebf85e50..313ee295 100644 --- a/src/service_provider.proto +++ b/src/service_provider.proto @@ -5,17 +5,3 @@ package helium; enum service_provider { helium_mobile = 0; } - -message service_provider_promotion_fund_v1 { - /// The timestamp for this report in milliseconds since unix epoch - uint64 timestamp = 1; - - /// Service Provider that is allocating funds for promotions - service_provider service_provider = 2; - - /// Percentage of Rewards allocated for promotions - /// stored in Basis Points - /// - /// https://www.investopedia.com/terms/b/basispoint.asp - uint32 bps = 3; -} From 47d19aa9fe25f5064c260981db79987577dafd71 Mon Sep 17 00:00:00 2001 From: Michael Jeffrey Date: Mon, 28 Oct 2024 14:42:01 -0700 Subject: [PATCH 2/2] Document service provider promotion fields --- src/reward_manifest.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/reward_manifest.proto b/src/reward_manifest.proto index d1386d0e..de04b002 100644 --- a/src/reward_manifest.proto +++ b/src/reward_manifest.proto @@ -13,9 +13,13 @@ message mobile_reward_data { message service_provider_promotions { message promotion { + // Name of the Promotion NFT string entity = 1; + // Unix timestamp in seconds of the start of the promotion uint64 start_ts = 2; + // Unix timestamp in seconds of the end of the promotion uint64 end_ts = 3; + // Shares used when distributing promotion incentive allocation uint32 shares = 4; }