istanbul

package
v0.0.0-...-7de49f1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Celo64 = 64 // eth/63 + the istanbul messages
	Celo65 = 65 // incorporates changes from eth/64 (EIP)
	Celo66 = 66 // incorporates changes from eth/65 (EIP-2464)
)

Constants to match up protocol versions and messages

View Source
const (
	ConsensusMsg           = 0x11
	QueryEnodeMsg          = 0x12
	ValEnodesShareMsg      = 0x13
	FwdMsg                 = 0x14
	DelegateSignMsg        = 0x15
	VersionCertificatesMsg = 0x16
	EnodeCertificateMsg    = 0x17
	ValidatorHandshakeMsg  = 0x18
)

Message codes for istanbul related messages If you want to add a code, you need to increment the protocolLengths Array size and update the IsIstanbulMsg function below!

View Source
const (
	MsgPreprepare uint64 = iota
	MsgPrepare
	MsgCommit
	MsgRoundChange
)
View Source
const (
	//MinEpochSize represents the minimum permissible epoch size
	MinEpochSize = 3
)
View Source
const ProtocolName = "istanbul"

protocolName is the official short name of the protocol used during capability negotiation.

Variables

View Source
var (
	// ErrUnauthorizedAddress is returned when given address cannot be found in
	// current validator set.
	ErrUnauthorizedAddress = errors.New("not an elected validator")
	// ErrInvalidSigner is returned if a message's signature does not correspond to the address in msg.Address
	ErrInvalidSigner = errors.New("signed by incorrect validator")
	// ErrStoppedEngine is returned if the engine is stopped
	ErrStoppedEngine = errors.New("stopped engine")
	// ErrStartedEngine is returned if the engine is already started
	ErrStartedEngine = errors.New("started engine")
	// ErrStoppedAnnounce is returned if announce is stopped
	ErrStoppedAnnounce = errors.New("stopped announce")
	// ErrStartedAnnounce is returned if announce is already started
	ErrStartedAnnounce = errors.New("started announce")
	// ErrStoppedProxiedValidatorEngine is returned if proxied validator engine is stopped
	ErrStoppedProxiedValidatorEngine = errors.New("stopped proxied validator engine")
	// ErrStartedProxiedValidatorEngine is returned if proxied validator engine is already started
	ErrStartedProxiedValidatorEngine = errors.New("started proxied validator engine")
	// ErrStoppedVPHThread is returned if validator peer handler thread is stopped
	ErrStoppedVPHThread = errors.New("stopped validator peer handler thread")
	// ErrStartedVPHThread is returned if validator peer handler thread is already started
	ErrStartedVPHThread = errors.New("started validator peer handler thread")
	// ErrValidatorNotProxied is returned if the validator is not configured to be proxied
	ErrValidatorNotProxied = errors.New("validator not proxied")
	// ErrInvalidEnodeCertMsgMapOldVersion is returned if a validator sends old enode certificate message
	ErrInvalidEnodeCertMsgMapOldVersion = errors.New("invalid enode certificate message map because of old version")
)
View Source
var DefaultConfig = &Config{
	RequestTimeout:                 3000,
	TimeoutBackoffFactor:           1000,
	MinResendRoundChangeTimeout:    15 * 1000,
	MaxResendRoundChangeTimeout:    2 * 60 * 1000,
	BlockPeriod:                    5,
	ProposerPolicy:                 ShuffledRoundRobin,
	Epoch:                          30000,
	DefaultLookbackWindow:          12,
	ReplicaStateDBPath:             "replicastate",
	ValidatorEnodeDBPath:           "validatorenodes",
	VersionCertificateDBPath:       "versioncertificates",
	RoundStateDBPath:               "roundstates",
	Validator:                      false,
	Replica:                        false,
	Proxy:                          false,
	Proxied:                        false,
	AnnounceQueryEnodeGossipPeriod: 300,
	AnnounceAggressiveQueryEnodeGossipOnEnablement: true,
	AnnounceAdditionalValidatorsToGossip:           10,
}

DefaultConfig for istanbul consensus engine

View Source
var ProtocolLengths = map[uint]uint64{Celo64: 22, Celo65: 27, Celo66: 27}

protocolLengths are the number of implemented message corresponding to different protocol versions.

View Source
var ProtocolVersions = []uint{Celo66, Celo65, Celo64}

