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

Use the h3dex to find gateways in the selected hex for poc notifications #58

Merged
merged 4 commits into from Jun 7, 2022

Conversation

Vagabond
Copy link
Member

@Vagabond Vagabond commented Jun 6, 2022

Using the old TargetMod:gateways_for_zone was more expensive and
prevented us from doing some useful optimizations and potentially was
limiting the number of hotspots we were notifying.

Using the old `TargetMod:gateways_for_zone` was more expensive and
prevented us from doing some useful optimizations and potentially was
limiting the number of hotspots we were notifying.
Vars,
HexList,
[{Hex, HexRandState}]
ZoneGWs = lists:flatten(
Copy link
Contributor

Choose a reason for hiding this comment

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

i see where you are going with this...the list here though will contain active and inactive GWs. As the inactive GWs wont likely have a streaming connection that is prob fine. Even if they do have a streaming connection but have not yet been reactivated via the HBs, it should still be fine as should they check with the challenger they will just get the usual not target response

Copy link
Contributor

Choose a reason for hiding this comment

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

That said, we will be potentially sending a lot of additional notifications....via gateways for zone, we would be dropping hundreds of notifications over this...at most in the old way we would have 20 notifications per hex, now we will have many hundreds for the more populated hexes

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally we'd pub-sub on the h3 index, can we switch to doing that?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah thats perfectly doable, the sub takes place in helium_stream_poc_impl:subscribe_to_events/1 whilst the pub takes place in sibyl_poc_mgr:run_poc_targetting/5. I can make that change later if you dont get to it

Going to reiterate the price for this is that end up sending potentially hundreds of extra notifications which themselves will result in same amount of additional API calls to durable validators and then all the same to the challenger

Copy link
Member Author

Choose a reason for hiding this comment

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

but don't we need to do this anyway? only the challenger knows what the entropy to pick the challengee is, we need to notify everyone in the hex?

Copy link
Contributor

Choose a reason for hiding this comment

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

looking at this I see why my PR was so confusing/hard to incorporate.

seems to me like we could make it a lot cheaper by doing cheap checks first. That said, here the cost isn't that bad, we're mostly concerned about expensive thing happening at validation time, so if we don't need to do this there, it's probably OK even if it's expensive. I might misunderstand, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

but don't we need to do this anyway? only the challenger knows what the entropy to pick the challengee is, we need to notify everyone in the hex?

Previously the target would have been selected from the filtered subset of 20 ( 20 being the max value, actuality much less). Only that same subset would have been notified here, whereas with this change we will be notifying all hotspots in the hex.

Maybe its worth it too take the hit here and reduce the critical path of the validations or maybe there is another option that reduces the cost on both sides...

@evanmcc evanmcc merged commit 717f2ed into master Jun 7, 2022
@evanmcc evanmcc deleted the adt/find_poc_gateways_better branch June 7, 2022 23:45
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.

None yet

3 participants