......@@ -19,7 +19,6 @@ use super::{
ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
TransactionByteFee, WeightToFee, XcmpQueue,
};
use crate::bridge_common_config::{DeliveryRewardInBalance, RequiredStakeForStakeAndSlash};
use frame_support::{
parameter_types,
traits::{tokens::imbalance::ResolveTo, ConstU32, Contains, Equals, Everything, Nothing},
......@@ -39,16 +38,16 @@ use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, IsConcrete,
ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
XcmFeeToAccount,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
FungibleAdapter, IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
use xcm_executor::XcmExecutor;
parameter_types! {
pub const WestendLocation: Location = Location::parent();
......@@ -119,73 +118,6 @@ impl Contains<Location> for ParentOrParentsPlurality {
}
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
///
/// Calls that are allowed through this filter must:
/// 1. Have a fixed weight;
/// 2. Cannot lead to another call being made;
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
pub struct SafeCallFilter;
impl Contains<RuntimeCall> for SafeCallFilter {
fn contains(call: &RuntimeCall) -> bool {
#[cfg(feature = "runtime-benchmarks")]
{
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
return true
}
}
// Allow to change dedicated storage items (called by governance-like)
match call {
RuntimeCall::System(frame_system::Call::set_storage { items })
if items.iter().all(|(k, _)| {
k.eq(&DeliveryRewardInBalance::key()) |
k.eq(&RequiredStakeForStakeAndSlash::key())
}) =>
return true,
_ => (),
};
matches!(
call,
RuntimeCall::PolkadotXcm(
pallet_xcm::Call::force_xcm_version { .. } |
pallet_xcm::Call::force_default_xcm_version { .. }
) | RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::authorize_upgrade { .. } |
frame_system::Call::authorize_upgrade_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(..) |
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::MessageQueue(..) |
RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::<
Runtime,
crate::bridge_to_rococo_config::BridgeGrandpaRococoInstance,
>::initialize { .. }) |
RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::<
Runtime,
crate::bridge_to_rococo_config::BridgeGrandpaRococoInstance,
>::set_operating_mode { .. }) |
RuntimeCall::BridgeRococoParachains(pallet_bridge_parachains::Call::<
Runtime,
crate::bridge_to_rococo_config::BridgeParachainRococoInstance,
>::set_operating_mode { .. }) |
RuntimeCall::BridgeRococoMessages(pallet_bridge_messages::Call::<
Runtime,
crate::bridge_to_rococo_config::WithBridgeHubRococoMessagesInstance,
>::set_operating_mode { .. })
)
}
}
pub type Barrier = TrailingSetTopicAsId<
DenyThenTry<
DenyReserveTransferToRelayChain,
......@@ -207,6 +139,8 @@ pub type Barrier = TrailingSetTopicAsId<
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
......@@ -265,8 +199,8 @@ impl xcm_executor::Config for XcmConfig {
>;
type MessageExporter = (crate::bridge_to_rococo_config::ToBridgeHubRococoHaulBlobExporter,);
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
......
......@@ -94,11 +94,10 @@ fn construct_and_apply_extrinsic(
r.unwrap()
}
fn construct_and_estimate_extrinsic_fee(batch: pallet_utility::Call<Runtime>) -> Balance {
let batch_call = RuntimeCall::Utility(batch);
let batch_info = batch_call.get_dispatch_info();
let xt = construct_extrinsic(Alice, batch_call);
TransactionPayment::compute_fee(xt.encoded_size() as _, &batch_info, 0)
fn construct_and_estimate_extrinsic_fee(call: RuntimeCall) -> Balance {
let info = call.get_dispatch_info();
let xt = construct_extrinsic(Alice, call);
TransactionPayment::compute_fee(xt.encoded_size() as _, &info, 0)
}
fn collator_session_keys() -> bridge_hub_test_utils::CollatorSessionKeys<Runtime> {
......@@ -271,22 +270,6 @@ fn relayed_incoming_message_works() {
)
}
#[test]
pub fn complex_relay_extrinsic_works() {
from_parachain::complex_relay_extrinsic_works::<RuntimeTestsAdapter>(
collator_session_keys(),
slot_durations(),
bp_bridge_hub_westend::BRIDGE_HUB_WESTEND_PARACHAIN_ID,
bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID,
SIBLING_PARACHAIN_ID,
BridgeHubRococoChainId::get(),
Westend,
XCM_LANE_FOR_ASSET_HUB_WESTEND_TO_ASSET_HUB_ROCOCO,
|| (),
construct_and_apply_extrinsic,
);
}
#[test]
pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
bridge_hub_test_utils::check_sane_fees_values(
......@@ -309,12 +292,12 @@ pub fn can_calculate_weight_for_paid_export_message_with_reserve_transfer() {
}
#[test]
pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
pub fn can_calculate_fee_for_standalone_message_delivery_transaction() {
bridge_hub_test_utils::check_sane_fees_values(
"bp_bridge_hub_westend::BridgeHubWestendBaseDeliveryFeeInWnds",
bp_bridge_hub_westend::BridgeHubWestendBaseDeliveryFeeInWnds::get(),
|| {
from_parachain::can_calculate_fee_for_complex_message_delivery_transaction::<
from_parachain::can_calculate_fee_for_standalone_message_delivery_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee)
},
......@@ -328,12 +311,12 @@ pub fn can_calculate_fee_for_complex_message_delivery_transaction() {
}
#[test]
pub fn can_calculate_fee_for_complex_message_confirmation_transaction() {
pub fn can_calculate_fee_for_standalone_message_confirmation_transaction() {
bridge_hub_test_utils::check_sane_fees_values(
"bp_bridge_hub_westend::BridgeHubWestendBaseConfirmationFeeInWnds",
bp_bridge_hub_westend::BridgeHubWestendBaseConfirmationFeeInWnds::get(),
|| {
from_parachain::can_calculate_fee_for_complex_message_confirmation_transaction::<
from_parachain::can_calculate_fee_for_standalone_message_confirmation_transaction::<
RuntimeTestsAdapter,
>(collator_session_keys(), construct_and_estimate_extrinsic_fee)
},
......
......@@ -41,6 +41,7 @@ use frame_system::pallet_prelude::BlockNumberFor;
use parachains_runtimes_test_utils::{
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
};
use sp_core::Get;
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::Header as HeaderT, AccountId32};
use xcm::latest::prelude::*;
......@@ -162,7 +163,14 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
test_data::from_grandpa_chain::make_complex_relayer_delivery_proofs::<
RuntimeHelper::MB,
(),
>(lane_id, xcm.into(), message_nonce, message_destination, relay_header_number);
>(
lane_id,
xcm.into(),
message_nonce,
message_destination,
relay_header_number,
false,
);
let relay_chain_header_hash = relay_chain_header.hash();
vec![
......@@ -202,6 +210,142 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
);
}
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
/// with proofs (finality, message) independently submitted.
/// Finality proof is submitted for free in this test.
/// Also verifies relayer transaction signed extensions work as intended.
pub fn free_relay_extrinsic_works<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
slot_durations: SlotDurations,
runtime_para_id: u32,
bridged_chain_id: bp_runtime::ChainId,
sibling_parachain_id: u32,
local_relay_chain_id: NetworkId,
lane_id: LaneId,
prepare_configuration: impl Fn(),
construct_and_apply_extrinsic: fn(
sp_keyring::AccountKeyring,
RuntimeCallOf<RuntimeHelper::Runtime>,
) -> sp_runtime::DispatchOutcome,
) where
RuntimeHelper: WithRemoteGrandpaChainHelper,
RuntimeHelper::Runtime: pallet_balances::Config,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>: ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
>,
{
// ensure that the runtime allows free header submissions
let free_headers_interval = <RuntimeHelper::Runtime as BridgeGrandpaConfig<
RuntimeHelper::GPI,
>>::FreeHeadersInterval::get()
.expect("this test requires runtime, configured to accept headers for free; qed");
helpers::relayed_incoming_message_works::<
RuntimeHelper::Runtime,
RuntimeHelper::AllPalletsWithoutSystem,
RuntimeHelper::MPI,
>(
collator_session_key,
slot_durations,
runtime_para_id,
sibling_parachain_id,
local_relay_chain_id,
construct_and_apply_extrinsic,
|relayer_id_at_this_chain,
relayer_id_at_bridged_chain,
message_destination,
message_nonce,
xcm| {
prepare_configuration();
// start with bridged relay chain block#0
let initial_block_number = 0;
helpers::initialize_bridge_grandpa_pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
test_data::initialization_data::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
initial_block_number,
),
);
// free relay chain header is `0 + free_headers_interval`
let relay_header_number = initial_block_number + free_headers_interval;
// relayer balance shall not change after relay and para header submissions
let initial_relayer_balance =
pallet_balances::Pallet::<RuntimeHelper::Runtime>::free_balance(
relayer_id_at_this_chain.clone(),
);
// initialize the `FreeHeadersRemaining` storage value
pallet_bridge_grandpa::Pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::on_initialize(
0u32.into(),
);
// generate bridged relay chain finality, parachain heads and message proofs,
// to be submitted by relayer to this chain.
let (relay_chain_header, grandpa_justification, message_proof) =
test_data::from_grandpa_chain::make_complex_relayer_delivery_proofs::<
RuntimeHelper::MB,
(),
>(
lane_id,
xcm.into(),
message_nonce,
message_destination,
relay_header_number.into(),
true,
);
let relay_chain_header_hash = relay_chain_header.hash();
vec![
(
BridgeGrandpaCall::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::submit_finality_proof {
finality_target: Box::new(relay_chain_header),
justification: grandpa_justification,
}.into(),
Box::new((
helpers::VerifySubmitGrandpaFinalityProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::expect_best_header_hash(
relay_chain_header_hash,
),
helpers::VerifyRelayerBalance::<RuntimeHelper::Runtime>::expect_relayer_balance(
relayer_id_at_this_chain.clone(),
initial_relayer_balance,
),
))
),
(
BridgeMessagesCall::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::receive_messages_proof {
relayer_id_at_bridged_chain,
proof: message_proof,
messages_count: 1,
dispatch_weight: Weight::from_parts(1000000000, 0),
}.into(),
Box::new((
helpers::VerifySubmitMessagesProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::expect_last_delivered_nonce(
lane_id,
1,
),
helpers::VerifyRelayerRewarded::<RuntimeHelper::Runtime>::expect_relayer_reward(
relayer_id_at_this_chain,
RewardsAccountParams::new(
lane_id,
bridged_chain_id,
RewardsAccountOwner::ThisChain,
),
),
)),
),
]
},
);
}
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
/// with proofs (finality, message) batched together in signed extrinsic.
/// Also verifies relayer transaction signed extensions work as intended.
......@@ -265,7 +409,14 @@ pub fn complex_relay_extrinsic_works<RuntimeHelper>(
test_data::from_grandpa_chain::make_complex_relayer_delivery_proofs::<
RuntimeHelper::MB,
(),
>(lane_id, xcm.into(), message_nonce, message_destination, relay_header_number);
>(
lane_id,
xcm.into(),
message_nonce,
message_destination,
relay_header_number,
false,
);
let relay_chain_header_hash = relay_chain_header.hash();
vec![(
......@@ -344,6 +495,7 @@ where
1,
[GlobalConsensus(Polkadot), Parachain(1_000)].into(),
1u32.into(),
false,
);
// generate batch call that provides finality for bridged relay and parachains + message
......@@ -423,3 +575,109 @@ where
compute_extrinsic_fee(batch)
})
}
/// Estimates transaction fee for default message delivery transaction from bridged GRANDPA chain.
pub fn can_calculate_fee_for_standalone_message_delivery_transaction<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
compute_extrinsic_fee: fn(
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> u128,
) -> u128
where
RuntimeHelper: WithRemoteGrandpaChainHelper,
RuntimeCallOf<RuntimeHelper::Runtime>:
From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>: ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
>,
{
run_test::<RuntimeHelper::Runtime, _>(collator_session_key, 1000, vec![], || {
// generate bridged relay chain finality, parachain heads and message proofs,
// to be submitted by relayer to this chain.
//
// we don't care about parameter values here, apart from the XCM message size. But we
// do not need to have a large message here, because we're charging for every byte of
// the message additionally
let (_, _, message_proof) =
test_data::from_grandpa_chain::make_complex_relayer_delivery_proofs::<
RuntimeHelper::MB,
(),
>(
LaneId::default(),
vec![Instruction::<()>::ClearOrigin; 1_024].into(),
1,
[GlobalConsensus(Polkadot), Parachain(1_000)].into(),
1u32.into(),
false,
);
let call = test_data::from_grandpa_chain::make_standalone_relayer_delivery_call::<
RuntimeHelper::Runtime,
RuntimeHelper::GPI,
RuntimeHelper::MPI,
>(
message_proof,
helpers::relayer_id_at_bridged_chain::<RuntimeHelper::Runtime, RuntimeHelper::MPI>(),
);
compute_extrinsic_fee(call)
})
}
/// Estimates transaction fee for default message confirmation transaction (batched with required
/// proofs) from bridged parachain.
pub fn can_calculate_fee_for_standalone_message_confirmation_transaction<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
compute_extrinsic_fee: fn(
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> u128,
) -> u128
where
RuntimeHelper: WithRemoteGrandpaChainHelper,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
MessageThisChain<RuntimeHelper::MB>:
bp_runtime::Chain<AccountId = AccountIdOf<RuntimeHelper::Runtime>>,
RuntimeCallOf<RuntimeHelper::Runtime>:
From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>: ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::TargetHeaderChain:
TargetHeaderChain<
XcmAsPlainPayload,
AccountIdOf<RuntimeHelper::Runtime>,
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<
HashOf<UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>>,
>,
>,
{
run_test::<RuntimeHelper::Runtime, _>(collator_session_key, 1000, vec![], || {
// generate bridged relay chain finality, parachain heads and message proofs,
// to be submitted by relayer to this chain.
let unrewarded_relayers = UnrewardedRelayersState {
unrewarded_relayer_entries: 1,
total_messages: 1,
..Default::default()
};
let (_, _, message_delivery_proof) =
test_data::from_grandpa_chain::make_complex_relayer_confirmation_proofs::<
RuntimeHelper::MB,
(),
>(
LaneId::default(),
1u32.into(),
AccountId32::from(Alice.public()).into(),
unrewarded_relayers.clone(),
);
let call = test_data::from_grandpa_chain::make_standalone_relayer_confirmation_call::<
RuntimeHelper::Runtime,
RuntimeHelper::GPI,
RuntimeHelper::MPI,
>(message_delivery_proof, unrewarded_relayers);
compute_extrinsic_fee(call)
})
}
......@@ -42,6 +42,7 @@ use frame_system::pallet_prelude::BlockNumberFor;
use parachains_runtimes_test_utils::{
AccountIdOf, BasicParachainRuntime, CollatorSessionKeys, RuntimeCallOf, SlotDurations,
};
use sp_core::Get;
use sp_keyring::AccountKeyring::*;
use sp_runtime::{traits::Header as HeaderT, AccountId32};
use xcm::latest::prelude::*;
......@@ -188,6 +189,7 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
para_header_number,
relay_header_number,
bridged_para_id,
false,
);
let parachain_head_hash = parachain_head.hash();
......@@ -241,6 +243,177 @@ pub fn relayed_incoming_message_works<RuntimeHelper>(
);
}
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
/// with proofs (finality, para heads, message) independently submitted.
/// Finality and para heads are submitted for free in this test.
/// Also verifies relayer transaction signed extensions work as intended.
pub fn free_relay_extrinsic_works<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
slot_durations: SlotDurations,
runtime_para_id: u32,
bridged_para_id: u32,
bridged_chain_id: bp_runtime::ChainId,
sibling_parachain_id: u32,
local_relay_chain_id: NetworkId,
lane_id: LaneId,
prepare_configuration: impl Fn(),
construct_and_apply_extrinsic: fn(
sp_keyring::AccountKeyring,
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> sp_runtime::DispatchOutcome,
) where
RuntimeHelper: WithRemoteParachainHelper,
RuntimeHelper::Runtime: pallet_balances::Config,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
RuntimeCallOf<RuntimeHelper::Runtime>: From<BridgeGrandpaCall<RuntimeHelper::Runtime, RuntimeHelper::GPI>>
+ From<BridgeParachainsCall<RuntimeHelper::Runtime, RuntimeHelper::PPI>>
+ From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
>,
{
// ensure that the runtime allows free header submissions
let free_headers_interval = <RuntimeHelper::Runtime as BridgeGrandpaConfig<
RuntimeHelper::GPI,
>>::FreeHeadersInterval::get()
.expect("this test requires runtime, configured to accept headers for free; qed");
helpers::relayed_incoming_message_works::<
RuntimeHelper::Runtime,
RuntimeHelper::AllPalletsWithoutSystem,
RuntimeHelper::MPI,
>(
collator_session_key,
slot_durations,
runtime_para_id,
sibling_parachain_id,
local_relay_chain_id,
construct_and_apply_extrinsic,
|relayer_id_at_this_chain,
relayer_id_at_bridged_chain,
message_destination,
message_nonce,
xcm| {
prepare_configuration();
// start with bridged relay chain block#0
let initial_block_number = 0;
helpers::initialize_bridge_grandpa_pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
test_data::initialization_data::<RuntimeHelper::Runtime, RuntimeHelper::GPI>(
initial_block_number,
),
);
// free relay chain header is `0 + free_headers_interval`
let relay_header_number = initial_block_number + free_headers_interval;
// first parachain header is always submitted for free
let para_header_number = 1;
// relayer balance shall not change after relay and para header submissions
let initial_relayer_balance =
pallet_balances::Pallet::<RuntimeHelper::Runtime>::free_balance(
relayer_id_at_this_chain.clone(),
);
// initialize the `FreeHeadersRemaining` storage value
pallet_bridge_grandpa::Pallet::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::on_initialize(
0u32.into(),
);
// generate bridged relay chain finality, parachain heads and message proofs,
// to be submitted by relayer to this chain.
let (
relay_chain_header,
grandpa_justification,
parachain_head,
parachain_heads,
para_heads_proof,
message_proof,
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
RuntimeHelper::MB,
(),
>(
lane_id,
xcm.into(),
message_nonce,
message_destination,
para_header_number,
relay_header_number,
bridged_para_id,
true,
);
let parachain_head_hash = parachain_head.hash();
let relay_chain_header_hash = relay_chain_header.hash();
let relay_chain_header_number = *relay_chain_header.number();
vec![
(
BridgeGrandpaCall::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::submit_finality_proof {
finality_target: Box::new(relay_chain_header),
justification: grandpa_justification,
}.into(),
Box::new((
helpers::VerifySubmitGrandpaFinalityProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::GPI>::expect_best_header_hash(
relay_chain_header_hash,
),
helpers::VerifyRelayerBalance::<RuntimeHelper::Runtime>::expect_relayer_balance(
relayer_id_at_this_chain.clone(),
initial_relayer_balance,
),
)),
),
(
BridgeParachainsCall::<RuntimeHelper::Runtime, RuntimeHelper::PPI>::submit_parachain_heads {
at_relay_block: (relay_chain_header_number, relay_chain_header_hash),
parachains: parachain_heads,
parachain_heads_proof: para_heads_proof,
}.into(),
Box::new((
helpers::VerifySubmitParachainHeaderProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::PPI>::expect_best_header_hash(
bridged_para_id,
parachain_head_hash,
),
/*helpers::VerifyRelayerBalance::<RuntimeHelper::Runtime>::expect_relayer_balance(
relayer_id_at_this_chain.clone(),
initial_relayer_balance,
),*/
)),
),
(
BridgeMessagesCall::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::receive_messages_proof {
relayer_id_at_bridged_chain,
proof: message_proof,
messages_count: 1,
dispatch_weight: Weight::from_parts(1000000000, 0),
}.into(),
Box::new((
helpers::VerifySubmitMessagesProofOutcome::<RuntimeHelper::Runtime, RuntimeHelper::MPI>::expect_last_delivered_nonce(
lane_id,
1,
),
helpers::VerifyRelayerRewarded::<RuntimeHelper::Runtime>::expect_relayer_reward(
relayer_id_at_this_chain,
RewardsAccountParams::new(
lane_id,
bridged_chain_id,
RewardsAccountOwner::ThisChain,
),
),
)),
),
]
},
);
}
/// Test-case makes sure that Runtime can dispatch XCM messages submitted by relayer,
/// with proofs (finality, para heads, message) batched together in signed extrinsic.
/// Also verifies relayer transaction signed extensions work as intended.
......@@ -325,6 +498,7 @@ pub fn complex_relay_extrinsic_works<RuntimeHelper>(
para_header_number,
relay_header_number,
bridged_para_id,
false,
);
let parachain_head_hash = parachain_head.hash();
......@@ -428,6 +602,7 @@ where
1,
5,
1_000,
false,
);
// generate batch call that provides finality for bridged relay and parachains + message
......@@ -527,3 +702,126 @@ where
compute_extrinsic_fee(batch)
})
}
/// Estimates transaction fee for default message delivery transaction from bridged parachain.
pub fn can_calculate_fee_for_standalone_message_delivery_transaction<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
compute_extrinsic_fee: fn(
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> u128,
) -> u128
where
RuntimeHelper: WithRemoteParachainHelper,
RuntimeCallOf<RuntimeHelper::Runtime>:
From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::SourceHeaderChain:
SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<
HashOf<MessageBridgedChain<RuntimeHelper::MB>>,
>,
>,
{
run_test::<RuntimeHelper::Runtime, _>(collator_session_key, 1000, vec![], || {
// generate bridged relay chain finality, parachain heads and message proofs,
// to be submitted by relayer to this chain.
//
// we don't care about parameter values here, apart from the XCM message size. But we
// do not need to have a large message here, because we're charging for every byte of
// the message additionally
let (
_,
_,
_,
_,
_,
message_proof,
) = test_data::from_parachain::make_complex_relayer_delivery_proofs::<
<RuntimeHelper::Runtime as pallet_bridge_grandpa::Config<RuntimeHelper::GPI>>::BridgedChain,
RuntimeHelper::MB,
(),
>(
LaneId::default(),
vec![Instruction::<()>::ClearOrigin; 1_024].into(),
1,
[GlobalConsensus(Polkadot), Parachain(1_000)].into(),
1,
5,
1_000,
false,
);
let call = test_data::from_parachain::make_standalone_relayer_delivery_call::<
RuntimeHelper::Runtime,
RuntimeHelper::MPI,
_,
>(
message_proof,
helpers::relayer_id_at_bridged_chain::<RuntimeHelper::Runtime, RuntimeHelper::MPI>(),
);
compute_extrinsic_fee(call)
})
}
/// Estimates transaction fee for default message confirmation transaction (batched with required
/// proofs) from bridged parachain.
pub fn can_calculate_fee_for_standalone_message_confirmation_transaction<RuntimeHelper>(
collator_session_key: CollatorSessionKeys<RuntimeHelper::Runtime>,
compute_extrinsic_fee: fn(
<RuntimeHelper::Runtime as frame_system::Config>::RuntimeCall,
) -> u128,
) -> u128
where
RuntimeHelper: WithRemoteParachainHelper,
AccountIdOf<RuntimeHelper::Runtime>: From<AccountId32>,
MessageThisChain<RuntimeHelper::MB>:
bp_runtime::Chain<AccountId = AccountIdOf<RuntimeHelper::Runtime>>,
RuntimeCallOf<RuntimeHelper::Runtime>:
From<BridgeMessagesCall<RuntimeHelper::Runtime, RuntimeHelper::MPI>>,
UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>:
bp_runtime::Chain<Hash = ParaHash> + Parachain,
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain:
bp_runtime::Chain<Hash = RelayBlockHash, BlockNumber = RelayBlockNumber> + ChainWithGrandpa,
<RuntimeHelper::Runtime as BridgeMessagesConfig<RuntimeHelper::MPI>>::TargetHeaderChain:
TargetHeaderChain<
XcmAsPlainPayload,
AccountIdOf<RuntimeHelper::Runtime>,
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<
HashOf<UnderlyingChainOf<MessageBridgedChain<RuntimeHelper::MB>>>,
>,
>,
{
run_test::<RuntimeHelper::Runtime, _>(collator_session_key, 1000, vec![], || {
// generate bridged relay chain finality, parachain heads and message proofs,
// to be submitted by relayer to this chain.
let unrewarded_relayers = UnrewardedRelayersState {
unrewarded_relayer_entries: 1,
total_messages: 1,
..Default::default()
};
let (_, _, _, _, _, message_delivery_proof) =
test_data::from_parachain::make_complex_relayer_confirmation_proofs::<
<RuntimeHelper::Runtime as BridgeGrandpaConfig<RuntimeHelper::GPI>>::BridgedChain,
RuntimeHelper::MB,
(),
>(
LaneId::default(),
1,
5,
1_000,
AccountId32::from(Alice.public()).into(),
unrewarded_relayers.clone(),
);
let call = test_data::from_parachain::make_standalone_relayer_confirmation_call::<
RuntimeHelper::Runtime,
RuntimeHelper::MPI,
>(message_delivery_proof, unrewarded_relayers);
compute_extrinsic_fee(call)
})
}
......@@ -193,6 +193,34 @@ where
}
}
/// Verifies that relayer balance is equal to given value.
pub struct VerifyRelayerBalance<Runtime: pallet_balances::Config> {
relayer: Runtime::AccountId,
balance: Runtime::Balance,
}
impl<Runtime> VerifyRelayerBalance<Runtime>
where
Runtime: pallet_balances::Config,
{
/// Expect given relayer balance after transaction.
pub fn expect_relayer_balance(
relayer: Runtime::AccountId,
balance: Runtime::Balance,
) -> Box<dyn VerifyTransactionOutcome> {
Box::new(Self { relayer, balance })
}
}
impl<Runtime> VerifyTransactionOutcome for VerifyRelayerBalance<Runtime>
where
Runtime: pallet_balances::Config,
{
fn verify_outcome(&self) {
assert_eq!(pallet_balances::Pallet::<Runtime>::free_balance(&self.relayer), self.balance,);
}
}
/// Initialize bridge GRANDPA pallet.
pub(crate) fn initialize_bridge_grandpa_pallet<Runtime, GPI>(
init_data: bp_header_chain::InitializationData<BridgedHeader<Runtime, GPI>>,
......
......@@ -121,6 +121,60 @@ where
}
}
/// Prepare a call with message proof.
pub fn make_standalone_relayer_delivery_call<Runtime, GPI, MPI>(
message_proof: FromBridgedChainMessagesProof<HashOf<BridgedChain<Runtime, GPI>>>,
relayer_id_at_bridged_chain: AccountIdOf<BridgedChain<Runtime, GPI>>,
) -> Runtime::RuntimeCall
where
Runtime: pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_messages::Config<
MPI,
InboundPayload = XcmAsPlainPayload,
InboundRelayer = AccountIdOf<BridgedChain<Runtime, GPI>>,
>,
MPI: 'static,
<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain: SourceHeaderChain<
MessagesProof = FromBridgedChainMessagesProof<HashOf<BridgedChain<Runtime, GPI>>>,
>,
Runtime::RuntimeCall: From<pallet_bridge_messages::Call<Runtime, MPI>>,
{
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_proof {
relayer_id_at_bridged_chain,
proof: message_proof,
messages_count: 1,
dispatch_weight: Weight::from_parts(1000000000, 0),
}
.into()
}
/// Prepare a call with message delivery proof.
pub fn make_standalone_relayer_confirmation_call<Runtime, GPI, MPI>(
message_delivery_proof: FromBridgedChainMessagesDeliveryProof<
HashOf<BridgedChain<Runtime, GPI>>,
>,
relayers_state: UnrewardedRelayersState,
) -> Runtime::RuntimeCall
where
Runtime: pallet_bridge_grandpa::Config<GPI>
+ pallet_bridge_messages::Config<MPI, OutboundPayload = XcmAsPlainPayload>,
MPI: 'static,
<Runtime as pallet_bridge_messages::Config<MPI>>::TargetHeaderChain: TargetHeaderChain<
XcmAsPlainPayload,
Runtime::AccountId,
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<
HashOf<BridgedChain<Runtime, GPI>>,
>,
>,
Runtime::RuntimeCall: From<pallet_bridge_messages::Call<Runtime, MPI>>,
{
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_delivery_proof {
proof: message_delivery_proof,
relayers_state,
}
.into()
}
/// Prepare storage proofs of messages, stored at the (bridged) source GRANDPA chain.
pub fn make_complex_relayer_delivery_proofs<MB, InnerXcmRuntimeCall>(
lane_id: LaneId,
......@@ -128,6 +182,7 @@ pub fn make_complex_relayer_delivery_proofs<MB, InnerXcmRuntimeCall>(
message_nonce: MessageNonce,
message_destination: Junctions,
header_number: BlockNumberOf<MessageBridgedChain<MB>>,
is_minimal_call: bool,
) -> (
HeaderOf<MessageBridgedChain<MB>>,
GrandpaJustification<HeaderOf<MessageBridgedChain<MB>>>,
......@@ -153,7 +208,7 @@ where
let (header, justification) = make_complex_bridged_grandpa_header_proof::<
MessageBridgedChain<MB>,
>(state_root, header_number);
>(state_root, header_number, is_minimal_call);
let message_proof = FromBridgedChainMessagesProof {
bridged_header_hash: header.hash(),
......@@ -200,8 +255,11 @@ where
StorageProofSize::Minimal(0),
);
let (header, justification) =
make_complex_bridged_grandpa_header_proof::<MB::BridgedChain>(state_root, header_number);
let (header, justification) = make_complex_bridged_grandpa_header_proof::<MB::BridgedChain>(
state_root,
header_number,
false,
);
let message_delivery_proof = FromBridgedChainMessagesDeliveryProof {
bridged_header_hash: header.hash(),
......@@ -216,6 +274,7 @@ where
pub fn make_complex_bridged_grandpa_header_proof<BridgedChain>(
state_root: HashOf<BridgedChain>,
header_number: BlockNumberOf<BridgedChain>,
is_minimal_call: bool,
) -> (HeaderOf<BridgedChain>, GrandpaJustification<HeaderOf<BridgedChain>>)
where
BridgedChain: ChainWithGrandpa,
......@@ -229,7 +288,9 @@ where
// `submit_finality_proof` call size would be close to maximal expected (and refundable)
let extra_bytes_required = maximal_expected_submit_finality_proof_call_size::<BridgedChain>()
.saturating_sub(header.encoded_size());
header.digest_mut().push(DigestItem::Other(vec![42; extra_bytes_required]));
if !is_minimal_call {
header.digest_mut().push(DigestItem::Other(vec![42; extra_bytes_required]));
}
let justification = make_default_justification(&header);
(header, justification)
......
......@@ -159,6 +159,52 @@ where
}
}
/// Prepare a call with message proof.
pub fn make_standalone_relayer_delivery_call<Runtime, MPI, InboundRelayer>(
message_proof: FromBridgedChainMessagesProof<ParaHash>,
relayer_id_at_bridged_chain: InboundRelayer,
) -> Runtime::RuntimeCall where
Runtime: pallet_bridge_messages::Config<
MPI,
InboundPayload = XcmAsPlainPayload,
InboundRelayer = InboundRelayer,
>,
MPI: 'static,
Runtime::RuntimeCall: From<pallet_bridge_messages::Call::<Runtime, MPI>>,
<<Runtime as pallet_bridge_messages::Config<MPI>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof:
From<FromBridgedChainMessagesProof<ParaHash>>,
{
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_proof {
relayer_id_at_bridged_chain: relayer_id_at_bridged_chain.into(),
proof: message_proof.into(),
messages_count: 1,
dispatch_weight: Weight::from_parts(1000000000, 0),
}
.into()
}
/// Prepare a call with message delivery proof.
pub fn make_standalone_relayer_confirmation_call<Runtime, MPI>(
message_delivery_proof: FromBridgedChainMessagesDeliveryProof<ParaHash>,
relayers_state: UnrewardedRelayersState,
) -> Runtime::RuntimeCall
where
Runtime: pallet_bridge_messages::Config<MPI, OutboundPayload = XcmAsPlainPayload>,
MPI: 'static,
Runtime::RuntimeCall: From<pallet_bridge_messages::Call<Runtime, MPI>>,
<Runtime as pallet_bridge_messages::Config<MPI>>::TargetHeaderChain: TargetHeaderChain<
XcmAsPlainPayload,
Runtime::AccountId,
MessagesDeliveryProof = FromBridgedChainMessagesDeliveryProof<ParaHash>,
>,
{
pallet_bridge_messages::Call::<Runtime, MPI>::receive_messages_delivery_proof {
proof: message_delivery_proof,
relayers_state,
}
.into()
}
/// Prepare storage proofs of messages, stored at the source chain.
pub fn make_complex_relayer_delivery_proofs<BridgedRelayChain, MB, InnerXcmRuntimeCall>(
lane_id: LaneId,
......@@ -168,6 +214,7 @@ pub fn make_complex_relayer_delivery_proofs<BridgedRelayChain, MB, InnerXcmRunti
para_header_number: u32,
relay_header_number: u32,
bridged_para_id: u32,
is_minimal_call: bool,
) -> (
HeaderOf<BridgedRelayChain>,
GrandpaJustification<HeaderOf<BridgedRelayChain>>,
......@@ -201,6 +248,7 @@ where
para_header_number,
relay_header_number,
bridged_para_id,
is_minimal_call,
);
let message_proof = FromBridgedChainMessagesProof {
......@@ -266,6 +314,7 @@ where
para_header_number,
relay_header_number,
bridged_para_id,
false,
);
let message_delivery_proof = FromBridgedChainMessagesDeliveryProof {
......@@ -290,6 +339,7 @@ pub fn make_complex_bridged_parachain_heads_proof<BridgedRelayChain, MB>(
para_header_number: u32,
relay_header_number: BlockNumberOf<BridgedRelayChain>,
bridged_para_id: u32,
is_minimal_call: bool,
) -> (
HeaderOf<BridgedRelayChain>,
GrandpaJustification<HeaderOf<BridgedRelayChain>>,
......@@ -319,9 +369,12 @@ where
)]);
assert_eq!(bridged_para_head.hash(), parachain_heads[0].1);
let (relay_chain_header, justification) = make_complex_bridged_grandpa_header_proof::<
BridgedRelayChain,
>(relay_state_root, relay_header_number);
let (relay_chain_header, justification) =
make_complex_bridged_grandpa_header_proof::<BridgedRelayChain>(
relay_state_root,
relay_header_number,
is_minimal_call,
);
(relay_chain_header, justification, bridged_para_head, parachain_heads, para_heads_proof)
}
......@@ -15,11 +15,7 @@
#[cfg(feature = "std")]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}
#[cfg(not(feature = "std"))]
......
......@@ -722,7 +722,7 @@ pub type UncheckedExtrinsic =
/// `OnRuntimeUpgrade`. Included migrations must be idempotent.
type Migrations = (
// unreleased
pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// unreleased
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
// permanent
......
......@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_xcm`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-03-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-02-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-h2rr8wx7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("collectives-westend-dev")`, DB CACHE: 1024
// Executed Command:
......@@ -64,30 +64,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `3610`
// Minimum execution time: 21_911_000 picoseconds.
Weight::from_parts(22_431_000, 0)
.saturating_add(Weight::from_parts(0, 3610))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `ParachainSystem::UpwardDeliveryFeeFactor` (r:1 w:0)
/// Proof: `ParachainSystem::UpwardDeliveryFeeFactor` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn send_blob() -> Weight {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `3610`
// Minimum execution time: 22_143_000 picoseconds.
Weight::from_parts(22_843_000, 0)
// Minimum execution time: 21_813_000 picoseconds.
Weight::from_parts(22_332_000, 0)
.saturating_add(Weight::from_parts(0, 3610))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -112,8 +90,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `214`
// Estimated: `3679`
// Minimum execution time: 96_273_000 picoseconds.
Weight::from_parts(98_351_000, 0)
// Minimum execution time: 93_243_000 picoseconds.
Weight::from_parts(95_650_000, 0)
.saturating_add(Weight::from_parts(0, 3679))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(3))
......@@ -148,8 +126,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `214`
// Estimated: `3679`
// Minimum execution time: 95_571_000 picoseconds.
Weight::from_parts(96_251_000, 0)
// Minimum execution time: 96_199_000 picoseconds.
Weight::from_parts(98_620_000, 0)
.saturating_add(Weight::from_parts(0, 3679))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(3))
......@@ -164,24 +142,14 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `Benchmark::Override` (r:0 w:0)
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn execute_blob() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_227_000 picoseconds.
Weight::from_parts(6_419_000, 0)
// Minimum execution time: 6_442_000 picoseconds.
Weight::from_parts(6_682_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -191,8 +159,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_851_000 picoseconds.
Weight::from_parts(1_940_000, 0)
// Minimum execution time: 1_833_000 picoseconds.
Weight::from_parts(1_973_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -218,8 +186,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `145`
// Estimated: `3610`
// Minimum execution time: 27_449_000 picoseconds.
Weight::from_parts(28_513_000, 0)
// Minimum execution time: 27_318_000 picoseconds.
Weight::from_parts(28_224_000, 0)
.saturating_add(Weight::from_parts(0, 3610))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
......@@ -244,8 +212,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `363`
// Estimated: `3828`
// Minimum execution time: 29_477_000 picoseconds.
Weight::from_parts(30_251_000, 0)
// Minimum execution time: 29_070_000 picoseconds.
Weight::from_parts(30_205_000, 0)
.saturating_add(Weight::from_parts(0, 3828))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -256,8 +224,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_894_000 picoseconds.
Weight::from_parts(2_009_000, 0)
// Minimum execution time: 1_904_000 picoseconds.
Weight::from_parts(2_033_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -267,8 +235,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `159`
// Estimated: `13524`
// Minimum execution time: 17_991_000 picoseconds.
Weight::from_parts(18_651_000, 0)
// Minimum execution time: 18_348_000 picoseconds.
Weight::from_parts(18_853_000, 0)
.saturating_add(Weight::from_parts(0, 13524))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -279,8 +247,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `163`
// Estimated: `13528`
// Minimum execution time: 18_321_000 picoseconds.
Weight::from_parts(18_701_000, 0)
// Minimum execution time: 17_964_000 picoseconds.
Weight::from_parts(18_548_000, 0)
.saturating_add(Weight::from_parts(0, 13528))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -291,8 +259,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `173`
// Estimated: `16013`
// Minimum execution time: 19_762_000 picoseconds.
Weight::from_parts(20_529_000, 0)
// Minimum execution time: 19_708_000 picoseconds.
Weight::from_parts(20_157_000, 0)
.saturating_add(Weight::from_parts(0, 16013))
.saturating_add(T::DbWeight::get().reads(6))
}
......@@ -314,8 +282,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `212`
// Estimated: `6152`
// Minimum execution time: 26_927_000 picoseconds.
Weight::from_parts(27_629_000, 0)
// Minimum execution time: 26_632_000 picoseconds.
Weight::from_parts(27_314_000, 0)
.saturating_add(Weight::from_parts(0, 6152))
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(3))
......@@ -326,8 +294,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `206`
// Estimated: `11096`
// Minimum execution time: 11_957_000 picoseconds.
Weight::from_parts(12_119_000, 0)
// Minimum execution time: 11_929_000 picoseconds.
Weight::from_parts(12_304_000, 0)
.saturating_add(Weight::from_parts(0, 11096))
.saturating_add(T::DbWeight::get().reads(4))
}
......@@ -337,8 +305,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `170`
// Estimated: `13535`
// Minimum execution time: 17_942_000 picoseconds.
Weight::from_parts(18_878_000, 0)
// Minimum execution time: 18_599_000 picoseconds.
Weight::from_parts(19_195_000, 0)
.saturating_add(Weight::from_parts(0, 13535))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -361,8 +329,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `212`
// Estimated: `13577`
// Minimum execution time: 35_640_000 picoseconds.
Weight::from_parts(36_340_000, 0)
// Minimum execution time: 35_524_000 picoseconds.
Weight::from_parts(36_272_000, 0)
.saturating_add(Weight::from_parts(0, 13577))
.saturating_add(T::DbWeight::get().reads(11))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -376,7 +344,7 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Measured: `103`
// Estimated: `1588`
// Minimum execution time: 4_044_000 picoseconds.
Weight::from_parts(4_229_000, 0)
Weight::from_parts(4_238_000, 0)
.saturating_add(Weight::from_parts(0, 1588))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -387,8 +355,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `7740`
// Estimated: `11205`
// Minimum execution time: 26_262_000 picoseconds.
Weight::from_parts(26_842_000, 0)
// Minimum execution time: 25_741_000 picoseconds.
Weight::from_parts(26_301_000, 0)
.saturating_add(Weight::from_parts(0, 11205))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......@@ -399,8 +367,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `160`
// Estimated: `3625`
// Minimum execution time: 36_775_000 picoseconds.
Weight::from_parts(37_265_000, 0)
// Minimum execution time: 35_925_000 picoseconds.
Weight::from_parts(36_978_000, 0)
.saturating_add(Weight::from_parts(0, 3625))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......
......@@ -35,16 +35,17 @@ use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use westend_runtime_constants::xcm as xcm_constants;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter,
IsConcrete, LocatableAssetId, OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
FrameTransactionalProcessor, FungibleAdapter, IsConcrete, LocatableAssetId,
OriginToPluralityVoice, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
XcmFeeToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
use xcm_executor::XcmExecutor;
parameter_types! {
pub const WndLocation: Location = Location::parent();
......@@ -138,83 +139,6 @@ impl Contains<Location> for ParentOrParentsPlurality {
}
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
///
/// Calls that are allowed through this filter must:
/// 1. Have a fixed weight;
/// 2. Cannot lead to another call being made;
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
pub struct SafeCallFilter;
impl Contains<RuntimeCall> for SafeCallFilter {
fn contains(call: &RuntimeCall) -> bool {
#[cfg(feature = "runtime-benchmarks")]
{
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
return true
}
}
matches!(
call,
RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::authorize_upgrade { .. } |
frame_system::Call::authorize_upgrade_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(..) |
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::PolkadotXcm(
pallet_xcm::Call::force_xcm_version { .. } |
pallet_xcm::Call::force_default_xcm_version { .. }
) | RuntimeCall::XcmpQueue(..) |
RuntimeCall::MessageQueue(..) |
RuntimeCall::Alliance(
// `init_members` accepts unbounded vecs as arguments,
// but the call can be initiated only by root origin.
pallet_alliance::Call::init_members { .. } |
pallet_alliance::Call::vote { .. } |
pallet_alliance::Call::disband { .. } |
pallet_alliance::Call::set_rule { .. } |
pallet_alliance::Call::announce { .. } |
pallet_alliance::Call::remove_announcement { .. } |
pallet_alliance::Call::join_alliance { .. } |
pallet_alliance::Call::nominate_ally { .. } |
pallet_alliance::Call::elevate_ally { .. } |
pallet_alliance::Call::give_retirement_notice { .. } |
pallet_alliance::Call::retire { .. } |
pallet_alliance::Call::kick_member { .. } |
pallet_alliance::Call::close { .. } |
pallet_alliance::Call::abdicate_fellow_status { .. },
) | RuntimeCall::AllianceMotion(
pallet_collective::Call::vote { .. } |
pallet_collective::Call::disapprove_proposal { .. } |
pallet_collective::Call::close { .. },
) | RuntimeCall::FellowshipCollective(
pallet_ranked_collective::Call::add_member { .. } |
pallet_ranked_collective::Call::promote_member { .. } |
pallet_ranked_collective::Call::demote_member { .. } |
pallet_ranked_collective::Call::remove_member { .. },
) | RuntimeCall::FellowshipCore(
pallet_core_fellowship::Call::bump { .. } |
pallet_core_fellowship::Call::set_params { .. } |
pallet_core_fellowship::Call::set_active { .. } |
pallet_core_fellowship::Call::approve { .. } |
pallet_core_fellowship::Call::induct { .. } |
pallet_core_fellowship::Call::promote { .. } |
pallet_core_fellowship::Call::offboard { .. } |
pallet_core_fellowship::Call::submit_evidence { .. } |
pallet_core_fellowship::Call::import { .. },
)
)
}
}
pub type Barrier = TrailingSetTopicAsId<
DenyThenTry<
DenyReserveTransferToRelayChain,
......@@ -233,6 +157,8 @@ pub type Barrier = TrailingSetTopicAsId<
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
......@@ -287,8 +213,8 @@ impl xcm_executor::Config for XcmConfig {
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
......
......@@ -15,11 +15,7 @@
#[cfg(feature = "std")]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.build()
substrate_wasm_builder::WasmBuilder::build_using_defaults();
}
#[cfg(not(feature = "std"))]
......
......@@ -98,6 +98,8 @@ pub type UncheckedExtrinsic =
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
cumulus_pallet_parachain_system::migration::Migration<Runtime>,
cumulus_pallet_xcmp_queue::migration::v2::MigrationToV2<Runtime>,
cumulus_pallet_xcmp_queue::migration::v3::MigrationToV3<Runtime>,
......
......@@ -38,22 +38,22 @@ use sp_runtime::traits::AccountIdConversion;
use testnet_parachains_constants::rococo::currency::CENTS;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, EnsureXcmOrigin, FixedWeightBounds, FrameTransactionalProcessor, FungibleAdapter,
IsConcrete, NativeAsset, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WithComputedOrigin, WithUniqueTopic, XcmFeeManagerFromComponents,
XcmFeeToAccount,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FixedWeightBounds,
FrameTransactionalProcessor, FungibleAdapter, IsConcrete, NativeAsset, ParentAsSuperuser,
ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
};
use xcm_executor::XcmExecutor;
parameter_types! {
pub const RelayLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = None;
pub const RelayNetwork: NetworkId = NetworkId::Rococo;
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorLocation = Parachain(ParachainInfo::parachain_id().into()).into();
pub UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())].into();
pub const ExecutiveBody: BodyId = BodyId::Executive;
pub TreasuryAccount: AccountId = TREASURY_PALLET_ID.into_account_truncating();
pub RelayTreasuryLocation: Location = (Parent, PalletInstance(rococo_runtime_constants::TREASURY_PALLET_ID)).into();
......@@ -149,6 +149,8 @@ pub type Barrier = TrailingSetTopicAsId<
)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
......
......@@ -108,6 +108,7 @@ pub type UncheckedExtrinsic =
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
pallet_broker::migration::MigrateV0ToV1<Runtime>,
// permanent
......
......@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_xcm`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-03-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-02-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-h2rr8wx7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-rococo-dev")`, DB CACHE: 1024
// Executed Command:
......@@ -62,28 +62,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `74`
// Estimated: `3539`
// Minimum execution time: 18_767_000 picoseconds.
Weight::from_parts(19_420_000, 0)
.saturating_add(Weight::from_parts(0, 3539))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn send_blob() -> Weight {
// Proof Size summary in bytes:
// Measured: `74`
// Estimated: `3539`
// Minimum execution time: 19_184_000 picoseconds.
Weight::from_parts(19_695_000, 0)
// Minimum execution time: 35_051_000 picoseconds.
Weight::from_parts(35_200_000, 0)
.saturating_add(Weight::from_parts(0, 3539))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -104,8 +84,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3571`
// Minimum execution time: 58_120_000 picoseconds.
Weight::from_parts(59_533_000, 0)
// Minimum execution time: 56_235_000 picoseconds.
Weight::from_parts(58_178_000, 0)
.saturating_add(Weight::from_parts(0, 3571))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -140,24 +120,14 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `Benchmark::Override` (r:0 w:0)
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn execute_blob() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_074_000 picoseconds.
Weight::from_parts(6_398_000, 0)
// Minimum execution time: 6_226_000 picoseconds.
Weight::from_parts(6_403_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -167,8 +137,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_036_000 picoseconds.
Weight::from_parts(2_180_000, 0)
// Minimum execution time: 2_020_000 picoseconds.
Weight::from_parts(2_100_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -192,8 +162,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `74`
// Estimated: `3539`
// Minimum execution time: 25_014_000 picoseconds.
Weight::from_parts(25_374_000, 0)
// Minimum execution time: 24_387_000 picoseconds.
Weight::from_parts(24_814_000, 0)
.saturating_add(Weight::from_parts(0, 3539))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
......@@ -216,8 +186,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `292`
// Estimated: `3757`
// Minimum execution time: 27_616_000 picoseconds.
Weight::from_parts(28_499_000, 0)
// Minimum execution time: 27_039_000 picoseconds.
Weight::from_parts(27_693_000, 0)
.saturating_add(Weight::from_parts(0, 3757))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -228,8 +198,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_061_000 picoseconds.
Weight::from_parts(2_153_000, 0)
// Minimum execution time: 1_920_000 picoseconds.
Weight::from_parts(2_082_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -239,8 +209,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `89`
// Estimated: `13454`
// Minimum execution time: 16_592_000 picoseconds.
Weight::from_parts(16_900_000, 0)
// Minimum execution time: 17_141_000 picoseconds.
Weight::from_parts(17_500_000, 0)
.saturating_add(Weight::from_parts(0, 13454))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -251,8 +221,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `93`
// Estimated: `13458`
// Minimum execution time: 16_694_000 picoseconds.
Weight::from_parts(16_905_000, 0)
// Minimum execution time: 17_074_000 picoseconds.
Weight::from_parts(17_431_000, 0)
.saturating_add(Weight::from_parts(0, 13458))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -263,8 +233,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `15946`
// Minimum execution time: 17_779_000 picoseconds.
Weight::from_parts(18_490_000, 0)
// Minimum execution time: 19_139_000 picoseconds.
Weight::from_parts(19_474_000, 0)
.saturating_add(Weight::from_parts(0, 15946))
.saturating_add(T::DbWeight::get().reads(6))
}
......@@ -284,8 +254,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `6082`
// Minimum execution time: 24_526_000 picoseconds.
Weight::from_parts(25_182_000, 0)
// Minimum execution time: 24_346_000 picoseconds.
Weight::from_parts(25_318_000, 0)
.saturating_add(Weight::from_parts(0, 6082))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
......@@ -296,8 +266,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `136`
// Estimated: `11026`
// Minimum execution time: 10_467_000 picoseconds.
Weight::from_parts(10_934_000, 0)
// Minimum execution time: 11_777_000 picoseconds.
Weight::from_parts(12_051_000, 0)
.saturating_add(Weight::from_parts(0, 11026))
.saturating_add(T::DbWeight::get().reads(4))
}
......@@ -307,8 +277,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `100`
// Estimated: `13465`
// Minimum execution time: 16_377_000 picoseconds.
Weight::from_parts(17_114_000, 0)
// Minimum execution time: 17_538_000 picoseconds.
Weight::from_parts(17_832_000, 0)
.saturating_add(Weight::from_parts(0, 13465))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -329,8 +299,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `13507`
// Minimum execution time: 32_575_000 picoseconds.
Weight::from_parts(33_483_000, 0)
// Minimum execution time: 33_623_000 picoseconds.
Weight::from_parts(34_186_000, 0)
.saturating_add(Weight::from_parts(0, 13507))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -343,8 +313,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `32`
// Estimated: `1517`
// Minimum execution time: 3_604_000 picoseconds.
Weight::from_parts(3_744_000, 0)
// Minimum execution time: 3_363_000 picoseconds.
Weight::from_parts(3_511_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -355,8 +325,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `7669`
// Estimated: `11134`
// Minimum execution time: 23_983_000 picoseconds.
Weight::from_parts(24_404_000, 0)
// Minimum execution time: 23_969_000 picoseconds.
Weight::from_parts(24_347_000, 0)
.saturating_add(Weight::from_parts(0, 11134))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......@@ -367,8 +337,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `90`
// Estimated: `3555`
// Minimum execution time: 34_446_000 picoseconds.
Weight::from_parts(35_465_000, 0)
// Minimum execution time: 34_071_000 picoseconds.
Weight::from_parts(35_031_000, 0)
.saturating_add(Weight::from_parts(0, 3555))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......
......@@ -39,16 +39,16 @@ use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, IsConcrete,
NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
FungibleAdapter, IsConcrete, NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
use xcm_executor::XcmExecutor;
parameter_types! {
pub const RocRelayLocation: Location = Location::parent();
......@@ -139,49 +139,6 @@ impl Contains<Location> for ParentOrParentsPlurality {
}
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
///
/// Calls that are allowed through this filter must:
/// 1. Have a fixed weight;
/// 2. Cannot lead to another call being made;
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
pub struct SafeCallFilter;
impl Contains<RuntimeCall> for SafeCallFilter {
fn contains(call: &RuntimeCall) -> bool {
#[cfg(feature = "runtime-benchmarks")]
{
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
return true
}
}
matches!(
call,
RuntimeCall::PolkadotXcm(
pallet_xcm::Call::force_xcm_version { .. } |
pallet_xcm::Call::force_default_xcm_version { .. }
) | RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::authorize_upgrade { .. } |
frame_system::Call::authorize_upgrade_without_checks { .. } |
frame_system::Call::kill_prefix { .. } |
// Should not be in Polkadot/Kusama. Here in order to speed up testing.
frame_system::Call::set_storage { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::Sudo(..) |
RuntimeCall::CollatorSelection(..) |
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::Broker(..)
)
}
}
pub type Barrier = TrailingSetTopicAsId<
DenyThenTry<
DenyReserveTransferToRelayChain,
......@@ -199,6 +156,8 @@ pub type Barrier = TrailingSetTopicAsId<
AllowExplicitUnpaidExecutionFrom<ParentOrParentsPlurality>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
......@@ -258,8 +217,8 @@ impl xcm_executor::Config for XcmConfig {
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
......
......@@ -108,6 +108,7 @@ pub type UncheckedExtrinsic =
/// Migrations to apply on runtime upgrade.
pub type Migrations = (
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
pallet_broker::migration::MigrateV0ToV1<Runtime>,
// permanent
......
......@@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_xcm`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-03-21, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-02-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-h2rr8wx7-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-bn-ce5rx-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("coretime-westend-dev")`, DB CACHE: 1024
// Executed Command:
......@@ -62,28 +62,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `74`
// Estimated: `3539`
// Minimum execution time: 17_681_000 picoseconds.
Weight::from_parts(18_350_000, 0)
.saturating_add(Weight::from_parts(0, 3539))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::VersionDiscoveryQueue` (r:1 w:1)
/// Proof: `PolkadotXcm::VersionDiscoveryQueue` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `PolkadotXcm::SafeXcmVersion` (r:1 w:0)
/// Proof: `PolkadotXcm::SafeXcmVersion` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::HostConfiguration` (r:1 w:0)
/// Proof: `ParachainSystem::HostConfiguration` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `ParachainSystem::PendingUpwardMessages` (r:1 w:1)
/// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn send_blob() -> Weight {
// Proof Size summary in bytes:
// Measured: `74`
// Estimated: `3539`
// Minimum execution time: 18_091_000 picoseconds.
Weight::from_parts(18_327_000, 0)
// Minimum execution time: 18_410_000 picoseconds.
Weight::from_parts(18_657_000, 0)
.saturating_add(Weight::from_parts(0, 3539))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -104,8 +84,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `3571`
// Minimum execution time: 54_943_000 picoseconds.
Weight::from_parts(56_519_000, 0)
// Minimum execution time: 56_616_000 picoseconds.
Weight::from_parts(57_751_000, 0)
.saturating_add(Weight::from_parts(0, 3571))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -140,24 +120,14 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `Benchmark::Override` (r:0 w:0)
/// Proof: `Benchmark::Override` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn execute_blob() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
Weight::from_parts(18_446_744_073_709_551_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// Storage: `PolkadotXcm::SupportedVersion` (r:0 w:1)
/// Proof: `PolkadotXcm::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`)
fn force_xcm_version() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_887_000 picoseconds.
Weight::from_parts(6_101_000, 0)
// Minimum execution time: 6_014_000 picoseconds.
Weight::from_parts(6_412_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -167,8 +137,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_940_000 picoseconds.
Weight::from_parts(2_022_000, 0)
// Minimum execution time: 1_844_000 picoseconds.
Weight::from_parts(1_957_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -192,8 +162,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `74`
// Estimated: `3539`
// Minimum execution time: 23_165_000 picoseconds.
Weight::from_parts(23_800_000, 0)
// Minimum execution time: 24_067_000 picoseconds.
Weight::from_parts(24_553_000, 0)
.saturating_add(Weight::from_parts(0, 3539))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
......@@ -216,8 +186,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `292`
// Estimated: `3757`
// Minimum execution time: 26_506_000 picoseconds.
Weight::from_parts(27_180_000, 0)
// Minimum execution time: 27_023_000 picoseconds.
Weight::from_parts(27_620_000, 0)
.saturating_add(Weight::from_parts(0, 3757))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -228,8 +198,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_868_000 picoseconds.
Weight::from_parts(2_002_000, 0)
// Minimum execution time: 1_866_000 picoseconds.
Weight::from_parts(1_984_000, 0)
.saturating_add(Weight::from_parts(0, 0))
.saturating_add(T::DbWeight::get().writes(1))
}
......@@ -239,8 +209,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `89`
// Estimated: `13454`
// Minimum execution time: 16_138_000 picoseconds.
Weight::from_parts(16_447_000, 0)
// Minimum execution time: 16_425_000 picoseconds.
Weight::from_parts(16_680_000, 0)
.saturating_add(Weight::from_parts(0, 13454))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -251,8 +221,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `93`
// Estimated: `13458`
// Minimum execution time: 16_099_000 picoseconds.
Weight::from_parts(16_592_000, 0)
// Minimum execution time: 16_171_000 picoseconds.
Weight::from_parts(16_564_000, 0)
.saturating_add(Weight::from_parts(0, 13458))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -263,8 +233,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `106`
// Estimated: `15946`
// Minimum execution time: 17_972_000 picoseconds.
Weight::from_parts(18_379_000, 0)
// Minimum execution time: 17_785_000 picoseconds.
Weight::from_parts(18_123_000, 0)
.saturating_add(Weight::from_parts(0, 15946))
.saturating_add(T::DbWeight::get().reads(6))
}
......@@ -284,8 +254,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `6082`
// Minimum execution time: 23_554_000 picoseconds.
Weight::from_parts(24_446_000, 0)
// Minimum execution time: 23_903_000 picoseconds.
Weight::from_parts(24_769_000, 0)
.saturating_add(Weight::from_parts(0, 6082))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(3))
......@@ -296,8 +266,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `136`
// Estimated: `11026`
// Minimum execution time: 10_541_000 picoseconds.
Weight::from_parts(10_894_000, 0)
// Minimum execution time: 10_617_000 picoseconds.
Weight::from_parts(10_843_000, 0)
.saturating_add(Weight::from_parts(0, 11026))
.saturating_add(T::DbWeight::get().reads(4))
}
......@@ -307,8 +277,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `100`
// Estimated: `13465`
// Minimum execution time: 16_404_000 picoseconds.
Weight::from_parts(16_818_000, 0)
// Minimum execution time: 16_656_000 picoseconds.
Weight::from_parts(17_106_000, 0)
.saturating_add(Weight::from_parts(0, 13465))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -329,8 +299,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `142`
// Estimated: `13507`
// Minimum execution time: 31_617_000 picoseconds.
Weight::from_parts(32_336_000, 0)
// Minimum execution time: 31_721_000 picoseconds.
Weight::from_parts(32_547_000, 0)
.saturating_add(Weight::from_parts(0, 13507))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(4))
......@@ -343,8 +313,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `32`
// Estimated: `1517`
// Minimum execution time: 3_328_000 picoseconds.
Weight::from_parts(3_501_000, 0)
// Minimum execution time: 3_439_000 picoseconds.
Weight::from_parts(3_619_000, 0)
.saturating_add(Weight::from_parts(0, 1517))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
......@@ -355,8 +325,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `7669`
// Estimated: `11134`
// Minimum execution time: 23_571_000 picoseconds.
Weight::from_parts(24_312_000, 0)
// Minimum execution time: 24_657_000 picoseconds.
Weight::from_parts(24_971_000, 0)
.saturating_add(Weight::from_parts(0, 11134))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......@@ -367,8 +337,8 @@ impl<T: frame_system::Config> pallet_xcm::WeightInfo for WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `90`
// Estimated: `3555`
// Minimum execution time: 32_879_000 picoseconds.
Weight::from_parts(33_385_000, 0)
// Minimum execution time: 34_028_000 picoseconds.
Weight::from_parts(34_697_000, 0)
.saturating_add(Weight::from_parts(0, 3555))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
......
......@@ -39,16 +39,16 @@ use polkadot_runtime_common::xcm_sender::ExponentialPrice;
use sp_runtime::traits::AccountIdConversion;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, DenyReserveTransferToRelayChain,
DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor, FungibleAdapter, IsConcrete,
NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative,
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowHrmpNotificationsFromRelayChain,
AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
DenyReserveTransferToRelayChain, DenyThenTry, EnsureXcmOrigin, FrameTransactionalProcessor,
FungibleAdapter, IsConcrete, NonFungibleAdapter, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
XcmFeeManagerFromComponents, XcmFeeToAccount,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
use xcm_executor::XcmExecutor;
parameter_types! {
pub const TokenRelayLocation: Location = Location::parent();
......@@ -146,48 +146,6 @@ impl Contains<Location> for FellowsPlurality {
}
}
/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
///
/// Calls that are allowed through this filter must:
/// 1. Have a fixed weight;
/// 2. Cannot lead to another call being made;
/// 3. Have a defined proof size weight, e.g. no unbounded vecs in call parameters.
pub struct SafeCallFilter;
impl Contains<RuntimeCall> for SafeCallFilter {
fn contains(call: &RuntimeCall) -> bool {
#[cfg(feature = "runtime-benchmarks")]
{
if matches!(call, RuntimeCall::System(frame_system::Call::remark_with_event { .. })) {
return true
}
}
matches!(
call,
RuntimeCall::PolkadotXcm(
pallet_xcm::Call::force_xcm_version { .. } |
pallet_xcm::Call::force_default_xcm_version { .. }
) | RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::authorize_upgrade { .. } |
frame_system::Call::authorize_upgrade_without_checks { .. } |
frame_system::Call::kill_prefix { .. } |
// Should not be in Polkadot/Kusama. Here in order to speed up testing.
frame_system::Call::set_storage { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(..) |
RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::Broker(..)
)
}
}
pub type Barrier = TrailingSetTopicAsId<
DenyThenTry<
DenyReserveTransferToRelayChain,
......@@ -206,6 +164,8 @@ pub type Barrier = TrailingSetTopicAsId<
AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>,
// Subscriptions for version tracking are OK.
AllowSubscriptionsFrom<ParentRelayOrSiblingParachains>,
// HRMP notifications from the relay chain are OK.
AllowHrmpNotificationsFromRelayChain,
),
UniversalLocation,
ConstU32<8>,
......@@ -265,8 +225,8 @@ impl xcm_executor::Config for XcmConfig {
>;
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
type TransactionalProcessor = FrameTransactionalProcessor;
type HrmpNewChannelOpenRequestHandler = ();
......