-
Notifications
You must be signed in to change notification settings - Fork 701
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
Drop Pending Stakers 5 - validated PostDurango StakerTxs #2314
Conversation
// move time ahead, promoting the validator to current | ||
currentTime := stakerTx.StartTime() | ||
vm.clock.Set(currentTime) | ||
vm.state.SetTimestamp(currentTime) | ||
|
||
blk, err = vm.Builder.BuildBlock(context.Background()) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed building block: %w", err) | ||
} | ||
if err := blk.Verify(context.Background()); err != nil { | ||
return nil, fmt.Errorf("failed verifying block: %w", err) | ||
} | ||
if err := blk.Accept(context.Background()); err != nil { | ||
return nil, fmt.Errorf("failed accepting block: %w", err) | ||
} | ||
if err := vm.SetPreference(context.Background(), vm.manager.LastAccepted()); err != nil { | ||
return nil, fmt.Errorf("failed setting preference: %w", err) | ||
} | ||
|
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.
Durango active here, no more pending
95b949e
to
8266e5e
Compare
vms/platformvm/service_test.go
Outdated
@@ -73,7 +73,7 @@ var ( | |||
) | |||
|
|||
func defaultService(t *testing.T) (*Service, *mutableSharedMemory) { | |||
vm, _, mutableSharedMemory := defaultVM(t) | |||
vm, _, mutableSharedMemory := defaultVM(t, latestFork) |
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.
P-chain UTs do not handle correctly forks at the moment.
Where is a bunch of PRs geared to fix this (see #2169).
While we wait to have them reviewed and merged, this is the minimal amount of changes I needed to have this PR tested meaningfully.
…into post_durango_stakerTxs_verification
527251b
to
eadfbe1
Compare
// to allow the verifier visitor to explicitly check for this error. | ||
maxStartTime := currentTimestamp.Add(MaxFutureStartTime) | ||
if preDurangoStartTime.After(maxStartTime) { | ||
return nil, ErrFutureStakeTime |
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.
we must guarantee this is the last error that occurs, if an error occurs.
Should be possible to cleanup post fork actiation
@@ -40,11 +40,6 @@ func (v *Validator) EndTime() time.Time { | |||
return time.Unix(int64(v.End), 0) | |||
} | |||
|
|||
// Duration is the amount of time that this validator will be in the validator set | |||
func (v *Validator) Duration() time.Duration { |
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.
Post Durango this is evil. Start and End are there for backward compatiblity reasons, but result has nothing to do with staking duration. Better bury this method
…/avalanchego into post_durango_minimal_test_infra
…erTxs_verification
…erTxs_verification
…erTxs_verification
commit 7a0dfda Author: Joshua Kim <[email protected]> Date: Tue Dec 12 03:29:47 2023 -0500 testing structs Signed-off-by: Joshua Kim <[email protected]> commit 58d2779 Author: Dhruba Basu <[email protected]> Date: Tue Dec 19 14:01:16 2023 -0500 Dedupe secp256k1 key usage in tests (#2511) commit 6c64372 Author: Dhruba Basu <[email protected]> Date: Tue Dec 19 11:45:58 2023 -0500 Remove unused `AcceptorTracker` struct (#2508) commit 7a9bdad Author: Dhruba Basu <[email protected]> Date: Tue Dec 19 10:44:20 2023 -0500 Remove unused `BuildGenesisTest` function (#2503) commit 44d71db Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Dec 18 19:05:26 2023 -0500 Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#2502) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Stephen Buttolph <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stephen Buttolph <[email protected]> commit aa764bb Author: Alberto Benegiamo <[email protected]> Date: Mon Dec 18 16:00:17 2023 -0700 Drop Pending Stakers 5 - validated PostDurango StakerTxs (#2314) Co-authored-by: Stephen Buttolph <[email protected]> Co-authored-by: dhrubabasu <[email protected]> Signed-off-by: Joshua Kim <[email protected]>
commit 7a0dfda Author: Joshua Kim <[email protected]> Date: Tue Dec 12 03:29:47 2023 -0500 testing structs Signed-off-by: Joshua Kim <[email protected]> commit 58d2779 Author: Dhruba Basu <[email protected]> Date: Tue Dec 19 14:01:16 2023 -0500 Dedupe secp256k1 key usage in tests (#2511) commit 6c64372 Author: Dhruba Basu <[email protected]> Date: Tue Dec 19 11:45:58 2023 -0500 Remove unused `AcceptorTracker` struct (#2508) commit 7a9bdad Author: Dhruba Basu <[email protected]> Date: Tue Dec 19 10:44:20 2023 -0500 Remove unused `BuildGenesisTest` function (#2503) commit 44d71db Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Dec 18 19:05:26 2023 -0500 Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#2502) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Stephen Buttolph <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stephen Buttolph <[email protected]> commit aa764bb Author: Alberto Benegiamo <[email protected]> Date: Mon Dec 18 16:00:17 2023 -0700 Drop Pending Stakers 5 - validated PostDurango StakerTxs (#2314) Co-authored-by: Stephen Buttolph <[email protected]> Co-authored-by: dhrubabasu <[email protected]> Signed-off-by: Joshua Kim <[email protected]>
Why this should be merged
This is the main PR containing the drop of pending validators.
AddStakerTx.StartTime is not anymore validated by itself; instead staking duration (AddStakerTx.EndTime - chainTime) is validated. Stakers are immediately marked as current instead of pending ones.
How this works
Slicing #2175 up
How this was tested