Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

XCM: Tools for uniquely referencing messages #7234

Merged
merged 37 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9540a98
Tools for unique topic references
gavofyork May 15, 2023
56b0df6
Formatting
gavofyork May 15, 2023
0f31fa6
Naming
gavofyork May 15, 2023
6ff9860
Repot into routing.rs.
gavofyork May 16, 2023
7a14617
More things done
gavofyork May 16, 2023
95c68e5
Universal Exporter supports topic-as-reference
gavofyork May 16, 2023
d78faba
Some tests for the topic routing
gavofyork May 17, 2023
d3301c7
More tests
gavofyork May 17, 2023
e0782f9
Paid bridge tests
gavofyork May 18, 2023
1ed9851
Add message ID to sending events
gavofyork May 19, 2023
8a2ed2a
Formatting
gavofyork May 19, 2023
c31e62e
fix and integrate into test nets
gavofyork May 19, 2023
88cc42f
Move DenyThenTry and friend from Cumulus
gavofyork May 19, 2023
e493a04
Merge remote-tracking branch 'origin/master' into gav-unique-topics
gavofyork May 19, 2023
db53caf
Append SetTopic rather than prepend
gavofyork May 21, 2023
fc437ed
Docs
gavofyork May 21, 2023
0476580
Merge remote-tracking branch 'origin/master' into gav-unique-topics
gavofyork May 21, 2023
1deacc6
Docs
gavofyork May 21, 2023
8247ae9
Work with new ProcessMessage ID API
gavofyork May 21, 2023
f44a4cd
Formatting
gavofyork May 21, 2023
23424e5
Fix build
gavofyork May 21, 2023
02794fa
Fixes
gavofyork May 21, 2023
7465a1c
Merge remote-tracking branch 'origin/master' into gav-unique-topics
gavofyork May 21, 2023
8d4f53a
Formatting
gavofyork May 21, 2023
9dc95f6
Update xcm/xcm-builder/src/barriers.rs
gavofyork May 22, 2023
bee9da3
Update xcm/xcm-builder/src/routing.rs
gavofyork May 22, 2023
1fa45d9
Docs
gavofyork May 23, 2023
98c6f86
Rename message_hash
gavofyork May 23, 2023
f4d7d7c
Merge branch 'gav-unique-topics' of github.com:paritytech/polkadot in…
gavofyork May 23, 2023
5d03354
Formatting
gavofyork May 23, 2023
2adf2f7
".git/.scripts/commands/fmt/fmt.sh"
May 24, 2023
207f8fd
Rename
gavofyork May 24, 2023
b49b43c
Another Rename
gavofyork May 24, 2023
523a7dc
".git/.scripts/commands/fmt/fmt.sh"
May 24, 2023
739b3b1
Merge remote-tracking branch 'origin/master' into gav-unique-topics
gavofyork May 24, 2023
24141b2
".git/.scripts/commands/fmt/fmt.sh"
May 24, 2023
ca065f4
Update xcm/xcm-builder/src/routing.rs
gavofyork May 25, 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
101 changes: 50 additions & 51 deletions node/core/dispute-coordinator/src/initialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,62 +214,61 @@ impl Initialized {
gum::trace!(target: LOG_TARGET, "Waiting for message");
let mut overlay_db = OverlayedBackend::new(backend);
let default_confirm = Box::new(|| Ok(()));
let confirm_write = match MuxedMessage::receive(ctx, &mut self.participation_receiver)
.await?
{
MuxedMessage::Participation(msg) => {
gum::trace!(target: LOG_TARGET, "MuxedMessage::Participation");
let ParticipationStatement {
session,
candidate_hash,
candidate_receipt,
outcome,
} = self.participation.get_participation_result(ctx, msg).await?;
if let Some(valid) = outcome.validity() {
gum::trace!(
target: LOG_TARGET,
?session,
?candidate_hash,
?valid,
"Issuing local statement based on participation outcome."
);
self.issue_local_statement(
ctx,
&mut overlay_db,
let confirm_write =
match MuxedMessage::receive(ctx, &mut self.participation_receiver).await? {
MuxedMessage::Participation(msg) => {
gum::trace!(target: LOG_TARGET, "MuxedMessage::Participation");
let ParticipationStatement {
session,
candidate_hash,
candidate_receipt,
session,
valid,
clock.now(),
)
.await?;
} else {
gum::warn!(target: LOG_TARGET, ?outcome, "Dispute participation failed");
}
default_confirm
},
MuxedMessage::Subsystem(msg) => match msg {
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::ActiveLeaves");
self.process_active_leaves_update(
ctx,
&mut overlay_db,
update,
clock.now(),
)
.await?;
outcome,
} = self.participation.get_participation_result(ctx, msg).await?;
if let Some(valid) = outcome.validity() {
gum::trace!(
target: LOG_TARGET,
?session,
?candidate_hash,
?valid,
"Issuing local statement based on participation outcome."
);
self.issue_local_statement(
ctx,
&mut overlay_db,
candidate_hash,
candidate_receipt,
session,
valid,
clock.now(),
)
.await?;
} else {
gum::warn!(target: LOG_TARGET, ?outcome, "Dispute participation failed");
}
default_confirm
},
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, n)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::BlockFinalized");
self.scraper.process_finalized_block(&n);
default_confirm
MuxedMessage::Subsystem(msg) => match msg {
FromOrchestra::Signal(OverseerSignal::Conclude) => return Ok(()),
FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::ActiveLeaves");
self.process_active_leaves_update(
ctx,
&mut overlay_db,
update,
clock.now(),
)
.await?;
default_confirm
},
FromOrchestra::Signal(OverseerSignal::BlockFinalized(_, n)) => {
gum::trace!(target: LOG_TARGET, "OverseerSignal::BlockFinalized");
self.scraper.process_finalized_block(&n);
default_confirm
},
FromOrchestra::Communication { msg } =>
self.handle_incoming(ctx, &mut overlay_db, msg, clock.now()).await?,
},
FromOrchestra::Communication { msg } =>
self.handle_incoming(ctx, &mut overlay_db, msg, clock.now()).await?,
},
};
};

if !overlay_db.is_empty() {
let ops = overlay_db.into_write_ops();
Expand Down
12 changes: 6 additions & 6 deletions runtime/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ use xcm_builder::{
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds,
WithComputedOrigin,
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
};
use xcm_executor::traits::WithOriginFilter;

Expand Down Expand Up @@ -115,14 +115,14 @@ parameter_types! {

/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
/// individual routers.
pub type XcmRouter = (
pub type XcmRouter = WithUniqueTopic<(
// Only one router so far - use DMP to communicate with child parachains.
ChildParachainRouter<
Runtime,
XcmPallet,
ExponentialPrice<FeeAssetId, BaseDeliveryFee, TransactionByteFee, Dmp>,
>,
);
)>;

parameter_types! {
pub const Ksm: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) });
Expand All @@ -142,7 +142,7 @@ match_types! {
}

/// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = (
pub type Barrier = TrailingSetTopicAsId<(
// Weight that is paid for may be consumed.
TakeWeightCredit,
// Expected responses are OK.
Expand All @@ -159,7 +159,7 @@ pub type Barrier = (
UniversalLocation,
ConstU32<8>,
>,
);
)>;

/// A call filter for the XCM Transact instruction. This is a temporary measure until we properly
/// account for proof size weights.
Expand Down
11 changes: 6 additions & 5 deletions runtime/rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ use xcm_builder::{
ChildParachainAsNative, ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
MintLocation, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
TakeWeightCredit, UsingComponents, WeightInfoBounds, WithComputedOrigin,
TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin,
WithUniqueTopic,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand Down Expand Up @@ -95,14 +96,14 @@ parameter_types! {

/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
/// individual routers.
pub type XcmRouter = (
pub type XcmRouter = WithUniqueTopic<(
// Only one router so far - use DMP to communicate with child parachains.
ChildParachainRouter<
Runtime,
XcmPallet,
ExponentialPrice<FeeAssetId, BaseDeliveryFee, TransactionByteFee, Dmp>,
>,
);
)>;

parameter_types! {
pub const Roc: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete(TokenLocation::get()) });
Expand Down Expand Up @@ -137,7 +138,7 @@ match_types! {
}

/// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = (
pub type Barrier = TrailingSetTopicAsId<(
// Weight that is paid for may be consumed.
TakeWeightCredit,
// Expected responses are OK.
Expand All @@ -154,7 +155,7 @@ pub type Barrier = (
UniversalLocation,
ConstU32<8>,
>,
);
)>;

/// A call filter for the XCM Transact instruction. This is a temporary measure until we
/// properly account for proof size weights.
Expand Down
10 changes: 5 additions & 5 deletions runtime/westend/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use xcm_builder::{
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, MintLocation,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
UsingComponents, WeightInfoBounds, WithComputedOrigin,
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
};
use xcm_executor::{traits::WithOriginFilter, XcmExecutor};

Expand Down Expand Up @@ -80,14 +80,14 @@ type LocalOriginConverter = (

/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
/// individual routers.
pub type XcmRouter = (
pub type XcmRouter = WithUniqueTopic<(
// Only one router so far - use DMP to communicate with child parachains.
ChildParachainRouter<
Runtime,
XcmPallet,
ExponentialPrice<FeeAssetId, BaseDeliveryFee, TransactionByteFee, Dmp>,
>,
);
)>;

parameter_types! {
pub const Westmint: MultiLocation = Parachain(1000).into_location();
Expand All @@ -108,7 +108,7 @@ pub type TrustedTeleporters =
(xcm_builder::Case<WndForWestmint>, xcm_builder::Case<WndForCollectives>);

/// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = (
pub type Barrier = TrailingSetTopicAsId<(
// Weight that is paid for may be consumed.
TakeWeightCredit,
// Expected responses are OK.
Expand All @@ -125,7 +125,7 @@ pub type Barrier = (
UniversalLocation,
ConstU32<8>,
>,
);
)>;

/// A call filter for the XCM Transact instruction. This is a temporary measure until we
/// properly account for proof size weights.
Expand Down
6 changes: 3 additions & 3 deletions xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ benchmarks_instance_pallet! {
&sender_location,
&XcmContext {
origin: Some(sender_location.clone()),
message_hash: [0; 32],
message_id: [0; 32],
topic: None,
},
).unwrap();
Expand Down Expand Up @@ -82,7 +82,7 @@ benchmarks_instance_pallet! {
&sender_location,
&XcmContext {
origin: Some(sender_location.clone()),
message_hash: [0; 32],
message_id: [0; 32],
topic: None,
},
).unwrap();
Expand All @@ -109,7 +109,7 @@ benchmarks_instance_pallet! {
&sender_location,
&XcmContext {
origin: Some(sender_location.clone()),
message_hash: [0; 32],
message_id: [0; 32],
topic: None,
},
).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ benchmarks! {
assets.clone().into(),
&XcmContext {
origin: Some(origin.clone()),
message_hash: [0; 32],
message_id: [0; 32],
topic: None,
},
);
Expand Down Expand Up @@ -266,7 +266,7 @@ benchmarks! {
max_response_weight,
&XcmContext {
origin: Some(origin.clone()),
message_hash: [0; 32],
message_id: [0; 32],
topic: None,
},
).map_err(|_| "Could not start subscription")?;
Expand Down
Loading