Skip to content

Commit cfad414

Browse files
Merge #7278: feat: remove SPORK_3_INSTANTSEND_BLOCK_FILTERING and SPORK_9_SUPERBLOCKS_ENABLED
18b990b refactor: move superblock sync check inside !IsTestChain() guard (UdjinM6) b2cde07 test, doc: address review suggestions for spork removal (UdjinM6) 3d9e80e refactor: cleanup unused members, includes and forward declaration after sporks removal (Konstantin Akimov) ee90879 doc: add release notes for SPORK_3/SPORK_9 removal (UdjinM6) afcf3d1 spork: remove SPORK_3_INSTANTSEND_BLOCK_FILTERING and SPORK_9_SUPERBLOCKS_ENABLED (UdjinM6) Pull request description: ## Issue being fixed or feature implemented Both sporks have been effectively permanent fixtures of the network and their gating logic is no longer needed. ## What was done? Drop the enum entries, spork definitions, the `AreSuperblocksEnabled()` helper, and all associated branches in governance, InstantSend, masternode payments and mining RPC. `getblocktemplate` now always reports `superblocks_enabled` as `true`. Functional tests are updated to stop toggling the removed sporks; `feature_multikeysporks.py` now uses `SPORK_19_CHAINLOCKS_ENABLED` as its second spork under test. ## How Has This Been Tested? Run tests ## Breaking Changes n/a ## Checklist: - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: PastaPastaPasta: utACK 18b990b Tree-SHA512: 2b84b1473ef1b81418fd29a0d14039ed98cda0cb7608bbf6798db62c72e76e11685ed1092cc5768c5ea95e6558b6909454fd6f5a3e2b46eb42a691294573e397
2 parents 351f0f8 + 18b990b commit cfad414

17 files changed

Lines changed: 54 additions & 80 deletions

doc/release-notes-7278.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Removed Sporks
2+
--------------
3+
4+
* `SPORK_3_INSTANTSEND_BLOCK_FILTERING` and `SPORK_9_SUPERBLOCKS_ENABLED` have
5+
been removed. These sporks were already effectively always enabled on mainnet
6+
but continued to gate behavior on test networks (testnet, regtest, and devnet).
7+
The associated functionality (InstantSend conflicting-block rejection and
8+
superblock payments) is now permanently enabled across all networks, and the
9+
sporks will no longer appear in the `spork` RPC output.
10+
11+
Updated RPCs
12+
------------
13+
14+
* `getblocktemplate` now always reports `superblocks_enabled` as `true`. The
15+
field is retained for backwards compatibility.
16+
17+
* `getblocktemplate` now requires a fully synced node at superblock heights.
18+
This check is skipped on test networks. Previously it was gated by
19+
`SPORK_9_SUPERBLOCKS_ENABLED` which was already always active on mainnet.

src/evo/chainhelper.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,12 @@ CChainstateHelper::CChainstateHelper(CEvoDB& evodb, CDeterministicMNManager& dmn
1818
llmq::CInstantSendManager& isman, llmq::CQuorumBlockProcessor& qblockman,
1919
llmq::CQuorumSnapshotManager& qsnapman, const ChainstateManager& chainman,
2020
const Consensus::Params& consensus_params, const CMasternodeSync& mn_sync,
21-
const CSporkManager& sporkman, const chainlock::Chainlocks& chainlocks,
22-
const llmq::CQuorumManager& qman) :
21+
const chainlock::Chainlocks& chainlocks, const llmq::CQuorumManager& qman) :
2322
isman{isman},
2423
credit_pool_manager{std::make_unique<CCreditPoolManager>(evodb, chainman)},
2524
m_chainlocks{chainlocks},
2625
ehf_manager{std::make_unique<CMNHFManager>(evodb, chainman, qman)},
27-
mn_payments{std::make_unique<CMNPaymentsProcessor>(dmnman, govman, chainman, consensus_params, mn_sync, sporkman)},
26+
mn_payments{std::make_unique<CMNPaymentsProcessor>(dmnman, govman, chainman, consensus_params, mn_sync)},
2827
special_tx{std::make_unique<CSpecialTxProcessor>(*credit_pool_manager, dmnman, *ehf_manager, qblockman, qsnapman,
2928
chainman, consensus_params, chainlocks, qman)}
3029
{}

