Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion relays/client-substrate/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub trait Chain: ChainBase + Clone {
/// Block type.
type SignedBlock: Member + Serialize + DeserializeOwned + BlockWithJustification<Self::Header>;
/// The aggregated `Call` type.
type Call: Clone + Codec + Debug + Send;
type Call: Clone + Codec + Debug + Send + Sync;
}

/// Substrate-based relay chain that supports parachains.
Expand Down
2 changes: 1 addition & 1 deletion relays/lib-substrate-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl<AccountId> TaggedAccount<AccountId> {
}

/// Batch call builder.
pub trait BatchCallBuilder<Call>: Clone + Send {
pub trait BatchCallBuilder<Call>: Clone + Send + Sync {
/// Create batch call from given calls vector.
fn build_batch_call(&self, _calls: Vec<Call>) -> Call;
}
Expand Down
1 change: 1 addition & 0 deletions relays/messages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
[dependencies]
async-std = { version = "1.6.5", features = ["attributes"] }
async-trait = "0.1"
env_logger = "0.10"
futures = "0.3.28"
hex = "0.4"
log = "0.4.17"
Expand Down
30 changes: 23 additions & 7 deletions relays/messages/src/message_lane_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub struct NoncesSubmitArtifacts<T> {

/// Batch transaction that already submit some headers and needs to be extended with
/// messages/delivery proof before sending.
pub trait BatchTransaction<HeaderId>: Debug + Send {
pub trait BatchTransaction<HeaderId>: Debug + Send + Sync {
/// Header that was required in the original call and which is bundled within this
/// batch transaction.
fn required_header_id(&self) -> HeaderId;
Expand Down Expand Up @@ -622,22 +622,38 @@ pub(crate) mod tests {
}

impl TestClientData {
fn receive_messages(&mut self, proof: TestMessagesProof) {
fn receive_messages(
&mut self,
maybe_batch_tx: Option<TestMessagesBatchTransaction>,
proof: TestMessagesProof,
) {
self.target_state.best_self =
HeaderId(self.target_state.best_self.0 + 1, self.target_state.best_self.1 + 1);
self.target_state.best_finalized_self = self.target_state.best_self;
self.target_latest_received_nonce = *proof.0.end();
if let Some(maybe_batch_tx) = maybe_batch_tx {
self.target_state.best_finalized_peer_at_best_self =
Some(maybe_batch_tx.required_header_id());
}
if let Some(target_latest_confirmed_received_nonce) = proof.1 {
self.target_latest_confirmed_received_nonce =
target_latest_confirmed_received_nonce;
}
self.submitted_messages_proofs.push(proof);
}

fn receive_messages_delivery_proof(&mut self, proof: TestMessagesReceivingProof) {
fn receive_messages_delivery_proof(
&mut self,
maybe_batch_tx: Option<TestConfirmationBatchTransaction>,
proof: TestMessagesReceivingProof,
) {
self.source_state.best_self =
HeaderId(self.source_state.best_self.0 + 1, self.source_state.best_self.1 + 1);
self.source_state.best_finalized_self = self.source_state.best_self;
if let Some(maybe_batch_tx) = maybe_batch_tx {
self.source_state.best_finalized_peer_at_best_self =
Some(maybe_batch_tx.required_header_id());
}
self.submitted_messages_receiving_proofs.push(proof);
self.source_latest_confirmed_received_nonce = proof;
}
Expand Down Expand Up @@ -760,13 +776,13 @@ pub(crate) mod tests {

async fn submit_messages_receiving_proof(
&self,
_maybe_batch_tx: Option<Self::BatchTransaction>,
maybe_batch_tx: Option<Self::BatchTransaction>,
_generated_at_block: TargetHeaderIdOf<TestMessageLane>,
proof: TestMessagesReceivingProof,
) -> Result<Self::TransactionTracker, TestError> {
let mut data = self.data.lock();
(self.tick)(&mut data);
data.receive_messages_delivery_proof(proof);
data.receive_messages_delivery_proof(maybe_batch_tx, proof);
(self.post_tick)(&mut data);
Ok(TestTransactionTracker(data.source_tracked_transaction_status))
}
Expand Down Expand Up @@ -885,7 +901,7 @@ pub(crate) mod tests {

async fn submit_messages_proof(
&self,
_maybe_batch_tx: Option<Self::BatchTransaction>,
maybe_batch_tx: Option<Self::BatchTransaction>,
_generated_at_header: SourceHeaderIdOf<TestMessageLane>,
nonces: RangeInclusive<MessageNonce>,
proof: TestMessagesProof,
Expand All @@ -895,7 +911,7 @@ pub(crate) mod tests {
if data.is_target_fails {
return Err(TestError)
}
data.receive_messages(proof);
data.receive_messages(maybe_batch_tx, proof);
(self.post_tick)(&mut data);
Ok(NoncesSubmitArtifacts {
nonces,
Expand Down
Loading