Documentation ¶
Overview ¶
nolint
Package nonce - This module allows replay protection to be added to process stack. This is achieved through the use of a sequence number for each unique set of signers. Note that the sequence number for the single signing account "foo" will be unique from the sequence number for a multi-sig account {"foo", "bar"} which would also be unique from a different multi-sig account {"foo", "soup"}
Index ¶
- Constants
- func ErrBadNonce(got, expected uint32) errors.TMError
- func ErrNoNonce() errors.TMError
- func ErrNoSigners() errors.TMError
- func ErrNotMember() errors.TMError
- func ErrTxEmpty() errors.TMError
- func ErrZeroSequence() errors.TMError
- func GetSeqKey(signers []sdk.Actor) (seqKey []byte)
- func NewTx(sequence uint32, signers []sdk.Actor, tx sdk.Tx) sdk.Tx
- type ReplayCheck
- type Tx
Constants ¶
const ( NameNonce = "nonce" CostNonce = 10 )
nolint
const ( ByteNonce = 0x69 //TODO overhaul byte assign system don't make no sense! TypeNonce = "nonce" )
nolint
Variables ¶
This section is empty.
Functions ¶
func ErrBadNonce ¶
func ErrNoNonce ¶
func ErrNoSigners ¶
func ErrNotMember ¶
func ErrTxEmpty ¶
func ErrZeroSequence ¶
Types ¶
type ReplayCheck ¶
type ReplayCheck struct { stack.PassInitState stack.PassInitValidate }
ReplayCheck uses the sequence to check for replay attacks
func (ReplayCheck) CheckTx ¶
func (r ReplayCheck) CheckTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Checker) (res sdk.CheckResult, err error)
CheckTx verifies tx is not being replayed - fulfills Middlware interface
func (ReplayCheck) DeliverTx ¶
func (r ReplayCheck) DeliverTx(ctx sdk.Context, store state.SimpleDB, tx sdk.Tx, next sdk.Deliver) (res sdk.DeliverResult, err error)
DeliverTx verifies tx is not being replayed - fulfills Middlware interface NOTE It is okay to modify the sequence before running the wrapped TX because if the wrapped Tx fails, the state changes are not applied
func (ReplayCheck) Name ¶
func (ReplayCheck) Name() string
Name of the module - fulfills Middleware interface
type Tx ¶
type Tx struct { Sequence uint32 `json:"sequence"` Signers []sdk.Actor `json:"signers"` Tx sdk.Tx `json:"tx"` }
Tx - Nonce transaction structure, contains list of signers and current sequence number
func (Tx) CheckIncrementSeq ¶
CheckIncrementSeq - Check that the sequence number is one more than the state sequence number and further increment the sequence number NOTE It is okay to modify the sequence before running the wrapped TX because if the wrapped Tx fails, the state changes are not applied