Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump to polkadot-v0.9.39 #156

Merged
merged 3 commits into from
Apr 1, 2023
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
4,083 changes: 2,527 additions & 1,556 deletions Cargo.lock

Large diffs are not rendered by default.

302 changes: 151 additions & 151 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(clippy::all)]
use sc_cli::KeySubcommand;
use std::path::PathBuf;

Expand Down
8 changes: 7 additions & 1 deletion node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ where
block_announce_validator_builder: Some(Box::new(|_| {
Box::new(block_announce_validator)
})),
warp_sync: None,
warp_sync_params: None,
})?;

if validator {
Expand Down Expand Up @@ -392,6 +392,10 @@ where
Arc::new(move |hash, data| network.announce_block(hash, data))
};

let overseer_handle = relay_chain_interface
.overseer_handle()
.map_err(|e| sc_service::Error::Application(Box::new(e)))?;

let relay_chain_slot_duration = Duration::from_secs(6);

if validator {
Expand Down Expand Up @@ -441,6 +445,7 @@ where
import_queue: import_queue_service,
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
};

start_collator(params).await?;
Expand All @@ -453,6 +458,7 @@ where
relay_chain_interface,
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
};

start_full_node(params)?;
Expand Down
8 changes: 7 additions & 1 deletion node/src/service_aura.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async fn start_node_impl(
block_announce_validator_builder: Some(Box::new(|_| {
Box::new(block_announce_validator)
})),
warp_sync: None,
warp_sync_params: None,
})?;

