-
Notifications
You must be signed in to change notification settings - Fork 35
Remove CBRS from db layer #982
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
Conversation
5d4a8ea to
08338a3
Compare
08338a3 to
a3c8d4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes CBRS-related functionality from the database layer and updates associated tests and data structures accordingly.
- Removed legacy CBRS verification and associated database tables/columns.
- Updated HeartbeatReward to remove the cell_type field and to require non-optional distances_to_asserted.
- Adjusted SQL queries and test cases to reflect these changes.
Reviewed Changes
Copilot reviewed 4 out of 11 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mobile_verifier/tests/integrations/heartbeats.rs | Removed cell_type from test cases and updated distances usage. |
| mobile_verifier/src/reward_shares.rs | Updated iterator usage to handle errors from the new API. |
| mobile_verifier/src/radio_threshold.rs | Removed legacy CBRS verification and adjusted insert/delete queries. |
| mobile_verifier/src/heartbeats/mod.rs | Removed cell_type from HeartbeatReward and added error checking for distances vs. multipliers. |
Files not reviewed (7)
- mobile_verifier/migrations/42_drop_grandfathered_radio_threshold.sql: Language not supported
- mobile_verifier/migrations/43_radio_threshold_rework_unique_idx.sql: Language not supported
- mobile_verifier/migrations/44_drop_cbrs_heartbeats.sql: Language not supported
- mobile_verifier/migrations/45_drop_old_hex_coverage.sql: Language not supported
- mobile_verifier/migrations/46_delete_cbrs_from_seniority.sql: Language not supported
- mobile_verifier/migrations/47_delete_cbrs_from_coverage_objects.sql: Language not supported
- mobile_verifier/src/heartbeats/valid_radios.sql: Language not supported
Comments suppressed due to low confidence (2)
mobile_verifier/src/radio_threshold.rs:257
- Ensure that the complete removal of legacy handling does not inadvertently affect other report verifications, especially in contexts that might still expect legacy behavior.
let is_legacy = self.verify_legacy(&report.hotspot_pubkey, &None).await?;
mobile_verifier/src/heartbeats/mod.rs:237
- [nitpick] Consider adding logging or additional context when a length mismatch is detected in iter_distances_and_scores to simplify debugging if data inconsistencies occur.
if self.trust_score_multipliers.len() != self.distances_to_asserted.len() {
| VALUES ($1, $2, $3, $4, true, $5) | ||
| ON CONFLICT (hotspot_pubkey) |
Copilot
AI
Apr 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify that using only hotspot_pubkey as the unique constraint does not allow duplicate entries, given that cbsd_id has been removed from the conflict target.
| VALUES ($1, $2, $3, $4, true, $5) | |
| ON CONFLICT (hotspot_pubkey) | |
| VALUES ($1, $2, $3, $4, $5, true, $6) | |
| ON CONFLICT (hotspot_pubkey, cbsd_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify that using only hotspot_pubkey as the unique constraint does not allow duplicate entries
In migration 43_radio_threshold_rework_unique_idx.sql unique index reworked to only hotspot_pubkey field
...
CREATE UNIQUE INDEX radio_threshold_hotspot_pubkey_idx ON radio_threshold (hotspot_pubkey);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know that this unique constraint holds in the current mainnet db?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested migrations on the one of the mobile verifier backups and it is worked.
But I will check it again before merge on the latest mainnet backup.
|
The comment I accidentally deleted: @michaeldjeffrey commented on this pull request. In mobile_verifier/src/radio_threshold.rs:
We're only grabbing a single field, this query can be simplified let gateways = sqlx::query_scalar::<, PublicKeyBinary>( Ok(VerifiedRadioThresholds { gateways }) And we can get rid of RadioThreshold. |
565069c to
4f07901
Compare
@michaeldjeffrey done |
|
Looks good, need to renumber the migrations |
6d50d88 to
e6ae2fc
Compare
@bbalser Done |
Migration info: It has taken 1m48s to run all migrations in this PR on the local DB setup.
UPD migration info: It takes 44s to run all migrations in this PR on the local labnet DB setup (04.22.25)
Mobile verifier:
verify_legacyfunction andgrandfathered_radio_thresholdTABLE.cbsd_idfromradio_thresholdtable (migration) andradio_threshold.rsmoduleold_hex_coveragetableDELETE FROM seniority WHERE radio_type = 'cbrs'which deletes around 500k rows (75%) in seniority table.DELETE FROM coverage_objects WHERE radio_type = 'cbrs';which deletes around 35k rows (55%) in coverage_objects table.