Skip to content

Commit 2ccf9d1

Browse files
committed
suggestions
1 parent 340226b commit 2ccf9d1

File tree

10 files changed

+34
-36
lines changed

10 files changed

+34
-36
lines changed

src/chainparams.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ class CMainParams : public CChainParams {
219219
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
220220
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 19999999999; // TODO: To be determined later
221221
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
222-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 576;
223-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 460; // 80% of 576
224-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 346; // 60% of 576
222+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 4032;
223+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 3226; // 80% of 4032
224+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 2420; // 60% of 4032
225225
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
226226
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nMNActivationHeight = 0; // requires EHF activation
227227

@@ -589,9 +589,9 @@ class CDevNetParams : public CChainParams {
589589
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
590590
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 1661990400; // Sep 1st, 2022
591591
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
592-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 1;
593-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 1; // 80% of 100
594-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 1; // 60% of 100
592+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 120;
593+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 80; // 80% of 100
594+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 60; // 60% of 100
595595
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
596596
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nMNActivationHeight = 0; // requires EHF activation
597597

@@ -828,9 +828,9 @@ class CRegTestParams : public CChainParams {
828828
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].bit = 10;
829829
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nStartTime = 0;
830830
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
831-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 1;
832-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 1; // 100% of 1
833-
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 1; // 100% of 1
831+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nWindowSize = 12;
832+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdStart = 9; // 80% of 12
833+
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nThresholdMin = 7; // 60% of 7
834834
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nFalloffCoeff = 5; // this corresponds to 10 periods
835835
consensus.vDeployments[Consensus::DEPLOYMENT_MN_RR].nMNActivationHeight = 0; // requires EHF activation
836836

src/llmq/ehf_signals.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,12 @@ CEHFSignalsHandler::~CEHFSignalsHandler()
4646

4747
void CEHFSignalsHandler::UpdatedBlockTip(const CBlockIndex* const pindexNew)
4848
{
49-
if (!fMasternodeMode) {
49+
if (!fMasternodeMode || !llmq::utils::IsV20Active(pindexNew) || !sporkman.IsSporkActive(SPORK_24_EHF)) {
5050
return;
5151
}
5252

53-
if (!llmq::utils::IsV20Active(pindexNew)) {
54-
return;
55-
}
56-
57-
if (sporkman.IsSporkActive(SPORK_24_MN_RR_READY)) {
58-
trySignEHFSignal(Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_MN_RR].bit, pindexNew);
59-
}
53+
// TODO: should do this for all not-yet-signied bits
54+
trySignEHFSignal(Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_MN_RR].bit, pindexNew);
6055
}
6156

6257
void CEHFSignalsHandler::trySignEHFSignal(int bit, const CBlockIndex* const pindex)
@@ -108,6 +103,7 @@ void CEHFSignalsHandler::HandleNewRecoveredSig(const CRecoveredSig& recoveredSig
108103
}
109104

110105
MNHFTxPayload mnhfPayload;
106+
// TODO: should do this for all not-yet-signied bits
111107
mnhfPayload.signal.versionBit = Params().GetConsensus().vDeployments[Consensus::DEPLOYMENT_MN_RR].bit;
112108

113109
const uint256 expectedId = mnhfPayload.GetRequestId();

src/llmq/ehf_signals.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ class CEHFSignalsHandler : public CRecoveredSigsListener
3737
/**
3838
* keep freshly generated IDs for easier filter sigs in HandleNewRecoveredSig
3939
*/
40-
std::set<uint256> ids;
40+
mutable Mutex cs;
41+
std::set<uint256> ids GUARDED_BY(cs);
4142
public:
4243
explicit CEHFSignalsHandler(CChainState& chainstate, CConnman& connman,
4344
CSigningManager& sigman, CSigSharesManager& shareman,

src/rpc/blockchain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ static void BIP9SoftForkDescPushBack(const CBlockIndex* active_chain_tip, UniVal
16141614
}
16151615
bip9.pushKV("start_time", consensusParams.vDeployments[id].nStartTime);
16161616
bip9.pushKV("timeout", consensusParams.vDeployments[id].nTimeout);
1617-
bip9.pushKV("EHF", consensusParams.vDeployments[id].nMNActivationHeight);
1617+
bip9.pushKV("ehf", consensusParams.vDeployments[id].nMNActivationHeight);
16181618
int64_t since_height = VersionBitsStateSinceHeight(active_chain_tip, consensusParams, id, versionbitscache);
16191619
bip9.pushKV("since", since_height);
16201620
if (ThresholdState::STARTED == thresholdState)

src/spork.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ enum SporkId : int32_t {
4141
SPORK_19_CHAINLOCKS_ENABLED = 10018,
4242
SPORK_21_QUORUM_ALL_CONNECTED = 10020,
4343
SPORK_23_QUORUM_POSE = 10022,
44-
SPORK_24_MN_RR_READY = 10023,
44+
SPORK_24_EHF = 10023,
4545

4646
SPORK_INVALID = -1,
4747
};
@@ -75,7 +75,7 @@ struct CSporkDef
7575
MAKE_SPORK_DEF(SPORK_19_CHAINLOCKS_ENABLED, 4070908800ULL), // OFF
7676
MAKE_SPORK_DEF(SPORK_21_QUORUM_ALL_CONNECTED, 4070908800ULL), // OFF
7777
MAKE_SPORK_DEF(SPORK_23_QUORUM_POSE, 4070908800ULL), // OFF
78-
MAKE_SPORK_DEF(SPORK_24_MN_RR_READY, 4070908800ULL), // OFF
78+
MAKE_SPORK_DEF(SPORK_24_EHF, 4070908800ULL), // OFF
7979
};
8080
#undef MAKE_SPORK_DEF
8181
extern std::unique_ptr<CSporkManager> sporkManager;

src/test/block_reward_reallocation_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ using SimpleUTXOMap = std::map<COutPoint, std::pair<int, CAmount>>;
4040
struct TestChainBRRBeforeActivationSetup : public TestChainSetup
4141
{
4242
// Force fast DIP3 activation
43-
TestChainBRRBeforeActivationSetup() : TestChainSetup(497, {"-dip3params=30:50"}) {}
43+
TestChainBRRBeforeActivationSetup() : TestChainSetup(497, {"-dip3params=30:50", "-vbparams=mn_rr:0:999999999999:20:16:12:5:0"}) {}
4444
};
4545

4646
static SimpleUTXOMap BuildSimpleUtxoMap(const std::vector<CTransactionRef>& txs)

test/functional/feature_asset_locks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def run_test(self):
455455
self.sync_mempools()
456456
node.generate(1)
457457
self.sync_all()
458-
self.log.info(f"MN RR status: {get_bip9_details(node, 'mn_rr')}")
458+
self.log.info(f"MN_RR status: {get_bip9_details(node, 'mn_rr')}")
459459

460460
new_total = self.get_credit_pool_balance()
461461
amount_actually_withdrawn = total - new_total
@@ -507,8 +507,10 @@ def run_test(self):
507507
self.check_mempool_size()
508508

509509
# activate MN_RR reallocation
510-
self.activate_mn_rr()
510+
self.activate_mn_rr(expected_activation_height=node.getblockcount() + 12 * 3)
511511
self.log.info(f'height: {node.getblockcount()} credit: {self.get_credit_pool_balance()}')
512+
assert_equal(new_total, self.get_credit_pool_balance())
513+
512514
bt = node.getblocktemplate()
513515
platform_reward = bt['masternode'][0]['amount']
514516
assert_equal(bt['masternode'][0]['script'], '6a') # empty OP_RETURN

test/functional/feature_mnehf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def run_test(self):
203203
self.restart_all_nodes()
204204

205205
self.check_fork('active')
206+
206207
fork_active_blockhash = node.getbestblockhash()
207208
self.log.info(f"Invalidate block: {ehf_blockhash} with tip {fork_active_blockhash}")
208209
for inode in self.nodes:
@@ -258,7 +259,7 @@ def run_test(self):
258259

259260
self.log.info("activate MN_RR also by enabling spork 24")
260261
assert_equal(get_bip9_details(node, 'mn_rr')['status'], 'defined')
261-
self.nodes[0].sporkupdate("SPORK_24_MN_RR_READY", 0)
262+
self.nodes[0].sporkupdate("SPORK_24_EHF", 0)
262263
self.wait_for_sporks_same()
263264

264265
self.check_fork('defined')

test/functional/rpc_blockchain.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def _test_getblockchaininfo(self):
147147
'start_time': 0,
148148
'timeout': 9223372036854775807,
149149
'since': 0,
150-
'EHF': -1,
150+
'ehf': -1,
151151
}, 'active': False},
152152
'mn_rr': {
153153
'type': 'bip9',
@@ -156,7 +156,7 @@ def _test_getblockchaininfo(self):
156156
'start_time': 0,
157157
'timeout': 9223372036854775807,
158158
'since': 0,
159-
'EHF': 0,
159+
'ehf': 0,
160160
},
161161
'active': False},
162162
'testdummy': {
@@ -174,7 +174,7 @@ def _test_getblockchaininfo(self):
174174
'count': 57,
175175
'possible': True,
176176
},
177-
'EHF': -1,
177+
'ehf': -1,
178178
},
179179
'active': False},
180180
})

