nonce

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

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

View Source
const (
	NameNonce = "nonce"
	CostNonce = 10
)

nolint

View Source
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 ErrBadNonce(got, expected uint32) errors.TMError

func ErrNoNonce

func ErrNoNonce() errors.TMError

func ErrNoSigners

func ErrNoSigners() errors.TMError

func ErrNotMember

func ErrNotMember() errors.TMError

func ErrTxEmpty

func ErrTxEmpty() errors.TMError

func ErrZeroSequence

func ErrZeroSequence() errors.TMError

func GetSeqKey

func GetSeqKey(signers []sdk.Actor) (seqKey []byte)

GetSeqKey - Generate the sequence key as the concatenated list of signers, sorted by address.

func NewTx

func NewTx(sequence uint32, signers []sdk.Actor, tx sdk.Tx) sdk.Tx

NewTx wraps the tx with a signable nonce

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

func (n Tx) CheckIncrementSeq(ctx sdk.Context, store state.SimpleDB) error

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

func (Tx) ValidateBasic

func (n Tx) ValidateBasic() error

func (Tx) Wrap

func (n Tx) Wrap() sdk.Tx

nolint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL