chore: reexport bytes & bump version to 1.4 (#1395)

This commit is contained in:
Roman Krasiuk
2023-02-16 20:33:28 +02:00
committed by GitHub
parent d2ec304bd3
commit f979c6c1fb
45 changed files with 93 additions and 88 deletions

View File

@ -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 }

View File

@ -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;

View File

@ -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> {

View File

@ -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,

View File

@ -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 {

View File

@ -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};

View File

@ -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};

View File

@ -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;

View File

@ -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};

View File

@ -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};