Skip to content

Commit 3c1782e

Browse files
authored
Merge pull request #1438 from delta1/simplicity-activation-dynafed
fix: simplicity activation when dynafed is active
2 parents 0e644ad + 1bb6c42 commit 3c1782e

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

src/chainparams.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class CMainParams : public CChainParams {
215215
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 709632; // Approximately November 12th, 2021
216216

217217
// Simplicity
218-
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
218+
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
219219
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
220220
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
221221
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
@@ -361,7 +361,7 @@ class CTestNetParams : public CChainParams {
361361
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
362362

363363
// Simplicity
364-
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
364+
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
365365
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
366366
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
367367
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
@@ -527,7 +527,7 @@ class SigNetParams : public CChainParams {
527527
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay
528528

529529
// Simplicity
530-
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
530+
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
531531
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
532532
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
533533
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
@@ -626,7 +626,7 @@ class CRegTestParams : public CChainParams {
626626
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nThreshold = 128;
627627

628628
// Simplicity
629-
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
629+
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
630630
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
631631
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
632632
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay
@@ -1288,7 +1288,7 @@ class CLiquidV1Params : public CChainParams {
12881288
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nThreshold = 10080; // ...of 100% signalling
12891289

12901290
// Simplicity
1291-
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 24;
1291+
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].bit = 21;
12921292
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
12931293
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
12941294
consensus.vDeployments[Consensus::DEPLOYMENT_SIMPLICITY].min_activation_height = 0; // No activation delay

test/functional/feature_elements_simplicity_activation.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class SimplicityActivationTest(BitcoinTestFramework):
1818
def set_test_params(self):
1919
self.setup_clean_chain = True
2020
self.num_nodes = 1
21+
self.extra_args = [["-evbparams=dynafed:0:::"]]
2122

2223
def skip_test_if_missing_module(self):
2324
self.skip_if_no_wallet()
@@ -36,8 +37,8 @@ def test_activation(self, rpc, activation_height):
3637
if n < 143:
3738
assert_equal (decode["versionHex"], "20000000")
3839
elif n < 431:
39-
# TESTDUMMY deployment: 144 blocks active, 144 blocks locked in
40-
assert_equal (decode["versionHex"], "30000000")
40+
# TESTDUMMY and DYNAFED deployment: 144 blocks active, 144 blocks locked in
41+
assert_equal (decode["versionHex"], "32000000")
4142
else:
4243
assert_equal (decode["versionHex"], "20000000")
4344

@@ -52,38 +53,38 @@ def test_activation(self, rpc, activation_height):
5253
blocks = self.generatetoaddress(rpc, 127, rpc.getnewaddress())
5354
for n, block in enumerate(blocks):
5455
decode = rpc.getblockheader(block)
55-
assert_equal (decode["versionHex"], "21000000")
56+
assert_equal (decode["versionHex"], "20200000")
5657
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")
5758

5859
# Fail to signal on the 128th block. Since the threshold for Simplicity is
5960
# 100% this will prevent activation. Note that our period is 128, not
6061
# 144 (the default), as we have overridden the period for Simplicity. On
6162
# the main Liquid chain it is overridden to be one week of signalling.
6263
block = rpc.getnewblockhex()
63-
block = block[:7] + "0" + block[8:] # turn off Simplicity signal
64+
block = block[:4] + "0" + block[5:] # turn off Simplicity signal
6465
rpc.submitblock(block)
6566
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")
6667

6768
# Run through another 128 blocks, without failing to signal
6869
blocks = self.generatetoaddress(rpc, 127, rpc.getnewaddress())
6970
for n, block in enumerate(blocks):
7071
decode = rpc.getblockheader(block)
71-
assert_equal (decode["versionHex"], "21000000")
72+
assert_equal (decode["versionHex"], "20200000")
7273
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")
7374
# The 128th block then switches from "started" to "locked_in"
7475
blocks = self.generatetoaddress(rpc, 1, rpc.getnewaddress())
7576
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "started")
7677
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status_next"], "locked_in")
77-
assert_equal(rpc.getblockheader(blocks[0])["versionHex"], "21000000")
78+
assert_equal(rpc.getblockheader(blocks[0])["versionHex"], "20200000")
7879

7980
# Run through another 128 blocks, which will go from "locked in" to "active" regardless of signalling
8081
blocks = self.generatetoaddress(rpc, 127, rpc.getnewaddress())
8182
for n, block in enumerate(blocks):
8283
decode = rpc.getblockheader(block)
83-
assert_equal (decode["versionHex"], "21000000")
84+
assert_equal (decode["versionHex"], "20200000")
8485
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "locked_in")
8586
block = rpc.getnewblockhex()
86-
block = block[:7] + "0" + block[8:] # turn off Simplicity signal
87+
block = block[:4] + "0" + block[5:] # turn off Simplicity signal
8788
rpc.submitblock(block)
8889
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status"], "locked_in")
8990
assert_equal(rpc.getdeploymentinfo()["deployments"]["simplicity"]["bip9"]["status_next"], "active")
@@ -103,15 +104,15 @@ def run_test(self):
103104
if n < 143:
104105
assert_equal (decode["versionHex"], "20000000")
105106
elif n < 431:
106-
# TESTDUMMY deployment: 144 blocks active, 144 blocks locked in
107-
assert_equal (decode["versionHex"], "30000000")
107+
# TESTDUMMY and DYNAFED deployment: 144 blocks active, 144 blocks locked in
108+
assert_equal (decode["versionHex"], "32000000")
108109
else:
109110
assert_equal (decode["versionHex"], "20000000")
110111

111112
# Test activation starting from height 1000
112113
# Note that for Simplicity this is an illogical combination (Simplicity without
113114
# Taproot) but for purposes of this test it's fine.
114-
self.restart_node(0, ["-evbparams=simplicity:500:::"])
115+
self.restart_node(0, ["-evbparams=dynafed:0:::", "-evbparams=simplicity:500:::"])
115116
self.nodes[0].invalidateblock(self.nodes[0].getblockhash(1))
116117
self.test_activation(self.nodes[0], 500)
117118

0 commit comments

Comments
 (0)