Deprecate ValidateUnsigned trait and #[pallet::validate_unsigned] attribute#10150
Deprecate ValidateUnsigned trait and #[pallet::validate_unsigned] attribute#10150RomarQ wants to merge 38 commits intoparitytech:masterfrom
ValidateUnsigned trait and #[pallet::validate_unsigned] attribute#10150Conversation
ValidateUnsigned trait and #[pallet::validate_unsigned] attribute
|
For information there I had 2 PR to upgrade usage to authorize call:
I also think it is actually somewhat a breaking change. Even if the old flow with unsigned transaction is kept, using a different transaction may break indexers and application monitoring the chain through those extrinsics. IMO |
Hi @gui1117, Agreed, these 2 PR's you mentioned complement this one. What is blocking them? |
Because I think it is unnecessary breaking change. In general I don't think we should deprecate Every time we deprecate something it involves extra work for everybody using the feature. I don't see it as necessary. |
The main concern is that the SDK now needs to maintain multiple mechanisms for achieving the same goal, which increases complexity and makes the codebase harder to maintain and document consistently. Ideally, there should be a single, recommended way to validate unsigned transactions. That mechanism should be well-maintained and clearly documented. I agree that the new extension mechanism currently lacks documentation, and requiring runtime developers to explicitly include |
This is hard because frame-executive only require an applyable implementation. The definition of the transaction extension is not accessible by Frame. Maybe there is a way to make an integrity test. Note that everytime a pallet defines an extension this extension can also be missed during the runtime configuration. |
substrate/frame/support/procedural/src/pallet/expand/validate_unsigned.rs
Outdated
Show resolved
Hide resolved
substrate/frame/support/procedural/src/pallet/expand/validate_unsigned.rs
Outdated
Show resolved
Hide resolved
gui1117
left a comment
There was a problem hiding this comment.
Apart from the comment above, looks good to me
…unsigned.rs Co-authored-by: Guillaume Thiolliere <guillaume.thiolliere@parity.io>
…10716) ## Summary Part of #2415 This PR is a focused extraction from the larger PR #10150, specifically migrating only `pallet-example-offchain-worker` to use the modern `TransactionExtension` API. ## Changes This PR migrates `pallet-example-offchain-worker` from the deprecated `ValidateUnsigned` trait to the `TransactionExtension` API using the `#[pallet::authorize]` attribute.
Part of #2415
Closes #2436
Related: #6325 #6326
Summary
Deprecates the
ValidateUnsignedtrait and#[pallet::validate_unsigned]attribute in favor of the newTransactionExtensionAPI. This is a non-breaking change that adds deprecation warnings to guide users toward the modern transaction validation approach.Motivation
The
ValidateUnsignedtrait was the legacy approach for validating unsigned transactions in FRAME pallets. The newerTransactionExtensiontrait provides a more flexible and composable way to handle transaction validation, including both signed and unsigned transactions.Changes
Deprecated APIs
#[deprecated]attribute toValidateUnsignedtrait#[pallet::validate_unsigned]macro attributeMigration (Using
TransactionExtensions)https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/transaction_extensions
Impact
Review Notes
#[pallet::validate_unsigned]deprecation warning might be redundant since it's always used together withValidateUnsigned, but both are included for completeness and clarity.Follow-up Tasks
The following pallets and crates need to be migrated to
TransactionExtensionin subsequent PRs:Runtime crates:
polkadot-runtime-commonpolkadot-runtime-parachainsFRAME pallets:
pallet-babepallet-beefypallet-election-provider-multi-blockpallet-grandpapallet-im-onlineMigrate pallet-im-online to TransactionExtension API #11235pallet-mixnetMigratepallet-mixnetfrom the deprecatedValidateUnsignedtrait to#[pallet::authorize]#11010Core:
frame-executiveframe-systemExamples:
pallet-example-offchain-workerMigrate pallet-example-offchain-worker to TransactionExtension API #10716Testing:
substrate-test-runtimeOpen Question
Should we remove the
ValidateUnsignedbound from the type parameterVin theApplyabletrait?