-
Notifications
You must be signed in to change notification settings - Fork 674
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
ACP-77: Update P-chain state staker tests #3494
Conversation
valOut := valsMap[staker.NodeID] | ||
r.Equal(valOut.NodeID, staker.NodeID) | ||
r.Equal(valOut.Weight, val.Weight+staker.Weight) | ||
expectedPublicKeyDiff: maybe.Some[*bls.PublicKey](nil), |
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.
why would adding a validator not update the publicKeyDiff
?
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.
This is specifying a key diff (providing a maybe.Some
means there is a key diff present). Adding a validator results in a key diff where the prior value was nil
.
}, | ||
expectedWeightDiff: &ValidatorWeightDiff{ | ||
Decrease: false, | ||
Amount: primaryNetworkCurrentDelegatorStaker.Weight, | ||
}, |
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.
for these tests why not also sanity check the expectedPublicKeyDiff
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.
These tests are verifying that there is no public key diff.
Weight: uint64(i + 1), | ||
StartTime: primaryStaker.StartTime, | ||
EndTime: primaryStaker.EndTime, | ||
PotentialReward: uint64(i + 1), |
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.
doesn't seem like we use PotentialReward
anyway, but if start time and end time are the same, then shouldn't the potential reward be 0?
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.
if start time and end time are the same
endTime
is 24h after startTime
throughout this test, but you're right these values don't really matter for this test.
Why this should be merged
Factored out of #3487.
TestPersistStakers
asTestState_writeStakers
which uses test tables rather than extensive callbacks.TestState_writeStakers
to not break the invariants around subnet validators being a sub-set of the primary network validator set.TestStateAddRemoveValidator
asTestState_ApplyValidatorDiffs
which includes additional cases, such as adding an removing validators in the same diff.How this works
Generally cleans up existing tests and improves coverage.
How this was tested
Only tests are modified.