From 39138825d3d0bc51244e71c4daa72bd30c4d5582 Mon Sep 17 00:00:00 2001 From: Andrew McKenzie Date: Wed, 17 Jan 2024 12:41:35 +0000 Subject: [PATCH 1/2] hex boosting protos --- build.rs | 1 + src/hex_boosting.proto | 31 ++++++++++++++++++++++++ src/lib.rs | 7 ++++-- src/service/mobile_config.proto | 42 +++++++++++++++++++++++++++++++++ src/service/poc_mobile.proto | 10 ++++++++ 5 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 src/hex_boosting.proto diff --git a/build.rs b/build.rs index 37f0df1f..f24332da 100644 --- a/build.rs +++ b/build.rs @@ -28,6 +28,7 @@ const MESSAGES: &[&str] = &[ "src/reward_manifest.proto", "src/blockchain_region_param_v1.proto", "src/price_report.proto", + "src/hex_boosting.proto", ]; macro_rules! config { diff --git a/src/hex_boosting.proto b/src/hex_boosting.proto new file mode 100644 index 00000000..39a539cf --- /dev/null +++ b/src/hex_boosting.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package helium; + +message boosted_hex_info_v1 { + // The res12 h3 index of the boosted hex + uint64 location = 1; + // Unix timestamp in seconds of the start of the boost period + // 0 if the boosting has not yet started + uint64 start_ts = 2; + // Unix timestamp in seconds of the end of the boost period + // 0 if the boosting has not yet started + uint64 end_ts = 3; + // The length of the boost period in months expressed as seconds + // where one month = 30 days + uint32 period_length = 4; + // the multipliers valid for this hex + // for each period + repeated uint32 multipliers = 5; + // the onchain address of the boosted hex account + bytes boosted_hex_pubkey = 6; + // the onchain address of the boost config account + bytes boost_config_pubkey = 7; +} + +message boosted_hex_update_v1 { + // Unix timestamp in seconds the hex was updated + uint64 timestamp = 1; + // Details of the updated hex + boosted_hex_info_v1 update = 2; +} diff --git a/src/lib.rs b/src/lib.rs index a66bdaf7..ef8e990d 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,8 +9,9 @@ pub use prost::{DecodeError, EncodeError, Message}; #[cfg(feature = "services")] pub mod services { use crate::{ - BlockchainRegionParamsV1, BlockchainTokenTypeV1, BlockchainTxn, DataRate, EntropyReportV1, - GatewayStakingMode, MapperAttach, Region, RoutingAddress, ServiceProvider, + BlockchainRegionParamsV1, BlockchainTokenTypeV1, BlockchainTxn, BoostedHexInfoV1, + BoostedHexUpdateV1, DataRate, EntropyReportV1, GatewayStakingMode, MapperAttach, Region, + RoutingAddress, ServiceProvider, }; pub mod iot_config { @@ -37,6 +38,8 @@ pub mod services { pub use entity_server::{Entity, EntityServer}; pub use gateway_client::GatewayClient; pub use gateway_server::{Gateway, GatewayServer}; + pub use hex_boosting_client::HexBoostingClient; + pub use hex_boosting_server::{HexBoosting, HexBoostingServer}; } pub mod downlink { diff --git a/src/service/mobile_config.proto b/src/service/mobile_config.proto index b5b6d44b..a09c8954 100644 --- a/src/service/mobile_config.proto +++ b/src/service/mobile_config.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package helium.mobile_config; +import "hex_boosting.proto"; + // ------------------------------------------------------------------ // Message Definitions // ------------------------------------------------------------------ @@ -210,6 +212,37 @@ message admin_key_res_v1 { bytes signature = 3; } +message boosted_hex_info_stream_req_v1 { + // max number of boosted hex info records in each message of the response + // stream + uint32 batch_size = 1; + // pubkey binary of the signing keypair + bytes signer = 2; + bytes signature = 3; +} + +message boosted_hex_modified_info_stream_req_v1 { + // max number of boosted hex info records in each message of the response + // stream + uint32 batch_size = 1; + // return only those records which were modified after the specified timestamp + // unix epoch timestamp in seconds + uint64 timestamp = 2; + // pubkey binary of the signing keypair + bytes signer = 3; + bytes signature = 4; +} + +message boosted_hex_info_stream_res_v1 { + // a list of boosted hex info + repeated boosted_hex_info_v1 hexes = 1; + // unix epoch timestamp in seconds + uint64 timestamp = 2; + // pubkey binary of the signing keypair + bytes signer = 3; + bytes signature = 4; +} + // ------------------------------------------------------------------ // Service Definitions // ------------------------------------------------------------------ @@ -253,3 +286,12 @@ service admin { // Deauthorize a public key for validating trusted rpcs rpc remove_key(admin_remove_key_req_v1) returns (admin_key_res_v1); } + +service hex_boosting { + // Get a stream of hex boost info + rpc info_stream(boosted_hex_info_stream_req_v1) + returns (stream boosted_hex_info_stream_res_v1); + // Get a stream of modified hex boost info since the specified timestamp + rpc modified_info_stream(boosted_hex_modified_info_stream_req_v1) + returns (stream boosted_hex_info_stream_res_v1); +} diff --git a/src/service/poc_mobile.proto b/src/service/poc_mobile.proto index 151617d4..dc897c51 100644 --- a/src/service/poc_mobile.proto +++ b/src/service/poc_mobile.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package helium.poc_mobile; import "mapper.proto"; +import "hex_boosting.proto"; import "service_provider.proto"; message speedtest_req_v1 { @@ -335,6 +336,15 @@ message radio_reward { // rewardable period // value is 0.0 to 1.0 multiplied by 1000 uint32 speedtest_multiplier = 9; + // list of all boosted hexes covered by this radio + repeated boosted_hex boosted_hexes = 10; +} + +message boosted_hex { + // The res12 h3 index of the boosted hex + uint64 location = 1; + // the multiplier applied to this hex + uint32 multiplier = 2; } message gateway_reward { From fb07b06d55aa9bcba6facf0307a218ab63b5d6cd Mon Sep 17 00:00:00 2001 From: Brian Balser Date: Thu, 8 Feb 2024 10:43:27 -0500 Subject: [PATCH 2/2] Add version to boosted_hex_info_v1 --- src/hex_boosting.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hex_boosting.proto b/src/hex_boosting.proto index 39a539cf..dbc135c9 100644 --- a/src/hex_boosting.proto +++ b/src/hex_boosting.proto @@ -21,6 +21,8 @@ message boosted_hex_info_v1 { bytes boosted_hex_pubkey = 6; // the onchain address of the boost config account bytes boost_config_pubkey = 7; + + uint32 version = 8; } message boosted_hex_update_v1 {