Skip to content

Commit c2ff5ff

Browse files
Fix proposervm.GetAncestors test flake (ava-labs#1572)
1 parent 842a6ab commit c2ff5ff

File tree

4 files changed

+118
-125
lines changed

4 files changed

+118
-125
lines changed

vms/platformvm/blocks/executor/proposal_block_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ func TestApricotProposalBlockTimeVerification(t *testing.T) {
113113
onParentAccept.EXPECT().GetDelegateeReward(constants.PrimaryNetworkID, utx.NodeID()).Return(uint64(0), nil).AnyTimes()
114114

115115
env.mockedState.EXPECT().GetUptime(gomock.Any(), constants.PrimaryNetworkID).Return(
116-
time.Duration(1000), /*upDuration*/
117-
time.Time{}, /*lastUpdated*/
118-
nil, /*err*/
116+
time.Microsecond, /*upDuration*/
117+
time.Time{}, /*lastUpdated*/
118+
nil, /*err*/
119119
).AnyTimes()
120120

121121
// wrong height
@@ -240,9 +240,9 @@ func TestBanffProposalBlockTimeVerification(t *testing.T) {
240240
onParentAccept.EXPECT().GetPendingStakerIterator().Return(pendingStakersIt, nil).AnyTimes()
241241

242242
env.mockedState.EXPECT().GetUptime(gomock.Any(), gomock.Any()).Return(
243-
time.Duration(1000), /*upDuration*/
244-
time.Time{}, /*lastUpdated*/
245-
nil, /*err*/
243+
time.Microsecond, /*upDuration*/
244+
time.Time{}, /*lastUpdated*/
245+
nil, /*err*/
246246
).AnyTimes()
247247

248248
// create proposal tx to be included in the proposal block

vms/platformvm/state/validator_metadata_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func TestParseValidatorMetadata(t *testing.T) {
218218
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x86, 0xA0,
219219
},
220220
expected: &validatorMetadata{
221-
UpDuration: time.Duration(6000000),
221+
UpDuration: 6000000,
222222
LastUpdated: 900000,
223223
PotentialReward: 100000,
224224
lastUpdated: time.Unix(900000, 0),
@@ -240,7 +240,7 @@ func TestParseValidatorMetadata(t *testing.T) {
240240
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4E, 0x20,
241241
},
242242
expected: &validatorMetadata{
243-
UpDuration: time.Duration(6000000),
243+
UpDuration: 6000000,
244244
LastUpdated: 900000,
245245
PotentialReward: 100000,
246246
PotentialDelegateeReward: 20000,

vms/platformvm/txs/executor/staker_tx_verification_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ func TestGetValidatorRules(t *testing.T) {
640640
assetID: customAssetID,
641641
minValidatorStake: config.MinValidatorStake,
642642
maxValidatorStake: config.MaxValidatorStake,
643-
minStakeDuration: time.Duration(1337) * time.Second,
644-
maxStakeDuration: time.Duration(42) * time.Second,
643+
minStakeDuration: 1337 * time.Second,
644+
maxStakeDuration: 42 * time.Second,
645645
minDelegationFee: config.MinDelegationFee,
646646
},
647647
expectedErr: nil,
@@ -760,8 +760,8 @@ func TestGetDelegatorRules(t *testing.T) {
760760
assetID: customAssetID,
761761
minDelegatorStake: config.MinDelegatorStake,
762762
maxValidatorStake: config.MaxValidatorStake,
763-
minStakeDuration: time.Duration(1337) * time.Second,
764-
maxStakeDuration: time.Duration(42) * time.Second,
763+
minStakeDuration: 1337 * time.Second,
764+
maxStakeDuration: 42 * time.Second,
765765
maxValidatorWeightFactor: 21,
766766
},
767767
expectedErr: nil,

0 commit comments

Comments
 (0)