aboutsummaryrefslogtreecommitdiff
path: root/src/script/interpreter.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|
* Generic TransactionSignatureCreator works with both CTransaction and ↵Martin Ankerl2018-05-301-14/+11
| | | | | | | | CMutableTransaction Templated version so that no copying of CMutableTransaction into a CTransaction is necessary. This speeds up the test case transaction_tests/test_big_witness_transaction from 7.9 seconds to 3.1 seconds on my machine.
* Add constant scriptCode policy in non-segwit scriptsJohnson Lau2018-05-051-0/+4
| | | | This disables OP_CODESEPARATOR in non-segwit scripts (even in an unexecuted branch), and makes a positive FindAndDelete result invalid. This ensures that the scriptCode serialized in SignatureHash() is always the same as the script passing to the EvalScript.
* [MOVEONLY] Move CSCript::FindAndDelete to interpreterPieter Wuille2018-04-131-0/+2
|
* Extract consts for WITNESS_V0 hash sizesBen Woosley2018-04-101-0/+4
|
* scripted-diff: Convert 11 enums into scoped enums (C++11)practicalswift2018-03-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- sed -i 's/enum DBErrors/enum class DBErrors/g' src/wallet/walletdb.h git grep -l DB_ | xargs sed -i 's/DB_\(LOAD_OK\|CORRUPT\|NONCRITICAL_ERROR\|TOO_NEW\|LOAD_FAIL\|NEED_REWRITE\)/DBErrors::\1/g' sed -i 's/^ DBErrors::/ /g' src/wallet/walletdb.h sed -i 's/enum VerifyResult/enum class VerifyResult/g' src/wallet/db.h sed -i 's/\(VERIFY_OK\|RECOVER_OK\|RECOVER_FAIL\)/VerifyResult::\1/g' src/wallet/db.cpp sed -i 's/enum ThresholdState/enum class ThresholdState/g' src/versionbits.h git grep -l THRESHOLD_ | xargs sed -i 's/THRESHOLD_\(DEFINED\|STARTED\|LOCKED_IN\|ACTIVE\|FAILED\)/ThresholdState::\1/g' sed -i 's/^ ThresholdState::/ /g' src/versionbits.h sed -i 's/enum SigVersion/enum class SigVersion/g' src/script/interpreter.h git grep -l SIGVERSION_ | xargs sed -i 's/SIGVERSION_\(BASE\|WITNESS_V0\)/SigVersion::\1/g' sed -i 's/^ SigVersion::/ /g' src/script/interpreter.h sed -i 's/enum RetFormat {/enum class RetFormat {/g' src/rest.cpp sed -i 's/RF_\(UNDEF\|BINARY\|HEX\|JSON\)/RetFormat::\1/g' src/rest.cpp sed -i 's/^ RetFormat::/ /g' src/rest.cpp sed -i 's/enum HelpMessageMode {/enum class HelpMessageMode {/g' src/init.h git grep -l HMM_ | xargs sed -i 's/HMM_BITCOIN/HelpMessageMode::BITCOIN/g' sed -i 's/^ HelpMessageMode::/ /g' src/init.h sed -i 's/enum FeeEstimateHorizon/enum class FeeEstimateHorizon/g' src/policy/fees.h sed -i 's/enum RBFTransactionState/enum class RBFTransactionState/g' src/policy/rbf.h git grep -l RBF_ | xargs sed -i 's/RBF_TRANSACTIONSTATE_\(UNKNOWN\|REPLACEABLE_BIP125\|FINAL\)/RBFTransactionState::\1/g' sed -i 's/^ RBFTransactionState::/ /g' src/policy/rbf.h sed -i 's/enum BlockSource {/enum class BlockSource {/g' src/qt/clientmodel.h git grep -l BLOCK_SOURCE_ | xargs sed -i 's/BLOCK_SOURCE_\(NONE\|REINDEX\|DISK\|NETWORK\)/BlockSource::\1/g' sed -i 's/^ BlockSource::/ /g' src/qt/clientmodel.h sed -i 's/enum FlushStateMode {/enum class FlushStateMode {/g' src/validation.cpp sed -i 's/FLUSH_STATE_\(NONE\|IF_NEEDED\|PERIODIC\|ALWAYS\)/FlushStateMode::\1/g' src/validation.cpp sed -i 's/^ FlushStateMode::/ /g' src/validation.cpp sed -i 's/enum WitnessMode {/enum class WitnessMode {/g' src/test/script_tests.cpp sed -i 's/WITNESS_\(NONE\|PKH\|SH\)/WitnessMode::\1/g' src/test/script_tests.cpp sed -i 's/^ WitnessMode::/ /g' src/test/script_tests.cpp -END VERIFY SCRIPT-
* Fix a-vs-an typospracticalswift2018-02-111-1/+1
|
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* Merge #10699: Make all script validation flags backward compatibleWladimir J. van der Laan2017-12-121-9/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 01013f5 Simplify tx validation tests (Pieter Wuille) 2dd6f80 Add a test that all flags are softforks (Pieter Wuille) 2851b77 Make all script verification flags softforks (Pieter Wuille) Pull request description: This change makes `SCRIPT_VERIFY_UPGRADABLE_NOPS` not apply to `OP_CHECKLOCKTIMEVERIFY` and `OP_CHECKSEQUENCEVERIFY`. This is a no-op as `UPGRADABLE_NOPS` is only set for mempool transactions, and those always have `SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY` and `SCRIPT_VERIFY_CHECKSEQUENCEVERIFY` set as well. The advantage is that setting more flags now always results in a reduction in acceptable scripts (=softfork). This results in a nice and testable property for validation, for which a new test is added. This also means that the introduction of a new definition for a NOP or witness version will likely need the following procedure (example OP_NOP8 here) * Remove OP_NOP8 from being affected by `SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS`. * Add a `SCRIPT_VERIFY_DISCOURAGE_NOP8`, which only applies to `OP_NOP8`. * Add a `SCRIPT_VERIFY_NOP8` which implements the new consensus logic. * Before activation, add `SCRIPT_VERIFY_DISCOURAGE_NOP8` to the mempool flags. * After activation, add `SCRIPT_VERIFY_NOP8` to both the mempool and consensus flags. Tree-SHA512: d3b4538986ecf646aac9dba13a8d89318baf9e308e258547ca3b99e7c0509747f323edac6b1fea4e87e7d3c01b71193794b41679ae4f86f6e11ed6be3fd62c72
| * Make all script verification flags softforksPieter Wuille2017-06-301-9/+14
| |
* | scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* | Merge #9572: Skip witness sighash cache for non-segwit transactionsWladimir J. van der Laan2017-10-051-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 0da49b5 Skip precompute sighash for transactions without witness (Johnson Lau) Pull request description: This saves unnecessary hash caching for non-segwit transactions, but I am not sure if the difference is noticeable. Tree-SHA512: 5cd733a729a52a45781510b3572b26e76837a94155caa14311c6d23a27a12e9613ff278dfc2592e21f640202782f22c5ad00fca85c4de5efacaa617c48ccb08d
| * | Skip precompute sighash for transactions without witnessJohnson Lau2017-01-191-0/+1
| | |
* | | Declare single-argument (non-converting) constructors "explicit"practicalswift2017-08-161-1/+1
| | | | | | | | | | | | In order to avoid unintended implicit conversions.
* | | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-4/+4
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* | Use the override specifier (C++11) where we expect to be overriding the ↵practicalswift2017-06-281-3/+3
| | | | | | | | virtual function of a base class
* | Do not shadow variables (gcc set)Pavel Janík2016-12-051-1/+1
|/
* Require compressed keys in segwit as policy and disable signing with ↵Johnson Lau2016-10-161-1/+5
| | | | uncompressed keys for segwit scripts
* Add policy: null signature for failed CHECK(MULTI)SIGJohnson Lau2016-09-271-0/+4
|
* Make non-minimal OP_IF/NOTIF argument non-standard for P2WSHJohnson Lau2016-09-231-0/+4
|
* Rename to PrecomputedTransactionDataPieter Wuille2016-08-261-6/+6
|
* Precompute sighashesPieter Wuille2016-08-161-2/+11
| | | | Original version by Nicolas Dorier. Precomputing version by Pieter Wuille.
* BIP141: Other consensus critical limits, and BIP145Pieter Wuille2016-06-221-0/+2
| | | | Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
* BIP143: Verification logicPieter Wuille2016-06-221-5/+12
| | | | Includes simplifications by Eric Lombrozo.
* Refactor script validation to observe amountsPieter Wuille2016-06-221-2/+2
| | | | This is a preparation for BIP143 support.
* BIP141: Witness programPieter Wuille2016-06-221-2/+10
|
* BIP112: Implement CHECKSEQUENCEVERIFYMark Friedenbach2016-02-141-0/+11
| | | | | | | | | | - Replace NOP3 with CHECKSEQUENCEVERIFY (BIP112) <nSequence> CHECKSEQUENCEVERIFY -> <nSequence> - Fails if txin.nSequence < nSequence, allowing funds of a txout to be locked for a number of blocks or a duration of time after its inclusion in a block. - Pull most of CheckLockTime() out into VerifyLockTime(), a local function that will be reused for CheckSequence() - Add bitwise AND operator to CScriptNum - Enable CHECKSEQUENCEVERIFY as a standard script verify flag - Transactions that fail CSV verification will be rejected from the mempool, making it easy to test the feature. However blocks containing "invalid" CSV-using transactions will still be accepted; this is *not* the soft-fork required to actually enable CSV for production use.
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* Resolve issue 3166.mruddy2015-07-301-0/+2
| | | | | These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts. This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa.
* Replace NOP2 with CHECKLOCKTIMEVERIFY (BIP65)Peter Todd2015-06-211-0/+11
| | | | | | | | | | | | | | | | <nLockTime> CHECKLOCKTIMEVERIFY -> <nLockTime> Fails if tx.nLockTime < nLockTime, allowing the funds in a txout to be locked until some block height or block time in the future is reached. Only the logic and unittests are implemented; this commit does not have any actual soft-fork logic in it. Thanks to Pieter Wuille for rebase. Credit goes to Gregory Maxwell for the suggestion of comparing the argument against the transaction nLockTime rather than the current time/blockheight directly.
* Avoid storing a reference passed to SignatureChecker constructorsPieter Wuille2015-02-021-3/+3
|
* Use separate SignatureChecker for CMutableTransactionPieter Wuille2015-02-021-2/+12
|
* Merge pull request #5143Wladimir J. van der Laan2015-01-081-2/+8
|\ | | | | | | | | | | da918ac Make SCRIPT_VERIFY_CLEANSTACK a standardness requirement (Pieter Wuille) b6e03cc Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6) (Pieter Wuille) ae4151b No semantic change: reuse stack variable in P2SH evaluation (Pieter Wuille)
| * Add SCRIPT_VERIFY_CLEANSTACK (BIP62 rule 6)Pieter Wuille2014-11-251-2/+8
| | | | | | | | | | Based on an earlier patch by Peter Todd, though the rules here are different (P2SH scripts should not have a CLEANSTACK check before the P2SH evaluation).
* | Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
|/ | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Make STRICTENC invalid pubkeys fail the script rather than the opcode.Pieter Wuille2014-11-201-2/+2
| | | | | | | This turns STRICTENC turn into a softforking-safe change (even though it is not intended as a consensus rule), and as a result guarantee that using it for mempool validation only results in consensus-valid transactions in the mempool.
* Discourage NOPs reserved for soft-fork upgradesPeter Todd2014-11-171-1/+12
| | | | | | | | | | | | | | | | | NOP1 to NOP10 are reserved for future soft-fork upgrades. In the event of an upgrade such NOPs have *VERIFY behavior, meaning that if their arguments are not correct the script fails. Discouraging these NOPs by rejecting transactions containing them from the mempool ensures that we'll never accept transactions, nor mine blocks, with scripts that are now invalid according to the majority of hashing power even if we're not yet upgraded. Previously this wasn't an issue as the IsStandard() rules didn't allow upgradable NOPs anyway, but 7f3b4e95 relaxed the IsStandard() rules for P2SH redemptions allowing any redeemScript to be spent. We *do* allow upgradable NOPs in scripts so long as they are not executed. This is harmless as there is no opportunity for the script to be invalid post-upgrade.
* script: create sane error return codes for script validation and remove loggingCory Fields2014-11-141-2/+4
| | | | | | | | | | | Attempt to codify the possible error statuses associated with script validation. script/types.h has been created with the expectation that it will be part of the public lib interface. The other flag enums will be moved here in a future commit. Logging has also been removed in order to drop the dependency on core.h. It can be re-added to bitcoind as-needed. This makes script verification finally free of application state and boost!
* Fix all header definesPavel Janík2014-11-031-3/+3
|
* Add SCRIPT_VERIFY_MINIMALDATA (BIP62 rules 3 and 4)Pieter Wuille2014-10-251-0/+7
| | | | | Also use the new flag as a standard rule, and replace the IsCanonicalPush standardness check with it (as it is more complete).
* Add SCRIPT_VERIFY_SIGPUSHONLY (BIP62 rule 2)Pieter Wuille2014-10-251-0/+3
|
* Make SCRIPT_VERIFY_STRICTENC compatible with BIP62Pieter Wuille2014-10-081-7/+18
| | | | | | | | * Delete canonical_tests.cpp, and move the tests to script_tests.cpp. * Split off SCRIPT_VERIFY_DERSIG from SCRIPT_VERIFY_STRICTENC (the BIP62 part of it). * Change signature STRICTENC/DERSIG semantics to fail the script entirely rather than the CHECKSIG result (softfork safety, and BIP62 requirement). * Add many autogenerated tests for several odd cases. * Mention specific BIP62 rules in the script verification flags.
* minor license, header end comment etc. cleanup in /scriptPhilip Kaufmann2014-10-061-1/+1
| | | | | | - ensure all licenses are just MIT - add a missing header end comment - ensure alphabetical ordering
* Replace SCRIPT_VERIFY_NOCACHE by flag directly to checkerPieter Wuille2014-10-021-5/+4
|
* Make signature cache optionalPieter Wuille2014-10-021-15/+19
|
* Abstract out SignatureCheckerPieter Wuille2014-10-021-3/+25
|
* Merge pull request #4555Wladimir J. van der Laan2014-09-171-3/+3
|\ | | | | | | | | | | | | 6dcfda2 Don't pass nHashType to EvalScript nor CheckSig (jtimon) 2b23a87 Don't pass nHashType to VerifyScript (jtimon) ce3649fb Remove CScriptCheck::nHashType (was always 0) (jtimon) 358562b Remove unused function main:VerifySignature (jtimon)
| * Don't pass nHashType to EvalScript nor CheckSigjtimon2014-09-121-2/+2
| |
| * Don't pass nHashType to VerifyScriptjtimon2014-09-121-1/+1
| |
* | cleanup new script files (no code changes)Philip Kaufmann2014-09-141-4/+4
|/ | | | | | - add missing header end comments - ensure alphabetical ordering - update copyright year and license