Commit Graph

15847 Commits

Author SHA1 Message Date
Svyatoslav Nikolsky d2ab81340a Use best block state to craft message relay transactions (#499)
* use best block state to craft message relay transactions

* removed obsolete TODO

* Update relays/messages-relay/src/message_race_loop.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
dependabot-preview[bot] f88c71252a Bump async-trait from 0.1.41 to 0.1.42 (#524) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 580c8234f5 Bump env_logger from 0.8.1 to 0.8.2 (#523) 2024-04-10 10:28:37 +02:00
Tomasz Drwięga 667f26bfdb Fix cargo-deny. (#522)
* Fix cargo-deny.

* Update time crate.

* Fix time issues.
2024-04-10 10:28:37 +02:00
Hernando Castano e91cab68d4 Avoid Panic When Fetching Info Before Bridge is Initialized (#504)
* Allow bridge pallet to return no finalized headers

* Update Runtime APIs to optionally return best finalized header

* Update relay to handle optional best finalized headers

* Fix Clippy lints

* Return a dummy header instead of an Option

* Remove Option from runtime Apis

* Remove support for handling optional finalized headers in relay
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 595523106e Fixed outbound_lane_data_key (#516) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky db84f84333 Fixed message signed by relay (#515)
* fixed message that is signed by relay

* clippy
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 6dc267393a Use different chain primitives in Millau (#517) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 20fc30404a Fixed referenced balance in rialto_messages.rs (#509)
* fixed referenced balance in rialto_messages

* names

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 23f5f3cdd6 Limit messages weight in batch (#496)
* limit messages in the batch by weight/count

* fixed components compilation

* reverted obsolete parts of #469

* implement generated_messages_weights

* actually use computed weight in message proof

* fmt and clippy

* fixed TODO

* clippy

* Update relays/messages-relay/src/message_race_loop.rs

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

* add issue reference

* add assert message

* grumbles

* fmt

* reexport weight from bp-message-lane

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Hernando Castano e515f4fb62 Fixes for Millau-Rialto Deployment (#493)
* Expose two nodes publicly through brucke.link

* Use flags for GNU `sed` instead of BSD `sed`

* Update Substrate relay entrypoint scripts to initialize bridge

* Add Rialto to Millau relay to Compose deployment

* Stop initializing Rialto chain through chainspec

* Include logging for Substrate pallet

* Make Rialto to Millau entrypoint executable

* Use YAML references for relay components

* Use published Substrate Relay image

* Relay messages from Millau to Rialto

* Use Bob nodes to serve message lane

* Fix some port number issues for PoA-Rialto deployment

* Stop directly referencing `environment` anchor in nodes

* Add probable cause to relayer error message

* Edit monitoring config file in-place

* Add some sleep time between bridge init call and starting relays

* Expose grafana.

* Use Root key as bridge pallet owner

In our case that's going to be Alice since she's Root for our Dev
and Local chains.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 0e6d2b8913 Removed unused file (#498)
* removed unused file

* another unused file
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 8d4e004d61 Fix Typo in Relay CLI Subcommand Description (#497) 2024-04-10 10:28:37 +02:00
Hernando Castano c8e4d536a2 Remove Millau Genesis Config in Rialto Node (#494) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 0c38193af7 Relay subcommands to initialize substrate bridge pallet (#483)
* initialize substrate bridge from relay

* is_halted: false

* initialize using su instead of owner

* Fix wording in comments

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Hernando Castano 3f7655a056 Allow Substrate Pallet to be Halted (#485)
* Copy-Pasta owner and freezing code from `message-lane`

* Halt pallet if bridge hasn't been initialized

* Make owner optional in `message-lane` pallet

* Add `is_halted` to `InitializationData`

* Fix initialization tests

* Only allow pallet to be initialized once

* Add some logging around halting and ownership changes

* Remove `target` in debugging calls
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 6c0110c11e Bump async-std from 1.6.5 to 1.7.0 (#491) 2024-04-10 10:28:37 +02:00
Hernando Castano 184871525c Rework Compose Setup for Millau Deployment (#464)
* Rename `rialto` deployment to `eth-sub-bridge`

* Add base Compose configs for Rialto and Eth-PoA nodes

* Add new compose file for eth-sub deployment

* Rename bridge-nodes to rialto-nodes

* Update bootnode entries for Rialto nodes

* Remove new compose file since it was used for quick test

* Rename bridge nodes in entrypoint scripts

* Remove all nodes from Eth-Sub Compose file

The nodes should be getting pulled in from the new compose files.

* Remove TODO comment

* Rename nodes to networks

Reflects the fact that a set of nodes makes up a network.

* Add Compose file for Millau network nodes

* Enable logging for all Millau nodes

* Delete Rialto reserved peers file

* Rename `bridge-config` to `scripts`

* Add Compose file for Rialto-Millau bridge

* Move bridge deployments into `bridges` folder

* Drop `bridges` prefix from bridge deployments

* Rename folder that had scripts for working with binaries

* Move proxy configuration to common top level folder

* Make a top level `monitoring` folder

* Start updating deployment README

* More updates in the README

* Remove usage of Git overrides

* Remove scripts to run Eth<->Sub

I don't think these are used anymore

* Remove Github Docker build instructions from main README

* Add note about monitoring

* Update Millau state root

* Add script for running and updating Compose deployments

* Remove old update script

* Explain usage of `run` script

* Update Millau state_root again

* Remove repeated Prom image from Rialto-Millau bridge

* Quick fix to stop containers in `run` script

* Pin GrafanaMatrix Dockerfile to old commit

The latest master has some changes in how the application is run. We don't
want to update just yet so we're pinning to an old commit.

* Make Compose files use a project directory

The main consequence of this change is that all paths have to be specified
from the root of the `deployments` folder. However, this makes it so that
we can reuse components in different deployments, like the GranfaMatrix
Dockerfile which is shared by all bridges.

* Use `project-directory` when stopping and updating network

If we don't use the full Compose command which includes `project-directory`
not all the containers get cleaned up correctly.

* Update path in Bridge Dockerfile

* Correctly ignore `target` folders in Docker builds

* Wait for Rialto nodes before running relay

* Make `run` script a little less sketchy

* Clean up deployment README

* Remove stray line

* Have run script automatically change into correct directory

* Use PoA-to-Rialto instead of Eth-to-Sub in names

* Rename `eth-poa-sub` bridge deployment to `poa-rialto`

* Use /entrypoints volume for entrypoint scripts

* Be more consistent with relay service names

* Remove `docker-compose` prefix from network Compose files

* Add comment explaning Grafana Matrix commit

* Fix wording in README

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

* Cleanup unused line in README

* Add link to Slava's test scripts

* Remove uneccessary piping when `cd`-ing in `run.sh`

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 74a2359c04 Print progress of message races (#489)
* print message race progress

* fmt

* Update relays/messages-relay/src/message_race_loop.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 739fb655a8 Fixed block where proof is generated (#488)
* fixed block where proof is generated

* proof_is_generated_at_best_block_known_to_target_node
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 439c3e9a70 Fixed client used in headers maintain (#487)
* fixed client used in headers maintain

* fmt
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 2a6af69ff0 enable GrandpaRpcApi for Rialto (#486) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 20fea45d1f Verify messages proofs (#480)
* verify messages proofs

* fmt

* clippy

* grumbles
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 3d24a4e34e verify messages delivery proofs (#482) 2024-04-10 10:28:37 +02:00
Hernando Castano cac8319480 Allow Substrate Pallet to be Initialized via Dipatchable (#481)
* Add dispatchable for intializing pallet

* Add Polkadot JS types for Substrate bridge pallet

* Ensure Root is the only one that can initialize the pallet

* Add some tests

* Pack initialization data into struct

* Only allow pallet to be initialized once

* Use new initialization config in nodes

* Rename ScheduledChange in Ethereum pallet

We're renaming it to prevent clashes with Substrate bridge pallet type
of the same name. This is relevant when importing types to Polkadot JS
Apps.

* Move all Polkadot JS types into one file

* Appease Clippy
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky d4fc7bebdc Millau -> Rialto messages relay (#399)
* Millau messages -> Rialto relay

* prepare for custom race strategy of delivery race

* custom strategy for delivery race

* update TODOs

* add reference to issue 457

* impl reconnect

* clippy

* fix check in test

* fmt

* removed obsolete TODO

* fixed another TODOs

* fmt

* use MAX_UNCONFIRMED_MESSAGES_AT_INBOUND_LANE const from primitives

* Update relays/messages-relay/src/message_lane_loop.rs

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

* added SubstrateMessagesProof typedef

* fix test

* removed comment

* additional_proof_required -> ProofParameters

* typo

* multiline literal

* clippy

* fix typo

* and_then -> await

* update_source_latest_confirmed_nonce

* Update relays/messages-relay/src/message_race_delivery.rs

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

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
Svyatoslav Nikolsky 804ef55146 Move storage keys computation to the message-lane pallet (#478)
* compute required storage keys in the message-lane pallet

* Update modules/message-lane/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 2d7eacf6e2 Parse substrate message proof (#479)
* parse substrate message proof

* unfinalized_header
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky b0a5e75ff4 is_finalized_header - use is_finalized flag (#476) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 3e45356aad Rialto -> Millau headers relay (#477)
* Rialto -> Millau headers relay

* removed more constraints

* removed file from other PR

* Update primitives/rialto/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 b027c81266 Substrate relay guards (#470)
* substrate relay guards

* checked time condition

* ChainWithBalances

* removed obsolete comment

* Update relays/substrate-client/src/chain.rs

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

* trailing space

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky cc1da1bb39 Ability to halt/resume message-lane pallet (#472)
* halt/resume message-lane pallet

* fmt

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

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

* include weights in halt/resume operations

* remove trailing space

* set_owner

* Shorten doc comment length

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ef9357596f Return cumulative dispatch weight of messages from the messageLane_proveMessages (#469)
* implement OutboundLaneApi and InboundLaneApi for Millau /Rialto runtimes

* fixed typo
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 51f39c4427 Update jsonrpsee reference (#467)
* update Millau state_root

* update jsonrpsee reference
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky b99fa90edd SubmitMillauToRialtoMessage subcommand in substrate-relay (#460)
* substrate-relay::SubmitMillauToRialtoMessage

* typo

* Update relays/substrate/src/cli.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
Hernando Castano a6048bca59 Support Tracking Forks in Substrate Pallet (#409)
* Support multiple "best headers" from different forks

* Update the name of a test

* Add note about multiple scheduled changes

* Disallow multiple scheduled authority set changes

* Return multiple best headers from Runtime APIs

* Remove invalid test write-up

* Add some sketch-ups of test scenarios

* Clean up test scenarios

* Add module for testing forks

* Write headers to storage

* Add way to check expected outcome for header imports

* Add support for importing finality proofs

* Support importing headers which schedule changes

* Write out test scenario using new framework

* Map authority set changes across forks

Gets all the tests in the `forks` module passing

* Remove basic tests

These were used when working on the initial test helper

* Prevent multiple pending set changes on the same fork

* Remove old test which allowed imports past unfinalized header

* Ignore failing test (for now)

* Rewrite `if` comparison using `match` and `cmp`

Fixes Clippy warning: `comparison_chain`

* Add helper for writing test headers with default characteristics

* Fix test that checked authority set updates

* Make note about importing headers on different unfinalized fork

* Perform some cleanup on the fork module

* Fix Clippy complaints

* Provide list of unfinalized headers to Runtime APIs

* Add proofs to expect() calls

* Make tests the focus of the forks module

* Allow specific errors to be checked in fork tests

* Remove unused method

* Replace unreachable() statement with expect()

* Rename storage `unfinalized_headers() `to make its purpose more clear

* Update Runtime API name in relayer to match pallet

* Commit `unfinalized_headers` changes I forgot to add

* Rename ChainTipHeight to BestHeight

* Make schedule_next_set_change require a mutable reference

* Remove check for key when enacting authority set

We only expect to take the happy-path in the pallet anyways, so this check
to save ourselves the time spent decoding the entry isn't really used.

* Clear justification set when writing headers to storage

* Clarify why we only allow one set change per fork

* Change best_headers() to return HeaderIDs

Prevents us from returning full headers (which are more expensive to
get from storage) since we only care about header IDs (number, hash)
anyways.

* Fix Clippy complaint

* Make note about equivocations

* Use HeaderIds when returning incomplete headers

This change stops returning full headers which are more expensive
to get from storage than header Ids (number, hash) are. Clients likely
don't need the full header anyways which is why this change is fine.

* Introduce HeaderId type to reduce type complexity

* Add signal hash to storage during genesis config

* Return error instead of expect()-ing

* Fix Clippy lint about `ok_or` fn call

* Rename `forks` module to indicate that it's for testing

* Use `const` for `expect()` proofs

* Remove check that key exists before `kill`-ing value

Co-authored-by: Svyatoslav Nikolsky <svyatonik@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 74249a0896 Integrate message-lane module RPCs into Rialto/Millau nodes (#458)
* integrate message-lane RPCs into Millau and Rialto runtime

* fmt

* use instance in InboundLanes

* moved RialtoMessageLaneKeys/MillauMessageLaneKeys inside rpc_extensions_builder to ease Substrate refs update
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ddef170340 Actually use pinned nightly version when building runtimes (#465)
* try to fix build

* use pinned nightly for in stable
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 1b96e51679 Subscribe to justifications in Millau->Rialto headers sync (#394)
* maintain MillauHeadersToRialto sync by subscribing to Millau justifications

* more tracing in maintain

* Update relays/substrate/src/headers_maintain.rs

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

* Update relays/substrate/src/headers_maintain.rs

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

* -Please

* -TODO

* revert raise recursion limit

* updated comment

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky e2d9b6393d Integrate Rialto <-> Millau message lanes into Millau/Rialto runtimes (#386)
* millau -> rialto lanes integration

* extrace common message-lane integration types into bridge-runtime-common

* rialto_messages.rs in Millau runtime

* tests

* Update bin/rialto/runtime/src/millau_messages.rs

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

* RELAYER_INTEREST_PERCENT -> RELAYER_FEE_PERCENT

* Update bin/runtime-common/src/messages.rs

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

* estimate_message_dispatch_and_delivery_fee returns Result

* Update bin/rialto/runtime/src/millau_messages.rs

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

* Update bin/rialto/runtime/src/millau_messages.rs

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

* Update bin/rialto/runtime/src/millau_messages.rs

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

* fmt

* mowed weight formula to primitives

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 3738bc4277 Bump futures from 0.3.6 to 0.3.7 (#456) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 5accb2b339 InboundLaneApi::latest_confirmed_nonce (#429)
* InboundLaneApi::latest_confirmed_nonce

* Fix wording and typo

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky a37c1762dc (optionally) include outbound lane data into messages proof (#428) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky bff930d01e Reward relayers for dispatching messages (#385)
* reward relayers for dispatching messages

* clippy

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

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

* added comment

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

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

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

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

* SubmitterId + RelayerId -> AccountId

* add confirmation_relayer arg to pay_relayer_reward

* cargo fmt --all

* removed verify_and_decode_messages_proof from SourceHeaderChain

* &mut self -> RefCell

* Optimize max messages at inbound lane (#418)

* Add tests for checking messages above max limit

Signed-off-by: MaciejBaj <macie.baj@gmail.com>

* Extend the relayers entry of inbound lane by additional msg nonce

Signed-off-by: MaciejBaj <macie.baj@gmail.com>

* Support additional message nonce from inbound relayers

Signed-off-by: MaciejBaj <macie.baj@gmail.com>

* Code format

Signed-off-by: MaciejBaj <macie.baj@gmail.com>

* Merge messages range for highest relayers

* Change unwrap() to ensure() while accessing relayers

* Edit rustdocs for relayers deque at inbound lane data

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

* Declare additional relayers A & B and use across tests consistently

Signed-off-by: MaciejBaj <macie.baj@gmail.com>

* Remove duplicates and improve naming for inbound lane tests

* Fix test checking max limit per inbound lane

* Correct relayers rewards loop after a proof is received

* Remove redundant check for messages ahead of received range

* Correct grammar at inbound lane tests rustdocs

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

* Improve code quality of relayers updates 💅

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

* Test dispatches above max limit from same relayer

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

* Fix typo.

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Maciej Baj <macie.baj@gmail.com>
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] c42023269a Bump env_logger from 0.7.1 to 0.8.1 (#424) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] f10f09a565 Bump structopt from 0.3.19 to 0.3.20 (#425) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 31c90f1cae Bump serde_json from 1.0.58 to 1.0.59 (#426) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] bf51e1cc6e Bump serde from 1.0.116 to 1.0.117 (#427) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 7a03b709be Millau -> Rialto headers relay (#398)
* working-millau-to-rialto-relay

* fix Millau state root

* properly fix synced+incomplete headers for sub2sub

* removed wrong TODO

* fmt + clippy

* Update relays/headers-relay/src/headers.rs

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

* moved SubstrateTransactionMaker definition

* removed M from phantomdata

* removed prune_synced_children

* methods names as consts

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 55d22a0d1e connect to substrate using ws (#417) 2024-04-10 10:28:37 +02:00