Move substrate-bridge-relay into repository (#1)

* Initial commit. CLI which parses RPC urls.

* Establish ws connections and make simple RPC requests.

* Complete bridge setup.

* Process subscription events.

* Ctrl-C handler.

* Write a bare-bones README and copy in design doc.

* Modularize code a little bit.

* Communicate with each chain in a separate task.

* Parse headers from RPC subscription notifications.

* Send (fake) extrinsics across bridge channels.

And now it's deadlocked.

* Fix deadlock.

* Clarify in README that this is not-in-progress.

* Move everything into a single folder

* Move Substrate relay into appropriate folder

* Get the Substrate Relay node compiling

* Update Cargo.lock

* Use new composite accounts from Substrate

* Remove specification document

It has been moved to the Wiki on the Github repo.

* Update author + remove comments

* Use latest master for jsonrpsee

Required renaming some stuff (e.g Client -> RawClient)

Co-authored-by: Jim Posen <jim.posen@gmail.com>
This commit is contained in:
Hernando Castano
2020-03-02 12:20:23 -05:00
committed by Bastian Köcher
parent 7ef276daba
commit ebbc4724d0
8 changed files with 661 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
use futures::channel::mpsc;
#[derive(Debug, derive_more::Display)]
pub enum Error {
#[display(fmt = "invalid RPC URL: {}", _0)]
UrlError(String),
#[display(fmt = "RPC response indicates invalid chain state: {}", _0)]
InvalidChainState(String),
#[display(fmt = "could not make RPC call: {}", _0)]
RPCError(String),
#[display(fmt = "could not connect to RPC URL: {}", _0)]
WsConnectionError(String),
#[display(fmt = "unexpected client event from RPC URL {}: {:?}", _0, _1)]
UnexpectedClientEvent(String, String),
#[display(fmt = "serialization error: {}", _0)]
SerializationError(serde_json::error::Error),
#[display(fmt = "invalid event received from bridged chain: {}", _0)]
InvalidBridgeEvent(String),
#[display(fmt = "error sending over MPSC channel: {}", _0)]
ChannelError(mpsc::SendError),
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::SerializationError(err) => Some(err),
Error::ChannelError(err) => Some(err),
_ => None,
}
}
}