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.
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,
Header only. Used for reorg checks, where fetching the BAL would be
wasted work; the default goes through
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,
Latest block number the source knows.
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,
Latest finalized block number (reorg horizon).
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,
Header + BAL for one block.
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,
BAL body only, unverified. Lets a backup supply the body while the
header — the canonical-chain fact — still comes from the primary.
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
Mutably borrows from an owned value. Read more