From f9620576b7a7481735cfd80e76c19da79eb6a02e Mon Sep 17 00:00:00 2001 From: Andrew McKenzie Date: Wed, 13 Nov 2024 11:11:58 +0000 Subject: [PATCH 1/4] add subdao epoch info related msg support --- build.rs | 1 + src/lib.rs | 6 +++++ src/reward_manifest.proto | 4 +++ src/service/mobile_config.proto | 1 - src/service/poc_lora.proto | 2 ++ src/service/poc_mobile.proto | 3 ++- src/service/sub_dao.proto | 45 +++++++++++++++++++++++++++++++++ 7 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/service/sub_dao.proto diff --git a/build.rs b/build.rs index b5c2cda4..c55f956b 100644 --- a/build.rs +++ b/build.rs @@ -16,6 +16,7 @@ const SERVICES: &[&str] = &[ "src/service/downlink.proto", "src/service/multi_buy.proto", "src/service/packet_verifier.proto", + "src/service/sub_dao.proto", ]; const MESSAGES: &[&str] = &[ diff --git a/src/lib.rs b/src/lib.rs index 0984b9e7..6c512944 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,6 +15,12 @@ pub mod services { ServiceProvider, ServiceProviderPromotions, }; + pub mod sub_dao { + include!(concat!(env!("OUT_DIR"), "/helium.sub_dao.rs")); + pub use sub_dao_client::SubDaoClient; + pub use sub_dao_server::{SubDao, SubDaoServer}; + } + pub mod iot_config { include!(concat!(env!("OUT_DIR"), "/helium.iot_config.rs")); pub use admin_client as config_admin_client; diff --git a/src/reward_manifest.proto b/src/reward_manifest.proto index de04b002..2f56a821 100644 --- a/src/reward_manifest.proto +++ b/src/reward_manifest.proto @@ -46,4 +46,8 @@ message reward_manifest { mobile_reward_data mobile_reward_data = 4; iot_reward_data iot_reward_data = 5; } + // the epoch of the reward share + uint64 epoch = 6; + /// Price of HNT @ 10^8 used when calculating the rewards + uint64 price = 7; } diff --git a/src/service/mobile_config.proto b/src/service/mobile_config.proto index 865c2376..d6821e11 100644 --- a/src/service/mobile_config.proto +++ b/src/service/mobile_config.proto @@ -5,7 +5,6 @@ package helium.mobile_config; import "hex_boosting.proto"; import "service_provider.proto"; import "reward_manifest.proto"; - // ------------------------------------------------------------------ // Message Definitions // ------------------------------------------------------------------ diff --git a/src/service/poc_lora.proto b/src/service/poc_lora.proto index 384a720e..44426060 100644 --- a/src/service/poc_lora.proto +++ b/src/service/poc_lora.proto @@ -266,6 +266,8 @@ message iot_reward_share { operational_reward operational_reward = 4; unallocated_reward unallocated_reward = 5; } + // the onchain epoch of the reward share + uint64 epoch = 6; } message lora_stream_session_offer_v1 { bytes nonce = 1; } diff --git a/src/service/poc_mobile.proto b/src/service/poc_mobile.proto index 7fc27a85..6b1d29aa 100644 --- a/src/service/poc_mobile.proto +++ b/src/service/poc_mobile.proto @@ -697,7 +697,8 @@ message gateway_reward { uint64 dc_transfer_reward = 2; /// count of rewardable bytes transfered uint64 rewardable_bytes = 3; - /// Price of MOBILE @ 10^6 used when calculating rewards + /// Price of HNT @ 10^8 used when calculating rewards + // todo: deprecate this ? replaced with price in manifest uint64 price = 4; } diff --git a/src/service/sub_dao.proto b/src/service/sub_dao.proto new file mode 100644 index 00000000..a6754a5d --- /dev/null +++ b/src/service/sub_dao.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package helium.sub_dao; + +message sub_dao_epoch_reward_info { + // The epoch of the reward info + uint64 epoch = 1; + // The on-chain identity of the epoch + string epoch_address = 2; + // The on-chain identity of the subdao + string sub_dao_address = 3; + // The total HNT rewards emitted for the sub dao and epoch minus the + // delegation rewards + uint64 rewards_issued = 4; + // The total HNT delegation rewards emitted for the sub dao and epoch + uint64 delegation_rewards_issued = 5; + // timestamp in seconds when the rewards were issued + uint64 rewards_issued_at = 6; +} + +message sub_dao_epoch_reward_info_req_v1 { + // The on-chain identity of the subdao to lookup + string sub_dao_address = 1; + // The epoch for the specified subdao to look up + uint64 epoch = 2; + // pubkey binary of the signing keypair + bytes signer = 3; + bytes signature = 4; +} + +message sub_dao_epoch_reward_info_res_v1 { + // The reward info for the specified subdao & epoch + sub_dao_epoch_reward_info info = 1; + // unix epoch timestamp in seconds + uint64 timestamp = 2; + // pubkey binary of the signing keypair + bytes signer = 3; + bytes signature = 4; +} + +service sub_dao { + // Get reward info for the specified subdao & epoch + rpc info(sub_dao_epoch_reward_info_req_v1) + returns (sub_dao_epoch_reward_info_res_v1); +} From e981c98bb3666caf885776fb035f8b6f6fbfefe2 Mon Sep 17 00:00:00 2001 From: Andrew McKenzie Date: Fri, 6 Dec 2024 14:40:47 +0000 Subject: [PATCH 2/4] remove epoch --- src/service/poc_lora.proto | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/service/poc_lora.proto b/src/service/poc_lora.proto index 44426060..384a720e 100644 --- a/src/service/poc_lora.proto +++ b/src/service/poc_lora.proto @@ -266,8 +266,6 @@ message iot_reward_share { operational_reward operational_reward = 4; unallocated_reward unallocated_reward = 5; } - // the onchain epoch of the reward share - uint64 epoch = 6; } message lora_stream_session_offer_v1 { bytes nonce = 1; } From d63af39f95c55e589dcf5fe028f9b958e691f6a4 Mon Sep 17 00:00:00 2001 From: Andrew McKenzie Date: Mon, 16 Dec 2024 14:01:35 +0000 Subject: [PATCH 3/4] rename to match contract --- src/service/sub_dao.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/sub_dao.proto b/src/service/sub_dao.proto index a6754a5d..63beadb3 100644 --- a/src/service/sub_dao.proto +++ b/src/service/sub_dao.proto @@ -11,7 +11,7 @@ message sub_dao_epoch_reward_info { string sub_dao_address = 3; // The total HNT rewards emitted for the sub dao and epoch minus the // delegation rewards - uint64 rewards_issued = 4; + uint64 hnt_rewards_issued = 4; // The total HNT delegation rewards emitted for the sub dao and epoch uint64 delegation_rewards_issued = 5; // timestamp in seconds when the rewards were issued From f7b68c095f86afdf904f6a38db8af03af99c9a86 Mon Sep 17 00:00:00 2001 From: Michael Jeffrey Date: Fri, 3 Jan 2025 11:43:19 -0700 Subject: [PATCH 4/4] Add rewarded token type enum to {subdao}_reward_data in reward manifest Two enum are needed so the default value for each reward_data type can be the corresponding subdao token for historical files that do not have these fields. Ref: HIP-138 https://github.com/helium/HIP/blob/main/0138-return-to-hnt.md Rewards will no longer be output in subdao tokens, only HNT. --- src/reward_manifest.proto | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/reward_manifest.proto b/src/reward_manifest.proto index 2f56a821..c093496b 100644 --- a/src/reward_manifest.proto +++ b/src/reward_manifest.proto @@ -5,10 +5,17 @@ package helium; import "decimal.proto"; import "service_provider.proto"; +enum mobile_reward_token { + mobile_reward_token_mobile = 0; + mobile_reward_token_hnt = 1; +} + message mobile_reward_data { Decimal poc_bones_per_reward_share = 1; Decimal boosted_poc_bones_per_reward_share = 2; repeated service_provider_promotions service_provider_promotions = 3; + // HIP-138: Reward output was changed from Subdao Tokens to HNT + mobile_reward_token token = 4; } message service_provider_promotions { @@ -30,10 +37,17 @@ message service_provider_promotions { repeated promotion promotions = 3; } +enum iot_reward_token { + iot_reward_token_iot = 0; + iot_reward_token_hnt = 1; +} + message iot_reward_data { Decimal poc_bones_per_beacon_reward_share = 1; Decimal poc_bones_per_witness_reward_share = 2; Decimal dc_bones_per_share = 3; + // HIP-138: Reward output was changed from Subdao Tokens to HNT + iot_reward_token token = 4; } message reward_manifest {