You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In #1617 it was noted that 3.0 GAS distribution scheme loses direct correspondence of 1 NEO to 10⁻⁸ GAS distributed per block and in #1848 some (unavoidable) rounding errors were noticed. So I've decided to take a closer look at these issues and they're quite visible, so it's worth at least discussing them.
To Reproduce
Create a chain (6 committee members with 4 validators in my case, that's the standard neo-go unit test chain)
Create some ValidatorsCount number of "whale" accounts and transfer 10M of NEO to each of them
Create "sender" account and transfer some 20M GAS generated in the genesis block (the amount should be sufficient to pay for all transactions, technically validators multisig account could be used, but this account simplifies signing)
Register standby validators (4 in my case) as candidates
Vote for them with "whale" accounts (1 account per one validator)
Create a number of test accounts (each will be flipping its NEO with an interval of its own) and transfer some (1/5/10/...) amount of NEO to them, in the same block make some accounts vote for the first validator
Now start generating blocks and add transactions flipping NEO (sending to itself) on test accounts, these transactions should be sent by the "sender" account, so that it spends GAS on fees while test accounts are only receiving it, and each account has its own block interval between transactions (1, 2, 3, 4, 5, 10, 100, 1000, 3000 in my case)
Get GAS balance for each account after some number of blocks (3001 in my case)
Expected behavior
Receive equal amount of GAS on different accounts irrespective of how often GAS is distributed
Voters receive 9 times more GAS than non-voters (10% vs 80%)
Increasing amount of voter/holder NEO increase the amount of generated GAS linearly
Real behavior
These are the results for owners of 1/5/10/100/.../1M NEO, the first column is the block interval between NEO transfers (1 is transferring each block), the second is amount of GAS generated on voter account and the third is amount of GAS generated on holder (non-voter) account.
You can get exactly zero GAS for holding 1 NEO if you don't vote and transfer it with every block.
If you make transfers more often you receive less GAS, the error is directly correlated to transfer frequency, big amounts of NEO hide that, although we're calculating just 3000 blocks here (half a day, roughly).
Voting holders of big amounts of NEO actually receive less GAS per NEO and this "less" can be quite significant, voting with 1M NEO influences voterSumRewardPerNEO calculations and it seriously affects GAS distribution. Two results for 1M NEO are different in that in the chain for additional run holders of 1M NEO vote for different (i%ValidatorsCount) candidates while everywhere above votes are for the first validator.
The problem above actually suggests that in real network with non-uniform vote distribution (this test chain is dominated by "whale" votes which are equal for each candidate) the amount of GAS received will be seriously affected by the number of votes for this candidate, the "additional" result proves this.
Voters receive roughly 17 times more than non-voters, which suggests that GasPerBlock policy is not really respected at the moment, we can generate more than GasPerBlock GAS. Of course this only affects voters for validators, if you're to vote for ordinary committee member you'll receive 9 times more than non-voter (why would you though?).
(Optional) Additional context
This also is relevant for #2008 discussions because this PR makes GAS be distributed more frequently in general.
Committee incentive is specifically not touched here, it has some inevitable rounding errors too, but it's more stable and doesn't accumulate these errors.
The text was updated successfully, but these errors were encountered:
Seeing this in real action on mainnet actually suggests that points 3-4 are features, not bugs, and point 5 is not entirely correct. The only problem is inevitable rounding (points 1-2), but while it makes the scheme not as perfect as the Legacy one was, it probably isn't really noticeable for regular users.
Describe the bug
In #1617 it was noted that 3.0 GAS distribution scheme loses direct correspondence of 1 NEO to 10⁻⁸ GAS distributed per block and in #1848 some (unavoidable) rounding errors were noticed. So I've decided to take a closer look at these issues and they're quite visible, so it's worth at least discussing them.
To Reproduce
ValidatorsCount
number of "whale" accounts and transfer 10M of NEO to each of themExpected behavior
Real behavior
These are the results for owners of 1/5/10/100/.../1M NEO, the first column is the block interval between NEO transfers (1 is transferring each block), the second is amount of GAS generated on voter account and the third is amount of GAS generated on holder (non-voter) account.
Identified problems
voterSumRewardPerNEO
calculations and it seriously affects GAS distribution. Two results for 1M NEO are different in that in the chain for additional run holders of 1M NEO vote for different (i%ValidatorsCount
) candidates while everywhere above votes are for the first validator.GasPerBlock
policy is not really respected at the moment, we can generate more thanGasPerBlock
GAS. Of course this only affects voters for validators, if you're to vote for ordinary committee member you'll receive 9 times more than non-voter (why would you though?).(Optional) Additional context
This also is relevant for #2008 discussions because this PR makes GAS be distributed more frequently in general.
Committee incentive is specifically not touched here, it has some inevitable rounding errors too, but it's more stable and doesn't accumulate these errors.
The text was updated successfully, but these errors were encountered: