Commit Graph

56 Commits

Author SHA1 Message Date
Paul Hauner
f229bbba1c Eth1 Integration (#542)
* Refactor to cache Eth1Data

* Fix merge conflicts and minor refactorings

* Rename Eth1Cache to Eth1DataCache

* Refactor events subscription

* Add deposits module to interface with BeaconChain deposits

* Remove utils

* Rename to types.rs and add trait constraints to Eth1DataFetcher

* Confirm to trait constraints. Make Web3DataFetcher cloneable

* Make fetcher object member of deposit and eth1_data cache and other fixes
* Fix update_cache function
* Move fetch_eth1_data to impl block
* Fix deposit tests

* Create Eth1 object for interfacing with Beacon chain
* Add `run` function for running update_cache and subscribe_deposit_logs tasks
* Add logging

* Run `cargo fmt` and make tests pass

* Convert sync functions to async

* Add timeouts to web3 functions

* Return futures from cache functions

* Add failed chaining of futures

* Working cache updation

* Clean up tests and `update_cache` function

* Refactor `get_eth1_data` functions to work with future returning functions

* Refactor eth1 `run` function to work with modified `update_cache` api

* Minor changes

* Add distance parameter to `update_cache`

* Fix tests and other minor fixes

* Working integration with cache and deposits

* Add merkle_tree construction, proof generation and verification code

* Add function to construct and fetch Deposits for BeaconNode

* Add error handling

* Import ssz

* Add error handling to eth1 cache and fix minor errors

* Run rustfmt

* Fix minor bug

* Rename Eth1Error and change to Result<T>

* Change deposit fetching mechanism from notification based to poll based
* Add deposits from eth1 chain in a given range every `x` blocks
* Modify `run` function to accommodate changes
* Minor fixes

* Fix formatting

* Initial commit. web3 api working.

* Tidied up lib. Add function for fetching logs.

* Refactor with `Eth1DataFetcher` trait

* Add parsing for deposit contract logs and get_eth1_data function

* Add `get_eth1_votes` function

* Refactor to cache Eth1Data

* Fix merge conflicts and minor refactorings

* Rename Eth1Cache to Eth1DataCache

* Refactor events subscription

* Add deposits module to interface with BeaconChain deposits

* Remove utils

* Rename to types.rs and add trait constraints to Eth1DataFetcher

* Confirm to trait constraints. Make Web3DataFetcher cloneable

* Make fetcher object member of deposit and eth1_data cache and other fixes
* Fix update_cache function
* Move fetch_eth1_data to impl block
* Fix deposit tests

* Create Eth1 object for interfacing with Beacon chain
* Add `run` function for running update_cache and subscribe_deposit_logs tasks
* Add logging

* Run `cargo fmt` and make tests pass

* Convert sync functions to async

* Add timeouts to web3 functions

* Return futures from cache functions

* Add failed chaining of futures

* Working cache updation

* Clean up tests and `update_cache` function

* Refactor `get_eth1_data` functions to work with future returning functions

* Refactor eth1 `run` function to work with modified `update_cache` api

* Minor changes

* Add distance parameter to `update_cache`

* Fix tests and other minor fixes

* Working integration with cache and deposits

* Add merkle_tree construction, proof generation and verification code

* Add function to construct and fetch Deposits for BeaconNode

* Add error handling

* Import ssz

* Add error handling to eth1 cache and fix minor errors

* Run rustfmt

* Fix minor bug

* Rename Eth1Error and change to Result<T>

* Change deposit fetching mechanism from notification based to poll based
* Add deposits from eth1 chain in a given range every `x` blocks
* Modify `run` function to accommodate changes
* Minor fixes

* Fix formatting

* Fix merge issue

* Refactor with `Config` struct. Remote `ContractConfig`

* Rename eth1_chain crate to eth1

* Rename files and read abi file using `fs::read`

* Move eth1 to lib

* Remove unnecessary mutability constraint

* Add `Web3Backend` for returning actual eth1 data

* Refactor `get_eth1_votes` to return a Result

* Delete `eth1_chain` crate

* Return `Result` from `get_deposits`

* Fix range of deposits to return to beacon chain

* Add `get_block_height_by_hash` trait function

* Add naive method for getting `previous_eth1_distance`

* Add eth1 config params to main config

* Add instructions for setting up eth1 testing environment

* Add build script to fetch deposit contract abi

* Contract ABI is part of compiled binary

* Fix minor bugs

* Move docs to lib

* Add timeout to config

* Remove print statements

* Change warn to error

* Fix typos

* Removed prints in test and get timeout value from config

* Fixed error types

* Added logging to web3_fetcher

* Refactor for modified web3 api

* Fix minor stuff

* Add build script

* Tidy, hide eth1 integration tests behind flag

* Add http crate

* Add first stages of eth1_test_rig

* Fix deposits on test rig

* Fix bug with deposit count method

* Add block hash getter to http eth1

* Clean eth1 http crate and tests

* Add script to start ganache

* Adds deposit tree to eth1-http

* Extend deposit tree tests

* Tidy tests in eth1-http

* Add more detail to get block request

* Add block cache to eth1-http

* Rename deposit tree to deposit cache

* Add inital updating to eth1-http

* Tidy updater

* Fix compile bugs in tests

* Adds an Eth1DataCache builder

* Reorg eth1-http files

* Add (failing) tests for eth1 updater

* Rename files, fix bug in eth1-http

* Ensure that ganache timestamps are increasing

* Fix bugs with getting eth1data ancestors

* Improve eth1 testing, fix bugs

* Add truncate method to block cache

* Add pruning to block cache update process

* Add tests for block pruning

* Allow for dropping an expired cache.

* Add more comments

* Add first compiling version of deposit updater

* Add common fn for getting range of required blocks

* Add passing deposit update test

* Improve tests

* Fix block pruning bug

* Add tests for running two updates at once

* Add updater services to eth1

* Add deposit collection to beacon chain

* Add incomplete builder experiments

* Add first working version of beacon chain builder

* Update test harness to new beacon chain type

* Rename builder file, tidy

* Add first working client builder

* Progress further on client builder

* Update becaon node binary to use client builder

* Ensure release tests compile

* Remove old eth1 crate

* Add first pass of new lighthouse binary

* Fix websocket server startup

* Remove old binary code from beacon_node crate

* Add first working beacon node tests

* Add genesis crate, new eth1 cache_2

* Add Serivce to Eth1Cache

* Refactor with general eth1 improvements

* Add passing genesis test

* Tidy, add comments

* Add more comments to eth1 service

* Add further eth1 progress

* Fix some bugs with genesis

* Fix eth1 bugs, make eth1 linking more efficient

* Shift logic in genesis service

* Add more comments to genesis service

* Add gzip, max request values, timeouts to http

* Update testnet parameters to suit goerli testnet

* Add ability to vary Fork, fix custom spec

* Be more explicit about deposit fork version

* Start adding beacon chain eth1 option

* Add more flexibility to prod client

* Further runtime refactoring

* Allow for starting from store

* Add bootstrapping to client config

* Add remote_beacon_node crate

* Update eth1 service for more configurability

* Update eth1 tests to use less runtimes

* Patch issues with tests using too many files

* Move dummy eth1 backend flag

* Ensure all tests pass

* Add ganache-cli to Dockerfile

* Use a special docker hub image for testing

* Appease clippy

* Move validator client into lighthouse binary

* Allow starting with dummy eth1 backend

* Improve logging

* Fix dummy eth1 backend from cli

* Add extra testnet command

* Ensure consistent spec in beacon node

* Update eth1 rig to work on goerli

* Tidy lcli, start adding support for yaml config

* Add incomplete YamlConfig struct

* Remove efforts at YamlConfig

* Add incomplete eth1 voting. Blocked on spec issues

* Add (untested) first pass at eth1 vote algo

* Add tests for winning vote

* Add more tests for eth1 chain

* Add more eth1 voting tests

* Added more eth1 voting testing

* Change test name

* Add more tests to eth1 chain

* Tidy eth1 generics, add more tests

* Improve comments

* Tidy beacon_node tests

* Tidy, rename JsonRpc.. to Caching..

* Tidy voting logic

* Tidy builder docs

* Add comments, tidy eth1

* Add more comments to eth1

* Fix bug with winning_vote

* Add doc comments to the `ClientBuilder`

* Remove commented-out code

* Improve `ClientBuilder` docs

* Add comments to client config

* Add decoding test for `ClientConfig`

* Remove unused `DepositSet` struct

* Tidy `block_cache`

* Remove commented out lines

* Remove unused code in `eth1` crate

* Remove old validator binary `main.rs`

* Tidy, fix tests compile error

* Add initial tests for get_deposits

* Remove dead code in eth1_test_rig

* Update TestingDepositBuilder

* Add testing for getting eth1 deposits

* Fix duplicate rand dep

* Remove dead code

* Remove accidentally-added files

* Fix comment in eth1_genesis_service

* Add .gitignore for eth1_test_rig

* Fix bug in eth1_genesis_service

* Remove dead code from eth2_config

* Fix tabs/spaces in root Cargo.toml

* Tidy eth1 crate

* Allow for re-use of eth1 service after genesis

* Update docs for new CLI

* Change README gif

* Tidy eth1 http module

* Tidy eth1 service

* Tidy environment crate

* Remove unused file

* Tidy, add comments

* Remove commented-out code

* Address majority of Michael's comments

* Address other PR comments

* Add link to issue alongside TODO
2019-11-15 14:47:51 +11:00
Paul Hauner
97729f8654 Run cargo-fmt (#599) 2019-11-12 19:15:56 +11:00
pscott
7eb82125ef Clippy clean (#536)
* Change into_iter to iter

* Fix clippy 'easy' warnings

* Clippy eth2/utils

* Add struct NetworkInfo

* Clippy for types, utils, and beacon_node/store/src/iters.rs

* Cargo fmt

* Change foo to my_foo

* Remove complex signature

* suppress clippy warning for unit_value in benches

* Use enumerate instead of iterating over range

* Allow trivially_copy_pass_by_ref in serde_utils
2019-09-30 13:58:45 +10:00
Michael Sproul
81325a0e05 Run rustfmt 2019-09-30 11:30:47 +10: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
2a938f2fd5 Fix clippy lints 2019-05-09 13:35:00 +10:00
Age Manning
ee693fb3e3 Add committe_len to gRPC parameters 2019-03-31 00:34:35 +11:00
Age Manning
9a6ecc4665 Add clippy suggestions 2019-03-30 19:58:19 +11:00
Age Manning
145cabc427 Build validator client AttestationProducer 2019-03-30 17:56:43 +11:00
Age Manning
bb8938c564 Use AttestationDuty in epoch duties 2019-03-30 17:14:38 +11:00
Age Manning
deb0abd4a8 Restores display for validator keys 2019-03-30 14:28:42 +11:00
Age Manning
d3a6d73153 Implements Signer generic for validator client and epoch duties 2019-03-30 14:27:37 +11:00
Age Manning
ba771282fa Merges in validator client branch 2019-03-30 13:17:24 +11:00
Age Manning
9cdb7bb716 Restructure of validator client service and block producer 2019-03-29 17:28:07 +11:00
Age Manning
68b33620c2 Implement Display and clean validator output 2019-03-29 02:23:03 +11:00
Luke Anderson
6c8abd8990 Fixed merge conflict fail. 2019-03-29 00:02:41 +11:00
Luke Anderson
367fbbc1c5 Merging master, fixing conflicts. 2019-03-28 23:57:06 +11:00
Luke Anderson
87acaac8a0 Ran cargo fmt. 2019-03-28 21:01:47 +11:00
Luke Anderson
867af4bc6a Made the 'signers' an Arc, so that things compile. 2019-03-28 21:00:38 +11:00
Luke Anderson
ba71e8adca Merged age-validator-client into luke's changes on validator_client, and fixed all the merge conflicts. 2019-03-28 20:55:07 +11:00
Age Manning
2a2660ce62 Cleanup debug issues, corrects RPC server logic 2019-03-28 17:24:49 +11:00
Age Manning
cc4ccd4017 Corrects read/write race condition 2019-03-28 17:16:43 +11:00
Luke Anderson
c9e8fe53bc Merged Age's changes and ripped out heaps of now obsolete stuff in the validator client.
- Replaced most instances of PublicKey with KeyPair, since they need to be passed into each validator thread now.
 - Pulled out a bunch of FreeAttestations, and replaced with regular Attestations (as per Paul's suggestion)
 - Started generalising pubkeys to 'signers' (though they are still just Keypairs)
 - Added validator_index into a few structs where relevant
 - Removed the SlotClock and DutiesReader from the BlockProducer and Attester services, since this logic is now abstracted to the higher level process.
 - Added a Hash trait to the Keypair (rather than just pubkey) which assumes the Pubkey uniquely defines it.
2019-03-28 15:50:57 +11:00
Age Manning
d3af95d1eb Returns attestation duty for validator client processing 2019-03-27 22:41:55 +11:00
Age Manning
75195bbbf4 Implement work finding logic in validator client 2019-03-27 22:22:51 +11:00
Age Manning
a315e9da49 Rename fields in validator client EpochDuties 2019-03-27 21:36:06 +11:00
Age Manning
46181408ba Epoch duties update 2019-03-27 19:47:08 +11:00
Age Manning
bc8ec51fe5 Update EpochDuty RPC and core functionality 2019-03-27 15:41:51 +11:00
Age Manning
7c31c052f3 Temp commit - Re-building validator RPC API 2019-03-26 15:59:00 +11:00
Age Manning
ffb3d94355 Wrap the duty manager in a future for its own thread 2019-03-26 11:59:48 +11:00
Age Manning
33d0f29221 Remove old tests 2019-03-26 11:33:24 +11:00
Age Manning
a8a3f1c318 Removes duty manager service in favour of tokio timer 2019-03-25 18:03:23 +11:00
Age Manning
56d33d2e26 Basic tokio slot stream implementation 2019-03-23 11:48:36 +11:00
Paul Hauner
f9964ebd8b Update Fork struct to v0.5.0 2019-03-15 13:33:45 +11:00
Paul Hauner
db3b6cba6d Introduce Fork struct to block_producer
It's a pretty crappy solution, IMO. It shouldn't really belong in
"duties" but this gets the job done for now.
2019-03-07 13:54:56 +11:00
Paul Hauner
663d39739f Do project-wide s/epoch_length/slots_per_epoch/g 2019-03-04 17:51:54 +11:00
Feng94
7ed606eca1 Modify block_producer references in other crates where needed for compilation 2019-02-19 00:21:23 +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
5c1d0dcea5 Fix various clippy lints 2019-02-13 07:32:31 +11:00
Paul Hauner
85450ec254 Fix all compile errors from new Slot/Epoch types 2019-02-07 11:22:48 +11:00
Paul Hauner
36ee4aa81f Fix file naming inconsistencies.
File names should be the same as the struct that they contain.
2019-02-05 16:53:44 +11:00
Paul Hauner
ea523c8658 Merge spec crate into types 2019-01-25 13:52:21 +11:00
Paul Hauner
9c86c07eea Fix unused deps warnings 2019-01-25 13:05:11 +11:00
Paul Hauner
19417efa63 Fix compile errors from block_producer upgrades 2019-01-25 13:03:17 +11:00
Paul Hauner
188434aaa0 Move block_propser -> eth/, impl for val client 2019-01-23 21:41:47 +11:00
Paul Hauner
8e935f93bc Replace EpochDutiesMap with trait in BlockProducer 2019-01-23 21:01:46 +11:00
Paul Hauner
14dfc3223a Add doc comments for validator service. 2019-01-22 12:38:11 +11:00
Paul Hauner
992f2101c2 Add short ID to logging for BLS public keys 2019-01-22 09:05:34 +11:00