src/evo/chainhelper.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class CMasternodeSync;
1919
class CMNHFManager;
2020
class CMNPaymentsProcessor;
2121
class CSpecialTxProcessor;
22-
class CSporkManager;
2322
class CTransaction;
2423
class uint256;
2524
struct CCreditPool;
@@ -61,8 +60,7 @@ class CChainstateHelper
6160
llmq::CInstantSendManager& isman, llmq::CQuorumBlockProcessor& qblockman,
6261
llmq::CQuorumSnapshotManager& qsnapman, const ChainstateManager& chainman,
6362
const Consensus::Params& consensus_params, const CMasternodeSync& mn_sync,
64-
const CSporkManager& sporkman, const chainlock::Chainlocks& chainlocks,
65-
const llmq::CQuorumManager& qman);
63+
const chainlock::Chainlocks& chainlocks, const llmq::CQuorumManager& qman);
6664
~CChainstateHelper();
6765

6866
/** Passthrough functions to chainlock::Chainlocks */

src/governance/governance.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
#include <governance/validators.h>
1212
#include <masternode/meta.h>
1313
#include <masternode/sync.h>
14-
#include <spork.h>
1514

1615
#include <chain.h>
1716
#include <chainparams.h>
1817
#include <common/bloom.h>
1918
#include <deploymentstatus.h>
19+
#include <net.h>
2020
#include <node/interface_ui.h>
2121
#include <protocol.h>
2222
#include <shutdown.h>
2323
#include <timedata.h>
24+
#include <util/check.h>
2425
#include <util/thread.h>
2526
#include <util/time.h>
2627
#include <validationinterface.h>
@@ -1490,8 +1491,3 @@ std::vector<std::shared_ptr<const CGovernanceObject>> CGovernanceManager::GetApp
14901491

14911492
return ret;
14921493
}
1493-
1494-
bool AreSuperblocksEnabled(const CSporkManager& sporkman)
1495-
{
1496-
return sporkman.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED);
1497-
}

src/governance/governance.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class CGovernanceObject;
4040
class CGovernanceVote;
4141
class CMasternodeMetaMan;
4242
class CMasternodeSync;
43-
class CSporkManager;
4443
class CSuperblock;
4544

4645
class UniValue;
@@ -444,6 +443,4 @@ class CGovernanceManager : public GovernanceStore, public GovernanceSignerParent
444443
EXCLUSIVE_LOCKS_REQUIRED(cs_store);
445444
};
446445

447-
bool AreSuperblocksEnabled(const CSporkManager& sporkman);
448-
449446
#endif // BITCOIN_GOVERNANCE_GOVERNANCE_H

src/instantsend/instantsend.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,6 @@ bool CInstantSendManager::RejectConflictingBlocks() const
474474
if (!m_mn_sync.IsBlockchainSynced()) {
475475
return false;
476476
}
477-
if (!spork_manager.IsSporkActive(SPORK_3_INSTANTSEND_BLOCK_FILTERING)) {
478-
LogPrint(BCLog::INSTANTSEND, "%s: spork3 is off, skipping transaction locking checks\n", __func__);
479-
return false;
480-
}
481477
return true;
482478
}
483479

