;
}
@@ -81,7 +81,7 @@ pub type TransactionOf = <
::Block as SourceBlo
pub type TransactionHashOf
= as SourceTransaction>::Hash;
/// Header id.
-pub type HeaderId = crate::sync_types::HeaderId, BlockNumberOf>;
+pub type HeaderId
= crate::utils::HeaderId, BlockNumberOf>;
/// Source client API.
#[async_trait]
@@ -443,7 +443,7 @@ async fn wait_header_finalized(
#[cfg(test)]
pub(crate) mod tests {
use super::*;
- use crate::sync_types::HeaderId;
+ use crate::utils::HeaderId;
use parking_lot::Mutex;
use std::{
diff --git a/bridges/relays/ethereum/src/headers.rs b/bridges/relays/ethereum/src/headers.rs
index 63c8e07351..991d935548 100644
--- a/bridges/relays/ethereum/src/headers.rs
+++ b/bridges/relays/ethereum/src/headers.rs
@@ -14,7 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see .
-use crate::sync_types::{HeaderId, HeaderIdOf, HeaderStatus, HeadersSyncPipeline, QueuedHeader, SourceHeader};
+use crate::sync_types::{HeaderIdOf, HeaderStatus, HeadersSyncPipeline, QueuedHeader, SourceHeader};
+use crate::utils::HeaderId;
+
use linked_hash_map::LinkedHashMap;
use num_traits::{One, Zero};
use std::{
@@ -777,7 +779,7 @@ fn queued_incomplete_header(
pub(crate) mod tests {
use super::*;
use crate::ethereum_types::{EthereumHeaderId, EthereumHeadersSyncPipeline, Header, H256};
- use crate::sync_types::{HeaderId, QueuedHeader};
+ use crate::sync_types::QueuedHeader;
pub(crate) fn header(number: u64) -> QueuedHeader {
QueuedHeader::new(Header {
diff --git a/bridges/relays/ethereum/src/main.rs b/bridges/relays/ethereum/src/main.rs
index a842c2b559..82dfb08209 100644
--- a/bridges/relays/ethereum/src/main.rs
+++ b/bridges/relays/ethereum/src/main.rs
@@ -27,6 +27,10 @@ mod exchange_loop;
mod exchange_loop_metrics;
mod headers;
mod instances;
+mod message_lane;
+mod message_lane_loop;
+mod message_race_delivery;
+mod message_race_loop;
mod metrics;
mod rpc;
mod rpc_errors;
diff --git a/bridges/relays/ethereum/src/message_lane.rs b/bridges/relays/ethereum/src/message_lane.rs
new file mode 100644
index 0000000000..7ca8d2e9fb
--- /dev/null
+++ b/bridges/relays/ethereum/src/message_lane.rs
@@ -0,0 +1,55 @@
+// Copyright 2019-2020 Parity Technologies (UK) Ltd.
+// This file is part of Parity Bridges Common.
+
+// Parity Bridges Common is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity Bridges Common is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity Bridges Common. If not, see .
+
+//! One-way message lane types. Within single one-way lane we have three 'races' where we try to:
+//!
+//! 1) relay new messages from source to target node;
+//! 2) relay proof-of-receiving from target to source node;
+//! 3) relay proof-of-processing from target no source node.
+
+use crate::utils::HeaderId;
+
+use std::fmt::Debug;
+
+/// One-way message lane.
+pub trait MessageLane {
+ /// Name of the messages source.
+ const SOURCE_NAME: &'static str;
+ /// Name of the messages target.
+ const TARGET_NAME: &'static str;
+
+ /// Message nonce type.
+ type MessageNonce: Clone + Copy + Debug + Default + From + Ord + std::ops::Add