Page MenuHomePhabricator

[avalanche] Make it possible to replace a proof
ClosedPublic

Authored by Fabien on Nov 24 2021, 16:58.

Details

Reviewers
deadalnix
tyler-smith
Group Reviewers
Restricted Project
Maniphest Tasks
Restricted Maniphest Task
Commits
rABCde7e134cbd3c: [avalanche] Make it possible to replace a proof
Summary

This lets the peer manager decide to replace a proof with another instead of rejecting the conflict.
This feature is hidden behind a flag so the behavior is not changed by default.

Ref T1854.

Depends on D10714.

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avalanche_peermanager_overrideproof
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17825
Build 35476: Build Difflint-circular-dependencies · build-without-wallet · build-diff · build-debug · build-clang-tidy · build-clang
Build 35475: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Nov 24 2021, 16:58
Fabien planned changes to this revision.Nov 26 2021, 23:09

Need rebase after D10522 is updated

Fabien planned changes to this revision.Nov 30 2021, 13:04
deadalnix requested changes to this revision.Nov 30 2021, 16:58
deadalnix added a subscriber: deadalnix.
deadalnix added inline comments.
src/avalanche/peermanager.cpp
269 ↗(On Diff #31172)

You almost certainly want to have some kind of cooldown between replacements or you might end up with someone grinding these.

This revision now requires changes to proceed.Nov 30 2021, 16:58

Rebase on top of D10606 to make use of the cooldown feature.

Tail of the build log:

[382/511] Linking CXX executable src/bitcoin-wallet
[383/511] Building CXX object src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o
FAILED: src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o -MF src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o.d -o src/CMakeFiles/server.dir/avalanche/peermanager.cpp.o -c ../../src/avalanche/peermanager.cpp
In file included from ../../src/avalanche/peermanager.cpp:7:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[384/511] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
FAILED: src/CMakeFiles/server.dir/rpc/net.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/rpc/net.cpp.o -MF src/CMakeFiles/server.dir/rpc/net.cpp.o.d -o src/CMakeFiles/server.dir/rpc/net.cpp.o -c ../../src/rpc/net.cpp
In file included from ../../src/rpc/net.cpp:7:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[385/511] Building CXX object src/CMakeFiles/server.dir/rpc/avalanche.cpp.o
FAILED: src/CMakeFiles/server.dir/rpc/avalanche.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/rpc/avalanche.cpp.o -MF src/CMakeFiles/server.dir/rpc/avalanche.cpp.o.d -o src/CMakeFiles/server.dir/rpc/avalanche.cpp.o -c ../../src/rpc/avalanche.cpp
In file included from ../../src/rpc/avalanche.cpp:5:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[386/511] Building CXX object src/CMakeFiles/server.dir/avalanche/processor.cpp.o
[387/511] Building CXX object src/CMakeFiles/server.dir/net.cpp.o
FAILED: src/CMakeFiles/server.dir/net.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/net.cpp.o -MF src/CMakeFiles/server.dir/net.cpp.o.d -o src/CMakeFiles/server.dir/net.cpp.o -c ../../src/net.cpp
In file included from ../../src/net.cpp:12:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[388/511] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
FAILED: src/CMakeFiles/server.dir/init.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/init.cpp.o -MF src/CMakeFiles/server.dir/init.cpp.o.d -o src/CMakeFiles/server.dir/init.cpp.o -c ../../src/init.cpp
In file included from ../../src/init.cpp:14:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[389/511] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
FAILED: src/CMakeFiles/server.dir/validation.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/validation.cpp.o -MF src/CMakeFiles/server.dir/validation.cpp.o.d -o src/CMakeFiles/server.dir/validation.cpp.o -c ../../src/validation.cpp
In file included from ../../src/validation.cpp:10:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[390/511] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
FAILED: src/CMakeFiles/server.dir/net_processing.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DABORT_ON_FAILED_ASSUME -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DDEBUG -DDEBUG_LOCKORDER -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -O0 -fPIC -fvisibility=hidden -g3 -ftrapv -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/net_processing.cpp.o -MF src/CMakeFiles/server.dir/net_processing.cpp.o.d -o src/CMakeFiles/server.dir/net_processing.cpp.o -c ../../src/net_processing.cpp
In file included from ../../src/net_processing.cpp:9:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-debug failed with exit code 1

Tail of the build log:

[340/511] Building C object src/secp256k1/CMakeFiles/internal-bench.dir/src/bench_internal.c.o
[341/511] Building C object src/secp256k1/CMakeFiles/secp256k1.dir/src/secp256k1.c.o
[342/511] Linking C static library src/secp256k1/libsecp256k1.a
[343/511] Linking CXX static library src/libbitcoinconsensus.a
[344/511] Linking C executable src/secp256k1/ecmult-bench
[345/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[346/511] Linking C executable src/secp256k1/internal-bench
[347/511] Linking C executable src/secp256k1/sign-bench
[348/511] Linking C executable src/secp256k1/verify-bench
[349/511] Linking C executable src/secp256k1/recover-bench
[350/511] Installing component secp256k1
-- Install configuration: "RelWithDebInfo"
-- Install component: "secp256k1"
-- Installing: /results/artifacts/lib/libsecp256k1.a
-- Installing: /results/artifacts/include/secp256k1.h
-- Installing: /results/artifacts/include/secp256k1_preallocated.h
-- Installing: /results/artifacts/include/secp256k1_recovery.h
-- Installing: /results/artifacts/include/secp256k1_schnorr.h
[351/511] Building CXX object src/CMakeFiles/script.dir/script/descriptor.cpp.o
[352/511] Linking CXX static library src/libscript.a
[353/511] Linking CXX static library src/libcommon.a
[354/511] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[355/511] Linking CXX shared library src/libbitcoinconsensus.so.0.24.7
[356/511] Creating library symlink src/libbitcoinconsensus.so.0 src/libbitcoinconsensus.so
[357/511] Linking CXX executable src/bitcoin-cli
[358/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[359/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[360/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[361/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[362/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[363/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[364/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[365/511] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[366/511] Linking CXX executable src/bitcoin-tx
[367/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[368/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[369/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[370/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[371/511] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[372/511] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[373/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[374/511] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[375/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[376/511] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[377/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[378/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[379/511] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[380/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[381/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/__/interfaces/wallet.cpp.o
[382/511] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[383/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[384/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[385/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcdump.cpp.o
[386/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[387/511] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[388/511] Linking CXX static library src/wallet/libwallet.a
[389/511] Linking CXX static library src/wallet/libwallet-tool.a
[390/511] Linking CXX executable src/bitcoin-wallet
ninja: build stopped: cannot make progress due to previous errors.
Build build-diff failed with exit code 1

Tail of the build log:

[338/457] Linking CXX executable src/bitcoin-cli
[339/457] Linking C executable src/secp256k1/ecmult-bench
[340/457] Linking C executable src/secp256k1/internal-bench
[341/457] Linking C executable src/secp256k1/sign-bench
[342/457] Linking C executable src/secp256k1/verify-bench
[343/457] Building CXX object src/CMakeFiles/server.dir/rpc/server.cpp.o
[344/457] Linking C executable src/secp256k1/recover-bench
[345/457] Linking CXX executable src/bitcoin-tx
[346/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[347/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[348/457] Building CXX object src/CMakeFiles/server.dir/rpc/net.cpp.o
FAILED: src/CMakeFiles/server.dir/rpc/net.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/rpc/net.cpp.o -MF src/CMakeFiles/server.dir/rpc/net.cpp.o.d -o src/CMakeFiles/server.dir/rpc/net.cpp.o -c ../../src/rpc/net.cpp
In file included from ../../src/rpc/net.cpp:7:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[349/457] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[350/457] Linking CXX static library src/zmq/libzmq.a
[351/457] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[352/457] Building CXX object src/CMakeFiles/server.dir/rpc/mining.cpp.o
[353/457] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[354/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[355/457] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[356/457] Building CXX object src/CMakeFiles/server.dir/init.cpp.o
FAILED: src/CMakeFiles/server.dir/init.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/init.cpp.o -MF src/CMakeFiles/server.dir/init.cpp.o.d -o src/CMakeFiles/server.dir/init.cpp.o -c ../../src/init.cpp
In file included from ../../src/init.cpp:14:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[357/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[358/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[359/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[360/457] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[361/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[362/457] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[363/457] Building CXX object src/CMakeFiles/server.dir/net_processing.cpp.o
FAILED: src/CMakeFiles/server.dir/net_processing.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/net_processing.cpp.o -MF src/CMakeFiles/server.dir/net_processing.cpp.o.d -o src/CMakeFiles/server.dir/net_processing.cpp.o -c ../../src/net_processing.cpp
In file included from ../../src/net_processing.cpp:9:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
[364/457] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[365/457] Building CXX object src/CMakeFiles/server.dir/rpc/rawtransaction.cpp.o
[366/457] Building CXX object src/CMakeFiles/server.dir/rpc/blockchain.cpp.o
[367/457] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
FAILED: src/CMakeFiles/server.dir/validation.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBOOST_AC_USE_STD_ATOMIC -DBOOST_SP_USE_STD_ATOMIC -DBUILD_BITCOIN_INTERNAL -DENABLE_AVX2 -DENABLE_SHANI -DENABLE_SSE41 -DHAVE_BUILD_INFO -DHAVE_CONFIG_H -DHAVE_CONSENSUS_LIB -DLEVELDB_ATOMIC_PRESENT -DLEVELDB_PLATFORM_POSIX -DOS_LINUX -I../../src/leveldb/helpers/memenv -I../../src/. -Isrc -I../../src/univalue/include -Isrc/crypto/.. -I../../src/secp256k1/include -I../../src/leveldb/include -isystem /usr/include/jemalloc -isystem /usr/include/miniupnpc -Werror -g -O2 -fPIC -fvisibility=hidden -fstack-reuse=none -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wformat -Wvla -Wcast-align -Wunused-parameter -Wmissing-braces -Wredundant-decls -Wsign-compare -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Wformat-security -Woverloaded-virtual -Wno-unused-parameter -Wno-implicit-fallthrough -pthread -std=gnu++17 -MD -MT src/CMakeFiles/server.dir/validation.cpp.o -MF src/CMakeFiles/server.dir/validation.cpp.o.d -o src/CMakeFiles/server.dir/validation.cpp.o -c ../../src/validation.cpp
In file included from ../../src/validation.cpp:10:
../../src/./avalanche/avalanche.h:35:73: error: ‘*’ in boolean context, suggest ‘&&’ instead [-Werror=int-in-bool-context]
 static constexpr bool AVALANCHE_DEFAULT_PROOF_REPLACEMENT_COOLDOWN = 60 * 60;
                                                                      ~~~^~~~
cc1plus: all warnings being treated as errors
ninja: build stopped: cannot make progress due to previous errors.
Build build-without-wallet failed with exit code 1

Update moveToOrphan to take a single proof as an input. Having a set is not going to be helpful with next patches

tyler-smith added inline comments.
src/avalanche/peermanager.cpp
262 ↗(On Diff #31230)

AFAICT this will update the registration time of the proof, resetting the cooldown. This seems like correct behavior but I wanted to confirm.

src/avalanche/test/peermanager_tests.cpp
1052 ↗(On Diff #31230)

I'm not finding the logic where calling updatedBlockTip causes the previously orphaned proof_seq30 to no longer be orphaned. I see why proof_seq20 is getting added to the newOrphans set but not where proof_seq30 is subsequently promoted.

src/avalanche/peermanager.cpp
262 ↗(On Diff #31230)

Yes, if the proof is added to the pool the registration time is updated. BTW the cooldown is always 0 for the orphans.

src/avalanche/test/peermanager_tests.cpp
1052 ↗(On Diff #31230)

This comes the rescan() function of the orphan pool, which clears the pool and attempts to register all the proofs again. So they have 2 outcomes: they either are promoted to peer, or they are added back to the orphans (there is no way they can become permanently invalid if they made it to the pool in the first place so they are never removed because of a rescan).

Fabien planned changes to this revision.Dec 8 2021, 14:52
Fabien planned changes to this revision.Dec 8 2021, 19:26

Rebase using the conflicting pool, use the peer registration time directly to implement the cooldown feature.

Fabien planned changes to this revision.Dec 14 2021, 14:28

I can split the cooldown apart

Fabien planned changes to this revision.Dec 15 2021, 16:22
Fabien planned changes to this revision.Jan 4 2022, 16:43

This can be simplified a bit

Logic and tests look correct.

This revision is now accepted and ready to land.Feb 8 2022, 21:25