-
Notifications
You must be signed in to change notification settings - Fork 36.4k
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: Remove ISM #8391
Consensus: Remove ISM #8391
Conversation
flags |= SCRIPT_VERIFY_DERSIG; | ||
} | ||
|
||
// Start enforcing CHECKLOCKTIMEVERIFY, (BIP65) for block.nVersion=4 | ||
// blocks, when 75% of the network has upgraded: | ||
if (block.nVersion >= 4 && IsSuperMajority(4, pindex->pprev, chainparams.GetConsensus().nMajorityEnforceBlockUpgrade, chainparams.GetConsensus())) { | ||
if (block.nVersion >= 4 && pindex->nHeight >= chainparams.GetConsensus().BIP65Height) { |
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.
actually, I don't need to compare the version. BIP65Height represent the 95% threshold height, so the first condition is always true.
8d4ca9a
to
86f5e2e
Compare
nFound; | ||
pstart = pstart->pprev; | ||
case 2: | ||
activated = consensusParams.BIP34Height >= pindex->nHeight; |
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.
Shouldn't this comparison be the other way around?
86f5e2e
to
9cf33d5
Compare
|
4610c9f
to
705d731
Compare
@@ -817,22 817,23 @@ UniValue verifychain(const UniValue& params, bool fHelp) | |||
} | |||
|
|||
/** Implementation of IsSuperMajority with better feedback */ | |||
static UniValue SoftForkMajorityDesc(int minVersion, CBlockIndex* pindex, int nRequired, const Consensus::Params& consensusParams) | |||
static UniValue SoftForkMajorityDesc(int minVersion, CBlockIndex* pindex, const Consensus::Params& consensusParams) |
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.
"minVersion" is a bit confusing after this.
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.
What would be better ?
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.
"version", like the caller SoftForkDesc
eca5b6f
to
316ecbd
Compare
/** Block height and hash at which BIP34 becomes active */ | ||
int BIP34Height; | ||
uint256 BIP34Hash; | ||
/** Block height at which BIP65 becomes active */ |
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.
We can make an array with an enum, like with vDeployments. Say, vPastDeployments, vOldDeployments, vBuriedDeployments, or something of the sort.
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.
I prefer keeping change of logic and refactoring done in different PR. I want this PR to be easy to review, so I'm using the previous way of doing with BIP34Height.
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.
Well, you can leave BIP34 as it is and put the new things in the array if you think that is less disruptive, no?
Anyway, if you feel strongly against doing it now, we can do it later. It's just feel cleaner not to put code to destroy it "right afterwards" (I can foresee the same "we can do the refactor later" argument when moving BIP113 there...).
utACK besides nits. |
316ecbd
to
122786d
Compare
|
Sync of Testnet succeed, the Travis error is unrelated to this PR is it possible to run it again ? (still going on for mainnet) |
Intial sync of testnet and mainnet succeed. |
Here are my proposed changes in code: jtimon/bitcoin@remove-ism...consensus-post-remove-ism In any case, utACK 122786d |
Note that #8418 adds a means to override the activation times for BIP9 activations in regtest mode. Perhaps a compatible approach can be followed here? Or is there no need for testing with different softforks activate in regtest? |
utACK 122786d |
I'll do a separate PR on top of this one for using the approach of #8418 alongs with @jtimon suggestion. EDIT: something like NicolasDorier@e4844f7 |
ACK 122786d |
122786d Consensus: Remove ISM (NicolasDorier)
@morcos and I were discussing this, and I think this change is subtle enough that it deserves some kind of BIP write-up. Technically this change is a hardfork: old ISM-based code, when presented with an alternate chain history in which one of these softforks activated earlier, would then reject a subsequent block that violated the softfork before the hardcoded heights here, whereas this code would not reject such a block (since the softfork would not yet be enforced). This seems like a fundamental consequence of removing the ISM code (excluding doing something like checkpointing the whole headers chain to detect this kind of thing, which seems like obvious overkill). In my judgement this is fine, as by the time we deploy this code in 0.14, it'll have been over a year since the most recent one of these softforks deployed. But to further everyone's understanding of how these kinds of consensus changes are made (especially for future developers, as well as authors of alternate implementations) I think it'd be beneficial to document this change along with the considerations and rationale that went into it. |
I agree a BIP makes sense. |
will write BIP |
122786d Consensus: Remove ISM (NicolasDorier)
122786d Consensus: Remove ISM (NicolasDorier)
8375bd8 [Tests] Use blocks v7 on regtest (random-zebra) 596902f [Core] Remove IsSuperMajority (random-zebra) 9cd2f81 [Consensus] Reject outdated blocks by enforcement height (random-zebra) Pull request description: `IsSuperMajority` checks are slow, and not needed after enforcement. Also ISM is not a good mechanism for deployment, so will not likely be used again after BIP65. (based on bitcoin#8391) We should implement better fork signal/activation solutions such as [BIP 9](https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki) in the future. **Note:** testnet resync completed. currently checking resync on mainnet. ACKs for top commit: furszy: Tested ACK 8375bd8 Fuzzbawls: ACK 8375bd8 Tree-SHA512: 587b08ab25b92661a362494023d914af606acce5af8ddb9bd4f4f36dc9dd621c6d5dfbe2a530c73aab3e9c47af90a98ff319cd4116e72eff2fdb424f4df517bd
I hard coded ISM SF in regtest and adapted the tests.
Will try a sync on mainnet and testnet soon.
Note that even if the activation threshold (75% which enforce a rule for block version above a number) and enforcement threshold (95% reject old versions) are different, only the enforcement one really matter post fork.