ProtocolVersions are the supported versions of the istanbul protocol (first is primary). (First is primary in the sense that it's the most current one supported, not in the sense of IsPrimary() below)

Functions

func ApplyParamsChainConfigToConfig

func ApplyParamsChainConfigToConfig(chainConfig *params.ChainConfig, config *Config) error

ApplyParamsChainConfigToConfig applies the istanbul config values from params.chainConfig to the istanbul.Config config

func CheckValidatorSignature

func CheckValidatorSignature(valSet ValidatorSet, data []byte, sig []byte) (common.Address, error)

func CompareValidatorPublicKeySlices

func CompareValidatorPublicKeySlices(valSet1 []blscrypto.SerializedPublicKey, valSet2 []blscrypto.SerializedPublicKey) bool

func CompareValidatorSlices

func CompareValidatorSlices(valSet1 []common.Address, valSet2 []common.Address) bool

CompareValidatorSlices compares 2 validator slices and indicate if they are equal. Equality is defined as: valseSet1[i] must be equal to valSet2[i] for every i. (aka. order matters)

func ConvertPublicKeysToStringSlice

func ConvertPublicKeysToStringSlice(publicKeys []blscrypto.SerializedPublicKey) []string

func GetEpochFirstBlockGivenBlockNumber

func GetEpochFirstBlockGivenBlockNumber(blockNumber uint64, epochSize uint64) (uint64, error)

GetEpochFirstBlockGivenBlockNumber retrieves first block of a given block's epoch Fails when try to obtain first block of epoch 0 (genesis)

func GetEpochFirstBlockNumber

func GetEpochFirstBlockNumber(epochNumber uint64, epochSize uint64) (uint64, error)

GetEpochFirstBlockNumber retrieves first block of epoch.

func GetEpochLastBlockNumber

func GetEpochLastBlockNumber(epochNumber uint64, epochSize uint64) uint64

GetEpochLastBlockNumber retrieves last block of epoch

func GetEpochNumber

func GetEpochNumber(number uint64, epochSize uint64) uint64

GetEpochNumber retrieves the epoch number given the block number. Epoch 0 is a special block that only contains the genesis block (block 0), epoch 1 starts at block 1

func GetNodeID

func GetNodeID(enodeURL string) (*enode.ID, error)

func GetNumberWithinEpoch

func GetNumberWithinEpoch(number uint64, epochSize uint64) uint64

GetNumberWithinEpoch retrieves the block number within an epoch. The return value will be 1-based; thus first block of epoch is 1, and last block of epoch is `epochSize` There is a special case if the number == 0. It is basically the last block of the 0th epoch, and should have a value of epochSize

func GetSignatureAddress

func GetSignatureAddress(data []byte, sig []byte) (common.Address, error)

GetSignatureAddress gets the signer address from the signature

func IsFirstBlockOfEpoch

func IsFirstBlockOfEpoch(number uint64, epochSize uint64) bool

IsFirstBlockOfEpoch indicates if block number is the first block of its epoch

func IsGossipedMsg

func IsGossipedMsg(msgCode uint64) bool

IsGossipedMsg specifies which messages should be gossiped throughout the network (as opposed to directly sent to a peer).

func IsIstanbulMsg

func IsIstanbulMsg(msg p2p.Msg) bool

func IsLastBlockOfEpoch

func IsLastBlockOfEpoch(number uint64, epochSize uint64) bool

IsLastBlockOfEpoch indicates if block number is the last block of its epoch

func IsPrimary

func IsPrimary(version uint) bool

Returns whether this version of Istanbul should have Primary: true (a legacy property that was needed to work around an upstream bug in the LES protocol which prevented two LES servers from connecting to each other). Versions up to Celo65 need to have it, for backwards compatibility. Newer versions don't need it, since the upstream LES bug has now been fixed.

func MapMessagesToSenders

func MapMessagesToSenders(messages []Message) []common.Address

MapMessagesToSenders map a list of Messages to the list of the sender addresses

func MapValidatorsToAddresses

func MapValidatorsToAddresses(validators []Validator) []common.Address

MapValidatorsToAddresses maps a slice of validator to a slice of addresses

func MapValidatorsToPublicKeys

func MapValidatorsToPublicKeys(validators []Validator) []blscrypto.SerializedPublicKey

MapValidatorsToPublicKeys maps a slice of validator to a slice of public keys

func MustGetEpochFirstBlockGivenBlockNumber

func MustGetEpochFirstBlockGivenBlockNumber(blockNumber uint64, epochSize uint64) uint64

MustGetEpochFirstBlockGivenBlockNumber is a variant of GetEpochFirstBlockGivenBlockNumber that panics if called for epoch 0 (genesis)

func NewIstLogger

func NewIstLogger(fn func() *big.Int, ctx ...interface{}) log.Logger

NewIstLogger creates an Istanbul Logger with custom logic for exposing logs

func RLPHash

func RLPHash(v interface{}) (h common.Hash)

func RandomnessCommitmentDBLocation

func RandomnessCommitmentDBLocation(commitment common.Hash) []byte

RandomnessCommitmentDBLocation will return the key for where the given commitment's cached key-value entry

func SeparateValidatorDataIntoIstanbulExtra

func SeparateValidatorDataIntoIstanbulExtra(validators []ValidatorData) ([]common.Address, []blscrypto.SerializedPublicKey)

Types

type AddressEntry

type AddressEntry struct {
	Address                      common.Address
	PublicKey                    *ecdsa.PublicKey
	Node                         *enode.Node
	Version                      uint
	HighestKnownVersion          uint
	NumQueryAttemptsForHKVersion uint
	LastQueryTimestamp           *time.Time
}

## AddressEntry ###################################################################### AddressEntry is an entry for the valEnodeTable.

func (*AddressEntry) DecodeRLP

func (ae *AddressEntry) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the AddressEntry fields from a RLP stream.

func (*AddressEntry) EncodeRLP

func (ae *AddressEntry) EncodeRLP(w io.Writer) error

EncodeRLP serializes AddressEntry into the Ethereum RLP format.

func (*AddressEntry) GetAddress

func (ae *AddressEntry) GetAddress() common.Address

GetAddess returns the addess entry's address

func (*AddressEntry) GetNode

func (ae *AddressEntry) GetNode() *enode.Node

GetNode returns the address entry's node

func (*AddressEntry) GetVersion

func (ae *AddressEntry) GetVersion() uint

GetVersion returns the addess entry's version

func (*AddressEntry) String

func (ae *AddressEntry) String() string

type AddressEntryRLP

type AddressEntryRLP struct {
	Address                      common.Address
	CompressedPublicKey          []byte
	EnodeURL                     string
	Version                      uint
	HighestKnownVersion          uint
	NumQueryAttemptsForHKVersion uint
	LastQueryTimestamp           []byte
}

Implement RLP Encode/Decode interface

type BLSSignerFn

type BLSSignerFn func(accounts.Account, []byte, []byte, bool, bool) (blscrypto.SerializedSignature, error)

BLSSignerFn is a signer callback function to request a message and extra data to be signed by a backing account using BLS with a direct or composite hasher

type CommittedSubject

type CommittedSubject struct {
	Subject               *Subject
	CommittedSeal         []byte
	EpochValidatorSetSeal []byte
}

type Config

type Config struct {
	RequestTimeout              uint64         `toml:",omitempty"` // The timeout for each Istanbul round in milliseconds.
	TimeoutBackoffFactor        uint64         `toml:",omitempty"` // Timeout at subsequent rounds is: RequestTimeout + 2**round * TimeoutBackoffFactor (in milliseconds)
	MinResendRoundChangeTimeout uint64         `toml:",omitempty"` // Minimum interval with which to resend RoundChange messages for same round
	MaxResendRoundChangeTimeout uint64         `toml:",omitempty"` // Maximum interval with which to resend RoundChange messages for same round
	BlockPeriod                 uint64         `toml:",omitempty"` // Default minimum difference between two consecutive block's timestamps in second
	ProposerPolicy              ProposerPolicy `toml:",omitempty"` // The policy for proposer selection
	Epoch                       uint64         `toml:",omitempty"` // The number of blocks after which to checkpoint and reset the pending votes
	DefaultLookbackWindow       uint64         `toml:",omitempty"` // The default value for how many blocks in a row a validator must miss to be considered "down"
	ReplicaStateDBPath          string         `toml:",omitempty"` // The location for the validator replica state DB
	ValidatorEnodeDBPath        string         `toml:",omitempty"` // The location for the validator enodes DB
	VersionCertificateDBPath    string         `toml:",omitempty"` // The location for the signed announce version DB
	RoundStateDBPath            string         `toml:",omitempty"` // The location for the round states DB
	Validator                   bool           `toml:",omitempty"` // Specified if this node is configured to validate  (specifically if --mine command line is set)
	Replica                     bool           `toml:",omitempty"` // Specified if this node is configured to be a replica

	// Proxy Configs
	Proxy                   bool           `toml:",omitempty"` // Specifies if this node is a proxy
	ProxiedValidatorAddress common.Address `toml:",omitempty"` // The address of the proxied validator

	// Proxied Validator Configs
	Proxied      bool           `toml:",omitempty"` // Specifies if this node is proxied
	ProxyConfigs []*ProxyConfig `toml:",omitempty"` // The set of proxy configs for this proxied validator at startup

	// Announce Configs
	AnnounceQueryEnodeGossipPeriod                 uint64 `toml:",omitempty"` // Time duration (in seconds) between gossiped query enode messages
	AnnounceAggressiveQueryEnodeGossipOnEnablement bool   `toml:",omitempty"` // Specifies if this node should aggressively query enodes on announce enablement
	AnnounceAdditionalValidatorsToGossip           int64  `toml:",omitempty"` // Specifies the number of additional non-elected validators to gossip an announce
}

Config represents the istanbul consensus engine

type DecryptFn

type DecryptFn func(accounts.Account, []byte, []byte, []byte) ([]byte, error)

Decrypt is a decrypt callback function to request an ECIES ciphertext to be decrypted

type EnodeCertMsg

type EnodeCertMsg struct {
	Msg           *Message
	DestAddresses []common.Address
}

## EnodeCertMsg ######################################################################

type EnodeCertificate

type EnodeCertificate struct {
	EnodeURL string
	Version  uint
}

## EnodeCertificate ######################################################################

func (*EnodeCertificate) DecodeRLP

func (ec *EnodeCertificate) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the ec fields from a RLP stream.

func (*EnodeCertificate) EncodeRLP

func (ec *EnodeCertificate) EncodeRLP(w io.Writer) error

EncodeRLP serializes ec into the Ethereum RLP format.

type FinalCommittedEvent

type FinalCommittedEvent struct {
}

FinalCommittedEvent is posted when a proposal is committed

type ForwardMessage

type ForwardMessage struct {
	Code          uint64
	Msg           []byte
	DestAddresses []common.Address
}

type HashSignerFn

type HashSignerFn func(accounts.Account, []byte) ([]byte, error)

HashSignerFn is a signer callback function to request a hash to be signed by a backing account.

type Message

type Message struct {
	Code      uint64
	Msg       []byte
	Address   common.Address // The sender address
	Signature []byte         // Signature of the Message using the private key associated with the "Address" field
}

func (*Message) Copy

func (m *Message) Copy() *Message

func (*Message) Decode

func (m *Message) Decode(val interface{}) error

func (*Message) FromPayload

func (m *Message) FromPayload(b []byte, validateFn func([]byte, []byte) (common.Address, error)) error

func (*Message) Payload

func (m *Message) Payload() ([]byte, error)

func (*Message) PayloadNoSig

func (m *Message) PayloadNoSig() ([]byte, error)

func (*Message) Sign

func (m *Message) Sign(signingFn func(data []byte) ([]byte, error)) error

func (*Message) String

func (m *Message) String() string

type MessageEvent

type MessageEvent struct {
	Payload []byte
}

MessageEvent is posted for Istanbul engine communication

type MessageWithPeerIDEvent

type MessageWithPeerIDEvent struct {
	PeerID  enode.ID
	Payload []byte
}

MessageWithPeerIDEvent is a MessageEvent with the peerID that sent the message

type PreparedCertificate

type PreparedCertificate struct {
	Proposal                Proposal
	PrepareOrCommitMessages []Message
}

func EmptyPreparedCertificate

func EmptyPreparedCertificate() PreparedCertificate

func (*PreparedCertificate) AsData

func (*PreparedCertificate) DecodeRLP

func (pc *PreparedCertificate) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the consensus fields from a RLP stream.

func (*PreparedCertificate) EncodeRLP

func (pc *PreparedCertificate) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the Ethereum RLP format.

func (*PreparedCertificate) IsEmpty

func (pc *PreparedCertificate) IsEmpty() bool

func (*PreparedCertificate) Summary

type PreparedCertificateData

type PreparedCertificateData struct {
	Proposal                *types.Block
	PrepareOrCommitMessages []Message
}

type PreparedCertificateSummary

type PreparedCertificateSummary struct {
	ProposalHash   common.Hash      `json:"proposalHash"`
	PrepareSenders []common.Address `json:"prepareSenders"`
	CommitSenders  []common.Address `json:"commitSenders"`
}

type Preprepare

type Preprepare struct {
	View                   *View
	Proposal               Proposal
	RoundChangeCertificate RoundChangeCertificate
}

func (*Preprepare) AsData

func (pp *Preprepare) AsData() *PreprepareData

func (*Preprepare) DecodeRLP

func (pp *Preprepare) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the consensus fields from a RLP stream.

func (*Preprepare) EncodeRLP

func (pp *Preprepare) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the Ethereum RLP format.

func (*Preprepare) HasRoundChangeCertificate

func (pp *Preprepare) HasRoundChangeCertificate() bool

func (*Preprepare) Summary

func (pp *Preprepare) Summary() *PreprepareSummary

type PreprepareData

type PreprepareData struct {
	View                   *View
	Proposal               *types.Block
	RoundChangeCertificate RoundChangeCertificate
}

type PreprepareSummary

type PreprepareSummary struct {
	View                          *View            `json:"view"`
	ProposalHash                  common.Hash      `json:"proposalHash"`
	RoundChangeCertificateSenders []common.Address `json:"roundChangeCertificateSenders"`
}

type Proposal

type Proposal interface {
	// Number retrieves the sequence number of this proposal.
	Number() *big.Int

	Header() *types.Header

	// Hash retrieves the hash of this block
	Hash() common.Hash

	// ParentHash retrieves the hash of this block's parent
	ParentHash() common.Hash

	EncodeRLP(w io.Writer) error

	DecodeRLP(s *rlp.Stream) error
}

Proposal supports retrieving height and serialized block to be used during Istanbul consensus.

type ProposerPolicy

type ProposerPolicy uint64

ProposerPolicy represents the policy used to order elected validators within an epoch

const (
	RoundRobin ProposerPolicy = iota
	Sticky
	ShuffledRoundRobin
)

type ProposerSelector

type ProposerSelector func(validatorSet ValidatorSet, lastBlockProposer common.Address, currentRound uint64) Validator

ProposerSelector returns the block proposer for a round given the last proposer, round number, and randomness.

type ProxyConfig

type ProxyConfig struct {
	InternalNode *enode.Node `toml:",omitempty"` // The internal facing node of the proxy that this proxied validator will peer with
	ExternalNode *enode.Node `toml:",omitempty"` // The external facing node of the proxy that the proxied validator will broadcast via the announce message
}

ProxyConfig represents the configuration for validator's proxies

type Request

type Request struct {
	Proposal Proposal
}

func (*Request) DecodeRLP

func (b *Request) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the consensus fields from a RLP stream.

func (*Request) EncodeRLP

func (b *Request) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the Ethereum RLP format.

type RequestEvent

type RequestEvent struct {
	Proposal Proposal
}

RequestEvent is posted to propose a proposal

type RoundChange

type RoundChange struct {
	View                *View
	PreparedCertificate PreparedCertificate
}

func (*RoundChange) DecodeRLP

func (b *RoundChange) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the consensus fields from a RLP stream.

func (*RoundChange) EncodeRLP

func (b *RoundChange) EncodeRLP(w io.Writer) error

EncodeRLP serializes b into the Ethereum RLP format.

func (*RoundChange) HasPreparedCertificate

func (b *RoundChange) HasPreparedCertificate() bool

type RoundChangeCertificate

type RoundChangeCertificate struct {
	RoundChangeMessages []Message
}

func (*RoundChangeCertificate) IsEmpty

func (b *RoundChangeCertificate) IsEmpty() bool

type SignerFn

type SignerFn func(accounts.Account, string, []byte) ([]byte, error)

SignerFn is a signer callback function to request a header to be signed by a backing account.

type Subject

type Subject struct {
	View   *View
	Digest common.Hash
}

func (*Subject) String

func (s *Subject) String() string

type Validator

type Validator interface {
	fmt.Stringer

	// Address returns address
	Address() common.Address

	// BLSPublicKey returns the BLS public key (compressed format)
	BLSPublicKey() blscrypto.SerializedPublicKey

	// BLSPublicKeyUncompressed returns the BLS public key (uncompressed format)
	BLSPublicKeyUncompressed() []byte

	// Serialize returns binary reprenstation of the Validator
	// can be use used to instantiate a validator with DeserializeValidator()
	Serialize() ([]byte, error)

	// AsData returns Validator representation as ValidatorData
	AsData() *ValidatorData

	// AsData returns Validator representation as ValidatorData
	AsDataWithBLSKeyCache() *ValidatorDataWithBLSKeyCache

	// CacheUncompressedBLSKey stores the uncompressed BLS public key to cache
	CacheUncompressedBLSKey()

	// Copy validator
	Copy() Validator
}

type ValidatorData

type ValidatorData struct {
	Address      common.Address
	BLSPublicKey blscrypto.SerializedPublicKey
}

func CombineIstanbulExtraToValidatorData

func CombineIstanbulExtraToValidatorData(addrs []common.Address, blsPublicKeys []blscrypto.SerializedPublicKey) ([]ValidatorData, error)

func ValidatorSetDiff

func ValidatorSetDiff(oldValSet []ValidatorData, newValSet []ValidatorData) ([]ValidatorData, *big.Int)

type ValidatorDataWithBLSKeyCache

type ValidatorDataWithBLSKeyCache struct {
	Address                  common.Address
	BLSPublicKey             blscrypto.SerializedPublicKey
	UncompressedBLSPublicKey []byte
}

type ValidatorSet

type ValidatorSet interface {
	fmt.Stringer

	// Sets the randomness for use in the proposer policy.
	// This is injected into the ValidatorSet when we call `getOrderedValidators`
	SetRandomness(seed common.Hash)
	// Sets the randomness for use in the proposer policy
	GetRandomness() common.Hash

	// Return the validator size
	Size() int
	// Get the maximum number of faulty nodes
	F() int
	// Get the minimum quorum size
	MinQuorumSize() int

	// List returns all the validators
	List() []Validator
	// Return the validator index
	GetIndex(addr common.Address) int
	// Get validator by index
	GetByIndex(i uint64) Validator
	// Get validator by given address
	GetByAddress(addr common.Address) (int, Validator)
	// CointainByAddress indicates if a validator with the given address is present
	ContainsByAddress(add common.Address) bool

	// Add validators
	AddValidators(validators []ValidatorData) bool
	// Remove validators
	RemoveValidators(removedValidators *big.Int) bool
	// Copy validator set
	Copy() ValidatorSet

	// CacheUncompressedBLSKey stores the uncompressed BLS public key to cache for each validator in the valset
	CacheUncompressedBLSKey()

	// HasBLSKeyCache tests that all uncompressed BLS public keys are in the cache, otherwise returns false
	HasBLSKeyCache() bool

	// Serialize returns binary reprentation of the ValidatorSet
	// can be use used to instantiate a validator with DeserializeValidatorSet()
	Serialize() ([]byte, error)
}

type ValidatorSetData

type ValidatorSetData struct {
	Validators []ValidatorData
	Randomness common.Hash
}

type ValidatorSetDataWithBLSKeyCache

type ValidatorSetDataWithBLSKeyCache struct {
	Validators []ValidatorDataWithBLSKeyCache
	Randomness common.Hash
}

type ValidatorsDataByAddress

type ValidatorsDataByAddress []ValidatorData

func (ValidatorsDataByAddress) Len

func (a ValidatorsDataByAddress) Len() int

func (ValidatorsDataByAddress) Less

func (a ValidatorsDataByAddress) Less(i, j int) bool

func (ValidatorsDataByAddress) Swap

func (a ValidatorsDataByAddress) Swap(i, j int)

type View

type View struct {
	Round    *big.Int
	Sequence *big.Int
}

View includes a round number and a sequence number. Sequence is the block number we'd like to commit. Each round has a number and is composed by 3 steps: preprepare, prepare and commit.

If the given block is not accepted by validators, a round change will occur and the validators start a new round with round+1.

func (*View) Cmp

func (v *View) Cmp(y *View) int

Cmp compares v and y and returns:

-1 if v <  y
 0 if v == y
+1 if v >  y

func (*View) String

func (v *View) String() string

Directories

Path Synopsis
random
Package random implements a language independent method of producing random validator orderings.
Package random implements a language independent method of producing random validator orderings.

Jump to

Keyboard shortcuts

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