Page MenuHomePhabricator

[avalanche] Promote stake contenders when the chain tip updates
ClosedPublic

Authored by roqqit on Mon, Oct 28, 21:33.

Details

Reviewers
Fabien
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABCf223acc35389: [avalanche] Promote stake contenders when the chain tip updates
Summary

Every time the chain tip updates, we need to "promote" stake contender cache entries in order to continue to track contender payout scripts and proof scores. Every time we do this, we grow the cache, so cleanup needs to be done on this cadence as well. This patch integrates that cache promotion into the Processor, trims the cache accordingly, and adds the -avalanchestakingpreconsensus option to enable this behavior. This same flag will be used to enable avalanche voting on contenders in future patches.

Depends on D17024

Test Plan
ninja check-avalanche-processor_tests

Event Timeline

Owners added a reviewer: Restricted Owners Package.Mon, Oct 28, 21:33
roqqit requested review of this revision.Mon, Oct 28, 21:33
Fabien requested changes to this revision.Tue, Oct 29, 09:06
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/avalanche/processor.cpp
999 ↗(On Diff #50497)

Use hasFinalizedTip()

1011 ↗(On Diff #50497)

I don't understand why this is done here. This should really happen upon block finalization

This revision now requires changes to proceed.Tue, Oct 29, 09:06

Feedback. Only cleanup cache once per block finalization.

Tail of the build log:

[392/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[393/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[394/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[395/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[396/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[397/577] Building CXX object src/CMakeFiles/server.dir/node/interfaces.cpp.o
[398/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[399/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[400/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[401/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[402/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[403/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[404/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[405/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[406/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[407/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[408/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[409/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[410/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[411/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[412/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[413/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[414/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[415/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[416/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[417/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[418/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[419/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[420/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[421/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[422/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[423/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[424/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[425/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[426/577] Linking CXX static library src/wallet/libwallet.a
[427/577] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[428/577] Building CXX object src/CMakeFiles/server.dir/node/blockstorage.cpp.o
[429/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[430/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[431/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[432/577] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[433/577] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
[434/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[435/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[436/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[437/577] Linking CXX executable src/iguana/iguana
[438/577] Building CXX object src/CMakeFiles/server.dir/rpc/server_util.cpp.o
[439/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[440/577] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
[441/577] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
[442/577] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[443/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[444/577] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[445/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[446/577] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
[447/577] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[448/577] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
[449/577] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang failed with exit code 1

Tail of the build log:

[391/575] Building CXX object src/CMakeFiles/bitcoind.dir/bitcoind.cpp.o
[392/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[393/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[394/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[395/575] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
[396/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[397/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[398/575] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[399/575] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[400/575] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[401/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[402/575] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[403/575] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[404/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[405/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[406/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[407/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[408/575] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[409/575] Linking CXX executable src/bitcoin-tx
[410/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[411/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[412/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[413/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[414/575] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[415/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[416/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[417/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[418/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[419/575] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[420/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[421/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[422/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[423/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[424/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[425/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[426/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[427/575] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[428/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[429/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[430/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[431/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[432/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[433/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[434/575] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[435/575] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[436/575] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[437/575] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[438/575] Linking CXX executable src/iguana/iguana
[439/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[440/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[441/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[442/575] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[443/575] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[444/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[445/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[446/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[447/575] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[448/575] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
Fabien requested changes to this revision.Tue, Oct 29, 20:22

back to your queue

This revision now requires changes to proceed.Tue, Oct 29, 20:22
Fabien added inline comments.
src/avalanche/processor.h
258 ↗(On Diff #50541)

At some point we should create an Arg object, it's getting wild

This revision is now accepted and ready to land.Thu, Oct 31, 07:29