Commit Graph

266 Commits

Author SHA1 Message Date
Alex Stokes
5eabdad0dc
remove active_validators crate 2018-12-12 19:22:44 -08:00
Alex Stokes
1ff47720f1
Clean up representation of ValidatorStatus 2018-12-12 19:05:32 -08:00
Grant Wuerker
6089b7c108 chain config TODO 2018-12-12 19:55:30 -06:00
Paul Hauner
4f0a223579
Change some ShardAndCommittee -> ShardCommittee 2018-12-13 12:28:37 +11:00
Paul Hauner
6847e68c5e
Move genesis code into its own crate 2018-12-13 12:27:45 +11:00
Grant Wuerker
82b3a21767 Merge branch 'master' into validator-record-update 2018-12-12 18:42:16 -06:00
Grant Wuerker
045f7b5b98 typo 2018-12-12 17:59:50 -06:00
Grant Wuerker
c7f7bfaab4 deposit and deposit_parameters types added 2018-12-12 17:57:14 -06:00
Grant Wuerker
071e099203 validator registration removed 2018-12-12 17:56:44 -06:00
Paul Hauner
bf49c881d5
Introduce un-tested BeaconState genesis code. 2018-12-12 18:36:12 +11:00
Paul Hauner
56dc73fbd1
Update some shard u16 to u64
This is pretty hacky, is just serving my purpose for `BeaconChain`.
These structs will need to be fully updated to the latest spec.
2018-12-12 18:35:31 +11:00
Paul Hauner
92786520e4
Update (hacky) validator induction and shuffling.
This allows the `BeaconChain` struct to be updated but it doesn't bring
these functions in line with the spec.
2018-12-12 18:32:19 +11:00
Paul Hauner
c944c435e2
Update CrosslinkRecord to latest spec
Addresses #100
2018-12-12 18:30:20 +11:00
Paul Hauner
89bea5b5e8
Update BeaconState rename ShardCommittee
Both structs are now consistent with the spec.

Addresses #100
2018-12-12 18:25:21 +11:00
Paul Hauner
211d3961a0
Add ChainSpec structure.
It includes all constants from the
[Constants](https://github.com/ethereum/eth2.0-specs/blob/master/specs/core/0_beacon-chain.md#attestation)
section in the spec, except for things that are clearly enums.

My reasoning is that these enums are not so much "chain specification"
and this struct should be reserved for items that "configure" the chain.
2018-12-12 16:08:01 +11:00
Paul Hauner
4d0641636e
Rename AttestationRecord -> Attestation 2018-12-12 12:16:11 +11:00
Alex Stokes
fa3d9bdb07
begin the transition to using ValidatorStatus as a distinct type 2018-12-11 15:17:55 -08:00
Alex Stokes
d3681e876a
add method to determine validator status 2018-12-11 15:16:25 -08:00
Paul Hauner
4fdc2e4ac6
Merge branch 'master' into attestation-update 2018-12-12 09:45:14 +11:00
Paul Hauner
f29d7961fd
Merge pull request #87 from ralexstokes/fix-boolean-bitfield-serde-bug
Fix boolean bitfield serde bug
2018-12-12 09:36:54 +11:00
Alex Stokes
6c2c42e6b7
Adds custom std::cmp::PartialEq impl
Two bitfields now match if they contain the same information.

There were some discrepancies before when comparing fields with the same
bits set but came from different sources, e.g. off the wire vs created
in memory, due to the existence of unset bits in the high byte.
2018-12-10 20:34:35 -08:00
Alex Stokes
1ffd9e10b3
Fixes bug with attestation validation that arose from change to API 2018-12-10 20:33:43 -08:00
Alex Stokes
4d43de1cea
rustfmt edits 2018-12-10 20:32:44 -08:00
Grant Wuerker
1d48aa280b test passing in validator_record.rs 2018-12-09 22:22:08 -06:00
Grant Wuerker
c63ef6d032 ValidatorRecord initialization updated to reflect struct 2018-12-09 22:13:57 -06:00
Paul Hauner
3ae82c0710
Strip out anitquated parts of chain crate 2018-12-10 10:48:02 +11:00
Paul Hauner
7ea701aa30
Remove old block processing code 2018-12-10 09:54:25 +11:00
Paul Hauner
a35a28f522
Remove old validation crate 2018-12-10 09:48:41 +11:00
Paul Hauner
0f9482f9d1
Complete attestation_validation, bar tests 2018-12-10 09:33:57 +11:00
Grant Wuerker
0627b658f1 struct updated accoding to spec 2018-12-08 21:11:10 -06:00
Paul Hauner
a8bfa4d733
Add more attestation validation tests 2018-12-07 08:59:05 +11:00
Paul Hauner
2d2da001b9
Implement tests for attestation validation 2018-12-06 19:50:33 +11:00
Paul Hauner
36bda7502b
Implement signature verification test 2018-12-06 18:41:22 +11:00
Paul Hauner
3533b8b892
Add untested attestation validation logic 2018-12-06 18:16:03 +11:00
Paul Hauner
d4b6d81c9d
Merge branch 'beacon-state-pub-fields' into attestation-update 2018-12-05 09:46:50 +11:00
Paul Hauner
140df1a689
Make all BeaconState fields public (doh!) 2018-12-05 09:45:03 +11:00
Alex Stokes
564f13be5f fixes bug with serialization logic for boolean bitfield
should match the python impl
2018-12-03 20:46:11 -08:00
Paul Hauner
e0360edde0
Update ssz_utils for new AttestationRecord. 2018-12-04 14:50:47 +11:00
Paul Hauner
6e0daec1da
Update AttestationData struct 2018-12-04 14:50:32 +11:00
Paul Hauner
bedc1abec0
Add failing boolean bitfield test 2018-12-03 17:13:39 +11:00
Paul Hauner
1e3fd1ff80
Add ssz encode/decode for AttestationData 2018-12-03 16:19:31 +11:00
Paul Hauner
430bc224a4
Update BeaconState object
Also adds the following structs:

- AttestationData
- ForkData
- PendingAttestationRecord

The `AttestationRecord` object has _not_ been updated.
2018-12-03 14:29:05 +11:00
Paul Hauner
54db7b5272
Merge pull request #76 from sigp/state-merge
Add new `State` type and dependant types

Closes #73
2018-11-27 15:10:06 +11:00
Paul Hauner
3ed4de65d2
Add new State type and dependant types 2018-11-25 15:39:50 +11:00
mjkeating
d6bf1a6119 removed unnecessary call to saturated_sub() in vec_shuffle 2018-11-23 19:29:03 -08:00
Paul Hauner
f65888226a Add some extra tests for boolean-bitfield 2018-11-22 14:18:08 -08:00
Alex Stokes
a695382260 Run cargo fmt that got clobbered in merge 2018-11-20 12:54:35 -08:00
Alex Stokes
11cdf66079 Remove warning about unused import 2018-11-20 12:51:51 -08:00
Alex Stokes
57dcad149f Fixes bug with ssz encoding of BooleanBitfield 2018-11-20 12:40:13 -08:00
Alex Stokes
031b7bf225 Add method to calculate the underlying number of bytes
Required for part of attestation validation logic
2018-11-20 12:40:13 -08:00
Alex Stokes
72cf7ad1bd Begin updating tests to reflect changes to bitfield 2018-11-20 12:40:13 -08:00
Alex Stokes
832d1bd295 Update bitfield to expand size when writing out-of-bounds 2018-11-20 12:38:23 -08:00
Alex Stokes
37b05e1a5b get tests passing (except one) 2018-11-20 12:38:23 -08:00
Alex Stokes
a9decd3aed Simplifies the boolean-bitfield implementation to use bit-vec crate 2018-11-20 12:34:28 -08:00
Paul Hauner
900ffac5e0
Run rustfmt globally.
Using `$ cargo fmt` in the root. Closes #68.
2018-11-04 15:35:55 +01:00
Paul Hauner
46da9b670f
Add untested minimum viable block processing 2018-10-30 15:49:32 +01:00
Paul Hauner
7f21fd325e
Add initial works on extending the chain 2018-10-25 10:14:43 +02:00
Paul Hauner
b2495cbcff
Fix clippy lints 2018-10-24 15:40:09 +02:00
Paul Hauner
28ffb037cc
Merge branch 'master' into genesis 2018-10-24 15:26:27 +02:00
Paul Hauner
e2c264de96
Merge pull request #58 from g-r-a-n-t/clippy-warnings
Clippy warnings
2018-10-24 15:25:14 +02:00
Paul Hauner
98076d6439
Add test for utils/active-validators 2018-10-24 15:22:39 +02:00
Grant Wuerker
625fc4c9b9 mutable iterator in encode_length 2018-10-24 07:56:58 -05:00
Paul Hauner
b17a15a378
Rename block preprocessing 2018-10-24 14:48:35 +02:00
Paul Hauner
e48e423b30
Update and add tests for chain maps 2018-10-24 14:48:20 +02:00
Paul Hauner
68e4c47cd3
Add slot-clock 2018-10-24 13:16:09 +02:00
Paul Hauner
58c6465f44
Ensure genesis inducts all validators as active 2018-10-24 10:15:59 +02:00
Paul Hauner
896810fb9f
Add status to validator induction.
Allows for inducting validators with a specific status.
2018-10-24 10:13:47 +02:00
Grant Wuerker
4c272d7f0a suppressed unknown lint warning in test 2018-10-23 19:34:47 -05:00
Paul Hauner
a170bfe4fc
Add untested validator change code 2018-10-23 23:45:54 +02:00
Paul Hauner
cc28b7370d
Extend chain config 2018-10-23 23:44:46 +02:00
Paul Hauner
da25a66196
Move active_validators into own crate 2018-10-23 23:43:35 +02:00
Paul Hauner
a34266de0a
Add unfinished progress on BeaconChain struct 2018-10-23 14:51:32 +02:00
Paul Hauner
a40b49d586
Updates to block validation
- Rename "parent_hashes" -> "recent_block_hashes"
- Expect block has to be computed prior to function
2018-10-23 13:15:08 +02:00
Paul Hauner
06c20857c8
Add slot duration to chain config 2018-10-23 13:09:47 +02:00
Paul Hauner
0536fb4a91
Update ShardAndCommittee per new spec
- `shard_id` -> `shard`
2018-10-23 12:28:07 +02:00
Paul Hauner
42e774cb48
Finish genesis for BeaconChain 2018-10-22 06:48:44 +11:00
Paul Hauner
41bfb7a0e2
Merge branch 'shuffle_underflow' into genesis 2018-10-22 06:17:02 +11:00
Paul Hauner
afc219c26b
Merge branch 'validator_induction' into genesis 2018-10-22 05:59:55 +11:00
Paul Hauner
8a2baa7b26
Move proof_of_possession into bls crate 2018-10-22 05:58:12 +11:00
Paul Hauner
c9dcf7906d
Merge branch 'validator_induction' into genesis 2018-10-22 05:51:55 +11:00
Paul Hauner
7eac75fcf6
Add missed file 2018-10-22 05:51:31 +11:00
Paul Hauner
14537818c4
Merge branch 'validator_induction' into genesis 2018-10-22 05:30:56 +11:00
Paul Hauner
db735a598f
Fix underflow in shuffle with empty list 2018-10-22 05:24:13 +11:00
Paul Hauner
12b5d7434c
Move ValidatorRegistration into types 2018-10-22 05:22:16 +11:00
Paul Hauner
d2c41977cc
Sketch out BeaconChain struct 2018-10-22 04:37:42 +11:00
Paul Hauner
bdb5c45e60
Merge pull request #57 from pinkiebell/shuffling/test_vectors
Closes #51
2018-10-21 22:07:13 +11:00
pinkiebell
78f9c09278 beacon_chain/utils/shuffling: Resolve PR comments 2018-10-21 13:01:56 +02:00
Paul Hauner
694db90b8c
Simplify parent_hashes code 2018-10-21 20:12:17 +11:00
Paul Hauner
6ee3ad10da
Change integer literals to constants 2018-10-21 20:07:57 +11:00
Grant Wuerker
d670294c11 readded cast_lossless supress to encode 2018-10-20 20:31:26 -05:00
Grant Wuerker
3c1640f41a moved suppress warning tag 2018-10-20 19:20:01 -05:00
Grant Wuerker
0cab98ffe1 another loop fixed 2018-10-20 18:43:43 -05:00
Grant Wuerker
d3ec313b43 a few more quick changes and another range loop ignore 2018-10-20 17:38:32 -05:00
Grant Wuerker
869049d099 needless_range ignore and derive[default] tag on sszstream 2018-10-20 17:29:12 -05:00
Grant Wuerker
e714ec0489 cast_lossless warning supressed and better looking vectors 2018-10-20 17:04:17 -05:00
Grant Wuerker
9c1d34253a refactoring of impl_decodable_for_uint 2018-10-20 15:15:58 -05:00
Grant Wuerker
ba65bdfc6a redundant if and type conversion change 2018-10-20 14:20:23 -05:00
pinkiebell
5252b54a04 beacon_chain/utils/shuffling: Introduce test vectors from sigp/shuffling_sandbox
Also:
 - return early if we shuffle an empty list
 - change RAND_MAX as per spec
2018-10-20 18:44:39 +02:00
Paul Hauner
5d85c62f6e
Finish implementing genesis (without tests) 2018-10-20 21:42:07 +11:00
Paul Hauner
f17d6db5e9
Merge branch 'validator_induction' into genesis 2018-10-20 21:29:55 +11:00
Paul Hauner
f495ed845b
Change ValidatorInductor to own instead of borrow 2018-10-20 21:28:57 +11:00
Paul Hauner
a60fd784e6
Merge branch 'validator_induction' into genesis 2018-10-20 21:01:50 +11:00
Paul Hauner
a8179897a9
Add to_ref method for inductor 2018-10-20 21:01:35 +11:00
Paul Hauner
2e7d6c0af3
Merge branch 'validator_induction' into genesis 2018-10-20 19:18:39 +11:00
Paul Hauner
99ce9a2dd2
Add new method for ValidatorInductor 2018-10-20 19:18:16 +11:00
Paul Hauner
eaf1198ec4
Add more half-finished genesis code 2018-10-20 19:02:15 +11:00
Paul Hauner
bb75e30ff2
Fix error in CrystallizedState definition 2018-10-20 19:02:02 +11:00
Paul Hauner
7508bfca6a
Change error handining in validator_shuffling 2018-10-20 18:10:41 +11:00
Paul Hauner
a8d2b20570
Update CrystallizedState as per new spec. 2018-10-20 17:15:53 +11:00
Paul Hauner
de8b84f9cd
Update ActiveState as per new spec 2018-10-20 17:15:36 +11:00
Paul Hauner
073e3529e9
Add half-finished chain code 2018-10-20 16:34:08 +11:00
Paul Hauner
606c32950d
Move shuffling functions around
- Move `delegation` from the `transition` dir into its own dir:
`beacon_chain/validator_shuffling`
- Rename `beacon_chain/utils/shuffling` -> `vec_shuffle`
2018-10-20 16:30:32 +11:00
Paul Hauner
b4566a776a
Add validator induction functionality 2018-10-20 03:11:45 +11:00
Paul Hauner
d5675062c1
Add proof-of-possession hash fn 2018-10-20 03:09:42 +11:00
Paul Hauner
f00b39dd3c
Remove dynasty from delegation fn 2018-10-20 02:36:55 +11:00
Paul Hauner
725741307a
Update validator record to new spec 2018-10-20 02:16:52 +11:00
Paul Hauner
1acfb87e77
Merge branch 'master' into beacon_block 2018-10-18 10:14:55 +11:00
Paul Hauner
2fb9dfbf14
Merge pull request #33 from sigp/validation
Add block and attestation validation
2018-10-18 10:07:06 +11:00
Paul Hauner
fa705229aa
Fix clippy lints 2018-10-16 15:24:50 +11:00
Paul Hauner
c3d88a7e80
Update validation as per new spec
- Block -> BeaconBlock
- Updates to SszBeaconBlock
2018-10-16 13:59:45 +11:00
Paul Hauner
c45e05ca02
Update SszBeaconBlock as per new spec 2018-10-16 13:59:26 +11:00
Paul Hauner
f31d41e123
Implement SSZ decode for BeaconBlock, fix encode 2018-10-16 13:47:28 +11:00
Paul Hauner
1621901f0d
Update SSZ
- Implement generic list decoding>
- Expose `encode` mod.
- Add convenience encoding function.
2018-10-16 13:44:26 +11:00
Paul Hauner
e91317ca27
Change SpecialRecord to use u8 instead of enum 2018-10-15 16:26:40 +11:00
Paul Hauner
cd05616efa
Merge branch 'validation' into beacon_block 2018-10-15 15:29:29 +11:00
Paul Hauner
e289d8b5fd
Fix comment in attestation_validation 2018-10-15 15:08:43 +11:00
Paul Hauner
a862c82b37
Rename Block -> BeaconBlock
- Update types::block
- Update ssz_helpers::SszBlock
- Update db::stores::block_store
- Add new fields to types::Block
- Update SszBlock as per new Block fields
2018-10-15 14:57:14 +11:00
Paul Hauner
561167fa1e
Fix panic in ssz decode 2018-10-15 14:10:43 +11:00
Paul Hauner
064e87a347
Add SpecialRecord struct 2018-10-15 12:05:36 +11:00
Paul Hauner
90010ced55
Fix big in attestation validation
There was no check that the attestation is within an appropriate
distance from its parent block.
2018-10-13 09:39:10 +11:00
Paul Hauner
e8daca4c80
Ensure that parent_block.slot < block.slot 2018-10-12 20:54:33 +11:00
Paul Hauner
1f089d423e
Ensure attestation val. check parent.slot
As per comments by Danny Ryan on PR#33
2018-10-12 20:41:18 +11:00
Paul Hauner
b5441535ba
Add comment regarding tightening block val.
Comment was suggested by Danny R.
2018-10-12 19:30:52 +11:00
Paul Hauner
68ca51c7ac
Fix "indicies" type 2018-10-12 00:55:29 +11:00
Paul Hauner
3139d0e5da
Replace hashmap with hashset 2018-10-12 00:53:56 +11:00
Paul Hauner
6ef4268d6d
Verify attestation justified_block_hash.
Previously there was not a check that the hash was in the chain, just
that it was known (in the database in any chain)
2018-10-12 00:41:47 +11:00
Paul Hauner
9717698f7b
Break split function into its own crate.
- Added tests
- Remove it from the delegation dir
- Added it as a crate in utils
2018-10-10 16:09:00 +11:00
Age Manning
ddc8037487
Merge branch 'master' into shuffling 2018-10-10 14:41:49 +11:00
Age Manning
6417ecd464
Correct comments for rust docs 2018-10-10 14:04:42 +11:00
Paul Hauner
739abc0bbd
Merge branch 'master' into validation 2018-10-09 18:28:35 +11:00
Paul Hauner
cf9f8c1e85
Fix issue with last_justified_block_hash
Previously we were just checking it exists in the DB. This is incorrect
because the last_justified_block_hash _must_ be in the chain referenced
by the block.

I.e., it's not OK for a block to reference a justified block in another
chain.
2018-10-09 12:14:59 +11:00
Paul Hauner
f13a4fffea
Fix a type in sig. ver. comment 2018-10-09 11:09:37 +11:00
Paul Hauner
9a59908506
Rename voted_hashmap to voted_hashset 2018-10-09 11:08:09 +11:00
Paul Hauner
a998ac2a12
Add InvalidBitfieldEndBits tests 2018-10-09 11:05:40 +11:00
Age Manning
14e12db374
Updates validation tests for clippy modifications 2018-10-05 14:53:21 +10:00
Age Manning
fd01ffc2a1
Removes block_hash.rs and adds minor clippy fixes 2018-10-05 14:51:16 +10:00
Paul Hauner
e2d45eafae
Separate parent block checking and proposer checking 2018-10-04 15:43:17 +10:00
Age
fd0de57aa7
Remove dead code 2018-10-04 14:51:27 +10:00
Paul Hauner
c30a9a7565
Update comment for rejecting future block
As per Danny's request
2018-10-04 14:46:05 +10:00
Age
1858b2d32b
Corrects cycle tests 2018-10-04 13:21:16 +10:00