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:
13
Cargo.lock
generated
13
Cargo.lock
generated
@ -503,9 +503,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
|
||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@ -4166,7 +4166,6 @@ dependencies = [
|
||||
name = "reth-discv4"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"discv5",
|
||||
"enr 0.7.0",
|
||||
"generic-array 0.14.6",
|
||||
@ -4191,7 +4190,6 @@ name = "reth-dns-discovery"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"data-encoding",
|
||||
"enr 0.7.0",
|
||||
"linked_hash_set",
|
||||
@ -4216,7 +4214,6 @@ name = "reth-downloaders"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"bytes",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"itertools 0.10.5",
|
||||
@ -4245,7 +4242,6 @@ dependencies = [
|
||||
"aes 0.8.2",
|
||||
"block-padding 0.3.2",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"cipher 0.4.3",
|
||||
"ctr 0.9.2",
|
||||
"digest 0.10.6",
|
||||
@ -4278,7 +4274,6 @@ dependencies = [
|
||||
"bytes",
|
||||
"ethers-core",
|
||||
"futures",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"metrics",
|
||||
"pin-project",
|
||||
@ -4332,7 +4327,6 @@ dependencies = [
|
||||
"arbitrary",
|
||||
"async-trait",
|
||||
"auto_impl 1.0.1",
|
||||
"bytes",
|
||||
"futures",
|
||||
"hex-literal",
|
||||
"modular-bitfield",
|
||||
@ -4451,7 +4445,6 @@ dependencies = [
|
||||
"aquamarine",
|
||||
"async-trait",
|
||||
"auto_impl 1.0.1",
|
||||
"bytes",
|
||||
"enr 0.7.0",
|
||||
"ethers-core",
|
||||
"ethers-middleware",
|
||||
@ -4672,7 +4665,6 @@ name = "reth-rpc-engine-api"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"assert_matches",
|
||||
"bytes",
|
||||
"futures",
|
||||
"reth-executor",
|
||||
"reth-interfaces",
|
||||
@ -4690,7 +4682,6 @@ dependencies = [
|
||||
name = "reth-rpc-types"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"jsonrpsee-types",
|
||||
"lru 0.9.0",
|
||||
"reth-network-api",
|
||||
|
||||
@ -16,7 +16,6 @@ async-trait = "0.1.57"
|
||||
thiserror = "1.0.37"
|
||||
auto_impl = "1.0"
|
||||
tokio = { version = "1.21.2", features = ["sync"] }
|
||||
bytes = "1.2"
|
||||
|
||||
# TODO(onbjerg): We only need this for [BlockBody]
|
||||
reth-eth-wire = { path = "../net/eth-wire" }
|
||||
|
||||
@ -33,7 +33,6 @@ tokio = { version = "1", features = ["io-util", "net", "time"] }
|
||||
tokio-stream = "0.1"
|
||||
|
||||
# misc
|
||||
bytes = "1.2"
|
||||
tracing = "0.1"
|
||||
thiserror = "1.0"
|
||||
hex = "0.4"
|
||||
|
||||
@ -3,10 +3,12 @@
|
||||
//! This basis of this file has been taken from the discv5 codebase:
|
||||
//! <https://github.com/sigp/discv5>
|
||||
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use reth_net_common::ban_list::BanList;
|
||||
use reth_net_nat::{NatResolver, ResolveNatInterval};
|
||||
use reth_primitives::NodeRecord;
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
NodeRecord,
|
||||
};
|
||||
use reth_rlp::Encodable;
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
|
||||
@ -21,7 +21,6 @@ use crate::{
|
||||
error::{DecodePacketError, Discv4Error},
|
||||
proto::{FindNode, Message, Neighbours, Packet, Ping, Pong},
|
||||
};
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use discv5::{
|
||||
kbucket,
|
||||
kbucket::{
|
||||
@ -32,7 +31,10 @@ use discv5::{
|
||||
};
|
||||
use enr::{Enr, EnrBuilder};
|
||||
use proto::{EnrRequest, EnrResponse};
|
||||
use reth_primitives::{ForkId, PeerId, H256};
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
ForkId, PeerId, H256,
|
||||
};
|
||||
use secp256k1::SecretKey;
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use crate::{error::DecodePacketError, PeerId, MAX_PACKET_SIZE, MIN_PACKET_SIZE};
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
use enr::Enr;
|
||||
use reth_primitives::{keccak256, ForkId, NodeRecord, H256};
|
||||
use reth_primitives::{
|
||||
bytes::{Buf, BufMut, Bytes, BytesMut},
|
||||
keccak256, ForkId, NodeRecord, H256,
|
||||
};
|
||||
use reth_rlp::{Decodable, DecodeError, Encodable, Header};
|
||||
use reth_rlp_derive::{RlpDecodable, RlpEncodable};
|
||||
use secp256k1::{
|
||||
@ -420,7 +422,6 @@ mod tests {
|
||||
test_utils::{rng_endpoint, rng_ipv4_record, rng_ipv6_record, rng_message},
|
||||
SAFE_MAX_DATAGRAM_NEIGHBOUR_RECORDS,
|
||||
};
|
||||
use bytes::BytesMut;
|
||||
use rand::{thread_rng, Rng, RngCore};
|
||||
|
||||
#[test]
|
||||
|
||||
@ -31,7 +31,6 @@ trust-dns-resolver = "0.22"
|
||||
# misc
|
||||
data-encoding = "2"
|
||||
async-trait = "0.1"
|
||||
bytes = "1.2"
|
||||
linked_hash_set = "0.1"
|
||||
lru = "0.9"
|
||||
thiserror = "1.0"
|
||||
|
||||
@ -23,10 +23,9 @@ use crate::error::{
|
||||
ParseDnsEntryError::{FieldNotFound, UnknownEntry},
|
||||
ParseEntryResult,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use data_encoding::{BASE32_NOPAD, BASE64URL_NOPAD};
|
||||
use enr::{Enr, EnrError, EnrKey, EnrKeyUnambiguous, EnrPublicKey};
|
||||
use reth_primitives::hex;
|
||||
use reth_primitives::{bytes::Bytes, hex};
|
||||
use secp256k1::SecretKey;
|
||||
use std::{fmt, str::FromStr};
|
||||
|
||||
|
||||
@ -31,7 +31,6 @@ metrics = "0.20.1"
|
||||
thiserror = { version = "1", optional = true }
|
||||
reth-rlp = { path = "../../rlp", optional = true }
|
||||
tokio-util = { version = "0.7", features = ["codec"], optional = true }
|
||||
bytes = { version = "1", optional = true }
|
||||
tempfile = { version = "3.3", optional = true }
|
||||
itertools = { version = "0.10", optional = true }
|
||||
|
||||
@ -45,10 +44,9 @@ tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
|
||||
tokio-util = { version = "0.7", features = ["codec"] }
|
||||
reth-rlp = { path = "../../rlp" }
|
||||
itertools = "0.10"
|
||||
bytes = "1"
|
||||
|
||||
thiserror = "1"
|
||||
tempfile = "3.3"
|
||||
|
||||
[features]
|
||||
test-utils = ["dep:reth-rlp", "dep:thiserror", "dep:tokio-util", "dep:tempfile", "dep:bytes", "dep:itertools"]
|
||||
test-utils = ["dep:reth-rlp", "dep:thiserror", "dep:tokio-util", "dep:tempfile", "dep:itertools"]
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
//! Codec for reading raw block bodies from a file.
|
||||
use super::FileClientError;
|
||||
use bytes::{Buf, BytesMut};
|
||||
use reth_primitives::Block;
|
||||
use reth_primitives::{
|
||||
bytes::{Buf, BytesMut},
|
||||
Block,
|
||||
};
|
||||
use reth_rlp::{Decodable, Encodable};
|
||||
use tokio_util::codec::{Decoder, Encoder};
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@ tracing = "0.1.37"
|
||||
generic-array = "0.14.6"
|
||||
typenum = "1.15.0"
|
||||
byteorder = "1.4.3"
|
||||
bytes = "1.2.1"
|
||||
|
||||
# crypto
|
||||
rand = "0.8.5"
|
||||
|
||||
@ -7,12 +7,14 @@ use crate::{
|
||||
};
|
||||
use aes::{cipher::StreamCipher, Aes128, Aes256};
|
||||
use byteorder::{BigEndian, ByteOrder, ReadBytesExt};
|
||||
use bytes::{BufMut, Bytes, BytesMut};
|
||||
use ctr::Ctr64BE;
|
||||
use digest::{crypto_common::KeyIvInit, Digest};
|
||||
use educe::Educe;
|
||||
use rand::{thread_rng, Rng};
|
||||
use reth_primitives::{H128, H256, H512 as PeerId};
|
||||
use reth_primitives::{
|
||||
bytes::{BufMut, Bytes, BytesMut},
|
||||
H128, H256, H512 as PeerId,
|
||||
};
|
||||
use reth_rlp::{Encodable, Rlp, RlpEncodable, RlpMaxEncodedLen};
|
||||
use secp256k1::{
|
||||
ecdsa::{RecoverableSignature, RecoveryId},
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use crate::{algorithm::ECIES, ECIESError, EgressECIESValue, IngressECIESValue};
|
||||
use bytes::BytesMut;
|
||||
use reth_primitives::H512 as PeerId;
|
||||
use reth_primitives::{bytes::BytesMut, H512 as PeerId};
|
||||
use secp256k1::SecretKey;
|
||||
use std::{fmt::Debug, io};
|
||||
use tokio_util::codec::{Decoder, Encoder};
|
||||
|
||||
@ -17,7 +17,10 @@ pub use error::ECIESError;
|
||||
|
||||
mod codec;
|
||||
|
||||
use reth_primitives::H512 as PeerId;
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
H512 as PeerId,
|
||||
};
|
||||
|
||||
/// Raw egress values for an ECIES protocol
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
@ -27,7 +30,7 @@ pub enum EgressECIESValue {
|
||||
/// The ACK message being sent out
|
||||
Ack,
|
||||
/// The message being sent out (wrapped bytes)
|
||||
Message(bytes::Bytes),
|
||||
Message(Bytes),
|
||||
}
|
||||
|
||||
/// Raw ingress values for an ECIES protocol
|
||||
@ -38,5 +41,5 @@ pub enum IngressECIESValue {
|
||||
/// Receiving an ACK message
|
||||
Ack,
|
||||
/// Receiving a message
|
||||
Message(bytes::BytesMut),
|
||||
Message(BytesMut),
|
||||
}
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
use crate::{
|
||||
codec::ECIESCodec, error::ECIESErrorImpl, ECIESError, EgressECIESValue, IngressECIESValue,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use futures::{ready, Sink, SinkExt};
|
||||
use reth_net_common::stream::HasRemoteAddr;
|
||||
use reth_primitives::H512 as PeerId;
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
H512 as PeerId,
|
||||
};
|
||||
use secp256k1::SecretKey;
|
||||
use std::{
|
||||
fmt::Debug,
|
||||
@ -104,7 +106,7 @@ impl<Io> Stream for ECIESStream<Io>
|
||||
where
|
||||
Io: AsyncRead + Unpin,
|
||||
{
|
||||
type Item = Result<bytes::BytesMut, io::Error>;
|
||||
type Item = Result<BytesMut, io::Error>;
|
||||
|
||||
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
match ready!(self.project().stream.poll_next(cx)) {
|
||||
|
||||
@ -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};
|
||||
|
||||
|
||||
@ -56,7 +56,6 @@ fnv = "1.0"
|
||||
thiserror = "1.0"
|
||||
parking_lot = "0.12"
|
||||
async-trait = "0.1"
|
||||
bytes = "1.2"
|
||||
linked_hash_set = "0.1"
|
||||
linked-hash-map = "0.5.6"
|
||||
rand = "0.8"
|
||||
|
||||
@ -40,7 +40,7 @@ secp256k1 = { version = "0.24.2", default-features = false, features = [
|
||||
crc = "3"
|
||||
|
||||
# misc
|
||||
bytes = "1.2"
|
||||
bytes = "1.4"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
serde_with = "2.1.0"
|
||||
|
||||
@ -92,6 +92,7 @@ pub use revm_primitives::{ruint::aliases::U128, B160 as H160, B256 as H256, U256
|
||||
|
||||
#[doc(hidden)]
|
||||
mod __reexport {
|
||||
pub use bytes;
|
||||
pub use hex;
|
||||
pub use hex_literal;
|
||||
pub use tiny_keccak;
|
||||
|
||||
@ -24,7 +24,7 @@ tower = "0.4"
|
||||
jsonrpsee = { version = "0.16", features = ["server", "client"] }
|
||||
serde_json = "1.0"
|
||||
tracing = "0.1.37"
|
||||
bytes = "1.2.1"
|
||||
bytes = "1.4"
|
||||
thiserror = "1.0.37"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@ -30,4 +30,3 @@ thiserror = "1.0.37"
|
||||
reth-interfaces = { path = "../../interfaces", features = ["test-utils"] }
|
||||
reth-provider = { path = "../../storage/provider", features = ["test-utils"] }
|
||||
assert_matches = "1.5.0"
|
||||
bytes = "1.2"
|
||||
|
||||
@ -326,9 +326,11 @@ mod tests {
|
||||
|
||||
mod new_payload {
|
||||
use super::*;
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use reth_interfaces::test_utils::generators::random_header;
|
||||
use reth_primitives::Block;
|
||||
use reth_primitives::{
|
||||
bytes::{Bytes, BytesMut},
|
||||
Block,
|
||||
};
|
||||
use reth_rlp::DecodeError;
|
||||
|
||||
fn transform_block<F: FnOnce(Block) -> Block>(src: SealedBlock, f: F) -> SealedBlock {
|
||||
|
||||
@ -23,6 +23,5 @@ tokio = { version = "1", features = ["sync"] }
|
||||
# misc
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
bytes = "1.2"
|
||||
jsonrpsee-types = { version = "0.16" }
|
||||
lru = "0.9"
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use bytes::BytesMut;
|
||||
use reth_primitives::{Address, Bloom, Bytes, SealedBlock, Withdrawal, H256, H64, U256, U64};
|
||||
use reth_primitives::{
|
||||
bytes::BytesMut, Address, Bloom, Bytes, SealedBlock, Withdrawal, H256, H64, U256, U64,
|
||||
};
|
||||
use reth_rlp::Encodable;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ reth-primitives = { path = "../../crates/primitives" }
|
||||
reth-provider = { path = "../../crates/storage/provider", features = ["test-utils"] }
|
||||
reth-net-nat = { path = "../../crates/net/nat" }
|
||||
reth-interfaces = { path = "../interfaces", optional = true }
|
||||
reth-tasks= { path = "../../crates/tasks" }
|
||||
reth-tasks = { path = "../../crates/tasks" }
|
||||
|
||||
# io
|
||||
serde = "1.0"
|
||||
|
||||
@ -21,7 +21,7 @@ arbitrary = [
|
||||
|
||||
|
||||
[dependencies]
|
||||
bytes = "1.2.1"
|
||||
bytes = "1.4"
|
||||
codecs-derive = { version = "0.1.0", path = "./derive", default-features = false }
|
||||
revm-primitives = { version = "1.0.0", features = ["serde"] }
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ modular-bitfield = "0.11.2"
|
||||
metrics = "0.20.1"
|
||||
|
||||
# misc
|
||||
bytes = "1.2.1"
|
||||
bytes = "1.4"
|
||||
page_size = "0.4.2"
|
||||
thiserror = "1.0.37"
|
||||
tempfile = { version = "3.3.0", optional = true }
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::{
|
||||
transaction::{DbTx, DbTxMut},
|
||||
Error,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use reth_primitives::bytes::Bytes;
|
||||
use serde::Serialize;
|
||||
use std::{
|
||||
fmt::Debug,
|
||||
|
||||
@ -5,9 +5,11 @@ use crate::{
|
||||
table::{Decode, Encode},
|
||||
Error,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use reth_codecs::Compact;
|
||||
use reth_primitives::{Account, Address, TransitionId};
|
||||
use reth_primitives::{
|
||||
bytes::{BufMut, Bytes},
|
||||
Account, Address, TransitionId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Account as it is saved inside [`AccountChangeSet`][crate::tables::AccountChangeSet].
|
||||
@ -25,7 +27,7 @@ pub struct AccountBeforeTx {
|
||||
// and compress second part of the value. If we have compression
|
||||
// over whole value (Even SubKey) that would mess up fetching of values with seek_by_key_subkey
|
||||
impl Compact for AccountBeforeTx {
|
||||
fn to_compact(self, buf: &mut impl bytes::BufMut) -> usize {
|
||||
fn to_compact(self, buf: &mut impl BufMut) -> usize {
|
||||
// for now put full bytes and later compress it.
|
||||
buf.put_slice(&self.address.to_fixed_bytes()[..]);
|
||||
self.info.to_compact(buf) + 32
|
||||
@ -88,7 +90,7 @@ impl Encode for TransitionIdAddress {
|
||||
|
||||
impl Decode for TransitionIdAddress {
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: bytes::Bytes = value.into();
|
||||
let value: Bytes = value.into();
|
||||
|
||||
let num =
|
||||
u64::from_be_bytes(value.as_ref()[..8].try_into().map_err(|_| Error::DecodeError)?);
|
||||
|
||||
@ -7,9 +7,8 @@ use crate::{
|
||||
table::{Decode, Encode},
|
||||
Error,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use reth_codecs::{main_codec, Compact};
|
||||
use reth_primitives::{BlockHash, BlockNumber, Header, TxNumber, Withdrawal, H256};
|
||||
use reth_primitives::{bytes::Bytes, BlockHash, BlockNumber, Header, TxNumber, Withdrawal, H256};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Total number of transactions.
|
||||
@ -128,7 +127,7 @@ impl Encode for BlockNumHash {
|
||||
|
||||
impl Decode for BlockNumHash {
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: bytes::Bytes = value.into();
|
||||
let value: Bytes = value.into();
|
||||
|
||||
let num =
|
||||
u64::from_be_bytes(value.as_ref()[..8].try_into().map_err(|_| Error::DecodeError)?);
|
||||
|
||||
@ -4,8 +4,7 @@ use crate::{
|
||||
table::{Compress, Decompress},
|
||||
Error,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use reth_primitives::IntegerList;
|
||||
use reth_primitives::{bytes::Bytes, IntegerList};
|
||||
|
||||
impl Compress for IntegerList {
|
||||
type Compressed = Vec<u8>;
|
||||
|
||||
@ -8,13 +8,13 @@ pub mod storage_sharded_key;
|
||||
|
||||
pub use accounts::*;
|
||||
pub use blocks::*;
|
||||
use reth_primitives::{Address, H256};
|
||||
pub use sharded_key::ShardedKey;
|
||||
|
||||
use crate::{
|
||||
table::{Decode, Encode},
|
||||
Error,
|
||||
};
|
||||
use reth_primitives::{bytes::Bytes, Address, H256};
|
||||
|
||||
/// Macro that implements [`Encode`] and [`Decode`] for uint types.
|
||||
macro_rules! impl_uints {
|
||||
@ -31,8 +31,8 @@ macro_rules! impl_uints {
|
||||
|
||||
impl Decode for $name
|
||||
{
|
||||
fn decode<B: Into<bytes::Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: bytes::Bytes = value.into();
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: Bytes = value.into();
|
||||
Ok(
|
||||
$name::from_be_bytes(
|
||||
value.as_ref().try_into().map_err(|_| Error::DecodeError)?
|
||||
@ -54,7 +54,7 @@ impl Encode for Vec<u8> {
|
||||
}
|
||||
|
||||
impl Decode for Vec<u8> {
|
||||
fn decode<B: Into<bytes::Bytes>>(value: B) -> Result<Self, Error> {
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
Ok(value.into().to_vec())
|
||||
}
|
||||
}
|
||||
@ -67,7 +67,7 @@ impl Encode for Address {
|
||||
}
|
||||
|
||||
impl Decode for Address {
|
||||
fn decode<B: Into<bytes::Bytes>>(value: B) -> Result<Self, Error> {
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
Ok(Address::from_slice(&value.into()[..]))
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ impl Encode for H256 {
|
||||
}
|
||||
|
||||
impl Decode for H256 {
|
||||
fn decode<B: Into<bytes::Bytes>>(value: B) -> Result<Self, Error> {
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
Ok(H256::from_slice(&value.into()[..]))
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::{
|
||||
table::{Decode, Encode},
|
||||
Error,
|
||||
};
|
||||
use reth_primitives::TransitionId;
|
||||
use reth_primitives::{bytes::Bytes, TransitionId};
|
||||
|
||||
/// Number of indices in one shard.
|
||||
pub const NUM_OF_INDICES_IN_SHARD: usize = 100;
|
||||
@ -48,8 +48,8 @@ impl<T> Decode for ShardedKey<T>
|
||||
where
|
||||
T: Decode,
|
||||
{
|
||||
fn decode<B: Into<bytes::Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: bytes::Bytes = value.into();
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: Bytes = value.into();
|
||||
let tx_num_index = value.len() - 8;
|
||||
|
||||
let highest_tx_number = u64::from_be_bytes(
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::{
|
||||
table::{Decode, Encode},
|
||||
Error,
|
||||
};
|
||||
use reth_primitives::{TransitionId, H160, H256};
|
||||
use reth_primitives::{bytes::Bytes, TransitionId, H160, H256};
|
||||
|
||||
use super::ShardedKey;
|
||||
|
||||
@ -44,8 +44,8 @@ impl Encode for StorageShardedKey {
|
||||
}
|
||||
|
||||
impl Decode for StorageShardedKey {
|
||||
fn decode<B: Into<bytes::Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: bytes::Bytes = value.into();
|
||||
fn decode<B: Into<Bytes>>(value: B) -> Result<Self, Error> {
|
||||
let value: Bytes = value.into();
|
||||
let tx_num_index = value.len() - 8;
|
||||
|
||||
let highest_tx_number = u64::from_be_bytes(
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::{
|
||||
table::{Decode, Decompress, Table},
|
||||
Error,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use reth_primitives::bytes::Bytes;
|
||||
use std::borrow::Cow;
|
||||
|
||||
#[macro_export]
|
||||
|
||||
@ -24,7 +24,7 @@ async-trait = "0.1.57"
|
||||
thiserror = "1.0.37"
|
||||
auto_impl = "1.0"
|
||||
tokio = { version = "1.21.2", features = ["sync"] }
|
||||
bytes = "1.2"
|
||||
bytes = "1.4"
|
||||
futures = "0.3.25"
|
||||
tokio-stream = "0.1.11"
|
||||
rand = "0.8.5"
|
||||
|
||||
Reference in New Issue
Block a user