Order-agnostic comparison for Finalized budgets
Problem
During finalization stage masternodes compare finalized budgets they receive with their local version of the budget and only vote for the ones that are identical to their local budget copy. The comparison is order-sensitive, so the same set of proposals but in different order will be considered a different budget (even though it doesn't make real difference in the end - all proposals will be funded)
Making budgets to be compared (and paid out) regardless of order will reduce disagreement during finalization stage
Solution requirements
- Budget comparison when masternode decides whether vote for the budget or now must be agnostic to the order of the proposals (which is defined by the number of votes)
- Finalized budget hash must also be order-agnostic
- Budget payments should not depend on the order of the proposals in the budget (consider paying them all in a single block)
Development plan
Preliminary stage
- Try to make unit tests run (hack or disable specific tests if needed, the goal is not to complete issue #109 , but to make sure that unit tests can be executed and don't fail)
-
Create unit tests for
CFinalizedBudget::AutoCheck()
,CBudgetManager::SubmitBudget()
,CBudgetManager::IsTransactionValid()
(or not?) andCFinalizedBudget::IsTransactionValid()
Implementation Stage
-
Change
CFinalizedBudget
,SubmitBudget
andAutoCheck
to compare budgets regardless of order. Modify unit tests accordingly, make some new ones -
If necessary, hange
CFinalizedBudget::IsTransactionValid()
to work in with new payment order - Refactor the most annoying pieces of code from two previous items
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information