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

pallet assets: optional auto-increment for the asset ID #4757

Merged
merged 11 commits into from
Jun 26, 2024

Conversation

muharem
Copy link
Contributor

@muharem muharem commented Jun 11, 2024

Introduce an optional auto-increment setup for the IDs of new assets.

@muharem muharem added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Jun 11, 2024
@muharem muharem requested a review from a team as a code owner June 11, 2024 10:08
substrate/frame/assets/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/assets/src/lib.rs Outdated Show resolved Hide resolved
@muharem
Copy link
Contributor Author

muharem commented Jun 25, 2024

@bkchr @ggwpez can you help with review here, it would be helpful to get this into the next sdk release

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

The implementation is a little bit complicated ;) I mean it doesn't break anything or at least not that much.

Left some things to improve. A followup would be nice that improves the docs on how to use this.

substrate/frame/assets/src/migration.rs Outdated Show resolved Hide resolved
substrate/frame/assets/src/migration.rs Outdated Show resolved Hide resolved
/// [SetNextAssetId](`migration::next_asset_id::SetNextAssetId`) migration. For the auto-
/// incremented model, the [`crate::AutoIncAssetId`] callback can be used.
#[pallet::storage]
pub type NextAssetId<T: Config<I>, I: 'static = ()> = StorageValue<_, T::AssetId, OptionQuery>;
Copy link
Member

Choose a reason for hiding this comment

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

There is no way to set this at genesis. Can you please add it to the GenesisConfig?

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 did not touch it to make this non breaking change for most of the users. But no strong opinion.
You can see it now in GenesisConfig.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but we need this here or otherwise test networks will have problems.

@muharem muharem requested review from athei and a team as code owners June 26, 2024 10:36
@muharem
Copy link
Contributor Author

muharem commented Jun 26, 2024

The implementation is a little bit complicated ;) I mean it doesn't break anything or at least not that much.

Left some things to improve. A followup would be nice that improves the docs on how to use this.

I updated docs, added the new storage item to the genesis config.
Should we wait for an audit or we merge this?

@paritytech-cicd-pr
Copy link

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

@bkchr
Copy link
Member

bkchr commented Jun 26, 2024

Should we wait for an audit or we merge this?

I think we can go ahead.

@muharem muharem added this pull request to the merge queue Jun 26, 2024
Merged via the queue into master with commit 929a273 Jun 26, 2024
150 of 158 checks passed
@muharem muharem deleted the muharem-assets-ai branch June 26, 2024 17:12
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
)

Introduce an optional auto-increment setup for the IDs of new assets.

---------

Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants