store

package
v0.0.0-...-8d666af Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestEpochSize = 100
)

Utilities for test

Variables

This section is empty.

Functions

func NewMockGetSigner

func NewMockGetSigner(s signer.Signer) func(uint64) (signer.Signer, error)

Types

type Candidate

type Candidate struct {
	Validator validators.Validator
	Authorize bool
}

type HeaderGetter

type HeaderGetter interface {
	Header() *types.Header
	GetHeaderByNumber(uint64) (*types.Header, bool)
}

HeaderGetter is an interface in order each ValidatorStore gets latest header and header by number

type MockBlockchain

type MockBlockchain struct {
	HeaderFn            func() *types.Header
	GetHeaderByNumberFn func(uint64) (*types.Header, bool)
}

func (*MockBlockchain) GetHeaderByNumber

func (m *MockBlockchain) GetHeaderByNumber(height uint64) (*types.Header, bool)

func (*MockBlockchain) Header

func (m *MockBlockchain) Header() *types.Header

type SourceType

type SourceType string

Define the type of the validator set

const (
	// For validators saved in-memory
	Snapshot SourceType = "Snapshot"

	// For validators managed in contract
	Contract SourceType = "Contract"
)

func (SourceType) String

func (t SourceType) String() string

String is a helper method for casting a SourceType to a string representation

type ValidatorStore

type ValidatorStore interface {
	SourceType() SourceType
}

ValidatorStore is an interface that ValidatorStore needs to implement

type ValidatorTypeGetter

type ValidatorTypeGetter func(uint64) (validators.ValidatorType, error)

type Vote

type Vote struct {
	Validator types.Address        // Voter
	Candidate validators.Validator // Candidate
	Authorize bool                 // Add or Remove
}

Vote defines the vote structure

func (*Vote) Copy

func (v *Vote) Copy() *Vote

Copy makes a copy of the vote, and returns it

func (*Vote) Equal

func (v *Vote) Equal(vv *Vote) bool

Equal checks if two votes are equal

func (*Vote) UnmarshalJSON

func (v *Vote) UnmarshalJSON(data []byte) error

UnmarshalJSON is JSON unmarshaler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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