mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore: use alloy's blockwithparent (#13052)
This commit is contained in:
@ -1225,11 +1225,10 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use crate::headers::test_utils::child_header;
|
use crate::headers::test_utils::child_header;
|
||||||
use alloy_consensus::Header;
|
use alloy_consensus::Header;
|
||||||
use alloy_eips::BlockNumHash;
|
use alloy_eips::{eip1898::BlockWithParent, BlockNumHash};
|
||||||
use assert_matches::assert_matches;
|
use assert_matches::assert_matches;
|
||||||
use reth_consensus::test_utils::TestConsensus;
|
use reth_consensus::test_utils::TestConsensus;
|
||||||
use reth_network_p2p::test_utils::TestHeadersClient;
|
use reth_network_p2p::test_utils::TestHeadersClient;
|
||||||
use reth_primitives_traits::BlockWithParent;
|
|
||||||
|
|
||||||
/// Tests that `replace_number` works the same way as `Option::replace`
|
/// Tests that `replace_number` works the same way as `Option::replace`
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
use super::error::HeadersDownloaderResult;
|
use super::error::HeadersDownloaderResult;
|
||||||
use crate::error::{DownloadError, DownloadResult};
|
use crate::error::{DownloadError, DownloadResult};
|
||||||
use alloy_consensus::BlockHeader;
|
use alloy_consensus::BlockHeader;
|
||||||
use alloy_eips::BlockHashOrNumber;
|
use alloy_eips::{eip1898::BlockWithParent, BlockHashOrNumber};
|
||||||
use alloy_primitives::B256;
|
use alloy_primitives::B256;
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use reth_consensus::HeaderValidator;
|
use reth_consensus::HeaderValidator;
|
||||||
use reth_primitives::SealedHeader;
|
use reth_primitives::SealedHeader;
|
||||||
use reth_primitives_traits::BlockWithParent;
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
/// A downloader capable of fetching and yielding block headers.
|
/// A downloader capable of fetching and yielding block headers.
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
mod sealed;
|
mod sealed;
|
||||||
pub use sealed::{BlockWithParent, Header, SealedHeader};
|
pub use sealed::{Header, SealedHeader};
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
pub use error::HeaderError;
|
pub use error::HeaderError;
|
||||||
|
|||||||
@ -1,26 +1,13 @@
|
|||||||
|
use crate::InMemorySize;
|
||||||
pub use alloy_consensus::Header;
|
pub use alloy_consensus::Header;
|
||||||
|
|
||||||
use core::mem;
|
|
||||||
|
|
||||||
use alloy_consensus::Sealed;
|
use alloy_consensus::Sealed;
|
||||||
use alloy_eips::BlockNumHash;
|
use alloy_eips::BlockNumHash;
|
||||||
use alloy_primitives::{keccak256, BlockHash, Sealable, B256};
|
use alloy_primitives::{keccak256, BlockHash, Sealable};
|
||||||
use alloy_rlp::{Decodable, Encodable};
|
use alloy_rlp::{Decodable, Encodable};
|
||||||
use bytes::BufMut;
|
use bytes::BufMut;
|
||||||
|
use core::mem;
|
||||||
use derive_more::{AsRef, Deref};
|
use derive_more::{AsRef, Deref};
|
||||||
|
|
||||||
use crate::InMemorySize;
|
|
||||||
|
|
||||||
/// A helper struct to store the block number/hash and its parent hash.
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
|
||||||
pub struct BlockWithParent {
|
|
||||||
/// Parent hash.
|
|
||||||
pub parent: B256,
|
|
||||||
/// Block number/hash.
|
|
||||||
pub block: BlockNumHash,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A [`Header`] that is sealed at a precalculated hash, use [`SealedHeader::unseal()`] if you want
|
/// A [`Header`] that is sealed at a precalculated hash, use [`SealedHeader::unseal()`] if you want
|
||||||
/// to modify header.
|
/// to modify header.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref)]
|
||||||
|
|||||||
@ -58,7 +58,7 @@ pub use storage::StorageEntry;
|
|||||||
pub mod header;
|
pub mod header;
|
||||||
#[cfg(any(test, feature = "arbitrary", feature = "test-utils"))]
|
#[cfg(any(test, feature = "arbitrary", feature = "test-utils"))]
|
||||||
pub use header::test_utils;
|
pub use header::test_utils;
|
||||||
pub use header::{BlockWithParent, Header, HeaderError, SealedHeader};
|
pub use header::{Header, HeaderError, SealedHeader};
|
||||||
|
|
||||||
/// Bincode-compatible serde implementations for common abstracted types in Reth.
|
/// Bincode-compatible serde implementations for common abstracted types in Reth.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user