Skip to content
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

Integration tests infrastructure refactoring. Separation of creation … #1492

Merged
merged 48 commits into from
Sep 27, 2024
Merged
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f3fb43f
Integration tests infrastructure refactoring. Separation of creation …
alexeykiselev Sep 10, 2024
f2281c2
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 10, 2024
e1dfe34
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 10, 2024
b5a2fe1
Update GolangCI-Lint to version 1.60.3.
alexeykiselev Sep 10, 2024
88280f6
Handle linter issue.
alexeykiselev Sep 10, 2024
47e161c
Fixed logging of diverged state hashes.
alexeykiselev Sep 11, 2024
8235936
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 12, 2024
548e3cb
Better error handling and other requested changes implemented.
alexeykiselev Sep 13, 2024
5382770
Fix error handling by adding named return parameter.
alexeykiselev Sep 13, 2024
3fbb2a3
Activation of feature "Fee Sponsorship" added to some negative tests.
alexeykiselev Sep 13, 2024
4ce1485
Replaced waiting for activation of sponsorship by waiting for the cer…
alexeykiselev Sep 13, 2024
b6d3533
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 13, 2024
e21ee4a
Introduce constant for default sponsorship activation height. Comment…
alexeykiselev Sep 13, 2024
c3a7ce2
Merge branch 'itest-infra-refactoring' of github.com:wavesplatform/go…
alexeykiselev Sep 13, 2024
12ef74e
Few itests fixed by using height to build expected data.
alexeykiselev Sep 16, 2024
f12e92d
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 16, 2024
4c4b314
Default XTN buyback period increased to 4 blocks.
alexeykiselev Sep 18, 2024
cae47a7
New utility function to wait for new height if it lower than given ad…
alexeykiselev Sep 18, 2024
f037586
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 18, 2024
7588ded
Waiting for height added to one more blinking test.
alexeykiselev Sep 18, 2024
e03bbb9
More blinking tests fixed by adding waiting for new height.
alexeykiselev Sep 18, 2024
2aba685
Two more blinking tests fixed.
alexeykiselev Sep 18, 2024
a31e3ce
Waiting for height 3 added to all related test.
alexeykiselev Sep 19, 2024
65073e7
Merge branch 'master' into itest-infra-refactoring
nickeskov Sep 19, 2024
42e70d0
Waiting for certain height removed from all blinking tests.
alexeykiselev Sep 20, 2024
e5dc67d
Implemented function to request balances by list of addresses in a sy…
alexeykiselev Sep 24, 2024
bc4782c
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 24, 2024
b0602e6
Merge branch 'itest-infra-refactoring' into remove-waiting
alexeykiselev Sep 24, 2024
8bf75e8
Merge branch 'itest-infra-refactoring' of github.com:wavesplatform/go…
alexeykiselev Sep 24, 2024
7eeac68
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 24, 2024
0da968f
Remove incorrect file.
alexeykiselev Sep 24, 2024
38d2836
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 25, 2024
8552b45
Merge branch 'master' into itest-infra-refactoring
nickeskov Sep 25, 2024
61d41e1
Reduce file permisions on test directories.
alexeykiselev Sep 26, 2024
dd86d8f
Add writing to itest logs directories.
alexeykiselev Sep 26, 2024
417f872
Add write permission to logs folders of itests.
alexeykiselev Sep 26, 2024
e81e4fc
Restored full permissions to itests folders.
alexeykiselev Sep 26, 2024
b6d6c1a
Run in parallel internals of some wait methods of 'NodesClients'.
nickeskov Sep 27, 2024
18ff648
Fix data race and refactor 'NodesClients.requestAvailableBalancesForA…
nickeskov Sep 27, 2024
9b17a38
Fix typo in 'getSynchronizedBalances'.
nickeskov Sep 27, 2024
779b049
Merge branch 'master' into itest-infra-refactoring
alexeykiselev Sep 27, 2024
af6aa8b
Fix bug with deadlock in 'NodesClients.WaitForConnectedPeers'.
nickeskov Sep 27, 2024
469b642
Refactor 'NodesClients.WaitForConnectedPeers'
nickeskov Sep 27, 2024
72e6a24
Move API key string to the constant.
alexeykiselev Sep 27, 2024
b7bdc83
Removed unnecessary context cancelling.
nickeskov Sep 27, 2024
e4e9d73
Merge branch 'itest-infra-refactoring.errgroup' into itest-infra-refa…
alexeykiselev Sep 27, 2024
d6f0f04
Handle error.
alexeykiselev Sep 27, 2024
62a5ca6
Merge branch 'master' into itest-infra-refactoring
nickeskov Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Waiting for height 3 added to all related test.
Expected balaces values calculated based on number of generated blocks.
alexeykiselev committed Sep 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit a31e3ce56a18df6aa643fb379e4483bacbcfa3bb
15 changes: 15 additions & 0 deletions itests/reward_distribution_preactivated_features_internal_test.go
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ func (suite *RewardDistributionIncreaseDaoXtnPreactivatedSuite) Test_NODE815() {
suite.Run(node815, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite,
addresses, testdata.GetRewardIncreaseDaoXtnTestData)
})
@@ -63,6 +64,7 @@ func (suite *RewardDistributionUnchangedDaoXtnPreactivatedSuite) Test_NODE815_2(
suite.Run(node815, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardUnchangedDaoXtnTestData)
})
@@ -106,6 +108,7 @@ func (suite *RewardDistributionIncreaseDaoPreactivatedSuite) Test_NODE817() {
suite.Run(node817, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardIncreaseDaoTestData)
})
@@ -125,6 +128,7 @@ func (suite *RewardDistributionUnchangedXtnPreactivatedSuite) Test_NODE817_2() {
suite.Run(node817, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardUnchangedXtnTestData)
})
@@ -146,6 +150,7 @@ func (suite *RewardDistributionDecreaseXtnPreactivatedSuite) Test_NODE818() {
suite.Run(node818, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDecreaseXtnTestData)
})
@@ -165,6 +170,7 @@ func (suite *RewardDistributionDecreaseDaoPreactivatedSuite) Test_NODE818_2() {
suite.Run(node818, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDecreaseDaoTestData)
})
@@ -184,6 +190,7 @@ func (suite *RewardDistribution2WUnchangedDaoXtnPreactivatedSuite) Test_NODE818_
suite.Run(node818, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetReward2WUnchangedDaoXtnTestData)
})
@@ -226,6 +233,7 @@ func (suite *RewardDistributionDaoXtnPreactivatedWithout19Suite) Test_NODE821()
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node821, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDaoXtnWithout19TestData)
})
@@ -248,6 +256,7 @@ func (suite *RewardDistributionIncreaseDaoXtnCeaseXTNBuybackPreactivatedSuite) T
suite.Run(node825, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardIncreaseDaoXtnCeaseXTNBuybackBeforePeriodTestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
@@ -305,6 +314,7 @@ func (suite *RewardUnchangedDaoXtnCeaseXTNBuybackPreactivatedSuite) Test_NODE825
suite.Run(node825, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardUnchangedDaoXtnCeaseXTNBuybackBeforePeriodTestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
@@ -333,6 +343,7 @@ func (suite *RewardDecreaseDaoXtnCeaseXTNBuybackPreactivatedSuite) Test_NODE826(
suite.Run(node826, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDecreaseDaoXtnCeaseXTNBuybackBeforePeriodTestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
@@ -361,6 +372,7 @@ func (suite *RewardDecreaseXtnCeaseXTNBuybackPreactivatedSuite) Test_NODE826_2()
suite.Run(node826, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDecreaseXtnCeaseXTNBuybackBeforePeriodTestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
@@ -389,6 +401,7 @@ func (suite *Reward2WUnchangedDaoXtnCeaseXTNBuybackPreactivatedSuite) Test_NODE8
suite.Run(node826, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetReward2WUnchangedDaoXtnCeaseXTNBuybackTestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
@@ -417,6 +430,7 @@ func (suite *Reward5W2MinersIncreaseCeaseXTNBuybackPreactivatedSuite) Test_NODE8
suite.Run(node829, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetReward5W2MinersIncreaseCeaseXTNBuybackTestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
@@ -471,6 +485,7 @@ func (suite *RewardDaoXtnPreactivatedWithout19And20Suite) Test_NODE830_2() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node830, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.XTNBuyBackCessation)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRewardDaoXtnWithout19And20TestData)
ceaseXtnBuybackHeight := utl.GetXtnBuybackPeriodCfg(&suite.BaseSuite)
utl.WaitForHeight(&suite.BaseSuite, ceaseXtnBuybackHeight)
11 changes: 8 additions & 3 deletions itests/reward_distribution_rollback_internal_test.go
Original file line number Diff line number Diff line change
@@ -23,13 +23,14 @@ func (suite *RewardDistributionAPIRollbackBeforeF19Suite) Test_NODE858() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node858, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution)
activationH19 := utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.BlockRewardDistribution, utl.GetHeight(&suite.BaseSuite))
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackBeforeF19TestData)
utl.GetRollbackToHeight(&suite.BaseSuite, uint64(activationH19-3), true)
utl.GetRollbackToHeight(&suite.BaseSuite, activationH19-3, true)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackBeforeF19TestData)
})
@@ -50,6 +51,7 @@ func (suite *RewardDistributionAPIRollbackAfterF19Suite) Test_NODE859() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node859, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackAfterF19TestData)
activationH19 := utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.BlockRewardDistribution, utl.GetHeight(&suite.BaseSuite))
@@ -75,14 +77,15 @@ func (suite *RewardDistributionAPIRollbackBeforeF20Suite) Test_NODE860() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node860, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution, settings.CappedRewards)
activationH20 := utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite))
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackBeforeF20TestData)
utl.GetRollbackToHeight(&suite.BaseSuite,
uint64(activationH20)-utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)+1, true)
activationH20-utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)+1, true)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution, settings.CappedRewards)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackBeforeF20TestData)
})
@@ -104,6 +107,7 @@ func (suite *RewardDistributionAPIRollbackAfterF20Suite) Test_NODE861() {
suite.Run(node861, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite,
settings.BlockReward, settings.BlockRewardDistribution, settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackAfterF20TestData)
activationH20 := utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite))
@@ -131,6 +135,7 @@ func (suite *RewardDistributionAPIRollbackBeforeF21Suite) Test_NODE862() {
suite.Run(node862, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite,
settings.BlockReward, settings.BlockRewardDistribution, settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackBeforeF21TestData)
ceaseXtnBuybackHeight := utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.BlockRewardDistribution,
@@ -142,7 +147,7 @@ func (suite *RewardDistributionAPIRollbackBeforeF21Suite) Test_NODE862() {
utl.WaitForHeight(&suite.BaseSuite, ceaseXtnBuybackHeight)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses, testdata.GetRollbackAfterF21TestData)
utl.GetRollbackToHeight(&suite.BaseSuite,
uint64(activationH21)-utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)-1, true)
activationH21-utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)-1, true)
utl.GetActivationOfFeatures(&suite.BaseSuite,
settings.BlockReward, settings.BlockRewardDistribution, settings.CappedRewards,
settings.XTNBuyBackCessation)
16 changes: 16 additions & 0 deletions itests/reward_distribution_supported_features_internal_test.go
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ func (suite *RewardDistributionIncreaseDaoXtnSupportedSuite) Test_NODE815() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node815, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -48,6 +49,7 @@ func (suite *RewardDistributionUnchangedDaoXtnSupportedSuite) Test_NODE815_2() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node815, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -73,6 +75,7 @@ func (suite *RewardDistributionDecreaseDaoXtnSupportedSuite) Test_NODE816() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node816, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -98,6 +101,7 @@ func (suite *RewardDistributionIncreaseDaoSupportedSuite) Test_NODE817() {
addresses := testdata.GetAddressesMinersDao(&suite.BaseSuite)
suite.Run(node817, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -120,6 +124,7 @@ func (suite *RewardDistributionUnchangedXtnSupportedSuite) Test_NODE817_2() {
addresses := testdata.GetAddressesMinersXtn(&suite.BaseSuite)
suite.Run(node817, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -168,6 +173,7 @@ func (suite *RewardDistributionDecreaseDaoSupportedSuite) Test_NODE818_2() {
addresses := testdata.GetAddressesMinersDao(&suite.BaseSuite)
suite.Run(node818, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -190,6 +196,7 @@ func (suite *RewardDistribution2WUnchangedDaoXtnSupportedSuite) Test_NODE818_3()
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node818, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -215,6 +222,7 @@ func (suite *RewardDistributionIncreaseSupportedSuite) Test_NODE820() {
addresses := testdata.GetAddressesMiners(&suite.BaseSuite)
suite.Run(node820, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockRewardDistribution,
@@ -240,6 +248,7 @@ func (suite *RewardDistributionDaoXtnSupportedWithout19Suite) Test_NODE821() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node821, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDistributionAfterF14Before19TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.CappedRewards)
@@ -265,6 +274,7 @@ func (suite *RewardIncreaseDaoXtnCeaseXTNBuybackSupportedSuite) Test_NODE825() {
suite.Run(node825, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardIncreaseDaoXtnCeaseXTNBuybackBeforePeriodTestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
@@ -294,6 +304,7 @@ func (suite *RewardIncreaseXtnCeaseXTNBuybackSupportedSuite) Test_NODE825_2() {
suite.Run(node825, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward,
settings.BlockRewardDistribution, settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardIncreaseXtnCeaseXTNBuybackBeforePeriodTestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
@@ -323,6 +334,7 @@ func (suite *RewardUnchangedDaoXtnCeaseXTNBuybackSupportedSuite) Test_NODE825_3(
suite.Run(node825, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardUnchangedDaoXtnCeaseXTNBuybackBeforePeriodTestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
@@ -383,6 +395,7 @@ func (suite *RewardDecreaseXtnCeaseXTNBuybackSupportedSuite) Test_NODE826_2() {
suite.Run(node826, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDecreaseXtnCeaseXTNBuybackBeforePeriodTestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
@@ -412,6 +425,7 @@ func (suite *Reward2WUnchangedDaoXtnCeaseXTNBuybackSupportedSuite) Test_NODE826_
suite.Run(node826, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetReward2WUnchangedDaoXtnCeaseXTNBuybackTestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
@@ -441,6 +455,7 @@ func (suite *Reward5W2MinersIncreaseCeaseXTNBuybackSupportedSuite) Test_NODE829(
suite.Run(node829, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetReward5W2MinersIncreaseCeaseXTNBuybackTestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
@@ -468,6 +483,7 @@ func (suite *RewardDaoXtnSupportedWithout20Suite) Test_NODE830() {
addresses := testdata.GetAddressesMinersDaoXtn(&suite.BaseSuite)
suite.Run(node830, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution)
utl.WaitForNewHeightIfLessThan(&suite.BaseSuite, 3)
reward.GetRewardDistributionAndChecks(&suite.BaseSuite, addresses,
testdata.GetRewardDaoXtnBeforePeriodWithout20TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.XTNBuyBackCessation)
148 changes: 74 additions & 74 deletions itests/testdata/reward_distribution_features_testdata.go

Large diffs are not rendered by default.

56 changes: 31 additions & 25 deletions itests/testdata/reward_distribution_rolllback_testdata.go
Original file line number Diff line number Diff line change
@@ -6,10 +6,10 @@ import (
)

func GetRewardDistributionAfterF14Before19TestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
height uint64, n int64) RewardDistributionTestData[RewardDistributionExpectedValues] {
return NewRewardDistributionTestData(addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: n * (int64(utl.GetCurrentReward(suite, height))),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermCfg(suite),
@@ -20,14 +20,14 @@ func GetRewardDistributionAfterF14Before19TestData(suite *f.BaseSuite, addresses
// ("preactivated_14_supported_19_20/2miners_dao_xtn_without_f20.json")
// NODE - 858.
func GetRollbackBeforeF19TestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
height uint64, n int64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: currentReward - 2*currentReward/3,
DaoDiffBalance: currentReward / 3,
XtnDiffBalance: currentReward / 3,
MinersSumDiffBalance: n * (currentReward - 2*currentReward/3),
DaoDiffBalance: n * (currentReward / 3),
XtnDiffBalance: n * (currentReward / 3),
Term: utl.GetRewardTermCfg(suite),
})
}
@@ -36,14 +36,14 @@ func GetRollbackBeforeF19TestData(suite *f.BaseSuite, addresses AddressesForDist
// ("preactivated_14_19_20/2miners_dao_xtn_without_f20.json")
// NODE - 859.
func GetRollbackAfterF19TestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
height uint64, n int64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: currentReward / 3,
DaoDiffBalance: currentReward / 3,
XtnDiffBalance: currentReward / 3,
MinersSumDiffBalance: n * (currentReward / 3),
DaoDiffBalance: n * (currentReward / 3),
XtnDiffBalance: n * (currentReward / 3),
Term: utl.GetRewardTermCfg(suite),
})
}
@@ -52,51 +52,57 @@ func GetRollbackAfterF19TestData(suite *f.BaseSuite, addresses AddressesForDistr
// ("preactivated_14_supported_19_20/7W_2miners_dao_xtn_increase.json")
// NODE - 860
func GetRollbackBeforeF20TestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
height uint64, n int64) RewardDistributionTestData[RewardDistributionExpectedValues] {
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
MinersSumDiffBalance: n * (int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward),
DaoDiffBalance: n * MaxAddressReward,
XtnDiffBalance: n * MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
})
}

// 2 miners, dao, xtn, initR=700000000, increment = 100000000, desiredR = 900000000
// ("preactivated_14_19_20/7W_2miners_dao_xtn_increase.json")
// NODE - 861
func GetRollbackAfterF20TestData(suite *f.BaseSuite, addresses AddressesForDistribution, height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
func GetRollbackAfterF20TestData(
suite *f.BaseSuite, addresses AddressesForDistribution, height uint64, n int64,
) RewardDistributionTestData[RewardDistributionExpectedValues] {
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
MinersSumDiffBalance: n * (int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward),
DaoDiffBalance: n * MaxAddressReward,
XtnDiffBalance: n * MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
})
}

// 2 miners,dao, xtn, initR=600000000, increment = 100000000, desiredR = 800000000
// ("preactivated_14_19_20_supported_21/6W_2miners_dao_xtn_increase.json")
// NODE - 862.
func GetRollbackBeforeF21TestData(suite *f.BaseSuite, addresses AddressesForDistribution, height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
func GetRollbackBeforeF21TestData(
suite *f.BaseSuite, addresses AddressesForDistribution, height uint64, n int64,
) RewardDistributionTestData[RewardDistributionExpectedValues] {
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
MinersSumDiffBalance: n * (int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward),
DaoDiffBalance: n * MaxAddressReward,
XtnDiffBalance: n * MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
})
}

func GetRollbackAfterF21TestData(suite *f.BaseSuite, addresses AddressesForDistribution, height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
func GetRollbackAfterF21TestData(
suite *f.BaseSuite, addresses AddressesForDistribution, height uint64, n int64,
) RewardDistributionTestData[RewardDistributionExpectedValues] {
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetDesiredReward(suite, height)) - MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
MinersSumDiffBalance: n * (int64(utl.GetDesiredReward(suite, height)) - MaxAddressReward),
DaoDiffBalance: n * MaxAddressReward,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
})
17 changes: 12 additions & 5 deletions itests/utilities/reward/reward.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package reward

import (
"math"

f "github.com/wavesplatform/gowaves/itests/fixtures"
"github.com/wavesplatform/gowaves/itests/testdata"
utl "github.com/wavesplatform/gowaves/itests/utilities"
@@ -63,7 +65,7 @@ func getAddressesDiffBalances(suite *f.BaseSuite, currentSumMinersBalance, curre
}

func GetBlockRewardDistribution(suite *f.BaseSuite, addresses testdata.AddressesForDistribution) (
utl.RewardDiffBalancesInWaves, utl.RewardTerm, proto.Height) {
utl.RewardDiffBalancesInWaves, utl.RewardTerm, proto.Height, int64) {
// Get balances in waves before block applied.
suite.T().Log("Balances before applied block: ")
initHeight := utl.GetHeight(suite)
@@ -80,20 +82,25 @@ func GetBlockRewardDistribution(suite *f.BaseSuite, addresses testdata.Addresses
diffMinersSumBalances, diffDaoBalance, diffXtnBalance := getAddressesDiffBalances(suite, currentSumMinersBalance,
currentDaoBalance, currentXtnBalance, initSumMinersBalance, initDaoBalance, initXtnBalance,
initHeight, currentHeight)

hd := currentHeight - initHeight
if hd > math.MaxInt64 {
panic("should not happen: heights difference is greater than math.MaxInt64")
}
return utl.NewRewardDiffBalances(diffMinersSumBalances.BalanceInWavesGo, diffMinersSumBalances.BalanceInWavesScala,
diffDaoBalance.BalanceInWavesGo, diffDaoBalance.BalanceInWavesScala, diffXtnBalance.BalanceInWavesGo,
diffXtnBalance.BalanceInWavesScala), term, currentHeight
diffXtnBalance.BalanceInWavesScala), term, currentHeight, int64(hd)
}

type GetTestData func(suite *f.BaseSuite, addresses testdata.AddressesForDistribution,
height uint64) testdata.RewardDistributionTestData[testdata.RewardDistributionExpectedValues]
height uint64, n int64) testdata.RewardDistributionTestData[testdata.RewardDistributionExpectedValues]

func GetRewardDistributionAndChecks(suite *f.BaseSuite, addresses testdata.AddressesForDistribution,
testdata GetTestData) {
// Get reward for 1 block.
rewardDistributions, term, h := GetBlockRewardDistribution(suite, addresses)
rewardDistributions, term, h, n := GetBlockRewardDistribution(suite, addresses)
// Get expected results on current height
td := testdata(suite, addresses, h)
td := testdata(suite, addresses, h, n)
// Check results.
utl.TermCheck(suite.T(), td.Expected.Term, term.TermGo, term.TermScala)
utl.MinersSumDiffBalanceInWavesCheck(suite.T(), td.Expected.MinersSumDiffBalance,