Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dashpay/dash into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Oct 15, 2024
2 parents cc2b6aa + d62fa7c commit 93eb979
Show file tree
Hide file tree
Showing 18 changed files with 259 additions and 410 deletions.
4 changes: 1 addition & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ class CRegTestParams : public CChainParams {
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;
Expand Down Expand Up @@ -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") {
Expand Down
2 changes: 1 addition & 1 deletion src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/policy/policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ static constexpr unsigned int STANDARD_SCRIPT_VERIFY_FLAGS = MANDATORY_SCRIPT_VE
SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY |
SCRIPT_VERIFY_CHECKSEQUENCEVERIFY |
SCRIPT_VERIFY_LOW_S |
SCRIPT_ENABLE_DIP0020_OPCODES |
SCRIPT_VERIFY_CONST_SCRIPTCODE;

/** For convenience, standard but not mandatory verify flags. */
Expand Down
17 changes: 0 additions & 17 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,23 +409,6 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
if (opcode > OP_16 && ++nOpCount > MAX_OPS_PER_SCRIPT)
return set_error(serror, SCRIPT_ERR_OP_COUNT);

bool fDIP0020OpcodesEnabled = (flags & SCRIPT_ENABLE_DIP0020_OPCODES) != 0;
if (!fDIP0020OpcodesEnabled) {
if (opcode == OP_CAT ||
opcode == OP_SPLIT ||
opcode == OP_AND ||
opcode == OP_OR ||
opcode == OP_XOR ||
opcode == OP_DIV ||
opcode == OP_MOD ||
opcode == OP_NUM2BIN ||
opcode == OP_BIN2NUM ||
opcode == OP_CHECKDATASIG ||
opcode == OP_CHECKDATASIGVERIFY) {
return set_error(serror, SCRIPT_ERR_DISABLED_OPCODE); // Disabled opcodes.
}
}

if (opcode == OP_INVERT ||
opcode == OP_2MUL ||
opcode == OP_2DIV ||
Expand Down
7 changes: 5 additions & 2 deletions src/script/interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ enum : uint32_t {
//
SCRIPT_VERIFY_NULLFAIL = (1U << 14),

// 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).
SCRIPT_ENABLE_DIP0020_OPCODES = (1U << 15),
// DIP0020_OPCODES - ignored.
// Was used to 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).
// SCRIPT_ENABLE_DIP0020_OPCODES = (1U << 15),

// Making OP_CODESEPARATOR and FindAndDelete fail
//
Expand Down
4 changes: 2 additions & 2 deletions src/test/checkdatasig_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void CheckError(uint32_t flags, const stacktype& original_stack,
BaseSignatureChecker sigchecker;
ScriptError err = ScriptError::SCRIPT_ERR_OK;
stacktype stack{original_stack};
bool r = EvalScript(stack, script, flags | SCRIPT_ENABLE_DIP0020_OPCODES, sigchecker, SigVersion::BASE, &err);
bool r = EvalScript(stack, script, flags, sigchecker, SigVersion::BASE, &err);
BOOST_CHECK(!r);
BOOST_CHECK(err == expected);
}
Expand All @@ -53,7 +53,7 @@ static void CheckPass(uint32_t flags, const stacktype& original_stack,
BaseSignatureChecker sigchecker;
ScriptError err = ScriptError::SCRIPT_ERR_OK;
stacktype stack{original_stack};
bool r = EvalScript(stack, script, flags | SCRIPT_ENABLE_DIP0020_OPCODES, sigchecker, SigVersion::BASE, &err);
bool r = EvalScript(stack, script, flags, sigchecker, SigVersion::BASE, &err);
BOOST_CHECK(r);
BOOST_CHECK(err == ScriptError::SCRIPT_ERR_OK);
BOOST_CHECK(stack == expected);
Expand Down
Loading

0 comments on commit 93eb979

Please sign in to comment.