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

Update polkadot dependencies #417

Merged
merged 27 commits into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
update snowbridge-runtime for new dependencies
  • Loading branch information
vgeddes committed Jun 8, 2021
commit 17100ad1690c34ff5c333cc7b39e321d4cfebeb0
1 change: 0 additions & 1 deletion parachain/Cargo.lock

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

2 changes: 0 additions & 2 deletions parachain/runtime/snowbridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot.git", branch = "re
polkadot-parachain = { git = "https://github.com/paritytech/polkadot.git", branch = "release-v0.9.4", default-features = false }

artemis-core = { path = "../../primitives/core", default-features = false }
artemis-transfer = { path = "../../pallets/transfer", default-features = false }
artemis-xcm-support = { path = "../../primitives/xcm-support", default-features = false }
basic-channel = { path = "../../pallets/basic-channel", package = "artemis-basic-channel", default-features = false }
incentivized-channel = { path = "../../pallets/incentivized-channel", package = "artemis-incentivized-channel", default-features = false }
Expand Down Expand Up @@ -123,7 +122,6 @@ std = [
"dot-app/std",
"eth-app/std",
"erc20-app/std",
"artemis-transfer/std",
"artemis-xcm-support/std",
"runtime-common/std",
]
Expand Down
115 changes: 44 additions & 71 deletions parachain/runtime/snowbridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ use dispatch::EnsureEthereumAccount;

pub use verifier_lightclient::{EthereumDifficultyConfig, EthereumHeader};

use cumulus_primitives_core::relay_chain::Balance as RelayChainBalance;
use polkadot_parachain::primitives::Sibling;
use xcm::v0::{Junction, MultiLocation, NetworkId};
use xcm::v0::{MultiAsset, Junction, MultiLocation, NetworkId, Xcm};
use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, CurrencyAdapter,
EnsureXcmOrigin, FixedRateOfConcreteFungible, FixedWeightBounds, IsConcrete, LocationInverter,
EnsureXcmOrigin, UsingComponents, FixedWeightBounds, IsConcrete, LocationInverter,
NativeAsset, ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
SiblingParachainConvertsVia, SignedAccountId32AsNative,
SovereignSignedViaLocation, TakeWeightCredit,
};
use xcm_executor::{Config, XcmExecutor};
use pallet_xcm::{XcmPassthrough, EnsureXcm, IsMajorityOfBody};

use artemis_xcm_support::AssetsTransactor;
use assets::SingleAssetAdaptor;
Expand Down Expand Up @@ -274,67 +274,28 @@ impl pallet_transaction_payment::Config for Runtime {

parameter_types! {
pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;
pub const ReservedDmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT / 4;

}

impl cumulus_pallet_parachain_system::Config for Runtime {
type Event = Event;
type OnValidationData = ();
type SelfParaId = parachain_info::Module<Runtime>;
type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
MaxDownwardMessageWeight,
XcmExecutor<XcmConfig>,
Call,
>;
type SelfParaId = parachain_info::Pallet<Runtime>;
type DmpMessageHandler = DmpQueue;
type ReservedDmpWeight = ReservedDmpWeight;
type OutboundXcmpMessageSource = XcmpQueue;
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
}

impl parachain_info::Config for Runtime {}

pub struct RelayToNative;
impl Convert<RelayChainBalance, Balance> for RelayToNative {
fn convert(val: u128) -> Balance {
val
}
}

pub struct NativeToRelay;
impl Convert<Balance, RelayChainBalance> for NativeToRelay {
fn convert(val: u128) -> Balance {
val
}
}

parameter_types! {
pub const PolkadotNetworkId: NetworkId = NetworkId::Polkadot;
}

pub struct AccountId32Converter;
impl Convert<AccountId, [u8; 32]> for AccountId32Converter {
fn convert(account_id: AccountId) -> [u8; 32] {
account_id.into()
}
}

impl artemis_transfer::Config for Runtime {
type Event = Event;
type Balance = Balance;
type ToRelayChainBalance = NativeToRelay;
type AccountIdConverter = SignedToAccountId32<Origin, AccountId, PolkadotNetworkId>;
type AccountId32Converter = AccountId32Converter;
type RelayChainNetworkId = PolkadotNetworkId;
type ParaId = ParachainInfo;
type XcmExecutor = XcmExecutor<XcmConfig>;
}

parameter_types! {
pub const RococoLocation: MultiLocation = MultiLocation::X1(Junction::Parent);
pub const RococoNetwork: NetworkId = NetworkId::Polkadot;
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub Ancestry: MultiLocation = MultiLocation::X1(Junction::Parachain {
id: ParachainInfo::parachain_id().into(),
});
pub Ancestry: MultiLocation = Junction::Parachain(ParachainInfo::parachain_id().into()).into();
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand All @@ -359,6 +320,8 @@ type LocalAssetTransactor2 = CurrencyAdapter<
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We don't track any teleports.
()
>;

type LocalAssetTransactor = (LocalAssetTransactor1, LocalAssetTransactor2);
Expand Down Expand Up @@ -414,7 +377,7 @@ impl Config for XcmConfig {
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
type Trader = FixedRateOfConcreteFungible<WeightPrice>;
type Trader = UsingComponents<IdentityFee<Balance>, RococoLocation, AccountId, Balances, ()>;
type ResponseHandler = (); // Don't handle responses for now.
}

Expand All @@ -439,17 +402,31 @@ impl pallet_xcm::Config for Runtime {
type SendXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<Origin, LocalOriginToLocation>;
type XcmExecuteFilter = All<(MultiLocation, Xcm<Call>)>;
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = All<(MultiLocation, Vec<MultiAsset>)>;
type XcmReserveTransferFilter = All<(MultiLocation, Vec<MultiAsset>)>;
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
}

impl cumulus_pallet_xcm::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
}

impl cumulus_pallet_xcm::Config for Runtime {}

impl cumulus_pallet_xcmp_queue::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
}

// Governance

impl pallet_sudo::Config for Runtime {
Expand Down Expand Up @@ -645,26 +622,26 @@ construct_runtime!(
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 2,
TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 3,
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage} = 4,
Utility: pallet_utility::{Pallet, Call, Event, Storage} = 5,

ParachainInfo: parachain_info::{Pallet, Storage, Config} = 5,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 6,
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 6,
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 7,

LocalCouncil: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 7,
LocalCouncilMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 8,
LocalCouncil: pallet_collective::<Instance1>::{Pallet, Call, Storage, Origin<T>, Event<T>, Config<T>} = 8,
LocalCouncilMembership: pallet_membership::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>} = 9,

BasicInboundChannel: basic_channel_inbound::{Pallet, Call, Config, Storage, Event} = 9,
BasicOutboundChannel: basic_channel_outbound::{Pallet, Config<T>, Storage, Event} = 10,
IncentivizedInboundChannel: incentivized_channel_inbound::{Pallet, Call, Config, Storage, Event} = 11,
IncentivizedOutboundChannel: incentivized_channel_outbound::{Pallet, Config<T>, Storage, Event} = 12,
Dispatch: dispatch::{Pallet, Call, Storage, Event<T>, Origin} = 13,
VerifierLightclient: verifier_lightclient::{Pallet, Call, Storage, Event, Config} = 14,
Assets: assets::{Pallet, Call, Config<T>, Storage, Event<T>} = 15,
BasicInboundChannel: basic_channel_inbound::{Pallet, Call, Config, Storage, Event} = 10,
BasicOutboundChannel: basic_channel_outbound::{Pallet, Config<T>, Storage, Event} = 11,
IncentivizedInboundChannel: incentivized_channel_inbound::{Pallet, Call, Config, Storage, Event} = 12,
IncentivizedOutboundChannel: incentivized_channel_outbound::{Pallet, Config<T>, Storage, Event} = 13,
Dispatch: dispatch::{Pallet, Call, Storage, Event<T>, Origin} = 14,
VerifierLightclient: verifier_lightclient::{Pallet, Call, Storage, Event, Config} = 15,
Assets: assets::{Pallet, Call, Config<T>, Storage, Event<T>} = 16,
vgeddes marked this conversation as resolved.
Show resolved Hide resolved

XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 16,
LocalXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 17,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Origin} = 18,
Transfer: artemis_transfer::{Pallet, Call, Event<T>} = 19,
Utility: pallet_utility::{Pallet, Call, Event, Storage} = 20,
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 17,
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 18,
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 19,
CumulusXcm: cumulus_pallet_xcm::{Pallet, Event<T>, Origin} = 20,

// For dev only, will be removed in production
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>} = 21,
Expand Down Expand Up @@ -748,10 +725,6 @@ impl_runtime_apis! {
) -> sp_inherents::CheckInherentsResult {
data.check_extrinsics(&block)
}

fn random_seed() -> <Block as BlockT>::Hash {
RandomnessCollectiveFlip::random_seed().0
}
}

impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
Expand Down