-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add footfall data to boosting flow footfall and urbanization are considered together for determining the multiplier applied to a hex. * require passing a valid hex cell when asking about a cell * Fix hex_assignment * Fix tests * Fix formatting * Fix footfall Assignment to A for coverage tests * Provide mocked hex assignments struct Test that don't care about the specific values or underlying structures of HexAssignments can use this mock. The only option available is to return the best possible multiplier for a hex, hopefully behaving in a way that removes hex boosting from the equation. * restructure HexBoosting The top level HexBoosting struct is the wrapper for asking internal DiskTree about Assignments. For debugability, the information inside a DiskTree is turned into an enum mirroring the verbage in HIP-103, then get's turned into an Assignment. * use helper to make hex boost data with settings path * keep naming consistent between structs * no longer only urbanization hexes, all unassigned hexes * Update mobile_verifier/src/boosting_oracles/mod.rs Co-authored-by: Matthew Plant <matty@nova-labs.com> * Implement HexAssignment for both of the data sets independently * add file-store dump for coverage object * add error context for keypair deserializing * add dump mobile rewards command groups mobile rewards from a file into a valid json object and prints * Pull calculations out of code into structs Co-authored-by: macpie <macpie@users.noreply.github.com> * more nonzero use * format * update helium-proto * Change proto back to master --------- Co-authored-by: Michael Jeffrey <michaeldjeffrey@gmail.com> Co-authored-by: Matthew Plant <matty@nova-labs.com> Co-authored-by: Brian Balser <bbalser@nova-labs.com>
- Loading branch information
1 parent
a6a73aa
commit 3e356bb
Showing
19 changed files
with
734 additions
and
236 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use crate::cli::print_json; | ||
use crate::{file_source, Result, Settings}; | ||
use futures::stream::StreamExt; | ||
use helium_crypto::PublicKey; | ||
use helium_proto::services::poc_mobile::mobile_reward_share::Reward::*; | ||
use helium_proto::services::poc_mobile::MobileRewardShare; | ||
use prost::Message; | ||
use serde_json::json; | ||
use std::path::PathBuf; | ||
|
||
#[derive(Debug, clap::Args)] | ||
pub struct Cmd { | ||
path: PathBuf, | ||
} | ||
|
||
impl Cmd { | ||
pub async fn run(&self, _settings: &Settings) -> Result { | ||
let mut file_stream = file_source::source([&self.path]); | ||
|
||
let mut radio_reward = vec![]; | ||
let mut gateway_reward = vec![]; | ||
let mut subscriber_reward = vec![]; | ||
let mut service_provider_reward = vec![]; | ||
let mut unallocated_reward = vec![]; | ||
|
||
while let Some(result) = file_stream.next().await { | ||
let msg = result?; | ||
let reward = MobileRewardShare::decode(msg)?; | ||
match reward.reward { | ||
Some(r) => match r { | ||
RadioReward(reward) => radio_reward.push(json!({ | ||
"hotspot_key": PublicKey::try_from(reward.hotspot_key)?.to_string(), | ||
"cbsd_id": reward.cbsd_id, | ||
"poc_reward": reward.poc_reward, | ||
"boosted_hexes": reward.boosted_hexes, | ||
})), | ||
GatewayReward(reward) => gateway_reward.push(json!({ | ||
"hotspot_key": PublicKey::try_from(reward.hotspot_key)?.to_string(), | ||
"dc_transfer_reward": reward.dc_transfer_reward, | ||
})), | ||
SubscriberReward(reward) => subscriber_reward.push(json!({ | ||
"subscriber_id": uuid::Uuid::from_slice(&reward.subscriber_id).unwrap(), | ||
"discovery_location_amount": reward.discovery_location_amount, | ||
})), | ||
ServiceProviderReward(reward) => service_provider_reward.push(json!({ | ||
"service_provider": reward.service_provider_id, | ||
"amount": reward.amount, | ||
})), | ||
UnallocatedReward(reward) => unallocated_reward.push(json!({ | ||
"unallocated_reward_type": reward.reward_type, | ||
"amount": reward.amount, | ||
})), | ||
}, | ||
None => todo!(), | ||
} | ||
} | ||
|
||
print_json(&json!({ | ||
"radio_reward": radio_reward, | ||
"gateway_reward": gateway_reward, | ||
"subscriber_reward": subscriber_reward, | ||
"service_provider_reward": service_provider_reward, | ||
"unallocated_reward": unallocated_reward, | ||
}))?; | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod bucket; | ||
pub mod dump; | ||
pub mod dump_mobile_rewards; | ||
pub mod info; | ||
|
||
use crate::Result; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE hexes ADD COLUMN footfall oracle_assignment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.