Skip to content

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
2 people authored and bkchr committed Apr 10, 2024
1 parent 7ef276d commit ebbc472
Show file tree
Hide file tree
Showing 8 changed files with 661 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bridges/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 bridges/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 bridges/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 ebbc472

Please sign in to comment.