headerCheck

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilHeaderSigVerifier = errors.New("nil header signature verifier")

ErrNilHeaderSigVerifier signals that a nil header sig verifier was provided

View Source
var ErrNilMarshaller = errors.New("nil marshaller")

ErrNilMarshaller signals that a nil marshaller was provided

View Source
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")

ErrNilNodesCoordinator signals that a nil nodes coordinator was provided

View Source
var ErrNilProxy = errors.New("nil proxy")

ErrNilProxy signals that a nil proxy was provided

View Source
var ErrNilRawHeaderHandler = errors.New("nil raw header handler")

ErrNilRawHeaderHandler signals that a nil raw header handler was provided

Functions

func NewHeaderVerifier

func NewHeaderVerifier(args ArgsHeaderVerifier) (*headerVerifier, error)

NewHeaderVerifier creates new instance of headerVerifier

func NewRawHeaderHandler

func NewRawHeaderHandler(proxy Proxy, marshaller marshal.Marshalizer) (*rawHeaderHandler, error)

NewRawHeaderHandler will create a new rawHeaderHandler instance

Types

type ArgsHeaderVerifier

type ArgsHeaderVerifier struct {
	HeaderHandler     RawHeaderHandler
	HeaderSigVerifier HeaderSigVerifierHandler
	NodesCoordinator  nodesCoordinator.EpochsConfigUpdateHandler
}

ArgsHeaderVerifier holds all dependencies required by headerVerifier in order to create a new instance

type HeaderSigVerifierHandler

type HeaderSigVerifierHandler interface {
	VerifySignature(header coreData.HeaderHandler) error
	IsInterfaceNil() bool
}

HeaderSigVerifierHandler defines the functions needed to verify headers signature

type HeaderVerifier

type HeaderVerifier interface {
	VerifyHeaderSignatureByHash(ctx context.Context, shardId uint32, hash string) (bool, error)
	IsInterfaceNil() bool
}

HeaderVerifier defines the functions needed for verifying headers

func NewHeaderCheckHandler

func NewHeaderCheckHandler(
	proxy Proxy,
	enableEpochsConfig *data.EnableEpochsConfig,
) (HeaderVerifier, error)

NewHeaderCheckHandler will create all components needed for header verification and returns the header verifier component. It behaves like a main factory for header verification components

type Proxy

type Proxy interface {
	GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error)
	GetRatingsConfig(ctx context.Context) (*data.RatingsConfig, error)
	GetEnableEpochsConfig(ctx context.Context) (*data.EnableEpochsConfig, error)
	GetNonceAtEpochStart(ctx context.Context, shardId uint32) (uint64, error)
	GetRawMiniBlockByHash(ctx context.Context, shardId uint32, hash string, epoch uint32) ([]byte, error)
	GetRawBlockByNonce(ctx context.Context, shardId uint32, nonce uint64) ([]byte, error)
	GetRawBlockByHash(ctx context.Context, shardId uint32, hash string) ([]byte, error)
	GetRawStartOfEpochMetaBlock(ctx context.Context, epoch uint32) ([]byte, error)
	GetGenesisNodesPubKeys(ctx context.Context) (*data.GenesisNodes, error)
	GetValidatorsInfoByEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, error)
	GetGuardianData(ctx context.Context, address core.AddressHandler) (*api.GuardianData, error)
	IsInterfaceNil() bool
}

Proxy holds the behaviour needed for header verifier in order to interact with proxy

type RawHeaderHandler

type RawHeaderHandler interface {
	GetMetaBlockByHash(ctx context.Context, hash string) (coreData.MetaHeaderHandler, error)
	GetShardBlockByHash(ctx context.Context, shardId uint32, hash string) (coreData.HeaderHandler, error)
	GetValidatorsInfoPerEpoch(ctx context.Context, epoch uint32) ([]*state.ShardValidatorInfo, []byte, error)
	IsInterfaceNil() bool
}

RawHeaderHandler holds the behaviour needed to handler raw header data from proxy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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