Commit Graph

78 Commits

Author SHA1 Message Date
75ebfcf0d6 chore: add RLP encoding support for IpAddr (#659)
* Add rlp encoding support for IpAddr

* Lock support behind std feature

* Replace Octets with IpAddr

* Derive Rlp traits for NodeEndpoint

* Derive Rlp traits for NodeRecord
2022-12-29 22:27:51 +01:00
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
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
525f28a67d feat(net): integrate external public ip auto discovery (#632)
* feat(net): integrate external public ip auto discovery

* Update crates/net/discv4/src/config.rs

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

* rename var

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-28 16:14:07 +01: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
c2ad7b1b06 chore(disc): unify duration settings and naming (#539) 2022-12-20 13:35:22 +01:00
3df86187d1 chore(deps): remove discv5 fork dep (#536)
* chore(deps): remove discv5 fork dep

* bump deps
2022-12-20 12:13:51 +01: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
f8b719e04c refactor(disc): use KBucekt entry API (#518)
* refactor(disc): use entry API

* refactor(disc): cleanup

* chore: rustfmt
2022-12-19 16:54:03 +01:00
bffc829bcb perf(net): increase udp channel buffers (#508)
* perf(net): increase channel buffers

* Update crates/net/discv4/src/config.rs

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

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2022-12-18 15:22:19 +01: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
601bdc5022 feat: wire components together in reth node (#416)
* feat: naively wire up components

* chore: clippy lints

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-14 12:51:56 +02:00
cbbdac2701 chore(disc): log channel errors (#428) 2022-12-14 09:06:16 +01:00
10d960c5d6 refactor(disc): use discv4 as log target (#423) 2022-12-13 21:56:20 +01:00
02be8121e0 fix(disc): also emit discovered node when buckets are full (#414) 2022-12-13 19:53:53 +02:00
95d99c4317 chore(disc): update discv5 and tracing (#408)
* chore(disc): update discv5 and tracing

* ignore
2022-12-13 19:12:59 +02:00
da5545157a feat(disc): support discport query and add display impl (#385)
* feat(disc): support discport query and add display impl

* chore: rustfmt
2022-12-12 01:08:32 +01:00
4d718bbf33 s/foundry-rs/paradigmxyz 2022-12-07 00:00:45 -08:00
f65969e90f perf(net): exclude bootnodes from update stream (#319) 2022-12-06 18:02:04 -08:00
1668313d55 perf(disc): instantly lookup self in DHT (#314)
* perf(disc): instantly lookup self in DHT

* Update crates/net/discv4/src/lib.rs

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

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-06 18:02:04 -08:00
12212ec91a fix(disc): set trace target correctly (#315) 2022-12-06 18:02:04 -08:00
d6a11c7f48 chore(deps): bump ethers + ethereum types + revm (#228)
* chore(deps): bump ethers + ethereum types

* bump revm

* chore(clippy): make clippy happy
2022-11-23 11:54:54 +01:00
f1e6639374 feat(net): authenticate sessions (#178)
* Switch stream type of ActiveSession to EthStream

 * Start `StatusBuilder` for initializing the `Status` message required
   for the handshake
 * Add `Hardfork` for `Status` default forkid
 * Add `MAINNET_GENESIS` constant

* finish `StatusBuilder`

* initialize eth streams in session

 * add status, hello, and fork filter to session manager
 * fix status builder example
 * add status and hello to network config
   * will probably remove

* removing status and hello from networkconfig

* move forkid to primitives

* change imports for forkid

* add hardfork to primitives

* remove hardfork and forkid from eth-wire

* fix remaining eth-wire forkid references

* put mainnet genesis in constants, remove NodeId

* replace NodeId with PeerId

 * the only NodeId remaining is inherited from enr
 * PeerId still needs to be documented
 * also run cargo fmt

* replace loop with iter().any()

* ignore missing docs for hardforks

* use correct PeerId for Discv4::bind example test

* document PeerId as secp256k1 public key

* cargo fmt

* temporarily allow too_many_arguments

 * the authenticate and start_pending_incoming_session methods have many
   arguments, we can reconsider the lint or fix the methods at a later
   point
2022-11-14 12:03:05 -05:00
b7cdfbf4f9 feat(net): network scaffolding (#110)
* feat(net): network scaffolding
2022-11-07 09:27:08 +01:00
ac2f3fcd8a feat: Consensus crate and verification functions. (#152)
* wip executor

* wip

* Cleanup added some checks and structure to executor

* adding additional block/header checks

* add basefee calculation and check

* some cleanup

* Sanity check test

* Test for sanity check

* move verification to consensus crate

* cleanup

* Better Error handling
2022-11-02 12:59:51 +01:00
6c0e2753dd test: add mock discovery testing (#139) 2022-10-26 14:33:13 +02:00
ce64fefd78 feat(net): add discv4 crate (#113)
* port kad

* feat: port kad bucket

* feat: add discv4

* chore: rustfmt

* cargo update

* just reuse discv5 table

* test: add rlp tests

* message encoding

* feat: impl codec roundtrip testing

* more work in message handling

* implement ping

* feat: impl commands

* cleanup

* more cleanup

* trim config

* more docs

* feat: implement recursive lookup

* docs

* cleanup config

* feat: implement update stream

* chore: config cleanup

* docs: add crate docs

* feat: more testing

* fix deny

* clarify ring

* docs: more docs

* use discv5 master

* docs: address review and add comments

* update readme

* rustmft

* chore(clippy): make clippy happy
2022-10-25 14:23:24 +02:00