verifier

package
v2.11.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

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, verifier interfaces.ConsensusVerifier, sbpStatReader cs_interfaces.SBPStatReader) *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, verifier interfaces.ConsensusVerifier) *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) (*interfaces.VmAccountBlock, error)
	VerifyPoolAccountBlock(block *ledger.AccountBlock, snapshot *ledger.SnapshotBlock) (*AccBlockPendingTask, *interfaces.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

	VerifyNetSb(block *ledger.SnapshotBlock) error
	VerifyReferred(block *ledger.SnapshotBlock) *SnapshotBlockVerifyStat

	Init(v interfaces.ConsensusVerifier, sbpStatReader cs_interfaces.SBPStatReader, manager *onroad.Manager) Verifier
}

Verifier provides methods that external modules can use.

func NewVerifier

func NewVerifier(ch chain.Chain) Verifier

NewVerifier with chain.Chain

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