Commit Graph

41 Commits

Author SHA1 Message Date
dab1f4f497 feat(net): add shutdown network signal (#1011)
Co-authored-by: lambdaclass-user <github@lambdaclass.com>
2023-02-04 12:28:13 -08:00
28cb91c6b4 perf(net): use qualified types for headers client future (#1115) 2023-02-01 13:12:48 +01:00
5c32ad01c9 refactor: add Peers trait und decouple rpc from NetworkHandle (#1100) 2023-01-31 10:32:45 -08:00
6b795be77f fix: increase minimum request timeout (#1078) 2023-01-30 16:10:50 +01:00
89ed9c8c41 test: print request error (#1032) 2023-01-25 04:28:33 -08:00
115e623ae6 Ability to (de)serialize NetworkConfigBuilder (#897) 2023-01-18 11:17:43 +01:00
55d1db0c1d feat(network): move test helpers to test-utils mod (#901) 2023-01-17 11:18:53 +01:00
18dbcd4e6a fix: use correct boolean conversion for direction (#870) 2023-01-13 15:50:39 +01:00
3f9e7a080a feat(net): introduce PeersInfo trait (#860) 2023-01-13 12:04:39 +01:00
ba3048ceb0 refactor: add network-api crate (#838) 2023-01-12 19:39:44 -08:00
20ee1bb1c9 refactor: move cli trace helpers to reth-tracing (#820) 2023-01-11 10:20:37 -08:00
5a58554596 test: add debug test for getting headers (#713) 2023-01-04 16:07:23 +01:00
5933014fba test(net): more txpool testing support for network (#711) 2023-01-04 14:36:51 +02:00
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
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
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
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
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
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
f5c9064b44 test(net): add e2e test for already connected (#538) 2022-12-20 18:02:16 +01:00
5c1f97cbf7 test: create events handler before interacting with network mngr (#532) 2022-12-20 00:38:23 +01:00
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
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
ac1c0419d2 feat(eth-wire): add timeouts to tests using Geth (#529) 2022-12-19 23:35:06 +01:00
516d744bdd test: run geth tests in serial (#527) 2022-12-19 19:12:14 +01:00
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
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
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
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
43f6bb9127 feat(net): integrate discovery banlist (#442)
* feat(net): integrate discovery banlist

* fix typos
2022-12-14 19:47:11 +02:00
12e7f0acbc feat(net): make Status and Hello configurable (#431)
* feat(net): make Status and Hello configurable

* set port
2022-12-14 11:39:09 +01:00
2537f14567 feat(network): add geth connection test (#352)
* wip: geth connection test

* set port until disabling discovery sets port

 * ignore test until it is complete

* check that first geth event is SessionEstablished

 * fix endpoint string for the geth instance

* force an incoming connection

 * we should also test establishing a session on an outgoing connections

* use NetworkEventStream helper in connect test

* create outgoing test

* make geth tests use different ports and datadirs

* update geth options

* cargo fmt

* s/geth_socket/reth_socket

* cargo fmt

* fix disc port collisions and re-add incoming test

 * should add test utilities for getting unused disc/p2p ports

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-13 14:29:44 -05:00
5057e8ec0a feat(p2p): refactor downloaders and add peer id to the result (#410)
* feat(p2p): refactor downloaders and add peer id to the result

* rm unused import

* fix tests

* clean up deps

* Update crates/interfaces/src/p2p/error.rs

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

* add split fn

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-13 17:14:45 +01:00
fecdc3f0f2 feat(net): add peer_id/ip blacklist (#366) 2022-12-11 02:05:07 -08:00
e014eaad33 feat(db): Refactor storage libraries (#371) 2022-12-09 23:14:07 -08:00
04105ec82b test: add mainnet connection test (#306) 2022-12-01 17:59:52 +01:00
a0c35f1f48 refactor: replace reverse with HeadersDirection (#305) 2022-12-01 17:59:33 +01:00
3355b0c605 test(net): add e2e request body test (#304)
* test(net): add e2e request body test

* test(net): add e2e request header test
2022-12-01 15:35:14 +01:00
2e3c220104 fix: fix flaky test (#250) 2022-11-24 13:26:22 -08:00
8966daad9d feat(net): reputation system and peer reporting (#239)
* refactor: move to module

* feat(net): reputation system and peer reporting

* be specific in test

* use saturating sub
2022-11-24 10:14:50 +01:00
0f45f16455 test(net): add Testnet implementation for testing (#232)
* test(net): add Testnet implementation for testing

* test(net): add testnet type and test
2022-11-22 19:33:01 -05:00