mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: reexport bytes & bump version to 1.4 (#1395)
This commit is contained in:
@ -8,8 +8,7 @@ repository = "https://github.com/paradigmxyz/reth"
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
bytes = { version = "1.1" }
|
||||
hex = "0.4"
|
||||
bytes = "1.4"
|
||||
thiserror = "1"
|
||||
serde = { version = "1", optional = true }
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
//! All capability related types
|
||||
|
||||
use crate::{version::ParseVersionError, EthMessage, EthVersion};
|
||||
use bytes::{BufMut, Bytes};
|
||||
use reth_codecs::add_arbitrary_tests;
|
||||
use reth_primitives::bytes::{BufMut, Bytes};
|
||||
use reth_rlp::{Decodable, DecodeError, Encodable, RlpDecodable, RlpEncodable};
|
||||
use smol_str::SmolStr;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
//! Disconnect
|
||||
|
||||
use bytes::Buf;
|
||||
use reth_codecs::derive_arbitrary;
|
||||
use reth_primitives::bytes::{Buf, BufMut};
|
||||
use reth_rlp::{Decodable, DecodeError, Encodable, Header};
|
||||
use std::fmt::Display;
|
||||
use thiserror::Error;
|
||||
@ -104,7 +104,7 @@ impl TryFrom<u8> for DisconnectReason {
|
||||
/// The [`Encodable`](reth_rlp::Encodable) implementation for [`DisconnectReason`] encodes the
|
||||
/// disconnect reason in a single-element RLP list.
|
||||
impl Encodable for DisconnectReason {
|
||||
fn encode(&self, out: &mut dyn bytes::BufMut) {
|
||||
fn encode(&self, out: &mut dyn BufMut) {
|
||||
vec![*self as u8].encode(out);
|
||||
}
|
||||
fn length(&self) -> usize {
|
||||
@ -146,6 +146,7 @@ impl Decodable for DisconnectReason {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{p2pstream::P2PMessage, DisconnectReason};
|
||||
use reth_primitives::hex;
|
||||
use reth_rlp::{Decodable, Encodable};
|
||||
|
||||
fn all_reasons() -> Vec<DisconnectReason> {
|
||||
|
||||
@ -3,10 +3,12 @@ use crate::{
|
||||
message::{EthBroadcastMessage, ProtocolBroadcastMessage},
|
||||
types::{EthMessage, ProtocolMessage, Status},
|
||||
};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures::{ready, Sink, SinkExt, StreamExt};
|
||||
use pin_project::pin_project;
|
||||
use reth_primitives::ForkFilter;
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
ForkFilter,
|
||||
};
|
||||
use reth_rlp::{Decodable, Encodable};
|
||||
use std::{
|
||||
pin::Pin,
|
||||
|
||||
@ -5,11 +5,14 @@ use crate::{
|
||||
pinger::{Pinger, PingerEvent},
|
||||
DisconnectReason, HelloMessage,
|
||||
};
|
||||
use bytes::{Buf, Bytes, BytesMut};
|
||||
use futures::{Sink, SinkExt, StreamExt};
|
||||
use metrics::counter;
|
||||
use pin_project::pin_project;
|
||||
use reth_codecs::derive_arbitrary;
|
||||
use reth_primitives::{
|
||||
bytes::{Buf, BufMut, Bytes, BytesMut},
|
||||
hex,
|
||||
};
|
||||
use reth_rlp::{Decodable, DecodeError, Encodable, EMPTY_LIST_CODE};
|
||||
use std::{
|
||||
collections::{BTreeSet, HashMap, HashSet, VecDeque},
|
||||
@ -651,7 +654,7 @@ impl P2PMessage {
|
||||
/// for all variants except the [`P2PMessage::Hello`] variant, because the hello message is never
|
||||
/// compressed in the `p2p` subprotocol.
|
||||
impl Encodable for P2PMessage {
|
||||
fn encode(&self, out: &mut dyn bytes::BufMut) {
|
||||
fn encode(&self, out: &mut dyn BufMut) {
|
||||
(self.message_id() as u8).encode(out);
|
||||
match self {
|
||||
P2PMessage::Hello(msg) => msg.encode(out),
|
||||
@ -761,7 +764,7 @@ pub enum ProtocolVersion {
|
||||
}
|
||||
|
||||
impl Encodable for ProtocolVersion {
|
||||
fn encode(&self, out: &mut dyn bytes::BufMut) {
|
||||
fn encode(&self, out: &mut dyn BufMut) {
|
||||
(*self as u8).encode(out)
|
||||
}
|
||||
fn length(&self) -> usize {
|
||||
|
||||
@ -5,7 +5,7 @@ use super::{
|
||||
NodeData, PooledTransactions, Receipts, Status, Transactions,
|
||||
};
|
||||
use crate::SharedTransactions;
|
||||
use bytes::{Buf, BufMut};
|
||||
use reth_primitives::bytes::{Buf, BufMut};
|
||||
use reth_rlp::{length_of_length, Decodable, Encodable, Header};
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ use crate::{EthVersion, StatusBuilder};
|
||||
|
||||
use ethers_core::utils::Genesis;
|
||||
use reth_codecs::derive_arbitrary;
|
||||
use reth_primitives::{Chain, ChainSpec, ForkId, Hardfork, Head, H256, MAINNET, U256};
|
||||
use reth_primitives::{hex, Chain, ChainSpec, ForkId, Hardfork, Head, H256, MAINNET, U256};
|
||||
use reth_rlp::{RlpDecodable, RlpEncodable};
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ mod test {
|
||||
use crate::{message::RequestPair, GetPooledTransactions, PooledTransactions};
|
||||
use hex_literal::hex;
|
||||
use reth_primitives::{
|
||||
Signature, Transaction, TransactionKind, TransactionSigned, TxEip1559, TxLegacy, U256,
|
||||
hex, Signature, Transaction, TransactionKind, TransactionSigned, TxEip1559, TxLegacy, U256,
|
||||
};
|
||||
use reth_rlp::{Decodable, Encodable};
|
||||
use std::str::FromStr;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
//! Decoding tests for [`NewBlock`]
|
||||
use reth_eth_wire::NewBlock;
|
||||
use reth_primitives::hex;
|
||||
use reth_rlp::Decodable;
|
||||
use std::{fs, path::PathBuf};
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
//! Decoding tests for [`NewPooledTransactions`]
|
||||
use reth_eth_wire::NewPooledTransactionHashes;
|
||||
use reth_primitives::hex;
|
||||
use reth_rlp::Decodable;
|
||||
use std::{fs, path::PathBuf};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user