Commit Graph

378 Commits

Author SHA1 Message Date
Paul Hauner
b096e3a643
Tidy ancestor iterators 2019-08-06 14:29:45 +10:00
Paul Hauner
845f336a59
Interop chain start strategies (#479)
* Implement more flexible beacon chain genesis

* Fix compile issues from rebase on master

* Rename CLI flag

* Adds initial documentation for TOML files

* Update docs readme

* Add first version of cli_util

* Dont write cache fields in serde

* Tidy cli_util

* Add code to load genesis YAML file

* Move serde_utils out of tests in `types`

* Update logging text

* Fix serde YAML for Fork

* Make yaml hex decoding more strict

* Update deterministic key generate for interop

* Set deposit count on testing genesis state

* Make some fixes for deposit count

* Remove code fragements

* Large restructure of docs

* Tidy docs

* Fix readme link

* Add interop docs

* Tidy README
2019-08-06 13:29:27 +10:00
Paul Hauner
e21d3fed05
Revert "Tidy ancestor iterators"
This reverts commit 5079c25bb2.

Accidental push to master.. my bad!
2019-08-05 16:27:55 +10:00
Paul Hauner
5079c25bb2
Tidy ancestor iterators 2019-08-05 16:25:21 +10:00
Michael Sproul
a236003a7b Update to frozen spec ❄️ (v0.8.1) (#444)
* types: first updates for v0.8

* state_processing: epoch processing v0.8.0

* state_processing: block processing v0.8.0

* tree_hash_derive: support generics in SignedRoot

* types v0.8: update to use ssz_types

* state_processing v0.8: use ssz_types

* ssz_types: add bitwise methods and from_elem

* types: fix v0.8 FIXMEs

* ssz_types: add bitfield shift_up

* ssz_types: iterators and DerefMut for VariableList

* types,state_processing: use VariableList

* ssz_types: fix BitVector Decode impl

Fixed a typo in the implementation of ssz::Decode for BitVector, which caused it
to be considered variable length!

* types: fix test modules for v0.8 update

* types: remove slow type-level arithmetic

* state_processing: fix tests for v0.8

* op_pool: update for v0.8

* ssz_types: Bitfield difference length-independent

Allow computing the difference of two bitfields of different lengths.

* Implement compact committee support

* epoch_processing: committee & active index roots

* state_processing: genesis state builder v0.8

* state_processing: implement v0.8.1

* Further improve tree_hash

* Strip examples, tests from cached_tree_hash

* Update TreeHash, un-impl CachedTreeHash

* Update bitfield TreeHash, un-impl CachedTreeHash

* Update FixedLenVec TreeHash, unimpl CachedTreeHash

* Update update tree_hash_derive for new TreeHash

* Fix TreeHash, un-impl CachedTreeHash for ssz_types

* Remove fixed_len_vec, ssz benches

SSZ benches relied upon fixed_len_vec -- it is easier to just delete
them and rebuild them later (when necessary)

* Remove boolean_bitfield crate

* Fix fake_crypto BLS compile errors

* Update ef_tests for new v.8 type params

* Update ef_tests submodule to v0.8.1 tag

* Make fixes to support parsing ssz ef_tests

* `compact_committee...` to `compact_committees...`

* Derive more traits for `CompactCommittee`

* Flip bitfield byte-endianness

* Fix tree_hash for bitfields

* Modify CLI output for ef_tests

* Bump ssz crate version

* Update ssz_types doc comment

* Del cached tree hash tests from ssz_static tests

* Tidy SSZ dependencies

* Rename ssz_types crate to eth2_ssz_types

* validator_client: update for v0.8

* ssz_types: update union/difference for bit order swap

* beacon_node: update for v0.8, EthSpec

* types: disable cached tree hash, update min spec

* state_processing: fix slot bug in committee update

* tests: temporarily disable fork choice harness test

See #447

* committee cache: prevent out-of-bounds access

In the case where we tried to access the committee of a shard that didn't have a committee in the
current epoch, we were accessing elements beyond the end of the shuffling vector and panicking! This
commit adds a check to make the failure safe and explicit.

* fix bug in get_indexed_attestation and simplify

There was a bug in our implementation of get_indexed_attestation whereby
incorrect "committee indices" were used to index into the custody bitfield. The
bug was only observable in the case where some bits of the custody bitfield were
set to 1. The implementation has been simplified to remove the bug, and a test
added.

* state_proc: workaround for compact committees bug

https://github.com/ethereum/eth2.0-specs/issues/1315

* v0.8: updates to make the EF tests pass

* Remove redundant max operation checks.
* Always supply both messages when checking attestation signatures -- allowing
  verification of an attestation with no signatures.
* Swap the order of the fork and domain constant in `get_domain`, to match
  the spec.

* rustfmt

* ef_tests: add new epoch processing tests

* Integrate v0.8 into master (compiles)

* Remove unused crates, fix clippy lints

* Replace v0.6.3 tags w/ v0.8.1

* Remove old comment

* Ensure lmd ghost tests only run in release

* Update readme
2019-07-30 12:44:51 +10:00
Paul Hauner
177df12149
Testnet stability (#451)
* Change reduced tree for adding weightless node

* Add more comments for reduced tree fork choice

* Small refactor on reduced tree for readability

* Move test_harness forking logic into itself

* Add new `AncestorIter` trait to store

* Add unfinished tests to fork choice

* Make `beacon_state.genesis_block_root` public

* Add failing lmd_ghost fork choice tests

* Extend fork_choice tests, create failing test

* Implement Debug for generic ReducedTree

* Add lazy_static to fork choice tests

* Add verify_integrity fn to reduced tree

* Fix bugs in reduced tree

* Ensure all reduced tree tests verify integrity

* Slightly alter reduce tree test params

* Add (failing) reduced tree test

* Fix bug in fork choice

Iter ancestors was not working well with skip slots

* Put maximum depth for common ancestor search

Ensures that we don't search back past the finalized root.

* Add basic finalization tests for reduced tree

* Change fork choice to use beacon_block_root

Previously it was using target_root, which was wrong

* Change reduced tree for adding weightless node

* Add more comments for reduced tree fork choice

* Small refactor on reduced tree for readability

* Move test_harness forking logic into itself

* Add new `AncestorIter` trait to store

* Add unfinished tests to fork choice

* Make `beacon_state.genesis_block_root` public

* Add failing lmd_ghost fork choice tests

* Extend fork_choice tests, create failing test

* Implement Debug for generic ReducedTree

* Add lazy_static to fork choice tests

* Add verify_integrity fn to reduced tree

* Fix bugs in reduced tree

* Ensure all reduced tree tests verify integrity

* Slightly alter reduce tree test params

* Add (failing) reduced tree test

* Fix bug in fork choice

Iter ancestors was not working well with skip slots

* Put maximum depth for common ancestor search

Ensures that we don't search back past the finalized root.

* Add basic finalization tests for reduced tree

* Add network dir CLI flag

* Simplify "NewSlot" log message

* Rename network-dir CLI flag

* Change fork choice to use beacon_block_root

Previously it was using target_root, which was wrong

* Update db dir size for metrics

* Change slog to use `FullFormat` logging

* Update some comments and log formatting

* Add prom gauge for best block root

* Only add known target blocks to fork choice

* Add finalized and justified root prom metrics

* Add CLI flag for setting log level

* Add logger to beacon chain

* Add debug-level CLI flag to validator

* Allow block processing if fork choice fails

* Create warn log when there's low libp2p peer count

* Minor change to logging

* Make ancestor iter return option

* Disable fork choice test when !debug_assertions

* Fix type, removed code fragment

* Tidy some borrow-checker evading

* Lower reduced tree random test iterations
2019-07-29 13:45:45 +10:00
Paul Hauner
7458022fcf
Fork choice bug fixes (#449)
* Change reduced tree for adding weightless node

* Add more comments for reduced tree fork choice

* Small refactor on reduced tree for readability

* Move test_harness forking logic into itself

* Add new `AncestorIter` trait to store

* Add unfinished tests to fork choice

* Make `beacon_state.genesis_block_root` public

* Add failing lmd_ghost fork choice tests

* Extend fork_choice tests, create failing test

* Implement Debug for generic ReducedTree

* Add lazy_static to fork choice tests

* Add verify_integrity fn to reduced tree

* Fix bugs in reduced tree

* Ensure all reduced tree tests verify integrity

* Slightly alter reduce tree test params

* Add (failing) reduced tree test

* Fix bug in fork choice

Iter ancestors was not working well with skip slots

* Put maximum depth for common ancestor search

Ensures that we don't search back past the finalized root.

* Add basic finalization tests for reduced tree

* Change fork choice to use beacon_block_root

Previously it was using target_root, which was wrong

* Make ancestor iter return option

* Disable fork choice test when !debug_assertions

* Fix type, removed code fragment

* Tidy some borrow-checker evading

* Lower reduced tree random test iterations
2019-07-29 12:08:52 +10:00
Pawan Dhananjay
db094022b9 Remove unused dependencies (#456) 2019-07-29 09:55:57 +10:00
John Adler
fec7168512
Fix lots of typos. 2019-07-26 15:26:06 -04:00
Grant Wuerker
51645aa9af
Correct process_attestation error handling. 2019-07-24 18:03:48 +02:00
Grant Wuerker
b2471eca49
Checking if the an attestation contains a latest message 2019-07-23 20:50:18 +02:00
Grant Wuerker
bef7ca6bfb
Cleaned up get_attestation_state 2019-07-20 12:49:41 +02:00
Grant Wuerker
7cdfa3cc27
Looser check on beacon state validity. 2019-07-19 14:52:01 +02:00
Grant Wuerker
b90edaf7f6
Merge branch 'master' into process-free-attestation 2019-07-18 12:33:22 +02:00
Kirk Baird
0513559252 Fix syncing bugs by recursively attempting to process parents in the … (#429)
* Fix syncing bugs by recursively attempting to process parents in the import queue, change BlockRootsIterator

* Swap from crossbeam channel to tokio mpsc

* Recursion fix

* Remove exess block processing

* Fix network lag, correct attestation topic

* Correct network poll logic

* Overhaul of SimpleSync and modify BlockRootsIterator to return start_slot

* Fix bug in tests relating to StateRootsIterator

* Remove old, commented-out heartbeat code.

* Tidy docs on import queue enum

* Change source logging msg in simple sync

* Rename function parameter in simple sync

* Use `BestBlockRootsIterator` in `reduced_tree`

* Update comments for `BestBlockRootsIterator`

* Fix duplicate dep in cargo.toml
2019-07-16 17:28:15 +10:00
Grant Wuerker
40b166edcd
Retrieving state from store and checking signature 2019-07-11 16:32:01 +02:00
Grant Wuerker
adf1d9c533
Processing attestation in fork choice 2019-07-09 12:36:59 +02:00
Grant Wuerker
e23726c0a1
Renamed fork_choice::process_attestation_from_block 2019-07-09 12:36:26 +02:00
Paul Hauner
027f0a539d
Prepare ssz for publishing on crates.io 2019-07-03 16:06:20 +10:00
Michael Sproul
73c4171b52
op_pool: finish persistence support 2019-07-01 10:55:55 +10:00
Michael Sproul
7fe458af45
op_pool: re-jig deposit handling (needs more work) 2019-07-01 10:55:55 +10:00
Michael Sproul
604fe2d97f
op_pool: partial persistence support 2019-07-01 10:55:55 +10:00
Paul Hauner
8afe8b3569
Implement fixes from PR review 2019-06-24 15:31:36 +10:00
Paul Hauner
8e13237b7f
Only perform beacon chain tests on release 2019-06-24 09:34:56 +10:00
Paul Hauner
77fba0b98e
Fix bugs in fork choice, add more tests 2019-06-24 09:34:56 +10:00
Paul Hauner
f8fb011d6c
Finish fork test for beacon chain 2019-06-24 09:34:55 +10:00
Paul Hauner
8ed03e391d
Allow harness to produce fork blocks 2019-06-24 09:34:55 +10:00
Paul Hauner
e904e0a5a8
Fix bug in operations for block production 2019-06-24 09:34:55 +10:00
Paul Hauner
fbb40485c1
Add additional chain tests 2019-06-24 09:34:55 +10:00
Paul Hauner
299b4cb207
Document beacon chain harness 2019-06-24 09:34:55 +10:00
Paul Hauner
723283bd01
Add attestation strategy to chain harness 2019-06-24 09:34:55 +10:00
Paul Hauner
46c0e17682
Add arbitrary attestation for beacon chain harness 2019-06-24 09:34:55 +10:00
Paul Hauner
7a4c3e26ac
Fix bug in reduced tree fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
0b2ad4d0a1
Mark reduced_tree fork choice as incomplete 2019-06-24 09:34:54 +10:00
Paul Hauner
d0037f49d8
Add progress on debugging fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
85b23f9f1b
Add incomplete progress on fork choice 2019-06-24 09:34:54 +10:00
Paul Hauner
41a36da765
Update BeaconChain tests 2019-06-24 09:34:54 +10:00
Paul Hauner
55818e285a
Refactor block prod. to produce for forks 2019-06-24 09:34:53 +10:00
Paul Hauner
55196dff64
Remove iter mod from beacon chain
Now the iter mod in store is the only implementation
2019-06-24 09:34:53 +10:00
Paul Hauner
c6e24572c7
Improve chain harness tests 2019-06-24 09:34:53 +10:00
Paul Hauner
9c2bbb6c05
Add stubbed-out block processing to fork choice 2019-06-24 09:34:52 +10:00
Paul Hauner
f6c86d0f7f
Add attestations to beacon chain harness 2019-06-24 09:34:52 +10:00
Paul Hauner
1638a7aa62
Alias zero hash to genesis in find head 2019-06-24 09:34:52 +10:00
Paul Hauner
8fb6ffffe2
Add new beacon chain test harness 2019-06-24 09:34:52 +10:00
Paul Hauner
1128de535d
Ignore attestations to zero hash 2019-06-24 09:34:52 +10:00
Paul Hauner
f4621a9f1a
Improve reduced tree fork choice 2019-06-24 09:34:52 +10:00
Paul Hauner
7756a658a7
Update fork choice find head fn 2019-06-24 09:34:51 +10:00
Paul Hauner
2ee71aa808
Add new fork choice struct to beacon chain 2019-06-24 09:34:51 +10:00
Paul Hauner
4c0724fba6
Refactor block processing results, some sync logic 2019-06-12 23:54:16 -04:00
Paul Hauner
e550c0218f
Add various fixes to clippy lints
Thou shalt appease clippy
2019-06-10 11:01:25 -04:00
Paul Hauner
749f2fcb5f
Unify EthSpecs in Mainnet and Minimal 2019-06-08 08:49:04 -04:00
Paul Hauner
e74d49fc8a
Remove dupe info between ChainSpec and EthSpec 2019-06-08 07:57:25 -04:00
Paul Hauner
4cecf05198
Fix beacon chain block iters 2019-06-07 02:48:26 -04:00
Paul Hauner
591c8ae219
Reject re-processing the genesis block 2019-06-07 02:48:08 -04:00
Paul Hauner
f52d66a136
Fix bug in rev block iter 2019-06-06 00:31:18 -04:00
Paul Hauner
ed9f655877
Update BeaconChain iters 2019-06-06 00:28:36 -04:00
Paul Hauner
df366f99dc
Add block iter to beacon chain 2019-06-05 13:33:32 +10:00
Paul Hauner
8ab1d28c9f
Fix attestation processing metrics 2019-06-04 17:10:25 +10:00
Paul Hauner
f530f5a848
Ensure committees are built for block processing 2019-06-04 13:13:38 +10:00
Paul Hauner
82202a7765
Update components to suit v0.6.1 API 2019-06-04 09:37:40 +10:00
Paul Hauner
39cb63e01e
Merge branch 'v0.6.1' into docker-env 2019-06-04 09:25:00 +10:00
Michael Sproul
6bde64bd6a
spec v0.6: update beacon_node, validator_client 2019-06-03 16:13:51 +10:00
Paul Hauner
e310bdd904
Merge branch 'master' into v0.6.1 2019-06-02 13:49:24 +10:00
Paul Hauner
997095fc43
Add attestations per block metric 2019-06-01 15:29:13 +10:00
Paul Hauner
244ffbc604
Store genesis root in beacon chain, fix fork bug 2019-06-01 15:02:19 +10:00
Paul Hauner
c8ba44b0b5
Create db-level alias for genesis block 2019-06-01 12:56:35 +10:00
Paul Hauner
8831db1e0f
Fix recently introduced errors for gRPC block prod 2019-06-01 12:36:10 +10:00
Paul Hauner
08bf5817c9
Update fork choice to take just. head 2019-05-31 17:51:32 +10:00
Paul Hauner
2f9f8bf772
Tidy BeaconChain; del spec, unify head updates 2019-05-31 17:32:20 +10:00
Paul Hauner
8acffcc0db
Make some BeaconChain functions private 2019-05-30 18:38:41 +10:00
Paul Hauner
4851d8be03
Fix some metrics labels 2019-05-29 18:09:51 +10:00
Paul Hauner
42b6e0c8a9
Run fork-choice after every block import 2019-05-29 17:55:38 +10:00
Paul Hauner
9f1039a350
Add metrics to BeaconChain, tidy fork choice 2019-05-29 17:52:43 +10:00
Paul Hauner
64fbc6bf3c
Add additional metrics to BeaconChain 2019-05-29 15:45:09 +10:00
Paul Hauner
345f7d5f18
Add global metrics registry, pass to BeaconState 2019-05-28 17:30:09 +10:00
Paul Hauner
b28fa3d20b
Save the BeaconChain to store on state update 2019-05-27 17:58:15 +10:00
Paul Hauner
faa682a9b5
Implement saving BeaconChain on client drop 2019-05-27 17:58:15 +10:00
Paul Hauner
9ed8a4d380
Implement basic BeaconChain persistence. 2019-05-27 17:58:15 +10:00
Paul Hauner
76602a65fc
Add new fns to ForkChoice and SlotClock 2019-05-27 17:58:15 +10:00
Paul Hauner
ee8d13573f
Create BeaconChainTypes, thread through runtime 2019-05-26 15:59:29 +10:00
Paul Hauner
3bcf5ba706
Rename db crate to store 2019-05-21 18:20:23 +10:00
Paul Hauner
058829b64d
Update beacon_chain to latest DB 2019-05-21 17:27:06 +10:00
Paul Hauner
f1584dada4
Update BeaconChain struct to use new store 2019-05-21 13:36:14 +10:00
Paul Hauner
658b425cce
Merge branch 'master' into disk-db 2019-05-20 16:56:04 +10:00
Paul Hauner
6660311b2b
Rename EpochCache to CommitteeCache 2019-05-20 14:36:54 +10:00
Paul Hauner
fcabef91da
Use E for EthSpec trait, instead of B 2019-05-13 14:44:43 +10:00
Paul Hauner
ce8ebeccbc
Rename BeaconStateTypes to EthSpec 2019-05-10 14:47:09 +10:00
Paul Hauner
2a938f2fd5
Fix clippy lints 2019-05-09 13:35:00 +10:00
Paul Hauner
49c92ef167
Remove attester, block_producer & test_harness 2019-05-09 11:48:14 +10:00
Paul Hauner
51dc97ee42
Allow fork_choice and beacon_chain to compile 2019-05-08 18:18:17 +10:00
Paul Hauner
05df7702d3
Merge branch 'master' into disk-db 2019-04-30 16:02:23 +10:00
Paul Hauner
a76b24e274
Disable running docs example for test harness 2019-04-25 12:25:01 +10:00
Paul Hauner
2527252248
Merge branch 'master' into 0.5.1-tests 2019-04-17 21:21:07 +10:00
Michael Sproul
32547373e5
spec: simplify cache_state
The `latest_block_root` input argument was unnecessary as we were always setting it to something
almost equivalent to `state.latest_block_root` anyway, and more importantly, it was messing up the
caching of the state root. Previously it was possible for the function to update the state's latest
block root, and then hash the outdated block root that was passed in as an argument.
2019-04-17 12:00:23 +10:00
Paul Hauner
f69b56ad60
Add new tree_hash crate project wide. 2019-04-16 14:25:43 +10:00
Paul Hauner
b8c4c3308a
Update types to new tree_hash crate 2019-04-16 14:14:38 +10:00
Paul Hauner
89bc15f77e
Move some long-running tests to release-only 2019-04-15 09:59:35 +10:00
Paul Hauner
1913be0c6f
Fix clippy lints 2019-04-03 16:23:09 +11:00
Paul Hauner
08b1808745
Modify runtime to allow memory or disk db
DiskDB is not working yet, but we'll get there!
2019-03-31 18:57:48 +11:00
Age Manning
f03259991d
Merge remote-tracking branch 'origin/paul-gossip-test' into validator-enhancements 2019-03-31 15:37:23 +11:00