Page MenuHomePhabricator

[avalanche] Start populating the staking contender cache
AbandonedPublic

Authored by roqqit on Oct 24 2024, 20:27.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Summary

This patch tracks proofs in the stake contender cache and allows them to be polled (if -avalanchestakingpreconsensus is set). Stake contenders are not yet reconciled, so no avalanche voting is taking place. Manually set winners polled for will respond as accepted.

Test Plan
ninja check check-functional

Event Timeline

Owners added a reviewer: Restricted Owners Package.Oct 24 2024, 20:27
roqqit requested review of this revision.Oct 24 2024, 20:27

Tail of the build log:

[589/647] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/util_time.cpp.o
[590/647] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/verify_script.cpp.o
[591/647] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rpc_mempool.cpp.o
[592/647] Building CXX object src/bench/CMakeFiles/bitcoin-bench.dir/rpc_blockchain.cpp.o
[593/647] Linking CXX executable src/seeder/bitcoin-seeder
[594/647] Automatic MOC for target bitcoin-qt-base
[595/647] Generating forms/ui_askpassphrasedialog.h
[596/647] Generating forms/ui_addressbookpage.h
[597/647] Generating forms/ui_createwalletdialog.h
[598/647] Generating forms/ui_editaddressdialog.h
[599/647] Generating forms/ui_signverifymessagedialog.h
[600/647] Generating forms/ui_coincontroldialog.h
[601/647] Generating forms/ui_helpmessagedialog.h
[602/647] Generating forms/ui_intro.h
[603/647] Generating forms/ui_modaloverlay.h
[604/647] Generating forms/ui_openuridialog.h
[605/647] Generating forms/ui_transactiondescdialog.h
[606/647] Generating forms/ui_receivecoinsdialog.h
[607/647] Generating forms/ui_receiverequestdialog.h
[608/647] Generating forms/ui_overviewpage.h
[609/647] Generating forms/ui_optionsdialog.h
[610/647] Generating forms/ui_sendcoinsdialog.h
[611/647] Generating forms/ui_sendcoinsentry.h
[612/647] Generating forms/ui_debugwindow.h
[613/647] Generating qrc_bitcoin.cpp
[614/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/csvmodelwriter.cpp.o
[615/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinamountfield.cpp.o
[616/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinunits.cpp.o
[617/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoinaddressvalidator.cpp.o
[618/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/modaloverlay.cpp.o
[619/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/networkstyle.cpp.o
[620/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bantablemodel.cpp.o
[621/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin.cpp.o
[622/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/notificator.cpp.o
[623/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/guiutil.cpp.o
[624/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/intro.cpp.o
[625/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsdialog.cpp.o
[626/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/optionsmodel.cpp.o
[627/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/platformstyle.cpp.o
[628/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvalidatedlineedit.cpp.o
[629/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qvaluecombobox.cpp.o
[630/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/utilitydialog.cpp.o
[631/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/trafficgraphwidget.cpp.o
[632/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/splashscreen.cpp.o
[633/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin_locale.cpp.o
[634/647] Linking CXX executable src/bitcoind
[635/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/qrc_bitcoin.cpp.o
[636/647] Linking CXX executable src/bench/bitcoin-bench
[637/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/clientmodel.cpp.o
[638/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoin-qt-base_autogen/mocs_compilation.cpp.o
[639/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/bitcoingui.cpp.o
[640/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/peertablemodel.cpp.o
[641/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt-base.dir/rpcconsole.cpp.o
[642/647] Linking CXX static library src/qt/libbitcoin-qt-base.a
[643/647] Automatic MOC for target bitcoin-qt
[644/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/bitcoin-qt_autogen/mocs_compilation.cpp.o
[645/647] Building CXX object src/qt/CMakeFiles/bitcoin-qt.dir/main.cpp.o
[646/647] Linking CXX executable src/qt/bitcoin-qt
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

Fix chainstate dependency

@bot build-tsan

src/avalanche/processor.cpp
964 ↗(On Diff #50409)

you can really use a more verbose name

974 ↗(On Diff #50409)

Does it make sense to run this if the above failed ?

976 ↗(On Diff #50409)

Overall I think you could have either or'ed the returns or just reverse the calls ordering to avoid the bool var

987 ↗(On Diff #50409)
988 ↗(On Diff #50409)

This is certainly not the best option here. You will likely end up calling this in a loop and you don't want to lock/unlock cs_main. You should assert the lock is held and let the caller decide if it's only locked for the single call or for the whole logic that requires it. It might not be safe to let the tip advance between these calls.

994 ↗(On Diff #50409)

This is not a very good name imo... UpdateStakeContendersForBlock ? PromoteStakeContendersToTip ?

1018 ↗(On Diff #50409)
Fabien requested changes to this revision.Oct 25 2024, 13:02

This can be split into several parts:

  • Automate the stake contenders promotion via updatedBlockTip()
  • Add the manual winners to the cache
  • Vote on manual winners
This revision now requires changes to proceed.Oct 25 2024, 13:02