store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: Apache-2.0 Imports: 5 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

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