* wip: start adding serde to stuff
* add serde traits to NewBlockHashes
* derive serde traits for the rest of the types
* derive serde traits for p2p subprotocol messages
* cargo fmt
* fix disconnect reason encoding
* move disconnect to own file
* add encoding test for 0x80 in list
* rlp([0u8]) is a good test case to have because it is the RLP encoding
of a DisconnectRequested p2p message
* fix disconnect encoding and decoding
* directly decode the disconnect id to handle the 0x80 case of
DisconnectRequested
* the previous manual snappy encoding / decoding was incorrect - a
snappy encoded disconnect message is 4 bytes, not 3 bytes. The tests
and implementation are changed to reflect this.
* fix p2p message decoding
* had a similar issue to disconnect reason decoding where it would not
handle a 0x80 message id
* make invalid rlp header case more explicit
* cargo fmt
* chore: clean up `.gitignore`
* fix: make RO cursors `Send + Sync`
* feat(wip): bodies stage
* driveby: improve docs
* chore: don't panic if we're the first stage
* chore: use `Vec` for ommers
* feat: error handling in bodies downloader
* chore: remove stale comment
* chore: pascal-case stage id
* refactor: remove unused new fns
* refactor: distinguish downloaders with prefix
* refactor: move downloader errs to own module
* refactor: `stream_bodies` -> `bodies_stream`
* test: fix borked imports in header stage
* test: clean up header tests
* test: add basic body stage tests
* test: add 2 more body stage test skeletons
* test: move generator test utils to own module
* refactor: move proof functions to primitives crate
* feat: add block generator test utils
* test: more body stage tests
* chore: fix typo (`Cannonical*` -> `Canonical`)
* docs: document `bodies_to_download`
* test: more body stage tests
* test: more body stage tests
* refactor: clean up body stage tests a bit
* test: fix broken tests
* refactor: clean up body stage tests
* test: more body stage tests
* 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
* feat(consensus): Signer recovery and tx validation
* Signature hash and use seckp256k1 over k256
* use deref_more for transactions
* cleanup and fix for eip1559 hash
* fix hash calculation on decoding
* Create UnauthedEthStream
* remove authed flag from EthStream
* encode and decode in status handshake
* update test to assert the proper status is communicated
* cargo fmt
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
* wip: p2pstream
* add comment for handshake timeout
* temp allow some lint violations
* ignore unused_variables
* start of ping task
* TODO: make it compile
* TODO: test ping/pong/disconnect state machine
* TODO: send subprotocol messages to stream
* TODO: encode non-hello p2p messages as snappy encoding without using
an encoder
* TODO: create test comparing encoder to hand-written snappy encoding
for ping, pong, disconnect messages
* implement message handling in stream poll method
* restricts S to be Stream+Sink for P2PStream to implement Stream
* start of a poll-based refactor
* impl Stream and Sink for P2PStream
* add tests
* TODO: make stream/sink types compatible
* TODO: handshake message ids
* TODO: inner poll fn
* TODO: pinger interval
* TODO: ethstream test
* TODO: passthrough test
* create pingers and test
* impl working timeout interval pinger
* it should be much easier to poll for pings and detect timeouts now
* use pinger in p2p stream
* change item produced by stream so it's compatible with EthStream
* add note on pros/cons
* shorten message sends in stream
* improve errors and remove redundant methods
* fix handshake
* debugging printlns
* fix encoding and decoding
* switch to snappy formatting for non-hello p2p messages
* cargo fmt
* perform handshake in ethstream over p2pstream test
* remove check for `Hello` messages outside of the handshake because
`P2PStream`s should assume messages sent in the sink are subprotocol
messages, not `p2p` messages.
* impl From<EthVersion> for CapabilityMessage
* remove printlns
* add total_message method to EthVersion
* decode Hello in handshake
* disallow protocol versions other than v5
* Integrate snappy and implement message size limits
* document constants, move stream definition
* fix missing hello message id
* implement shared capabilities
* todo: test shared capabilities
* todo: determine how / when / why to support multiple capabilities
* removes obsolete authed and offset fields
* add sink api TODOs
* remove les
* should add protocols when necessary rather than name unsupported
protocols
* fix snappy compression length
* add test for p2pstream over a passthrough codec which tests that
peers agree on a single shared capability
* fix some clippy lints
* 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>
* 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>