Skip to content

Commit

Permalink
lint: fix non-pylint linter errors
Browse files Browse the repository at this point in the history
Includes fixing all the spelling mistakes that are our fault,
but not those present upstream in Core.
  • Loading branch information
apoelstra committed Oct 15, 2021
1 parent f71e68f commit ba8273a
Show file tree
Hide file tree
Showing 23 changed files with 40 additions and 45 deletions.
2 changes: 1 addition & 1 deletion contrib/assets_tutorial/assets_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
# already exist.
print ("1c. Creating wallets on all daemons")

# We have configured this regtest chain to start with 21M bitcoins, which are initally
# We have configured this regtest chain to start with 21M bitcoins, which are initially
# in a single OP_TRUE output. All Elements wallets recognize OP_TRUE outputs as their
# own (this differs from Bitcoin), so the 21M bitcoins are immediately available for
# use. This can be disabled by setting `anyonecanspend_aremine=0` in the daemon config.
Expand Down
2 changes: 1 addition & 1 deletion contrib/assets_tutorial/pset_swap_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# ten thousand BTC and Carol has 1000 of a new asset. After the swap, Alice
# will have the new asset and Carol will have the BTC.
#
# This script can be executed in a Python intepreter. The user is encouraged
# This script can be executed in a Python interpreter. The user is encouraged
# to add tracing or debugging code throughout to better understand what is
# going on.
#
Expand Down
2 changes: 1 addition & 1 deletion doc/build-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ macOS comes with a built-in Terminal located in:
### 1. Xcode Command Line Tools

The Xcode Command Line Tools are a collection of build tools for macOS.
These tools must be installed in order to build Elemens Core from source.
These tools must be installed in order to build Elements Core from source.

To install, run the following command from your terminal:

Expand Down
4 changes: 2 additions & 2 deletions doc/pset.mediawiki
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The currently defined elements global proprietary types are as follows:
| 2
|}

The currently defined elements per-input proprietary types are as folows:
The currently defined elements per-input proprietary types are as follows:

