forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 3
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
[PVM] Adjustment of validator uptime on reactivation #189
Open
charalarg
wants to merge
1
commit into
dev
Choose a base branch
from
poc-update-uptime
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
charalarg
changed the title
[PVM] Adjustment of validator uptime on reactivation
[PVM, STATE] Adjustment of validator uptime on reactivation
Feb 23, 2023
charalarg
force-pushed
the
poc-update-uptime
branch
2 times, most recently
from
February 23, 2023 09:54
7a36def
to
2072568
Compare
charalarg
changed the title
[PVM, STATE] Adjustment of validator uptime on reactivation
TECH-72: Adjustment of validator uptime on reactivation
Feb 23, 2023
charalarg
changed the title
TECH-72: Adjustment of validator uptime on reactivation
TECH-727: Adjustment of validator uptime on reactivation
Feb 23, 2023
charalarg
changed the title
TECH-727: Adjustment of validator uptime on reactivation
TECH-724: Adjustment of validator uptime on reactivation
Feb 23, 2023
charalarg
force-pushed
the
poc-update-uptime
branch
from
February 23, 2023 12:59
2072568
to
e8955ef
Compare
charalarg
force-pushed
the
poc-update-uptime
branch
from
February 28, 2023 15:22
e8955ef
to
e417cd9
Compare
evlekht
requested changes
Mar 2, 2023
charalarg
force-pushed
the
poc-update-uptime
branch
from
March 3, 2023 12:33
e417cd9
to
e828478
Compare
charalarg
force-pushed
the
poc-update-uptime
branch
from
March 21, 2023 11:27
e828478
to
73b27cc
Compare
c4t-ag
reviewed
Mar 27, 2023
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.
Wouldn't it be much easier regarding implementation if we wrap the *Staker around a struct which has a member "suspendedUptime"? Something like:
struct {
Staker
suspendUptime
}
charalarg
changed the title
TECH-724: Adjustment of validator uptime on reactivation
[PVM] Adjustment of validator uptime on reactivation
Apr 6, 2023
charalarg
force-pushed
the
poc-update-uptime
branch
2 times, most recently
from
May 31, 2023 08:52
974e562
to
058d579
Compare
charalarg
force-pushed
the
poc-update-uptime
branch
from
May 31, 2023 09:54
058d579
to
a8bfaab
Compare
peak3d
force-pushed
the
dev
branch
3 times, most recently
from
July 3, 2023 10:38
fee8858
to
c61241b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adjusts the uptime of a suspended validator at its reactivation time because by default when its moved back to the current set, its uptime starts from 0 but the uptime percentage is calculated from its initial start time ending up in an invalid value.
Important note: This invalid value is only stored on a mapping in state and not on disc. And this happens because when we reactivate the validator, the
LoadUptime
is being called which is not altering anything on disc. So, if we boot up a brand new node and request the uptime of the reactivated validator it will be calculated from its initial value.With this PR we are updating the uptime of the reactivated validator both on the mapping and in db's state, thus they will be in sync.
Changes
setValidatorUptime
call on validator reactivationsetValidatorUptime
function in statesetUptime
function we needed to make a cross reference betweenstate
andcaminoState
.Remarks
This implementation is just a POC proving that the uptime update works.
Further discussions, thoughts and tests needed in order to conclude to this implementation