if parachain_config.offchain_worker.enabled {
Expand Down Expand Up @@ -258,6 +258,10 @@ async fn start_node_impl(

let relay_chain_slot_duration = Duration::from_secs(6);

let overseer_handle = relay_chain_interface
.overseer_handle()
.map_err(|e| sc_service::Error::Application(Box::new(e)))?;

if validator {
let parachain_consensus = build_consensus(
client.clone(),
Expand Down Expand Up @@ -286,6 +290,7 @@ async fn start_node_impl(
import_queue: import_queue_service,
collator_key: collator_key.expect("Command line arguments do not allow this. qed"),
relay_chain_slot_duration,
recovery_handle: Box::new(overseer_handle),
};

start_collator(params).await?;
Expand All @@ -298,6 +303,7 @@ async fn start_node_impl(
relay_chain_interface,
relay_chain_slot_duration,
import_queue: import_queue_service,
recovery_handle: Box::new(overseer_handle),
};

start_full_node(params)?;
Expand Down
2 changes: 1 addition & 1 deletion primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 of a second of compute with a 12 second average block time.
pub const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
WEIGHT_REF_TIME_PER_SECOND.saturating_div(2),
cumulus_primitives_core::relay_chain::v2::MAX_POV_SIZE as u64,
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
);
14 changes: 11 additions & 3 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,7 @@ parameter_types! {

impl pallet_authorship::Config for Runtime {
type EventHandler = ();
type FilterUncle = ();
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
type UncleGenerations = UncleGenerations;
}

parameter_types! {
Expand Down Expand Up @@ -411,6 +409,7 @@ impl pallet_dkg_metadata::Config for Runtime {
type SigningJailSentence = Period;
type SessionPeriod = SessionPeriod;
type DecayPercentage = DecayPercentage;
type ForceOrigin = EnsureRoot<AccountId>;
type Reputation = Reputation;
type UnsignedPriority = UnsignedPriority;
type UnsignedInterval = UnsignedInterval;
Expand All @@ -434,6 +433,7 @@ parameter_types! {

impl pallet_dkg_proposal_handler::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ForceOrigin = EnsureRoot<AccountId>;
type OffChainAuthId = dkg_runtime_primitives::offchain::crypto::OffchainAuthId;
type MaxSubmissionsPerBatch = frame_support::traits::ConstU16<100>;
type UnsignedProposalExpiry = UnsignedProposalExpiry;
Expand Down Expand Up @@ -599,6 +599,7 @@ parameter_types! {

impl pallet_democracy::Config for Runtime {
type BlacklistOrigin = EnsureRoot<AccountId>;
type SubmitOrigin = frame_system::EnsureSigned<AccountId>;
// To cancel a proposal before it has been passed, the technical committee must
// be unanimous or Root must agree.
type CancelProposalOrigin = EitherOfDiverse<
Expand Down Expand Up @@ -663,6 +664,7 @@ impl pallet_collective::Config<CouncilCollective> for Runtime {
type DefaultVote = pallet_collective::PrimeDefaultVote;
type RuntimeEvent = RuntimeEvent;
type MaxMembers = CouncilMaxMembers;
type SetMembersOrigin = EnsureRoot<AccountId>;
type MaxProposals = CouncilMaxProposals;
type MotionDuration = CouncilMotionDuration;
type RuntimeOrigin = RuntimeOrigin;
Expand Down Expand Up @@ -858,7 +860,7 @@ construct_runtime!(
AuthorInherent: pallet_author_inherent::{Pallet, Call, Storage, Inherent} = 28,
AuraAuthorFilter: pallet_aura_style_filter::{Pallet, Storage} = 29,
// Collator support. the order of these 4 are important and shall not change.
Authorship: pallet_authorship::{Pallet, Call, Storage} = 30,
Authorship: pallet_authorship::{Pallet, Storage} = 30,
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>} = 32,
Aura: pallet_aura::{Pallet, Storage, Config<T>} = 33,
//AuraExt: cumulus_pallet_aura_ext::{Pallet, Storage, Config} = 34,
Expand Down Expand Up @@ -1110,6 +1112,12 @@ impl_runtime_apis! {
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl pallet_linkable_tree_rpc_runtime_api::LinkableTreeApi<Block, ChainId, Element, LeafIndex> for Runtime {
Expand Down
95 changes: 64 additions & 31 deletions runtime/rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,35 @@
// limitations under the License.
//
use super::{
AccountId, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall,
RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use crate::{DmpQueue, Weight, MAXIMUM_BLOCK_WEIGHT};
use crate::{DmpQueue, EnsureRoot, MAXIMUM_BLOCK_WEIGHT};
use core::marker::PhantomData;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use frame_support::{
log, match_types, parameter_types,
traits::{Everything, Nothing},
traits::{ConstU32, Everything, Nothing},
weights::Weight,
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::latest::{prelude::*, Weight as XCMWeight};
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedWeightBounds, IsConcrete, LocationInverter, NativeAsset, ParentIsPreset,
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom,
CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents,
UsingComponents, WithComputedOrigin,
};
use xcm_executor::{traits::ShouldExecute, XcmExecutor};

parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const RelayNetwork: NetworkId = NetworkId::Any;
pub const RelayNetwork: Option<NetworkId> = None;
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand Down Expand Up @@ -84,16 +85,17 @@ pub type XcmOriginToTransactDispatchOrigin = (
// recognized.
SiblingParachainAsNative<cumulus_pallet_xcm::Origin, RuntimeOrigin>,
// Native signed account converter; this just converts an `AccountId32` origin into a normal
// `Origin::Signed` origin of the same 32-byte value.
// `RuntimeOrigin::Signed` origin of the same 32-byte value.
SignedAccountId32AsNative<RelayNetwork, RuntimeOrigin>,
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
XcmPassthrough<RuntimeOrigin>,
);

parameter_types! {
// One XCM operation is 1_000_000_000 weight - almost certainly a conservative estimate.
pub UnitWeightCost: u64 = 1_000_000_000;
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 64 * 1024);
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
}

match_types! {
Expand All @@ -118,25 +120,25 @@ where
{
fn should_execute<RuntimeCall>(
origin: &MultiLocation,
message: &mut Xcm<RuntimeCall>,
max_weight: XCMWeight,
weight_credit: &mut XCMWeight,
message: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
weight_credit: &mut Weight,
) -> Result<(), ()> {
Deny::should_execute(origin, message, max_weight, weight_credit)?;
Allow::should_execute(origin, message, max_weight, weight_credit)
}
}

// See issue #5233
// See issue <https://github.com/paritytech/polkadot/issues/5233>
pub struct DenyReserveTransferToRelayChain;
impl ShouldExecute for DenyReserveTransferToRelayChain {
fn should_execute<RuntimeCall>(
origin: &MultiLocation,
message: &mut Xcm<RuntimeCall>,
_max_weight: XCMWeight,
_weight_credit: &mut XCMWeight,
message: &mut [Instruction<RuntimeCall>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
if message.0.iter().any(|inst| {
if message.iter().any(|inst| {
matches!(
inst,
InitiateReserveWithdraw {
Expand All @@ -155,7 +157,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
// An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve`
// should not allow this, but we just log it here.
if matches!(origin, MultiLocation { parents: 1, interior: Here }) &&
message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
{
log::warn!(
target: "xcm::barriers",
Expand All @@ -171,9 +173,15 @@ pub type Barrier = DenyThenTry<
DenyReserveTransferToRelayChain,
(
TakeWeightCredit,
AllowTopLevelPaidExecutionFrom<Everything>,
AllowUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
// ^^^ Parent and its exec plurality get free execution
WithComputedOrigin<
(
AllowTopLevelPaidExecutionFrom<Everything>,
AllowExplicitUnpaidExecutionFrom<ParentOrParentsExecutivePlurality>,
// ^^^ Parent and its exec plurality get free execution
),
UniversalLocation,
ConstU32<8>,
>,
),
>;

Expand All @@ -186,7 +194,7 @@ impl xcm_executor::Config for XcmConfig {
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = NativeAsset;
type IsTeleporter = (); // Teleporting is disabled.
type LocationInverter = LocationInverter<Ancestry>;
type UniversalLocation = UniversalLocation;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader =
Expand All @@ -195,6 +203,15 @@ impl xcm_executor::Config for XcmConfig {
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
}

/// No local origins on this chain are allowed to dispatch XCM sends/executions.
Expand All @@ -204,11 +221,16 @@ pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, R
/// queues.
pub type XcmRouter = (
// Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, ()>,
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, (), ()>,
// ..and XCMP to communicate with the sibling chains.
XcmpQueue,
);

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
}

impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
Expand All @@ -221,13 +243,21 @@ impl pallet_xcm::Config for Runtime {
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Nothing;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type LocationInverter = LocationInverter<Ancestry>;
type UniversalLocation = UniversalLocation;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;

const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
// ^ Override for AdvertisedXcmVersion default
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
type Currency = Balances;
type CurrencyMatcher = ();
type TrustedLockers = ();
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>;
type WeightInfo = pallet_xcm::TestWeightInfo;
#[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDest;
}

impl cumulus_pallet_xcm::Config for Runtime {
Expand All @@ -243,17 +273,19 @@ parameter_types! {
impl cumulus_pallet_parachain_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
type SelfParaId = parachain_info::Pallet<Runtime>;
type OutboundXcmpMessageSource = XcmpQueue;
type DmpMessageHandler = DmpQueue;
type ReservedDmpWeight = ReservedDmpWeight;
type OutboundXcmpMessageSource = XcmpQueue;
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
}

impl parachain_info::Config for Runtime {}

// impl cumulus_pallet_aura_ext::Config for Runtime {}

impl cumulus_pallet_xcmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
Expand All @@ -263,10 +295,11 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = ();
type PriceForSiblingDelivery = ();
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ExecuteOverweightOrigin = frame_system::EnsureRoot<AccountId>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
}
2 changes: 1 addition & 1 deletion scripts/parachain-launch/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Relaychain Configuration
relaychain:
image: parity/polkadot:v0.9.36 # the docker image to use
image: parity/polkadot:v0.9.39 # the docker image to use
chain: rococo-local # the chain to use
runtimeGenesisConfig: # additonal genesis override
configuration:
Expand Down
2 changes: 1 addition & 1 deletion standalone/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

#![allow(clippy::all)]
use sc_cli::RunCmd;

#[derive(Debug, clap::Parser)]
Expand Down
Loading