-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: Additional (refactored) BIP9 tests #21334
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
cc @ajtowns @luke-jr @TheBlueMatt and those who ACK'd the full PR: @benthecarman, @michaelfolkson, @AnthonyRonning, @lucasmoten. Try: PREV=bd715ff8 N=2 && git range-diff `git merge-base --all HEAD $PREV`...$PREV HEAD~$N...HEAD --color-moved=dimmed-zebra |
Cool. Thanks for opening this Sjors. I'd rather not unpick all the work that has gone into BIP 8 and consensus that has built up around it over the past months. Is there a path forward you could get behind where we do actually refer to BIP 8 rather than BIP 9 even if you are opening pull requests assuming lockinontimeout=false? |
@michaelfolkson these first commits refer to existing BIP9 code, hence the title. I agree it makes sense to refer to BIP 8 even with |
src/test/versionbits_tests.cpp
Outdated
state == ThresholdState::LOCKED_IN ? "LOCKED_IN" : | ||
state == ThresholdState::ACTIVE ? "ACTIVE" : | ||
state == ThresholdState::FAILED ? "FAILED" : | ||
""); |
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.
Any reason to disable the compile time checks that come with a switch-case?
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.
IIUC it's to remain compatible with C++11: bae9a45#r579334677
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 am pretty sure that switch
exists way before C++11
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.
It can't be a constexpr function with a switch. I'm not sure what the reason for it being constexpr was, though; I may have been trying something with templates at one point?
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 can change it to use switch and not constexpr. Is there a ./configure
flag to force c++11?
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.
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.
static const std::string StateName(ThresholdState state)
{
switch (state) {
case ThresholdState::DEFINED: return "DEFINED";
case ThresholdState::STARTED: return "STARTED";
case ThresholdState::LOCKED_IN: return "LOCKED_IN";
case ThresholdState::ACTIVE: return "ACTIVE";
case ThresholdState::FAILED: return "FAILED";
} // no default case, so the compiler can warn about missing cases
return "";
}
looks fine to me fwiw.
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.
Two birds, one stone...
Concept ACK for splitting commits out. |
Can you keep this based on 831675c please? (So it's a clean merge to both 0.21 and master) |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
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.
Concept ACK
Co-authored-by: Sjors Provoost <sjors@sprovoost.nl>
6aeb212
to
0c471a5
Compare
@Sjors Due to conflicts with the remaining BIP 8 code, followups may need to be based on the merge commit - but in ideal circumstances, yes, it would be best to have kept it mergable in both branches where practical. |
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.
ACK 0c471a5
This is a test only change that's useful for both bip9 and bip8, so it would be good to get this merged quickly I think.
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.
review ACK 0c471a5 🔓
Show signature and timestamp
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
review ACK 0c471a5f306044cbd2eb230714571f05dd6aaf3c 🔓
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgISgwAyQvxPB7TAQwnAhABJgr2zwO7XYdx0ZMShKIt1rTw7HvCzqWqlY1vfun3
Ntq7sj03ee/bW2ga/EmApwzMlzObC1BTi3oD1MKnhe9KegvqOxo7uBy0RH5OMxtg
ywgM4ycrA2zLt2g95Mi1atAmas85xjXeHH3T3a4+GTXsNvVRXMpGO50Z4VACNeqQ
GXcccQitq3IXt4fvzEDouOurjUpyAnJ4LxJ4Nq5CasgEtqN5MtQC09J/h//LZ+8N
wbozI23bNmthW8eJRGIpzOnM0FvBGFprX34L08sww4Qohvpv9Ed0vuSGW0vTynFD
UiBHuiJe+v8EXhS0Hhklemg3aDOnhOFv2cPFsUQQ4A/irNBTYCj1wZ/azMsJcv4l
xBb/s5UYvG/wzjYeC5pMQq58SQDSDGI+glIUUgdmuPUZPIk7t5j+W5a1P5djoOw/
/YsJgVzcaS3kfJjKBYfNMbTzYYNWrMxq+lVTjGPx6aoKQ6z2djYX5aCfLpaH2fX1
KVNqcC3J
=paOz
-----END PGP SIGNATURE-----
Timestamp of file with hash 7eb1f34d6f69c582bcce82dc0a088637be492c5d3e060d5f19d5fac018087fee -
0c471a5 tests: check never active versionbits (Anthony Towns) 3ba9283 tests: more helpful errors for failing versionbits tests (Anthony Towns) Pull request description: Extracted from bitcoin#19573 to make review easier. I also reviewed it myself. I added some comments to the test: bitcoin@bae9a45#r585486781 I also moved some `TestState` changes from the second to the first commit, to reduce the latter diff. ACKs for top commit: ajtowns: ACK 0c471a5 MarcoFalke: review ACK 0c471a5 🔓 Tree-SHA512: 61f8d1ecaf38a6cd13db1cf71c89b8c4d2f5852ef77c5e7ecb9bd78eb216545037411641bb101cf0740c5c47845ac327954ee25b676d63779c5f148719ac5caf
e775b0a tests: Add fuzzing harness for versionbits (Anthony Towns) 0c471a5 tests: check never active versionbits (Anthony Towns) 3ba9283 tests: more helpful errors for failing versionbits tests (Anthony Towns) Pull request description: Backport of unit test (#21334) and fuzz test (#21380) changes for versionbits. Top commit has no ACKs. Tree-SHA512: b68b570e48e0076bb2ade3b91c59612029235d2c9e39048d548aa141fa0906343fa492e9a981065fbdbbebecbbb3dcbaf39ec69228c7581178fcca567e8201b8
Extracted from #19573 to make review easier. I also reviewed it myself.
I added some comments to the test: bae9a45#r585486781
I also moved some
TestState
changes from the second to the first commit, to reduce the latter diff.