Commit Graph

54 Commits

Author SHA1 Message Date
Svyatoslav Nikolsky c131a5e3c8 Send messages using xcm pallet (#1518)
* send messages using xcm pallet

* XcmBridge && XcmBridgeAdapter + (untested) config in RialtoParachain

* impl encode_send_xcm for the rest

* remove duplicate code

* some fixes

* cleanup

* some more tests

* cleanup

* cleanup

* send Rialto -> Millau messages using bridge-messages pallet

* fmt

* some clippy fixes

* more clippy
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ea1f46ff45 Add another condition to the reject-obsolete-parachain-heads extension (#1505)
* add another condition to the reject-obsolete-parachain-heads extension

* add tracing to obsolete-tx-extensions

* fix tests

* extension_rejects_header_from_new_relay_block_with_same_hash

* fmt

* fix benchmarks
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ceefd1b05d remove account derivation functions (#1498) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 4929493f83 backport named events PR (#1489) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 7d97e576d0 Remove without_storage_info for messages pallet (#1487)
* draft: remove without_storage_info for messages pallet

* some cleanup
2024-04-10 10:28:37 +02:00
Serban Iorga ec76490ddb Test pallet owner calls using macro
Define macro that generates tests for set_owner() and set_operating_mode()
in order to avoid duplicate code.

Signed-off-by: Serban Iorga <serban@parity.io>
2024-04-10 10:28:37 +02:00
Serban Iorga 6b67d6b262 Define const LOG_TARGET for bridge pallets
Signed-off-by: Serban Iorga <serban@parity.io>
2024-04-10 10:28:37 +02:00
Serban Iorga f8ff3c9142 Unify the operating mode for bridge pallets (#1483)
Unify the operating mode for bridge pallets

- define the OperationMode trait and BasicOperatingMode enum
- use the OperationMode trait in all the bridge pallets
- use BasicOperatingMode instead of IsHalted for the Grandpa pallet
- use BasicOperatingMode as part of MessagesOperatingMode

Signed-off-by: Serban Iorga <serban@parity.io>
2024-04-10 10:28:37 +02:00
Serban Iorga ff342fafa9 Avoid duplicate function definitions
Avoid duplicate function definitions for:
- ensure_owner_or_root()
- ensure_not_halted()
- set_owner()
- set_operating_mode() / set_operational()

Signed-off-by: Serban Iorga <serban@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 19c73ce0b7 Signed extension for rejecting obsolete messages pallet transactions (#1446)
* BridgeRejectObsoleteMessages

* add obsolete confirmations verification to the BridgeRejectObsoleteMessages

* move tests where they belong
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky f0d05de080 Get dispatch weight from the target chain (when DispatchFeePayment::AtTargetChain is used) (#1430)
* reintroduce From<SourceChain>InboundLaneApi

* impl From<Chain>InboundLaneApi for testnet runtimes

* use inboundlaneapi in relay

* remove unused OutboundXcmWeigher

* spelling

* added the only test to messages pallet

* fmt
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 748c265c47 Xcm in Rialto<>Millau bridge (#1379)
* add XCM pallet to Millau runtime

* some progress

* messages are delivered (no fee)

* temp

* flush

* flush

* some progress

* progress

* Trap(42) is dispatched successfully

* fix spelling

* no more manual sending

* parametrize weight credit for tests

* actually charge fees

* enable send-using-messages-pallet to keep our test deployments alive + send valid XCM sometimes

* fix benchmarks build

* fix tests
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky eb1e48edba pub use WeightInfo in Grandpa + Messsages pallets (#1370) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ed2a3082ef Support dedicated lanes for pallets (#962)
* pass call origin to the message verifier

* is_outbound_lane_enabled -> is_message_accepted

* trait SenderOrigin

* only accept messages from token swap pallet to token swap lane

* tests for edge cases of pay_delivery_and_dispatch_fee

* fixed origin verification

* fmt

* fix benchmarks compilation

* fix TODO with None account and non-zero message fee (already covered by tests)

* revert cargo fmt changes temporarily
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky f95456d4ea replace From<>InboundLaneApi with direct storage reads (#1348) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ea2d6f898d Bump Substrate/Polkadot/Cumulus refs (#1295)
Substrate: 31d90c202d6df9ce3837ee55587b604619a912ba
Polkadot: 60df3c55c711c2872872d6220f98b2611340e051
Cumulus: a9630551c2
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 25008a5166 when messages pallet is halted, relay shall not submit messages delivery/confirmation transactions (#1289) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 1d99ad3619 replace latest_confirmed_nonce runtime APIs with direct storage reads (#1282) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky a88207876c Replace InboundLaneApi::latest_received_nonce with direct storage read (#1269)
* remove inbound_latest_received_nonce

* Update relays/lib-substrate-relay/src/messages_target.rs

Co-authored-by: Adrian Catangiu <adrian@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 988f6b1664 remove OutboundLaneApi::latest_received_nonce (#1262) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 22b1e456ab move storage keys computation to primitivs (#1254) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky e23266c7e6 Bump dependencies (#1180)
* substrate: d0f6c1c60da22e04dd25c2eca46ebfe6f1571af0
polkadot: dd4b2e6a34a08a01b876d14641e99e7011be3463
cumulus: 9379cd6c18

* fmt

* fixed lost refs

* spelling

* benckhmarks

* fmt
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 4b525f4fe1 Token swap pallet benchmarks (#1174)
* token swap benchmarks

* spellcheck
2024-04-10 10:28:37 +02:00
bear f2092515a0 Move calculation relayer reward into MessageDeliveryAndDispatchPayment (#1153)
* Refactor logic

* Thanks svyatonik help, it compile

* Fix failed unit test

* Remove compile warning

* Rename

* Return result in pay_relayers_rewards

* Fix runtime compile issue

* Use MessageNonce

* Fix review issue

* Missing u64 replacement

* Revert return type changes

* Fix merge issue

* Remove useless clone
2024-04-10 10:28:37 +02:00
hacpy bd70de8b8b Match substrate's fmt (#1148)
* Alter gitlab.

* Use substrate's rustfmt.toml

* cargo +nightly fmt --all

* Fix spellcheck.

* cargo +nightly fmt --all

* format.

* Fix spellcheck and fmt

* fmt?

* Fix spellcheck

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 5dbf6ba78c Relay subcommand that performs token RLT <> MLAU token swap (#1141)
* token swap relay

* token swap subcommand fixes

* fmt

* removed debug traces

* removed commented code
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 2db84b74cc Polkadot <> Kusama relayers (#1122)
* relay headers between Kusama and Polkadot

* relay messages between Kusama and Polkadot

* complex Kusama <> Polkadot relayer

* expose relayer_fund_account_id from messages pallet

* create relayers fund accounts on Kusama/Polkadot + some more fixes

* fmt

* fix compilation

* compilation + clippy

* compilation

* MAXIMAL_BALANCE_DECREASE_PER_DAY for K<>P header relays

* fmt

* deduplicate tests

* Update modules/messages/src/lib.rs

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

* extract storage_parameter_key function

* other grumbles

* fix

* fmt

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
bear 417903f9e7 Add OnMessageAccepted callback (#1134)
* Add `OnMessageAccepted` config type

* Update actual weight

* Add unit test

* Update weight

* Remove old comment & update wrong test data

* Make ci happy

* Add lane_id param

* update test case

* Make log info more readable

* Use saturating_sub

* Update docs
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 24bd2d6c51 Integrate token swap pallet into Millau runtime (#1099)
* integrate token swap pallet into Millau runtime

* set OnDeliveryConfirmed callback in Millau runtime
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 6e3b083ab3 Fix spelling (#1118)
* I'm just trying to do my job

* spelling
2024-04-10 10:28:37 +02:00
Tomasz Drwięga 2101ed9cc5 Remove fund account checks from upgrade. (#1111) 2024-04-10 10:28:37 +02:00
bear e20163c4ea Rename param and update comment (#1108)
* Rename param in `confirm_delivery`

* Fix typo

* Update comment

* Fix review issue
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky fc9363619a [BREAKING] Migrate messages pallet to frame v2 (#1088)
* get rid of frame_support::traits::Instance usage in messaging

* migrate messages pallet to frame v2

* fix benchmarks

* remove dummy event + add Parameter to metadata

* review

* typo
2024-04-10 10:28:37 +02:00
Hector Bulgarini b1db3df199 Bridge/This Chain Ids should be exposed as constants on pallet level. (#1085)
* Adding BridgedChainId constant to message pallet

* Addressing PR feedback
2024-04-10 10:28:37 +02:00
Tomasz Waszczyk f86d101d7c Fix full spellcheck (#1076)
* fix(spellcheck): test of fixing

* fix(hunspell): improved many typos etc.

* fix(hunspell): all errors solved

* fix(hunspell): extended scope of files - the build should fail

* Return error code.

* Fix spelling, sort dictionary.

* fix(hunspell): added fix to gitlabs check

* fix(typo): one typo and test of verification on github

* fix(typo): one typo

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 4f7b0d3b19 merge two weight-related loops in messages pallet (#1071) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 712ccbb742 increase_message_fee depends on stored mesage size (#1066) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 31828783ab refund weight for mot pruning messages (#1062) 2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 2e50bf8fb1 Confirm delivery detects when more than expected messages are confirmed (#1039)
* confirm delivery detects when more than expected messages are confirmed

* fix benchmarks compilation
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky dfdd541bc9 pre and post dispatch weights of OnDeliveryConfirmed callback (#1040)
* pre and post dispatch weights of OnDeliveryConfirmed callback

* Update modules/messages/README.md

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

* clippy + compilation

* fix test issue from parallel PR

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 165730a2c2 Rococo <> Wococo messages relay (#1030)
* MessagesInstance -> BridgedMessagesInstance

* Chain::ID -> Bridge::THIS_CHAIN_ID+Bridge::BRIDGED_CHAIN_ID

* FromBridgedChainEncodedMessageCall<B> -> FromBridgedChainEncodedMessageCall<DecodedCall>

* impl Parameter for ()

* copypaste storage_map_final_key to avoid different runtime references/dummy runtimes

* moved dummy runtime from primitives to relay client

* Rococo <> Wococo messages relays

* send R<>W messages using relay

* fmt

* return Result from get_dispatch_info

* fix benchmarks compilation

* clippy
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ee43a560f8 Relay basic single-bit message dispatch results back to the source chain (#935)
* relay dispatch result flags back to the source chain

* OnMessagesDelivered callback

* add lane id to OnDeliveredMessages callback

* fix benchmarks && upate weights

* clippy

* clippy

* clipy another try

* OnMessagesDelivered -> OnDeliveryConfirmed

* Update primitives/messages/src/source_chain.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 20b7f341e1 pay dispatch fee at target chain (#911)
* pay dispatch fee at target chain

* refund unspent dispatch weight to messages relayer

* test that transfer actually happens

* pay-at-target-cchain benchmarks + fix previous benchmarks (invalid signature)

* include/exclude pay-dispatch-fee weight from delivery_and_dispatch_fee/delivery tx cost

* remvoe some redundant traces

* enum DispatchFeePayment {}

* typo

* update docs

* (revert removal of valid check)

* Update modules/messages/src/benchmarking.rs

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

* Update modules/messages/src/benchmarking.rs

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

* Update modules/messages/src/benchmarking.rs

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

* Update modules/messages/src/benchmarking.rs

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

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Hernando Castano 613803a15d Bump Substrate to 286d7ce (#1006)
* Bump dependencies

- Substrate to `74a1bfdcc`
- `finality-grandpa` to `0.14.1`
- `fs-swap` to `0.2.6`

* Add `pallet_randomness_collective_flip` to runtimes

* Rename GenesisConfig fields

See Substrate PR: https://github.com/paritytech/substrate/pull/8990

* Missed PoA renames in Rialto GenesisConfig

* Use `spawn_essential_handle` for transaction pool

See Substrate PR: https://github.com/paritytech/substrate/pull/9074
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky ec8412b6d0 rename messages_dispatch_weight -> message_details (#996)
Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Svyatoslav Nikolsky 41b65c28cf Flag for rejecting all outbound messages (#982)
* flag for rejecting all outbound messages

* update weights

* Revert "update weights"

This reverts commit 992b866edc7c9fd97013cee9cd68b9d783f8681e.

* Revert "flag for rejecting all outbound messages"

This reverts commit d094964bb4f8800ab6978b9d4b12aade2f80d266.

* OperatingMode

* Update modules/messages/src/lib.rs

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

* Poke CI

* RustFmt

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Hernando Castano <hernando@hcastano.com>
2024-04-10 10:28:37 +02:00
Denis Pisarev 0b7f40a371 Move CI from GitHub Actions to GitLab (#814)
* CI: do not trust this CI 1

* CI: don't want to trigger unneded statuses

* CI: debug 1

* CI: new CI

* CI: temp allow failure

* CI: exclude paths

* doc: check if docs won't trigger pipelines

* doc: check hybrid changes pipeline

* doc: do not push excluded files together with others

* CI: undebug fmt

* CI: better deny

* CI: fix deny and spellcheck

* CI: global backtrace

* CI: deny config

* CI: publishing

* Dockerfile: metadata fix [skip ci]

* CI: revert me

* CI: debug bash

* CI: mv ci.Dockerfile; fix buildah bug

* CI: fix artifact name

* Dockerfile: fix context

* CI: separate deny check licenses

* CI: when to run

* CI: unneded stuff in these Dockerfiles

* CI: merged test-refs and build-refs

* CI: test-build optimizations

* CI: changes, web, scheduled pipelines now work as intended

* CI: use tested production CI image

* CI: substitute GHA

* Fix clippy.

* Moar clippy fixes.

* Fix more.

* Finally fix all?

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
2024-04-10 10:28:37 +02:00
Hernando Castano c6ae74725b Bump Substrate (#871)
* Bump Substrate

* Change usage of "Module" to "Pallet"

Related Substrate PR: https://github.com/paritytech/substrate/pull/8372

* Add `OnSetCode` config param

Related Substrate PR: https://github.com/paritytech/substrate/pull/8496

* Update Aura Slot duration time type

Related Substrate PR: https://github.com/paritytech/substrate/pull/8386

* Add `OnSetCode` to mock runtimes

* Add support for multiple justifications

Related Substrate PR: https://github.com/paritytech/substrate/pull/7640

* Use updated justification type in more places

* Make GenesisConfig type non-optional

Related Substrate PR: https://github.com/paritytech/substrate/pull/8275

* Update service to use updated telemetry

Related Substrate PR: https://github.com/paritytech/substrate/pull/8143

* Appease Clippy
2024-04-10 10:28:37 +02:00
Hernando Castano 21baffc832 Update Copyright Date to 2021 (#864)
* Update copyright date to 2021

* Bump date in license header template
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