diff --git a/AGENTS.md b/AGENTS.md index 329bc2361a0f..e7c3f52a2312 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -241,8 +241,11 @@ Be extra careful around: - governance object and superblock payment logic; - EvoDB, credit-pool, asset-lock, and Platform integration code; - network-message serialization, checksums, and partial-send paths; -- BLS scheme transitions across connect, disconnect, undo, and activation - boundaries; +- BLS schemes: an unnamed scheme is basic; legacy is selected by a payload's + version (encoding) or by the block being validated (signature verification). + Uniqueness checks also probe both encodings, and RPC or log code may print or + parse a key or signature in either one. See "BLS schemes" in + `doc/developer-notes.md`; - future DKG/quorum prediction, which must evaluate quorum availability at the relevant future work/cycle base instead of only the current tip; - time, mocktime, scheduler, and interrupt/shutdown behavior. diff --git a/doc/design/assumeutxo.md b/doc/design/assumeutxo.md index d02930538606..ea0392977fc9 100644 --- a/doc/design/assumeutxo.md +++ b/doc/design/assumeutxo.md @@ -1,7 +1,7 @@ # assumeutxo Assumeutxo is a feature that allows fast bootstrapping of a validating dashd -instance with a very similar security model to assumevalid. +instance. ## Loading a snapshot @@ -9,12 +9,19 @@ There is currently no canonical source for snapshots, but any downloaded snapsho will be checked against a hash that's been hardcoded in source code. Once you've obtained the snapshot, you can use the RPC command `loadtxoutset` -(yet to be merged) to load it. +to load it. `loadtxoutset` and `getchainstates` are hidden and available on +regtest only. + +A masternode does not load snapshots, and a node does not start with +`-masternodeblsprivkey` while it has a snapshot chainstate, validated or not, +until a restart has promoted it. ### Pruning -A pruned node can load a snapshot. To save space, it's possible to delete the -snapshot file as soon as `loadtxoutset` finishes. +A pruned node cannot load a snapshot, and a node does not start with `-prune` +while it has a snapshot chainstate, validated or not, until a restart has +promoted it. It's possible to delete the snapshot file as soon as +`loadtxoutset` finishes. The minimum `-dbcache` setting is 550 MiB, but this functionality ignores that minimum and uses at least 1100 MiB. @@ -25,10 +32,17 @@ downloaded snapshot). ### Indexes -Indexes work but don't take advantage of this feature. They always start building +A node with `-addressindex`, `-spentindex` or `-timestampindex` cannot load a +snapshot, and does not start with them while it has a snapshot chainstate. + +Other indexes work but don't take advantage of this feature. They always start building from the genesis block. Once the background validation reaches the snapshot block, indexes will continue to build all the way to the tip. +Governance waits until background validation has completed and the governance +collateral index has caught up: until then the node neither processes nor relays +governance objects, and `gobject prepare` and `gobject submit` refuse. + For indexes that support pruning, note that no pruning will take place between the snapshot and the tip, until the background sync has completed - after which everything is pruned. Depending on how old the snapshot is, this may temporarily @@ -51,18 +65,12 @@ The utility script ## Design notes -- A new block index `nStatus` flag is introduced, `BLOCK_ASSUMED_VALID`, to mark block - index entries that are required to be assumed-valid by a chainstate created - from a UTXO snapshot. This flag is used as a way to modify certain - CheckBlockIndex() logic to account for index entries that are pending validation by a - chainstate running asynchronously in the background. - - The concept of UTXO snapshots is treated as an implementation detail that lives behind the ChainstateManager interface. The external presentation of the changes required to facilitate the use of UTXO snapshots is the understanding that there are - now certain regions of the chain that can be temporarily assumed to be valid (using - the nStatus flag mentioned above). In certain cases, e.g. wallet rescanning, this is - very similar to dealing with a pruned chain. + now certain regions of the chain that can be temporarily assumed to be valid. + In certain cases, e.g. wallet rescanning, this is very similar to dealing with + a pruned chain. Logic outside ChainstateManager should try not to know about snapshots, instead preferring to work in terms of more general states like assumed-valid. diff --git a/doc/developer-notes.md b/doc/developer-notes.md index 56511991ff7e..3d281d02f2f0 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -18,6 +18,7 @@ Developer Notes - [DEBUG_LOCKORDER](#debug_lockorder) - [DEBUG_LOCKCONTENTION](#debug_lockcontention) - [Assertions and Checks](#assertions-and-checks) + - [BLS schemes](#bls-schemes) - [Valgrind suppressions file](#valgrind-suppressions-file) - [Compiling for test coverage](#compiling-for-test-coverage) - [Performance profiling with perf](#performance-profiling-with-perf) @@ -502,6 +503,36 @@ assert; use `Assume` for our *own* bookkeeping while still handling the violated case; and reserve `assert` for the narrow spot where continuing would corrupt EvoDB, the block index, or the wallet. +### BLS schemes + +BLS public keys and signatures have two encodings and two signature schemes: the +legacy one used before v19, and the basic one used since. Which one applies is a +property of the data or of the block, never of the node: + +- A call that names no scheme is basic. That is the right choice for everything + that is not historical: P2P messages, DKG, signing, ChainLocks, InstantSend, + governance, and any new payload or message. +- The encoding of a key or signature inside a versioned structure follows that + structure's version. Use the helper of its owner (`ProTxVersion::GetBLSScheme()`, + `CFinalCommitment::GetBLSScheme()`, `OperatorKeyScheme()`) rather than comparing + versions inline. +- The scheme a signature in a block is *verified* under follows the block, not the + version of the payload carrying it: `BLSSchemeAfter(pindexPrev, params)`, which + provider transaction checks receive as `SpecialTxRules::bls_scheme`. A + legacy-encoded payload mined after v19 is verified under basic. +- Production code cannot sign under the legacy scheme. Tests that need a legacy + signature for historical validation use `SignBLS()` from `test/util/bls.h`. +- An operator key (`CBLSLazyPublicKey`) has no encoding of its own, so + serializing, hashing or printing one always names the scheme, taken from the + payload or masternode state that owns it. +- Two other kinds of code name legacy explicitly: operator-key uniqueness + checks, which probe both encodings, and RPC or log code that prints or parses + a key or signature in either encoding. + +`test/lint/lint-bls-scheme.py` lists the files that may name `BLSScheme::Legacy`: +version and block selection, those uniqueness probes, legacy-diff migration, and +the RPC or log code that prints or parses either encoding. + ### Valgrind suppressions file Valgrind is a programming tool for memory debugging, memory leak detection, and diff --git a/doc/release-notes-7593.md b/doc/release-notes-7593.md new file mode 100644 index 000000000000..79db45766e96 --- /dev/null +++ b/doc/release-notes-7593.md @@ -0,0 +1,16 @@ +Updated RPCs +------------ + +- On a pruned node, `quorum info`, `quorum memberof` and `quorum selectquorum` + fail with `RPC_INTERNAL_ERROR` for a quorum whose members this node cannot + compute because the block that fixes them was pruned. They used to work with + members computed from a substitute value, which could be wrong. (#7593) + +Other changes +------------- + +- A pruned node no longer substitutes the block hash for the quorum score + modifier of a pruned work block. It keeps such a quorum's public key, from + its mined commitment, without members, so it still verifies signatures + by that quorum (for example on masternode hard-fork signals) and never + stalls on them. (#7593) diff --git a/doc/release-notes-7887.md b/doc/release-notes-7887.md new file mode 100644 index 000000000000..b07f910c4b77 --- /dev/null +++ b/doc/release-notes-7887.md @@ -0,0 +1,39 @@ +Updated RPCs +------------ + +- An RPC that fails with an error because this node cannot read the + masternode, quorum or other Evo state it needs, for example because the + block data it is derived from was pruned, now returns error code + `RPC_INTERNAL_ERROR` (-32603) instead of `RPC_MISC_ERROR` (-1). The request + was not at fault. The package RPCs report such a failure as described + below. (#7887) + +- `testmempoolaccept` with more than one transaction reports such a failure as + the `package-error` `evo-local-unavailable`, and `submitpackage` fails with + that reason. (#7887) + +Other changes +------------- + +- A block this node has stored but cannot read back while deriving the credit + pool or the EHF signals no longer makes the block being validated invalid. + The node shuts down with a "Failed to read block" error instead, as it does + when it cannot read a block it is connecting. (#7887) + +- On a node without an assumeutxo snapshot, a warning about Evo state that + cannot be derived because block data was pruned now says so and suggests + restarting with `-reindex`. Startup still fails when the EHF signals at the + tip cannot be rebuilt. (#7887) + +- On a pruned node, a block whose masternode, quorum or other Evo state + depends on block data that was pruned is no longer marked invalid, which + left the node on a local fork until `reconsiderblock`. The node now stops + advancing at that block, logs an error and shows a warning that block data + was pruned; restart with `-reindex` to download it again. (#7887) + +- Developers: on regtest, every Evo database access must now be bound to a + chainstate's view (the hidden `-checkevobinding` option, on by default + there). A code path that reads Evo state without a binding fails with an + internal error, a dropped task or a stalled chainstate instead of reading + the default view. Local regtest networks run with it unless started with + `-checkevobinding=0`. (#7887) diff --git a/doc/zmq.md b/doc/zmq.md index d9e2709b2f81..3fd715d7762d 100644 --- a/doc/zmq.md +++ b/doc/zmq.md @@ -141,11 +141,11 @@ Where the 8-byte uints correspond to the mempool sequence number. | hashtx | <32-byte transaction hash in Little Endian> | -`rawblock`: Notifies when the chain tip is updated. Messages are ZMQ multipart messages with three parts. The first part is the topic (`rawblock`), the second part is the serialized block, and the last part is a sequence number (representing the message count to detect lost messages). +`rawblock`: Notifies when the chain tip is updated. When assumeutxo is in use, this notification will not be issued for historical blocks connected to the background validation chainstate. Messages are ZMQ multipart messages with three parts. The first part is the topic (`rawblock`), the second part is the serialized block, and the last part is a sequence number (representing the message count to detect lost messages). | rawblock | | -`hashblock`: Notifies when the chain tip is updated. Messages are ZMQ multipart messages with three parts. The first part is the topic (`hashblock`), the second part is the 32-byte block hash, and the last part is a sequence number (representing the message count to detect lost messages). +`hashblock`: Notifies when the chain tip is updated. When assumeutxo is in use, this notification will not be issued for historical blocks connected to the background validation chainstate. Messages are ZMQ multipart messages with three parts. The first part is the topic (`hashblock`), the second part is the 32-byte block hash, and the last part is a sequence number (representing the message count to detect lost messages). | hashblock | <32-byte block hash in Little Endian> | diff --git a/src/Makefile.am b/src/Makefile.am index 4bd5da7cdc72..cad46d84e2b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -235,10 +235,13 @@ BITCOIN_CORE_H = \ evo/simplifiedmns.h \ evo/smldiff.h \ evo/snapshot.h \ + evo/snapshot_config.h \ + evo/snapshot_types.h \ evo/specialtx.h \ evo/specialtx_filter.h \ evo/specialtxman.h \ evo/types.h \ + evo/viewcache.h \ external_signer.h \ flat-database.h \ flatfile.h \ @@ -570,6 +573,8 @@ libbitcoin_node_a_SOURCES = \ evo/simplifiedmns.cpp \ evo/smldiff.cpp \ evo/snapshot.cpp \ + evo/snapshot_chain.cpp \ + evo/snapshot_config.cpp \ evo/specialtx.cpp \ evo/specialtx_filter.cpp \ evo/specialtxman.cpp \ @@ -955,6 +960,7 @@ libbitcoin_consensus_a_SOURCES = \ arith_uint256.h \ bls/bls.cpp \ bls/bls.h \ + bls/scheme.h \ consensus/amount.h \ consensus/merkle.cpp \ consensus/merkle.h \ @@ -1311,6 +1317,9 @@ libdashkernel_la_SOURCES = \ evo/providertx_util.cpp \ evo/simplifiedmns.cpp \ evo/smldiff.cpp \ + evo/snapshot.cpp \ + evo/snapshot_chain.cpp \ + evo/snapshot_config.cpp \ evo/specialtx.cpp \ evo/specialtx_filter.cpp \ evo/specialtxman.cpp \ diff --git a/src/Makefile.test_util.include b/src/Makefile.test_util.include index 91a9ca2788dc..ff16b4464d41 100644 --- a/src/Makefile.test_util.include +++ b/src/Makefile.test_util.include @@ -8,9 +8,11 @@ EXTRA_LIBRARIES += \ $(LIBTEST_UTIL) TEST_UTIL_H = \ + test/util/bls.h \ test/util/blockfilter.h \ test/util/chainstate.h \ test/util/coins.h \ + test/util/evo_snapshot.h \ test/util/json.h \ test/util/index.h \ test/util/llmq_tests.h \ @@ -35,6 +37,7 @@ endif # ENABLE_WALLET libtest_util_a_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BOOST_CPPFLAGS) libtest_util_a_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS) libtest_util_a_SOURCES = \ + test/util/bls.cpp \ test/util/blockfilter.cpp \ test/util/index.cpp \ test/util/coins.cpp \ diff --git a/src/active/dkgsession.cpp b/src/active/dkgsession.cpp index 1fdad45fd7d5..8338114a68d1 100644 --- a/src/active/dkgsession.cpp +++ b/src/active/dkgsession.cpp @@ -31,8 +31,7 @@ ActiveDKGSession::ActiveDKGSession(CBLSWorker& bls_worker, CDeterministicMNManag CDKGSession(bls_worker, dmnman, dkgdbgman, qdkgsman, qsnapman, chainman, base_block_index, llmq_params), m_mn_metaman{mn_metaman}, m_mn_activeman{mn_activeman}, - m_sporkman{sporkman}, - m_use_legacy_bls{!DeploymentActiveAfter(m_quorum_base_block_index, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)} + m_sporkman{sporkman} { } @@ -125,7 +124,7 @@ std::optional ActiveDKGSession::SendContributions() logger.Batch("encrypted contributions. time=%d", t1.count()); - qc.sig = m_mn_activeman.Sign(qc.GetSignHash(), m_use_legacy_bls); + qc.sig = m_mn_activeman.Sign(qc.GetSignHash()); logger.Flush(); @@ -157,7 +156,6 @@ void ActiveDKGSession::VerifyPendingContributions() std::vector memberIndexes; std::vector vvecs; std::vector skContributions; - bool anyLegacyVvec{false}; for (const auto& idx : pendingContributionVerifications) { const auto& m = members[idx]; @@ -166,7 +164,6 @@ void ActiveDKGSession::VerifyPendingContributions() } memberIndexes.emplace_back(idx); vvecs.emplace_back(receivedVvecs[idx]); - anyLegacyVvec |= receivedVvecsLegacyScheme[idx]; skContributions.emplace_back(receivedSkContributions[idx]); // Write here to definitely store one contribution for each member no matter if // our share is valid or not, could be that others are still correct @@ -184,9 +181,8 @@ void ActiveDKGSession::VerifyPendingContributions() return; } - // Weighted aggregation needs points that passed subgroup checks, which legacy-scheme deserialization skips auto result = blsWorker.VerifyContributionShares(myId, vvecs, skContributions, /*parallel=*/true, - /*aggregated=*/!anyLegacyVvec); + /*aggregated=*/true); if (result.size() != memberIndexes.size()) { logger.Batch("VerifyContributionShares returned result of size %d but size %d was expected, something is wrong", result.size(), memberIndexes.size()); return; @@ -348,7 +344,7 @@ std::optional ActiveDKGSession::SendComplaint() logger.Batch("sending complaint. badCount=%d, complaintCount=%d", badCount, complaintCount); - qc.sig = m_mn_activeman.Sign(qc.GetSignHash(), m_use_legacy_bls); + qc.sig = m_mn_activeman.Sign(qc.GetSignHash()); logger.Flush(); @@ -438,7 +434,7 @@ std::optional ActiveDKGSession::SendJustification(const Uint2 return std::nullopt; } - qj.sig = m_mn_activeman.Sign(qj.GetSignHash(), m_use_legacy_bls); + qj.sig = m_mn_activeman.Sign(qj.GetSignHash()); logger.Flush(); @@ -595,23 +591,24 @@ std::optional ActiveDKGSession::SendCommitment() (*qc.quorumVvecHash.begin())++; } - uint256 commitmentHash = BuildCommitmentHash(qc.llmqType, qc.quorumHash, qc.validMembers, qc.quorumPublicKey, qc.quorumVvecHash); + uint256 commitmentHash = BuildCommitmentHash(qc.llmqType, qc.quorumHash, qc.validMembers, qc.quorumPublicKey, + qc.quorumVvecHash, BLSScheme::Basic); if (lieType == 2) { (*commitmentHash.begin())++; } - qc.sig = m_mn_activeman.Sign(commitmentHash, m_use_legacy_bls); - qc.quorumSig = skShare.Sign(commitmentHash, m_use_legacy_bls); + qc.sig = m_mn_activeman.Sign(commitmentHash); + qc.quorumSig = skShare.Sign(commitmentHash); if (lieType == 3) { - auto buf = qc.sig.ToBytes(m_use_legacy_bls); + auto buf = qc.sig.ToBytes(); buf[5]++; - qc.sig.SetBytes(buf, m_use_legacy_bls); + qc.sig.SetBytes(buf); } else if (lieType == 4) { - auto buf = qc.quorumSig.ToBytes(m_use_legacy_bls); + auto buf = qc.quorumSig.ToBytes(); buf[5]++; - qc.quorumSig.SetBytes(buf, m_use_legacy_bls); + qc.quorumSig.SetBytes(buf); } t3.stop(); @@ -686,7 +683,8 @@ std::vector ActiveDKGSession::FinalizeCommitments() fqc.nVersion = CFinalCommitment::GetVersion(isQuorumRotationEnabled, DeploymentActiveAfter(m_quorum_base_block_index, m_chainman.GetConsensus(), Consensus::DEPLOYMENT_V19)); fqc.quorumIndex = isQuorumRotationEnabled ? quorumIndex : 0; - uint256 commitmentHash = BuildCommitmentHash(fqc.llmqType, fqc.quorumHash, fqc.validMembers, fqc.quorumPublicKey, fqc.quorumVvecHash); + uint256 commitmentHash = BuildCommitmentHash(fqc.llmqType, fqc.quorumHash, fqc.validMembers, + fqc.quorumPublicKey, fqc.quorumVvecHash, BLSScheme::Basic); std::vector aggSigs; std::vector aggPks; @@ -722,7 +720,7 @@ std::vector ActiveDKGSession::FinalizeCommitments() t2.stop(); cxxtimer::Timer t3(true); - if (!fqc.Verify({m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, true)) { + if (!fqc.Verify({m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, BLSScheme::Basic)) { logger.Batch("failed to verify final commitment"); continue; } @@ -773,16 +771,16 @@ CFinalCommitment ActiveDKGSession::FinalizeSingleCommitment() fqc.quorumIndex = 0; uint256 commitmentHash = BuildCommitmentHash(fqc.llmqType, fqc.quorumHash, fqc.validMembers, fqc.quorumPublicKey, - fqc.quorumVvecHash); - fqc.quorumSig = sk1.Sign(commitmentHash, m_use_legacy_bls); + fqc.quorumVvecHash, BLSScheme::Basic); + fqc.quorumSig = sk1.Sign(commitmentHash); - fqc.membersSig = m_mn_activeman.Sign(commitmentHash, m_use_legacy_bls); + fqc.membersSig = m_mn_activeman.Sign(commitmentHash); if (workaround_qpublic_key) { fqc.quorumSig = fqc.membersSig; } - if (!fqc.Verify({m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, true)) { + if (!fqc.Verify({m_dmnman, m_qsnapman, m_chainman, m_quorum_base_block_index}, BLSScheme::Basic)) { logger.Batch("failed to verify final commitment"); assert(false); } diff --git a/src/active/dkgsession.h b/src/active/dkgsession.h index 6ea2f71a510d..e7db33a7ce92 100644 --- a/src/active/dkgsession.h +++ b/src/active/dkgsession.h @@ -20,7 +20,6 @@ class ActiveDKGSession final : public llmq::CDKGSession CMasternodeMetaMan& m_mn_metaman; const CActiveMasternodeManager& m_mn_activeman; const CSporkManager& m_sporkman; - const bool m_use_legacy_bls{false}; public: ActiveDKGSession() = delete; diff --git a/src/active/dkgsessionhandler.cpp b/src/active/dkgsessionhandler.cpp index 1d540275efda..8fb6f3c01217 100644 --- a/src/active/dkgsessionhandler.cpp +++ b/src/active/dkgsessionhandler.cpp @@ -87,6 +87,11 @@ bool ActiveDKGSessionHandler::InitNewQuorum(gsl::not_null pQ if (!DeploymentDIP0003Enforced(pQuorumBaseBlockIndex->nHeight, Params().GetConsensus())) { return false; } + if (!DeploymentActiveAfter(pQuorumBaseBlockIndex, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)) { + LogPrint(BCLog::LLMQ_DKG, "%s -- no DKG for quorum base %d: v19 is not active\n", __func__, + pQuorumBaseBlockIndex->nHeight); + return false; + } auto next_session = std::make_shared(m_bls_worker, m_dmnman, m_dkgdbgman, m_qdkgsman, m_mn_metaman, m_qsnapman, m_mn_activeman, m_chainman, @@ -114,15 +119,31 @@ void ActiveDKGSessionHandler::WaitForNextPhase(std::optional curPha { LogPrint(BCLog::LLMQ_DKG, "ActiveDKGSessionHandler::%s -- %s qi[%d] - starting, curPhase=%d, nextPhase=%d\n", __func__, params.name, quorumIndex, curPhase.has_value() ? std23::to_underlying(*curPhase) : -1, std23::to_underlying(nextPhase)); + const bool waiting_for_round_start{!curPhase.has_value()}; + bool logged_snapshot_wait{false}; while (true) { - if (m_chainman.IsSnapshotActiveAndUnvalidated()) { - LogPrint(BCLog::LLMQ_DKG, "ActiveDKGSessionHandler::%s -- %s qi[%d] - aborting because snapshot background validation is incomplete\n", __func__, params.name, quorumIndex); - throw AbortPhaseException(); - } if (stopRequested) { LogPrint(BCLog::LLMQ_DKG, "ActiveDKGSessionHandler::%s -- %s qi[%d] - aborting due to stop/shutdown requested\n", __func__, params.name, quorumIndex); throw AbortPhaseException(); } + if (m_chainman.IsSnapshotActiveAndUnvalidated()) { + if (!waiting_for_round_start) { + LogPrint(BCLog::LLMQ_DKG, + "ActiveDKGSessionHandler::%s -- %s qi[%d] - aborting because snapshot background validation " + "is incomplete\n", + __func__, params.name, quorumIndex); + throw AbortPhaseException(); + } + // No round can start until background validation completes, so wait instead of aborting + if (!logged_snapshot_wait) { + LogPrint(BCLog::LLMQ_DKG, + "ActiveDKGSessionHandler::%s -- %s qi[%d] - waiting for snapshot background validation\n", + __func__, params.name, quorumIndex); + logged_snapshot_wait = true; + } + UninterruptibleSleep(std::chrono::milliseconds{100}); + continue; + } auto [_phase, _quorumHash] = GetPhaseAndQuorumHash(); if (!expectedQuorumHash.IsNull() && _quorumHash != expectedQuorumHash) { LogPrint(BCLog::LLMQ_DKG, "ActiveDKGSessionHandler::%s -- %s qi[%d] - aborting due unexpected expectedQuorumHash change\n", __func__, params.name, quorumIndex); diff --git a/src/active/dkgsessionhandler.h b/src/active/dkgsessionhandler.h index 11764fe17bd1..acbcc36f29b6 100644 --- a/src/active/dkgsessionhandler.h +++ b/src/active/dkgsessionhandler.h @@ -107,7 +107,8 @@ class ActiveDKGSessionHandler final : public llmq::CDKGSessionHandler bool InitNewQuorum(gsl::not_null pQuorumBaseBlockIndex) EXCLUSIVE_LOCKS_REQUIRED(!cs_session); /** - * @param curPhase current QuorumPhase + * @param curPhase current QuorumPhase, or nullopt for the wait before a round starts, which waits out an + * unvalidated snapshot instead of aborting * @param nextPhase next QuorumPhase * @param expectedQuorumHash expected QuorumHash, defaults to null * @param shouldNotWait function that returns bool, defaults to function that returns false. If the function returns false, we will wait in the loop, if true, we don't wait diff --git a/src/active/masternode.cpp b/src/active/masternode.cpp index 20561768e686..d207be34f722 100644 --- a/src/active/masternode.cpp +++ b/src/active/masternode.cpp @@ -59,8 +59,7 @@ CActiveMasternodeManager::CActiveMasternodeManager(CConnman& connman, CDetermini { assert(sk.IsValid()); /* We can assume pk is valid if sk is valid */ LogPrintf("MASTERNODE:\n blsPubKeyOperator legacy: %s\n blsPubKeyOperator basic: %s\n", - m_operator_pk.ToString(/*specificLegacyScheme=*/true), - m_operator_pk.ToString(/*specificLegacyScheme=*/false)); + m_operator_pk.ToString(BLSScheme::Legacy), m_operator_pk.ToString(BLSScheme::Basic)); } CActiveMasternodeManager::~CActiveMasternodeManager() = default; @@ -288,21 +287,21 @@ template bool CActiveMasternodeManager::Decrypt(const CBLSIESEncryptedObject& obj, size_t idx, CBLSSecretKey& ret_obj, int version) const; -[[nodiscard]] CBLSSignature CActiveMasternodeManager::Sign(const uint256& hash, const bool is_legacy) const +[[nodiscard]] CBLSSignature CActiveMasternodeManager::Sign(const uint256& hash) const { AssertLockNotHeld(cs); - return WITH_READ_LOCK(cs, return m_operator_sk.Sign(hash, is_legacy)); + return WITH_READ_LOCK(cs, return m_operator_sk.Sign(hash)); } [[nodiscard]] std::vector CActiveMasternodeManager::SignBasic(const uint256& hash) const { AssertLockNotHeld(cs); - auto sig = Sign(hash, /*is_legacy=*/false); + auto sig = Sign(hash); assert(sig.IsValid()); - return sig.ToByteVector(/*specificLegacyScheme=*/false); + return sig.ToByteVector(); } -// We need to pass a copy as opposed to a const ref because CBLSPublicKeyVersionWrapper +// We need to pass a copy as opposed to a const ref because BLSEncoded // does not accept a const ref in its construction args [[nodiscard]] CBLSPublicKey CActiveMasternodeManager::GetPubKey() const { diff --git a/src/active/masternode.h b/src/active/masternode.h index e189fba0ea02..de0c68bea6e1 100644 --- a/src/active/masternode.h +++ b/src/active/masternode.h @@ -61,7 +61,7 @@ class CActiveMasternodeManager template