Skip to content

Commit

Permalink
Now we're thinking with portals!
Browse files Browse the repository at this point in the history
  • Loading branch information
arrudagates committed Jan 8, 2024
1 parent c73e867 commit 334d42f
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 25 deletions.
73 changes: 54 additions & 19 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ members = [
"runtime",
]

resolver = "2"

[patch.crates-io]
ss58-registry = { git = "https://github.com/paritytech/ss58-registry" }
3 changes: 3 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ async-trait = { version = "0.1.48" }
jsonrpc-core = "18.0.0"
hex = "0.4.0"

#librocksdb-sys = "=0.6.2+6.28.2"
bindgen = "0.62"

# Local
gm-chain-runtime = { path = "../runtime" }

Expand Down
2 changes: 2 additions & 0 deletions runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ scale-info = { version = "2.1", default-features = false, features = ["derive"]
serde = { version = "1.0.137", optional = true, features = ["derive"] }
smallvec = "1.6.1"

#librocksdb-sys = "=0.6.2+6.28.2"

# Chess
pallet-chess = { git = "https://github.com/SubstrateChess/pallet-chess.git", default-features = false, branch = "gmordie" }

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("gm_parachain"),
impl_name: create_runtime_str!("gm_parachain"),
authoring_version: 1,
spec_version: 9,
spec_version: 10,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
21 changes: 17 additions & 4 deletions runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ parameter_types! {
pub const RelayNetwork: NetworkId = NetworkId::Any;
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
pub Ancestry: MultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();

/// The check account, which holds any native assets that have been teleported out and not back in (yet).
pub CheckAccount: AccountId = PolkadotXcm::check_account();

pub const FrenLocation: MultiLocation = MultiLocation { parents: 0, interior: Here };
}

/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used
Expand All @@ -45,13 +50,13 @@ pub type LocalAssetTransactor = CurrencyAdapter<
// Use this currency:
Balances,
// Use this currency when it is a fungible asset matching the given location or name:
IsConcrete<RelayLocation>,
IsConcrete<FrenLocation>,
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
LocationToAccountId,
// Our chain's account ID type (we can't get away without mentioning it explicitly):
AccountId,
// We don't track any teleports.
(),
// We track our teleports in/out to keep total issuance correct.
CheckAccount,
>;

/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance,
Expand Down Expand Up @@ -180,6 +185,14 @@ pub type Barrier = DenyThenTry<
),
>;

parameter_types! {
pub const AssetHub: MultiLocation = MultiLocation { parents: 1, interior: X1(Parachain(1000)) };
pub const FrenFilter: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(FrenLocation::get()) });
pub const FrenForAssetHub: (MultiAssetFilter, MultiLocation) = (FrenFilter::get(), AssetHub::get());
}

pub type TrustedTeleporters = (xcm_builder::Case<FrenForAssetHub>,);

pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
type Call = Call;
Expand All @@ -188,7 +201,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type IsReserve = NativeAsset;
type IsTeleporter = (); // Teleporting is disabled.
type IsTeleporter = TrustedTeleporters;
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, Call, MaxInstructions>;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2022-11-01"
targets = ["wasm32-unknown-unknown"]
components = [ "rustfmt", "rustc", "rust-std", "cargo", "clippy", "llvm-tools-preview"]
components = [ "rustfmt", "rustc", "rust-std", "cargo", "clippy", "llvm-tools-preview", "rust-analyzer"]

0 comments on commit 334d42f

Please sign in to comment.