[Feat] Limit the total supply of Aleo to 5B - #3042
Conversation
vicsn
left a comment
There was a problem hiding this comment.
LGTM, let's await Kai's review too
|
One of the ledger tests seems to fail. We probably should look into that before merging. |
Co-authored-by: vicsn <victor.s.nicolaas@protonmail.com> Signed-off-by: Raymond Chu <14917648+raychu86@users.noreply.github.com>
| /// This value represents the absolute upper bound on all ALEO created over the lifetime of the network. | ||
| const MAX_SUPPLY: u64 = 5_000_000_000_000_000; // 5B credits | ||
| /// The block height that upper bounds the total supply of Aleo credits to 5 billion. | ||
| #[cfg(not(any(test, feature = "test")))] |
There was a problem hiding this comment.
Should this be using the test feature or the test_consensus_heights feature? I am still hoping we can phase out the former, as its name is not very descriptive.
There was a problem hiding this comment.
We want this to be for tests only rather than test_consensus_heights, because test_consensus_heights can be used for devnets.
I've kept the feature flag consistent with the other network variables, so if we would like to cleanup, we should do in a subsequent PR.
|
Fixed tests and simplified logic with d3fd59b. |
|
@raychu86 it looks like the tests fail again |
vicsn
left a comment
There was a problem hiding this comment.
Still LGTM, and this will give us a further early peace of mind: ProvableHQ/snarkOS#4029
Motivation
This PR limits the total supply of Aleo that can be created to 5B credits. This is done by calculated the expected upper-bound block height based on the emission algorithms and bringing the block and coinbase rewards to 0 after that height.
Based on the current timelines, this limit height will be hit at block
263_527_685, which is ~25 years from network launch. Because the changes will not occur for quite some time, there is flexibility for adjusting this limit height to be more accurate if there are major changes to network assumptions in the future.Link to ARC - ProvableHQ/ARCs#101
Do Not Merge until ARC is voted on and approved.