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

Adjust expected unclaimed GAS calculation for TestNEO_CalculateBonus #3596

Merged
merged 2 commits into from
Oct 4, 2024
Merged
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
4 changes: 2 additions & 2 deletions pkg/core/native/native_neo.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ const (
effectiveVoterTurnout = 5
// neoHolderRewardRatio is a percent of generated GAS that is distributed to NEO holders.
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
// 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

// maxGetCandidatesRespLen is the maximum number of candidates to return from the
Expand Down
11 changes: 8 additions & 3 deletions pkg/core/native/native_test/neo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,9 @@ func TestNEO_CalculateBonus(t *testing.T) {

t.Run("Many blocks", func(t *testing.T) {
amount := 100
defaultGASParBlock := 5
defaultGASPerBlock := 5
newGASPerBlock := 1
neoHolderRewardRatio := 10

initialGASBalance := e.Chain.GetUtilityTokenBalance(accH)

Expand All @@ -764,8 +765,12 @@ func TestNEO_CalculateBonus(t *testing.T) {
h := acc.Invoke(t, true, "transfer", accH, accH, amount, nil)
claimTx, _ := e.GetTransaction(t, h)

firstPart := int64(amount*rewardDistance/2*defaultGASParBlock) / int64(rewardDistance)
secondPart := int64(amount*rewardDistance/2*newGASPerBlock) / int64(rewardDistance)
firstPart := int64(amount * neoHolderRewardRatio / 100 * // reward for a part of the whole NEO total supply that is owned by acc
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()-
claimTx.SystemFee-claimTx.NetworkFee + +firstPart + secondPart))
})
Expand Down
Loading