Commit Graph

98 Commits

Author SHA1 Message Date
Tomasz Drwięga 60c1c24784 Expose storage of finality-verifier pallets. (#844)
* Expose storage of finality-verifier pallets.

* Fix compilation.
2024-04-10 10:28:37 +02:00
Hernando Castano 8d122b03f1 Rename Finality Verifier and Call Dispatch Pallets (#838)
* Rename `pallet-finality-verifier` to `pallet-bridge-grandpa`

* Missed some CamelCase ones

* Update logging target in GRANDPA pallet

* Rename `pallet-bridge-call-dispatch` to `pallet-bridge-dispatch`

* Rename the dispatch pallet folder

* Update logging target in Dispatch pallet

* Missed a couple

* Format the repo

* Stop listing individual pallets in Compose logs

* Use correct pallet name in module doc comments

* Add `pallet-bridge-dispatch` to README project layout

* Sort crate names in TOML files

* Rename `pallet-bridge-grandpa` runtime Call alias
2024-04-10 10:28:37 +02:00
Tomasz Drwięga acb872fbb0 Flatten back the structure (#837)
* Remove chains.

* Move relay clients.

* Flatten generic.

* Fix fmt.
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 647eb80165 Westend->Millau headers relay in deployments (#831)
* reorganize monitoring

* Westend->Millau bridge

* support multiple bridges

* initialize Westend -> Millau bridge byMillau.George

* fix intersecting ports

* ignore dashboards

* single bridged network

* deal with multple --env-file args

* fix chain name

* use images from docker hub

* update show_help

* updated comment

* mount whole dashboards directory

* removed unneeded network

* reverted reverse-proxy changes

* prometheus -> targets

* separate Grafana.Dockerfile with builtin /etc/grafana

* Revert "separate Grafana.Dockerfile with builtin /etc/grafana"

This reverts commit 53e04c4556f882d19e3af0fac581a926b8e0c167.

* read dashboards from /etc/grafana/dashboards

* stop comment
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 4105575794 Rename pallet-message-lane into pallet-bridge-messages (#834)
* use runtime:: prefix for message-lane pallet traces

* renamed message-lane (module and primitives) folder into messages

* replace "message lane" with "messages" where appropriate
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 401d3847d1 Add multiplier parameter to transaction_payment function (#830)
* transaction_payment_without_multiplier -> transaction_payment

* tests

* fmt
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky d749bc3a96 Sync Westend to Millau (#824)
* make finality verifier pallet instantiable

* add second instance of finality verifier pallet to the Millau runtime

* add Westend -> Millau headers relay

* use wss to connect to public westend nodes

* initialize with best_finalized_block

* typo

* Revert "initialize with best_finalized_block"

This reverts commit 954ed2832372d67618abc1a06d47e66faa93f674.

* pass VoterSet by ref

* new bridge initialization code

* loop upper bound

* Polkadot -> Westend

* fixed tests compilation

* default-features

* assert
2024-04-10 10:28:37 +02:00
Hernando Castano d8852fd197 Clean Finality Verifier Pallet (#804)
* Remove unused Config types from `pallet-finality-verifier`

* Remove unused AncestryChecker trait

* Remove ancestry proof parameter from relayer calls

* Update docs to reflect current state of pallet

* Remove mock ancestry checker

* Remove unused error

* Write headers outside of function used for authority set changes

* Move justification verification into helper function

* Add documentation suggestions

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

* Clean up module level documentation a bit

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 84cd93f936 Add Westend & Rococo primitives (#808)
* Move chain primitives to a sub-folder.

* Update workspace members.

* Extract core parts of polkadot.

* cargo fmt --all

* Remove TODO.

* cargo fmt --all

* Fix crate names.

* Add to the latest API.

* cargo fmt --all

* Add nested lock files to ignore (generated during cargo fmt)

* Fix compilation.

* cargo fmt --all

* Fix ignore pattern.

* Address review comments.
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 8f11732bb9 Uniform git dependencies (Backport of substrate#2589) (#805)
* Make Substrate deps uniform

* Rest of the deps.

* Fix broken merge.

* Revert substrate.

* Fix tests

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 903018db3d Add Transaction Payment Custom RPC (#806)
* Transaction payment RPC.

* Add payment RuntimeApi to fix the build.

* cargo fmt --all
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 324e083cba Changed delivery and dispatch fee computation methods (#795)
* removed weight <-> fee mess

* updated documentation

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Hernando Castano f7c3bd4e08 Bump Substrate (#796)
* Bump Substrate to version used by Polkadot (`5f056830`)

* Use `log` crate for runtime logging

See https://github.com/paritytech/substrate/pull/8128/ for more info.

* Stop using return value from `execute_block`

* Update test weight
2024-04-10 10:28:37 +02:00
Tomasz Drwięga afb48a547e bridges: fix random_seed (#797)
Co-authored-by: André Silva <andrerfosilva@gmail.com>
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 56354c7d1a Bump serde from 1.0.123 to 1.0.124 (#801)
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.123 to 1.0.124.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.123...v1.0.124)

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

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky f87053c1cb Relay Millau && Rialto headers using (future) finality verifier API (#761)
* finality proofs relay

* SyncHeader::is_mandatory

* empty ancestry proof

* logs

* fixed submit condition

* fixed wrong split index

* tick comment

* recent_finality_proofs

* basic finality loop tests

* removed obsolete files

* rename files in substrate relay

* fmt

* clippy

* fixed TODOs

* clippy

* stop syncing if target node is out of sync

* more clippy

* more clippy

* Update relays/finality-relay/src/finality_loop.rs

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

* Update relays/finality-relay/src/finality_loop.rs

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

* Update relays/finality-relay/src/finality_loop.rs

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

* docs

* moved doc

* typo

* Update relays/finality-relay/src/finality_loop_tests.rs

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

* Update relays/finality-relay/src/finality_loop_tests.rs

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

* header_and_finality_proof_by_number -> header_and_finality_proof

* VecDeque isn't required (because of make_contiguous)

* fixed wrong expect

* Update relays/finality-relay/src/finality_loop.rs

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

* Update relays/substrate/src/rialto_headers_to_millau.rs

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

* Update relays/substrate/src/rialto_headers_to_millau.rs

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

* RialtoSyncHeader

* Update relays/finality-relay/src/finality_loop.rs

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

* Update relays/finality-relay/src/finality_loop.rs

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

* removed wrong comment

* Update relays/finality-relay/src/finality_loop.rs

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

* fix used runtime methods names

* fix for new jsonrpsee

* fix comment

* initialize finality verifier pallet

* fmt

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
Hernando Castano 6cfd87783e Unify Substrate Bridge Pallet with Finality Verifier (#783)
* Add relevant storage items from Substrate pallet

* Add function for importing finalized headers to storage

* Remove unused getter functions

* Add GenesisConfig to pallet

* Add initialization extrinsic

* Add operational extrinsic

* Get existing finality verifier tests compiling again

* Add tests for pallet initialization

* Add tests related to pallet's operational status

* Update tests which were using `pallet-substrate-bridge`

* Add tests related to header imports

* Use wrapper function when init-ing some tests

* Add prefix to tests related to rate limiter

* Fix failed compilation related to GenesisConfig

* Add some documentation

* Change some extrinsics to be Operational

* Add public interface to pallet

* Implement runtime APIs for finality-verifier pallet

* Justify use of `expect` when importing headers

* Reject headers with forced changes

* Add weight to initialize extrinsic

* Remove TODO which will be addressed later

* Move succesful import log to correct location

* Expand proof for when `best_finalized` is fetched

* Move check for newer finalized blocks earlier in pipeline

* Rename `ConflictingFork` error to be more generic

* Only compute finality_target's hash once

* Add missing documentation to Runtime APIs

* Add TODO about using `set_id` from `ScheduledChange` digest
2024-04-10 10:28:37 +02:00
Hernando Castano f1553e3de9 Update Substrate Node build script (#786)
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Hernando Castano 658e4e9b5c Use No-Op Ancestry Checker (#755)
* Use no-op ancestry checker

* Check that current header height is greater than last finalized

* Ensure that incoming headers are strictly greater than last finalized

* Ensure that header numbers always increase in tests
2024-04-10 10:28:37 +02:00
Tomasz Drwięga c3d651d29a Add inspect command to take a look at extrinsics. (#762)
* Add inspect command to take a look at extrinsics.

* cargo fmt --all

* New weight for on-chain remark in tests

* Minor style tweaks.

Co-authored-by: adoerr <0xad@gmx.net>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 89b0f7beda verify ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT constant value (#731) 2024-04-10 10:28:37 +02:00
Tomasz Drwięga 82739314a8 Bump substrate in subtree import preparation. (#759) 2024-04-10 10:28:37 +02:00
Tomasz Drwięga 441c95ba2b Set weird substrate global state for custom SS58 prefixes (#754)
* Issue with SS58 decoding.

* Switch to test branch.

* Fix set.

* Revert "Switch to test branch."

This reverts commit d79e42ea9bc780edb20296dae546d534f1916fc7.

* cargo fmt --all

Co-authored-by: adoerr <0xad@gmx.net>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 1bf2eb1ab5 Message lane pallet parameters + updatable conversion rate (#728)
* message lane pallet parameters

* updated comment

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

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

* fmt

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Tomasz Drwięga e8b5a53eed Change SS58Prefixes (#739)
* Workaround for SS58Prefix issues in the UI.

* Change prefixes.

Co-authored-by: adoerr <0xad@gmx.net>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 90113303f1 Fix updated clippy grumbles (#733)
* Revert "Pin Rust Nightly to 2020-12-17 (#652)"

This reverts commit e54e6f7e3d34c28d698e637f9099162b3c1917e9.

* fix clippy

* clippy again

* more clippy in test code

* and new cargo fmt

* another try
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 7aa51f8d30 Update to latest substrate (#723)
* Bump substrate deps.

* Bump scale.

* Bump ethabi.

* Remove inherent from aura.

* Migrate to construct_runtime

* cargo fmt --all
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 32342bf6e5 remove lower limit of message weight (#727) 2024-04-10 10:28:37 +02:00
Hernando Castano d835233571 Finality Pallet Rate Limiter (#720)
* Add simple rate limiting mechanism

* Add tests

* Small test cleanup

* Hook MaxRequests into runtimes
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ca91d34059 limit number of pending messages at outbound lane (#715) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 2f457775bb Account proof size in weight formula (#679)
* fix broken message lane benchmarks

* proof-size related benchmarks

* impl Size for proof parameters

* include proof weight into weight formula

* left TODO

* fixed proof size

* WeightInfoExt::receive_messages_proof_weight

* charge for extra message bytes delivery in send_message

* removed default impl of WeightsInfoExt

* moved weight formulas to WeightInfoExt

* receive_messages_proof_outbound_lane_state_overhead is included twice in weight

* typo

* typo

* fixed TODO

* more asserts

* started wotk on message-lane documentation

* expected_extra_storage_proof_size() is actually expected in delivery confirmation tx

* update README.md

* ensure_able_to_receive_confirmation

* test rialto message lane weights

* removed TODO

* removed unnecessary trait requirements

* fixed arguments

* fix compilation

* decreased basic delivery tx weight

* fmt

* clippy

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

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

* structs

* Update primitives/millau/src/lib.rs

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

* removed readme.md

* removed obsolete trait bounds

* Revert "removed readme.md"

This reverts commit 50b7376a41687a94c27bf77565434be153f87ca1.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

* PreComputedSize

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
Hernando Castano fb7c191234 Stop Importing Full Header Chain (#707)
* Make AncestryProof type more flexible

* Only import single finalized header instead of a chain

* Fix unchecked header import tests

* Add option for limiting ancestry proof size

* Update finality verifier Config in runtimes

* Update some documentation

* Fix Clippy warning

* Allow AncestryChecker to return proof size

Stops us from abusing the `Size` trait

* Remove Size impl for Vec<T>

* Remove size contraints for ancestry proofs

With different proof types its unclear how to "size" should be interpreted,
so we remove this requirement all together to avoid confusion.
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 0344d8de84 Bump serde from 1.0.121 to 1.0.123 (#709) 2024-04-10 10:28:37 +02:00
Hernando Castano 8c7d0ca35d Wire Finality Verifier Pallet Into Runtimes (#696)
* Add Finality Verifier pallet to runtimes

* Implement simple ancestry checker

* Use the new checker in runtimes

* Remove unused import warning

* Bump max allowed ancestry proof size

* Add a few optimization suggestions when verifying ancestry

* Use session length as upper bound for ancestry proof size

* Remove unused time units
2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 277167face Bump serde from 1.0.118 to 1.0.121 (#674) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 8ee90afae6 Pre-dispatch call filter (#687)
* pre-dispatch call filter

* swap filter <-> weight

* clippy

* fmt
2024-04-10 10:28:37 +02:00
Hernando Castano ac1d12e607 Bump Substrate Dependency (#684)
* Bump Substrate to commit `0b0d124d5`

* Get Millau node compiling

* Get Rialto node compiling

* Increase account reference count before test

* Fix Clippy warnings for Millau node

* Fix Clippy warnings for Rialto node

* Trigger build.

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Hernando Castano e4f195d14c Make Account Derivation More Unique (#686)
* Use more unique prefix when generating account IDs

* Update derived addresses used in tests

* Make `account` prefix more unique

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

* Update test account IDs again

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky acee5580ca decode call after spec_version check (#663) 2024-04-10 10:28:37 +02:00
Andreas Doerr 926520292e Prevent potential signature reuse (#667)
* patch audit findings #42

* extend msg signature for substrate relay

* signature verification test

* make proof dependet on call_dispatch crate

* silence clippy

* revert deny exception

* address code review

* since it's not really a proof, call it digest
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 0f56f18778 Use real weights to compute message delivery and dispatch fee (#598)
* message fee formula

* update GetDelvieryConfirmationTransactionFee

* include cost of transactions (i.e. not only dispatch cost) in delivery_and_dispatch_fee

* endow relayers fund account

* include db ops weight in max tx weight estimation

* (in bytes)

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky fd7f2a45d8 Fixed messages count check (#659)
* fixed messages count check

* explicit check of `messages_count` in the receive_messages_proof

* change messages_count to be u32

* 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 f3ea6a8d3d Reward delivery confirmation transaction submitter (aka confirmation relayer) (#599)
* reward confirmation relayer

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

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

* added some constants

* pallet_balances

* removed comment

* fix typo

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 3ffeaade1c Expose message lane storage. (#642) 2024-04-10 10:28:37 +02:00
dependabot-preview[bot] 58fbd8cb49 Bump substrate & deps (#637) 2024-04-10 10:28:37 +02:00
Tomasz Drwięga 3f7107da10 Relayer rewards improvements (#624)
* Document relayers fund existence and add root account.

* Introduce initialize method instead of assuming that relayer_fund_account is always required.

* cargo fmt --all

* Fix benchmarks.

* cargo fmt --all

* Fix docs for the relayer fund account.
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 9fbb922766 Estimate message fee api (#600)
* estimate_message_delivery_and_dispatch_fee runtime API

* auto-determine message fees in relay

* remove fee argument from relay calls

* Fix import of weight contant

Co-authored-by: Hernando Castano <castano.ha@gmail.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 0624fd0d94 Update Substrate reference (#604) 2024-04-10 10:28:37 +02:00
Hernando Castano a6c3de51d3 Fixes for Polkadot Integration (#586)
* Add AccountIdConverter impl to Kusama and Polkadot primitives

* Add missing message lane config constants

* Add more consts

* Add another missing const

* Move consts in primitives so that they're consistent across files

* Move types and consts to more intuitive locations

* Downgrade hyper from v0.13.8 to v0.13.6

This conflicts with a requirement on the Polkadot side
which requires that hyper is =v0.13.6

* Update hyper to v0.13.9

* Update async-io to v1.3.1

* Update socket2 from v0.3.15 to v0.3.18

* Update message weight/size constants

* Make BlockWeights/Length parameter types

Allows us to re-use these types from both the runtime and
the message lane config files without creating a new instance
of them.

* Remove uneccesary weight constants

These can be found in the `runtime-common` crate used
by Polkadot/Kusama. The constants there will also be
the most up-to-date versions.
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky e5f6e309a6 Automated weights for message lane module (#590)
* automated weights

* associated WeightInfo type

* update weights using wasmtime

* disable clippy for autogenerated weight.rs

* fix
2024-04-10 10:28:37 +02:00