Skip to content

Commit

Permalink
Move refund extension to relayers pallet (#2584)
Browse files Browse the repository at this point in the history
* moved all call-related definitions to primitives

* moving refund extension to relayers pallet

* cleaning up

* fix compilation + spelling
  • Loading branch information
svyatonik authored Sep 28, 2023
1 parent 99da1f9 commit 95a7f53
Show file tree
Hide file tree
Showing 28 changed files with 1,195 additions and 1,169 deletions.
12 changes: 12 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/millau/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/par
[dev-dependencies]
bridge-runtime-common = { path = "../../runtime-common", features = ["integrity-test", "std"] }
env_logger = "0.10"
pallet-bridge-relayers = { path = "../../../modules/relayers", features = ["integrity-test", "std"] }
static_assertions = "1.1"

[build-dependencies]
Expand Down
33 changes: 13 additions & 20 deletions bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,8 @@ pub use pallet_sudo::Call as SudoCall;
pub use pallet_timestamp::Call as TimestampCall;
pub use pallet_xcm::Call as XcmCall;

use bridge_runtime_common::{
generate_bridge_reject_obsolete_headers_and_messages,
refund_relayer_extension::{
ActualFeeRefund, RefundBridgedParachainMessages, RefundSignedExtensionAdapter,
RefundableMessagesLane, RefundableParachain,
},
};
use bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages;

#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{Perbill, Permill};
Expand Down Expand Up @@ -653,23 +648,21 @@ generate_bridge_reject_obsolete_headers_and_messages! {
BridgeRialtoMessages, BridgeRialtoParachainMessages
}

bp_runtime::generate_static_str_provider!(BridgeRefundRialtoPara2000Lane0Msgs);
bp_runtime::generate_static_str_provider!(BridgeRefundRialtoPara2000Msgs);
/// Signed extension that refunds relayers that are delivering messages from the Rialto parachain.
pub type PriorityBoostPerMessage = ConstU64<351_343_108>;
pub type BridgeRefundRialtoParachainMessages = RefundSignedExtensionAdapter<
RefundBridgedParachainMessages<
pub type BridgeRefundRialtoParachainMessages =
pallet_bridge_relayers::extension::BridgeRelayersSignedExtension<
Runtime,
RefundableParachain<WithRialtoParachainsInstance, bp_rialto_parachain::RialtoParachain>,
RefundableMessagesLane<
pallet_bridge_relayers::extension::WithParachainExtensionConfig<
StrBridgeRefundRialtoPara2000Msgs,
Runtime,
bp_relayers::RuntimeWithUtilityPallet<Runtime>,
WithRialtoParachainsInstance,
WithRialtoParachainMessagesInstance,
rialto_parachain_messages::Lane,
PriorityBoostPerMessage,
>,
ActualFeeRefund<Runtime>,
PriorityBoostPerMessage,
StrBridgeRefundRialtoPara2000Lane0Msgs,
>,
>;
>;

/// The address format for describing accounts.
pub type Address = AccountId;
Expand Down Expand Up @@ -1186,8 +1179,8 @@ impl_runtime_apis! {
parachain_head_size: u32,
proof_params: bp_runtime::UnverifiedStorageProofParams,
) -> (
pallet_bridge_parachains::RelayBlockNumber,
pallet_bridge_parachains::RelayBlockHash,
bp_parachains::RelayBlockNumber,
bp_parachains::RelayBlockHash,
bp_polkadot_core::parachains::ParaHeadsProof,
Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>,
) {
Expand Down
2 changes: 1 addition & 1 deletion bin/millau/runtime/src/rialto_parachain_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ mod tests {
},
});

bridge_runtime_common::priority_calculator::ensure_priority_boost_is_sane::<
pallet_bridge_relayers::extension::ensure_priority_boost_is_sane::<
Runtime,
WithRialtoParachainMessagesInstance,
PriorityBoostPerMessage,
Expand Down
4 changes: 0 additions & 4 deletions bin/runtime-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ use xcm::v3::NetworkId;
pub mod messages_api;
pub mod messages_benchmarking;
pub mod parachains_benchmarking;
pub mod priority_calculator;
pub mod refund_relayer_extension;

mod mock;

#[cfg(feature = "integrity-test")]
pub mod integrity;
Expand Down
Loading

0 comments on commit 95a7f53

Please sign in to comment.