{|
! Name
Expand Down Expand Up @@ -441,7 +441,7 @@ A single entity is likely to be a Creator, Updater, and Blinder.
===Signer===
In addition to the BIP 370 PSBT Signer behavior, PSET specifies some addtional constraints.
In addition to the BIP 370 PSBT Signer behavior, PSET specifies some additional constraints.
Before signing, the Signer must check whether blinding is complete. If any output contains a blinding pubkey but no commitments or proofs, then it must not sign.
===Combiner===
Expand Down
2 changes: 1 addition & 1 deletion src/blind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool SurjectOutput(CTxOutWitness& txoutwit, const std::vector<secp256k1_fixed_as
// secp-zkp the complete list of inputs, and if this exceeds 256 then surjectionproof_verify
// will always return false, so there is no way to work around this situation at signing time
if (surjection_targets.size() > SECP256K1_SURJECTIONPROOF_MAX_N_INPUTS) {
// We must return false here to avoid triggering an assertation within
// We must return false here to avoid triggering an assertion within
// secp256k1_surjectionproof_initialize on the next line.
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/block_proof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static bool CheckProofGeneric(const CBlockHeader& block, const uint32_t max_bloc

// Some anti-DoS flags, though max_block_signature_size caps the possible
// danger in malleation of the block witness data.
unsigned int proof_flags = SCRIPT_VERIFY_P2SH // For cleanstack evalution under segwit flag
unsigned int proof_flags = SCRIPT_VERIFY_P2SH // For cleanstack evaluation under segwit flag
| SCRIPT_VERIFY_STRICTENC // Minimally-sized DER sigs
| SCRIPT_VERIFY_NULLDUMMY // No extra data stuffed into OP_CMS witness
| SCRIPT_VERIFY_CLEANSTACK // No extra pushes leftover in witness
Expand Down
6 changes: 3 additions & 3 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
// DynaFed: never activate (but set to avoid use of unitialized memory in tests)
// DynaFed: never activate (but set to avoid use of uninitialized memory in tests)
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
Expand Down Expand Up @@ -401,7 +401,7 @@ class SigNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay
// DynaFed: never activate (but set to avoid use of unitialized memory in tests)
// DynaFed: never activate (but set to avoid use of uninitialized memory in tests)
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
Expand Down Expand Up @@ -491,7 +491,7 @@ class CRegTestParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay

// DynaFed: never activate (but set to avoid use of unitialized memory in tests)
// DynaFed: never activate (but set to avoid use of uninitialized memory in tests)
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].bit = 25;
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_DYNA_FED].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
Expand Down
2 changes: 1 addition & 1 deletion src/dynafed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ bool NextBlockIsParameterTransition(const CBlockIndex* pindexPrev, const Consens
const DynaFedParamEntry& proposal = p_epoch_walk->dynafed_params.m_proposed;
const uint256 proposal_root = proposal.CalculateRoot();
vote_tally[proposal_root]++;
// Short-circuit once 4/5 threshhold is reached
// Short-circuit once 4/5 threshold is reached
if (!proposal_root.IsNull() && vote_tally[proposal_root] >=
(consensus.dynamic_epoch_length*4)/5) {
winning_entry = proposal;
Expand Down
10 changes: 0 additions & 10 deletions src/primitives/pak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@

// ELEMENTS

// PAK entries loaded by config file entries
// These will be embedded into coinbase transaction
// during block creation and tested against during
// testproposedblock
boost::optional<CPAKList> g_paklist_config;
// PAK entries loaded from latest coinbase pak commitment
CPAKList g_paklist_blockchain;

///////////

namespace {

static secp256k1_context *secp256k1_ctx_pak;
Expand Down
1 change: 0 additions & 1 deletion src/primitives/pak.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include <script/script.h>
#include <secp256k1/include/secp256k1_whitelist.h>
#include <boost/optional.hpp>
#include <chain.h>

class CPAKList
Expand Down
2 changes: 1 addition & 1 deletion src/psbt.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static constexpr uint8_t PSBT_ELEMENTS_OUT_BLINDER_INDEX = 0x08;
static constexpr uint8_t PSBT_ELEMENTS_OUT_BLIND_VALUE_PROOF = 0x09;
static constexpr uint8_t PSBT_ELEMENTS_OUT_BLIND_ASSET_PROOF = 0x0a;

// Proprietary type identifer string
// Proprietary type identifier string
static const std::vector<unsigned char> PSBT_ELEMENTS_ID = {'p', 's', 'e', 't'};

// The separator is 0x00. Reading this in means that the unserializer can interpret it
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ static RPCHelpMan getblockheader()
{RPCResult::Type::ELISION, "", ""}
}}
}},
{RPCResult::Type::OBJ, "proposed", "Proposed paramaters. Uninforced. Must be published in full",
{RPCResult::Type::OBJ, "proposed", "Proposed parameters. Uninforced. Must be published in full",
{
{RPCResult::Type::ELISION, "", "same entries as current"}
}},
Expand Down Expand Up @@ -1023,7 +1023,7 @@ static RPCHelpMan getblock()
{RPCResult::Type::ELISION, "", ""}
}},
}},
{RPCResult::Type::OBJ, "proposed", "Proposed paramaters. Uninforced. Must be published in full",
{RPCResult::Type::OBJ, "proposed", "Proposed parameters. Uninforced. Must be published in full",
{
{RPCResult::Type::ELISION, "", "same entries as current"}
}},
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ static RPCHelpMan getnewblockhex()
return RPCHelpMan{"getnewblockhex",
"\nGets hex representation of a proposed, unmined new block\n",
{
{"min_tx_age", RPCArg::Type::NUM, RPCArg::Default{0}, "How many seconds a transaction must have been in the mempool to be inluded in the block proposal. This may help with faster block convergence among functionaries using compact blocks."},
{"min_tx_age", RPCArg::Type::NUM, RPCArg::Default{0}, "How many seconds a transaction must have been in the mempool to be included in the block proposal. This may help with faster block convergence among functionaries using compact blocks."},
{"proposed_parameters", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED , "Parameters to be used in dynamic federations blocks as proposals. During a period of `-dynamic_epoch_length` blocks, 4/5 of total blocks must signal these parameters for the proposal to become activated in the next epoch.",
{
{"signblockscript", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "Hex-encoded block signing script to propose"},
Expand Down
12 changes: 6 additions & 6 deletions src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1839,7 +1839,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
auto inps = checker.GetTxvIn();
const PrecomputedTransactionData *cache = checker.GetPrecomputedTransactionData();
// Return error if the evaluation context is unavailable
// TODO: Handle accoding to MissingDataBehavior
// TODO: Handle according to MissingDataBehavior
if (!inps || !cache || !cache->m_bip341_taproot_ready)
return set_error(serror, SCRIPT_ERR_INTROSPECT_CONTEXT_UNAVAILABLE);
const std::vector<CTxOut>& spent_outputs = cache->m_spent_outputs;
Expand Down Expand Up @@ -1911,7 +1911,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&

// Even tough this value should never 2^25(MAX_SIZE), this can set to any value in exotic custom contexts
// safe to check that this in 4 byte positive number before pushing it
// TODO: Handle accoding to MissingDataBehavior
// TODO: Handle according to MissingDataBehavior
if (checker.GetnIn() > MAX_SIZE)
return set_error(serror, SCRIPT_ERR_INTROSPECT_CONTEXT_UNAVAILABLE);
stack.push_back(CScriptNum(static_cast<int64_t>(checker.GetnIn())).getvch());
Expand All @@ -1935,7 +1935,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
auto outs = checker.GetTxvOut();
const PrecomputedTransactionData *cache = checker.GetPrecomputedTransactionData();
// Return error if the evaluation context is unavailable
// TODO: Handle accoding to MissingDataBehavior
// TODO: Handle according to MissingDataBehavior
if (!outs || !cache || !cache->m_bip341_taproot_ready)
return set_error(serror, SCRIPT_ERR_INTROSPECT_CONTEXT_UNAVAILABLE);
assert(cache->m_output_spk_single_hashes.size() == outs->size());
Expand Down Expand Up @@ -2022,7 +2022,7 @@ bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript&
{
const PrecomputedTransactionData *cache = checker.GetPrecomputedTransactionData();
// Return error if the evaluation context is unavailable
// TODO: Handle accoding to MissingDataBehavior
// TODO: Handle according to MissingDataBehavior
if (!cache || !cache->m_bip341_taproot_ready)
return set_error(serror, SCRIPT_ERR_INTROSPECT_CONTEXT_UNAVAILABLE);
push8_le(stack, cache->m_tx_weight);
Expand Down Expand Up @@ -2497,7 +2497,7 @@ std::vector<uint256> GetSpentScriptPubKeysSHA256(const std::vector<CTxOut>& outp
std::vector<uint256> spent_spk_single_hashes;
spent_spk_single_hashes.reserve(outputs_spent.size());
for (const auto& txout : outputs_spent) {
// Normal serialization using the << operater would also serialize the length, therefore we directly write using CSHA256
// Normal serialization using the << operator would also serialize the length, therefore we directly write using CSHA256
uint256 spent_spk_single_hash;
CSHA256().Write(txout.scriptPubKey.data(), txout.scriptPubKey.size()).Finalize(spent_spk_single_hash.data());
spent_spk_single_hashes.push_back(std::move(spent_spk_single_hash));
Expand All @@ -2512,7 +2512,7 @@ std::vector<uint256> GetOutputScriptPubKeysSHA256(const T& txTo)
std::vector<uint256> out_spk_single_hashes;
out_spk_single_hashes.reserve(txTo.vout.size());
for (const auto& txout : txTo.vout) {
// Normal serialization using the << operater would also serialize the length, therefore we directly write using CSHA256
// Normal serialization using the << operator would also serialize the length, therefore we directly write using CSHA256
uint256 out_spk_single_hash;
CSHA256().Write(txout.scriptPubKey.data(), txout.scriptPubKey.size()).Finalize(out_spk_single_hash.data());
out_spk_single_hashes.push_back(std::move(out_spk_single_hash));
Expand Down
1 change: 0 additions & 1 deletion src/test/fuzz/FuzzedDataProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_
#define LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_

#include <limits>
#include <algorithm>
#include <array>
#include <climits>
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5028,7 +5028,7 @@ static RPCHelpMan walletcreatefundedpsbt()
// FundTransaction expects blinding keys, if present, to appear in the output nonces
for (CTxOut& txout : rawTx.vout) {
auto search_it = psbt_outs.find(txout);
assert (search_it != psbt_outs.end());
CHECK_NONFATAL (search_it != psbt_outs.end());
CPubKey& blind_pub = search_it->second.m_blinding_pubkey;
if (blind_pub.IsFullyValid()) {
txout.nNonce.vchCommitment = std::vector<unsigned char>(blind_pub.begin(), blind_pub.end());
Expand All @@ -5046,7 +5046,7 @@ static RPCHelpMan walletcreatefundedpsbt()
}
}
}
assert(blinder_index < rawTx.vin.size()); // We added inputs, or existing inputs are ours, we should have a blinder index at this point.
CHECK_NONFATAL (blinder_index < rawTx.vin.size()); // We added inputs, or existing inputs are ours, we should have a blinder index at this point.
// It may add outputs (change, and in some edge case OP_RETURN) which need to be
// blinded. So pull these into `psbt_outs`.
for (const CTxOut& txout : rawTx.vout) {
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/spend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm

// We will have to do coin selection on the difference between the target and the provided values.
// If value_to_select <= 0 for all asset types, we are done; but unlike in Bitcoin, this may be
// true for some assets whlie being false for others. So clear all the "completed" assets out
// true for some assets while being false for others. So clear all the "completed" assets out
// of value_to_select before calling AttemptSelection.
for (CAmountMap::const_iterator it = value_to_select.begin(); it != value_to_select.end();) {
if (it->second <= 0) {
Expand Down Expand Up @@ -766,7 +766,7 @@ bool fillBlindDetails(BlindDetails* det, CWallet* wallet, CMutableTransaction& t
// We need to make sure to dupe an asset that is in input set
//TODO Have blinding do some extremely minimal rangeproof
CTxOut newTxOut(det->o_assets.back(), 0, CScript() << OP_RETURN);
CPubKey blind_pub = wallet->GetBlindingPubKey(newTxOut.scriptPubKey); // irrelevent, just needs to be non-null
CPubKey blind_pub = wallet->GetBlindingPubKey(newTxOut.scriptPubKey); // irrelevant, just needs to be non-null
newTxOut.nNonce.vchCommitment = std::vector<unsigned char>(blind_pub.begin(), blind_pub.end());
txNew.vout.push_back(newTxOut);
det->o_pubkeys.push_back(wallet->GetBlindingPubKey(newTxOut.scriptPubKey));
Expand Down Expand Up @@ -917,7 +917,7 @@ bool CWallet::CreateTransactionInternal(
}
error = strprintf(_("Transaction needs a change address, but we can't generate it. %s"), dest_err);
// ELEMENTS: We need to put a dummy destination here. Core uses an empty script
// but we can't because empty scripts indicate fees (which trigger assertation
// but we can't because empty scripts indicate fees (which trigger assertion
// failures in `BlindTransaction`). We also set the index to -1, indicating
// that this destination is not actually used, and therefore should not be
// returned by the `ReturnDestination` loop below.
Expand Down
2 changes: 1 addition & 1 deletion test/functional/data/invalid_txs.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def get_tx(self):
})

# Disabled opcode tx templates (CVE-2010-5137)
# ELEMENTS: many of these are reenabled
# ELEMENTS: many of these are re-enabled
DisabledOpcodeTemplates = [getDisabledOpcodeTemplate(opcode) for opcode in [
# OP_CAT,
# OP_SUBSTR,
Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_dynafed.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
5) Test full epoch with just at 4/5 votes, with competing random proposals
6) Test full epoch with 5/5 votes
7) Test that peg-outs(PAK) and peg-ins are ejected from mempool block before transition
and rejected when re-submitted if there is a parameter mis-match
and rejected when re-submitted if there is a parameter mismatch
8) Test that reorging a transition results in transitions being undone,
previously ejected transactions are allowed back into the mempool when appropriate

Expand Down
2 changes: 1 addition & 1 deletion test/functional/feature_sighash_rangeproof.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def run_test(self):
self.assert_tx_standard(tx, True)
self.assert_tx_valid(tx, True)

# Ensure that if we then use the old sighash algorith that doesn't hash
# Ensure that if we then use the old sighash algorithm that doesn't hash
# the rangeproofs, the signature is no longer valid.
for address_type in ADDRESS_TYPES:
self.log.info("Post-activation invalid sighash for {} address".format(address_type))
Expand Down
Loading

0 comments on commit ba8273a

Please sign in to comment.