Expand description
Scarcity transaction extension.
§Runtime ordering
AsScarcity changes a signed origin into Origin::Nft during validation. Following
Coinage’s purse model, runtime integrators must place it with the origin modifiers, before
frame_system::AuthorizeCall, signed-account checks, and transaction payment:
AsScarcity -> AuthorizeCall -> ... -> CheckNonce -> ... ->
SkipCheckIfFeeless<ChargeAssetTxPayment>The account checks deliberately see a non-system origin and skip it, so an NFT-only purse needs
neither a System account nor a balance. AsScarcity consumes the NFT during preparation to
prevent concurrent use. A successful move increments its state nonce. Failed dispatch restores
the same state and applies a temporary backoff lock; once that lock expires, the same signed
transaction can be submitted again. This is the same retry model as Coinage.
Placing this extension after payment prevents
pallet_skip_feeless_payment::SkipCheckIfFeeless from observing Origin::Nft and makes a
balance-less purse unable to transact.
§Replay and mortality
Purse authorization is not account-nonce-based: a signed NFT transaction stays valid for as long as its purse still holds the named instance at the named state nonce. Two rules bound stale intent, exactly as in Coinage:
- Callers must sign mortal transactions with an era shorter than
Config::LockPeriod. A successful move invalidates every outstanding authorization by incrementing the state nonce, but an unexecuted transaction is otherwise replayable by anyone who has seen it until its era expires. - Because the era ends before the shortest failure lock does, a failed transaction can never re-enter a block: every retry after a failure is a fresh signing decision rather than a third-party replay of the old transaction.
A holder can also cancel an outstanding authorization at any time by moving the NFT, which increments its state nonce.
Structs§
- AsScarcity
- Purse-key authorization for Scarcity transfers and burns.
Enums§
- AsScarcity
Info - The Scarcity authorization requested by this extension.
- Custom
Invalidity - An error reported while validating
AsScarcity. - Pre
- Information carried from preparation to post-dispatch.
- Val
- Information carried from validation to preparation.