-
Notifications
You must be signed in to change notification settings - Fork 20
Bridging: Add pallet-assets #2354
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
Bridging: Add pallet-assets #2354
Conversation
…-bridge-add-asset-pallet
Codecov ReportAll modified and coverable lines are covered by tests ✅ 🚀 New features to boost your workflow:
|
- Added `pallet-assets` and `assets-common` as optional dependencies in Cargo.toml. - Introduced types and parameters for foreign assets in lib.rs, enabled with the `frequency-bridging` feature. - Configured the assets pallet within the runtime, allowing for asset creation and management. - Updated various comments for clarity and corrected minor typos.
…hmark script - Updated Cargo.toml to add "frequency-bridging" to the frequency-lint-check dependencies. - Modified run_benchmarks.sh to include pallet_assets in the list of ALL_EXTERNAL_PALLETS.
….rs and Cargo.lock
…-bridge-add-asset-pallet
…Cargo.lock bump spec_version to 154 in runtime frequency
…-bridge-add-asset-pallet
…argo.toml and lib.rs
// ForeignCreators<Everything, LocationToAccountId, AccountId, xcm::latest::Location>; | ||
// Use EnsureSignedBy to specify a single account allowed to create assets. | ||
// The Success type of EnsureSignedBy is AccountId, matching the trait bound. | ||
type CreateOrigin = EnsureSigned<AccountId>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently allows any signed Frequency account to create. This can be assigned to a Council or a specific address, if we need to limit creation.
type RemoveItemsLimit = frame_support::traits::ConstU32<1000>; | ||
|
||
#[cfg(feature = "runtime-benchmarks")] | ||
// type BenchmarkHelper = xcm_config::XcmBenchmarkHelper; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some xcm stuff will be brought in when other PRs finish the xcm setup.
…and include pallet-assets in runtime benchmarks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces bridging support for Frequency by integrating the pallet-assets module to handle DOT as a foreign asset. Key changes include:
- Adding new type definitions (AssetId and AssetBalance) and parameter_types for the foreign assets feature.
- Configuring pallet-assets for bridging with a new CreateOrigin based on EnsureSigned and integrating it in the runtime.
- Updating Cargo.toml files to include the necessary bridging feature flags and dependencies.
Reviewed Changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated no comments.
File | Description |
---|---|
runtime/frequency/src/lib.rs | Introduces type aliases, parameters, and pallet-assets config for bridging |
runtime/frequency/Cargo.toml | Adds pallet-assets as an optional dependency and bridging feature flag |
runtime/common/Cargo.toml | Adds the frequency-bridging feature |
Cargo.toml | Integrates pallet-assets for bridging in the main Cargo configuration |
Files not reviewed (3)
- Makefile: Language not supported
- scripts/init.sh: Language not supported
- scripts/run_benchmarks.sh: Language not supported
Comments suppressed due to low confidence (2)
runtime/frequency/src/lib.rs:526
- The placeholder AssetCreatorAccount is hardcoded; please ensure this account is updated with the proper creator account for production to avoid misconfiguration.
pub const AssetCreatorAccount: AccountId = AccountId::new([0u8; 32]); // TODO: Replace with actual AccountId
runtime/frequency/src/lib.rs:1343
- No unit tests currently cover the new foreign assets (bridging) configuration; please add tests to verify asset creation and fee handling behavior under the bridging feature.
impl pallet_assets::Config for Runtime {
👍 great! |
…cy into 2340-bridge-add-asset-pallet
…rt and clean up feature flags
Description
In order to teleport Frequency tokens to AssetHub, we need a way to pay the execution fee on AssetHub otherwise it will reject the request and treat the tokens as trapped assets.
Since AssetHub does not accept Frequency as payment for execution fees, we must also include DOT in the message to cover those fees.
To support this, Frequency must be able to handle DOT as an asset — both to receive DOT from AssetHub and to send DOT back out.
Acceptance Criteria
frequency-bridging
Implementation suggestions
Checklist