fjahr
commented at 11:34 PM on March 14, 2024:
contributor
This picks up the work from #29331 and closes #29258.
This simply changes the type and addresses the comments from #29331 by changing the type in all relevant places and removing unnecessary casts. This also adds an extremely simple unit test.
Additionally this modernizes the name of nChainTx which helps reviewers check all use of the symbol and can make silent merge conflicts.
DrahtBot
commented at 11:34 PM on March 14, 2024:
contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
If your review is incorrectly listed, please react with π to this comment and the bot will ignore it on the next update.
<!--174a7506f384e20aa4161008e828411d-->
Conflicts
Reviewers, this pull request conflicts with the following ones:
#30560 (refactor: Add consteval uint256 constructor by hodlinator)
#30377 (refactor: Add consteval uint256{"str"} by hodlinator)
#30364 (logging: Replace LogError and LogWarning with LogAlert by ryanofsky)
#30214 (refactor: Improve assumeutxo state representation by ryanofsky)
#29641 (scripted-diff: Use LogInfo/LogDebug over LogPrintf/LogPrint by maflcko)
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.
DrahtBot added the label CI failed on Mar 15, 2024
DrahtBot
commented at 12:33 AM on March 15, 2024:
contributor
<!--85328a0da195eb286784d51f73fa0af9-->
π§ At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
fanquake
commented at 2:34 PM on March 15, 2024:
member
==25794==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 152 byte(s) in 1 object(s) allocated from:
[#0](/bitcoin-bitcoin/0/) 0x5597c4ef3931 in operator new(unsigned long) (/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x1276931) (BuildId: dc550d0a0634dbe1f98f193b152915bbb7968f28)
[#1](/bitcoin-bitcoin/1/) 0x5597c53b3398 in CreateBlockIndexWithNbits(unsigned int) src/test/blockchain_tests.cpp:24:32
[#2](/bitcoin-bitcoin/2/) 0x5597c53b1e58 in blockchain_tests::num_chain_tx_max_invoker() src/test/blockchain_tests.cpp:77:1
[#3](/bitcoin-bitcoin/3/) 0x5597c4fea063 in boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:771:14
[#4](/bitcoin-bitcoin/4/) 0x5597c5070afa in boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1395:32
[#5](/bitcoin-bitcoin/5/) 0x5597c5070afa in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18
[#6](/bitcoin-bitcoin/6/) 0x5597c4f2922f in int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:308:30
[#7](/bitcoin-bitcoin/7/) 0x5597c4f2922f in boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:910:16
[#8](/bitcoin-bitcoin/8/) 0x5597c4f297fe in boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1308:16
[#9](/bitcoin-bitcoin/9/) 0x5597c4f214fb in boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1404:5
[#10](/bitcoin-bitcoin/10/) 0x5597c4f214fb in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9
[#11](/bitcoin-bitcoin/11/) 0x5597c4fa3c92 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44
[#12](/bitcoin-bitcoin/12/) 0x5597c4fa2c0f in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:784:58
[#13](/bitcoin-bitcoin/13/) 0x5597c4fa2c0f in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:784:58
[#14](/bitcoin-bitcoin/14/) 0x5597c4f1f4a5 in boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1722:29
[#15](/bitcoin-bitcoin/15/) 0x5597c4f54a47 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9
[#16](/bitcoin-bitcoin/16/) 0x7f0c325b31c9 (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: b58ab3be268281d0cf45f2b22cbd4ba8b4aac9bd)
[#17](/bitcoin-bitcoin/17/) 0x7f0c325b328a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: b58ab3be268281d0cf45f2b22cbd4ba8b4aac9bd)
[#18](/bitcoin-bitcoin/18/) 0x5597c4e17804 in _start (/ci_container_base/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src/test/test_bitcoin+0x119a804) (BuildId: dc550d0a0634dbe1f98f193b152915bbb7968f28)
SUMMARY: AddressSanitizer: 152 byte(s) leaked in 1 allocation(s).
fjahr force-pushed on Mar 15, 2024
fjahr force-pushed on Mar 15, 2024
DrahtBot removed the label CI failed on Mar 15, 2024
fjahr
commented at 5:34 PM on March 15, 2024:
contributor
Fixed CI
Randy808
commented at 12:52 PM on March 18, 2024:
contributor
ACKafa67033772d750a15231aa0aa998a0454848bea
maflcko
commented at 1:03 PM on March 18, 2024:
member
In some draft by sjors from 5 years ago I saw that he took the chance to rename the variable to m_chain_num_tx. I didnβt do this now because nChainTx isnβt terrible IMO, just outdated, but happy to do this if people think itβs valuable while I touch these lines.
I'd say it should. Reviewers will have to look up every use of the symbol anyway. Also, a rename turns silent merge conflicts into compile failures, so devs are notified if an old use of the symbol remains, which may assume a 32-bit width.
fjahr
commented at 10:30 PM on March 18, 2024:
contributor
Added a scripted diff renaming nChainTx to m_chain_tx_count.
fjahr force-pushed on Mar 18, 2024
DrahtBot added the label CI failed on Mar 18, 2024
DrahtBot removed the label CI failed on Mar 19, 2024
in
src/kernel/chainparams.h:72
in
cef04348bcoutdated
68 | @@ -69,7 +69,7 @@ struct AssumeutxoData {
69 | */
70 | struct ChainTxData {
71 | int64_t nTime; //!< UNIX timestamp of last known number of transactions
72 | - int64_t nTxCount; //!< total number of transactions between genesis and that timestamp 73 | + uint64_t nTxCount; //!< total number of transactions between genesis and that timestamp
DrahtBot added the label Needs rebase on Mar 20, 2024
fjahr force-pushed on Mar 20, 2024
DrahtBot removed the label Needs rebase on Mar 20, 2024
maflcko
commented at 2:32 PM on March 24, 2024:
member
@maflcko@ryanofsky curious about your thoughts on fjahr@b938204 , i.e. if should take that route with memory optimization or if you think it's not necessary after all.
I don't think it is needed. If it was done, it should be a bitfield instead, no? See also #29258 (comment) ?
fjahr
commented at 8:42 PM on March 25, 2024:
contributor
I don't think it is needed. If it was done, it should be a bitfield instead, no? See also #29258 (comment) ?
I could change the approach to bitfields, sure. I don't think we are using them anywhere yet so I wasn't sure if it would really be the preferred approach. But if it's not needed, I will just leave the PR as is for now.
maflcko
commented at 8:08 AM on March 28, 2024:
member
I don't think it is needed. If it was done, it should be a bitfield instead, no? See also #29258 (comment) ?
I could change the approach to bitfields, sure. I don't think we are using them anywhere yet so I wasn't sure if it would really be the preferred approach. But if it's not needed, I will just leave the PR as is for now.
Yeah, I think the current approach is fine. bitfields can be done in a follow-up, if needed. One thing to look out for would be to check that the integer sanitizer works properly on bitfields as well.
maflcko
commented at 8:15 AM on March 28, 2024:
member
Concept ACK. I think the pull description can be rewritten, since it ends up in plain text in the merge commit. Instead of writing "<strike>Thing A is not included.</strike> It is now", it would be better to say why it is included and remove the formatting/negation: "Thing A is included, because (...motivation...)"
fjahr
commented at 9:45 PM on April 27, 2024:
contributor
Concept ACK. I think the pull description can be rewritten, since it ends up in plain text in the merge commit. Instead of writing "Thing A is not included. It is now", it would be better to say why it is included and remove the formatting/negation: "Thing A is included, because (...motivation...)"
I have updated the description.
DrahtBot added the label Needs rebase on Jul 3, 2024
in
src/chain.h:176
in
64d35be20coutdated
173 | @@ -174,7 +174,7 @@ class CBlockIndex
174 | //! to the genesis block or an assumeutxo snapshot block have reached the
175 | //! VALID_TRANSACTIONS level.
176 | //! Change to 64-bit type before 2024 (assuming worst case of 60 byte transactions).
This would mean that we return a different key in the JSON returned from the RPC. We usually don't do this unless it's needed in order to not break things on the user side. We also only use the m_ prefix for class members.
naiyoma
commented at 10:26 AM on July 5, 2024:
contributor
nit in e78cf83: Not sure why nbits matter for this test.
Yeah, I had just reused the helper method from this test but it's not needed indeed. I am using an empty constructor now.
I think you can just write CBlockIndex block{.nChainTx=..max()};, replacing the first two lines.
I am unfamiliar with the ..max() syntax and I am also getting a compiler error when I try to use a designated initializer here, I didn't investigate deeper why that is though.
DrahtBot requested review from glozow on Jul 10, 2024
DrahtBot requested review from naiyoma on Jul 10, 2024
maflcko
commented at 12:43 PM on July 10, 2024:
member
Additionally this modernizes the name of nChainTx to m_chain_num_tx which helps reviewers check all use of the symbol and can make silent merge conflicts.
I think you can drop the new name from the pull description. It is wrong right now (doesn't match the scripted diff), and if anyone wanted to find it, they can look at the scripted diff.
fjahr force-pushed on Jul 10, 2024
fjahr
commented at 3:45 PM on July 10, 2024:
contributor
I think you can drop the new name from the pull description. It is wrong right now (doesn't match the scripted diff), and if anyone wanted to find it, they can look at the scripted diff.
done
DrahtBot removed the label CI failed on Jul 10, 2024
DrahtBot added the label Needs rebase on Jul 10, 2024
fjahr force-pushed on Jul 10, 2024
fjahr
commented at 10:20 PM on July 10, 2024:
contributor
Rebased
DrahtBot removed the label Needs rebase on Jul 10, 2024
marcofleon
commented at 5:57 PM on August 1, 2024:
contributor
ACKfab49990eb787aabd908f6ba88f5e00ed9844f91. Reviewed the changes, grepped for the old variable names, and ran make check and the individual test. I read a bit of the background (links provided in the PR description) and there doesn't seem to be any issue with this change in validation.
DrahtBot requested review from maflcko on Aug 1, 2024
maflcko
commented at 6:32 PM on August 1, 2024:
member
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-22 03:13 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me