Commit Graph

15760 Commits

Author SHA1 Message Date
Svyatoslav Nikolsky 6df0341064 extract ShiftSessionManager into separate pallet (#342) 2024-04-10 10:28:37 +02:00
Tomasz Drwięga 858940050a Initial version of Call::decode dispatch. (#300)
* Initial version of call dispatch.

* cargo fmt --all

* Remove unused stuff.

* cargo fmt --all

* weight is part of msg + events

* should_fail_on_weight_mismatch

* plug into runtime

* cargo fmt --all

* fix benchmarks compilation?

* expected/actual values in events

* return actual weight from MessageDispatch::dispatch()

* MessageOrigin -> InstanceId + move bridge_account_id to bp-runtime

* fix benchmarks again

* cargo fmt --all

* clippy

Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky c7437c7d91 Custom RPC methods for DummyOrdered pallet (#317)
* RPC for DummyOrdered

* add test for RPC

* proof returned by RPC is Vec<<Vec<u8>>>.encode()

* retrieval -> receiving

* bp-runtime crate

* bp-runtime supports no_std

* cargo fmt --all

* jsonrpc_core::BoxFuture

* Update modules/message-lane/rpc/Cargo.toml

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update modules/message-lane/rpc/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* messageLane_ prefix for RPC methods

* Update primitives/runtime/Cargo.toml

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update primitives/runtime/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update modules/message-lane/rpc/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update modules/message-lane/rpc/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update modules/message-lane/rpc/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky f6d45a38da Initial version of DummyOrdered pallet (#299)
* initial commit of DummyOrdered (aka message-lane) pallet

* API for relay

* cargo fmt --all

* some clippy + no_std

* more clippy + no_std

* inbound lane tests

* outbound lane tests

* cargo fmt --all

* prune old messages whenever outbound lane is updated

* do not care about MessageNonce overflow

* cargo fmt --all

* update crate docs

* MaxHeadersToPruneAtOnce -> MaxMessagesToPruneAtOnce

* MessageAction -> MessageResult

* cargo fmt --all

* fire MessageAccepted + MessagesDelivered

* confirm message processing

* cargo fmt --all

* clippy

* cargo fmt again

* Update modules/message-lane/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update modules/message-lane/src/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* use crate::*

* cargo fmt --all

* Storage -> S

* Update modules/message-lane/src/outbound_lane.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* add method doc

* Update modules/message-lane/src/inbound_lane.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* added detailed module docs

* Update modules/message-lane/src/lib.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* updated OnMessageReceived docs

* prune only when new message is sent

* removed #![warn(missing_docs)]

* fixed merge with overlapped PR

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 5e86447d3e Bump structopt from 0.3.16 to 0.3.17 (#330) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 112e60439a Bump async-trait from 0.1.38 to 0.1.40 (#329) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 933a8e9252 Bump async-trait from 0.1.37 to 0.1.38 (#306)
Bumps [async-trait](https://github.com/dtolnay/async-trait) from 0.1.37 to 0.1.38.
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.37...0.1.38)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky b7cb0623d4 Update substrate reference to rc6 (#321)
* update substrate to rc6

* clippy

* fixed benchmarks compilation

* Update bin/node/node/src/service.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky aa90d16832 Fix (workaround) for "cannot read property 'toFixed' of null" (#297)
* fix (workaround) for NaN CPU usage

* cargo fmt --all
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 1823923a79 Remove errors from log (#294)
* changed log level from error to trace

* incomplete during submit != synced
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky b2c3238501 MAX_SUBMITTED_HEADERS = 4 (#293) 2024-04-10 10:28:37 +02:00
Hernando Castano 0f38601252 Remove old Substrate pallet (#292) 2024-04-10 10:28:37 +02:00
Hernando Castano 29244ba76d Introduce Minimal Header Chain: Proving Interface (#287)
* Add header-chain primitive crate

* Make MinimalHeaderChain functionaly the same as PeerBlockchain

* Use a better doc comment for MinimalHeaderChain

* Fix benchmark compilation

* Rust Fmt

* Remove Substrate based dependencies

* Rename MinimalHeaderChain to BaseHeaderChain
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky a0555d8118 Parse all deploy contract arguments (#289)
* parse all deploy contract arguments

* cargo fmt --all
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 7a71279ab8 Update open ethereum. (#290)
* Update open ethereum.

* Remove extra line break.

* Remove branch comment.
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 4ddb8b1e7a Bump clap from 2.33.2 to 2.33.3 (#284) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 49bbcae637 Bump serde from 1.0.114 to 1.0.115 (#282) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 0900573706 Bump async-trait from 0.1.36 to 0.1.37 (#283) 2024-04-10 10:28:37 +02:00
Hernando Castano accdc454ec Add instructions and scripts for local development (#280)
* Add dev deployment profile with Ethereum PoA config

* Add scripts for running local components

* Use `openethereum` folder

* Add local development instructions in README

* Add note about clone location

* Point to right folder for scripts

* Add some missing back-ticks

* Remove Bertha and Carlos as authorities

* Fix a line length issue
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 761882e06b Bump clap from 2.33.1 to 2.33.2 (#279) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 4545931e02 Bump async-stream from 0.2.1 to 0.3.0 (#278) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 94192aec3b Bump structopt from 0.3.15 to 0.3.16 (#277) 2024-04-10 10:28:37 +02:00
Hernando Castano acb78b0595 Fix panic when no instance is passed to certain CLI options (#275) 2024-04-10 10:28:37 +02:00
Hernando Castano 9f6bd28384 Rename Primitive Crates (#271)
* Rename Ethereum PoA primitives crate

The "sp" prefix comes from Substrate primitives, since this crate originated
in that repo. However, it is not part of Substrate anymore and its name should
be updated to reflect that.

* Rename currency exchange primitives

* Rust Fmt

* Update import in benchmarking module

* Rust Fmt

* Split pub and no-pub

* Sort toml files.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 868814e4b6 Prepare for sub to eth relay - part2 (#253)
* fixed PoA contract deploy (granda_authorities call)

* pause if all submitted headers were rejected

* give funds to Bertha and Carlos

* max 1 active PoA transaction in headers sync :(

* display initial header id when deploying PoA contract

* cargo fmt + clipy

* update PoA contract to accept <= 4 Substrate headers at once

* pause submitting headers when contract rejects all new headers + we have active transactions

* fix compilation

* cargo fmt --all

* does_not_select_new_headers_to_submit_when_submit_is_paused

* updated bridge contract

* Update relays/ethereum/src/sync.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* WiP.

* Submit first incomplete header.

* Finish up test.

* cargo fmt --all

* Remove redundant clone.

* Address review comments.

* cargo fmt --all

* Fix clippy.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Hernando Castano 7f8360d8ab Support Pallet Instances in Relay (#238)
* Sketch out how to support different bridge pallet instances

* Create a common interface for using pallet instances

* Start introducing generic instance parameter

Attemps to make the compiler happy, but I'm having second thoughts about
this approach. Commiting now as a way to have a checkpoint, but I think
I'm going to need to re-consider my approach here.

Ideally I want a change which introduces minimal changes, but this seems
to be propagating around the codebase in ways I don't want.

* Use trait objects instead of generics

* Implement traits for Boxed trait objects

This is done in order to statisfy trait bounds by types
which use these new trait objects

* Remove Clone usage for sync parameters

* Remove implementation of Default for sync params

* Require that BridgeInstance implements Debug

* Ensure that BridgeInstance trait implements Send/Sync

* Add documentation related to instances

* Rust Fmt

* Remove needless format

* Make instance CLI option case insensitive

* Replace `with_*` constructors with `new`

* Clean up usage of instance structs

* Enforce a default instance in the CLI params

* Build sync params as we process input from CLI

* Remove case insensitivity from sub-tx-mode

I think this should happen, but maybe as part of a different PR

* Process default Eth contract deployment config in CLI

* Build EthereumExchangeParams in CLI

* Process EthereumExchangeSubmitParams params in CLI
2024-04-10 10:28:37 +02:00
Hernando Castano 6fd1651b21 Bump Substrate to RC5 (#243)
* Bump Substrate to rc5

* Bump async-std to v1.6.2

There was a bug in v.1.6.0 which kept us locked to v1.5 releases.
I think that's fixed now so I'm bumping this.

* Update bridge node runtime

* Update node service

* Update CLI

* Add SystemWeightInfo type to test runtimes

* Add RPC extension builder to service

* Directly return rpc_extensions_builder

* Allow complex types in service

This comes from Substrate, so I'd rather just keep the code as is

* Update benchmarking code for new CLI
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 80cc9e793e Fix gas_used fields in receipts (#261)
* gas_used should be cumulative_gas_used!!!

* more runtime traces

* improve logs
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky e665f93608 Add traces to PoA builtin (#258)
* replace debug printlns with traces

* cargo fmt --all

* fixed traces

* update RUST_LOG in docker-compose

* only print hex data if error has occured

* updated OE hash
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky b98b7d2e43 Prepare for sub to eth relay (#248)
* fixed PoA contract deploy (granda_authorities call)

* pause if all submitted headers were rejected

* give funds to Bertha and Carlos

* max 1 active PoA transaction in headers sync :(

* display initial header id when deploying PoA contract

* cargo fmt + clipy

* fix compilation

* Update relays/ethereum/src/sync_types.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/utils.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky fddfbb5b1c Submit exchange transactions to PoA node (#229)
* submit Eth exchange transactions

* submit ethereum in docker-compose

* submit Eth exchange transactions

* fix duplicate message

* fix relay script

* lost file

* cargo fmt --all

* cargo +nightly clippy

* Show sccache

* remove test-helpers remains

* what's going on with jsonrpsee + Cargo.lock?

* relay-eth-submit-exchange-tx -> poa-exchange-tx-generator

* Update relays/ethereum/src/main.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* configuring exchange-gen loop using env variables

* fixed signer account from dev chain to Arthur

* improve debug prints

* parse nonce from relay output

* --eth-nonce=

* fix compilation

* cargo fmt --all

* fix typo

* duplicate relay output to tty

* allow using from bash scripts tests

* fix: U256::parse() expects hex string :/

* cargo fmt --all

* BRIDGE_HASH: ${BRIDGE_HASH:-master}

* script comment

* generate exchange PoA transactions by Bertha

* Bertha address

Co-authored-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Tomasz Drwięga d3f6948050 Remove substrate relay. (#244) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 8456d0d969 Exchange transactions relay dashboard (#241)
* update dashboards

* cargo fmt --all

* Update deployments/rialto/dashboard/prometheus/prometheus.yml

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ae88e86d6d fixed method name (#239) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 0be27839bc Auto exchange transactions relay metrics (#237)
* auto exchange tx relay dashboard

* cargo fmt --all

* single metrics startup fn
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 156ec9862f Make transactions receipts part of transaction inclusion proof (#236)
* make receipts part of tx proof

* is_successful_raw_receipt_with_empty_data

* cargo fmt --all

* clippy

* fix everything
2024-04-10 10:28:37 +02:00
Hernando Castano 70135cb797 Fix Local Dockerfile Entrypoint (#233)
* Correctly resolve project in Dockerfile entrypoint

* Improve instruction for running local Docker containers

* Rename bridge entrypoint script
2024-04-10 10:28:37 +02:00
Hernando Castano 30844b1e9c Allow Multiple Bridge Pallet Instances (#226)
* Add Instance type parameter to pallet

* Sketch out what the runtime could look like

* Allow runtime to compile with multiple bridge pallets

* Cargo Fmt

* Allow an instance of a PoA chain to be used with currency-exchange

I specify that it's only _an instance_ instead of _instances_ since the currency-exchange
pallet does not support multiple instances itself. What this commit does is make it so
that the different instances of the PoA chains we currently have are compatible with the
currency-exchange pallet through the implementation of the PeerBlockchain trait.

* Add Instance type parameter to Currency Exchange pallet

* Wire up currency exchange intances in runtime

* Rust Fmt

* Show sccache

* Allow Eth pallet to use a default instance

* Use a default instance in Eth pallet tests

* Remove Rialto and Kovan feature flags

Through some discussions it has been decided that the `bridge-node` should, like
Substrate's `node-template`, be a showcase of the different pallets available in
a project. Because of this I've removed the feature flags for the Rialto and Kovan
networks in favour of having both of them included in the runtime.

* Update the chain_spec to use both Rialto and Kovan configs

* Update pallet level calls used by Substrate client

Allows the project to compile. However, it should be noted that in reality
we shouldn't be hardcoding the pallet we're calling.

* Allow currency-exchange pallet to use a default instance

* Support benchmarking an instance of the Eth pallet

* Update currency exchange benchmarks to work with instances

* Fix test helpers which now need a PoA instance

* Remove Actions for checking Rialto and Kovan features

* Add missing comments

* Update Runtime API string constants

* Add issue number for generic chain support in relay

* Add Runtime APIs for instances of the currency-exchange pallet

* Rust Fmt

Co-authored-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky c4424e5b73 Auto relay exchange transactions (#227)
* auto relay exchange transactions

* docker + auto-relay-tx

* clippy

* jsonrpsee in Cargo.lock ???

* fix tests compilation

* Show sccache

* mute clippy

* move

* Update relays/ethereum/src/exchange.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* finish comment

* (bool, String) -> StringifiedMaybeConnectionError

* Update deployments/rialto/docker-compose.yml

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Denis S. Soldatov aka General-Beck <general.beck@gmail.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 112eb86b8f Bump serde_json from 1.0.56 to 1.0.57 (#235) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 06236a37dd Bump sysinfo from 0.14.13 to 0.15.0 (#234) 2024-04-10 10:28:37 +02:00
Hernando Castano 663eb57323 Add Prometheus and Grafana to Docker Compose (#221)
* Add Prometheus and Grafana to Docker Compose

* Expose relay's Prometheus metrics port

* Use Docker network references intead of localhost

When you have containers on the same network they don't communicate
over localhost, they instead refer to their container names

* Move dashboard components into deployment folder

* Update folder structure for Grafana and Prometheus config files

The new folder structure more closely matches the expected defaults
by Grafana and Prometheus, which allows us to clean up the paths
in our docker-compose file a bit.

* Add documentation about Prometheus and Grafana

* Refer to Prometheus server instead of node
2024-04-10 10:28:37 +02:00
Tomasz Drwięga bdf6901ce2 Fix clippy suggestions. (#179)
* Fix clippy errors.

* Cargo fmt.

* Enable clippy checks.

* Create if does not exist.

* Fix warnings and enable sccache for clippy.

* chmod +x

* Revert and ignore errors.

* Update cancel-workflow-action.

* Fixes.

* Clippy fixes.

* Fix compilation.

* Fix new clippy warnings.

* fmt --all

* Fix the rest.

* fmt --all

* Conditional.

* Bump smallvec.

* Use separate cache dir for clippy to prevent races.

* Remove unused imports in tests

* Remove "useless conversion"

* Move clippy to main worfklow to avoid clashes.

* Fix clippy error.

* Fix remaning clippy errors.

* cargo fmt --all

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 65852944e3 Bump log from 0.4.8 to 0.4.11 (#224) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] fed1251030 Bump sysinfo from 0.13.4 to 0.14.13 (#225) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] f017b635a8 Bump hex-literal from 0.2.1 to 0.3.0 (#223) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 33b1780da8 Bump backoff from 0.1.6 to 0.2.1 (#222) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 8121b3f82b Relay dashboard (#191)
* expose metrics for Prometheus

* added preconfigured configs for Prometheus and Grafana

* metrics-related cli args

* fix compilation
2024-04-10 10:28:37 +02:00
Tomasz Drwięga bebb5e6035 Rialto test network setup (#163)
* Dockerfile for OpenEth.

* Add relayer dockerfile.

* Add docker-compose.

* Working on the relay.

* Bump a bunch of deps.

* Change relay branch.

* Running a 3-validators poa network.

* Add bridge nodes.

* Conditional compilation of bridge configs.

* Fix genesis hash.

* Disable features build.

* Disable empty steps.

* Work on sub2eth

* Add some logs.

* More logs.

* Fix compilation.

* Add chain-id parameter to relay.

* Unify bridge-hash.

* Update the hash.

* Ditch sub2eth for now.

* Add some docs & proxy configuration.

* Fixes.

* Fix remaining issues.

* Increase health timeout.

* Make sure to install curl for health monitoring.

* Fix kovan.

* Fix build.

* Create if does not exist.

* Fix benches.

* Revert CLI params requirements.

* cargo fmt --all

* Apply suggestions from code review

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Add some docs.

* Update BRIDGE_HASH to master

* Duplicate compose file.

* Rename testpoa to Rialto.

* Fix borked merge.

* Fix entrypoints to take arguments.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 00bd13f8cd Exchange pallet benchmarks (#158)
* exchange benchmarks: framework

* updated comment about tx size

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00