KOIN generates 10,000 times as much RC to fix numerical instability in prices
Processing of decay, budget and user activity occurs in a sensible order
Replace approximate calculation of RC spent (from xyk invariant) with exact calculation based on price x quantity
Add phantom RC usage to improve chain behavior in a no-load condition
Decay calculation is implemented in a slightly different way, allowing a very large constant to be replaced with a 32-bit one
Decay constants are updated to implement a 30-day halflife for a 3 second block time
Decay is now applied to both the system resource balance and the system RC balance
And some work still to be done:
Better initialization values are discussed in the notes and calculated in a Python script, but not implemented in the contract (and code may be different depending on whether this is deployed as an in-band upgrade to the existing testnet, or a new testnet)
The system resource / RC balances and the actions of the resource system should be logged and made available in block receipts
An accounting function should be implemented to check that all sources, sinks and balances of resources and RC always add up
To the best of my knowledge, the current PR is functionally correct, and should be deployable on testnet as an in-band upgrade. But I have not tested it at all. (It should probably be tested with integration testing and a private testnet before being deployed.) Comments suggesting a testing plan are quite welcome!
Also, do feel free to close this PR and borrow some or all of the code and analysis in a better PR.
Brief description
This PR is my attempt to create a single patch to fix numerous issues in the resource system.
My notes on these changes are available here.
Here is a summary of the main changes:
And some work still to be done:
To the best of my knowledge, the current PR is functionally correct, and should be deployable on testnet as an in-band upgrade. But I have not tested it at all. (It should probably be tested with integration testing and a private testnet before being deployed.) Comments suggesting a testing plan are quite welcome!
Also, do feel free to close this PR and borrow some or all of the code and analysis in a better PR.
Checklist
Demonstration