mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
feat: remove feature_dip0020_activationl.py functional test and related code
This commit is contained in:
parent
8598a3fbb8
commit
0e55abd0f2
@ -760,7 +760,7 @@ public:
|
||||
consensus.DIP0003EnforcementHash = uint256();
|
||||
consensus.DIP0008Height = 1; // Always active unless overridden
|
||||
consensus.BRRHeight = 1; // Always active unless overridden
|
||||
consensus.DIP0020Height = 1;
|
||||
consensus.DIP0020Height = 1; // Always active unless overridden
|
||||
consensus.DIP0024Height = 900;
|
||||
consensus.DIP0024QuorumsHeight = 900;
|
||||
consensus.V19Height = 900;
|
||||
@ -999,8 +999,6 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
|
||||
consensus.DIP0001Height = int{height};
|
||||
} else if (name == "dip0008") {
|
||||
consensus.DIP0008Height = int{height};
|
||||
} else if (name == "dip0020") {
|
||||
consensus.DIP0020Height = int{height};
|
||||
} else if (name == "v20") {
|
||||
consensus.V20Height = int{height};
|
||||
} else if (name == "mn_rr") {
|
||||
|
@ -22,7 +22,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
|
||||
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, dip0020, v20, mn_rr). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
|
||||
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, brr, dip0001, dip0008, v20, mn_rr). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
|
||||
argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
|
||||
|
@ -1,114 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2015-2024 The Dash Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
from test_framework.blocktools import create_block, create_coinbase
|
||||
from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut
|
||||
from test_framework.p2p import P2PDataStore
|
||||
from test_framework.script import CScript, OP_CAT, OP_DROP, OP_TRUE
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_raises_rpc_error, softfork_active, satoshi_round
|
||||
|
||||
'''
|
||||
feature_dip0020_activation.py
|
||||
|
||||
This test checks activation of DIP0020 opcodes
|
||||
'''
|
||||
|
||||
DISABLED_OPCODE_ERROR = "non-mandatory-script-verify-flag (Attempted to use a disabled opcode)"
|
||||
|
||||
|
||||
DIP0020_HEIGHT = 300
|
||||
class DIP0020ActivationTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 1
|
||||
self.extra_args = [[
|
||||
f'-testactivationheight=dip0020@{DIP0020_HEIGHT}',
|
||||
"-acceptnonstdtxn=1",
|
||||
]]
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
self.skip_if_no_wallet()
|
||||
|
||||
def create_test_block(self, txs, tip_hash, tip_height, tip_time):
|
||||
block = create_block(int(tip_hash, 16), create_coinbase(tip_height + 1), tip_time + 1)
|
||||
block.nVersion = 4
|
||||
block.vtx.extend(txs)
|
||||
block.hashMerkleRoot = block.calc_merkle_root()
|
||||
block.rehash()
|
||||
block.solve()
|
||||
return block
|
||||
|
||||
def run_test(self):
|
||||
node = self.nodes[0]
|
||||
relayfee = satoshi_round(node.getnetworkinfo()["relayfee"])
|
||||
|
||||
# We should have some coins already
|
||||
utxos = node.listunspent()
|
||||
assert len(utxos) > 0
|
||||
|
||||
# Lock some coins using disabled opcodes
|
||||
utxo = utxos[len(utxos) - 1]
|
||||
value = int(satoshi_round(utxo["amount"] - relayfee) * COIN)
|
||||
tx = CTransaction()
|
||||
tx.vin.append(CTxIn(COutPoint(int(utxo["txid"], 16), utxo["vout"])))
|
||||
tx.vout.append(CTxOut(value, CScript([b'1', b'2', OP_CAT])))
|
||||
tx_signed_hex = node.signrawtransactionwithwallet(tx.serialize().hex())["hex"]
|
||||
txid = node.sendrawtransaction(tx_signed_hex)
|
||||
|
||||
# This tx should be completely valid, should be included in mempool and mined in the next block
|
||||
assert txid in set(node.getrawmempool())
|
||||
self.generate(node, 1, sync_fun=self.no_op)
|
||||
assert txid not in set(node.getrawmempool())
|
||||
|
||||
# Create spending tx
|
||||
value = int(value - relayfee * COIN)
|
||||
tx0 = CTransaction()
|
||||
tx0.vin.append(CTxIn(COutPoint(int(txid, 16), 0)))
|
||||
tx0.vout.append(CTxOut(value, CScript([OP_TRUE, OP_DROP] * 15 + [OP_TRUE])))
|
||||
tx0.rehash()
|
||||
tx0_hex = tx0.serialize().hex()
|
||||
tx0id = node.decoderawtransaction(tx0_hex)["txid"]
|
||||
|
||||
# flush state to disk before potential crashes below
|
||||
self.nodes[0].gettxoutsetinfo()
|
||||
|
||||
self.log.info("Transactions spending coins with new opcodes aren't accepted before DIP0020 activation")
|
||||
assert not softfork_active(node, 'dip0020')
|
||||
assert_raises_rpc_error(-26, DISABLED_OPCODE_ERROR, node.sendrawtransaction, tx0_hex)
|
||||
helper_peer = node.add_p2p_connection(P2PDataStore())
|
||||
helper_peer.send_txs_and_test([tx0], node, success=False, reject_reason=DISABLED_OPCODE_ERROR)
|
||||
tip = node.getblock(node.getbestblockhash(), 1)
|
||||
test_block = self.create_test_block([tx0], tip["hash"], tip["height"], tip["time"])
|
||||
helper_peer.send_blocks_and_test([test_block], node, success=False, reject_reason='block-validation-failed', expect_disconnect=True)
|
||||
|
||||
self.log.info("Generate enough blocks to activate DIP0020 opcodes")
|
||||
self.generate(node, 97, sync_fun=self.no_op)
|
||||
assert not softfork_active(node, 'dip0020')
|
||||
self.generate(node, 1, sync_fun=self.no_op)
|
||||
assert softfork_active(node, 'dip0020')
|
||||
|
||||
# flush state to disk before potential crashes below
|
||||
self.nodes[0].gettxoutsetinfo()
|
||||
|
||||
# Still need 1 more block for mempool to accept txes spending new opcodes
|
||||
self.log.info("Transactions spending coins with new opcodes aren't accepted at DIP0020 activation block")
|
||||
assert_raises_rpc_error(-26, DISABLED_OPCODE_ERROR, node.sendrawtransaction, tx0_hex)
|
||||
helper_peer = node.add_p2p_connection(P2PDataStore())
|
||||
helper_peer.send_txs_and_test([tx0], node, success=False, reject_reason=DISABLED_OPCODE_ERROR)
|
||||
# A block containing new opcodes is accepted however
|
||||
tip = node.getblock(node.getbestblockhash(), 1)
|
||||
test_block = self.create_test_block([tx0], tip["hash"], tip["height"], tip["time"])
|
||||
helper_peer.send_blocks_and_test([test_block], node, success=True)
|
||||
# txes spending new opcodes still won't be accepted into mempool if we roll back to the previous tip
|
||||
node.invalidateblock(node.getbestblockhash())
|
||||
assert tx0id not in set(node.getrawmempool())
|
||||
self.generate(node, 1, sync_fun=self.no_op)
|
||||
|
||||
self.log.info("Transactions spending coins with new opcodes are accepted one block after DIP0020 activation block")
|
||||
node.sendrawtransaction(tx0_hex)
|
||||
assert tx0id in set(node.getrawmempool())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
DIP0020ActivationTest().main()
|
@ -325,7 +325,6 @@ BASE_SCRIPTS = [
|
||||
'rpc_deprecated_platform_filter.py',
|
||||
'rpc_external_queue.py',
|
||||
'rpc_wipewallettxes.py',
|
||||
'feature_dip0020_activation.py',
|
||||
'feature_uacomment.py',
|
||||
'feature_init.py',
|
||||
'wallet_coinbase_category.py --legacy-wallet',
|
||||
|
Loading…
Reference in New Issue
Block a user