Skip to main content

TestFullBlockClient

Struct TestFullBlockClient 

Source
pub struct TestFullBlockClient { /* private fields */ }
Available on crate features test-utils only.
Expand description

A headers+bodies client that stores the headers and bodies in memory, with an artificial soft bodies response limit that is set to 20 by default.

This full block client can be Cloned and shared between multiple tasks.

Implementations§

Source§

impl TestFullBlockClient

Source

pub fn insert(&self, header: SealedHeader, body: BlockBody)

Insert a header and body into the client maps.

Source

pub fn insert_access_list(&self, hash: B256, access_list: Bytes)

Insert a raw block access list served for the given block hash.

Source

pub const fn set_soft_limit(&mut self, limit: usize)

Set the soft response limit.

Source

pub fn highest_block(&self) -> Option<SealedBlock<Block>>

Get the block with the highest block number.

Trait Implementations§

Source§

impl BlockAccessListsClient for TestFullBlockClient

Source§

type Output = Ready<Result<WithPeerId<BlockAccessLists>, RequestError>>

The bal type this client fetches.
Source§

fn get_block_access_lists_with_priority_and_requirement( &self, hashes: Vec<B256>, _priority: Priority, _requirement: BalRequirement, ) -> Self::Output

Fetches the block access lists for given hashes with priority and BAL availability policy.
Source§

fn get_block_access_lists(&self, hashes: Vec<B256>) -> Self::Output

Fetches the block access lists for given hashes.
Source§

fn get_block_access_lists_with_requirement( &self, hashes: Vec<B256>, requirement: BalRequirement, ) -> Self::Output

Fetches the block access lists for given hashes with the requested BAL availability policy.
Source§

fn get_block_access_lists_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output

Fetches the block access lists for given hashes with priority
Source§

impl BlockClient for TestFullBlockClient

Source§

type Block = Block<EthereumTxEnvelope<TxEip4844>>

The Block type that this client fetches.
Source§

impl BodiesClient for TestFullBlockClient

Implements the BodiesClient trait for the TestFullBlockClient struct.

Source§

type Output = Ready<Result<WithPeerId<Vec<BlockBody<EthereumTxEnvelope<TxEip4844>>>>, RequestError>>

Defines the output type of the function.

Source§

fn get_block_bodies_with_priority_and_range_hint( &self, hashes: Vec<B256>, _priority: Priority, _range_hint: Option<RangeInclusive<u64>>, ) -> Self::Output

Retrieves block bodies corresponding to provided hashes with a given priority.

§Arguments
  • hashes - A vector of block hashes to retrieve bodies for.
  • _priority - Priority level for block body retrieval (unused in this implementation).
§Returns

A future containing the result of the block body retrieval operation.

Source§

type Body = BlockBody<EthereumTxEnvelope<TxEip4844>>

The body type this client fetches.
Source§

fn get_block_bodies(&self, hashes: Vec<B256>) -> Self::Output

Fetches the block body for the requested block.
Source§

fn get_block_bodies_with_priority( &self, hashes: Vec<B256>, priority: Priority, ) -> Self::Output

Fetches the block body for the requested block with priority
Source§

fn get_block_body(&self, hash: B256) -> SingleBodyRequest<Self::Output> ⓘ

Fetches a single block body for the requested hash.
Source§

fn get_block_body_with_priority( &self, hash: B256, priority: Priority, ) -> SingleBodyRequest<Self::Output> ⓘ

Fetches a single block body for the requested hash with priority
Source§

impl Clone for TestFullBlockClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TestFullBlockClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TestFullBlockClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl DownloadClient for TestFullBlockClient

Source§

fn report_bad_message(&self, _peer_id: PeerId)

Reports a bad message from a specific peer.

Source§

fn num_connected_peers(&self) -> usize

Retrieves the number of connected peers.

Returns the number of connected peers in the test scenario (1).

Source§

impl HeadersClient for TestFullBlockClient

Implements the HeadersClient trait for the TestFullBlockClient struct.

Source§

type Output = Ready<Result<WithPeerId<Vec<Header>>, RequestError>>

Specifies the associated output type.

Source§

fn get_headers_with_priority( &self, request: HeadersRequest, _priority: Priority, ) -> Self::Output

Retrieves headers with a given priority level.

§Arguments
  • request - A HeadersRequest indicating the headers to retrieve.
  • _priority - A Priority level for the request.
§Returns

A Ready future containing a PeerRequestResult with a vector of retrieved headers.

Source§

type Header = Header

The header type this client fetches.
Source§

fn get_headers(&self, request: HeadersRequest) -> Self::Output

Sends the header request to the p2p network and returns the header response received from a peer.
Source§

fn get_header( &self, start: BlockHashOrNumber, ) -> SingleHeaderRequest<Self::Output> ⓘ

Fetches a single header for the requested number or hash.
Source§

fn get_header_with_priority( &self, start: BlockHashOrNumber, priority: Priority, ) -> SingleHeaderRequest<Self::Output> ⓘ

Fetches a single header for the requested number or hash with priority

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> EthBlockClient for T
where T: BlockClient<Block = Block<EthereumTxEnvelope<TxEip4844>>>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> MaybeDebug for T
where T: Debug,

§

impl<T> NonStaticAny for T
where T: ?Sized,

§

fn type_id(&self) -> TypeId

Returns the lifetime-erased type ID of self.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 32 bytes