test/functional/test_framework/test_framework.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,7 @@ def activate_dip8(self, slow_mode=False):
10711071
self.sync_blocks()
10721072

10731073
def activate_by_name(self, name, expected_activation_height=None):
1074+
assert not softfork_active(self.nodes[0], name)
10741075
self.log.info("Wait for " + name + " activation")
10751076

10761077
# disable spork17 while mining blocks to activate "name" to prevent accidental quorum formation
@@ -1083,6 +1084,7 @@ def activate_by_name(self, name, expected_activation_height=None):
10831084
batch_size = 10
10841085
if expected_activation_height is not None:
10851086
height = self.nodes[0].getblockcount()
1087+
assert height < expected_activation_height
10861088
# NOTE: getblockchaininfo shows softforks active at block (window * 3 - 1)
10871089
# since it's returning whether a softwork is active for the _next_ block.
10881090
# Hence the last block prior to the activation is (expected_activation_height - 2).
@@ -1122,20 +1124,16 @@ def activate_v19(self, expected_activation_height=None):
11221124
def activate_v20(self, expected_activation_height=None):
11231125
self.activate_by_name('v20', expected_activation_height)
11241126

1125-
def activate_mn_rr(self):
1126-
self.nodes[0].sporkupdate("SPORK_24_MN_RR_READY", 0)
1127+
def activate_mn_rr(self, expected_activation_height=None):
1128+
self.nodes[0].sporkupdate("SPORK_24_EHF", 0)
11271129
self.wait_for_sporks_same()
1128-
11291130
mn_rr_status = 0
11301131
while mn_rr_status == 0:
11311132
time.sleep(1)
1132-
mn_rr_status = get_bip9_details(self.nodes[0], 'mn_rr')['EHF']
1133-
self.nodes[0].generate(1)
1134-
self.sync_all()
1135-
# only couple extra blocks are needed, so, helper `activate_by_name` is not needed
1136-
while get_bip9_details(self.nodes[0], 'mn_rr')['status'] != 'active':
1133+
mn_rr_status = get_bip9_details(self.nodes[0], 'mn_rr')['ehf']
11371134
self.nodes[0].generate(1)
11381135
self.sync_all()
1136+
self.activate_by_name('mn_rr', expected_activation_height)
11391137

11401138
def set_dash_llmq_test_params(self, llmq_size, llmq_threshold):
11411139
self.llmq_size = llmq_size

0 commit comments

Comments
 (0)