Skip to content

Commit

Permalink
Mention the signed extensions in the reference docs (#4887)
Browse files Browse the repository at this point in the history
Co-authored-by: gupnik <mail.guptanikhil@gmail.com>
  • Loading branch information
bkchr and gupnik authored Jun 27, 2024
1 parent 929a273 commit 7c6ab07
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions docs/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ pallet-balances = { workspace = true, default-features = true }
pallet-assets = { workspace = true, default-features = true }
pallet-preimage = { workspace = true, default-features = true }
pallet-transaction-payment = { workspace = true, default-features = true }
pallet-asset-tx-payment = { workspace = true, default-features = true }
pallet-skip-feeless-payment = { workspace = true, default-features = true }
pallet-asset-conversion-tx-payment = { workspace = true, default-features = true }
pallet-utility = { workspace = true, default-features = true }
pallet-multisig = { workspace = true, default-features = true }
pallet-proxy = { workspace = true, default-features = true }
Expand Down
54 changes: 53 additions & 1 deletion docs/sdk/src/reference_docs/signed_extensions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,59 @@
//! Signed extensions are, briefly, a means for different chains to extend the "basic" extrinsic
//! format with custom data that can be checked by the runtime.
//!
//! # Example
//! # FRAME provided signed extensions
//!
//! FRAME by default already provides the following signed extensions:
//!
//! - [`CheckGenesis`](frame_system::CheckGenesis): Ensures that a transaction was sent for the same
//! network. Determined based on genesis.
//!
//! - [`CheckMortality`](frame_system::CheckMortality): Extends a transaction with a configurable
//! mortality.
//!
//! - [`CheckNonZeroSender`](frame_system::CheckNonZeroSender): Ensures that the sender of a
//! transaction is not the *all zero account* (all bytes of the accountid are zero).
//!
//! - [`CheckNonce`](frame_system::CheckNonce): Extends a transaction with a nonce to prevent replay
//! of transactions and to provide ordering of transactions.
//!
//! - [`CheckSpecVersion`](frame_system::CheckSpecVersion): Ensures that a transaction was built for
//! the currently active runtime.
//!
//! - [`CheckTxVersion`](frame_system::CheckTxVersion): Ensures that the transaction signer used the
//! correct encoding of the call.
//!
//! - [`CheckWeight`](frame_system::CheckWeight): Ensures that the transaction fits into the block
//! before dispatching it.
//!
//! - [`ChargeTransactionPayment`](pallet_transaction_payment::ChargeTransactionPayment): Charges
//! transaction fees from the signer based on the weight of the call using the native token.
//!
//! - [`ChargeAssetTxPayment`](pallet_asset_tx_payment::ChargeAssetTxPayment): Charges transaction
//! fees from the signer based on the weight of the call using any supported asset (including the
//! native token).
//!
//! - [`ChargeAssetTxPayment`(using
//! conversion)](pallet_asset_conversion_tx_payment::ChargeAssetTxPayment): Charges transaction
//! fees from the signer based on the weight of the call using any supported asset (including the
//! native token). The asset is converted to the native token using a pool.
//!
//! - [`SkipCheckIfFeeless`](pallet_skip_feeless_payment::SkipCheckIfFeeless): Allows transactions
//! to be processed without paying any fee. This requires that the `call` that should be
//! dispatched is augmented with the [`feeless_if`](frame_support::pallet_macros::feeless_if)
//! attribute.
//!
//! - [`CheckMetadataHash`](frame_metadata_hash_extension::CheckMetadataHash): Extends transactions
//! to include the so-called metadata hash. This is required by chains to support the generic
//! Ledger application and other similar offline wallets.
//!
//! - [`StorageWeightReclaim`](cumulus_primitives_storage_weight_reclaim::StorageWeightReclaim): A
//! signed extension for parachains that reclaims unused storage weight after executing a
//! transaction.
//!
//! For more information about these extensions, follow the link to the type documentation.
//!
//! # Building a custom signed extension
//!
//! Defining a couple of very simple signed extensions looks like the following:
#![doc = docify::embed!("./src/reference_docs/signed_extensions.rs", signed_extensions_example)]
Expand Down
3 changes: 3 additions & 0 deletions substrate/frame/system/src/extensions/check_mortality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ use sp_runtime::{

/// Check for transaction mortality.
///
/// The extension adds [`Era`] to every signed extrinsic. It also contributes to the signed data, by
/// including the hash of the block at [`Era::birth`].
///
/// # Transaction Validity
///
/// The extension affects `longevity` of the transaction according to the [`Era`] definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
//! # Skip Feeless Payment Pallet
//!
//! This pallet allows runtimes that include it to skip payment of transaction fees for
//! dispatchables marked by [`#[pallet::feeless_if]`](`macro@
//! frame_support::pallet_prelude::feeless_if`).
//! dispatchables marked by
//! [`#[pallet::feeless_if]`](frame_support::pallet_prelude::feeless_if).
//!
//! ## Overview
//!
Expand All @@ -30,8 +30,9 @@
//! ## Integration
//!
//! This pallet wraps an existing transaction payment pallet. This means you should both pallets
//! in your `construct_runtime` macro and include this pallet's
//! [`SignedExtension`] ([`SkipCheckIfFeeless`]) that would accept the existing one as an argument.
//! in your [`construct_runtime`](frame_support::construct_runtime) macro and
//! include this pallet's [`SignedExtension`] ([`SkipCheckIfFeeless`]) that would accept the
//! existing one as an argument.
#![cfg_attr(not(feature = "std"), no_std)]

Expand Down

0 comments on commit 7c6ab07

Please sign in to comment.