Merge pull request #3596 from nspcc-dev/fix-test

This commit is contained in:
Roman Khimov 2024-10-04 13:06:57 +03:00 committed by GitHub
commit b1068b1ab9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 5 deletions

View file

@ -102,9 +102,9 @@ const (
effectiveVoterTurnout = 5 effectiveVoterTurnout = 5
// neoHolderRewardRatio is a percent of generated GAS that is distributed to NEO holders. // neoHolderRewardRatio is a percent of generated GAS that is distributed to NEO holders.
neoHolderRewardRatio = 10 neoHolderRewardRatio = 10
// neoHolderRewardRatio is a percent of generated GAS that is distributed to committee. // committeeRewardRatio is a percent of generated GAS that is distributed to committee.
committeeRewardRatio = 10 committeeRewardRatio = 10
// neoHolderRewardRatio is a percent of generated GAS that is distributed to voters. // voterRewardRatio is a percent of generated GAS that is distributed to voters.
voterRewardRatio = 80 voterRewardRatio = 80
// maxGetCandidatesRespLen is the maximum number of candidates to return from the // maxGetCandidatesRespLen is the maximum number of candidates to return from the

View file

@ -743,8 +743,9 @@ func TestNEO_CalculateBonus(t *testing.T) {
t.Run("Many blocks", func(t *testing.T) { t.Run("Many blocks", func(t *testing.T) {
amount := 100 amount := 100
defaultGASParBlock := 5 defaultGASPerBlock := 5
newGASPerBlock := 1 newGASPerBlock := 1
neoHolderRewardRatio := 10
initialGASBalance := e.Chain.GetUtilityTokenBalance(accH) initialGASBalance := e.Chain.GetUtilityTokenBalance(accH)
@ -764,8 +765,12 @@ func TestNEO_CalculateBonus(t *testing.T) {
h := acc.Invoke(t, true, "transfer", accH, accH, amount, nil) h := acc.Invoke(t, true, "transfer", accH, accH, amount, nil)
claimTx, _ := e.GetTransaction(t, h) claimTx, _ := e.GetTransaction(t, h)
firstPart := int64(amount*rewardDistance/2*defaultGASParBlock) / int64(rewardDistance) firstPart := int64(amount * neoHolderRewardRatio / 100 * // reward for a part of the whole NEO total supply that is owned by acc
secondPart := int64(amount*rewardDistance/2*newGASPerBlock) / int64(rewardDistance) defaultGASPerBlock * // GAS generated by a single block
rewardDistance / 2) // number of blocks generated with specified GasPerBlock
secondPart := int64(amount * neoHolderRewardRatio / 100 * // reward for a part of the whole NEO total supply that is owned by acc
newGASPerBlock * // GAS generated by a single block after GasPerBlock update
rewardDistance / 2) // number of blocks generated with specified GasPerBlock
e.CheckGASBalance(t, accH, big.NewInt(initialGASBalance.Int64()- e.CheckGASBalance(t, accH, big.NewInt(initialGASBalance.Int64()-
claimTx.SystemFee-claimTx.NetworkFee + +firstPart + secondPart)) claimTx.SystemFee-claimTx.NetworkFee + +firstPart + secondPart))
}) })