Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Move substrate-bridge-relay into repository (#1)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
HCastano and jimpo committed Mar 2, 2020
1 parent 2d1bbc3 commit 907e9f8
Show file tree
Hide file tree
Showing 10 changed files with 1,627 additions and 46 deletions.
1,011 changes: 965 additions & 46 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
members = [
"modules/substrate",
"modules/ethereum",
"relays/substrate",
]
3 changes: 3 additions & 0 deletions modules/substrate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,9 @@ mod tests {
type MaximumBlockLength = ();
type Version = ();
type ModuleToIndex = ();
type AccountData = ();
type OnNewAccount = ();
type OnReapAccount = ();
}

impl Trait for Test {}
Expand Down
20 changes: 20 additions & 0 deletions relays/substrate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "substrate-bridge"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
async-std = "1.0.1"
clap = "2.3.3"
ctrlc = "3.1.3"
derive_more = "0.99.1"
env_logger = "0.7.1"
futures = "0.3.1"
jsonrpsee = { git = "https://github.com/paritytech/jsonrpsee", features = ["ws"] }
log = "0.4.8"
node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate" }
serde_json = "1.0.41"
sp-core = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git" }
sp-rpc = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git" }
url = "2.1.0"
32 changes: 32 additions & 0 deletions relays/substrate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Substrate-to-Substrate Bridge Relay

The bridge relay is a process that connects to running Substrate nodes and sends data over the Substrate-to-Substrate bridge. The process communicates with the nodes over the JSON-RPC interface and reads data from the relays information required by the `bridge` pallet using runtime calls and writes data to the modules by constructing and submitting extrinsics.

For more details, see the [design document](doc/design.md).

## Status

This is a not-in-progress prototype.

## Running in development

Run two development Substrate chains:

```bash
> TMPDIR=(mktemp -d)
> cd $TMPDIR
> substrate build-spec --dev > red-spec.json
> cp red-spec.json blue-spec.json
# Modify the chain spec in an editor so that the genesis hashes of the two chains differ.
# For example, double one of the balances in '$.genesis.runtime.balances.balances'.
> substrate --chain red-spec.json --alice --base-path ./red --port 30343 --ws-port 9954
> substrate --chain blue-spec.json --alice --base-path ./blue --port 30353 --ws-port 9964
```

Now run the bridge relay:

```
> target/release/substrate-bridge --base-path ./relay \
--rpc-url ws://localhost:9954 \
--rpc-url ws://localhost:9964
```
Loading

0 comments on commit 907e9f8

Please sign in to comment.