mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
add relayers_state param to the receive_messages_delivery_proof (#584)
This commit is contained in:
committed by
Bastian Köcher
parent
595481f02e
commit
043a008723
@@ -37,7 +37,7 @@ use sp_trie::StorageProof;
|
||||
use std::ops::RangeInclusive;
|
||||
|
||||
/// Message receiving proof returned by the target Substrate node.
|
||||
pub type SubstrateMessagesReceivingProof<C> = (HashOf<C>, StorageProof, LaneId);
|
||||
pub type SubstrateMessagesReceivingProof<C> = (UnrewardedRelayersState, (HashOf<C>, StorageProof, LaneId));
|
||||
|
||||
/// Substrate client as Substrate messages target.
|
||||
pub struct SubstrateMessagesTarget<C: Chain, P> {
|
||||
@@ -156,12 +156,13 @@ where
|
||||
&self,
|
||||
id: TargetHeaderIdOf<P>,
|
||||
) -> Result<(TargetHeaderIdOf<P>, P::MessagesReceivingProof), Self::Error> {
|
||||
let (id, relayers_state) = self.unrewarded_relayers_state(id).await?;
|
||||
let proof = self
|
||||
.client
|
||||
.prove_messages_delivery(self.instance, self.lane_id, id.1)
|
||||
.await?;
|
||||
let proof = (id.1, proof, self.lane_id);
|
||||
Ok((id, proof))
|
||||
Ok((id, (relayers_state, proof)))
|
||||
}
|
||||
|
||||
async fn submit_messages_proof(
|
||||
|
||||
@@ -59,9 +59,10 @@ impl SubstrateMessageLane for MillauMessagesToRialto {
|
||||
_generated_at_block: RialtoHeaderId,
|
||||
proof: <Self as MessageLane>::MessagesReceivingProof,
|
||||
) -> Result<Self::SourceSignedTransaction, SubstrateError> {
|
||||
let (relayers_state, proof) = proof;
|
||||
let account_id = self.source_sign.signer.public().as_array_ref().clone().into();
|
||||
let nonce = self.source_client.next_account_index(account_id).await?;
|
||||
let call = millau_runtime::MessageLaneCall::receive_messages_delivery_proof(proof).into();
|
||||
let call = millau_runtime::MessageLaneCall::receive_messages_delivery_proof(proof, relayers_state).into();
|
||||
let transaction = Millau::sign_transaction(&self.source_client, &self.source_sign.signer, nonce, call);
|
||||
Ok(transaction)
|
||||
}
|
||||
|
||||
@@ -59,9 +59,10 @@ impl SubstrateMessageLane for RialtoMessagesToMillau {
|
||||
_generated_at_block: MillauHeaderId,
|
||||
proof: <Self as MessageLane>::MessagesReceivingProof,
|
||||
) -> Result<Self::SourceSignedTransaction, SubstrateError> {
|
||||
let (relayers_state, proof) = proof;
|
||||
let account_id = self.source_sign.signer.public().as_array_ref().clone().into();
|
||||
let nonce = self.source_client.next_account_index(account_id).await?;
|
||||
let call = rialto_runtime::MessageLaneCall::receive_messages_delivery_proof(proof).into();
|
||||
let call = rialto_runtime::MessageLaneCall::receive_messages_delivery_proof(proof, relayers_state).into();
|
||||
let transaction = Rialto::sign_transaction(&self.source_client, &self.source_sign.signer, nonce, call);
|
||||
Ok(transaction)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user