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

Add NonFungibleAdapter #2924

Merged
merged 9 commits into from
Jan 26, 2024
Merged

Conversation

Szegoo
Copy link
Contributor

@Szegoo Szegoo commented Jan 14, 2024

This PR introduces a new NonFungibleAdapter.

It will be useful for enabling cross-chain Coretime region transfers, as the existing NonFungiblesAdapter is unsuitable for this purpose. This is due to the fact that there is only one class of items within the pallet-broker, i.e., the Coretime regions.

@Szegoo Szegoo requested a review from a team as a code owner January 14, 2024 07:44
prdoc/pr_2924.prdoc Outdated Show resolved Hide resolved
Co-authored-by: Francisco Aguirre <[email protected]>
@Szegoo
Copy link
Contributor Author

Szegoo commented Jan 21, 2024

@joepetrowski Could you take a look at this?

@joepetrowski
Copy link
Contributor

Yeah I can review, but if it's for Coretime then I think @seadanda knows this better.

@seadanda seadanda self-requested a review January 21, 2024 13:47
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.

Looks good, just needs an update to XCM v4 syntax.

polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
polkadot/xcm/xcm-builder/src/nonfungible_adapter.rs Outdated Show resolved Hide resolved
Comment on lines 89 to 96
fn accrue_checked(checking_account: AccountId, instance: Asset::ItemId) {
let ok = Asset::mint_into(&instance, &checking_account).is_ok();
debug_assert!(ok, "`mint_into` cannot generally fail; qed");
}
fn reduce_checked(instance: Asset::ItemId) {
let ok = Asset::burn(&instance, None).is_ok();
debug_assert!(ok, "`can_check_in` must have returned `true` immediately prior; qed");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps these should be proper log messages and not debug_asserts. You are assuming that the user has e.g. called can_check_in prior to calling this function, but there is no guarantee. If the trait doesn't allow you to return an error here, should probably log it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used debug_assert here to keep consistent with other adapter implementations.

@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 1/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/5009848

@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/5009831

@franciscoaguirre franciscoaguirre added the T6-XCM This PR/Issue is related to XCM. label Jan 23, 2024
@Szegoo Szegoo requested a review from seadanda January 24, 2024 16:02
@franciscoaguirre
Copy link
Contributor

@Szegoo seems like after fixing a conflict this can be merged

@Szegoo
Copy link
Contributor Author

Szegoo commented Jan 26, 2024

@franciscoaguirre Resolved the conflict, should be ready for merging now.

@franciscoaguirre franciscoaguirre added this pull request to the merge queue Jan 26, 2024
Merged via the queue into paritytech:master with commit 6633253 Jan 26, 2024
123 of 124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants