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

Pausable uptime manager #1372

Merged
merged 40 commits into from
Nov 5, 2024
Merged

Pausable uptime manager #1372

merged 40 commits into from
Nov 5, 2024

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Oct 28, 2024

Why this should be merged

Adds pausable uptime manager interface for uptime tracking

How this works

Pausable uptime manager extends the avalanchego uptime manager by introducing callback listeners for validators state (under plugin/evm/validators). The idea is to pause a node's uptime and then can continue whenever it's resumed. It also modifies Connect, Disconnect, StartTracking` accordingly.

How this was tested

Added tests

How is this documented

Comments in code

ceyonur and others added 28 commits September 16, 2024 15:58
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: Ceyhun Onur <ceyhunonur54@gmail.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: Ceyhun Onur <ceyhunonur54@gmail.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Signed-off-by: Ceyhun Onur <ceyhunonur54@gmail.com>
@ceyonur ceyonur requested review from darioush and a team as code owners October 28, 2024 19:00
@ceyonur ceyonur requested a review from darioush November 5, 2024 09:57
plugin/evm/uptime/pausable_manager.go Outdated Show resolved Hide resolved
plugin/evm/uptime/pausable_manager.go Outdated Show resolved Hide resolved
plugin/evm/uptime/pausable_manager_test.go Outdated Show resolved Hide resolved
plugin/evm/uptime/pausable_manager.go Show resolved Hide resolved
plugin/evm/uptime/pausable_manager.go Show resolved Hide resolved
@ceyonur ceyonur requested review from marun and yacovm November 5, 2024 17:33
darioush
darioush previously approved these changes Nov 5, 2024
plugin/evm/uptime/pausable_manager_test.go Show resolved Hide resolved
darioush
darioush previously approved these changes Nov 5, 2024
Copy link
Contributor

@michaelkaplan13 michaelkaplan13 left a comment

Choose a reason for hiding this comment

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

Could you confirm my understanding based on going through this code in the context of ACP-77?

  • Validators can are either connected/disconnected and active/inactive.
    • A connected & inactive validator represents a validators running properly, but out of PAYG on the P-Chain
    • A connected & active validator is both running properly and has non-zero balance on the P-Chain
    • A disconnected & active validator represents an offline node that still has non-zero balance on the P-Chain
    • A disconnected & inactive validator is a node that is both offline and out of PAYG balance.
  • We pause nodes when they are marked as inactive, and when we pause them, we disconnect from them if we were previously connected.
  • We resume nodes when they are marked as active, and reconnect to them then if necessary.
  • A nodes uptime is incremented when: (it is both active and connected) OR (it isn't tracked). The second part is because we assume validators are online while we ourselves are offline.

marun
marun previously approved these changes Nov 5, 2024
yacovm
yacovm previously approved these changes Nov 5, 2024
@ceyonur
Copy link
Collaborator Author

ceyonur commented Nov 5, 2024

Could you confirm my understanding based on going through this code in the context of ACP-77?

* Validators can are either connected/disconnected and active/inactive.

Yes, those two states are different though. They can be connected/active disconnected/inactive etc...

  * A connected & inactive validator represents a validators running properly, but out of PAYG on the P-Chain

True

  * A connected & active validator is both running properly and has non-zero balance on the P-Chain

True

  * A disconnected & active validator represents an offline node that still has non-zero balance on the P-Chain

True

  * A disconnected & inactive validator is a node that is both offline and out of PAYG balance.

True

* We pause nodes when they are marked as inactive, and when we pause them, we disconnect from them if we were previously connected.

True, the inner manager (who does the actual uptime tracking) is disconnected.

* We resume nodes when they are marked as active, and reconnect to them then if necessary.

True. Note that they're already connected (in p2p), we just start increasing their uptime in manager.

* A nodes uptime is incremented when: (it is both active and connected) OR (it isn't tracked). The second part is because we assume validators are online while we ourselves are offline.

true

@ceyonur ceyonur dismissed stale reviews from yacovm, marun, and darioush via 366c946 November 5, 2024 21:15
@ceyonur ceyonur enabled auto-merge (squash) November 5, 2024 21:15
@ceyonur ceyonur merged commit 8a6df9e into master Nov 5, 2024
14 checks passed
@ceyonur ceyonur deleted the pausable-uptime-manager branch November 5, 2024 21:48
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.

5 participants