Commit Graph

308 Commits

Author SHA1 Message Date
mjkeating
d7184345b8 renamed the macro Hashtree to TreeHash 2019-02-25 09:17:17 -08:00
thojest
9a892bbdfd removed TestRandom import in beacon_state (lighthouse-246) 2019-02-25 09:26:43 +01:00
thojest
cd4346962a Merge branch 'master' into lighthouse-246 2019-02-25 09:24:47 +01:00
mjkeating
2ce316235f merged master and resolved beacon_state conflict 2019-02-24 16:54:26 -08:00
Kirk Baird
4c3b0a6575
Formatting 2019-02-25 10:38:04 +11:00
Kirk Baird
f72b45147a
Merge conflicts from master 2019-02-25 10:36:54 +11:00
Age Manning
27e7bbd72f
Fix typo in BeaconState
Co-Authored-By: paulhauner <paul@paulhauner.com>
2019-02-25 08:35:21 +13:00
Paul Hauner
5ca7c9929a
Merge branch 'master' into beacon-state-caching 2019-02-24 19:14:05 +13:00
Paul Hauner
ab10cbbdb5
Fix clippy lints, small typos 2019-02-24 18:52:12 +13:00
Paul Hauner
c49f425fe8
Tidy, add comments to BeaconState 2019-02-24 18:25:17 +13:00
Paul Hauner
779b6266a5
Ensure shuffling is cached between slot calcs
Previously it was being re-built for every slot, now it is being
generated once-per-epoch.
2019-02-23 18:45:32 +13:00
Kirk Baird
a5cbda0b60 Merge branch 'master' into signature-scheme-update 2019-02-23 13:34:57 +11:00
mjkeating
f95a0134e6 now using the Hashtree macro for most struct types 2019-02-22 13:07:04 -08:00
thojest
66b5accdc2 replaced manual TestRandom implementation with macro when possible; fixed typo in TestRandom macro (lighthouse-246) 2019-02-22 17:10:26 +01:00
thojest
278b41c8ef decided against moving test_utils (lighthouse-246) 2019-02-22 16:05:52 +01:00
thojest
7a382043e1 added test_random_derive implementation (lighthouse-246) 2019-02-22 15:54:18 +01:00
thojest
5f3ba42b97 added first draft for lib-crates for test_random and test_random_derive (lighthouse-246) 2019-02-22 12:16:11 +01:00
Paul Hauner
7a28893bab
Fix bug in Epoch.slot_iter()
It wasn't running the whole range, plus it could get into a loop when
used near the u64::max_value
2019-02-22 18:48:35 +13:00
Paul Hauner
89ab0f683e
Change "few_validators" spec to be 8 shards.
A bug arises when the number of shards is less than the slots in an
epoch.
2019-02-22 18:19:47 +13:00
Paul Hauner
a5de6a1915
Add caching to BeaconState.
Removes CachingBeaconState
2019-02-22 18:14:16 +13:00
Paul Hauner
cdc03f1749
Remove FastBeaconState 2019-02-22 17:55:36 +13:00
Paul Hauner
c040ed7b11
Merge pull request #243 from sigp/fork-choice-tests
Fork choice tests
2019-02-22 13:34:58 +13:00
Paul Hauner
b211e39331
Add progress on FastBeaconState 2019-02-21 19:00:55 +13:00
Kirk Baird
673c8ea388
Merge current master 2019-02-20 13:59:11 +11:00
Age Manning
efa8aa19e7
Corrects small comments. 2019-02-20 12:52:03 +11:00
Age Manning
0f7167992b
Removes topic from logs. 2019-02-20 12:39:00 +11:00
Age Manning
2fbdc53147
Add asserts to ensure block heights are not too large. 2019-02-20 12:36:54 +11:00
Age Manning
d8584cbed2
Update to rust 2018 importing macros. 2019-02-20 12:15:41 +11:00
Age Manning
c7acde4fc2
Rename OptimisedLMDGhost to BitwiseLMDGhost. 2019-02-20 12:14:46 +11:00
Paul Hauner
59fd716286
Add extra comment to ssz_derive 2019-02-20 11:23:35 +13:00
Paul Hauner
586bb09e02
Set ssz_derive to import from ssz::
Previously it was expecting `Encodable`, `Decodable`, etc to be in
scope, now it uses `ssz::Encodable`.
2019-02-20 11:06:03 +13:00
Paul Hauner
abef6698b1
Fix failing doc examples in ssz_derive 2019-02-20 10:12:18 +13:00
Age Manning
6f74ffc7e6
Correct minor comment. 2019-02-19 23:20:45 +11:00
Age Manning
b8411e7126
Merge branch 'master' into fork-choice-tests 2019-02-19 23:09:31 +11:00
Age Manning
fd1edaf805
Add fork choice bug fixes.
- Further bug fixes from testing.
- Simplify the testing framework.
- Add tests for longest chain and GHOST vs bitwise GHOST.
2019-02-19 23:06:35 +11:00
Paul Hauner
a78256c778
Merge branch 'master' into ssz-derive 2019-02-19 20:46:47 +13:00
Paul Hauner
5e67ddd498
Add docs to ssz_derive 2019-02-19 20:43:09 +13:00
Paul Hauner
a1118e13ae
Merge pull request #238 from mjkeating/tree_hash_add_padding2
Updated TreeHash to spec - added padding
2019-02-19 16:54:36 +11:00
Paul Hauner
b6f3156b4e
Run rustfmt on ssz_derive 2019-02-19 18:04:29 +13:00
Paul Hauner
089127b347
Merge pull request #226 from thojest/lighthouse-150
add is_double_vote and is_surround_vote
2019-02-19 16:02:29 +11:00
Age Manning
2394f64329
Add longest chain tests and test vectors. 2019-02-19 15:22:35 +11:00
Age Manning
bd66a02cb3
Add slow LMD Ghost working tests. 2019-02-19 15:08:55 +11:00
Age Manning
846cbdd7f7
Generalise fork choice tests. 2019-02-19 14:37:17 +11:00
Paul Hauner
fc0bf578f8
Use SSZ enc/dec proc macros on most types
Some types were skipped as they have non-standard serialization.
2019-02-19 14:32:00 +11:00
Paul Hauner
345c527d33
Add SSZ encode/decode for bool 2019-02-19 14:31:09 +11:00
Paul Hauner
fdfaf18dbd
Add ssz_derive crate.
It appears to be fully functional at this stage.
2019-02-19 13:54:39 +11:00
Age Manning
8baae0e02e
Updates optimised fork choice.
- Bug fixes in optimised fork choice.
- YAML tests functioning.
- Implement Clippy suggestions.
- Remove Copywrite notices.
2019-02-19 11:58:17 +11:00
mjkeating
cd676d5621 fixed a bug in TreeHash.rs/list_to_blob 2019-02-18 11:55:44 -08:00
mjkeating
0148abaa0b Merge branch 'master' into tree_hash_add_padding2 2019-02-18 09:04:53 -08:00
Feng94
1bdce182a9
Rename block_producer crate to block_proposer and change references inside it to block_proposer 2019-02-19 00:03:35 +11:00
thojest
f88155625c added comment to indicate highest spec version of implemented functions; added realistic test scenario for is_surround_vote (lighthouse-150) 2019-02-18 12:12:01 +01:00
thojest
ee13c6ee40 Merge branch 'master' into lighthouse-150 2019-02-18 11:49:37 +01:00
Age Manning
4eddb47fd0
Updates all fork-choices to use ChainSpec for consts. 2019-02-18 17:49:05 +11:00
Age Manning
6e6d451978
Updates optimised ghost to use chainspec for consts. 2019-02-18 17:42:07 +11:00
Age Manning
8b34bc490b
Add fork-choice yaml tests. 2019-02-18 17:32:13 +11:00
Kirk Baird
21d75f1853
Use verify_proof_of_possession 2019-02-18 12:06:47 +11:00
Kirk Baird
2c8aa17e0d Merge branch 'master' into signature-scheme-update 2019-02-18 10:54:26 +11:00
Kirk Baird
9c4a1f1d1f
Update to signature-scheme 0.5.2 2019-02-18 10:50:40 +11:00
mjkeating
6fa141181b Updated TreeHash to spec - added padding 2019-02-17 09:30:18 -08:00
Paul Hauner
c4bedc03a8
Fix file org. inconsistency in types 2019-02-17 20:21:13 +11:00
Paul Hauner
b2173c1a16
Merge branch 'master' into test-harness-fix 2019-02-16 15:10:48 +11:00
Paul Hauner
f83d02b394
Update previous epoch function 2019-02-16 15:09:43 +11:00
Paul Hauner
b79f0cdf68
Fix bug with reward quotient in epoch processing 2019-02-16 15:09:14 +11:00
Paul Hauner
c5158e2974
Fix bug with total_balance in epoch processing 2019-02-16 15:08:57 +11:00
Paul Hauner
b0513b1ec1
Add and update logs 2019-02-16 15:08:33 +11:00
Paul Hauner
5e6acb8f39
Break BeaconState tests into separate file 2019-02-16 11:19:47 +11:00
thojest
203f3b37f2 adapted import due to renaming of crate slot_epoch_height -> slot_epoch (lighthouse-150) 2019-02-15 12:25:59 +01:00
thojest
94cb6a2a43 Merge branch 'master' into lighthouse-150 2019-02-15 12:16:39 +01:00
Paul Hauner
7c920cfb96
Add incomplete progress on fixing test harness 2019-02-15 19:23:22 +11:00
Paul Hauner
2affd305d9
Merge branch 'master' into implement-shuffle 2019-02-15 18:21:54 +11:00
Age Manning
0800091a43
Merge pull request #232 from sigp/tidy-beacon-state
Add beacon state test builder, tidy errors
2019-02-15 18:06:42 +11:00
Paul Hauner
b05f12cf6f
Merge branch 'tidy-beacon-state' into test-harness-fix 2019-02-15 17:10:11 +11:00
Paul Hauner
1c57eb47f9
Move BeaconStateTestBuilder into test mod 2019-02-15 17:07:52 +11:00
Paul Hauner
054c1f9047
Swap over to v0.2.0 shuffling algo 2019-02-15 16:55:52 +11:00
Paul Hauner
2f8c4536a0
Merge branch 'int_to_bytes' into implement-shuffle 2019-02-15 16:40:32 +11:00
Paul Hauner
4ddbb3197c
Merge branch 'master' into tidy-beacon-state 2019-02-15 16:30:51 +11:00
Paul Hauner
ae5072d0f5
Merge branch 'master' into int_to_bytes 2019-02-15 16:13:40 +11:00
Paul Hauner
ec4a658fe7
Add beacon state test builder, tidy errors 2019-02-15 16:12:24 +11:00
Paul Hauner
b15ee17fed
Merge pull request #225 from sigp/permutated-index
Add get_permutated_index
2019-02-15 15:32:28 +11:00
Age Manning
e06c4796e4
Import Slot directly from types in fork-choice. 2019-02-15 14:21:33 +11:00
Age Manning
b16ac40fd5
Add tests to SlotHeight. 2019-02-15 14:16:45 +11:00
Kirk Baird
977f3edfb6
Add domain to all signature funcitons, modify validate_proof_of_possession() 2019-02-15 13:58:14 +11:00
Age Manning
5031ee5505
Remove comments from fork choice. 2019-02-15 13:32:37 +11:00
Age Manning
2cab2952a8
Removes duplication of macros in types. 2019-02-15 13:29:09 +11:00
Paul Hauner
af1d44e8b0
Add shuffling to fuzzer, fixing a bug
We were being to strict on list length, it can be 2**24 as all index's
will need to be less than that.
2019-02-15 12:58:14 +11:00
Paul Hauner
210ec89b0b
Replace ssz_encode with int_to_bytes32
Only in the relevant places I can think of.. I might have missed some.
2019-02-15 12:21:19 +11:00
Paul Hauner
fc04286ae6
Use int_to_bytes in swap or not.
I also fixed an error I found through strict typing.
2019-02-15 12:13:57 +11:00
Paul Hauner
73484f04a1
Rename eth2_bytes to int_to_bytes 2019-02-15 11:19:25 +11:00
Paul Hauner
46673238b6
Add eth2_bytes crate
Is passing test vectors
2019-02-15 11:13:56 +11:00
Paul Hauner
8c54e55d99
Updates to permutated_index
- Add comments.
- Add more `None` conditions.
- Add more tests.
2019-02-15 00:28:24 +11:00
Age Manning
91ba26a351
Add test dependencies for fork-choice. 2019-02-15 00:21:26 +11:00
Paul Hauner
c98a9fdf3e
Update test vectors, align to test vectors. 2019-02-14 23:55:48 +11:00
thojest
7434ff47ba added is_double_vote and is_surround_vote (lighthouse-150) 2019-02-14 13:28:42 +01:00
Paul Hauner
18e85a3cf8
Add swap_or_not_shuffle and tests.
The implementation is not matching the EF implementation at this point.
2019-02-14 18:22:55 +11:00
Age Manning
fe13d98469
Updates longest chain to match new fork-choice structure. 2019-02-14 18:09:09 +11:00
Age Manning
7b39dad232
Removes protolambda as an option of fork-choice. 2019-02-14 16:56:12 +11:00
Age Manning
7a03ee79aa
Update SlowLMDGhost to use SlotHeight. 2019-02-14 16:53:53 +11:00
Age Manning
066f0090dd
Add slot_height type. 2019-02-14 16:46:33 +11:00
Paul Hauner
c41b743d2d
Rename vec_shuffle to fisher_yates_shuffle
We're adding another shuffler so it's nice to be specific
2019-02-14 14:57:29 +11:00
Paul Hauner
35c914baa6
Revert "Merge pull request #200 from sigp/new-structure"
This reverts commit d7a3545be1, reversing
changes made to 1da06c156c.
2019-02-14 12:09:18 +11:00
Paul Hauner
1d5ff4359a
Strip out old code
All of these files have been moved to either:

