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

Use real rust type for pallet alias in runtime macro #4769

Merged
merged 21 commits into from
Jun 25, 2024

Conversation

gupnik
Copy link
Contributor

@gupnik gupnik commented Jun 12, 2024

Fixes #4723. Also, closes #4622

As stated in the linked issue, this PR adds the ability to use a real rust type for pallet alias in the new runtime macro:

#[runtime::pallet_index(0)]
pub type System = frame_system::Pallet<Runtime>;

Please note that the current syntax still continues to be supported.

CC: @shawntabrizi @kianenigma

@gupnik gupnik added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Jun 12, 2024
@gupnik gupnik requested a review from a team as a code owner June 12, 2024 04:22
Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

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

lgtm high level

Copy link
Contributor

@kianenigma kianenigma left a comment

Choose a reason for hiding this comment

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

Loogs good, except the doc for #[runtime] macro are not updated.

I also wanted to log this for you in a new issue that I have not done so far:

The docs for frame::runtime, unlike almost all other frame macros, live in the procedural crate, and therefore is ignore-ed code. It would align with our standards better to move them to where it is being re-exported so the code snippets can be live.

@shawntabrizi
Copy link
Member

Is this syntax supported?

///   // Pallet with instance.
///   #[runtime::pallet_index(2)]
///   pub type Test2_Instance1 = test2::Pallet<Runtime, Instance1>;

This is what I would expect for Pallet<T, I>

@gupnik
Copy link
Contributor Author

gupnik commented Jun 17, 2024

Is this syntax supported?

///   // Pallet with instance.
///   #[runtime::pallet_index(2)]
///   pub type Test2_Instance1 = test2::Pallet<Runtime, Instance1>;

This is what I would expect for Pallet<T, I>

Yes, this is the way its added now. Will add this in the docify example as well.

@paritytech-review-bot paritytech-review-bot bot requested a review from a team June 19, 2024 05:34
@gupnik
Copy link
Contributor Author

gupnik commented Jun 19, 2024

bot fmt

@command-bot
Copy link

command-bot bot commented Jun 19, 2024

@gupnik https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6499660 was started for your command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh". Check out https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/pipelines?page=1&scope=all&username=group_605_bot to know what else is being executed currently.

Comment bot cancel 4-7fceaa54-0ccd-487b-94ac-62f9f9f56566 to cancel this command or bot cancel to cancel all commands in this pull request.

@command-bot
Copy link

command-bot bot commented Jun 19, 2024

@gupnik Command "$PIPELINE_SCRIPTS_DIR/commands/fmt/fmt.sh" has finished. Result: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6499660 has finished. If any artifacts were generated, you can download them from https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6499660/artifacts/download.

prdoc/pr_4769.prdoc Outdated Show resolved Hide resolved
@paritytech-review-bot paritytech-review-bot bot requested a review from a team June 21, 2024 13:21
@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/6537108

@gupnik gupnik added this pull request to the merge queue Jun 25, 2024
Merged via the queue into master with commit 2f3a1bf Jun 25, 2024
160 of 163 checks passed
@gupnik gupnik deleted the gupnik/runtime-updates branch June 25, 2024 15:03
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
Fixes paritytech#4723. Also,
closes paritytech#4622

As stated in the linked issue, this PR adds the ability to use a real
rust type for pallet alias in the new `runtime` macro:
```rust
#[runtime::pallet_index(0)]
pub type System = frame_system::Pallet<Runtime>;
```

Please note that the current syntax still continues to be supported.

CC: @shawntabrizi @kianenigma

---------

Co-authored-by: command-bot <>
Co-authored-by: Bastian Köcher <[email protected]>
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
7 participants