Commit Graph

224 Commits

Author SHA1 Message Date
Jude Nelson
cad5a71fb4 run c32 tests 2019-03-09 18:46:59 -05:00
Jude Nelson
c2078ad55e Merge branch 'develop' into develop-jude 2019-02-19 14:09:34 -05:00
Aaron Blankstein
29a0225531 light cleaning up of test functions 2019-02-19 11:28:30 -06:00
Aaron Blankstein
bb203956e7 rename MultiplyDefined error to VariableDefinedMultipleTimes 2019-02-19 10:40:22 -06:00
Aaron Blankstein
74e45cbcb8 implement partialeq, hash for ListData and TupleData manually: allows Value to derive. remove now uneccessary Hash traits. 2019-02-19 10:19:16 -06:00
Aaron Blankstein
f3177eece8 implement equality for Value enum 2019-02-19 09:47:23 -06:00
Jude Nelson
8a2f742694 add uint 2019-02-18 22:00:58 -05:00
Jude Nelson
aac244a5f6 burnchain::new can fail 2019-02-18 22:00:50 -05:00
Jude Nelson
ac60f8858e the check() method for operations returns a CheckResult enum now to encode specific kinds of errors (instead of a catch-all bool). Add tests for each check() method and make sure they all fail in the right way. 2019-02-18 22:00:01 -05:00
Jude Nelson
b6a6ee4fe6 implement sortition hashes -- a rolling hash over block headers from the PoW chain that gets mixed with a VRF seed 2019-02-18 21:59:30 -05:00
Jude Nelson
8eba37aab8 SortitionHash's will be stored in a BlockSnapshot, so make them insertable into rows 2019-02-18 21:58:52 -05:00
Jude Nelson
95a0d24057 flesh out unit tests; expand snapshot code to accomodate sortition results; add method to query the last successful sortition; add a few more methods needed for checking operations 2019-02-18 21:58:10 -05:00
Jude Nelson
038eba12a0 some type refactoring to better represent various burnchain configurations 2019-02-18 21:57:47 -05:00
Jude Nelson
60d36a3d3a refactor the burnchain "main loop" to only insert user burns that supported block commits in this block (and ignoring all others), and to make it easier to test cryptographic sortition. Add cryptographic sortition tests. 2019-02-18 21:57:04 -05:00
Jude Nelson
217c7f4e73 to_address_bits() should just return the 20-byte hash, not the scriptpubkey 2019-02-18 21:56:37 -05:00
Jude Nelson
e4dabe358d add macros and implementations for 256-bit and 512-bit integers (borrowed with gratitude from rust-bitcoin) 2019-02-18 21:56:11 -05:00
Jude Nelson
32883c8934 Update the BlockSnapshot code to generate a burn distribution over its blocks and select a winning block using cryptographic sortition. The burn distribution will be sampled using the hash of the PoW block header and the last successful sortition's VRF seed. 2019-02-18 21:55:20 -05:00
Jude Nelson
dde76d520c Separate out code and tests for calculating a burn distribution -- a Vec of BurnSamplePoints. This allows us to take a block's worth of block commits and user burns, and figure out the total burns behind each candidate block. This code also takes the integer range [0, 2**256 - 1) and partitions it into disjoint ranges representing sets of possible sortition hashes whose sizes are proportional to how much burn support there is behind each block. 2019-02-18 21:52:48 -05:00
Aaron Blankstein
241b3cc49f separate two kinds of contexts (local and global) into two types 2019-02-18 12:29:17 -06:00
Aaron Blankstein
8791851bbf use two types for public and private functions 2019-02-18 09:46:53 -06:00
Aaron Blankstein
476cd7f1a0 use [u8;20] array instead of vec for principal type 2019-02-18 09:28:48 -06:00
Aaron Blankstein
c62297dde7 handle the sender argument to contract execution 2019-02-18 09:18:24 -06:00
Aaron Blankstein
d062cd9859 return error from size() instead of panics on overflow. 2019-02-18 09:15:02 -06:00
Aaron Blankstein
96c6085362 add Principal type. implement c32 address decoding/encoding. 2019-02-15 17:28:28 -06:00
Aaron Blankstein
0056fe96c6 require type parameters in define-public 2019-02-14 15:32:50 -06:00
Aaron Blankstein
59de9365f9 use loose type admission for buffers and tuples as well as lists 2019-02-14 13:05:07 -06:00
Aaron Blankstein
1f6aac5b93 update admits() logic for buffers. add test for more complex type signature in a data map 2019-02-13 14:07:04 -06:00
Aaron Blankstein
bc24cc34ea oops, type forcing 2019-02-13 08:59:24 -06:00
Aaron Blankstein
233a26d100 do value size checks in type instantiations 2019-02-13 08:34:07 -06:00
Aaron Blankstein
961886bbcc drop the string-based type descriptors in favor of the structural descriptors from SIP-002 2019-02-12 09:56:02 -06:00
Aaron Blankstein
7a5e1bbe30 add test for non-public contract invocation failure 2019-02-12 08:55:08 -06:00
Aaron Blankstein
71934673ce add define-public and a test for contract environment execution 2019-02-08 20:58:11 -06:00
Aaron Blankstein
856c56d987 instantiating contract 2019-02-08 14:56:41 -06:00
Aaron Blankstein
c981aca042 add execute_transaction impl for skeletal contract interface 2019-02-08 14:37:35 -06:00
Aaron Blankstein
388743c406 update tests to work with env constructions 2019-02-08 14:15:16 -06:00
Aaron Blankstein
6c48a5bb98 environments now have immutable ref to global context. this is in preparation for creating contract contexts-- a transaction should _never_ be able to modify a contract's global context. 2019-02-08 13:58:48 -06:00
Aaron Blankstein
53f6e3f759 refactor value construction to allow for value size enforcement. 2019-02-08 08:47:47 -06:00
Aaron Blankstein
ba2d70353f u8 is too small for 256! 2019-02-07 15:43:38 -06:00
Aaron Blankstein
ec2af760d2 Merge branch 'develop' into feature/smart-contract-vm 2019-02-07 15:39:23 -06:00
Aaron Blankstein
06e1f04bfa use 256 for max stack, context depth. use drain() in parser to avoid clones 2019-02-07 15:36:45 -06:00
Jude Nelson
213f3083ec API sync with ed25519 and curve25519 2019-02-07 16:11:12 -05:00
Jude Nelson
113df58622 make all ops Eq; fix test imports 2019-02-07 16:10:53 -05:00
Jude Nelson
d8ebc59ecb use correct column name; fix imports in tests 2019-02-07 16:10:38 -05:00
Jude Nelson
c73f63e3fc add Eq derive 2019-02-07 16:10:26 -05:00
Jude Nelson
ff14340a44 Merge branch 'develop-jude' into develop 2019-02-07 15:32:44 -05:00
Jude Nelson
e39ea808f5 generate hash160 from sha256 as a separate method 2019-02-07 15:32:13 -05:00
Jude Nelson
3dfba809d3 add system fork set version 2019-02-07 15:31:57 -05:00
Jude Nelson
ba06e20f99 implement check routine for user burn supports. In particular, a user burn support does _not_ need to correspond to a specific block to be accepted -- we'll still keep the burns around to measure chain quality 2019-02-07 15:30:28 -05:00
Jude Nelson
735dab927c finish check() routine for leader block commits 2019-02-07 15:30:16 -05:00
Jude Nelson
9ca2ac9817 roll the system fork version into the consensus hash 2019-02-07 15:29:57 -05:00