- https://github.com/sigp/lighthouse-beacon
- https://github.com/sigp/lighthouse-validator
- https://github.com/sigp/lighthouse-common

For rationale, see: https://github.com/sigp/lighthouse/issues/197
2019-02-13 14:15:53 +11:00
Paul Hauner
492d4749d7
Fix clippy lint 2019-02-13 10:32:56 +11:00
Paul Hauner
683147035b
Fix clippy lints in block and epoch processing 2019-02-13 10:28:57 +11:00
Paul Hauner
4824b43808
Fix various clippy lints 2019-02-13 07:46:59 +11:00
Paul Hauner
05ed778ccc
Remove unused var from block_producer
It was made redundant when `proposer_slots` was removed.
2019-02-13 07:39:00 +11:00
Paul Hauner
5c1d0dcea5
Fix various clippy lints 2019-02-13 07:32:31 +11:00
Paul Hauner
fef22c31be
Update block_producer to spec v0.2.0 2019-02-12 17:00:10 +11:00
Paul Hauner
5fefc79521
Update BeaconChain for spec v0.2.0 2019-02-12 13:00:52 +11:00
Paul Hauner
36f441c968
Replace genesis crate with on-type defs
The methods in the `gensis` crate have been moved to `genesis` methods
on `BeaconState` and `BeaconBlock`.
2019-02-12 13:00:35 +11:00
Paul Hauner
cb97870c15
Add genesis() function to BeaconBlock 2019-02-12 11:57:34 +11:00
Paul Hauner
f27308e377
Tidy old comments 2019-02-12 11:57:20 +11:00
Paul Hauner
3b75e93122
Add genesis() to BeaconState 2019-02-12 11:54:02 +11:00
Paul Hauner
f3e556bca3
Remove validator_induction crate 2019-02-12 09:02:26 +11:00
Paul Hauner
ff2025ec5c
Update epoch processing to v0.2.0 2019-02-12 08:58:20 +11:00
Paul Hauner
c1f8c85ce9
Add un-finished, uncompiling state_processing 2019-02-11 17:25:23 +11:00
Paul Hauner
03e84a63ec
Tidy BeaconState 2019-02-11 17:24:56 +11:00
Paul Hauner
75a9e0f3de
Add verify_signature() to Attestation 2019-02-11 17:24:32 +11:00
Paul Hauner
25ae0f64c2
Tidy, fix & extend BeaconState impls. 2019-02-11 16:32:55 +11:00
Paul Hauner
d7f8c60f93
Fix un-annotated test in types crate 2019-02-11 16:31:33 +11:00
Paul Hauner
a13dd0d871
Update types defs, move processing out.
- Update `types` to v0.2.0 spec (not all functions upgraded too).
- Move slot/block/epoch processing out to a separate crate (not included
yet, it doesn't compile)
2019-02-11 14:02:59 +11:00
Paul Hauner
ba7137697c
Add impl_common to slot_epoch.rs 2019-02-07 13:53:30 +11:00
Paul Hauner
7583599e65
Add tests for Slot/Epoch types 2019-02-07 13:44:48 +11:00
Paul Hauner
85450ec254
Fix all compile errors from new Slot/Epoch types 2019-02-07 11:22:48 +11:00
Paul Hauner
b865768d3b
Update validator_inductor to use Slot newtype 2019-02-07 09:54:45 +11:00
Paul Hauner
a98c221447
Add new fn to Slot and Epoch 2019-02-07 09:53:53 +11:00
Paul Hauner
bd71304d73
Convert beacon_state to Slot/Epoch newtypes 2019-02-06 13:17:10 +11:00
Paul Hauner
2aa7d80a5f
Update types to use Slot newtype
All dependant functions haven't yet been updated.
2019-02-05 19:27:12 +11:00
Paul Hauner
dbe9112848
Add first impl of Slot and Epoch newtypes
Not tested yet.
2019-02-05 19:15:26 +11:00
Paul Hauner
6c6ee4320d
Fix block_producer naming to match attester 2019-02-05 16:47:59 +11:00
Paul Hauner
49dcb38c31
Fix naming consistency with attester crate.
Adjusted naming of files to ensure they match the name of the struct.
Also change the name of some structs so they don't look like tests.
2019-02-05 16:41:18 +11:00
Paul Hauner
da1498fc45
Remove validator_shuffling crate.
It has been replaced by the `beacon_state.get_shuffling` function.
2019-02-05 12:48:07 +11:00
Paul Hauner
87a326d8a2
Complete canonical_root for attestation_data 2019-02-05 12:41:56 +11:00
Paul Hauner
cbb84c0d69
Move all attestation_data fns into same file 2019-02-05 12:40:03 +11:00
Paul Hauner
05b890860a
Move all attestaion fns into same file 2019-02-05 12:38:58 +11:00
Paul Hauner
b9dc8437c9
Move all beacon_block fns into the same file 2019-02-05 12:33:52 +11:00
Paul Hauner
ade2460377
Move all beacon_state fns into single file. 2019-02-05 12:25:42 +11:00
Paul Hauner
0120082f6b
Merge branch 'master' into add-chain-benchmarks 2019-02-05 05:49:45 +11:00
Paul Hauner
bd1cfeeba9
Change bls import method for validator 2019-02-05 03:52:34 +11:00
Paul Hauner
dcb507ca18
Remove unused errors from genesis crate 2019-02-05 03:51:24 +11:00
Paul Hauner
aad3b3dc7a
Merge spec into types crate.
Also remove some pre-2018 `extern crate` calls.
2019-02-01 19:05:39 +11:00
Paul Hauner
efc0902abb
Run cargo fmt 2019-02-01 18:20:42 +11:00
Paul Hauner
865919e398
Improve attester errors, move info -> helpers
- Ensured one can distingush between a committee error and an invalid
validator index when using `validator_attesation_slot_and_shard`.
- Renamed the `info.rs` file to `getters.rs`, for clarity.
2019-02-01 17:56:49 +11:00
Paul Hauner
20e45b3369
Refactor block_processing
- Add the rayon library for parallelization
- Move from std::sync::Rwlock to rayon::RwLock
- Add `state` field to BeaconChain
- Fix major bug in attestation validator where justified slot was
incorrectly looked up.
2019-02-01 14:48:09 +11:00
Paul Hauner
10fec4919b
Merge pull request #175 from sigp/tree_hash
Merkle hashing chunk size fix
2019-02-01 12:08:17 +11:00
Paul Hauner
02a962d35d
Ensure per_epoch trans. happens before per_slot. 2019-01-31 18:32:23 +11:00
Paul Hauner
c1b3d1b63e
Tidy up and add some logs 2019-01-31 18:32:01 +11:00
Paul Hauner
e1239a1ecc
Ensure attestation_participants is deduped 2019-01-31 18:31:20 +11:00
Paul Hauner
3f13c25c05
Fix issues with per_epoch block_root calls
They were being called with the wrong slot.
2019-01-31 18:28:54 +11:00
Paul Hauner
5c44f97fba
Fix bug with committee index for attester duties
It was returning the validator_index instead of the `committee_index`.
2019-01-31 16:42:53 +11:00
Paul Hauner
48801e4674
Re-enable signature checking for validations 2019-01-31 16:42:31 +11:00