Documentation
¶
Index ¶
- func NewSignedPayload(call primitives.Call, extra primitives.SignedExtra) (primitives.SignedPayload, primitives.TransactionValidityError)
- type Applyable
- type Checked
- func (xt Checked) Apply(validator UnsignedValidator, info *primitives.DispatchInfo, length sc.Compact) (primitives.DispatchResultWithPostInfo[primitives.PostDispatchInfo], ...)
- func (xt Checked) Validate(validator UnsignedValidator, source primitives.TransactionSource, ...) (ok primitives.ValidTransaction, err primitives.TransactionValidityError)
- type Unchecked
- type UnsignedValidator
- type UnsignedValidatorForChecked
- func (v UnsignedValidatorForChecked) PreDispatch(call *primitives.Call) (sc.Empty, primitives.TransactionValidityError)
- func (v UnsignedValidatorForChecked) ValidateUnsigned(_source primitives.TransactionSource, call *primitives.Call) (primitives.ValidTransaction, primitives.TransactionValidityError)
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSignedPayload ¶
func NewSignedPayload(call primitives.Call, extra primitives.SignedExtra) (primitives.SignedPayload, primitives.TransactionValidityError)
NewSignedPayload creates a new `SignedPayload`. It may fail if `additional_signed` of `Extra` is not available.
Types ¶
type Applyable ¶
type Applyable interface {
Apply(validator UnsignedValidator, info *primitives.DispatchInfo, length sc.Compact) (ok primitives.DispatchResultWithPostInfo[primitives.PostDispatchInfo], err primitives.TransactionValidityError)
}
type Checked ¶
type Checked types.CheckedExtrinsic
func (Checked) Apply ¶
func (xt Checked) Apply(validator UnsignedValidator, info *primitives.DispatchInfo, length sc.Compact) (primitives.DispatchResultWithPostInfo[primitives.PostDispatchInfo], primitives.TransactionValidityError)
func (Checked) Validate ¶
func (xt Checked) Validate(validator UnsignedValidator, source primitives.TransactionSource, info *primitives.DispatchInfo, length sc.Compact) (ok primitives.ValidTransaction, err primitives.TransactionValidityError)
type Unchecked ¶
type Unchecked types.UncheckedExtrinsic
func (Unchecked) Check ¶
func (uxt Unchecked) Check(lookup primitives.AccountIdLookup) (ok types.CheckedExtrinsic, err primitives.TransactionValidityError)
type UnsignedValidator ¶
type UnsignedValidator interface { // PreDispatch validates the call right before dispatch. // // This method should be used to prevent transactions already in the pool // (i.e. passing [`validate_unsigned`](Self::validate_unsigned)) from being included in blocks // in case they became invalid since being added to the pool. // // By default it's a good idea to call [`validate_unsigned`](Self::validate_unsigned) from // within this function again to make sure we never include an invalid transaction. Otherwise // the implementation of the call or this method will need to provide proper validation to // ensure that the transaction is valid. // // Changes made to storage *WILL* be persisted if the call returns `Ok`. PreDispatch(call *primitives.Call) (ok sc.Empty, err primitives.TransactionValidityError) // ValidateUnsigned returns the validity of the call // // This method has no side-effects. It merely checks whether the call would be rejected // by the runtime in an unsigned extrinsic. // // The validity checks should be as lightweight as possible because every node will execute // this code before the unsigned extrinsic enters the transaction pool and also periodically // afterwards to ensure the validity. To prevent dos-ing a network with unsigned // extrinsics, these validity checks should include some checks around uniqueness, for example, // like checking that the unsigned extrinsic was send by an authority in the active set. // // Changes made to storage should be discarded by caller. ValidateUnsigned(source primitives.TransactionSource, call *primitives.Call) (ok primitives.ValidTransaction, err primitives.TransactionValidityError) }
UnsignedValidator provides validation for unsigned extrinsics.
This trait provides two functions [`pre_dispatch`](Self::pre_dispatch) and [`validate_unsigned`](Self::validate_unsigned). The [`pre_dispatch`](Self::pre_dispatch) function is called right before dispatching the call wrapped by an unsigned extrinsic. The [`validate_unsigned`](Self::validate_unsigned) function is mainly being used in the context of the transaction pool to check the validity of the call wrapped by an unsigned extrinsic.
type UnsignedValidatorForChecked ¶
type UnsignedValidatorForChecked struct{}
func (UnsignedValidatorForChecked) PreDispatch ¶
func (v UnsignedValidatorForChecked) PreDispatch(call *primitives.Call) (sc.Empty, primitives.TransactionValidityError)
PreDispatch validates the dispatch call before execution. Inherent call is accepted for being dispatched
func (UnsignedValidatorForChecked) ValidateUnsigned ¶
func (v UnsignedValidatorForChecked) ValidateUnsigned(_source primitives.TransactionSource, call *primitives.Call) (primitives.ValidTransaction, primitives.TransactionValidityError)
ValidateUnsigned returns the validity of the dispatch call. Inherent call is not validated as unsigned
type Validatable ¶
type Validatable interface {
Validate(validator UnsignedValidator, source primitives.TransactionSource, info *primitives.DispatchInfo, length sc.Compact) (ok primitives.ValidTransaction, err primitives.TransactionValidityError)
}