Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
use crate ::behaviour ::{ Behaviour , BehaviourEvent } ;
2020-04-07 15:08:05 +00:00
use crate ::discovery ::enr ;
2019-03-08 01:15:57 +00:00
use crate ::multiaddr ::Protocol ;
2020-04-01 06:20:32 +00:00
use crate ::types ::{ error , GossipKind } ;
2020-05-17 11:16:48 +00:00
use crate ::EnrExt ;
2020-04-07 15:08:05 +00:00
use crate ::{ NetworkConfig , NetworkGlobals } ;
2019-03-07 05:17:06 +00:00
use futures ::prelude ::* ;
use libp2p ::core ::{
2020-03-02 02:35:20 +00:00
identity ::Keypair ,
multiaddr ::Multiaddr ,
muxing ::StreamMuxerBox ,
transport ::boxed ::Boxed ,
upgrade ::{ InboundUpgradeExt , OutboundUpgradeExt } ,
ConnectedPoint ,
2019-03-07 05:17:06 +00:00
} ;
2020-05-17 11:16:48 +00:00
use libp2p ::{
core , noise , secio ,
swarm ::{ NetworkBehaviour , SwarmBuilder , SwarmEvent } ,
PeerId , Swarm , Transport ,
} ;
2020-05-18 11:35:14 +00:00
use slog ::{ crit , debug , info , o , trace , warn } ;
2019-07-01 06:38:42 +00:00
use std ::fs ::File ;
use std ::io ::prelude ::* ;
2019-03-07 05:17:06 +00:00
use std ::io ::{ Error , ErrorKind } ;
2020-05-17 11:16:48 +00:00
use std ::pin ::Pin ;
2020-02-19 11:12:25 +00:00
use std ::sync ::Arc ;
2019-03-07 05:17:06 +00:00
use std ::time ::Duration ;
2020-05-17 11:16:48 +00:00
use tokio ::time ::DelayQueue ;
2020-03-25 11:18:06 +00:00
use types ::{ EnrForkId , EthSpec } ;
2019-03-04 07:31:01 +00:00
2020-04-19 02:20:43 +00:00
pub const NETWORK_KEY_FILENAME : & str = " key " ;
2019-11-29 02:04:44 +00:00
/// The time in milliseconds to wait before banning a peer. This allows for any Goodbye messages to be
/// flushed and protocols to be negotiated.
2019-12-06 03:13:43 +00:00
const BAN_PEER_WAIT_TIMEOUT : u64 = 200 ;
2020-05-17 11:16:48 +00:00
/// The maximum simultaneous libp2p connections per peer.
const MAX_CONNECTIONS_PER_PEER : usize = 1 ;
/// The types of events than can be obtained from polling the libp2p service.
///
/// This is a subset of the events that a libp2p swarm emits.
#[ derive(Debug) ]
pub enum Libp2pEvent < TSpec : EthSpec > {
/// A behaviour event
Behaviour ( BehaviourEvent < TSpec > ) ,
/// A new listening address has been established.
NewListenAddr ( Multiaddr ) ,
/// A peer has established at least one connection.
PeerConnected {
/// The peer that connected.
peer_id : PeerId ,
/// Whether the peer was a dialer or listener.
endpoint : ConnectedPoint ,
} ,
/// A peer no longer has any connections, i.e is disconnected.
PeerDisconnected {
/// The peer the disconnected.
peer_id : PeerId ,
/// Whether the peer was a dialer or a listener.
endpoint : ConnectedPoint ,
} ,
}
2019-07-01 06:38:42 +00:00
2019-03-04 07:31:01 +00:00
/// The configuration and state of the libp2p components for the beacon node.
Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
pub struct Service < TSpec : EthSpec > {
2019-03-07 00:43:55 +00:00
/// The libp2p Swarm handler.
2019-03-12 06:28:11 +00:00
//TODO: Make this private
2020-05-17 11:16:48 +00:00
pub swarm : Swarm < Behaviour < TSpec > > ,
2019-11-27 01:47:46 +00:00
2019-03-06 12:31:08 +00:00
/// This node's PeerId.
2019-08-23 05:53:53 +00:00
pub local_peer_id : PeerId ,
2019-11-27 01:47:46 +00:00
2020-05-17 11:16:48 +00:00
/// Used for managing the state of peers.
network_globals : Arc < NetworkGlobals < TSpec > > ,
2019-11-29 02:04:44 +00:00
/// A current list of peers to ban after a given timeout.
2019-12-06 03:13:43 +00:00
peers_to_ban : DelayQueue < PeerId > ,
/// A list of timeouts after which peers become unbanned.
peer_ban_timeout : DelayQueue < PeerId > ,
2019-11-29 02:04:44 +00:00
2019-03-12 06:28:11 +00:00
/// The libp2p logger handle.
pub log : slog ::Logger ,
2019-03-06 12:31:08 +00:00
}
2019-03-04 07:31:01 +00:00
Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
impl < TSpec : EthSpec > Service < TSpec > {
2020-02-19 11:12:25 +00:00
pub fn new (
2020-06-04 11:48:05 +00:00
executor : environment ::TaskExecutor ,
2020-02-19 11:12:25 +00:00
config : & NetworkConfig ,
2020-03-25 11:18:06 +00:00
enr_fork_id : EnrForkId ,
2020-05-17 11:16:48 +00:00
log : & slog ::Logger ,
Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
) -> error ::Result < ( Arc < NetworkGlobals < TSpec > > , Self ) > {
2020-05-17 11:16:48 +00:00
let log = log . new ( o! ( " service " = > " libp2p " ) ) ;
2019-08-29 11:23:28 +00:00
trace! ( log , " Libp2p Service starting " ) ;
2019-03-06 12:31:08 +00:00
2020-04-07 15:08:05 +00:00
// initialise the node's ID
2019-09-10 16:13:54 +00:00
let local_keypair = if let Some ( hex_bytes ) = & config . secret_key_hex {
keypair_from_hex ( hex_bytes ) ?
} else {
2020-02-19 11:12:25 +00:00
load_private_key ( config , & log )
2019-09-10 16:13:54 +00:00
} ;
2020-04-07 15:08:05 +00:00
// Create an ENR or load from disk if appropriate
let enr =
enr ::build_or_load_enr ::< TSpec > ( local_keypair . clone ( ) , config , enr_fork_id , & log ) ? ;
2019-03-06 12:31:08 +00:00
2020-04-07 15:08:05 +00:00
let local_peer_id = enr . peer_id ( ) ;
2020-02-19 11:12:25 +00:00
// set up a collection of variables accessible outside of the network crate
Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
let network_globals = Arc ::new ( NetworkGlobals ::new (
2020-04-07 15:08:05 +00:00
enr . clone ( ) ,
Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
config . libp2p_port ,
config . discovery_port ,
2020-04-07 15:08:05 +00:00
& log ,
Initial work towards v0.2.0 (#924)
* Remove ping protocol
* Initial renaming of network services
* Correct rebasing relative to latest master
* Start updating types
* Adds HashMapDelay struct to utils
* Initial network restructure
* Network restructure. Adds new types for v0.2.0
* Removes build artefacts
* Shift validation to beacon chain
* Temporarily remove gossip validation
This is to be updated to match current optimisation efforts.
* Adds AggregateAndProof
* Begin rebuilding pubsub encoding/decoding
* Signature hacking
* Shift gossipsup decoding into eth2_libp2p
* Existing EF tests passing with fake_crypto
* Shifts block encoding/decoding into RPC
* Delete outdated API spec
* All release tests passing bar genesis state parsing
* Update and test YamlConfig
* Update to spec v0.10 compatible BLS
* Updates to BLS EF tests
* Add EF test for AggregateVerify
And delete unused hash2curve tests for uncompressed points
* Update EF tests to v0.10.1
* Use optional block root correctly in block proc
* Use genesis fork in deposit domain. All tests pass
* Fast aggregate verify test
* Update REST API docs
* Fix unused import
* Bump spec tags to v0.10.1
* Add `seconds_per_eth1_block` to chainspec
* Update to timestamp based eth1 voting scheme
* Return None from `get_votes_to_consider` if block cache is empty
* Handle overflows in `is_candidate_block`
* Revert to failing tests
* Fix eth1 data sets test
* Choose default vote according to spec
* Fix collect_valid_votes tests
* Fix `get_votes_to_consider` to choose all eligible blocks
* Uncomment winning_vote tests
* Add comments; remove unused code
* Reduce seconds_per_eth1_block for simulation
* Addressed review comments
* Add test for default vote case
* Fix logs
* Remove unused functions
* Meter default eth1 votes
* Fix comments
* Progress on attestation service
* Address review comments; remove unused dependency
* Initial work on removing libp2p lock
* Add LRU caches to store (rollup)
* Update attestation validation for DB changes (WIP)
* Initial version of should_forward_block
* Scaffold
* Progress on attestation validation
Also, consolidate prod+testing slot clocks so that they share much
of the same implementation and can both handle sub-slot time changes.
* Removes lock from libp2p service
* Completed network lock removal
* Finish(?) attestation processing
* Correct network termination future
* Add slot check to block check
* Correct fmt issues
* Remove Drop implementation for network service
* Add first attempt at attestation proc. re-write
* Add version 2 of attestation processing
* Minor fixes
* Add validator pubkey cache
* Make get_indexed_attestation take a committee
* Link signature processing into new attn verification
* First working version
* Ensure pubkey cache is updated
* Add more metrics, slight optimizations
* Clone committee cache during attestation processing
* Update shuffling cache during block processing
* Remove old commented-out code
* Fix shuffling cache insert bug
* Used indexed attestation in fork choice
* Restructure attn processing, add metrics
* Add more detailed metrics
* Tidy, fix failing tests
* Fix failing tests, tidy
* Address reviewers suggestions
* Disable/delete two outdated tests
* Modification of validator for subscriptions
* Add slot signing to validator client
* Further progress on validation subscription
* Adds necessary validator subscription functionality
* Add new Pubkeys struct to signature_sets
* Refactor with functional approach
* Update beacon chain
* Clean up validator <-> beacon node http types
* Add aggregator status to ValidatorDuty
* Impl Clone for manual slot clock
* Fix minor errors
* Further progress validator client subscription
* Initial subscription and aggregation handling
* Remove decompressed member from pubkey bytes
* Progress to modifying val client for attestation aggregation
* First draft of validator client upgrade for aggregate attestations
* Add hashmap for indices lookup
* Add state cache, remove store cache
* Only build the head committee cache
* Removes lock on a network channel
* Partially implement beacon node subscription http api
* Correct compilation issues
* Change `get_attesting_indices` to use Vec
* Fix failing test
* Partial implementation of timer
* Adds timer, removes exit_future, http api to op pool
* Partial multiple aggregate attestation handling
* Permits bulk messages accross gossipsub network channel
* Correct compile issues
* Improve gosispsub messaging and correct rest api helpers
* Added global gossipsub subscriptions
* Update validator subscriptions data structs
* Tidy
* Re-structure validator subscriptions
* Initial handling of subscriptions
* Re-structure network service
* Add pubkey cache persistence file
* Add more comments
* Integrate persistence file into builder
* Add pubkey cache tests
* Add HashSetDelay and introduce into attestation service
* Handles validator subscriptions
* Add data_dir to beacon chain builder
* Remove Option in pubkey cache persistence file
* Ensure consistency between datadir/data_dir
* Fix failing network test
* Peer subnet discovery gets queued for future subscriptions
* Reorganise attestation service functions
* Initial wiring of attestation service
* First draft of attestation service timing logic
* Correct minor typos
* Tidy
* Fix todos
* Improve tests
* Add PeerInfo to connected peers mapping
* Fix compile error
* Fix compile error from merge
* Split up block processing metrics
* Tidy
* Refactor get_pubkey_from_state
* Remove commented-out code
* Rename state_cache -> checkpoint_cache
* Rename Checkpoint -> Snapshot
* Tidy, add comments
* Tidy up find_head function
* Change some checkpoint -> snapshot
* Add tests
* Expose max_len
* Remove dead code
* Tidy
* Fix bug
* Add sync-speed metric
* Add first attempt at VerifiableBlock
* Start integrating into beacon chain
* Integrate VerifiableBlock
* Rename VerifableBlock -> PartialBlockVerification
* Add start of typed methods
* Add progress
* Add further progress
* Rename structs
* Add full block verification to block_processing.rs
* Further beacon chain integration
* Update checks for gossip
* Add todo
* Start adding segement verification
* Add passing chain segement test
* Initial integration with batch sync
* Minor changes
* Tidy, add more error checking
* Start adding chain_segment tests
* Finish invalid signature tests
* Include single and gossip verified blocks in tests
* Add gossip verification tests
* Start adding docs
* Finish adding comments to block_processing.rs
* Rename block_processing.rs -> block_verification
* Start removing old block processing code
* Fixes beacon_chain compilation
* Fix project-wide compile errors
* Remove old code
* Correct code to pass all tests
* Fix bug with beacon proposer index
* Fix shim for BlockProcessingError
* Only process one epoch at a time
* Fix loop in chain segment processing
* Correct tests from master merge
* Add caching for state.eth1_data_votes
* Add BeaconChain::validator_pubkey
* Revert "Add caching for state.eth1_data_votes"
This reverts commit cd73dcd6434fb8d8e6bf30c5356355598ea7b78e.
Co-authored-by: Grant Wuerker <gwuerker@gmail.com>
Co-authored-by: Michael Sproul <michael@sigmaprime.io>
Co-authored-by: Michael Sproul <micsproul@gmail.com>
Co-authored-by: pawan <pawandhananjay@gmail.com>
Co-authored-by: Paul Hauner <paul@paulhauner.com>
2020-03-17 06:24:44 +00:00
) ) ;
2020-02-19 11:12:25 +00:00
2020-04-07 15:08:05 +00:00
info! ( log , " Libp2p Service " ; " peer_id " = > format! ( " {:?} " , enr . peer_id ( ) ) ) ;
2020-04-14 05:29:29 +00:00
debug! ( log , " Attempting to open listening ports " ; " address " = > format! ( " {} " , config . listen_address ) , " tcp_port " = > config . libp2p_port , " udp_port " = > config . discovery_port ) ;
2020-04-07 15:08:05 +00:00
2019-03-08 00:07:30 +00:00
let mut swarm = {
2020-03-02 02:35:20 +00:00
// Set up the transport - tcp/ws with noise/secio and mplex/yamux
2020-05-17 11:16:48 +00:00
let transport = build_transport ( local_keypair . clone ( ) )
. map_err ( | e | format! ( " Failed to build transport: {:?} " , e ) ) ? ;
2019-06-25 04:51:45 +00:00
// Lighthouse network behaviour
2020-04-07 15:08:05 +00:00
let behaviour = Behaviour ::new ( & local_keypair , config , network_globals . clone ( ) , & log ) ? ;
2020-05-17 11:16:48 +00:00
// use the executor for libp2p
2020-06-04 11:48:05 +00:00
struct Executor ( environment ::TaskExecutor ) ;
2020-05-17 11:16:48 +00:00
impl libp2p ::core ::Executor for Executor {
fn exec ( & self , f : Pin < Box < dyn Future < Output = ( ) > + Send > > ) {
2020-06-04 11:48:05 +00:00
self . 0. spawn ( f , " libp2p " ) ;
2020-05-17 11:16:48 +00:00
}
}
SwarmBuilder ::new ( transport , behaviour , local_peer_id . clone ( ) )
. peer_connection_limit ( MAX_CONNECTIONS_PER_PEER )
2020-06-04 11:48:05 +00:00
. executor ( Box ::new ( Executor ( executor ) ) )
2020-05-17 11:16:48 +00:00
. build ( )
2019-03-08 00:07:30 +00:00
} ;
2019-03-06 12:31:08 +00:00
2019-06-25 08:02:11 +00:00
// listen on the specified address
let listen_multiaddr = {
let mut m = Multiaddr ::from ( config . listen_address ) ;
m . push ( Protocol ::Tcp ( config . libp2p_port ) ) ;
m
} ;
match Swarm ::listen_on ( & mut swarm , listen_multiaddr . clone ( ) ) {
Ok ( _ ) = > {
let mut log_address = listen_multiaddr ;
log_address . push ( Protocol ::P2p ( local_peer_id . clone ( ) . into ( ) ) ) ;
2019-08-29 11:23:28 +00:00
info! ( log , " Listening established " ; " address " = > format! ( " {} " , log_address ) ) ;
2019-06-25 08:02:11 +00:00
}
2019-08-23 05:53:53 +00:00
Err ( err ) = > {
crit! (
log ,
" Unable to listen on libp2p address " ;
" error " = > format! ( " {:?} " , err ) ,
" listen_multiaddr " = > format! ( " {} " , listen_multiaddr ) ,
) ;
return Err ( " Libp2p was unable to listen on the given listen address. " . into ( ) ) ;
}
2019-06-25 08:02:11 +00:00
} ;
2019-03-06 12:31:08 +00:00
2019-09-02 21:50:44 +00:00
// helper closure for dialing peers
2020-02-19 11:12:25 +00:00
let mut dial_addr = | multiaddr : & Multiaddr | {
2019-08-10 01:44:17 +00:00
match Swarm ::dial_addr ( & mut swarm , multiaddr . clone ( ) ) {
2019-08-29 11:23:28 +00:00
Ok ( ( ) ) = > debug! ( log , " Dialing libp2p peer " ; " address " = > format! ( " {} " , multiaddr ) ) ,
2019-08-10 01:44:17 +00:00
Err ( err ) = > debug! (
log ,
2019-09-02 14:34:41 +00:00
" Could not connect to peer " ; " address " = > format! ( " {} " , multiaddr ) , " error " = > format! ( " {:?} " , err )
2019-08-10 01:44:17 +00:00
) ,
} ;
2019-09-02 21:50:44 +00:00
} ;
// attempt to connect to user-input libp2p nodes
2020-02-19 11:12:25 +00:00
for multiaddr in & config . libp2p_nodes {
2019-09-02 21:50:44 +00:00
dial_addr ( multiaddr ) ;
}
// attempt to connect to any specified boot-nodes
2020-05-17 11:16:48 +00:00
let mut boot_nodes = config . boot_nodes . clone ( ) ;
boot_nodes . dedup ( ) ;
for bootnode_enr in boot_nodes {
2020-02-19 11:12:25 +00:00
for multiaddr in & bootnode_enr . multiaddr ( ) {
2019-09-04 22:07:57 +00:00
// ignore udp multiaddr if it exists
let components = multiaddr . iter ( ) . collect ::< Vec < _ > > ( ) ;
if let Protocol ::Udp ( _ ) = components [ 1 ] {
continue ;
}
2020-05-17 11:16:48 +00:00
if ! network_globals
2020-04-21 14:29:19 +00:00
. peers
2020-05-17 11:16:48 +00:00
. read ( )
. is_connected_or_dialing ( & bootnode_enr . peer_id ( ) )
{
dial_addr ( multiaddr ) ;
}
2019-09-02 21:50:44 +00:00
}
2019-08-10 01:44:17 +00:00
}
2020-04-01 06:20:32 +00:00
let mut subscribed_topics : Vec < GossipKind > = vec! [ ] ;
for topic_kind in & config . topics {
if swarm . subscribe_kind ( topic_kind . clone ( ) ) {
subscribed_topics . push ( topic_kind . clone ( ) ) ;
2019-03-19 12:20:39 +00:00
} else {
2020-04-01 06:20:32 +00:00
warn! ( log , " Could not subscribe to topic " ; " topic " = > format! ( " {} " , topic_kind ) ) ;
2019-03-19 12:20:39 +00:00
}
2019-03-13 04:37:44 +00:00
}
2019-12-20 05:26:30 +00:00
info! ( log , " Subscribed to topics " ; " topics " = > format! ( " {:?} " , subscribed_topics ) ) ;
2019-03-13 04:37:44 +00:00
2020-02-19 11:12:25 +00:00
let service = Service {
2019-08-23 05:53:53 +00:00
local_peer_id ,
2019-03-07 00:43:55 +00:00
swarm ,
2020-05-17 11:16:48 +00:00
network_globals : network_globals . clone ( ) ,
2019-12-06 03:13:43 +00:00
peers_to_ban : DelayQueue ::new ( ) ,
peer_ban_timeout : DelayQueue ::new ( ) ,
2019-03-12 06:28:11 +00:00
log ,
2020-02-19 11:12:25 +00:00
} ;
Ok ( ( network_globals , service ) )
2019-03-12 06:28:11 +00:00
}
2019-11-29 02:04:44 +00:00
2019-12-06 03:13:43 +00:00
/// Adds a peer to be banned for a period of time, specified by a timeout.
pub fn disconnect_and_ban_peer ( & mut self , peer_id : PeerId , timeout : Duration ) {
2020-05-18 11:35:14 +00:00
warn! ( self . log , " Disconnecting and banning peer " ; " peer_id " = > peer_id . to_string ( ) , " timeout " = > format! ( " {:?} " , timeout ) ) ;
2019-12-06 03:13:43 +00:00
self . peers_to_ban . insert (
peer_id . clone ( ) ,
Duration ::from_millis ( BAN_PEER_WAIT_TIMEOUT ) ,
) ;
self . peer_ban_timeout . insert ( peer_id , timeout ) ;
2019-11-29 02:04:44 +00:00
}
2019-03-12 06:28:11 +00:00
2020-05-17 11:16:48 +00:00
pub async fn next_event ( & mut self ) -> Libp2pEvent < TSpec > {
2019-03-12 06:28:11 +00:00
loop {
2020-05-17 11:16:48 +00:00
tokio ::select! {
event = self . swarm . next_event ( ) = > {
match event {
SwarmEvent ::Behaviour ( behaviour ) = > {
return Libp2pEvent ::Behaviour ( behaviour )
}
SwarmEvent ::ConnectionEstablished {
peer_id ,
endpoint ,
num_established ,
} = > {
debug! ( self . log , " Connection established " ; " peer_id " = > peer_id . to_string ( ) , " connections " = > num_established . get ( ) ) ;
// if this is the first connection inform the network layer a new connection
// has been established and update the db
if num_established . get ( ) = = 1 {
// update the peerdb
match endpoint {
ConnectedPoint ::Listener { .. } = > {
self . swarm . peer_manager ( ) . connect_ingoing ( & peer_id ) ;
}
ConnectedPoint ::Dialer { .. } = > self
. network_globals
. peers
. write ( )
. connect_outgoing ( & peer_id ) ,
}
return Libp2pEvent ::PeerConnected { peer_id , endpoint } ;
}
}
SwarmEvent ::ConnectionClosed {
peer_id ,
cause ,
endpoint ,
num_established ,
} = > {
debug! ( self . log , " Connection closed " ; " peer_id " = > peer_id . to_string ( ) , " cause " = > cause . to_string ( ) , " connections " = > num_established ) ;
if num_established = = 0 {
// update the peer_db
self . swarm . peer_manager ( ) . notify_disconnect ( & peer_id ) ;
// the peer has disconnected
return Libp2pEvent ::PeerDisconnected {
peer_id ,
endpoint ,
} ;
}
}
SwarmEvent ::NewListenAddr ( multiaddr ) = > {
return Libp2pEvent ::NewListenAddr ( multiaddr )
}
2019-12-06 03:13:43 +00:00
2020-05-17 11:16:48 +00:00
SwarmEvent ::IncomingConnection {
local_addr ,
send_back_addr ,
} = > {
debug! ( self . log , " Incoming connection " ; " our_addr " = > local_addr . to_string ( ) , " from " = > send_back_addr . to_string ( ) )
}
SwarmEvent ::IncomingConnectionError {
local_addr ,
send_back_addr ,
error ,
} = > {
debug! ( self . log , " Failed incoming connection " ; " our_addr " = > local_addr . to_string ( ) , " from " = > send_back_addr . to_string ( ) , " error " = > error . to_string ( ) )
}
SwarmEvent ::BannedPeer {
peer_id ,
endpoint : _ ,
} = > {
debug! ( self . log , " Attempted to dial a banned peer " ; " peer_id " = > peer_id . to_string ( ) )
}
SwarmEvent ::UnreachableAddr {
peer_id ,
address ,
error ,
attempts_remaining ,
} = > {
debug! ( self . log , " Failed to dial address " ; " peer_id " = > peer_id . to_string ( ) , " address " = > address . to_string ( ) , " error " = > error . to_string ( ) , " attempts_remaining " = > attempts_remaining ) ;
self . swarm . peer_manager ( ) . notify_disconnect ( & peer_id ) ;
}
SwarmEvent ::UnknownPeerUnreachableAddr { address , error } = > {
debug! ( self . log , " Peer not known at dialed address " ; " address " = > address . to_string ( ) , " error " = > error . to_string ( ) ) ;
}
SwarmEvent ::ExpiredListenAddr ( multiaddr ) = > {
debug! ( self . log , " Listen address expired " ; " multiaddr " = > multiaddr . to_string ( ) )
}
SwarmEvent ::ListenerClosed { addresses , reason } = > {
debug! ( self . log , " Listener closed " ; " addresses " = > format! ( " {:?} " , addresses ) , " reason " = > format! ( " {:?} " , reason ) )
}
SwarmEvent ::ListenerError { error } = > {
debug! ( self . log , " Listener error " ; " error " = > format! ( " {:?} " , error . to_string ( ) ) )
}
SwarmEvent ::Dialing ( peer_id ) = > {
debug! ( self . log , " Dialing peer " ; " peer " = > peer_id . to_string ( ) ) ;
self . swarm . peer_manager ( ) . dialing_peer ( & peer_id ) ;
}
2019-12-06 03:13:43 +00:00
}
}
2020-05-17 11:16:48 +00:00
Some ( Ok ( peer_to_ban ) ) = self . peers_to_ban . next ( ) = > {
let peer_id = peer_to_ban . into_inner ( ) ;
Swarm ::ban_peer_id ( & mut self . swarm , peer_id . clone ( ) ) ;
// TODO: Correctly notify protocols of the disconnect
// TODO: Also remove peer from the DHT: https://github.com/sigp/lighthouse/issues/629
self . swarm . inject_disconnected ( & peer_id ) ;
// inform the behaviour that the peer has been banned
self . swarm . peer_banned ( peer_id ) ;
}
Some ( Ok ( peer_to_unban ) ) = self . peer_ban_timeout . next ( ) = > {
debug! ( self . log , " Peer has been unbanned " ; " peer " = > format! ( " {:?} " , peer_to_unban ) ) ;
let unban_peer = peer_to_unban . into_inner ( ) ;
self . swarm . peer_unbanned ( & unban_peer ) ;
Swarm ::unban_peer_id ( & mut self . swarm , unban_peer ) ;
}
2019-12-06 03:13:43 +00:00
}
}
2019-03-04 07:31:01 +00:00
}
}
2019-03-06 12:31:08 +00:00
2020-03-02 02:35:20 +00:00
/// The implementation supports TCP/IP, WebSockets over TCP/IP, noise/secio as the encryption layer, and
2019-03-06 12:31:08 +00:00
/// mplex or yamux as the multiplexing layer.
2020-05-17 11:16:48 +00:00
fn build_transport (
local_private_key : Keypair ,
) -> Result < Boxed < ( PeerId , StreamMuxerBox ) , Error > , Error > {
let transport = libp2p_tcp ::TokioTcpConfig ::new ( ) . nodelay ( true ) ;
let transport = libp2p ::dns ::DnsConfig ::new ( transport ) ? ;
2019-03-07 05:17:06 +00:00
#[ cfg(feature = " libp2p-websocket " ) ]
let transport = {
let trans_clone = transport . clone ( ) ;
transport . or_transport ( websocket ::WsConfig ::new ( trans_clone ) )
} ;
2020-03-02 02:35:20 +00:00
// Authentication
let transport = transport
. and_then ( move | stream , endpoint | {
let upgrade = core ::upgrade ::SelectUpgrade ::new (
generate_noise_config ( & local_private_key ) ,
secio ::SecioConfig ::new ( local_private_key ) ,
) ;
core ::upgrade ::apply ( stream , upgrade , endpoint , core ::upgrade ::Version ::V1 ) . and_then (
2020-05-17 11:16:48 +00:00
| out | async move {
2020-03-02 02:35:20 +00:00
match out {
// Noise was negotiated
core ::either ::EitherOutput ::First ( ( remote_id , out ) ) = > {
Ok ( ( core ::either ::EitherOutput ::First ( out ) , remote_id ) )
}
// Secio was negotiated
core ::either ::EitherOutput ::Second ( ( remote_id , out ) ) = > {
Ok ( ( core ::either ::EitherOutput ::Second ( out ) , remote_id ) )
}
}
} ,
)
} )
. timeout ( Duration ::from_secs ( 20 ) ) ;
// Multiplexing
let transport = transport
. and_then ( move | ( stream , peer_id ) , endpoint | {
let peer_id2 = peer_id . clone ( ) ;
let upgrade = core ::upgrade ::SelectUpgrade ::new (
libp2p ::yamux ::Config ::default ( ) ,
libp2p ::mplex ::MplexConfig ::new ( ) ,
)
. map_inbound ( move | muxer | ( peer_id , muxer ) )
. map_outbound ( move | muxer | ( peer_id2 , muxer ) ) ;
core ::upgrade ::apply ( stream , upgrade , endpoint , core ::upgrade ::Version ::V1 )
2020-05-17 11:16:48 +00:00
. map_ok ( | ( id , muxer ) | ( id , core ::muxing ::StreamMuxerBox ::new ( muxer ) ) )
2020-03-02 02:35:20 +00:00
} )
2019-10-30 01:22:18 +00:00
. timeout ( Duration ::from_secs ( 20 ) )
2019-03-07 05:17:06 +00:00
. map_err ( | err | Error ::new ( ErrorKind ::Other , err ) )
2020-03-02 02:35:20 +00:00
. boxed ( ) ;
2020-05-17 11:16:48 +00:00
Ok ( transport )
2019-03-07 00:43:55 +00:00
}
2019-03-12 06:28:11 +00:00
2019-09-10 16:13:54 +00:00
fn keypair_from_hex ( hex_bytes : & str ) -> error ::Result < Keypair > {
let hex_bytes = if hex_bytes . starts_with ( " 0x " ) {
hex_bytes [ 2 .. ] . to_string ( )
} else {
hex_bytes . to_string ( )
} ;
hex ::decode ( & hex_bytes )
. map_err ( | e | format! ( " Failed to parse p2p secret key bytes: {:?} " , e ) . into ( ) )
. and_then ( keypair_from_bytes )
}
fn keypair_from_bytes ( mut bytes : Vec < u8 > ) -> error ::Result < Keypair > {
libp2p ::core ::identity ::secp256k1 ::SecretKey ::from_bytes ( & mut bytes )
. map ( | secret | {
let keypair : libp2p ::core ::identity ::secp256k1 ::Keypair = secret . into ( ) ;
Keypair ::Secp256k1 ( keypair )
} )
. map_err ( | e | format! ( " Unable to parse p2p secret key: {:?} " , e ) . into ( ) )
}
2019-07-01 06:38:42 +00:00
/// Loads a private key from disk. If this fails, a new key is
/// generated and is then saved to disk.
///
/// Currently only secp256k1 keys are allowed, as these are the only keys supported by discv5.
fn load_private_key ( config : & NetworkConfig , log : & slog ::Logger ) -> Keypair {
// TODO: Currently using secp256k1 keypairs - currently required for discv5
// check for key from disk
let network_key_f = config . network_dir . join ( NETWORK_KEY_FILENAME ) ;
if let Ok ( mut network_key_file ) = File ::open ( network_key_f . clone ( ) ) {
let mut key_bytes : Vec < u8 > = Vec ::with_capacity ( 36 ) ;
match network_key_file . read_to_end ( & mut key_bytes ) {
Err ( _ ) = > debug! ( log , " Could not read network key file " ) ,
Ok ( _ ) = > {
// only accept secp256k1 keys for now
if let Ok ( secret_key ) =
libp2p ::core ::identity ::secp256k1 ::SecretKey ::from_bytes ( & mut key_bytes )
{
let kp : libp2p ::core ::identity ::secp256k1 ::Keypair = secret_key . into ( ) ;
debug! ( log , " Loaded network key from disk. " ) ;
return Keypair ::Secp256k1 ( kp ) ;
} else {
debug! ( log , " Network key file is not a valid secp256k1 key " ) ;
}
}
}
}
// if a key could not be loaded from disk, generate a new one and save it
let local_private_key = Keypair ::generate_secp256k1 ( ) ;
if let Keypair ::Secp256k1 ( key ) = local_private_key . clone ( ) {
let _ = std ::fs ::create_dir_all ( & config . network_dir ) ;
match File ::create ( network_key_f . clone ( ) )
. and_then ( | mut f | f . write_all ( & key . secret ( ) . to_bytes ( ) ) )
{
Ok ( _ ) = > {
debug! ( log , " New network key generated and written to disk " ) ;
}
Err ( e ) = > {
warn! (
log ,
2019-08-29 11:23:28 +00:00
" Could not write node key to file: {:?}. error: {} " , network_key_f , e
2019-07-01 06:38:42 +00:00
) ;
}
}
}
local_private_key
}
2020-03-02 02:35:20 +00:00
/// Generate authenticated XX Noise config from identity keys
fn generate_noise_config (
identity_keypair : & Keypair ,
2020-05-29 02:03:30 +00:00
) -> noise ::NoiseAuthenticated < noise ::XX , noise ::X25519Spec , ( ) > {
let static_dh_keys = noise ::Keypair ::< noise ::X25519Spec > ::new ( )
2020-03-02 02:35:20 +00:00
. into_authentic ( identity_keypair )
. expect ( " signing can fail only once during starting a node " ) ;
noise ::NoiseConfig ::xx ( static_dh_keys ) . into_authenticated ( )
}