Skip to content

Commit 5318d68

Browse files
Merge #6302: feat: remove DIP0020 requirement for OP_ since it is activated long time ago
c8fd37d docs: added a comment about removed SCRIPT_ENABLE_DIP0020_OPCODES (Konstantin Akimov) 61bc300 feat: drop SCRIPT_ENABLE_DIP0020_OPCODES, make opcodes available from genesis block (Konstantin Akimov) 0e55abd feat: remove feature_dip0020_activationl.py functional test and related code (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented it's alternate solution for #6299 to fix a crash reported #6256 ## What was done? Removed code related to DIP0020 activation for various OP codes. DIP0020 is activated long time ago and no any historical blocks are violating rules, removing it's backwards compatible. ## How Has This Been Tested? Run unit and functional tests. See also changes in data for unit tests and removed functional test. It also re-index mainnet and testnet successfully ``` src/qt/dash-qt -reindex -assumevalid=0 src/qt/dash-qt -testnet -reindex -assumevalid=0 ``` Also extra test is done with bitcoin#23590 - no crash with it in `feature_dip0020_activation.py` [modified assuming it is always activated] ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: UdjinM6: utACK c8fd37d PastaPastaPasta: utACK c8fd37d Tree-SHA512: 05ddda4e8fb66305995e91c8a04fbda690aef8fb82acb23b7d62f302da60b5ec7e7a97bd988efd2523dbd9cafde9f4b65cae2db9e4b5257464ce1c8fcca6a40f
2 parents dc02da1 + c8fd37d commit 5318d68

File tree

13 files changed

+239
-400
lines changed

13 files changed

+239
-400
lines changed

src/chainparams.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ class CRegTestParams : public CChainParams {
760760
consensus.DIP0003EnforcementHash = uint256();
761761
consensus.DIP0008Height = 1; // Always active unless overridden
762762
consensus.BRRHeight = 1; // Always active unless overridden
763-
consensus.DIP0020Height = 1;
763+
consensus.DIP0020Height = 1; // Always active unless overridden
764764
consensus.DIP0024Height = 900;
765765
consensus.DIP0024QuorumsHeight = 900;
766766
consensus.V19Height = 900;
@@ -999,8 +999,6 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
999999
consensus.DIP0001Height = int{height};
10001000
} else if (name == "dip0008") {
10011001
consensus.DIP0008Height = int{height};
1002-
} else if (name == "dip0020") {
1003-
consensus.DIP0020Height = int{height};
10041002
} else if (name == "v20") {
10051003
consensus.V20Height = int{height};
10061004
} else if (name == "mn_rr") {

src/chainparamsbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
2222
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2323
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
2424
argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
25-
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);
25+
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);
2626
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);
2727
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);
2828
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);

src/policy/policy.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VE
6060
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
6161
SCRIPT_VERIFY_CHECKSEQUENCEVERIFY |
6262
SCRIPT_VERIFY_LOW_S |
63-
SCRIPT_ENABLE_DIP0020_OPCODES |
6463
SCRIPT_VERIFY_CONST_SCRIPTCODE;
6564

6665
/** For convenience, standard but not mandatory verify flags. */

src/script/interpreter.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -409,23 +409,6 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
409409
if (opcode > OP_16 && ++nOpCount > MAX_OPS_PER_SCRIPT)
410410
return set_error(serror, SCRIPT_ERR_OP_COUNT);
411411

412-
bool fDIP0020OpcodesEnabled = (flags & SCRIPT_ENABLE_DIP0020_OPCODES) != 0;
413-
if (!fDIP0020OpcodesEnabled) {
414-
if (opcode == OP_CAT ||
415-
opcode == OP_SPLIT ||
416-
opcode == OP_AND ||
417-
opcode == OP_OR ||
418-
opcode == OP_XOR ||
419-
opcode == OP_DIV ||
420-
opcode == OP_MOD ||
421-
opcode == OP_NUM2BIN ||
422-
opcode == OP_BIN2NUM ||
423-
opcode == OP_CHECKDATASIG ||
424-
opcode == OP_CHECKDATASIGVERIFY) {
425-
return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); // Disabled opcodes.
426-
}
427-
}
428-
429412
if (opcode == OP_INVERT ||
430413
opcode == OP_2MUL ||
431414
opcode == OP_2DIV ||

src/script/interpreter.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ enum : uint32_t {
9595
//
9696
SCRIPT_VERIFY_NULLFAIL = (1U << 14),
9797

98-
// Enable the opcodes listed in DIP0020 (OP_CAT, OP_AND, OP_OR, OP_XOR, OP_DIV, OP_MOD, OP_SPLIT, OP_BIN2NUM, OP_NUM2BIN, OP_CHECKDATASIG, OP_CHECKDATASIGVERIFY).
99-
SCRIPT_ENABLE_DIP0020_OPCODES = (1U << 15),
98+
// DIP0020_OPCODES - ignored.
99+
// Was used to enable the opcodes listed in DIP0020
100+
// (OP_CAT, OP_AND, OP_OR, OP_XOR, OP_DIV, OP_MOD, OP_SPLIT, OP_BIN2NUM,
101+
// OP_NUM2BIN, OP_CHECKDATASIG, OP_CHECKDATASIGVERIFY).
102+
// SCRIPT_ENABLE_DIP0020_OPCODES = (1U << 15),
100103

101104
// Making OP_CODESEPARATOR and FindAndDelete fail
102105
//

src/test/checkdatasig_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void CheckError(uint32_t flags, const stacktype& original_stack,
4242
BaseSignatureChecker sigchecker;
4343
ScriptError err = ScriptError::SCRIPT_ERR_OK;
4444
stacktype stack{original_stack};
45-
bool r = EvalScript(stack, script, flags | SCRIPT_ENABLE_DIP0020_OPCODES, sigchecker, SigVersion::BASE, &err);
45+
bool r = EvalScript(stack, script, flags, sigchecker, SigVersion::BASE, &err);
4646
BOOST_CHECK(!r);
4747
BOOST_CHECK(err == expected);
4848
}
@@ -53,7 +53,7 @@ static void CheckPass(uint32_t flags, const stacktype& original_stack,
5353
BaseSignatureChecker sigchecker;
5454
ScriptError err = ScriptError::SCRIPT_ERR_OK;
5555
stacktype stack{original_stack};
56-
bool r = EvalScript(stack, script, flags | SCRIPT_ENABLE_DIP0020_OPCODES, sigchecker, SigVersion::BASE, &err);
56+
bool r = EvalScript(stack, script, flags, sigchecker, SigVersion::BASE, &err);
5757
BOOST_CHECK(r);
5858
BOOST_CHECK(err == ScriptError::SCRIPT_ERR_OK);
5959
BOOST_CHECK(stack == expected);

0 commit comments

Comments
 (0)