Commit Graph

198 Commits

Author SHA1 Message Date
Age Manning
e7ab89a783
Adds gossipsub object validation and verification 2019-09-05 02:06:39 +10:00
Age Manning
13b5df56b3
Account manager, bootnodes, RPC display and sync fixes 2019-09-03 07:50:44 +10:00
Age Manning
cd7b6da88e
Updates syncing, corrects CLI variables 2019-09-03 00:34:41 +10:00
Age Manning
c1614b110b
Merge interop branch 2019-09-02 05:45:00 +10:00
Age Manning
192380cb58
Ethereum 2.0 Network Specification Upgrade (#510)
Updates lighthouse to the latest networking spec

-  Sync re-write (#496)
-  Updates to the latest eth2 networking spec (#495)
-  Libp2p updates and improvements
2019-08-29 13:23:28 +02:00
Age Manning
1bea1755c4
Remove redundant code 2019-08-25 10:13:17 +10:00
Age Manning
9cdcc7d198
Update to latest libp2p 2019-08-25 10:02:54 +10:00
Age Manning
72cf50d904
Update to latest master 2019-08-25 09:06:26 +10:00
Age Manning
7ee080db60
Updated syncing algorithm 2019-08-25 08:25:54 +10:00
Age Manning
0d56df474a
Main batch sync debugging 2019-08-25 00:27:47 +10:00
Paul Hauner
0c3fdcd57c
Bootstrap (#501)
* Renamed fork_choice::process_attestation_from_block

* Processing attestation in fork choice

* Retrieving state from store and checking signature

* Looser check on beacon state validity.

* Cleaned up get_attestation_state

* Expanded fork choice api to provide latest validator message.

* Checking if the an attestation contains a latest message

* Correct process_attestation error handling.

* Copy paste error in comment fixed.

* Tidy ancestor iterators

* Getting attestation slot via helper method

* Refactored attestation creation in test utils

* Revert "Refactored attestation creation in test utils"

This reverts commit 4d277fe4239a7194758b18fb5c00dfe0b8231306.

* Integration tests for free attestation processing

* Implicit conflicts resolved.

* formatting

* Do first pass on Grants code

* Add another attestation processing test

* Tidy attestation processing

* Remove old code fragment

* Add non-compiling half finished changes

* Simplify, fix bugs, add tests for chain iters

* Remove attestation processing from op pool

* Fix bug with fork choice, tidy

* Fix overly restrictive check in fork choice.

* Ensure committee cache is build during attn proc

* Ignore unknown blocks at fork choice

* Various minor fixes

* Make fork choice write lock in to read lock

* Remove unused method

* Tidy comments

* Fix attestation prod. target roots change

* Fix compile error in store iters

* Reject any attestation prior to finalization

* Begin metrics refactor

* Move beacon_chain to new metrics structure.

* Make metrics not panic if already defined

* Use global prometheus gather at rest api

* Unify common metric fns into a crate

* Add heavy metering to block processing

* Remove hypen from prometheus metric name

* Add more beacon chain metrics

* Add beacon chain persistence metric

* Prune op pool on finalization

* Add extra prom beacon chain metrics

* Prefix BeaconChain metrics with "beacon_"

* Add more store metrics

* Add basic metrics to libp2p

* Add metrics to HTTP server

* Remove old `http_server` crate

* Update metrics names to be more like standard

* Fix broken beacon chain metrics, add slot clock metrics

* Add lighthouse_metrics gather fn

* Remove http args

* Fix wrong state given to op pool prune

* Make prom metric names more consistent

* Add more metrics, tidy existing metrics

* Fix store block read metrics

* Tidy attestation metrics

* Fix minor PR comments

* Fix minor PR comments

* Remove duplicated attestation finalization check

* Remove awkward `let` statement

* Add first attempts at HTTP bootstrap

* Add beacon_block methods to rest api

* Fix serde for block.body.grafitti

* Allow travis failures on beta (see desc)

There's a non-backward compatible change in `cargo fmt`. Stable and beta
do not agree.

* Add network routes to API

* Fix rustc warnings

* Add best_slot method

* Add --bootstrap arg to beacon node

* Get bootstrapper working for ENR address

* Store intermediate states during block processing

* Allow bootstrapper to scrape libp2p address

* Update bootstrapper libp2p address finding

* Add comments

* Tidy API to be more consistent with recent decisions

* Address some review comments

* Make BeaconChainTypes Send + Sync + 'static

* Add `/network/listen_port` API endpoint

* Abandon starting the node if libp2p doesn't start

* Update bootstrapper for API changes

* Remove unnecessary trait bounds
2019-08-23 15:53:53 +10:00
Paul Hauner
c4ced3e0d2
Fix block processing blowup, upgrade metrics (#500)
* Renamed fork_choice::process_attestation_from_block

* Processing attestation in fork choice

* Retrieving state from store and checking signature

* Looser check on beacon state validity.

* Cleaned up get_attestation_state

* Expanded fork choice api to provide latest validator message.

* Checking if the an attestation contains a latest message

* Correct process_attestation error handling.

* Copy paste error in comment fixed.

* Tidy ancestor iterators

* Getting attestation slot via helper method

* Refactored attestation creation in test utils

* Revert "Refactored attestation creation in test utils"

This reverts commit 4d277fe4239a7194758b18fb5c00dfe0b8231306.

* Integration tests for free attestation processing

* Implicit conflicts resolved.

* formatting

* Do first pass on Grants code

* Add another attestation processing test

* Tidy attestation processing

* Remove old code fragment

* Add non-compiling half finished changes

* Simplify, fix bugs, add tests for chain iters

* Remove attestation processing from op pool

* Fix bug with fork choice, tidy

* Fix overly restrictive check in fork choice.

* Ensure committee cache is build during attn proc

* Ignore unknown blocks at fork choice

* Various minor fixes

* Make fork choice write lock in to read lock

* Remove unused method

* Tidy comments

* Fix attestation prod. target roots change

* Fix compile error in store iters

* Reject any attestation prior to finalization

* Begin metrics refactor

* Move beacon_chain to new metrics structure.

* Make metrics not panic if already defined

* Use global prometheus gather at rest api

* Unify common metric fns into a crate

* Add heavy metering to block processing

* Remove hypen from prometheus metric name

* Add more beacon chain metrics

* Add beacon chain persistence metric

* Prune op pool on finalization

* Add extra prom beacon chain metrics

* Prefix BeaconChain metrics with "beacon_"

* Add more store metrics

* Add basic metrics to libp2p

* Add metrics to HTTP server

* Remove old `http_server` crate

* Update metrics names to be more like standard

* Fix broken beacon chain metrics, add slot clock metrics

* Add lighthouse_metrics gather fn

* Remove http args

* Fix wrong state given to op pool prune

* Make prom metric names more consistent

* Add more metrics, tidy existing metrics

* Fix store block read metrics

* Tidy attestation metrics

* Fix minor PR comments

* Allow travis failures on beta (see desc)

There's a non-backward compatible change in `cargo fmt`. Stable and beta
do not agree.

* Tidy `lighthouse_metrics` docs

* Fix typo
2019-08-19 21:02:34 +10:00
Age Manning
af5372fde4
Merge latest master 2019-08-12 22:24:20 +10:00
Age Manning
5d4d2f35e1
Initial sync re-write. WIP 2019-08-12 22:07:59 +10:00
Age Manning
468015f9bb Initial Interop Updates (#492)
* Add interop chain spec and rename chain_id

* Add ability to connect to raw libp2p nodes

* Adds Identify protocol, clean up RPC protocol name handling

* Update to latest libp2p, gossipsub improvements

* Updates to latest interop branch.

- Shifts decoding of objects into message handler.
- Updates to latest interop gossipsub.
- Adds interop spec constant.

* Configuration updates allow for verbosity CLI flag and spec constants

* Update submodules to master

* Correct minimal chainspec modifications

* Duplication of validator polls are no longer fatal

* Apply PR suggestions
2019-08-10 11:44:17 +10:00
Age Manning
ec73dfe90b
Starting of req/resp overhaul 2019-08-09 13:27:31 +10:00
Age Manning
5a74239ebc
Add decoding/encoding for extended gossip topics. Correct logging CLI 2019-08-09 13:27:31 +10:00
Age Manning
80f15f5d70
Correct gossipsub message encoding. Add extended topics 2019-08-09 13:27:31 +10:00
Age Manning
d83fa67068
Subscribe to all required gossipsub topics 2019-08-09 13:27:31 +10:00
Age Manning
ce50616032
Improve logging 2019-08-09 13:27:30 +10:00
Age Manning
3210489a36
Apply PR suggestions 2019-08-09 13:23:47 +10:00
Age Manning
826abea8e0
Merge latest 'master' 2019-08-09 10:46:49 +10:00
Paul Hauner
8cfa36fedd
Publish ssz_types (and deps) to crates.io (#468)
* Rename `hashing` crate to `eth2_hashing`

* Add license, desc to eth2_hashing Cargo.toml

* Remove merkle root from eth2 hashing

* Remove old benches folder (zombied from old branch)

* Add docs to eth2_hashing

* Prepare tree_hash for publishing on crates.io

* Update deps to use crates.io instead of paths

* Update all crates to pull ssz from crates.io

* Remove cached_tree_hash, add patches to manifest

* Fix compile error in benches

* Remove unused code

* Fix fake_crypto compile error
2019-08-08 11:39:47 +10:00
Age Manning
107bbdcccd
Updates to latest interop branch.
- Shifts decoding of objects into message handler.
- Updates to latest interop gossipsub.
- Adds interop spec constant.
2019-08-06 17:54:38 +10:00
Age Manning
0613bc16fc
Update to latest libp2p, gossipsub improvements 2019-08-06 15:46:19 +10:00
Age Manning
04ce9ec95e
Adds Identify protocol, clean up RPC protocol name handling 2019-08-06 15:46:16 +10:00
Age Manning
15c4062761
Add ability to connect to raw libp2p nodes 2019-08-06 15:35:54 +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
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
Age Manning
b5af73d056
Merge pull request #441 from sigp/rpc-update
RPC Rewrite
2019-07-24 20:08:16 +10:00
Age Manning
ae96325c81
Allows Libp2p service to be read outside network thread 2019-07-24 17:45:31 +10:00
Age Manning
7d38cba252
Remove encoding error and redundant code 2019-07-24 15:17:44 +10:00
Age Manning
89ff7fb6b8
Complete initial testing of new RPC 2019-07-23 22:45:42 +10:00
Age Manning
b350a78fec
Update RPC. WIP 2019-07-22 14:13:18 +10:00
b-m-f
e9671084af
Saves ENR to disk on every address update
Signed-off-by: b-m-f <max@ehlers.berlin>
2019-07-18 16:48:04 +01:00
Age Manning
b2a1b20e24
Merge latest master 2019-07-16 23:26:31 +10:00
Age Manning
414d41cb57
Shift changes into message handler and simple sync for rpc-rewrite 2019-07-16 22:32:37 +10: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
Age Manning
704263e35f
Clean up Protocol types 2019-07-15 18:41:05 +10:00
Age Manning
15c99b5f37
RPC Update. WIP 2019-07-15 17:07:23 +10:00
Age Manning
15cdd2afb9
Initial codec module 2019-07-13 18:57:18 +10:00
Age Manning
d84780a339
Initial base codec 2019-07-13 18:35:33 +10:00
Age Manning
0292679f27
Improved error handling. Switching to codecs for easier encoding support 2019-07-11 15:11:31 +10:00
Age Manning
4a84b2f7cc
Improved RPC handling. WIP 2019-07-09 15:44:23 +10:00
Age Manning
bb0e28b8e3
Improved rpc protocols handler. WIP 2019-07-06 23:43:44 +10:00
Age Manning
f1127e4e0d
Initial addition of an RPC Protocol Handler 2019-07-06 21:32:32 +10:00
Age Manning
cda61c1577
Adds basic inbound/outbound upgrades for eth2 rpc 2019-07-05 18:59:53 +10:00
Age Manning
746935fa41
Initial sub-protocol implementation 2019-07-04 15:26:02 +10:00
Age Manning
1aeec12b78
Improve error handling of default directory 2019-07-04 14:14:27 +10:00
Age Manning
dd410535cb
Remove Phase 1 TODO 2019-07-04 14:14:27 +10:00
Age Manning
bffe6c327f
Removes left-over debugging statements 2019-07-04 14:14:27 +10:00
Age Manning
177daf2609
Typo fixes 2019-07-04 14:14:27 +10:00
Age Manning
af28d5e20c
Add persistent network identification 2019-07-04 14:14:27 +10:00
Age Manning
7dc5e2f959
Update to latest libp2p 2019-07-04 14:14:27 +10:00
Age Manning
0952a36a21
Initial integration of discovery v5 2019-07-04 14:14:27 +10:00
Age Manning
44c9058477
Integrate discv5 into lighthouse 2019-07-04 14:14:27 +10:00
Age Manning
6ee2b4df34
Complete merging of network addition branch 2019-07-04 14:14:26 +10:00
Age Manning
c7e17c8641
Updates for latest master 2019-07-04 14:14:26 +10:00
Age Manning
43135484ca
Update to lastest libp2p 2019-07-04 14:13:43 +10:00
Age Manning
b33ce5dd10
Initial core grouping of libp2p behaviours 2019-07-04 14:13:43 +10:00
Age Manning
cb7d5eba1c
Discovery and gossip bug fixes 2019-07-04 14:12:06 +10:00
Age Manning
f80c34b74f
Builds on discovery. Adds identify to discovery 2019-07-04 14:11:17 +10:00
Age Manning
e36fa3152d
Adds verbosity cli flag 2019-07-04 14:11:17 +10:00
Age Manning
a38f4c4cd1
Adds Kademlia for peer discovery 2019-07-04 14:08:48 +10:00
Age Manning
be6ebb5ffa
Add custom inactivity timeout to gossipsub 2019-07-04 14:08:48 +10:00
Age Manning
2d710f19fc
Update to latest libp2p 2019-07-04 14:08:48 +10:00
Age Manning
7920f8098f
Complete moving network logc into beacon node 2019-07-04 14:07:26 +10:00
Age Manning
64abd0bc5b
Removes network parameters from chain spec 2019-07-04 14:07:26 +10:00
Age Manning
4e24c8e651
Add topics to chain id 2019-07-04 14:07:26 +10:00
Paul Hauner
027f0a539d
Prepare ssz for publishing on crates.io 2019-07-03 16:06:20 +10:00
Age Manning
76371659e9
Improve error handling of default directory 2019-07-02 17:32:14 +10:00
Age Manning
6c18b417c3
Remove Phase 1 TODO 2019-07-02 11:15:35 +10:00
Age Manning
1f62221235
Removes left-over debugging statements 2019-07-01 17:23:14 +10:00
Age Manning
f8e20d8027
Typo fixes 2019-07-01 16:40:35 +10:00
Age Manning
5521c53d36
Add persistent network identification 2019-07-01 16:38:42 +10:00
Age Manning
955574f469
Update to latest libp2p 2019-06-25 18:57:11 +10:00
Age Manning
a64a6c7d3a
Initial integration of discovery v5 2019-06-25 18:02:50 +10:00
Age Manning
81f0b6c238
Integrate discv5 into lighthouse 2019-06-25 18:02:50 +10:00
Age Manning
84ea5adffe
Complete merging of network addition branch 2019-06-25 18:02:50 +10:00
Age Manning
cf459b60a9
Updates for latest master 2019-06-25 18:02:50 +10:00
Age Manning
fc8dc6dfa7
Update to lastest libp2p 2019-06-25 18:02:50 +10:00
Age Manning
f7c2e4c5af
Initial core grouping of libp2p behaviours 2019-06-25 18:02:50 +10:00
Age Manning
75959cc9a2
Discovery and gossip bug fixes 2019-06-25 18:02:50 +10:00
Age Manning
25f37ad967
Builds on discovery. Adds identify to discovery 2019-06-25 18:02:50 +10:00
Age Manning
ad1438db53
Adds verbosity cli flag 2019-06-25 18:02:49 +10:00
Age Manning
8d5d228270
Adds Kademlia for peer discovery 2019-06-25 18:02:49 +10:00
Age Manning
dea6ac7923
Add custom inactivity timeout to gossipsub 2019-06-25 18:02:49 +10:00
Age Manning
7ad9805f02
Update to latest libp2p 2019-06-25 18:02:49 +10:00
Age Manning
c1d609902a
Complete moving network logc into beacon node 2019-06-25 18:02:49 +10:00
Age Manning
dd3a4f0b43
Removes network parameters from chain spec 2019-06-25 18:02:49 +10:00
Age Manning
e9181e120c
Add topics to chain id 2019-06-25 18:02:48 +10:00
Paul Hauner
25e93f60fd
Tidy comments 2019-06-17 10:01:23 -04:00
Paul Hauner
059699736b
Return errors instead of panic in libp2p 2019-06-10 21:37:41 -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
e73a31c37f
Refactor ClientConfig, add serde to it 2019-06-07 19:44:27 -04:00
Paul Hauner
4cecf05198
Fix beacon chain block iters 2019-06-07 02:48:26 -04:00