Commit graph

334 commits

Author SHA1 Message Date
Chris Stewart
481173dd3a Refactoring SpliceInterpreter and LocktimeInterpreter to set script errors on the ScriptProgram 2016-04-19 10:05:45 -05:00
Chris Stewart
6286300c70 Fixing StackInterpreter to set script errors inside a script program now 2016-04-19 09:57:47 -05:00
Chris Stewart
8f11393f68 Refactoring ScriptProgram into sum types - PreExecutionScriptProgram, ExecutionInProgressScriptProggram and ExecutedScriptProgram to represent the three states of a script program 2016-04-19 09:19:25 -05:00
Chris Stewart
00f792c6e6 Adding ScriptError types and a ScriptError companion object to be a factory 2016-04-18 19:32:50 -05:00
Chris Stewart
3099051e78 Fixing merge conflict in CryptoInterpreter 2016-04-18 19:30:36 -05:00
Chris Stewart
fe9225ba97 Merge pull request #4 from TomMcCabe/factory_refactoring
Factory refactoring
2016-04-18 19:11:38 -05:00
Tom McCabe
2d621f9c83 refactored ScriptProgramFactory with ScriptProgram companion object 2016-04-18 18:23:35 -05:00
Tom McCabe
17e9061215 refactored TransactionOutputFactory with TransactionOutput companion object 2016-04-18 14:38:32 -05:00
Tom McCabe
455f980e38 refactored TransactionInputFactory with TransactionInput companion object 2016-04-18 14:29:49 -05:00
Tom McCabe
28c97a6772 refactored AddressFactory with Address companion object 2016-04-18 14:12:23 -05:00
Tom McCabe
e857ad2085 refactored TransactionFactory to use Transaction companion object 2016-04-18 13:43:04 -05:00
Tom McCabe
d8b6211334 refactored TransactionOutPointFactory to use TransactionOutPoint companion object 2016-04-18 13:43:04 -05:00
Tom McCabe
fdde131d29 refactored ScriptSignatureFactory to use ScriptSignature companion object 2016-04-18 13:43:02 -05:00
Tom McCabe
46617658b9 refactored ScriptPubKeyFactory to use ScriptPubKey companion object 2016-04-18 13:42:43 -05:00
Tom McCabe
79d8277e2c refactored ScriptPubKeyFactory to use ScriptPubKey companion object 2016-04-18 11:44:14 -05:00
Chris Stewart
3a9736aa21 Adding new TransactionSignatureInvalid type to represent when we don't have enough sigs to meet the required signature threshold - fixing bug in ECPublicKey 2016-04-18 08:48:02 -05:00
Chris Stewart
994c73062a Refactoring old requirements on stack sizes to log errors and return script programs that are marked invalid 2016-04-17 21:02:24 -05:00
Chris Stewart
a25ed9aaef Implementing functionality to mark script as invalid if we see a script op code that is not defined by the Script documentation 2016-04-17 19:57:17 -05:00
Chris Stewart
48b0e4ad80 Fixing bug in OP_TOALTSTACK implementation, adding restriction to allow a max of 10,000 byte script to be run through the interpreter 2016-04-17 19:14:44 -05:00
Chris Stewart
89010e0e6d Merge pull request #3 from Christewart/script_parsing_refactor
Script parsing refactor
2016-04-17 15:39:59 -05:00
Chris Stewart
2046146e0b Cleaning up the codebase 2016-04-17 15:04:47 -05:00
Chris Stewart
42ec9e90b1 Fixing a few more bugs to force constants to be interpreted as numbers 2016-04-17 14:58:33 -05:00
Chris Stewart
df939d7693 fixing bug with what op codes are counted towards bitcoin core's op code limit 2016-04-17 10:52:26 -05:00
Chris Stewart
e3fce380c1 Fixing bug in how we kept tract of op counts in a script 2016-04-16 08:54:49 -05:00
Chris Stewart
6eece17379 fixing bug in script parser for dealing with OP_PUSHDATA operations from string constants in script_valid.json 2016-04-15 19:23:39 -05:00
Chris Stewart
2a3e4928dd Fixing bugs in OP_ROLL, OP_PICK. Fixing bug in .toLong for ScriptTokens 2016-04-14 19:21:54 -05:00
Chris Stewart
9bb5f60bf4 Adding more documentation to types in the Script language class hierarchy 2016-04-14 15:04:32 -05:00
Chris Stewart
5b06e2e066 Refactoring ScriptProgram.stackTopIsFalse to check the underlying hex representation to see if the stacktop is true/false 2016-04-14 13:31:24 -05:00
Chris Stewart
2312459c73 Refactoring script interpreter to push OP_0s onto the stack instead of empty byte vectors - changing ArithmeticInterpreter to try and interpretet numbers from a script constant if it is passed on 2016-04-14 12:52:26 -05:00
Chris Stewart
bdb8f55564 All ScriptParserTests are now passing - essentially all strings are converted to byte arrays then run through ScriptParser.fromBytes 2016-04-13 20:43:00 -05:00
Chris Stewart
f1042f87d4 Cleaning up TestUtil to use appropriate factory functions 2016-04-13 18:53:40 -05:00
Chris Stewart
8160b8c3f2 Starting to refactor fromString to just convert the string into a byte array to be passed to fromBytes inside of the ScriptParser 2016-04-13 15:06:17 -05:00
Chris Stewart
61ede1f214 implementing function in BitcoinScriptUtil to count the number of script operations - ScriptInterpreter now fails script if there are > 201 script operations 2016-04-12 20:05:08 -05:00
Chris Stewart
631be78b82 Refactoring CryptoInterpreter hash functions to use a higher order helper function 2016-04-12 09:17:16 -05:00
Chris Stewart
245e7ab741 Adding new factory function for script signatures which allows you to pass in the scriptPubKey 2016-04-12 08:30:17 -05:00
Chris Stewart
471e31a7a0 Refactoring Arithmetic interpretations to go through one of three higher order helper functions 2016-04-11 12:03:41 -05:00
Chris Stewart
8e48598785 Implementing operations that are currently illegal to Script - they just mark the script program as invalid right away 2016-04-10 10:02:25 -05:00
Chris Stewart
25ae09b5b1 Finishing modifying stack operations to mark script as invalid instad of throwing exception 2016-04-09 10:29:53 -05:00
Chris Stewart
27226ae0e7 Modifying stack interpreter operations to mark the script program as false instead of throwing exceptions 2016-04-09 09:29:04 -05:00
Chris Stewart
737d7369b8 Fixing bug in OP_TUCK implementation, adding comments to indicate that the boolean returned by 'loop' inside of interpreter indicates if any invalid things were done inside the evaluation of the script - NOT if the stack ended up as true or false 2016-04-08 18:43:50 -05:00
Chris Stewart
5c9fedb0be Fixing bug in checking for that OP_IF/OP_NOTIFs have matching OP_ENDIFs 2016-04-08 16:14:48 -05:00
Chris Stewart
960e0fd009 Trying to fix build issues with travis-ci - hopefully scala 2.10.x works now 2016-04-08 14:17:37 -05:00
Chris Stewart
45fb82d2b7 Matching OP_RESERVED operations in interpreter, making OP_VERIF && OP_VERNOTIF operations illegal in the script 2016-04-08 13:05:56 -05:00
Chris Stewart
bc3c27d782 fixing bug in parsing byte array strings - now failing if there isn't enough data for an OP_PUSHDATA op, also not evaluating serialized script inside of p2sh scriptSig if the p2sh script flag is not set 2016-04-08 12:45:31 -05:00
Chris Stewart
f2430cf8d7 Refactoring all OP_PUSHDATA operations to use pushNumberBytesToStack - also fixing bug in opNumEqual 2016-04-08 10:39:59 -05:00
Chris Stewart
3abb542189 bumping scala version trying to get continous integration working 2016-04-08 08:37:42 -05:00
Chris Stewart
9c18a8dbf4 All tests passing in script_valid.json again - we now have broken up scriptSig & scriptPubKey execution into two parts with the stack state copied from scriptSig exection to scriptPubKey execution 2016-04-07 22:03:40 -05:00
Chris Stewart
be45a5c3ec Implementing alternative for opCodeSeparator 2016-04-07 09:27:41 -05:00
Chris Stewart
6b34cc43c7 Major refactor on how scripts are run through the interpreter. Now first the scriptSignature is run through the intrpreter then the stack state from the scriptSig execution is copied into a new script program and run with the scriptPubKey as the script instructions 2016-04-06 16:26:14 -05:00
Chris Stewart
7d8024a67d Major refactor in ScriptNumbers - creating ScriptNumberFactory which should be gone through to create ScriptNumbers. We now keep the byte representation of the number underneath the hood. This is needed for checking byte equality of numbers 2016-04-05 09:38:16 -05:00