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 macro: do not generate try-runtime related code when frame-support doesn't have try-runtime. #5099

Merged
merged 7 commits into from
Jul 24, 2024

Conversation

gui1117
Copy link
Contributor

@gui1117 gui1117 commented Jul 22, 2024

Status: Ready for review

Fix #5092

Introduce a new macro in frame-support which discard content if try-runtime is not enabled.

Use this macro inside frame-support-procedural to generate code only when frame-support is compiled with try-runtime.

@gui1117 gui1117 requested a review from a team as a code owner July 22, 2024 04:19
@gui1117
Copy link
Contributor Author

gui1117 commented Jul 22, 2024

I believe this is not a breaking change. Should I include a prdoc?

Copy link
Contributor

@gupnik gupnik left a comment

Choose a reason for hiding this comment

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

Will need to update the frame crate as well

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

@gupnik gupnik added R0-silent Changes should not be mentioned in any release notes T1-FRAME This PR/Issue is related to core FRAME, the framework. labels Jul 22, 2024
@gui1117
Copy link
Contributor Author

gui1117 commented Jul 22, 2024

Will need to update the frame crate as well

is it? frame imports frame-support with try-runtime feature so frame-support-procedural should also have try-runtime feature.

proc_macro2::TokenStream::new()
};

let try_state = if cfg!(feature = "try-runtime") {
Copy link
Member

Choose a reason for hiding this comment

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

We should not do this. This is partly "cursed". Sometimes this is not really working well.

You can create a macro in frame_support using this macro and then you can use this to guard the code. Here is an example of what I mean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yes, I implemented as you suggested here 61fa26d

@bkchr bkchr enabled auto-merge July 24, 2024 09:20
@bkchr bkchr added this pull request to the merge queue Jul 24, 2024
Merged via the queue into paritytech:master with commit 8a96d07 Jul 24, 2024
155 of 160 checks passed
@gui1117 gui1117 deleted the gui-pallet-try-runtime branch July 24, 2024 13:06
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
…port doesn't have try-runtime. (paritytech#5099)

Status: Ready for review

Fix paritytech#5092

Introduce a new macro in frame-support which discard content if
`try-runtime` is not enabled.

Use this macro inside `frame-support-procedural` to generate code only
when `frame-support` is compiled with `try-runtime`.

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
ordian added a commit that referenced this pull request Aug 6, 2024
* master: (27 commits)
  Bridges improved tests and nits (#5128)
  Fix misleading comment about RewardHandler in epm config (#3095)
  Introduce a workflow updating the wishlist leaderboards (#5085)
  membership: Restructure pallet into separate files (#4536)
  Fix after ring-proof api change (#5126)
  Bump paritytech/review-bot from 2.4.0 to 2.5.0 (#5057)
  Bump docker/login-action from 3.0.0 to 3.3.0 (#5109)
  Bump docker/build-push-action from 5.1.0 to 6.5.0 (#5108)
  Bump peter-evans/create-pull-request from 5.0.0 to 6.1.0 (#5093)
  Tx Payment: drop ED requirements for tx payments with exchangeable asset  (#4488)
  Remove `pallet-getter` usage from pallet-transaction-payment (#4970)
  pallet macro: do not generate try-runtime related code when frame-support doesn't have try-runtime. (#5099)
  fix(chain-spec): ChainSpecBuilder with object as default genesis (#4345)
  Migrate BEEFY BLS crypto to  bls12-381 curve (#4931)
  Bump clap from 4.5.9 to 4.5.10 in the known_good_semver group (#5120)
  Use jobserver in wasm-builder to limit concurrency of spawned cargo processes (#4946)
  include events for voting (#4613)
  [subsystem-bench] Add mocks for own assignments triggering (#5042)
  Remove not-audited warning (#5114)
  hotfix: blockchain/backend: Skip genesis leaf to unblock syncing (#5103)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R0-silent Changes should not be mentioned in any release notes 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.

Pallet without try-runtime feature flag produces a compiler warning
6 participants