From fffce9d335b1e5d74ffd5da27ddba6e60b6d9d7c Mon Sep 17 00:00:00 2001 From: Andrew McKenzie Date: Wed, 13 Nov 2024 11:11:58 +0000 Subject: [PATCH] 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 88af8c41..c945eeed 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 06fff579..1d878ff6 100644 --- a/src/service/poc_mobile.proto +++ b/src/service/poc_mobile.proto @@ -644,7 +644,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); +}