-
Notifications
You must be signed in to change notification settings - Fork 714
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
[Consensus][Refactoring] Blocks v10: TierTwo payments in the coinbase transaction #2274
[Consensus][Refactoring] Blocks v10: TierTwo payments in the coinbase transaction #2274
Conversation
68ff087
to
1a98bf8
Compare
e7d61f6
to
98667d5
Compare
Can be rebased now. |
98667d5
to
89416a1
Compare
Rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initial code review completed. There are some really nice cleanups and refactorings 👌
Left some comments. Probably the most important one for me, code structure wise, is inside 89416a1. The rest looks great
Thanks for the feedback @furszy! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cool 👌, thanks for jumping over the feedback so quickly. Left some more comments after doing another full round.
The only comment that you missed to tackle from the previous round was the addMnToScores
refactor that has the same rationale as the CanScheduleMN
refactor, from this comment #2274 (comment)
Other than that and as a final line, awesome unit tests inclusion + further changes into the budget one, loved them 🥃 .
2651d4f
to
2410ee6
Compare
Updated as per review and rebased on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 2410ee6, great work 👌 ☕ .
A good future PR work can be to create a functional test for the coinbase and coinstake changes pre and post v6 enforcement, overminting, sending to a different payee etc.
Crafting invalid blocks similar to how it is done in #2346. So we can validate the entire block processing flow as well.
2410ee6
to
42005be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No code changes after squashing, re-ACK 42005be
Sadly, this PR requires a rebase. Will re-re-review the changes after it. |
this will be needed in the following commits
Masternode and budgets are paid as outputs of the coinbase transaction rather than the coinstake.
There is no change in the behavior here. We just prepare the functions for a simpler integration with the new payment logic by: - passing the pindexPrev (instead of just the height), so we don't introduce additional cs_main locks, to look into the active chain, before accessing the deterministic list. - using a *vector* of outputs (instead of a single one) since DMNs could require a payment for the mn operator.
- use MasternodeRef for const mn pointers - Initialize CMasternodePaymentWinner with the height - CMasternodeMan: - CompareLastPaid/CompareScoreTxIn/CompareScoreMN (same) - Save MasternodeRefs in vecMasternodeLastPaid (instead of ins) - Refactor/Simplify GetMasternodeRank and GetCurrentMasterNode
42005be
to
c2060ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No code changes after rebase, ACK c2060ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code ACK c2060ef
…get_tests 42be32c [Trivial] Rename AddSporkMessage --> AddOrUpdateSporkMessage (random-zebra) 76fbe44 [Refactoring] Use AddSporkMessage globally for maps update (random-zebra) 7c68750 [Cleanup][Trivial] Remove un-implemented function ExecuteSpork (random-zebra) eb271ef [Refactoring] Remove mocked BudgetManagerTest::IsBlockValueValid (random-zebra) Pull request description: Extracted from: - [x] #2274 and based on top of it. Forcing the update of the spork message and finalized budget, we can test the actual `IsBlockValueValid` function. This also refactors the spork code to update the maps in a single place, as suggested by @furszy here #2274 (comment). ACKs for top commit: furszy: ACK 42be32c 👍 . Fuzzbawls: ACK 42be32c Tree-SHA512: e1ef9aed9a4ff37f1dac4505d6213a93d75eba28d4592168f267c3089b60ff4e81c0d292bd1c8a34746124c3efbf479f2f42862fea414f4f31ed07e701ac8a57
4a5baf3 [Doc] Add cold-staking changes to release notes (random-zebra) c19416f [GUI] Use new opcode for P2CS after v6 enforcement (random-zebra) 45ebfee [RPC] Use new opcode for P2CS after v6 enforcement (random-zebra) 8eefab5 [Tests] Add script test for new opcode (random-zebra) df11631 [Script] Introduce new OP_CHECKCOLDSTAKEVERIFY opcode (random-zebra) b194386 [Refactor] Rename CCSV opcode to OP_CHECKCOLDSTAKEVERIFY_LOF (random-zebra) Pull request description: Extracted from #2267, and rebased on top of #2258. Given the consensus change, introduced in #2274, we can define a more secure `OP_CHECKCOLDSTAKEVERIFY` opcode, which doesn't leave the last output of the coinstake "free" (as we no longer pay masternode/budgets in the coinstake tx). Built on top of: - [x] #2258 - [x] #2274 ACKs for top commit: Fuzzbawls: re-Code ACK 4a5baf3 after rebase, no code changes. furszy: ACK 4a5baf3. Tree-SHA512: ee78b76137e40df05b854f8959755f1b99e7c7328fb13708ba7e3e6dae6357450210ce19ed7a99dc54aa0d6051d0dbd745af70f4b6e9927de5d3cbb2e04fffb6
Extracted from #2267.
This PR introduces an important consensus change. As per title, mn/budget payments are now outputs of the coinbase transaction, rather than the coinstake (which, now, contains only outputs belonging to the staker).
The block version is bumped to 10.
Also refactor the budget-payment functions, in preparation for the compatibility code and the new payment logic.
Built on top of: