Skip to content

Commit

Permalink
Coverage Point Calculator Integration with mobile-verifier (#830)
Browse files Browse the repository at this point in the history
* include coverage point calculator in mobile-verifier

* derive Debug for nested types

will help with the switchover

* CoveragePoints uses CoveragePoint2 internally

This makes coverage points async internally. When cleanup is done there will be a single instance of CoveragePoints.

* add coverage map to compute rank

* unignore mobile verifier integration tests

* update with rename SubscriberThreshold -> RadioThreshold

thresholds being met for a radio are not only about subscribers.

* filter for boosted hexes during report generation

It's the responsibility of the report to only include hexes with active boost values

* calculator uses hex_assignments crate

* clean values for reports

* Start adding coverage-map in mobile-verifier

Keep disctinction between SignalLevel in coverage and coverage-map, this way coverage-map doesn't need to bring in sqlx as a dependency

* break out coverage map for drop in replacement testing

* Remove coverage map trait

* use RankedCoverage from coverage-map

* Skip a radio for rewards if it cannot be constructed properly

rewards should never fail. but we can skip a radio and have an alert that says something went wrong.

* use new coverage_map for testing

* bring up to date with coverage-point-calculator

* remove unused fields now that coverage-map is stabilized

* remove innner coverage map wrapper

* rename after move from unwrapping

* lift coverage points one more time

* starting to conslidate radio information into single map

* total coverage points is now provided pre-truncated

* simplify coverage points to use only radio_infos

* hotspot_points no longer needs to be &mut self

* clean up trust_score construction and long types

Move zipping trust scores with their distances to heartbeatreward.
Leave

I put the use statements above where they are in the function because the names of the types kind of overlap with the names used in the mobile verifier, and I wanted to make it extra clear to anyone reading, this function is transforming those values into calculator types.

* name test function more explicitly

* DateTime<Utc> implements Copy, no need to Clone

* remove need for cloning radio_info

we can clone the speed_tests and trust_scores as they enter the calculator, but everything else can work with a reference for much longer.

* Remove replaced coverage point code

* rename coverage points constructor

The constructor no longer tries to calculate points, it collects information about radios and coverage. All the pointing happens in into_rewards.

* remove async where possible from CoveragePoints

* remove unneccessary `this` binding

* Rename CoveragePoints -> CoverageShares

This matches with the other reward structs `MapperShares`, `ServiceProviderShares`. 

And reflects more that we're talking about `reward_shares`, where `coverage_points` is starting to mean points provided towards shares relating only to coverage (excluding backhaul (speedtests)).

* remove unneeded derive for debug

* remove location trust score calculation 

This all lives in the coverage-point-calculator now

* rename to differentiate argument from local bindings

* construct coverage map inside block scope

We can insert coverage objects directly after iterating over them, radio_info only needs to know if the radio `is_indoor`. Moving that binding to the top helps hint that it's set by something in the block and returned.

And we don't need to carry around covered_hexes for any longer than necessary.

* function call now small enough to inline

* rename coverage variables to match with struct

* handle potential lack of speedtest for radio
  • Loading branch information
michaeldjeffrey authored Jun 21, 2024
1 parent d721c0d commit 6ce7d68
Show file tree
Hide file tree
Showing 11 changed files with 459 additions and 1,348 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mobile_verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ regex = "1"
humantime-serde = { workspace = true }
custom-tracing = { path = "../custom_tracing" }
hex-assignments = { path = "../hex_assignments" }
coverage-point-calculator = { path = "../coverage_point_calculator" }
coverage-map = { path = "../coverage_map" }

[dev-dependencies]
backon = "0"
4 changes: 2 additions & 2 deletions mobile_verifier/src/cli/reward_from_db.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
heartbeats::HeartbeatReward,
radio_threshold::VerifiedRadioThresholds,
reward_shares::{get_scheduled_tokens_for_poc, CoveragePoints},
reward_shares::{get_scheduled_tokens_for_poc, CoverageShares},
speedtests_average::SpeedtestAverages,
Settings,
};
Expand Down Expand Up @@ -41,7 +41,7 @@ impl Cmd {
let speedtest_averages =
SpeedtestAverages::aggregate_epoch_averages(epoch.end, &pool).await?;

let reward_shares = CoveragePoints::aggregate_points(
let reward_shares = CoverageShares::new(
&pool,
heartbeats,
&speedtest_averages,
Expand Down
Loading

0 comments on commit 6ce7d68

Please sign in to comment.