Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
308 changes: 154 additions & 154 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion runtime/common/src/paras_sudo_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use runtime_parachains::{
paras::{self, ParaGenesisArgs},
ump, ParaLifecycle,
};
use sp_std::boxed::Box;

#[frame_support::pallet]
pub mod pallet {
Expand Down Expand Up @@ -132,7 +133,7 @@ pub mod pallet {
pub fn sudo_queue_downward_xcm(
origin: OriginFor<T>,
id: ParaId,
xcm: xcm::opaque::VersionedXcm,
xcm: Box<xcm::opaque::VersionedXcm>,
) -> DispatchResult {
ensure_root(origin)?;
ensure!(<paras::Pallet<T>>::is_valid_para(id), Error::<T>::ParaDoesntExist);
Expand Down
10 changes: 10 additions & 0 deletions runtime/kusama/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,13 @@ fn era_payout_should_give_sensible_results() {
assert_eq!(era_payout(75, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), (10, 0));
assert_eq!(era_payout(80, 100, Perquintill::from_percent(10), Perquintill::one(), 0,), (6, 4));
}

#[test]
fn call_size() {
assert!(
core::mem::size_of::<Call>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to reduce \
the size of Call.
If the limit is too strong, maybe consider increase the limit to 300.",
);
}
15 changes: 15 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1683,3 +1683,18 @@ mod test_fees {
assert!(active > target_voters, "we need to reevaluate the weight of the election system");
}
}

#[cfg(test)]
mod test {
use super::*;

#[test]
fn call_size() {
assert!(
core::mem::size_of::<Call>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to \
reduce the size of Call.
If the limit is too strong, maybe consider increase the limit",
);
}
}
10 changes: 10 additions & 0 deletions runtime/westend/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,13 @@ fn sample_size_is_sensible() {
BlockWeights::get().max_block
);
}

#[test]
fn call_size() {
assert!(
core::mem::size_of::<Call>() <= 230,
"size of Call is more than 230 bytes: some calls have too big arguments, use Box to reduce \
the size of Call.
If the limit is too strong, maybe consider increase the limit to 300.",
);
}
2 changes: 1 addition & 1 deletion utils/staking-miner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ macro_rules! construct_runtime_prelude {

let crate::signer::Signer { account, pair, .. } = signer;

let local_call = EPMCall::<Runtime>::submit(raw_solution, witness);
let local_call = EPMCall::<Runtime>::submit(Box::new(raw_solution), witness);
let call: Call = <EPMCall<Runtime> as std::convert::TryInto<Call>>::try_into(local_call)
.expect("election provider pallet must exist in the runtime, thus \
inner call can be converted, qed."
Expand Down
30 changes: 17 additions & 13 deletions xcm/pallet-xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,19 @@ pub mod pallet {
#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::weight(100_000_000)]
pub fn send(origin: OriginFor<T>, dest: MultiLocation, message: Xcm<()>) -> DispatchResult {
pub fn send(
origin: OriginFor<T>,
dest: Box<MultiLocation>,
message: Box<Xcm<()>>,
) -> DispatchResult {
let origin_location = T::SendXcmOrigin::ensure_origin(origin)?;
Self::send_xcm(origin_location.clone(), dest.clone(), message.clone()).map_err(
Self::send_xcm(origin_location.clone(), *dest.clone(), *message.clone()).map_err(
|e| match e {
XcmError::CannotReachDestination(..) => Error::<T>::Unreachable,
_ => Error::<T>::SendFailure,
},
)?;
Self::deposit_event(Event::Sent(origin_location, dest, message));
Self::deposit_event(Event::Sent(origin_location, *dest, *message));
Ok(())
}

Expand All @@ -144,16 +148,16 @@ pub mod pallet {
assets: assets.clone(),
effects: sp_std::vec![ InitiateTeleport {
assets: Wild(All),
dest: dest.clone(),
dest: *dest.clone(),
effects: sp_std::vec![],
} ]
};
T::Weigher::weight(&mut message).map_or(Weight::max_value(), |w| 100_000_000 + w)
})]
pub fn teleport_assets(
origin: OriginFor<T>,
dest: MultiLocation,
beneficiary: MultiLocation,
dest: Box<MultiLocation>,
beneficiary: Box<MultiLocation>,
assets: MultiAssets,
fee_asset_item: u32,
dest_weight: Weight,
Expand All @@ -176,7 +180,7 @@ pub mod pallet {
assets,
effects: vec![InitiateTeleport {
assets: Wild(All),
dest,
dest: *dest,
effects: vec![
BuyExecution {
fees,
Expand All @@ -187,7 +191,7 @@ pub mod pallet {
orders: vec![],
instructions: vec![],
},
DepositAsset { assets: Wild(All), max_assets, beneficiary },
DepositAsset { assets: Wild(All), max_assets, beneficiary: *beneficiary },
],
}],
};
Expand Down Expand Up @@ -216,15 +220,15 @@ pub mod pallet {
#[pallet::weight({
let mut message = Xcm::TransferReserveAsset {
assets: assets.clone(),
dest: dest.clone(),
dest: *dest.clone(),
effects: sp_std::vec![],
};
T::Weigher::weight(&mut message).map_or(Weight::max_value(), |w| 100_000_000 + w)
})]
pub fn reserve_transfer_assets(
origin: OriginFor<T>,
dest: MultiLocation,
beneficiary: MultiLocation,
dest: Box<MultiLocation>,
beneficiary: Box<MultiLocation>,
assets: MultiAssets,
fee_asset_item: u32,
dest_weight: Weight,
Expand All @@ -245,7 +249,7 @@ pub mod pallet {
let assets = assets.into();
let mut message = Xcm::TransferReserveAsset {
assets,
dest,
dest: *dest,
effects: vec![
BuyExecution {
fees,
Expand All @@ -256,7 +260,7 @@ pub mod pallet {
orders: vec![],
instructions: vec![],
},
DepositAsset { assets: Wild(All), max_assets, beneficiary },
DepositAsset { assets: Wild(All), max_assets, beneficiary: *beneficiary },
],
};
let weight =
Expand Down
20 changes: 12 additions & 8 deletions xcm/pallet-xcm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ fn send_works() {
DepositAsset { assets: All.into(), max_assets: 1, beneficiary: sender.clone() },
],
};
assert_ok!(XcmPallet::send(Origin::signed(ALICE), RelayLocation::get(), message.clone()));
assert_ok!(XcmPallet::send(
Origin::signed(ALICE),
Box::new(RelayLocation::get()),
Box::new(message.clone())
));
assert_eq!(
sent_xcm(),
vec![(
Expand Down Expand Up @@ -83,7 +87,7 @@ fn send_fails_when_xcm_router_blocks() {
assert_noop!(
XcmPallet::send(
Origin::signed(ALICE),
X8(
Box::new(X8(
Junction::Parent,
Junction::Parent,
Junction::Parent,
Expand All @@ -92,8 +96,8 @@ fn send_fails_when_xcm_router_blocks() {
Junction::Parent,
Junction::Parent,
Junction::Parent
),
message.clone()
)),
Box::new(message.clone())
),
crate::Error::<Test>::SendFailure
);
Expand All @@ -113,8 +117,8 @@ fn teleport_assets_works() {
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
assert_ok!(XcmPallet::teleport_assets(
Origin::signed(ALICE),
RelayLocation::get(),
X1(AccountId32 { network: Any, id: BOB.into() }),
Box::new(RelayLocation::get()),
Box::new(X1(AccountId32 { network: Any, id: BOB.into() })),
(Here, SEND_AMOUNT).into(),
0,
weight,
Expand Down Expand Up @@ -142,8 +146,8 @@ fn reserve_transfer_assets_works() {
assert_eq!(Balances::total_balance(&ALICE), INITIAL_BALANCE);
assert_ok!(XcmPallet::reserve_transfer_assets(
Origin::signed(ALICE),
Parachain(PARA_ID).into(),
dest.clone(),
Box::new(Parachain(PARA_ID).into()),
Box::new(dest.clone()),
(Here, SEND_AMOUNT).into(),
0,
weight
Expand Down
4 changes: 2 additions & 2 deletions xcm/xcm-simulator/example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ mod tests {
Relay::execute_with(|| {
assert_ok!(RelayChainPalletXcm::reserve_transfer_assets(
relay_chain::Origin::signed(ALICE),
X1(Parachain(1)),
X1(AccountId32 { network: Any, id: ALICE.into() }),
Box::new(X1(Parachain(1))),
Box::new(X1(AccountId32 { network: Any, id: ALICE.into() })),
(Here, 123).into(),
0,
3,
Expand Down