Commit Graph

118 Commits

Author SHA1 Message Date
Matthias Seitz
ed55c2bf2b docs(net): update best_unconnected docs (#670) 2023-01-01 17:16:30 +02:00
LambdaClass
1f6a9436ac feat(net): enforce trusted_nodes_only setting (#660)
* Add PeerKind and enforce trusted_only setting

* Don't remove trusted peer on graceful close

* Don't remove trusted nodes on PeerCommand::Remove

* Rename PeerKind::NonTrusted to Basic

* Move PeerKind::is_trusted to Peer impl

* Add trusted peer prioritization
2023-01-01 12:14:10 +01:00
GeemoCandama
f5ae970e63 feat(cli): add --disable-discovery (#597)
* redo add disable_discovery cli flag

* incorporate option into discovery test

* smol touch up

* rustmft

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-30 10:56:59 +01:00
Matthias Seitz
3ab6c278e8 fix(net): improve error propagation (#620)
* fix(net): improve error propagation

* refactor: unify on closed session

* add noop helpers

* add noop helpers

* test setup

* test: add dropped connection test

* rename mock --> test-utils
2022-12-29 16:05:56 +01:00
Ayush
de6630a121 feat(network): get peer info (#603)
* Create struct PeerInfo

* Add GetPeerInfo command

* Minor changes

* Use oneshot::sender

* Add GetPeerInfoById

* Use async/await

* Add client_id to establish connection

* Add method calls

* Add test_get_peer

* Add test_get_peer_by_id

* fmt changes

* clippy changes

* chore: rustfmt

* smol touch ups

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-29 14:20:17 +01:00
Roman Krasiuk
565a0aa90b feat(engine): new payload execution (#631)
* feat(engine): new payload execution

* address PR comments

* rm unused dev deps

* add comment about lru

* remove par_iter
2022-12-29 02:36:56 -08:00
Tomás
76e76bb651 feat: add trusted nodes configuration (#569)
* Add preferred nodes to config

* Add preferred nodes on boot

* Add flag in config for trusted only mode

* Add preferred nodes configuration to config

* Fix comment

* Add preferred nodes to config file

* Rename preferred_nodes to trusted_nodes

* Change preferred to trusted

I renamed preferred_nodes to trusted_nodes in various places.
Seems I missed quite a bit of them.

* Pull trusted_only from config

* Rename DiscoveryConfig to PeersConfig

* Fix last commit

Now actually renamed DiscoveryConfig

* Rename trusted_only to connect_trusted_nodes_only

* Add helper function

* Use HashSet for boot_nodes and trusted_nodes

* Change trusted nodes functions in ConfigBuilder

* Move trusted peers from discv4 to network config

* Add trusted nodes to peers on Manager creation

* Use NodeRecord in trusted_nodes config

* Fix comment

* Move trusted_nodes config to PeersConfig

* Add trusted nodes directly to peers

* Move network_config to Config impl

* Move start_network to NetworkConfig impl
2022-12-28 21:48:11 +01:00
Matthias Seitz
d9d0ba14c4 docs: add outgoing request diagram (#630) 2022-12-28 20:36:53 +01:00
Matthias Seitz
1ba81191f6 perf(net): backoff on IO error (#633) 2022-12-28 12:43:02 +01:00
Andrew Kirillov
d4d8a8c882 Moves code walkthrough book chapters to docs (#629)
* replaced template blocks with code blocks in stages chapter

* replaced template blocks with code blocks in network chapter

* moved book sections to docs

* fix indentation in recover_signer codeblock

* remove unnecessary TODO comment in network.md
2022-12-28 10:24:39 +01:00
Andrew Kirillov
a51fa4fd63 docs(book): start book chapter for network crate (#445)
* WIP FOR DRAFT PR

* WIP draft, walking through usage in pipeline

* diving deeper into instantiation of NetworkHandle & FetchClient

* WIP network management task & eth requests task done (ish)

* address pr comments: networkmanager as standalone task, networkconfig as main entrypoint for setup

* complete draft of the  crate docs

* restructured, starts w/ expl of

* added more snippets/anchors

* using ignore flag on code blocks, brief explanation of  struct

* typos addressed
2022-12-27 14:53:15 -08:00
Tomás
dcd3923d19 Add serde support for NodeRecord primitive type (#617)
* Add serde support to NodeRecord

* Move NodeRecord to primitives

along with NodeKey and Octets

* Reexport NodeRecord from discv4

* Move NodeKey and kad_key back to discv4::node

Also, move NodeRecord::key functionality to a helper function: discv4::node::record_key.
This avoids the discv5 dependency in the primitives crate.

* Fix NodeRecord (de)serializing

The default derive macros work with a dictionary like display.
Changed that to serde_with macros, that use Display and FromStr traits.

* Add some tests for NodeRecord (de)serializing

* Hide NodeKey struct

* Move Octets after NodeRecord

* Replace record_key with From trait

* Fix clippy error

unnecessary into()
2022-12-27 18:03:54 +01:00
Matthias Seitz
ebd686a407 refactor(net): rename and restructure wire error types (#614) 2022-12-26 16:33:59 +02:00
Matthias Seitz
8779000460 test(net): add test for dropped pending no response (#613) 2022-12-26 15:51:14 +02:00
Matthias Seitz
f1c1fb85ff fix(net): add no response to backoff check (#610) 2022-12-26 14:00:01 +02:00
Sanket Shanbhag
73e12341c4 feat(net): Make PeerManager emit peerevents for admin rpc (#602)
* Make PeerManager emit peerevents for admin rpc

* Fix tests to include new peer events
2022-12-25 10:00:10 +01:00
Matthias Seitz
5affa67805 refactor(net): unify closed incoming session handling (#600) 2022-12-24 12:38:21 +01:00
Sanket Shanbhag
43008b7b07 feat: Add PeerEvent to NetworkEvent enum (#574)
* Add peerAdded and peerRemoved events to NetworkEvent enum

* Remove unnecessary todo macros
2022-12-24 10:25:09 +01:00
Matthias Seitz
7c80dde0ec fix(net): check for handshake disconnect (#596) 2022-12-24 00:58:43 +01:00
Matthias Seitz
4e677b5993 refactor(net): unify dropped connection handling (#595) 2022-12-23 21:46:44 +01:00
Bjerg
562e895f21 ci: unused dependencies sanity check (#590)
* ci: add unused deps sanity check

* ci: fix unused deps issue template title

* ci: rename udeps job

* chore: formatting

* chore: make `cargo-udeps` ignore `aquamarine`

* deps: resolve unused deps

* ci: check every feature and target in udeps job
2022-12-23 13:19:50 +01:00
Matthias Seitz
cb58759e66 feat(net): validate discovered enr forkid (#586) 2022-12-23 12:15:07 +01:00
mempirate
e549b29cce feat(net): increase session command buffer (#585)
* refactor: unnecessary return

* feat: increase session command buffer to 32
2022-12-23 11:24:04 +01:00
Roman Krasiuk
a85793cd9b feat(rpc): basic engine api (#551)
* feat(rpc): engine api

* change transition config exchange

* payload block construction

* pull out engine api logic

* linter

* clippy

* clippy

* Apply suggestions from code review

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* import & map_err for RecvError

* move result

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-22 12:38:28 +01:00
Matthias Seitz
1400e51495 chore(net): add more active session traces (#557)
* chore(net): add more active session traces

* Update crates/net/network/src/session/active.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-21 15:44:39 +02:00
Matthias Seitz
b2abcddeda fix(net): temporarily backoff busy peers (#548)
* fix(net): temporarily backoff busy peers

* chore: rustfmt
2022-12-20 22:19:06 +01:00
Matthias Seitz
7184e4df3f fix(net): ban peer on fatal error (#543) 2022-12-20 18:04:33 +01:00
Matthias Seitz
63406d5a6d perf(net): put timeout check behind interval (#537) 2022-12-20 18:02:35 +01:00
Matthias Seitz
f5c9064b44 test(net): add e2e test for already connected (#538) 2022-12-20 18:02:16 +01:00
Matthias Seitz
7a13cf6688 feat(net): add ForkTransition type (#542) 2022-12-20 18:01:54 +01:00
Dan Cline
aab385c84a feat(eth-wire): RLP encode then compress (#535) 2022-12-20 14:33:47 +02:00
Matthias Seitz
5c1f97cbf7 test: create events handler before interacting with network mngr (#532) 2022-12-20 00:38:23 +01:00
Dan Cline
fc11443b97 feat(net): create enr to peerid helper (#533)
* set network enr dev-dep to 0.7.0 instead of git - ethers and each
   other crate uses 0.7.0 and not git
2022-12-19 18:32:19 -05:00
Dan Cline
c53b2bcccb feat(net): use NodeRecord instead of enode format (#530)
* feat(eth-wire): add timeouts to tests using Geth

* feat(net): use NodeRecord instead of enode format

 * make NodeRecord::new pub instead of pub(crate)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-19 17:57:02 -05:00
Dan Cline
ac1c0419d2 feat(eth-wire): add timeouts to tests using Geth (#529) 2022-12-19 23:35:06 +01:00
Matthias Seitz
3db7455eca fix(net): fix disconnect edge case on remove from discovery (#479)
* fix(net): fix disconnect edge case on remove from discovery

* test: add disconnect test
2022-12-19 22:27:01 +01:00
Bjerg
13bb41517d feat: config (#496)
* feat: default reth dirs

* docs: clarify txpool config docs

* feat: `serde` feature for `reth-consensus`

* feat: add missing hardforks

* feat: full chain specification

* feat: `DbPath` type

* feat: custom chain specs

* feat: `--debug.tip` option

* feat: basic stage config

* fix: resize db geometry

* refactor: don't commit in headers stage

* chore: remove headers dl timeout

* feat: loading of config

* refactor(config): `stage` -> `stages`
2022-12-19 21:27:26 +01:00
Matthias Seitz
516d744bdd test: run geth tests in serial (#527) 2022-12-19 19:12:14 +01:00
Matthias Seitz
40579bf233 test: decrease test timeout for keep alive (#523) 2022-12-19 18:03:50 +01:00
Matthias Seitz
e713b0c015 fix(net): poll after starting disconnect (#522) 2022-12-19 18:03:36 +01:00
Matthias Seitz
aac078a132 fix(net): add already connected check (#521)
* fix(net): add already connected check

* fix: get events before adding peer
2022-12-19 18:03:10 +01:00
Dan Cline
5758c297b3 fix(eth-wire): fix disconnect reason rlp decoding (#502)
* add trace in DisconnectReason Decodable impl

* add trace for decoding p2p hello

* add traces to p2p and eth stream

* refactor P2PMessage decoding

 * improve disconnect tracing

* s/Hello/first

* add geth disconnect test

* add disconnectreason test cases

* add known failing disconnect messages

* add trace when disconnect reason decoding fails

* cargo fmt

* add more examples

 * adding more as they appear in traces
 * will add the rest since they can be exhaustively enumerated

* add every other possible encoding

* fix disconnect decoding

 * the four possible formats for a disconnect message (rlp list (y/n) x
   snappy (y/n)):
   * encoded as a single rlp byte
     * with snappy
     * without snappy
   * encoded as a rlp list
     * with snappy
     * without snappy
 * fix the type for decoding in the test_decode_known_reasons test

* sort reasons by length in test

* remove printlns

* use one call to advance

* simplify decode impl to strip last byte

 * todo: comment explaining the different formats being parsed?

* explicitly remove geth as a peer

* style: traces

* add another disconnect code from geth

* fix: add check for DisconnectRequested

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-19 11:19:08 -05:00
Matthias Seitz
a5f01238b9 feat(net): allow disconnect with reason (#519) 2022-12-19 16:22:24 +01:00
Matthias Seitz
c1f124d3e3 feat(net): temporarily ban bad peers (#492)
* feat(net): temporarily ban bad peers

* use half duration interval

* Update crates/net/network/src/peers/manager.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* fix bad test

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2022-12-16 18:22:25 +01:00
Roman Krasiuk
daaf039fbf feat(sync): state transition indexes (#449)
* introduce state transitions and revert/modify block bodies table

* init refactor

* revamp transaction iteration based on bodies and add state transition mappings

* change expected return on empty db execution

* interim commit

* fix body downloader & stage

* refactor(bodies/dl): make fetch bodies fn more clear

* chore: disable unused vars/fns temporarily until exec is back

* chore: fmt

* test: fix tests

* use transitions in execution stage

* clarify empty unwind test

* remove last_tx_index fn

* rename fn and var names

* fix full block response comment

* rename fetcher`s get_block_body to get_block_bodies

* Update crates/stages/src/db.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* fmt

* fix index overlap check error

* uncomment eth chain command

* fix doc comment

* typos

* cleanup

* any_last_tx_index -> last_tx_index

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
2022-12-16 08:37:49 -08:00
Matthias Seitz
345b2c35b9 fix: apply reputation (#487)
* fix: apply reputation

* add note
2022-12-16 13:36:58 +01:00
Dan Cline
635203759b feat(discv4): support eth entries (#447)
* add ENRRequest and ENRResponse messages

 * todo: encode and decode impls

* scaffold enrrequest and enrresponse msgs

* implement encodable and decodable for enr

* cargo fmt

* impl sending enr requests

* silence clippy for now

* add todos for enrrequest and response in mocks

* make payload length fold more explicit

* feat: add enr support to ping pong

* integrate enr

* add update methods

* add enr handling

* feat: add enr handling

* integrate fork id

* fix: set frontier forkid

* disable eip868 by default

* address comments

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-16 14:14:19 +02:00
Matthias Seitz
864e6481da fix: set forkfilter correctly (#486)
* fix: set forkfilter correctly

* fix types

* update tests
2022-12-16 14:14:07 +02:00
mempirate
b1ce398dff feat(net): add Status to session established event (#473) 2022-12-15 22:37:03 +01:00
mempirate
6e577c6e5f feat(net): request peer by id through PeersHandle (#464) 2022-12-15 17:10:21 +02:00