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

reciprocity checks #709

Merged
merged 1 commit into from
Feb 12, 2024
Merged

reciprocity checks #709

merged 1 commit into from
Feb 12, 2024

Conversation

andymck
Copy link
Contributor

@andymck andymck commented Jan 12, 2024

proto pr: helium/proto#388

This adds a reciprocity or bidirectional validation to POC validations in order to satisfy https://github.com/helium/HIP/blob/main/0106-hotspot-bidirectional-coverage-requirement.md

The flow is as follows:

  1. Run regular validations on POC ( per beacon and any associated witnesses )

  2. After regular validations update DB to track the 'last beacon' and 'last witness' timestamps per relevant gateway

  • If regular validations declared the beacon valid then record last valid beacon timestamp ( 1 update per beacon)
  • If regular validations declared the witness valid then record last valid witness timestamp ( 1 update per witness )
  1. After updating the DB then run the reciprocity check:
  • For each previously declared valid witness, render the final status of each as invalid where the witnessing gateway does not have a valid beacon within the previous N hours

  • Render the beacon invalid if beaconer's gateway does not have a valid witness within the previous N hours

  1. Output POC reports to S3 as normal

TODO:

  • determine perf hit from additional DB access
  • add last witness read cache
  • add batch updates for last witnesses
  • mock last witness cache

@andymck andymck changed the title initial pass over reciprocity check reciprocity checks Jan 16, 2024
@andymck andymck force-pushed the andymck/reciprocity-check branch from f31a120 to 7a1e7c4 Compare February 5, 2024 14:27
@andymck andymck marked this pull request as ready for review February 7, 2024 17:05
@andymck andymck force-pushed the andymck/reciprocity-check branch from e76c8b9 to b49d136 Compare February 12, 2024 14:38
@@ -252,6 +252,8 @@ where

// create the struct defining this POC
let mut poc = Poc::new(
self.pool.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the size of the db thread pool we're working with in IoT Verifier? this seems risky to be cloning per-beacon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pool size is configurable...not sure what it is on mainnet currently.

As per the TODO above, i plan on refactoring db handling in here and wrapping all in a txn. The db access here is far from ideal

@andymck andymck force-pushed the andymck/reciprocity-check branch from 573a916 to cd32bc6 Compare February 12, 2024 17:17
@andymck andymck merged commit 934065c into main Feb 12, 2024
1 check passed
@andymck andymck deleted the andymck/reciprocity-check branch February 12, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants