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

New publish instruction #2359

Draft
wants to merge 108 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
6d5beca
Copy XCM V3 to V4
franciscoaguirre Aug 28, 2023
bf114a0
Add v4 procedural
franciscoaguirre Aug 28, 2023
b33c516
".git/.scripts/commands/fmt/fmt.sh"
Aug 28, 2023
9dc896e
Fix all errors
franciscoaguirre Aug 29, 2023
b61f5dd
Fix all conversion tests
franciscoaguirre Aug 29, 2023
2b61dff
Ported over polkadot#7236
franciscoaguirre Aug 29, 2023
053efa6
Fix more conversion issues
franciscoaguirre Aug 30, 2023
1e73a45
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Aug 30, 2023
812df22
Fix more version things
franciscoaguirre Aug 31, 2023
8ec2a1d
Fix pallet-xcm tests
franciscoaguirre Sep 1, 2023
56512b9
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 1, 2023
b179a75
".git/.scripts/commands/fmt/fmt.sh"
Sep 1, 2023
f132002
Import GetWeight from v2
franciscoaguirre Sep 1, 2023
35e3b12
Fix clippy issues
franciscoaguirre Sep 1, 2023
fe8ab73
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 1, 2023
c4ea551
".git/.scripts/commands/fmt/fmt.sh"
Sep 1, 2023
bb7892c
Fix cumulus issues
franciscoaguirre Sep 2, 2023
a18be4c
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 2, 2023
6465d73
".git/.scripts/commands/fmt/fmt.sh"
Sep 2, 2023
e550269
Fix fuzzer compilation issue
franciscoaguirre Sep 2, 2023
df82a6f
Fix assets benchmarks
franciscoaguirre Sep 2, 2023
27b3f7a
Fix compilation issues
franciscoaguirre Sep 2, 2023
12e7768
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 2, 2023
3226676
".git/.scripts/commands/fmt/fmt.sh"
Sep 2, 2023
66227d3
Fix runtime-benchmarks compilation issues
franciscoaguirre Sep 3, 2023
e1a581d
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 3, 2023
d448008
Merge commit
franciscoaguirre Sep 4, 2023
3005d80
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 4, 2023
95db365
Fix limits test
franciscoaguirre Sep 4, 2023
8126d0a
Fix
franciscoaguirre Sep 4, 2023
85d9c22
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 5, 2023
e66e438
Remove the 'Multi' prefix from Locations and Assets
franciscoaguirre Sep 5, 2023
51f7b0c
Fixes
franciscoaguirre Sep 6, 2023
bf01267
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 6, 2023
16f63ce
Address feedback and fix some outstanding issues
franciscoaguirre Sep 6, 2023
9eadae5
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 7, 2023
09f8470
Fix small type confusion
franciscoaguirre Sep 7, 2023
36038eb
Fix small type confusion
franciscoaguirre Sep 7, 2023
50b4ae6
Fix small type confusion
franciscoaguirre Sep 7, 2023
3bacb50
Fix small type confusion
franciscoaguirre Sep 7, 2023
6f9306a
Fix small type confusion
franciscoaguirre Sep 7, 2023
1684d48
Fix small type confusion
franciscoaguirre Sep 7, 2023
10797bd
Fix conflicts
franciscoaguirre Sep 7, 2023
89998c3
Remove some remnants of Multi
franciscoaguirre Sep 7, 2023
3c653a2
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 7, 2023
f4c5483
".git/.scripts/commands/fmt/fmt.sh"
Sep 7, 2023
ae00c52
Remove Abstract AssetId
franciscoaguirre Sep 7, 2023
2fe9519
Remove more references to abstract assets
franciscoaguirre Sep 7, 2023
042c0cc
Remove more references to abstract assets
franciscoaguirre Sep 7, 2023
71a61b5
Remove more references to abstract assets
franciscoaguirre Sep 8, 2023
73694fa
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 8, 2023
7a3231a
Remove more references to abstract assets
franciscoaguirre Sep 8, 2023
a3a0124
".git/.scripts/commands/fmt/fmt.sh"
Sep 8, 2023
6ac7f6f
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 8, 2023
b9701bf
Update polkadot/xcm/src/lib.rs
franciscoaguirre Sep 9, 2023
f9bfab7
Update polkadot/xcm/src/lib.rs
franciscoaguirre Sep 9, 2023
8f82a46
Address feedback
franciscoaguirre Sep 9, 2023
3cf6607
Fix V3/V4 NetworkId issues
franciscoaguirre Sep 11, 2023
177c30e
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 11, 2023
b0a3c56
".git/.scripts/commands/fmt/fmt.sh"
Sep 11, 2023
efd0146
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 12, 2023
a054f7b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 26, 2023
03dd1b8
Fix some conflicts
franciscoaguirre Sep 26, 2023
7ec0bd7
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 27, 2023
fd06d44
Fix pallet-xcm
franciscoaguirre Sep 27, 2023
2c6db72
Add deprecation warnings in executor
franciscoaguirre Sep 27, 2023
09a697f
Address feedback
franciscoaguirre Sep 27, 2023
953d6d4
Remove more old syntax
franciscoaguirre Sep 27, 2023
00fd94b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Sep 27, 2023
3b0a504
Fix universal exports
franciscoaguirre Sep 27, 2023
09ba7f2
Favor xcm executor's prepare_and_execute
franciscoaguirre Sep 27, 2023
1f15c8e
Fixes
franciscoaguirre Sep 27, 2023
31ab8e9
Fixing old runtime code
franciscoaguirre Sep 28, 2023
9dfc772
Replace more deprecated functions
franciscoaguirre Sep 28, 2023
bab9c85
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 6, 2023
541d495
Rename more instances of multi-things
franciscoaguirre Oct 6, 2023
7129c5b
Moved some muts
franciscoaguirre Oct 9, 2023
056a427
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 20, 2023
3709d36
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 20, 2023
9d375b3
Fix a bunch of things
franciscoaguirre Oct 20, 2023
d81d176
Add TODO for LocatableAssetId to fix conflicts
franciscoaguirre Oct 23, 2023
16d8997
Fix conflicts
franciscoaguirre Oct 23, 2023
a1b9512
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 25, 2023
2e2ade7
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Oct 25, 2023
1e9aeba
Address feedback
franciscoaguirre Oct 25, 2023
3408299
Fix more compiler issues
franciscoaguirre Oct 25, 2023
defc92f
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 1, 2023
223f70f
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 1, 2023
25e7fa2
Fix conflicts and add tests for xcm procedural
franciscoaguirre Nov 1, 2023
00f2c86
Add alias HERE for empty junctions when matching unpacked locations
franciscoaguirre Nov 1, 2023
e4e9ede
Fix unclosed delimiter
franciscoaguirre Nov 1, 2023
06b288a
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 2, 2023
17436b2
Remove unused import
franciscoaguirre Nov 2, 2023
b580ef2
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 3, 2023
d7ba541
Fix conflicts
franciscoaguirre Nov 7, 2023
dd156da
Remove unused stuff and fix conversion example
franciscoaguirre Nov 7, 2023
1136c1b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 7, 2023
e9dc9ca
Make Outcome a named fields struct
franciscoaguirre Nov 7, 2023
dfe5863
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 7, 2023
b036638
Fixed conflicts, only missing the LocatableAssetId issue
franciscoaguirre Nov 7, 2023
2470925
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 9, 2023
08ccf4f
More HEREs
franciscoaguirre Nov 13, 2023
739dc98
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 13, 2023
e0b1da2
Fix conflicts
franciscoaguirre Nov 13, 2023
94f6f98
Fix conflicts
franciscoaguirre Nov 13, 2023
a0a4c1b
Merge branch 'master' into cis-xcm-v4
franciscoaguirre Nov 14, 2023
7bccc37
Fix a lot more conflicts
franciscoaguirre Nov 15, 2023
ab56554
New publish instruction
franciscoaguirre Nov 16, 2023
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
Fix V3/V4 NetworkId issues
  • Loading branch information
franciscoaguirre committed Sep 11, 2023
commit 3cf6607d25d19c606408b8829a7dcdb7ff8d5807
4 changes: 2 additions & 2 deletions polkadot/xcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ macro_rules! versioned_type {
V2(x) => Ok(x),
V3(x) => x.try_into(),
V4(x) => {
let v3: $v3 = x.try_into()?;
let v3: $v3 = x.try_into().map_err(|_| ())?;
v3.try_into()
},
}
Expand All @@ -351,7 +351,7 @@ macro_rules! versioned_type {
match x {
V2(x) => x.try_into(),
V3(x) => Ok(x),
V4(x) => x.try_into(),
V4(x) => x.try_into().map_err(|_| ()),
}
}
}
Expand Down
34 changes: 29 additions & 5 deletions polkadot/xcm/src/v3/junction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
BodyId as OldBodyId, BodyPart as OldBodyPart, Junction as OldJunction,
NetworkId as OldNetworkId,
},
v4::Junction as NewJunction,
v4::{Junction as NewJunction, NetworkId as NewNetworkId},
VersionedLocation,
};
use bounded_collections::{BoundedSlice, BoundedVec, ConstU32};
Expand Down Expand Up @@ -101,6 +101,30 @@ impl TryFrom<OldNetworkId> for NetworkId {
}
}

impl From<NewNetworkId> for Option<NetworkId> {
fn from(new: NewNetworkId) -> Self {
Some(NetworkId::from(new))
}
}

impl From<NewNetworkId> for NetworkId {
fn from(new: NewNetworkId) -> Self {
use NewNetworkId::*;
match new {
ByGenesis(hash) => Self::ByGenesis(hash),
ByFork { block_number, block_hash } => Self::ByFork { block_number, block_hash },
Polkadot => Self::Polkadot,
Kusama => Self::Kusama,
Westend => Self::Westend,
Rococo => Self::Rococo,
Wococo => Self::Wococo,
Ethereum { chain_id } => Self::Ethereum { chain_id },
BitcoinCore => Self::BitcoinCore,
BitcoinCash => Self::BitcoinCash,
}
}
}

/// An identifier of a pluralistic body.
#[derive(
Copy,
Expand Down Expand Up @@ -412,15 +436,15 @@ impl TryFrom<NewJunction> for Junction {
use NewJunction::*;
Ok(match value {
Parachain(id) => Self::Parachain(id),
AccountId32 { network, id } => Self::AccountId32 { network, id },
AccountIndex64 { network, index } => Self::AccountIndex64 { network, index },
AccountKey20 { network, key } => Self::AccountKey20 { network, key },
AccountId32 { network: maybe_network, id } => Self::AccountId32 { network: maybe_network.map(|network| network.into()), id },
AccountIndex64 { network: maybe_network, index } => Self::AccountIndex64 { network: maybe_network.map(|network| network.into()), index },
AccountKey20 { network: maybe_network, key } => Self::AccountKey20 { network: maybe_network.map(|network| network.into()), key },
PalletInstance(index) => Self::PalletInstance(index),
GeneralIndex(id) => Self::GeneralIndex(id),
GeneralKey { length, data } => Self::GeneralKey { length, data },
OnlyChild => Self::OnlyChild,
Plurality { id, part } => Self::Plurality { id, part },
GlobalConsensus(network) => Self::GlobalConsensus(network),
GlobalConsensus(network) => Self::GlobalConsensus(network.into()),
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion polkadot/xcm/src/v3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ impl<Call> TryFrom<NewInstruction<Call>> for Instruction<Call> {
ClearTransactStatus => Self::ClearTransactStatus,
UniversalOrigin(junction) => Self::UniversalOrigin(junction.try_into()?),
ExportMessage { network, destination, xcm } => Self::ExportMessage {
network,
network: network.into(),
destination: destination.try_into()?,
xcm: xcm.try_into()?,
},
Expand Down
82 changes: 76 additions & 6 deletions polkadot/xcm/src/v4/junction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//! Support data structures for `Location`, primarily the `Junction` datatype.

use super::Location;
pub use crate::v3::{BodyId, BodyPart, NetworkId};
use crate::{v3::Junction as OldJunction, VersionedLocation};
pub use crate::v3::{BodyId, BodyPart};
use crate::{v3::{Junction as OldJunction, NetworkId as OldNetworkId}, VersionedLocation};
use bounded_collections::{BoundedSlice, BoundedVec, ConstU32};
use core::convert::TryFrom;
use parity_scale_codec::{self, Decode, Encode, MaxEncodedLen};
Expand Down Expand Up @@ -101,6 +101,76 @@ pub enum Junction {
GlobalConsensus(NetworkId),
}

/// A global identifier of a data structure existing within consensus.
///
/// Maintenance note: Networks with global consensus and which are practically bridgeable within the
/// Polkadot ecosystem are given preference over explicit naming in this enumeration.
#[derive(
Copy,
Clone,
Eq,
PartialEq,
Ord,
PartialOrd,
Encode,
Decode,
Debug,
TypeInfo,
MaxEncodedLen,
Serialize,
Deserialize,
)]
pub enum NetworkId {
/// Network specified by the first 32 bytes of its genesis block.
ByGenesis([u8; 32]),
/// Network defined by the first 32-bytes of the hash and number of some block it contains.
ByFork { block_number: u64, block_hash: [u8; 32] },
/// The Polkadot mainnet Relay-chain.
Polkadot,
/// The Kusama canary-net Relay-chain.
Kusama,
/// The Westend testnet Relay-chain.
Westend,
/// The Rococo testnet Relay-chain.
Rococo,
/// The Wococo testnet Relay-chain.
Wococo,
/// An Ethereum network specified by its chain ID.
Ethereum {
/// The EIP-155 chain ID.
#[codec(compact)]
chain_id: u64,
},
/// The Bitcoin network, including hard-forks supported by Bitcoin Core development team.
BitcoinCore,
/// The Bitcoin network, including hard-forks supported by Bitcoin Cash developers.
BitcoinCash,
}

impl From<OldNetworkId> for Option<NetworkId> {
fn from(old: OldNetworkId) -> Self {
Some(NetworkId::from(old))
}
}

impl From<OldNetworkId> for NetworkId {
fn from(old: OldNetworkId) -> Self {
use OldNetworkId::*;
match old {
ByGenesis(hash) => Self::ByGenesis(hash),
ByFork { block_number, block_hash } => Self::ByFork { block_number, block_hash },
Polkadot => Self::Polkadot,
Kusama => Self::Kusama,
Westend => Self::Westend,
Rococo => Self::Rococo,
Wococo => Self::Wococo,
Ethereum { chain_id } => Self::Ethereum { chain_id },
BitcoinCore => Self::BitcoinCore,
BitcoinCash => Self::BitcoinCash,
}
}
}

impl From<NetworkId> for Junction {
fn from(n: NetworkId) -> Self {
Self::GlobalConsensus(n)
Expand Down Expand Up @@ -162,15 +232,15 @@ impl TryFrom<OldJunction> for Junction {
use OldJunction::*;
Ok(match value {
Parachain(id) => Self::Parachain(id),
AccountId32 { network, id } => Self::AccountId32 { network, id },
AccountIndex64 { network, index } => Self::AccountIndex64 { network, index },
AccountKey20 { network, key } => Self::AccountKey20 { network, key },
AccountId32 { network: maybe_network, id } => Self::AccountId32 { network: maybe_network.map(|network| network.into()), id },
AccountIndex64 { network: maybe_network, index } => Self::AccountIndex64 { network: maybe_network.map(|network| network.into()), index },
AccountKey20 { network: maybe_network, key } => Self::AccountKey20 { network: maybe_network.map(|network| network.into()), key },
PalletInstance(index) => Self::PalletInstance(index),
GeneralIndex(id) => Self::GeneralIndex(id),
GeneralKey { length, data } => Self::GeneralKey { length, data },
OnlyChild => Self::OnlyChild,
Plurality { id, part } => Self::Plurality { id, part },
GlobalConsensus(network) => Self::GlobalConsensus(network),
GlobalConsensus(network) => Self::GlobalConsensus(network.into()),
})
}
}
Expand Down