-
Notifications
You must be signed in to change notification settings - Fork 38.6k
[kernel 2b/n] Add ChainstateManager::m_adjusted_time_callback
#25064
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
[kernel 2b/n] Add ChainstateManager::m_adjusted_time_callback
#25064
Conversation
dongcarl
commented
May 4, 2022
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
So even if adjusted time was removed, there'd be a time callback? |
If usage of adjusted time in validation was removed, then we'd just remove the If you're asking about if we'll ever make the normal |
|
Why does adjusted time depend on asmap...? |
Oh sorry, I misspoke. More precisely: adjusted time depends on netaddress, and linking in netaddress requires linking in asmap. |
4b5a8a1 to
45e2400
Compare
|
Pushed 4b5a8a1a03af47d3cb4a7c9020f2a0bf63a563a7 -> 45e24007e8742d53b5b45ec22ebed962ffffe079
|
45e2400 to
52804f7
Compare
|
Pushed 45e24007e8742d53b5b45ec22ebed962ffffe079 -> 52804f7
|
jamesob
left a comment
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 52804f7 (jamesob/ackr/25064.1.dongcarl.kernel_2b_n_add_chainst)
Built, reviewed, unittested locally. Change looks good and is very simple. A few minor points:
- there's a lingering comment in
validation.cppthat could use updating: https://github.com/jamesob/bitcoin/blob/52804f7ad0da32bc4d7be726e08e0b1e34619acb/src/validation.cpp#L2008 - can't use designated initializers (yet?) because of a VS Code/CI issue:
10:42 <_aj_> jamesob: #24531 -- VS 2019 (which CI uses) doesn't support them, and figuring out how to fix that isn't trivial
10:42 <@gribble> https://github.com/bitcoin/bitcoin/issues/24531 | Use designated initializers by MarcoFalke · Pull Request #24531 · bitcoin/bitcoin · GitHub
10:45 <sipsorcery> _aj_: in fairness VS2019 does seem support them it just seems to want to use a massive amount of memory to compile them...
10:47 <_aj_> sipsorcery: doesn't support them with the amount of memory we currently allocate for those CI jobs :-P
Show signature data
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 52804f7ad0da32bc4d7be726e08e0b1e34619acb ([`jamesob/ackr/25064.1.dongcarl.kernel_2b_n_add_chainst`](https://github.com/jamesob/bitcoin/tree/ackr/25064.1.dongcarl.kernel_2b_n_add_chainst))
Built, reviewed, unittested locally. Change looks good and is very simple. A few minor points:
- - there's a lingering comment in `validation.cpp` that could use updating: https://github.com/jamesob/bitcoin/blob/52804f7ad0da32bc4d7be726e08e0b1e34619acb/src/validation.cpp#L2008
- - can't use designated initializers (yet?) because of a VS Code/CI issue:
10:42 <aj> jamesob: #24531 -- VS 2019 (which CI uses) doesn't support them, and figuring out how to fix that isn't trivial
10:42 <@gribble> #24531 | Use designated initializers by MarcoFalke · Pull Request #24531 · bitcoin/bitcoin · GitHub
10:45 aj: in fairness VS2019 does seem support them it just seems to want to use a massive amount of memory to compile them...
10:47 <aj> sipsorcery: doesn't support them with the amount of memory we currently allocate for those CI jobs :-P
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCgAdFiEEGNRVI1NPYuZCSIrGepNdrbLETwUFAmKDyWUACgkQepNdrbLE
TwWRFQ//UtNY+1IMPL/xvHWvqwgWm9O9FzXZIswmIX3OVze3X9GFXk1sEb7RejHR
z8jFtQW+g5uh4I4vD85BoRyQPmhD2VSc4TCipRTLOjuzOp67OpgSrTq+my89Myh0
ggEQip73F+XPkQl1EjMF/YEH6W1xnUBtIZXLvrXuKm1W03BK5flfxVzsxKYIoj9p
Rb6zic0AaVnbFSxKFiz3F5QE/Vw5lfBbZGblHNAricmVneEX9UNt5CVhCn0mZ2Ki
Ad2UD3Ugbj/qXoF76QeN44QqMsoi57PxwF8Fs53KsuTjdAJSVnD4Ma3ulaeKAy2C
6RZsjJAFGXAGXVRIWr8vvneZmvXRSdnhYPOQvw5gGJTIJxcADH/pSuyP5kDP/CLA
gfCnq+/eK2zhf6B1u8JzUpEbik6IM0bVYamUShZqVQDOKH4nEf7aoOu7E+j0JbWf
gywqlOD3rpDeUS2o8c4TjRqRCIqWPXgHxRI53nQE6AXQvOnNzdLzmetRqvWlqFLu
SgYv4QE25XkFXjbQMDTE+VQ3Qf9/OiHrtRVdYMCpqEHiN2US9RAwGVOF2zqD3wxK
bcY6j5HtbGP341mhmlD3ERBvpk4qi+L5OQRd1s20LyiTVF4RIodOV9i0P1fLL/qh
nPCyUeEoxDp9xWDR9l7aMqxxxt8thNnBt1uvEqdElmdEDLZKTbk=
=9W+m
-----END PGP SIGNATURE-----
Show platform data
Tested on Linux-5.10.0-11-amd64-x86_64-with-glibc2.31
Configured with ./configure LDFLAGS=-L/home/james/src/bitcoin/db4/lib/ CPPFLAGS=-I/home/james/src/bitcoin/db4/include/ CXXFLAGS=-fPIE -pipe -O2 -g -Wthread-safety-analysis -Wall -Werror=sign-compare -Wsign-compare -Werror=thread-safety-analysis --enable-wallet --enable-debug --with-daemon --enable-natpmp-default CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang PYTHONPATH= --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-schnorrsig --disable-shared --with-pic --enable-benchmark=no --enable-module-recovery --enable-module-schnorrsig --no-create --no-recursion
Compiled with /usr/bin/ccache /usr/local/bin/clang++ -std=c++17 -mavx -mavx2 -mpclmul -fPIE -pipe -O2 -g -Wthread-safety-analysis -Wall -Werror=sign-compare -Wsign-compare -Werror=thread-safety-analysis -O0 -g3 -ftrapv -fdebug-prefix-map=$(abs_top_srcdir)=. -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -msse4.1 -msse4.2 -msse4 -msha i
Compiler version: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63
52804f7 to
f554689
Compare
|
Pushed 52804f7 -> f554689988413479ea9bc561f7efd9d56a5c078f
|
src/chainstatemanager_opts.h
Outdated
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.
good candidate for a not_null #24423
given that we assert not null where it is actually used.
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.
Totally agree!
f554689 to
a4cb66a
Compare
|
Pushed f554689988413479ea9bc561f7efd9d56a5c078f -> 211674ce4fa845e872e2af9bfcdfc47c37729c52 |
211674c to
af8e546
Compare
[META] Although it seems like we don't need it for just one option,
we're going to introduce another member to this struct *in the
next commit*. In future patchsets for libbitcoinkernel decoupling
it from ArgsManager, even more members will be added here.
This decouples validation.cpp from netaddress.cpp (transitively, timedata.cpp, and asmap.cpp). This is important for libbitcoinkernel as: - There is no reason for the consensus engine to be coupled with netaddress, timedata, and asmap - Users of libbitcoinkernel can now easily supply their own std::function that provides the adjusted time. See the src/Makefile.am changes for some satisfying removals.
We want m_chainparams to be alive for the duration of ChainstateManager's lifetime since ChainstateManager's behaviour depends on m_chainparams. We could allow for a std::shared_ptr to be passed in as m_chainparams, but that complicates things further. Given that CChainParams is not an entity class or struct, we can just copy it and have ChainstateManager own it.
af8e546 to
53494bc
Compare
|
Pushed af8e5468b589ea0e43e7d130033bfec23b616717 -> 53494bc
|
|
utack 53494bc |