Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Migrate remaining old decl_* macros to the new pallet attribute macros #12271

Merged
merged 11 commits into from
Sep 22, 2022
Merged

Migrate remaining old decl_* macros to the new pallet attribute macros #12271

merged 11 commits into from
Sep 22, 2022

Conversation

koushiro
Copy link
Contributor

What does it do?

Migrate remaining old decl_* macros to the new #[pallet] attribute macros

part of #12248


polkadot address: 15XuanNimo5951s3RjFTPX1AvYVnCwfr3SDhb3AV4fQF3LpK

@@ -36,7 +36,7 @@ mod pallet_test {

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(_);
pub struct Pallet<T>(PhantomData<T>);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub struct Pallet<T>(PhantomData<T>);
pub struct Pallet<T>(_);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not use struct Pallet<T>(PhantomData<T>);?

struct Pallet<T>(_); is not standard rust syntax

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I know. This syntax was added as some shortcut.

Copy link
Member

Choose a reason for hiding this comment

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

i would not be against removing these shortcuts if you find it confusing. End of the day, no one writes this line by hand, they just copy some template.

test-utils/runtime/src/system.rs Outdated Show resolved Hide resolved
utils/frame/rpc/support/src/lib.rs Outdated Show resolved Hide resolved
@koushiro koushiro requested a review from bkchr September 16, 2022 03:17
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.

CI isn't happy, but looks good otherwise!

Ty

@koushiro
Copy link
Contributor Author

@KiChjang @shawntabrizi PTAL

@bkchr
Copy link
Member

bkchr commented Sep 20, 2022

@koushiro tests are still failing.

Signed-off-by: koushiro <[email protected]>
Signed-off-by: koushiro <[email protected]>
@koushiro
Copy link
Contributor Author

@koushiro tests are still failing.

Fixed

@kianenigma kianenigma added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. labels Sep 20, 2022
@kianenigma
Copy link
Contributor

By the end of this PR, we should have no more use of decl_* in our codebase, so we should mark them as deprecated? @KiChjang WDYT?

@bkchr
Copy link
Member

bkchr commented Sep 21, 2022

bot rebase

@paritytech-processbot
Copy link

Error: Command 'Command { std: "git" "merge" "origin/master" "--no-ff" "--no-edit", kill_on_drop: false }' failed with status Some(1); output: no output

@bkchr
Copy link
Member

bkchr commented Sep 21, 2022

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot
Copy link

Merge cancelled due to error. Error: Statuses failed for eee38f7

@kianenigma
Copy link
Contributor

/tip small

@substrate-tip-bot
Copy link

@kianenigma A small tip was successfully submitted for koushiro (15XuanNimo5951s3RjFTPX1AvYVnCwfr3SDhb3AV4fQF3LpK on polkadot).

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.polkadot.io#/treasury/tips

@bkchr
Copy link
Member

bkchr commented Sep 22, 2022

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot paritytech-processbot bot merged commit cc4d5cc into paritytech:master Sep 22, 2022
@koushiro koushiro deleted the remove-old-decl-macros branch September 22, 2022 08:56
@KiChjang
Copy link
Contributor

By the end of this PR, we should have no more use of decl_* in our codebase, so we should mark them as deprecated? @KiChjang WDYT?

We already have a PR for that: #12326, although I must say that perhaps what we should really do is remove them rather than simply deprecating them.

ordian added a commit that referenced this pull request Sep 23, 2022
* master:
  [Fix] parameter_types! dead code errors (#12340)
  [Feature] Sequential migration execution for try-runtime (#12319)
  bench: Use `_` instead  of `::` in auto-generated file names (#12332)
  Fast Unstake Pallet (#12129)
  Rename anonymous to pure proxy (#12283)
  Migrate remaining old decl_* macros to the new pallet attribute macros (#12271)
  pallet-utility: Disallow none origin (#12321)
  Make automatic storage deposits resistant against changing deposit prices (#12083)
  Format templates and fix `--steps` default value (#12286)
  Bump `wasmtime` to 1.0.0 (#12317)
  Introduce 'intermediate_insert' method to hide implementation details (#12215)
  Bound staking storage items (#12230)
  Use `array-bytes` for All Array/Bytes/Hex Operations (#12190)
  BREAKING: Rename Origin (#12258)
  Use temporary db for benchmarking (#12254)
  rpc: Implement `chainSpec` RPC API (#12261)
  Import target block body during warp sync (#12300)
  Proper naming wrt expectations (#12311)
  [ci] Revert cancel-pipeline job (#12309)
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
paritytech#12271)

* Migrate remaining old decl_* macros to the new pallet attribute macros

Signed-off-by: koushiro <[email protected]>

* Apply review suggestions

Signed-off-by: koushiro <[email protected]>

* Apply review suggestions

Signed-off-by: koushiro <[email protected]>

* use pallet::storage

* Fix dev rpc test

Signed-off-by: koushiro <[email protected]>

* Fix service tests

Signed-off-by: koushiro <[email protected]>

Signed-off-by: koushiro <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants