-
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.
HIP-119: Location Trust Score from maximum asserted distance differen…
…ce (#840) * Calculate Location Trust Score from asserted distance in heartbeat HIP-119 introduces a new set of tables for location trust scores based on `(radio_type, distance_to_asserted)`. This also allows for a new minimum trust score multiplier of `0x`. * Remove use of max_distance_to_asserted This value is now contained within the function `asserted_distance_to_trust_multiplier` in the coverage point calculator. * Update test for increased allowable location trust multipliers All location trust scores used to be 1.0 or 0.25. HIP-119 adds 0.00 as a multiplier possibility based on distance. * typo in test name * Use lowest possible location trust multiplier value for bad case scenarios * Pass location trust to determine boost eligibility Location Trust Scores are no longer reduced based on the presence of a boosted hex. However, having an average distance from an asserted location past 50m can cause a radio to be ineligible for boosted rewards. * namespace location consts to provide more context Both constants have to do with service provider boosting in regards to a radios location trust scores. Namespacing allows for not needing to shove all possible context into a top level name. * make service provider boosting module It didn't feel quite correct to have half the service provider boosting code in lib.rs and the other in location.rs. The constants have to with location trust scores, but they do not get used there. * Remove trust score tests that expect score modification from boosting The distance to asserted no longer changes trust scores in the presence of a boosted hex. Service provider boosting eligibility is determined from the distance to asserted, that is tested at the top level of this crate. * Test Boosting does not apply when too far away * consolidate seeding heartbeats v1 and v3 The only difference was the location distance from asserted and assigned location trust multipliers. Refactoring heartbeat seeding further is left as an exercise to the next person who has a need to change these tests. * Test being too far from asserted location removes service provider boosting HIP-119 removes the part of calculating coverage points that degrades a trust score when a radio covers a boosted hex and is more than 50m away from their asserted location. Now, being +50m away from an asserted location makes a radio not eligible for receiving service provider boosted rewards. They continue to receive the full force of their location trust score. Being an Indoor radio 100m away from an asserted location is enough to keep a location trust multiplier of 1.0x, but not receive boosted rewards. * add hip-125 mentions in the docs * Try to link to relevant hips when possible Adding links to multiple places so you don't have to know a secret location where they exist. * Active boosting ineligibility takes precendence over passive ineligibility * Remove answered questions Both were answered yes * New location scores apply to Wifi only CBRS is always trusted for location. The location trust score is intercepted earlier when validating heartbeats. If for some reason CBRS radios do make it to this function, they will receive a good trust score anyways. * ServiceProvider -> SP for brevity
- Loading branch information
1 parent
fe83fa3
commit 3e142e9
Showing
14 changed files
with
543 additions
and
396 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
37 changes: 37 additions & 0 deletions
37
coverage_point_calculator/src/service_provider_boosting.rs
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,37 @@ | ||
use rust_decimal::Decimal; | ||
use rust_decimal_macros::dec; | ||
|
||
// In order for the Wi-Fi access point to be eligible for boosted hex rewards | ||
// as described in HIP84 the location trust score needs to be 0.75 or higher. | ||
// | ||
// [HIP-93: Add Wifi to Mobile Dao][add-wifi-aps] | ||
// | ||
// [add-wifi-aps]: https://github.com/helium/HIP/blob/main/0093-addition-of-wifi-aps-to-mobile-subdao.md#341-indoor-access-points-rewards | ||
pub(crate) const MIN_WIFI_TRUST_MULTIPLIER: Decimal = dec!(0.75); | ||
|
||
// In order for access points to be eligible for boosted Service Provider | ||
// rewards defined in HIP-84, the asserted distances must be 50 meters or | ||
// less than the reported location from external services for both indoor | ||
// and outdoor Access Points. | ||
// | ||
// [HIP-119: Gaming Loopholes][gaming-loopholes] | ||
// | ||
// [gaming-loopholes]: https://github.com/helium/HIP/blob/main/0119-closing-gaming-loopholes-within-the-mobile-network.md#maximum-asserted-distance-for-boosted-hexes | ||
pub(crate) const MAX_AVERAGE_DISTANCE: Decimal = dec!(50); | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq)] | ||
pub enum SPBoostedRewardEligibility { | ||
Eligible, | ||
/// Service Provider can invalidate boosted rewards of a hotspot | ||
/// | ||
/// [HIP-125: Anti gaming measures][anti-gaming] | ||
/// | ||
/// [anti-gaming]: https://github.com/helium/HIP/blob/main/0125-temporary-anti-gaming-measures-for-boosted-hexes.md | ||
ServiceProviderBanned, | ||
/// Radio must pass at least 1mb of data from 3 unique phones. | ||
/// | ||
/// [HIP-84: Provider Hex Boosting][provider-boosting] | ||
/// | ||
/// [provider-boosting]: https://github.com/helium/HIP/blob/main/0084-service-provider-hex-boosting.md | ||
RadioThresholdNotMet, | ||
} |
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
Oops, something went wrong.