validator

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: GPL-3.0 Imports: 20 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInnerAgency

func NewInnerAgency(nodes []configs.PbftNode, chain *core.BlockChain, blocksPerNode, offset int) consensus.Agency

func NewMockAgency

func NewMockAgency(nodes []configs.PbftNode, interval uint64) consensus.Agency

func NewStaticAgency

func NewStaticAgency(nodes []configs.PbftNode) consensus.Agency

func NextRound

func NextRound(blockNumber uint64) uint64

Types

type InnerAgency

type InnerAgency struct {
	consensus.Agency
	// contains filtered or unexported fields
}

func (*InnerAgency) Flush

func (ia *InnerAgency) Flush(header *types.Header) error

func (*InnerAgency) GetLastNumber

func (ia *InnerAgency) GetLastNumber(blockNumber uint64) uint64

func (*InnerAgency) GetValidator

func (ia *InnerAgency) GetValidator(blockNumber uint64) (v *pbfttypes.Validators, err error)

func (*InnerAgency) IsCandidateNode

func (ia *InnerAgency) IsCandidateNode(nodeID discover.NodeID) bool

func (*InnerAgency) OnCommit

func (ia *InnerAgency) OnCommit(block *types.Block) error

func (*InnerAgency) Sign

func (ia *InnerAgency) Sign(interface{}) error

func (*InnerAgency) VerifyHeader

func (ia *InnerAgency) VerifyHeader(header *types.Header, stateDB *state.StateDB) error

func (*InnerAgency) VerifySign

func (ia *InnerAgency) VerifySign(interface{}) error

type MockAgency

type MockAgency struct {
	consensus.Agency
	// contains filtered or unexported fields
}

func (*MockAgency) Flush

func (d *MockAgency) Flush(header *types.Header) error

func (*MockAgency) GetLastNumber

func (d *MockAgency) GetLastNumber(blockNumber uint64) uint64

func (*MockAgency) GetValidator

func (d *MockAgency) GetValidator(blockNumber uint64) (*pbfttypes.Validators, error)

func (*MockAgency) IsCandidateNode

func (d *MockAgency) IsCandidateNode(nodeID discover.NodeID) bool

func (*MockAgency) OnCommit

func (d *MockAgency) OnCommit(block *types.Block) error

func (*MockAgency) Sign

func (d *MockAgency) Sign(interface{}) error

func (*MockAgency) VerifyHeader

func (d *MockAgency) VerifyHeader(header *types.Header, statedb *state.StateDB) error

func (*MockAgency) VerifySign

func (d *MockAgency) VerifySign(interface{}) error

type StaticAgency

type StaticAgency struct {
	consensus.Agency
	// contains filtered or unexported fields
}

func (*StaticAgency) Flush

func (d *StaticAgency) Flush(header *types.Header) error

func (*StaticAgency) GetLastNumber

func (d *StaticAgency) GetLastNumber(blockNumber uint64) uint64

func (*StaticAgency) GetValidator

func (d *StaticAgency) GetValidator(uint64) (*pbfttypes.Validators, error)

func (*StaticAgency) IsCandidateNode

func (d *StaticAgency) IsCandidateNode(nodeID discover.NodeID) bool

func (*StaticAgency) OnCommit

func (d *StaticAgency) OnCommit(block *types.Block) error

func (*StaticAgency) Sign

func (d *StaticAgency) Sign(interface{}) error

func (*StaticAgency) VerifyHeader

func (d *StaticAgency) VerifyHeader(header *types.Header, statedb *state.StateDB) error

func (*StaticAgency) VerifySign

func (d *StaticAgency) VerifySign(interface{}) error

type ValidatorPool

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

ValidatorPool a pool storing validators.

func NewValidatorPool

func NewValidatorPool(agency consensus.Agency, blockNumber uint64, epoch uint64, nodeID discover.NodeID) *ValidatorPool

NewValidatorPool new a validator pool.

func (*ValidatorPool) Commit

func (vp *ValidatorPool) Commit(block *types.Block) error

func (*ValidatorPool) EnableVerifyEpoch

func (vp *ValidatorPool) EnableVerifyEpoch(epoch uint64) error

func (*ValidatorPool) EqualSwitchPoint

func (vp *ValidatorPool) EqualSwitchPoint(number uint64) bool

EqualSwitchPoint returns boolean which representment the switch point equal the inputs number.

func (*ValidatorPool) Flush

func (vp *ValidatorPool) Flush(header *types.Header) error

func (*ValidatorPool) GetIndexByNodeID

func (vp *ValidatorPool) GetIndexByNodeID(epoch uint64, nodeID discover.NodeID) (uint32, error)

GetIndexByNodeID get the index by node id.

func (*ValidatorPool) GetNodeIDByIndex

func (vp *ValidatorPool) GetNodeIDByIndex(epoch uint64, index int) discover.NodeID

GetNodeIDByIndex get the node id by index.

func (*ValidatorPool) GetValidatorByAddr

func (vp *ValidatorPool) GetValidatorByAddr(epoch uint64, addr common.NodeAddress) (*pbfttypes.ValidateNode, error)

GetValidatorByAddr get the validator by address.

func (*ValidatorPool) GetValidatorByIndex

func (vp *ValidatorPool) GetValidatorByIndex(epoch uint64, index uint32) (*pbfttypes.ValidateNode, error)

GetValidatorByIndex get the validator by index.

func (*ValidatorPool) GetValidatorByNodeID

func (vp *ValidatorPool) GetValidatorByNodeID(epoch uint64, nodeID discover.NodeID) (*pbfttypes.ValidateNode, error)

GetValidatorByNodeID get the validator by node id.

func (*ValidatorPool) IsCandidateNode

func (vp *ValidatorPool) IsCandidateNode(nodeID discover.NodeID) bool

IsCandidateNode check if the node is candidate node.

func (*ValidatorPool) IsValidator

func (vp *ValidatorPool) IsValidator(epoch uint64, nodeID discover.NodeID) bool

IsValidator check if the node is validator.

func (*ValidatorPool) Len

func (vp *ValidatorPool) Len(epoch uint64) int

Len return number of validators.

func (*ValidatorPool) MockSwitchPoint

func (vp *ValidatorPool) MockSwitchPoint(number uint64)

func (*ValidatorPool) Reset

func (vp *ValidatorPool) Reset(blockNumber uint64, epoch uint64)

Reset reset validator pool.

func (*ValidatorPool) ShouldSwitch

func (vp *ValidatorPool) ShouldSwitch(blockNumber uint64) bool

ShouldSwitch check if should switch validators at the moment.

func (*ValidatorPool) Update

func (vp *ValidatorPool) Update(blockNumber uint64, epoch uint64, eventMux *event.TypeMux) error

Update switch validators.

func (*ValidatorPool) ValidatorList

func (vp *ValidatorPool) ValidatorList(epoch uint64) []discover.NodeID

ValidatorList get the validator list.

func (*ValidatorPool) Validators

func (vp *ValidatorPool) Validators(epoch uint64) *pbfttypes.Validators

func (*ValidatorPool) Verify

func (vp *ValidatorPool) Verify(epoch uint64, validatorIndex uint32, msg, signature []byte) error

Verify verifies signature using the specified validator's bls public key.

func (*ValidatorPool) VerifyAggSig

func (vp *ValidatorPool) VerifyAggSig(epoch uint64, validatorIndexes []uint32, msg, signature []byte) bool

VerifyAggSig verifies aggregation signature using the specified validators' public keys.

func (*ValidatorPool) VerifyAggSigByBA

func (vp *ValidatorPool) VerifyAggSigByBA(epoch uint64, vSet *utils.BitArray, msg, signature []byte) error

func (*ValidatorPool) VerifyHeader

func (vp *ValidatorPool) VerifyHeader(header *types.Header) error

VerifyHeader verify block's header.

Jump to

Keyboard shortcuts

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