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

Reward itest suite #1362

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 21 additions & 15 deletions itests/reward_distribution_info_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ type RewardDistributionAPIRewardInfoPreactivatedSuite struct {
func (suite *RewardDistributionAPIRewardInfoPreactivatedSuite) Test_NODE855() {
const node855 = "/blockchain/rewards returns correct values for term," +
" nextCheck and votingIntervalStart after CappedReward activation"
td := testdata.GetRewardInfoApiAfterPreactivated20TestData(&suite.BaseSuite)
suite.Run(node855, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
reward.GetRewardInfoAndChecks(&suite.BaseSuite, td)
utl.WaitForHeight(&suite.BaseSuite, uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite)))+utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)-1)
reward.GetRewardInfoAndChecks(&suite.BaseSuite, testdata.GetRewardInfoApiAfterPreactivated20TestData)
})
}

Expand All @@ -43,13 +44,13 @@ type RewardDistributionAPIRewardInfoSupportedSuite struct {
func (suite *RewardDistributionAPIRewardInfoSupportedSuite) Test_NODE855_2() {
const node855 = "/blockchain/rewards returns correct values for term," +
" nextCheck and votingIntervalStart after CappedReward activation"
tdBefore20 := testdata.GetRewardInfoApiBefore20TestData(&suite.BaseSuite)
tdAfter20 := testdata.GetRewardInfoApiAfterSupported20TestData(&suite.BaseSuite)
suite.Run(node855, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution)
reward.GetRewardInfoAndChecks(&suite.BaseSuite, tdBefore20)
reward.GetRewardInfoAndChecks(&suite.BaseSuite, testdata.GetRewardInfoApiBefore20TestData)
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.CappedRewards)
reward.GetRewardInfoAndChecks(&suite.BaseSuite, tdAfter20)
utl.WaitForHeight(&suite.BaseSuite, uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite)))+utl.GetRewardTermAfter20Cfg(&suite.BaseSuite))
reward.GetRewardInfoAndChecks(&suite.BaseSuite, testdata.GetRewardInfoApiAfterSupported20TestData)
})
}

Expand All @@ -67,12 +68,15 @@ type RewardDistributionAPIRewardInfoAtHeightPreactivatedSuite struct {
func (suite *RewardDistributionAPIRewardInfoAtHeightPreactivatedSuite) Test_NODE856() {
const node856 = "/blockchain/rewards/{height} returns correct values for term," +
" nextCheck and votingIntervalStart after CappedReward activation"
td := testdata.GetRewardInfoApiAfterPreactivated20TestData(&suite.BaseSuite)
suite.Run(node856, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution,
settings.CappedRewards)
reward.GetRewardInfoAtHeightAndChecks(&suite.BaseSuite, td, uint64(utl.GetFeatureActivationHeight(
&suite.BaseSuite, settings.CappedRewards, utl.GetHeight(&suite.BaseSuite))+1))
utl.WaitForHeight(&suite.BaseSuite, uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite)))+utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)-1)
reward.GetRewardInfoAtHeightAndChecks(&suite.BaseSuite, testdata.GetRewardInfoApiAfterPreactivated20TestData,
uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite)))+
utl.GetRewardTermAfter20Cfg(&suite.BaseSuite)-1)
})
}

Expand All @@ -88,15 +92,17 @@ type RewardDistributionAPIRewardInfoAtHeightSupportedSuite struct {
func (suite *RewardDistributionAPIRewardInfoAtHeightSupportedSuite) Test_NODE856_2() {
const node856 = "/blockchain/rewards/{height} returns correct values for term," +
" nextCheck and votingIntervalStart after CappedReward activation"
tdBefore20 := testdata.GetRewardInfoApiBefore20TestData(&suite.BaseSuite)
tdAfter20 := testdata.GetRewardInfoApiAfterSupported20TestData(&suite.BaseSuite)
suite.Run(node856, func() {
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.BlockReward, settings.BlockRewardDistribution)
reward.GetRewardInfoAtHeightAndChecks(&suite.BaseSuite, tdBefore20, uint64(utl.GetFeatureActivationHeight(
&suite.BaseSuite, settings.BlockRewardDistribution, utl.GetHeight(&suite.BaseSuite))+1))
reward.GetRewardInfoAtHeightAndChecks(&suite.BaseSuite, testdata.GetRewardInfoApiBefore20TestData,
uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite, settings.BlockRewardDistribution,
utl.GetHeight(&suite.BaseSuite))+1))
utl.GetActivationOfFeatures(&suite.BaseSuite, settings.CappedRewards)
reward.GetRewardInfoAtHeightAndChecks(&suite.BaseSuite, tdAfter20, uint64(utl.GetFeatureActivationHeight(
&suite.BaseSuite, settings.CappedRewards, utl.GetHeight(&suite.BaseSuite))))
utl.WaitForHeight(&suite.BaseSuite, uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite)))+utl.GetRewardTermAfter20Cfg(&suite.BaseSuite))
reward.GetRewardInfoAtHeightAndChecks(&suite.BaseSuite, testdata.GetRewardInfoApiAfterSupported20TestData,
uint64(utl.GetFeatureActivationHeight(&suite.BaseSuite,
settings.CappedRewards, utl.GetHeight(&suite.BaseSuite)))+utl.GetRewardTermAfter20Cfg(&suite.BaseSuite))
})
}

Expand Down
50 changes: 25 additions & 25 deletions itests/testdata/reward_distribution_features_testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func GetRewardIncreaseDaoXtnTestData(suite *f.BaseSuite, addresses AddressesForD
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -105,7 +105,7 @@ func GetRewardUnchangedDaoXtnTestData(suite *f.BaseSuite, addresses AddressesFor
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -118,7 +118,7 @@ func GetRewardUnchangedDaoXtnTestData(suite *f.BaseSuite, addresses AddressesFor
// NODE - 816
func GetRewardDecreaseDaoXtnTestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -138,7 +138,7 @@ func GetRewardIncreaseDaoTestData(suite *f.BaseSuite, addresses AddressesForDist
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -154,7 +154,7 @@ func GetRewardUnchangedXtnTestData(suite *f.BaseSuite, addresses AddressesForDis
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - MaxAddressReward,
DaoDiffBalance: 0,
XtnDiffBalance: MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -167,7 +167,7 @@ func GetRewardUnchangedXtnTestData(suite *f.BaseSuite, addresses AddressesForDis
// NODE - 818
func GetRewardDecreaseXtnTestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -184,7 +184,7 @@ func GetRewardDecreaseXtnTestData(suite *f.BaseSuite, addresses AddressesForDist
// NODE - 818
func GetRewardDecreaseDaoTestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -204,7 +204,7 @@ func GetReward2WUnchangedDaoXtnTestData(suite *f.BaseSuite, addresses AddressesF
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -220,7 +220,7 @@ func GetRewardMinersTestData(suite *f.BaseSuite, addresses AddressesForDistribut
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -236,7 +236,7 @@ func GetRewardDaoXtnWithout19TestData(suite *f.BaseSuite, addresses AddressesFor
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -260,7 +260,7 @@ func GetRewardIncreaseDaoXtnCeaseXTNBuybackBeforePeriodTestData(suite *f.BaseSui
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -272,7 +272,7 @@ func GetRewardIncreaseDaoXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSuit
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -288,7 +288,7 @@ func GetRewardIncreaseXtnCeaseXTNBuybackBeforePeriodTestData(suite *f.BaseSuite,
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - MaxAddressReward,
DaoDiffBalance: 0,
XtnDiffBalance: MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -300,7 +300,7 @@ func GetRewardIncreaseXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSuite,
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -316,7 +316,7 @@ func GetRewardUnchangedDaoXtnCeaseXTNBuybackBeforePeriodTestData(suite *f.BaseSu
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - 2*MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - 2*MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: MaxAddressReward,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -328,7 +328,7 @@ func GetRewardUnchangedDaoXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSui
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)) - MaxAddressReward,
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)) - MaxAddressReward,
DaoDiffBalance: MaxAddressReward,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -341,7 +341,7 @@ func GetRewardUnchangedDaoXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSui
// NODE - 826
func GetRewardDecreaseDaoXtnCeaseXTNBuybackBeforePeriodTestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -354,7 +354,7 @@ func GetRewardDecreaseDaoXtnCeaseXTNBuybackBeforePeriodTestData(suite *f.BaseSui

func GetRewardDecreaseDaoXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -371,7 +371,7 @@ func GetRewardDecreaseDaoXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSuit
// NODE - 826
func GetRewardDecreaseXtnCeaseXTNBuybackBeforePeriodTestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -387,7 +387,7 @@ func GetRewardDecreaseXtnCeaseXTNBuybackAfterPeriodTestData(suite *f.BaseSuite,
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -403,7 +403,7 @@ func GetReward2WUnchangedDaoXtnCeaseXTNBuybackTestData(suite *f.BaseSuite, addre
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -419,7 +419,7 @@ func GetReward5W2MinersIncreaseCeaseXTNBuybackTestData(suite *f.BaseSuite, addre
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermAfter20Cfg(suite),
Expand All @@ -432,7 +432,7 @@ func GetReward5W2MinersIncreaseCeaseXTNBuybackTestData(suite *f.BaseSuite, addre
// NODE - 830
func GetRewardDaoXtnBeforePeriodWithout20TestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -445,7 +445,7 @@ func GetRewardDaoXtnBeforePeriodWithout20TestData(suite *f.BaseSuite, addresses

func GetRewardDaoXtnAfterPeriodWithout20TestData(suite *f.BaseSuite, addresses AddressesForDistribution,
height uint64) RewardDistributionTestData[RewardDistributionExpectedValues] {
currentReward := int64(utl.GetCurrentReward(suite, height))
currentReward := int64(utl.GetCurrentRewardAtHeight(suite, height))
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
Expand All @@ -465,7 +465,7 @@ func GetRewardDaoXtnWithout19And20TestData(suite *f.BaseSuite, addresses Address
return NewRewardDistributionTestData(
addresses,
RewardDistributionExpectedValues{
MinersSumDiffBalance: int64(utl.GetCurrentReward(suite, height)),
MinersSumDiffBalance: int64(utl.GetCurrentRewardAtHeight(suite, height)),
DaoDiffBalance: 0,
XtnDiffBalance: 0,
Term: utl.GetRewardTermCfg(suite),
Expand Down
Loading
Loading