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

[DNM] Coretime revenue: asset teleport draft #4811

Closed

Conversation

s0me0ne-unkn0wn
Copy link
Contributor

No description provided.

@s0me0ne-unkn0wn s0me0ne-unkn0wn changed the base branch from master to ava-request-revenue-info June 17, 2024 20:30
@@ -88,6 +88,17 @@ impl WeightInfo for TestWeightInfo {
}
}

pub struct RevenueClaim<T: Config> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some docs would be good. What is the purpose of this struct? What is a split_off? ..

Copy link
Contributor

@seadanda seadanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see the XCM seems reasonable as it's the same asset, but will definitely need an emulated test to convince myself the issuance is right.

check_origin: None,
},
ReceiveTeleportedAsset(parent_assets.clone()),
BurnAsset(parent_assets),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM. We just had one level of optimisation to try to minimise the XCMs by burning at some fixed period, instead of being done at the point of revenue coming in. So at the minute on Kusama we dump it into an account on unbalanced, then with the upcoming coretime-allocator pallet we'll burn the contents of the pot - this is the XCM we'll use for it though. I'm sure this is fine on Rococo and Westend and we can update when the new pallet is ready

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, Rococo and Westend are probably fine with the old CreditToCollatorPot for now

type SendXcm: SendXcm;
/// The asstet transactor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The asstet transactor.
/// The asset transactor.

let parent_assets: Assets =
vec![Asset { id: AssetId(Location::here()), fun: Fungible(value) }].into();

let send_res = PolkadotXcm::send_xcm(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the check_out logic get called somewhere else before this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I follow. It's the parachain side, so we don't have to check out assets here IIUC. They're checked out at the relay chain, and here, we want the RC to check them back in and burn them immediately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I understand, but it's up to the implementation of AssetTransactor.

Follow the code paths in do_teleport_assets. You will see it ends up executing a teleport_assets_program locally. IMO the system teleporting assets should behave like other teleports. If the Config::AssetTransactor changes in a runtime upgrade, it will be strange if these are accounted for differently.

We probably need some refactor to make system teleports more ergonomic with less code duplication, but I would treat these like other teleports for now (except that we can get away with UnpaidExecution and extra privilege here). cc @franciscoaguirre @acatangiu

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I was thinking the same, but the first bump in the road is that both InitiateTeleport XCM instructions and/or pallet-xcm/xtokens/etc build XCMs assuming BuyExecution and do not "out of the box" support UnpaidExecution.

We should def fix that, but I can't think of a way to do it without breaking pallet APIs (and/or without new XCM version) (as I'm writing this, obviously we can add new unpaid transfer extrinsics - ugly, yes)

I will file an issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #4854 - lemme know if anyone can pick it up, or I should add it to our priority queue.

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6532801

@s0me0ne-unkn0wn
Copy link
Contributor Author

Merged into #3940

@s0me0ne-unkn0wn s0me0ne-unkn0wn deleted the s0me0ne/tmp-revenue-teleport branch June 24, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants