-
Notifications
You must be signed in to change notification settings - Fork 37.7k
BIP90: Make buried deployments slightly more easily extensible #11426
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
Conversation
be8b282
to
4a87820
Compare
/** | ||
* Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period, | ||
* (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments. | ||
* Examples: 1916 for 95%, 1512 for testchains. | ||
*/ | ||
uint32_t nRuleChangeActivationThreshold; | ||
uint32_t nMinerConfirmationWindow; | ||
/** BIP90: Block height at which buried deployments becomes active */ | ||
int buried_deployments[MAX_BURIED_DEPLOYMENTS]; |
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.
uint32_t instead of int?
4a87820
to
a99208c
Compare
a99208c
to
c12ae89
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.
utACK c12ae89a3a898fe7778ef29c15527e698bf33b5b
src/consensus/params.h
Outdated
/** | ||
* Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period, | ||
* (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments. | ||
* Examples: 1916 for 95%, 1512 for testchains. | ||
*/ | ||
uint32_t nRuleChangeActivationThreshold; | ||
uint32_t nMinerConfirmationWindow; | ||
/** BIP90: Block height at which buried deployments becomes active */ | ||
uint64_t buried_deployments[MAX_BURIED_DEPLOYMENTS]; |
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.
Seems like it would fit in better with existing code to use int
for block heights instead of uint64_t
. Also would avoid signed/unsigned comparisons.
This feels like entirely needless code churn. This doesn't change the memory layout but add one extra entry of padding, arrays are probably just more brittle than named variables (now you're actually doing pointer offset and can lookup wrong), and doesn't seem to provide any benifit aside from fewer entries in the chainparams, which I dont think is a useful goal. |
I think the change is fine, but I agree with Matt in not seeing any obvious advantages to this approach. @jtimon, I wonder if there are any concrete advantages you would cite, or if you see this as mostly a stylistic change. Also, it might be helpful in reviewing these PRs to have a better idea of how you want the final public libconsensus interface to look. If you had a document listing the different header files and describing what kinds of functions they expose, that would help put these changes in context. |
I agree this is not necessary. It is meant to make the code clearer and simplify bip90 related changes like #11398 If it doesn't, then we shouldn't do this.
I am no longer working on libconsensus. Of all my opened PRs, I only used #8498 (well, some older version) in my longest branch for libconsensus. #6714 I have more links if you're interested and of course feel free to ask any questions you may have about my abandoned work on irc, the mailing list or by mail, whatever. But this PR doesn't seem the right place. |
Wow, those libconsensus docs are really interesting, and I hadn't seen them before. It probably is worth discussing more, but I guess not here (I didn't realize this PR was only intended be a standalone cleanup). I think we need to a better job reviewing cleanup PR's like this. It seems like when a PR making a stylistic change gets posted, there's either a contentious debate with ACKs and NACKs and exaggerated comments about why the change is wonderful or terrible, or people withhold opinions and ignore the PR because they don't want to risk starting an unproductive debate. Maybe a better way to handle cleanup changes would be to do a noncommital round of polling before asking for hard ACKs and NACKs, asking maybe 4 or 5 developers to take an initial look at the change and write a sentence saying whether they like, dislike, or are indifferent to it. Apache's voting system could be useful for this:
This way people would feel more free to comment on cleanup PRs without forming hard opinions or getting sucked into debate, so cleanup authors could get quicker feedback on their PRs, and make faster decisions on whether to close, improve, or move forward with their changes, and there could be less of a cleanup PR backlog. |
Heh, alright, I'm a -0 on this one =D. |
I'm +0. I like the deployments being grouped together and not sitting top level consensus params. I might put them in a struct instead of an array, but I mostly just think the change is harmless and not significant. |
-0 is a pretty good summary of my view as well |
@ryanofsky thanks for the suggestion and thanks everyone for the feedback. But I don't think it should deter discussion. I'm really interested on why people see the buried blocks enum and array here differently from versionbits' enum and array. I really see them similar. |
It's a minor change which isn't an unambiguous improvement and doesn't have a broader impact, so I wouldn't expect it to attract a lot of positive feedback. I like that the change groups deployments and would merge it even though I think grouping them under a struct would be a better than grouping them in an array. Arrays with constant offsets are more verbose than structs, less flexible, and also brittle like matt pointed out. I'd probably use a struct for vb deployments as well, or anything else I didn't think code would frequently be iterating over. |
Needs rebase if still relevant |
c12ae89
to
2193faa
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.
utACK 2193faa
Note that this conflicts with #11739, which removes |
@@ -13,6 +13,15 @@ | |||
|
|||
namespace Consensus { | |||
|
|||
enum BuriedDeploymentPos | |||
{ | |||
DEPLOYMENT_BIP16, |
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.
Note that the title says BIP90, but BIP90 never mentions BIP16. So either the code needs to change or the title.
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.
Couldn't bip90 change as it does with new additions like hopefully csv and segwit?
EDIT: assuming BIP16Height is not removed (still reading #11739 )
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, I'd rather not change BIPs to be a running target. The previous release implements BIP 90, so you can't change it after it is published.
Yeah, this should probably be rebased on top of #11739 |
Closing. But not for lack of enthusiasm, the next thing, I don't remember the name. More reasoned NACKS always welcomed. |
Also make it more similar to BIP9's implementation.