Skip to content

Commit 8649d12

Browse files
svyatonikacatangiu
andauthored
Signed extension to refund relayer at the target chain (#1657)
* add utlity pallet to the Millau runtime * RefundRelayerForMessagesDeliveryFromParachain prototype * done with RefundRelayerForMessagesDeliveryFromParachain::post_dispatch * parse calls * check batch for obsolete headers/messages * fmt * shorten generic arg names + add parachain id generic arg * check lane_id * impl all state read functions * fix typos from review * renamed extension + reference issue from TODO * tests for pre-dispaytch * renamed extension source file * tests for post-dispatch * abstract fee calculation * clippy * actually fix clippy * Update bin/runtime-common/src/refund_relayer_extension.rs Co-authored-by: Adrian Catangiu <[email protected]> * Update bin/runtime-common/src/refund_relayer_extension.rs Co-authored-by: Adrian Catangiu <[email protected]> * Update bin/runtime-common/src/refund_relayer_extension.rs Co-authored-by: Adrian Catangiu <[email protected]> * Update bin/runtime-common/src/refund_relayer_extension.rs Co-authored-by: Adrian Catangiu <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]>
1 parent ec6bafa commit 8649d12

File tree

11 files changed

+895
-4
lines changed

11 files changed

+895
-4
lines changed

Cargo.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/millau/runtime/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "maste
4949
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
5050
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
5151
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
52+
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
5253
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
5354
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
5455
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -113,6 +114,7 @@ std = [
113114
"pallet-timestamp/std",
114115
"pallet-transaction-payment-rpc-runtime-api/std",
115116
"pallet-transaction-payment/std",
117+
"pallet-utility/std",
116118
"pallet-xcm/std",
117119
"scale-info/std",
118120
"sp-api/std",

bin/millau/runtime/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,13 @@ impl pallet_bridge_parachains::Config<WithWestendParachainsInstance> for Runtime
550550
type MaxParaHeadSize = MaxWestendParaHeadSize;
551551
}
552552

553+
impl pallet_utility::Config for Runtime {
554+
type RuntimeEvent = RuntimeEvent;
555+
type RuntimeCall = RuntimeCall;
556+
type PalletsOrigin = OriginCaller;
557+
type WeightInfo = ();
558+
}
559+
553560
construct_runtime!(
554561
pub enum Runtime where
555562
Block = Block,
@@ -558,6 +565,7 @@ construct_runtime!(
558565
{
559566
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
560567
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>},
568+
Utility: pallet_utility,
561569

562570
// Must be before session.
563571
Aura: pallet_aura::{Pallet, Config<T>},

bin/runtime-common/Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ bp-runtime = { path = "../../primitives/runtime", default-features = false }
2323
pallet-bridge-grandpa = { path = "../../modules/grandpa", default-features = false }
2424
pallet-bridge-messages = { path = "../../modules/messages", default-features = false }
2525
pallet-bridge-parachains = { path = "../../modules/parachains", default-features = false }
26+
pallet-bridge-relayers = { path = "../../modules/relayers", default-features = false }
2627

2728
# Substrate dependencies
2829

2930
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3031
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3132
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
33+
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
34+
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3235
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3336
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
3437
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
@@ -43,6 +46,8 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master
4346
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false }
4447

4548
[dev-dependencies]
49+
bp-rialto = { path = "../../primitives/chain-rialto" }
50+
bp-test-utils = { path = "../../primitives/test-utils" }
4651
millau-runtime = { path = "../millau/runtime" }
4752

4853
[features]
@@ -61,6 +66,9 @@ std = [
6166
"pallet-bridge-grandpa/std",
6267
"pallet-bridge-messages/std",
6368
"pallet-bridge-parachains/std",
69+
"pallet-bridge-relayers/std",
70+
"pallet-transaction-payment/std",
71+
"pallet-utility/std",
6472
"pallet-xcm/std",
6573
"scale-info/std",
6674
"sp-api/std",

bin/runtime-common/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ pub mod messages_api;
2727
pub mod messages_benchmarking;
2828
pub mod messages_extension;
2929
pub mod parachains_benchmarking;
30+
pub mod refund_relayer_extension;
3031

3132
mod messages_generation;
3233

@@ -78,7 +79,7 @@ where
7879
#[macro_export]
7980
macro_rules! generate_bridge_reject_obsolete_headers_and_messages {
8081
($call:ty, $account_id:ty, $($filter_call:ty),*) => {
81-
#[derive(Clone, codec::Decode, codec::Encode, Eq, PartialEq, frame_support::RuntimeDebug, scale_info::TypeInfo)]
82+
#[derive(Clone, codec::Decode, Default, codec::Encode, Eq, PartialEq, frame_support::RuntimeDebug, scale_info::TypeInfo)]
8283
pub struct BridgeRejectObsoleteHeadersAndMessages;
8384
impl sp_runtime::traits::SignedExtension for BridgeRejectObsoleteHeadersAndMessages {
8485
const IDENTIFIER: &'static str = "BridgeRejectObsoleteHeadersAndMessages";

0 commit comments

Comments
 (0)