Skip to content

Commit

Permalink
[Coretime] Always include UnpaidExecution, not just when revenue is >…
Browse files Browse the repository at this point in the history
… 0 (#5369)

The NotifyRevenue XCM from relay to coretime chain fails to pass the
barrier when revenue is 0.


https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/parachains/src/coretime/mod.rs#L401
pushes notifyrevenue onto an [empty
vec](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/parachains/src/coretime/mod.rs#L361)
when `revenue == 0`, so it never explicitly requests unpaid execution,
because that happens only in [the block where revenue is `>
0`](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/parachains/src/coretime/mod.rs#L387).

This will need to be backported to 1.14 when merged.
  • Loading branch information
seadanda committed Aug 28, 2024
1 parent c9e5cf1 commit f570b0d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
9 changes: 4 additions & 5 deletions polkadot/runtime/parachains/src/coretime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,10 @@ fn mk_coretime_call<T: Config>(call: crate::coretime::CoretimeCalls) -> Instruct

fn do_notify_revenue<T: Config>(when: BlockNumber, raw_revenue: Balance) -> Result<(), XcmError> {
let dest = Junction::Parachain(T::BrokerId::get()).into_location();
let mut message = Vec::new();
let mut message = vec![Instruction::UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
}];
let asset = Asset { id: AssetId(Location::here()), fun: Fungible(raw_revenue) };
let dummy_xcm_context = XcmContext { origin: None, message_id: [0; 32], topic: None };

Expand All @@ -384,10 +387,6 @@ fn do_notify_revenue<T: Config>(when: BlockNumber, raw_revenue: Balance) -> Resu

message.extend(
[
Instruction::UnpaidExecution {
weight_limit: WeightLimit::Unlimited,
check_origin: None,
},
ReceiveTeleportedAsset(assets_reanchored),
DepositAsset {
assets: Wild(AllCounted(1)),
Expand Down
15 changes: 15 additions & 0 deletions prdoc/pr_5369.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Schema: Polkadot SDK PRDoc Schema (prdoc) v1.0.0
# See doc at https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/prdoc/schema_user.json

title: Fix failing XCM from relay to Coretime Chain when revenue is zero

doc:
- audience: Runtime Dev
description: |
The coretime assigner now always includes UnpaidExecution when calling `notify_revenue` via a
`Transact`, not just when revenue is nonzero. This fixes an issue where the XCM would fail to
process on the receiving side.

crates:
- name: polkadot-runtime-parachains
bump: patch

0 comments on commit f570b0d

Please sign in to comment.