Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIP-140: > 25 unique connections required for boosted hex eligibility #931

Merged
merged 8 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 35 additions & 19 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ helium-lib = { git = "https://github.com/helium/helium-wallet-rs.git", branch =
hextree = { git = "https://github.com/jaykickliter/HexTree", branch = "main", features = [
"disktree",
] }
helium-proto = { git = "https://github.com/helium/proto", branch = "master", features = [
helium-proto = { git = "https://github.com/helium/proto", branch = "bbalser/hip-140", features = [
"services",
] }
beacon = { git = "https://github.com/helium/proto", branch = "master" }
beacon = { git = "https://github.com/helium/proto", branch = "bbalser/hip-140" }
solana-client = "1.18"
solana-sdk = "1.18"
solana-program = "1.18"
Expand Down
20 changes: 9 additions & 11 deletions coverage_point_calculator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
//!
//! - [SPBoostedRewardEligibility]
//! - Radio must pass at least 1mb of data from 3 unique phones [HIP-84][provider-boosting]
//! - Service Provider can invalidate boosted rewards of a hotspot [HIP-125][provider-banning]
//! - Radio must serve >25 unique connections on a rolling 7-day window [HIP-140][sp-boost-qualifiers]
//! - [@deprecated] Service Provider can invalidate boosted rewards of a hotspot [HIP-125][provider-banning]
//!
//! - [OracleBoostingStatus]
//! - Eligible: Radio is eligible for normal oracle boosting multipliers
Expand All @@ -69,6 +70,7 @@
//! [provider-banning]: https://github.com/helium/HIP/blob/main/0125-temporary-anti-gaming-measures-for-boosted-hexes.md
//! [anti-gaming]: https://github.com/helium/HIP/blob/main/0131-bridging-gap-between-verification-mappers-and-anti-gaming-measures.md
//! [carrier-offload]: https://github.com/helium/HIP/blob/main/0134-reward-mobile-carrier-offload-hotspots.md
//! [sp-boost-qualifiers]: https://github.com/helium/HIP/blob/main/0140-adjust-service-provider-boost-qualifiers.md
//!
pub use crate::{
hexes::{CoveredHex, HexPoints},
Expand Down Expand Up @@ -242,7 +244,7 @@ impl CoveragePoints {
SpBoostedHexStatus::WifiLocationScoreBelowThreshold(_) => dec!(0),
SpBoostedHexStatus::AverageAssertedDistanceOverLimit(_) => dec!(0),
SpBoostedHexStatus::RadioThresholdNotMet => dec!(0),
SpBoostedHexStatus::ServiceProviderBanned => dec!(0),
SpBoostedHexStatus::NotEnoughConnections => dec!(0),
}
}
}
Expand All @@ -260,7 +262,7 @@ pub enum SpBoostedHexStatus {
WifiLocationScoreBelowThreshold(Decimal),
AverageAssertedDistanceOverLimit(Decimal),
RadioThresholdNotMet,
ServiceProviderBanned,
NotEnoughConnections,
}

impl SpBoostedHexStatus {
Expand All @@ -271,10 +273,10 @@ impl SpBoostedHexStatus {
service_provider_boosted_reward_eligibility: SPBoostedRewardEligibility,
) -> Self {
match service_provider_boosted_reward_eligibility {
// hip-125: if radio has been banned by service provider, no boosting
SPBoostedRewardEligibility::ServiceProviderBanned => Self::ServiceProviderBanned,
// hip-84: if radio has not met minimum data and subscriber thresholds, no boosting
SPBoostedRewardEligibility::RadioThresholdNotMet => Self::RadioThresholdNotMet,
// hip-140: radio must have enough unique connections
SPBoostedRewardEligibility::NotEnoughConnections => Self::NotEnoughConnections,
SPBoostedRewardEligibility::Eligible => {
// hip-93: if radio is wifi & location_trust score multiplier < 0.75, no boosting
if radio_type.is_wifi() && location_trust_multiplier < MIN_WIFI_TRUST_MULTIPLIER {
Expand Down Expand Up @@ -941,12 +943,8 @@ mod tests {
SpBoostedHexStatus::WifiLocationScoreBelowThreshold(dec!(0)),
);
assert_eq!(
wifi_bad_trust_score(SPBoostedRewardEligibility::ServiceProviderBanned),
SpBoostedHexStatus::ServiceProviderBanned
);
assert_eq!(
wifi_bad_trust_score(SPBoostedRewardEligibility::RadioThresholdNotMet),
SpBoostedHexStatus::RadioThresholdNotMet
wifi_bad_trust_score(SPBoostedRewardEligibility::NotEnoughConnections),
SpBoostedHexStatus::NotEnoughConnections
);
}

Expand Down
12 changes: 6 additions & 6 deletions coverage_point_calculator/src/service_provider_boosting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ 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,
/// Radio must have greather than 25 unique connections over 7 days
///
/// [HIP-140: Adjust Service Provider Boost Qualifiers][adjust-service-provider-boost-qualifiers]
///
/// [adjust-service-provider-boost-qualifiers]: https://github.com/helium/HIP/blob/main/0140-adjust-service-provider-boost-qualifiers.md
NotEnoughConnections,
}
14 changes: 9 additions & 5 deletions mobile_verifier/src/reward_shares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,13 @@ impl CoverageShares {
OracleBoostingStatus::Eligible
};

let sp_boosted_reward_eligibility = boosted_hex_eligibility.eligibility(
radio_type,
pubkey.clone(),
cbsd_id.clone(),
&covered_hexes,
);

if eligible_for_coverage_map(
oracle_boosting_status,
&speedtests,
Expand All @@ -501,16 +508,13 @@ impl CoverageShares {
) {
coverage_map_builder.insert_coverage_object(coverage_map::CoverageObject {
indoor: is_indoor,
hotspot_key: pubkey.clone().into(),
cbsd_id: cbsd_id.clone(),
hotspot_key: pubkey.into(),
cbsd_id,
seniority_timestamp: seniority.seniority_ts,
coverage: covered_hexes,
});
}

let sp_boosted_reward_eligibility =
boosted_hex_eligibility.eligibility(radio_type, pubkey, cbsd_id);

radio_infos.insert(
key,
RadioInfo {
Expand Down
10 changes: 5 additions & 5 deletions mobile_verifier/src/reward_shares/radio_reward_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ impl RadioRewardV2Ext for coverage_point_calculator::CoveragePoints {
coverage_point_calculator::SpBoostedHexStatus::WifiLocationScoreBelowThreshold(_) => {
SpBoostedHexStatus::LocationScoreBelowThreshold
}
coverage_point_calculator::SpBoostedHexStatus::AverageAssertedDistanceOverLimit(_) => {
SpBoostedHexStatus::AverageAssertedDistanceOverLimit
}
coverage_point_calculator::SpBoostedHexStatus::RadioThresholdNotMet => {
SpBoostedHexStatus::RadioThresholdNotMet
}
coverage_point_calculator::SpBoostedHexStatus::ServiceProviderBanned => {
SpBoostedHexStatus::ServiceProviderBan
}
coverage_point_calculator::SpBoostedHexStatus::AverageAssertedDistanceOverLimit(_) => {
SpBoostedHexStatus::AverageAssertedDistanceOverLimit
coverage_point_calculator::SpBoostedHexStatus::NotEnoughConnections => {
SpBoostedHexStatus::NotEnoughConnections
}
}
}
Expand Down
6 changes: 0 additions & 6 deletions mobile_verifier/src/rewarder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,6 @@ async fn reward_poc(

let boosted_hex_eligibility = BoostedHexEligibility::new(
radio_threshold::verified_radio_thresholds(pool, reward_period).await?,
sp_boosted_rewards_bans::db::get_banned_radios(
pool,
SpBoostedRewardsBannedRadioBanType::BoostedHex,
reward_period.end,
)
.await?,
unique_connections.clone(),
);

Expand Down
Loading