pub trait SourceClient<P: MessageLane>: RelayClient {
type BatchTransaction: BatchTransaction<TargetHeaderIdOf<P>> + Clone;
type TransactionTracker: TransactionTracker<HeaderId = SourceHeaderIdOf<P>>;
// Required methods
fn state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SourceClientState<P>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn latest_generated_nonce<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, MessageNonce), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn latest_confirmed_received_nonce<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, MessageNonce), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn generated_message_details<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
nonces: RangeInclusive<MessageNonce>,
) -> Pin<Box<dyn Future<Output = Result<MessageDetailsMap<P::SourceChainBalance>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn prove_messages<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
nonces: RangeInclusive<MessageNonce>,
proof_parameters: MessageProofParameters,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, RangeInclusive<MessageNonce>, P::MessagesProof), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn submit_messages_receiving_proof<'life0, 'async_trait>(
&'life0 self,
maybe_batch_tx: Option<Self::BatchTransaction>,
generated_at_block: TargetHeaderIdOf<P>,
proof: P::MessagesReceivingProof,
) -> Pin<Box<dyn Future<Output = Result<Self::TransactionTracker, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn require_target_header_on_source<'life0, 'async_trait>(
&'life0 self,
id: TargetHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::BatchTransaction>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Source client trait.
Required Associated Types§
sourcetype BatchTransaction: BatchTransaction<TargetHeaderIdOf<P>> + Clone
type BatchTransaction: BatchTransaction<TargetHeaderIdOf<P>> + Clone
Type of batch transaction that submits finality and message receiving proof.
sourcetype TransactionTracker: TransactionTracker<HeaderId = SourceHeaderIdOf<P>>
type TransactionTracker: TransactionTracker<HeaderId = SourceHeaderIdOf<P>>
Transaction tracker to track submitted transactions.
Required Methods§
sourcefn state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SourceClientState<P>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn state<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<SourceClientState<P>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns state of the client.
sourcefn latest_generated_nonce<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, MessageNonce), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn latest_generated_nonce<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, MessageNonce), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get nonce of instance of latest generated message.
sourcefn latest_confirmed_received_nonce<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, MessageNonce), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn latest_confirmed_received_nonce<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, MessageNonce), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get nonce of the latest message, which receiving has been confirmed by the target chain.
sourcefn generated_message_details<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
nonces: RangeInclusive<MessageNonce>,
) -> Pin<Box<dyn Future<Output = Result<MessageDetailsMap<P::SourceChainBalance>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn generated_message_details<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
nonces: RangeInclusive<MessageNonce>,
) -> Pin<Box<dyn Future<Output = Result<MessageDetailsMap<P::SourceChainBalance>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns mapping of message nonces, generated on this client, to their weights.
Some messages may be missing from returned map, if corresponding messages were pruned at the source chain.
sourcefn prove_messages<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
nonces: RangeInclusive<MessageNonce>,
proof_parameters: MessageProofParameters,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, RangeInclusive<MessageNonce>, P::MessagesProof), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prove_messages<'life0, 'async_trait>(
&'life0 self,
id: SourceHeaderIdOf<P>,
nonces: RangeInclusive<MessageNonce>,
proof_parameters: MessageProofParameters,
) -> Pin<Box<dyn Future<Output = Result<(SourceHeaderIdOf<P>, RangeInclusive<MessageNonce>, P::MessagesProof), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Prove messages in inclusive range [begin; end].
sourcefn submit_messages_receiving_proof<'life0, 'async_trait>(
&'life0 self,
maybe_batch_tx: Option<Self::BatchTransaction>,
generated_at_block: TargetHeaderIdOf<P>,
proof: P::MessagesReceivingProof,
) -> Pin<Box<dyn Future<Output = Result<Self::TransactionTracker, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit_messages_receiving_proof<'life0, 'async_trait>(
&'life0 self,
maybe_batch_tx: Option<Self::BatchTransaction>,
generated_at_block: TargetHeaderIdOf<P>,
proof: P::MessagesReceivingProof,
) -> Pin<Box<dyn Future<Output = Result<Self::TransactionTracker, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Submit messages receiving proof.
sourcefn require_target_header_on_source<'life0, 'async_trait>(
&'life0 self,
id: TargetHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::BatchTransaction>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn require_target_header_on_source<'life0, 'async_trait>(
&'life0 self,
id: TargetHeaderIdOf<P>,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::BatchTransaction>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
We need given finalized target header on source to continue synchronization.
We assume that the absence of header id
has already been checked by caller.
The client may return Some(_)
, which means that nothing has happened yet and
the caller must generate and append message receiving proof to the batch transaction
to actually send it (along with required header) to the node.
If function has returned None
, it means that the caller now must wait for the
appearance of the target header id
at the source client.