-
Notifications
You must be signed in to change notification settings - Fork 704
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 4 - minimal UT infra cleanup #2332
Conversation
@@ -36,7 +36,7 @@ func TestBoundedBy(t *testing.T) { | |||
End: bEndTime, | |||
Wght: defaultWeight, | |||
} | |||
require.False(BoundedBy(a.StartTime(), b.EndTime(), b.StartTime(), b.EndTime())) | |||
require.False(BoundedBy(a.StartTime(), a.EndTime(), b.StartTime(), b.EndTime())) |
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 a test fix
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.
Nits and suggestions only.
@@ -691,8 +697,8 @@ func TestGetCurrentValidators(t *testing.T) { | |||
require.Len(*innerVdr.Delegators, 1) | |||
delegator := (*innerVdr.Delegators)[0] | |||
require.Equal(delegator.NodeID, innerVdr.NodeID) | |||
require.Equal(uint64(delegator.StartTime), delegatorStartTime) | |||
require.Equal(uint64(delegator.EndTime), delegatorEndTime) | |||
require.Equal(int64(delegator.StartTime), delegatorStartTime.Unix()) |
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.
(No action required) Maybe call Unix() where these are defined rather than at each point of use?
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.
It's annoying but I use delegatorStartTime
as time.Time too, so can't redefine it as uint64
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.
Are you talking about for Add
? Because adding (or comparing) seconds doesn't require a time type.
…/avalanchego into post_durango_minimal_test_infra
vms/platformvm/service_test.go
Outdated
balance := defaultBalance | ||
if idx == 0 { | ||
// we use the first key to fund a subnet creation in [defaultGenesis]. | ||
// As such we need to account for the subnet creation fee | ||
balance = defaultBalance - service.vm.Config.GetCreateBlockchainTxFee(service.vm.clock.Time()) | ||
} |
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 needed because the prior fee was 0 - now this test runs with a CreateSubnetTx fee that is non-0.
Why this should be merged
P-chain UT are not great, especially when it comes to testing forks. There is a whole PRs thread that addresses the issue (see #2453). This PR does the bare minumim to allow testing of Drop pending in Durango fork
How this works
Mostly is editing test environments constructors to explicitly set the fork we target in the test and a sensible fork time (that respects forks ordering at the very least). Test environment are some UT helper structs that acts as a vm in packages where we cannot reference platformvm.VM (due to import cycles)
How this was tested
This is just fixing some UTs.