contract

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// How many validator sets are stored in the cache
	// Cache 3 validator sets for 3 epochs
	DefaultValidatorSetCacheSize = 3
)

Variables

View Source
var (
	ErrSignerNotFound                 = errors.New("signer not found")
	ErrInvalidValidatorsTypeAssertion = errors.New("invalid type assertion for Validators")
)

Functions

func FetchBLSValidators

func FetchBLSValidators(
	transition *state.Transition,
	from types.Address,
) (validators.Validators, error)

FetchBLSValidators queries a contract for validator addresses & BLS Public Keys and returns ECDSAValidators

func FetchECDSAValidators

func FetchECDSAValidators(
	transition *state.Transition,
	from types.Address,
) (validators.Validators, error)

FetchECDSAValidators queries a contract for validator addresses and returns ECDSAValidators

func FetchValidators

func FetchValidators(
	validatorType validators.ValidatorType,
	transition *state.Transition,
	from types.Address,
) (validators.Validators, error)

FetchValidators fetches validators from a contract switched by validator type

Types

type ContractValidatorStore

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

func NewContractValidatorStore

func NewContractValidatorStore(
	logger hclog.Logger,
	blockchain store.HeaderGetter,
	executor Executor,
	validatorSetCacheSize int,
) (*ContractValidatorStore, error)

func (*ContractValidatorStore) GetValidatorsByHeight

func (s *ContractValidatorStore) GetValidatorsByHeight(
	validatorType validators.ValidatorType,
	height uint64,
) (validators.Validators, error)

func (*ContractValidatorStore) SourceType

func (s *ContractValidatorStore) SourceType() store.SourceType

type Executor

type Executor interface {
	BeginTxn(types.Hash, *types.Header, types.Address) (*state.Transition, error)
}

Jump to

Keyboard shortcuts

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