verifier

package
v2.10.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 22 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// can retry
	ErrVerifyVmGeneratorFailed           = errors.New("generator in verifier run failed")
	ErrVerifyAccountNotInvalid           = errors.New("general account's sendBlock.Height must be larger than 1")
	ErrVerifyContractMetaNotExists       = errors.New("contract meta not exists")
	ErrVerifyConfirmedTimesNotEnough     = errors.New("verify referred send's confirmedTimes not enough")
	ErrVerifySeedConfirmedTimesNotEnough = errors.New("verify referred send's seed confirmedTimes not enough")

	ErrVerifyHashFailed           = errors.New("verify hash failed")
	ErrVerifySignatureFailed      = errors.New("verify signature failed")
	ErrVerifyNonceFailed          = errors.New("check pow nonce failed")
	ErrVerifyPrevBlockFailed      = errors.New("verify prevBlock failed, incorrect use of prevHash or fork happened")
	ErrVerifyRPCBlockPendingState = errors.New("verify referred block failed, pending for them")

	// check data, can't retry
	ErrVerifyDependentSendBlockNotExists   = errors.New("receive's dependent send block is not exists on chain")
	ErrVerifyPowNotEligible                = errors.New("verify that it's not eligible to do pow")
	ErrVerifyProducerIllegal               = errors.New("verify that the producer is illegal")
	ErrVerifyBlockFieldData                = errors.New("verify that block field data is illegal")
	ErrVerifyContractReceiveSequenceFailed = errors.New("verify that contract's receive sequence is illegal")
	ErrVerifySendIsAlreadyReceived         = errors.New("block is already received successfully")
	ErrVerifyVmResultInconsistent          = errors.New("inconsistent execution results in vm")
)

Errors that the external module needs to be aware of.

Functions

This section is empty.

Types

type AccBlockPendingTask

type AccBlockPendingTask struct {
	AccountTask []*AccountPendingTask
}

AccBlockPendingTask defines a data structure for a pending transaction

type AccountHashH

type AccountHashH struct {
	Addr   *types.Address
	Hash   *types.Hash
	Height *big.Int
}

type AccountPendingTask

type AccountPendingTask struct {
	Addr *types.Address
	Hash *types.Hash
}

AccountPendingTask defines to carry the information of those account block to be processed(PENDING).

type AccountVerifier

type AccountVerifier struct {
	// contains filtered or unexported fields
}

AccountVerifier implements all method to verify the transaction.

func NewAccountVerifier

func NewAccountVerifier(chain accountChain, consensus cssConsensus) *AccountVerifier

NewAccountVerifier needs two args, the implementation methods of the "accountChain" and "cssConsensus"

func (*AccountVerifier) InitOnRoadPool

func (v *AccountVerifier) InitOnRoadPool(manager *onroad.Manager)

InitOnRoadPool method implements the inspection on whether the Contract's onRoad block is at the lowest height.

type SnapshotBlockVerifyStat

type SnapshotBlockVerifyStat struct {
	// contains filtered or unexported fields
}

func (*SnapshotBlockVerifyStat) ErrMsg

func (self *SnapshotBlockVerifyStat) ErrMsg() string

func (*SnapshotBlockVerifyStat) Results

func (self *SnapshotBlockVerifyStat) Results() map[types.Address]VerifyResult

func (*SnapshotBlockVerifyStat) VerifyResult

func (self *SnapshotBlockVerifyStat) VerifyResult() VerifyResult

type SnapshotPendingTask

type SnapshotPendingTask struct {
	Hash *types.Hash
}

SnapshotPendingTask defines to carry the information of those snapshot block to be processed(PENDING).

type SnapshotVerifier

type SnapshotVerifier struct {
	// contains filtered or unexported fields
}

func NewSnapshotVerifier

func NewSnapshotVerifier(ch chain.Chain, cs css.Verifier) *SnapshotVerifier

func (*SnapshotVerifier) VerifyNetSb

func (self *SnapshotVerifier) VerifyNetSb(block *ledger.SnapshotBlock) error

func (*SnapshotVerifier) VerifyReferred

func (self *SnapshotVerifier) VerifyReferred(block *ledger.SnapshotBlock) *SnapshotBlockVerifyStat

type Verifier

type Verifier interface {
	VerifyNetSnapshotBlock(block *ledger.SnapshotBlock) error
	VerifyNetAccountBlock(block *ledger.AccountBlock) error

	VerifyRPCAccountBlock(block *ledger.AccountBlock, snapshot *ledger.SnapshotBlock) (*vm_db.VmAccountBlock, error)
	VerifyPoolAccountBlock(block *ledger.AccountBlock, snapshot *ledger.SnapshotBlock) (*AccBlockPendingTask, *vm_db.VmAccountBlock, error)

	VerifyAccountBlockNonce(block *ledger.AccountBlock) error
	VerifyAccountBlockHash(block *ledger.AccountBlock) error
	VerifyAccountBlockSignature(block *ledger.AccountBlock) error
	VerifyAccountBlockProducerLegality(block *ledger.AccountBlock) error

	VerifySnapshotBlockHash(block *ledger.SnapshotBlock) error
	VerifySnapshotBlockSignature(block *ledger.SnapshotBlock) error

	GetSnapshotVerifier() *SnapshotVerifier

	InitOnRoadPool(manager *onroad.Manager)
}

Verifier provides methods that external modules can use.

func NewVerifier

func NewVerifier(sv *SnapshotVerifier, av *AccountVerifier) Verifier

NewVerifier needs instances of SnapshotVerifier and AccountVerifier.

func NewVerifier2

func NewVerifier2(ch chain.Chain, cs consensus.Consensus) Verifier

NewVerifier needs instances of SnapshotVerifier and AccountVerifier.

type VerifierError

type VerifierError struct {
	// contains filtered or unexported fields
}

func (VerifierError) Detail

func (e VerifierError) Detail() string

func (VerifierError) Error

func (e VerifierError) Error() string

type VerifyResult

type VerifyResult int

VerifyResult explains the states of transaction validation.

const (
	PENDING VerifyResult = iota
	FAIL
	SUCCESS
)

PENDING represents the block which can't be determined because its dependent transactions were not verified, FAIL represents the block which is found illegal or unqualified, SUCCESS represents the block is successfully verified.

Jump to

Keyboard shortcuts

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