Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/actions/clear-files/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Clear unnecessary files'
description: 'Clear out unnecessary files to make space on the VM'
runs:
using: 'composite'
steps:
- name: Clear unnecessary files
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
run: |
set +o errexit
sudo bash -c '(ionice -c 3 nice -n 19 rm -rf /usr/share/dotnet/ /usr/local/graalvm/ /usr/local/.ghcup/ /usr/local/share/powershell /usr/local/share/chromium /usr/local/lib/android /usr/local/lib/node_modules)&'
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ jobs:
key: ${{ github.job }}-ccache-${{ github.run_id }}
restore-keys: ${{ github.job }}-ccache-

- name: Clear unnecessary files
if: ${{ needs.runners.outputs.provider == 'gha' && true || false }} # Only needed on GHA runners
uses: ./.github/actions/clear-files

- name: Enable bpfcc script
# In the image build step, no external environment variables are available,
# so any settings will need to be written to the settings env file:
Expand Down
2 changes: 1 addition & 1 deletion src/bitcoin-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ static int EvalScript(const ArgsManager& argsman, const std::vector<std::string>

for (size_t i = 1; i < args.size(); ++i) {
if (args[i].size() == 0) {
stack.push_back({});
stack.emplace_back();
} else if (IsHex(args[i])) {
stack.push_back(ParseHex(args[i]));
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// sanitize comments per BIP-0014, format user agent and check total size
std::vector<std::string> uacomments;
if (!args.IsArgSet("-uacomment") && !args.IsArgNegated("-uacomment")) {
uacomments.push_back("inquisition");
uacomments.emplace_back("inquisition");
}
for (const std::string& cmt : args.GetArgs("-uacomment")) {
if (cmt != SanitizeString(cmt, SAFE_CHARS_UA_COMMENT))
Expand Down
13 changes: 7 additions & 6 deletions src/test/bip54_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ static std::vector<uint8_t> SignInput(const CKey& key, const CScript& spent_scri
}

/** Verify a transaction input's script against consensus rules. */
static bool VerifyTxin(const CScript& spent_script, const CMutableTransaction& tx, unsigned idx, std::vector<CTxOut>&& spent_outputs, const CAmount& amount)
static bool VerifyTxin(const CScript& spent_script, const CMutableTransaction& tx, unsigned idx, std::vector<CTxOut> spent_outputs, const CAmount& amount)
{
Assert(idx < tx.vin.size());
PrecomputedTransactionData txdata;
txdata.Init(tx, std::forward<std::vector<CTxOut>>(spent_outputs), /*force=*/true);
txdata.Init(tx, std::move(spent_outputs), /*force=*/true);
const MutableTransactionSignatureChecker checker{&tx, idx, amount, txdata, MissingDataBehavior::ASSERT_FAIL};
return VerifyScript(tx.vin[idx].scriptSig, spent_script, &tx.vin[idx].scriptWitness, MANDATORY_SCRIPT_VERIFY_FLAGS, checker);
}
Expand Down Expand Up @@ -1019,7 +1019,7 @@ BOOST_AUTO_TEST_CASE(bip54_legacy_sigops)
sigdata.tr_spenddata = builder.GetSpendData();
auto spent_outputs{RecordSpent(coins, tx_copy2)};
Assert(SignSignature(keystore, spk, tx_copy2, idx, value, std::vector<CTxOut>(spent_outputs), SIGHASH_ALL, sigdata));
BOOST_REQUIRE(VerifyTxin(spk, tx_copy2, idx, std::move(spent_outputs), value));
BOOST_REQUIRE(VerifyTxin(spk, tx_copy2, idx, spent_outputs, value));

CheckWithinBIP54Limits(CTransaction(tx_copy2), coins, test_vectors, "Mixed input types reaching exactly 2500 BIP54-sigops + a Taproot key path spend input");
}
Expand Down Expand Up @@ -1055,15 +1055,15 @@ BOOST_AUTO_TEST_CASE(bip54_legacy_sigops)
keystore.keys[pubkey.GetID()] = privkey;
sigdata.tr_spenddata = builder.GetSpendData();
Assert(SignSignature(keystore, spk, tx_copy2, idx, value, std::vector<CTxOut>(spent_outputs), SIGHASH_ALL, sigdata));
BOOST_REQUIRE(VerifyTxin(spk, tx_copy2, idx, std::vector<CTxOut>(spent_outputs), value));
BOOST_REQUIRE(VerifyTxin(spk, tx_copy2, idx, spent_outputs, value));
CheckWithinBIP54Limits(CTransaction(tx_copy2), coins, test_vectors, "Mixed input types reaching exactly 2500 BIP54-sigops + a Taproot script path spend input");

// Spend through the future-version leaf.
keystore.keys.clear();
keystore.keys[pubkey_future.GetID()] = privkey_future;
sigdata.tr_spenddata = builder.GetSpendData();
Assert(SignSignature(keystore, spk, tx_copy2, idx, value, std::vector<CTxOut>(spent_outputs), SIGHASH_ALL, sigdata));
BOOST_REQUIRE(VerifyTxin(spk, tx_copy2, idx, std::move(spent_outputs), value));
BOOST_REQUIRE(VerifyTxin(spk, tx_copy2, idx, spent_outputs, value));
CheckWithinBIP54Limits(CTransaction(tx_copy2), coins, test_vectors, "Mixed input types reaching exactly 2500 BIP54-sigops + a Taproot script path spend input of a future leaf version");
}

Expand Down Expand Up @@ -1343,6 +1343,7 @@ struct TimestampTestCase {
* The BIP 54 timestamp test vectors are arranged as a tree. This recursively build a list of
* header-chain test cases from the root of the JSON test vectors.
*/
// NOLINTNEXTLINE(misc-no-recursion)
static std::vector<TimestampTestCase> VisitNode(std::vector<CBlockHeader> header_chain, const UniValue& test_node)
{
std::vector<TimestampTestCase> test_cases;
Expand Down Expand Up @@ -1441,7 +1442,7 @@ BOOST_AUTO_TEST_CASE(bip54_coinbase)
{
auto test_setup{TestingSetup{ChainType::MAIN, {.extra_args = {"-vbparams=consensuscleanup:-1:-1"}}}};
BlockValidationState state;
BOOST_CHECK_MESSAGE(AcceptBlocks(*test_setup.m_node.chainman, std::move(blocks), state) == is_valid, comment);
BOOST_CHECK_MESSAGE(AcceptBlocks(*test_setup.m_node.chainman, blocks, state) == is_valid, comment);
if (!is_valid) {
const auto reason{state.GetRejectReason()};
BOOST_CHECK_MESSAGE(reason == "bad-cb-locktime" || reason == "bad-cb-sequence" || reason == "bad-txns-nonfinal", comment);
Expand Down
8 changes: 4 additions & 4 deletions src/test/script_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ BOOST_AUTO_TEST_CASE(script_json_test)
// We use #SCRIPT# to flag a non-hex script that we can read using ParseScript
// Taproot script must be third from the last element in witness stack
std::string scriptFlag = std::string("#SCRIPT#");
if (element.find(scriptFlag) == 0) {
if (element.starts_with(scriptFlag)) {
CScript script = ParseScript(element.substr(scriptFlag.size()));
witness.stack.push_back(ToByteVector(script));
} else if (strcmp(element.c_str(), "#CONTROLBLOCK#") == 0) {
Expand Down Expand Up @@ -1801,8 +1801,8 @@ BOOST_AUTO_TEST_CASE(cat_empty_stack)
{
// Ensures that OP_CAT successfully handles concatenating two empty stack elements
std::vector<std::vector<unsigned char>> witData;
witData.push_back({});
witData.push_back({});
witData.emplace_back();
witData.emplace_back();
std::vector<unsigned char> witVerifyScript = {OP_CAT, OP_PUSHDATA1, 0x00,OP_EQUAL};
DoTapscriptTest(*this, witVerifyScript, witData, "CAT empty stack", SCRIPT_ERR_OK);
}
Expand All @@ -1816,7 +1816,7 @@ BOOST_AUTO_TEST_CASE(cat_dup_test)
unsigned int maxDupsToCheck = 10;

std::vector<std::vector<unsigned char>> witData;
witData.push_back({});
witData.emplace_back();
for (unsigned int elementSize = 1; elementSize <= maxElementSize; elementSize++) {
std::vector<unsigned char> witVerifyScript;
// increase the size of stack element by one byte
Expand Down
Loading