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

Introduce ActiveLaneRelayersSet and NextLaneRelayersSet #2627

Merged
merged 11 commits into from
Oct 27, 2023

Conversation

svyatonik
Copy link
Contributor

related to #2486
extracted from #2605

I'm splitting #2605 into smaller parts (while still fixing remaining TODOs there), because it is IMO easier to review it that way (#2605 is too large already). Feel free to argue - I'll close this PR and leave all changes in the #2605.

This PR adds two structures ActiveLaneRelayersSet and NextLaneRelayersSet + two runtime storage values for those (instead of one LaneRelayersSet that was there previously). Later we'll add two three calls to:

  • add relayer to the NextLaneRelayers;
  • remove relayer from the NextLaneRelayers;
  • replace ActiveLaneRelayers with the NextLaneRelayers.

Why two storage values instead of one? Because NextLaneRelayers is only touched in above ^^^ calls and ActiveLaneRelayers will be touched during every message delivery and confirmation transaction. So it makes sense to have two storage values to decrease PoV.

///
/// Relayers set is a bounded priority queue, where relayers with lower expected reward are
/// prioritized over greedier relayers. At the end of epoch, we select top
/// `MaxActiveRelayersPerLane` relayers from the next set and move them to the next set. To
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please note that it isn't the whole solution - there's yet two additional steps mentioned in #2605 (comment) and extracted to the #2618

primitives/relayers/src/lane_relayers.rs Outdated Show resolved Hide resolved
primitives/relayers/src/lane_relayers.rs Outdated Show resolved Hide resolved
primitives/relayers/src/lane_relayers.rs Outdated Show resolved Hide resolved
primitives/relayers/src/lane_relayers.rs Show resolved Hide resolved
primitives/relayers/src/lane_relayers.rs Outdated Show resolved Hide resolved
@svyatonik svyatonik merged commit 5137448 into master Oct 27, 2023
15 checks passed
@svyatonik svyatonik deleted the next-and-active-lane-relayers branch October 27, 2023 07:27
bkontur pushed a commit that referenced this pull request May 7, 2024
* intreoduce ActiveLaneRelayersSet and NextLaneRelayersSet

* more tests

* fix runtimes

* CI

* CI 2

* CI 3

* apply review suggestions

* return Option<> from try_remove

* RelayerAndReward -> LaneRegistration

* separate BTreeSet -> boolean flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants