pub struct JsonRpcSource { /* private fields */ }Expand description
BalSource + StateSource over plain JSON-RPC. One request per call;
no batching, no retries — callers own that policy.
Implementations§
Source§impl JsonRpcSource
impl JsonRpcSource
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
Talk to the JSON-RPC endpoint at url. Requests time out after 30 s
so a stalled gateway cannot hang a sync forever; redirects are not
followed, so a request never silently goes to a host you did not name.
Sourcepub fn try_new(url: impl Into<String>) -> Result<Self>
pub fn try_new(url: impl Into<String>) -> Result<Self>
Like JsonRpcSource::new but surfaces a client-construction failure.
Sourcepub async fn call(&self, method: &str, params: Value) -> Result<Value>
pub async fn call(&self, method: &str, params: Value) -> Result<Value>
Raw JSON-RPC call; returns the result member or the error object as
SourceError::Rpc. Transport failures (5xx from a gateway, a
connection dropped mid-body) are retried a few times with backoff;
RPC errors and malformed JSON are not.
Sourcepub async fn bal(&self, number: u64) -> Result<BlockAccessList>
pub async fn bal(&self, number: u64) -> Result<BlockAccessList>
Fetch and decode the BAL of number via eth_getBlockAccessList.
Sourcepub async fn probe(&self, old_block_age: u64) -> Result<ProbeReport>
pub async fn probe(&self, old_block_age: u64) -> Result<ProbeReport>
Day-0 probe: Q1 (is the BAL served?), Q2 (for old blocks too?), and does our codec reproduce the header hash on real data.
Trait Implementations§
Source§impl BalSource for JsonRpcSource
impl BalSource for JsonRpcSource
Source§fn header<'life0, 'async_trait>(
&'life0 self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Header>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn header<'life0, 'async_trait>(
&'life0 self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<Header>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
BalSource::block.Source§fn head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn finalized<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn finalized<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn block<'life0, 'async_trait>(
&'life0 self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<SourcedBlock>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn block<'life0, 'async_trait>(
&'life0 self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<SourcedBlock>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn bal<'life0, 'async_trait>(
&'life0 self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockAccessList>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn bal<'life0, 'async_trait>(
&'life0 self,
number: u64,
) -> Pin<Box<dyn Future<Output = Result<BlockAccessList>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl StateSource for JsonRpcSource
impl StateSource for JsonRpcSource
Source§fn proof<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: Address,
slots: &'life1 [B256],
block: u64,
) -> Pin<Box<dyn Future<Output = Result<AccountProof>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn proof<'life0, 'life1, 'async_trait>(
&'life0 self,
addr: Address,
slots: &'life1 [B256],
block: u64,
) -> Pin<Box<dyn Future<Output = Result<AccountProof>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
eth_getProof(addr, slots, block). One call per (address, block)
carries any number of slots — batching happens here, not in JSON-RPC.Auto Trait Implementations§
impl !RefUnwindSafe for JsonRpcSource
impl !UnwindSafe for JsonRpcSource
impl Freeze for JsonRpcSource
impl Send for JsonRpcSource
impl Sync for JsonRpcSource
impl Unpin for JsonRpcSource
impl UnsafeUnpin for JsonRpcSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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