Activation manager for BIP30-style forks#46
Closed
domob1812 wants to merge 2 commits intoDiviProject:Developmentfrom
Closed
Activation manager for BIP30-style forks#46domob1812 wants to merge 2 commits intoDiviProject:Developmentfrom
domob1812 wants to merge 2 commits intoDiviProject:Developmentfrom
Conversation
Author
|
I've successfully synced DIVI from scratch on mainnet with this PR now (so the various changes did not affect compatibility especially to the very first blocks). |
|
Looks ok. Is there a reason you added the commit for the staking vault checks in this PR ? I'm a bit confused by that |
Author
The main reason is that I believe both of these changes to be quick to review and push, and so I combined them. If you prefer to review & push the checks as a separate PR, I'm happy to spit it up. |
ab5c555 to
e602db9
Compare
Author
|
I've removed the coinstakes checking commit from #38 now. |
bc05a32 to
afc688a
Compare
afc688a to
85cde58
Compare
f61f174 to
a4ef70a
Compare
DIVI has some of the softforks of Bitcoin (BIP16, BIP30, BIP34, BIP66) on all the time since genesis. This change removes the conditional activation for them (which is not necessary). Since this also makes all other BIP30 things obsolete (in particular, IsSuperMajority and the related constants in chain params), those can be removed as well.
This adds the new ActivationState utility class. It is used to abstract fork activation away from other parts of the code. An instance is based on a CBlockIndex representing the chain tip being validated, and it can be queried for the state of various forks with IsActive. Activation happens by block timestamp, as this is totally straight-forward and more or less the simplest form of activation possible. This also makes it independent of the block context (unlike e.g. median time) and allows us to theoretically use fork activation even for things like changing the serialisation format of blocks. For now, no fork is defined apart from a dummy one used in testing. In the future, we will define real forks with this framework (e.g. the staking-vault changes).
a4ef70a to
d5dd1ac
Compare
Author
|
We'll use activation based on a timestamp instead to simplify this, as in #55. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This refactors BIP30-style fork activation (signalling with block versoins): Instead of a function
IsSuperMajority, we now have a utility classActivationManagerthat takes care of both the state of individual forks (for now, just aTestDummyfork is defined) as well as of enforcing minimal block versions as the network updates.Strictly speaking this is by itself already a soft fork that activates automatically: With this logic, the network will enforce any arbitrary block version as minimum that has been seen in at least 950 of the last 1'000 blocks; previously that was only the case for specifically scheduled block versions corresponding to implemented forks. This is irrelevant in practice, though.
Since DIVI started the network already with block version 4 and various BIPs enforced from the start (BIP16, BIP30, BIP34, BIP66), we can also remove obsolete / always-on "conditional" activation for those to simplify the code.