src/masternode/payments.cpp

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,6 @@ bool CMNPaymentsProcessor::IsBlockValueValid(const CBlock& block, const int nBlo
241241

242242
// we are synced and possibly on a superblock now
243243

244-
if (!AreSuperblocksEnabled(m_sporkman)) {
245-
// should NOT allow superblocks at all, when superblocks are disabled
246-
// revert to block reward limits in this case
247-
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Superblocks are disabled, no superblocks allowed\n", __func__);
248-
if(!isBlockRewardValueMet) {
249-
strErrorRet = strprintf("coinbase pays too much at height %d (actual=%d vs limit=%d), exceeded block reward, superblocks are disabled",
250-
nBlockHeight, block.vtx[0]->GetValueOut(), blockReward);
251-
}
252-
return isBlockRewardValueMet;
253-
}
254-
255244
if (!check_superblock) return true;
256245

257246
const auto tip_mn_list = m_dmnman.GetListAtChainTip();
@@ -308,26 +297,23 @@ bool CMNPaymentsProcessor::IsBlockPayeeValid(const CTransaction& txNew, const CB
308297
}
309298

310299
// superblocks started
300+
if (!check_superblock) return true;
311301

312-
if (AreSuperblocksEnabled(m_sporkman)) {
313-
if (!check_superblock) return true;
314-
const auto tip_mn_list = m_dmnman.GetListAtChainTip();
315-
if (m_govman.IsSuperblockTriggered(tip_mn_list, nBlockHeight)) {
316-
if (m_govman.IsValidSuperblock(m_chainman.ActiveChain(), tip_mn_list, txNew, nBlockHeight,
317-
blockSubsidy + feeReward)) {
318-
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Valid superblock at height %d: %s", __func__, nBlockHeight, txNew.ToString()); /* Continued */
319-
// continue validation, should also pay MN
320-
} else {
321-
LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s", __func__, nBlockHeight, txNew.ToString()); /* Continued */
322-
// should NOT allow such superblocks, when superblocks are enabled
323-
return false;
324-
}
302+
const auto tip_mn_list = m_dmnman.GetListAtChainTip();
303+
if (m_govman.IsSuperblockTriggered(tip_mn_list, nBlockHeight)) {
304+
if (m_govman.IsValidSuperblock(m_chainman.ActiveChain(), tip_mn_list, txNew, nBlockHeight,
305+
blockSubsidy + feeReward)) {
306+
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Valid superblock at height %d: %s", /* Continued */
307+
__func__, nBlockHeight, txNew.ToString());
308+
// continue validation, should also pay MN
325309
} else {
326-
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- No triggered superblock detected at height %d\n", __func__, nBlockHeight);
310+
LogPrintf("CMNPaymentsProcessor::%s -- ERROR! Invalid superblock detected at height %d: %s", /* Continued */
311+
__func__, nBlockHeight, txNew.ToString());
312+
return false;
327313
}
328314
} else {
329-
// should NOT allow superblocks at all, when superblocks are disabled
330-
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Superblocks are disabled, no superblocks allowed\n", __func__);
315+
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- No triggered superblock detected at height %d\n",
316+
__func__, nBlockHeight);
331317
}
332318

333319
return true;
@@ -338,10 +324,9 @@ void CMNPaymentsProcessor::FillBlockPayments(CMutableTransaction& txNew, const C
338324
{
339325
int nBlockHeight = pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1;
340326

341-
// only create superblocks if spork is enabled AND if superblock is actually triggered
342-
// (height should be validated inside)
327+
// Only create superblocks when one is actually triggered.
343328
const auto tip_mn_list = m_dmnman.GetListAtChainTip();
344-
if (AreSuperblocksEnabled(m_sporkman) && m_govman.IsSuperblockTriggered(tip_mn_list, nBlockHeight)) {
329+
if (m_govman.IsSuperblockTriggered(tip_mn_list, nBlockHeight)) {
345330
LogPrint(BCLog::GOBJECT, "CMNPaymentsProcessor::%s -- Triggered superblock creation at height %d\n", __func__, nBlockHeight);
346331
m_govman.GetSuperblockPayments(tip_mn_list, nBlockHeight, voutSuperblockPaymentsRet);
347332
}

src/masternode/payments.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class CGovernanceManager;
1717
class ChainstateManager;
1818
class CMasternodeSync;
1919
class CTransaction;
20-
class CSporkManager;
2120
class CTxOut;
2221

2322
struct CMutableTransaction;
@@ -38,7 +37,6 @@ class CMNPaymentsProcessor
3837
const ChainstateManager& m_chainman;
3938
const Consensus::Params& m_consensus_params;
4039
const CMasternodeSync& m_mn_sync;
41-
const CSporkManager& m_sporkman;
4240

4341
private:
4442
[[nodiscard]] bool GetBlockTxOuts(const CBlockIndex* pindexPrev, const CAmount blockSubsidy, const CAmount feeReward,
@@ -51,9 +49,8 @@ class CMNPaymentsProcessor
5149

5250
public:
5351
explicit CMNPaymentsProcessor(CDeterministicMNManager& dmnman, CGovernanceManager& govman, const ChainstateManager& chainman,
54-
const Consensus::Params& consensus_params, const CMasternodeSync& mn_sync, const CSporkManager& sporkman) :
55-
m_dmnman{dmnman}, m_govman{govman}, m_chainman{chainman}, m_consensus_params{consensus_params}, m_mn_sync{mn_sync},
56-
m_sporkman{sporkman} {}
52+
const Consensus::Params& consensus_params, const CMasternodeSync& mn_sync) :
53+
m_dmnman{dmnman}, m_govman{govman}, m_chainman{chainman}, m_consensus_params{consensus_params}, m_mn_sync{mn_sync} {}
5754

5855
bool IsBlockValueValid(const CBlock& block, const int nBlockHeight, const CAmount blockReward, std::string& strErrorRet, const bool check_superblock);
5956
bool IsBlockPayeeValid(const CTransaction& txNew, const CBlockIndex* pindexPrev, const CAmount blockSubsidy, const CAmount feeReward, const bool check_superblock);

src/node/chainstate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void DashChainstateSetup(ChainstateManager& chainman,
236236
mempool->ConnectManagers(dmnman.get(), llmq_ctx->isman.get());
237237
chain_helper.reset();
238238
chain_helper = std::make_unique<CChainstateHelper>(evodb, *dmnman, govman, *(llmq_ctx->isman), *(llmq_ctx->quorum_block_processor),
239-
*(llmq_ctx->qsnapman), chainman, consensus_params, mn_sync, sporkman, chainlocks,
239+
*(llmq_ctx->qsnapman), chainman, consensus_params, mn_sync, chainlocks,
240240
*(llmq_ctx->qman));
241241
}
242242

src/rpc/mining.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
#include <core_io.h>
1515
#include <deploymentinfo.h>
1616
#include <deploymentstatus.h>
17+
#include <governance/classes.h>
1718
#include <key_io.h>
1819
#include <llmq/blockprocessor.h>
1920
#include <llmq/context.h>
2021
#include <evo/evodb.h>
22+
#include <masternode/sync.h>
2123
#include <net.h>
2224
#include <node/context.h>
2325
#include <node/miner.h>
@@ -42,10 +44,6 @@
4244
#include <validationinterface.h>
4345
#include <warnings.h>
4446

45-
#include <governance/classes.h>
46-
#include <governance/governance.h>
47-
#include <masternode/sync.h>
48-
4947
#include <memory>
5048
#include <stdint.h>
5149

@@ -729,14 +727,12 @@ static RPCHelpMan getblocktemplate()
729727
if (active_chainstate.IsInitialBlockDownload()) {
730728
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is in initial sync and waiting for blocks...");
731729
}
732-
}
733730

734-
// next bock is a superblock and we need governance info to correctly construct it
735-
CHECK_NONFATAL(node.sporkman);
736-
if (AreSuperblocksEnabled(*node.sporkman)
737-
&& !node.mn_sync->IsSynced()
738-
&& CSuperblock::IsValidBlockHeight(active_chain.Height() + 1))
731+
if (!node.mn_sync->IsSynced() && CSuperblock::IsValidBlockHeight(active_chain.Height() + 1)) {
732+
// Next block is a superblock but we need governance info to correctly construct it.
739733
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, PACKAGE_NAME " is syncing with network...");
734+
}
735+
}
740736

741737
static unsigned int nTransactionsUpdatedLast;
742738
const CTxMemPool& mempool = EnsureMemPool(node);
@@ -962,7 +958,7 @@ static RPCHelpMan getblocktemplate()
962958
}
963959
result.pushKV("superblock", superblockObjArray);
964960
result.pushKV("superblocks_started", pindexPrev->nHeight + 1 > consensusParams.nSuperblockStartBlock);
965-
result.pushKV("superblocks_enabled", AreSuperblocksEnabled(*node.sporkman));
961+
result.pushKV("superblocks_enabled", true);
966962

967963
result.pushKV("coinbase_payload", HexStr(pblock->vtx[0]->vExtraPayload));
968964

0 commit comments

Comments
 (0)