Commit Graph

1569 Commits

Author SHA1 Message Date
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
2a8189d7c9 chore(db): Add tests and fuzz target to BlockNumHash (#130)
* add tests and fuzz target for BlockNumHash

* use block 1 for test_block_num_hash

* new clippy stds

* fmt
2022-10-25 01:23:10 -07:00
15bd88e637 headers(part2) - feat: add Downloader trait and test utils (#118)
* feat(interfaces): implement header client traits

* feat: add downloader trait implementer

* feat: use explicit error type instead of ok(false)

* feat: add constructor to HeaderLocked

* test: scaffold mock consensus, downloader and headersclient helpers

* test: implement test consensus

* test: implement test headers client

* refactor: cleanup download headers

* chore: fix lint

* s/test_utils/test_helpers

* headers(part 3) feat: implement Linear downloader (#119)

* feat: add headers downloaders crate

* feat: more scaffolding

* interfaces: generalize retryable erros

* feat: implement linear downloader

* fix linear downloader tests & add builder

* extend & reverse

* feat: linear downloader generics behind arc and reversed return order (#120)

* put client & consensus behind arc and return headers in rev

* cleanup

Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>

* extract test_utils

* cargo fmt

Co-authored-by: Roman Krasiuk <rokrassyuk@gmail.com>
2022-10-24 04:56:43 -07:00
c277015f5c feat(eth): add remaining eth protocol message types (#82)
* chore: port over remaining types from ethp2p

https://github.com/Rjected/ethp2p/

* replace fastrlp with reth_rlp

* use correct type for tx messages

 * encoding / decoding still todo

* derive Default for AccessList

* export receipts

 * also add Hash to more types

* fix receipts tests

* remove unused receipts test imports

* add convenience methods on transaction

* add block body

* move blockbody to eth-wire, uncomment wire type

* uncomment rest of messages

 * TODO: refactor tests and make tests pass

* use U128 instead of Uint for td

* expose wire types

* use reth_eth_wire instead of ethp2p

* expose Signature

* refactor pooled transaction tests

* fix hash calculation

 * do not hash the entire buffer

* uncomment block test and make clippy happy

* module-level documentation for message types

 * apply a clippy fix

* cargo fmt

* actually make clippy happy

* use H256 instead of [u8; 32]

 * use partition in split_transaction_by_hashes instead of peekable

Co-authored-by: Dan Cline <6798349+Rjected@users.noreply.github.com>
2022-10-19 23:24:50 -04:00
4298e3aa87 feat(rpc): more rpc scaffolding (#99)
* feat(rpc): more rpc scaffolding

* use Into<String>

* rm unused error
2022-10-19 22:12:53 +02:00
8009d997c0 Implement ETH P2P (#81)
* refactor: move things to types

* feat(ethwire): bring in message type from ethp2p

30c11138d5/src/message.rs

* feat(ethwire): add eth-stream with Stream/Sink impls

* feat(ethwire): make Sink error an EthStreamError

* feat(ecies): expose util module

* add more deps

* feat: add broadcast newblockhashes

* fix: rlp serialize with message-id first

* chore: cleanup doc

* wip: test eth connection

* bump cargo lock

* feat: add rlp codec and get stream tests working

* fix: convert RlpCodec to PassthroughCodec

we were rlp encoding twice

* Revert "fix: convert RlpCodec to PassthroughCodec"

This reverts commit 6e6e0a58112c14d7ffba62dc83f9747ddc280641.

This does not handle framing, which would fail decoding if a partial
write happened to the socket.

* add tracing

* refactor: add handshake error

* feat(ethwire): add status handshake

* test(ethwire): handshake works

* refactor: expose EthStream::new

* chore: clippy lints

* fix: get rid of rlp codec

we can instead use LengthLimitedCodec from Tokio IO, which we re-export
as PassthroughCodec

* fix(eth): add handshake + msg error checks

1. 10MB message lengths
2. Same Genesis, Version, Chain on Status Handshake

* chore: ignore result_large_err

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-10-16 20:10:25 -07:00
5dfe5ac29b feat(net): add Framed ECIES implementation (#80)
* feat(net): add ecies crate

* cargo fmt

* add hex-literal and proptest to dev-dependencies

 * adds std feature to reth-rlp

* document util

* document more

* chore: allow missing docs in ecies/algorith.rs

* feat(ecies): improve error handling

remove anyhow and strictly type all errors

* refactor(ecies): movem ingress/egress to lib.rs

* chore(ecies): allow missing docs in mac

* chore(ecies): cleanup utils

* refactor(ecies): move ECIES Codec to separate file

* refactor(ecies): rename proto to stream

* add test scaffold

* implement server/client read/write test

* chore: clippy / fmt

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-10-15 18:20:17 -07:00
533c3ebe98 feat(rpc): add EthApiServer impl skeleton (#75) 2022-10-14 12:01:00 -07:00
a644318c32 feat(p2p): Include forkid file from apache licenced repo (#68)
* Start using reth-rlp
* Include apache licenced forkid file in primitives
* Move forkid to eth-wire
2022-10-14 16:52:59 +02:00
8eb2ea4152 feat(rpc): add rpc-api client feature (#33)
* feat(rpc): add rpc-api client feature

* refactor: combine proc macro

* feat: add missing deserialize functions

* add missing derive
2022-10-11 11:56:12 +02:00
230e9ef179 feat(p2p): add anchor file for discovery state (#11)
* feat(p2p): add anchor file for discovery state

* move rustdoc and improve error messages

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

* add temp file tests and log drop error

 * fix error due to lack of read option
 * fix empty and nonexistent file error

* remove redundant new

* replace println with tracing

* show underlying error in custom error message

* chore: cargo fmt

* change AsRef<Path> to &Path

* remove ineffective dedups

* chore: cargo fmt

* switch out Vec<Enr<K>> for HashSet<Enr<K>>

* cargo fmt

* use tempdir instead of of std::env::temp_dir

* refactor anchor to contain &Path instead of File

 * change new_from_file to explicitly include logic for opening existing
   files, rather than calling out to from_toml
 * remove from_toml because new_from_file handles existing files
   properly with only a path. It is not possible to obtain a Path from a
   File anyways, its only purpose was to accept a File type

* use PathBuf instead of Path

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2022-10-10 13:02:54 -04:00
d7c8b70cc3 feat: add eth-wire (#20) 2022-10-10 09:46:02 -07:00
bc30cbce61 Skeleton primitives and interface crate (#13)
* wip interface primitives

* wip

* Integrate it inside rpc- crates

* fmt

* move tx to mod.rs

* Add interfaces, executor to toml

* Added nits, comments fix
2022-10-06 14:48:57 +02:00
14d0b6ac4e fix: make everything compile again 2022-10-03 15:36:13 +02:00
9251b286d0 feat: add engine api types and interface 2022-10-03 15:31:08 +02:00
8b7bef4f48 feat: add debug functions 2022-10-03 15:18:22 +02:00
eeda03a3f3 feat: add missing eth_ functions 2022-10-03 15:06:58 +02:00
5e0315cce0 move crates into net 2022-10-03 13:40:26 +02:00
6ff7cf5a74 feat: add p2p crate (#4)
* feat: add p2p crate

* move p2p to net subfolder

* add lib.rs and Cargo.toml to net

* remove net crate, use explicit names in workspace
2022-09-30 09:27:52 -07:00