Versions in this module Expand all Collapse all v0 v0.0.21 Jun 7, 2022 v0.0.2 Jun 7, 2022 Changes in this version + const MaxTotalVotingPower + const PriorityWindowSizeFactor + var ErrInvalidTimestamp = errors.New("invalid timestamp") + var MaxCheckpointLength = uint64(math.Pow(2, 15)) + func BorRLP(header *types.Header, c *params.BorConfig) []byte + func CalcProducerDelay(number uint64, succession int, c *params.BorConfig) uint64 + func IsErrTooMuchChange(err error) bool + func SealHash(header *types.Header, c *params.BorConfig) (hash common.Hash) + func ValidatorListString(vals []*Validator) string + type API struct + func (api *API) GetAuthor(number *rpc.BlockNumber) (*common.Address, error) + func (api *API) GetCurrentProposer() (common.Address, error) + func (api *API) GetCurrentValidators() ([]*Validator, error) + func (api *API) GetRootHash(start uint64, end uint64) (string, error) + func (api *API) GetSigners(number *rpc.BlockNumber) ([]common.Address, error) + func (api *API) GetSignersAtHash(hash common.Hash) ([]common.Address, error) + func (api *API) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error) + func (api *API) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error) + type BlockTooSoonError struct + Number uint64 + Succession int + func (e *BlockTooSoonError) Error() string + type Bor struct + GenesisContractsClient *GenesisContractsClient + HeimdallClient IHeimdallClient + WithoutHeimdall bool + func New(chainConfig *params.ChainConfig, db ethdb.Database, ...) *Bor + func (c *Bor) APIs(chain consensus.ChainHeaderReader) []rpc.API + func (c *Bor) Author(header *types.Header) (common.Address, error) + func (c *Bor) Authorize(signer common.Address, signFn SignerFn) + func (c *Bor) CalcDifficulty(chain consensus.ChainHeaderReader, time uint64, parent *types.Header) *big.Int + func (c *Bor) Close() error + func (c *Bor) CommitStates(state *state.StateDB, header *types.Header, chain chainContext) ([]*types.StateSyncData, error) + func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...) + func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error) + func (c *Bor) GetCurrentSpan(headerHash common.Hash) (*Span, error) + func (c *Bor) GetCurrentValidators(headerHash common.Hash, blockNumber uint64) ([]*Validator, error) + func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error + func (c *Bor) Seal(chain consensus.ChainHeaderReader, block *types.Block, ...) error + func (c *Bor) SealHash(header *types.Header) common.Hash + func (c *Bor) SetHeimdallClient(h IHeimdallClient) + func (c *Bor) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error + func (c *Bor) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) + func (c *Bor) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error + func (c *Bor) VerifyUncles(chain consensus.ChainReader, block *types.Block) error + type EventRecord struct + ChainID string + Contract common.Address + Data hexutil.Bytes + ID uint64 + LogIndex uint64 + TxHash common.Hash + type EventRecordWithTime struct + Time time.Time + func (e *EventRecordWithTime) BuildEventRecord() *EventRecord + func (e *EventRecordWithTime) String(gasUsed uint64) string + type GenesisContractsClient struct + StateReceiverContract string + ValidatorContract string + func NewGenesisContractsClient(chainConfig *params.ChainConfig, ...) *GenesisContractsClient + func (gc *GenesisContractsClient) CommitState(event *EventRecordWithTime, state *state.StateDB, header *types.Header, ...) (uint64, error) + func (gc *GenesisContractsClient) LastStateId(snapshotNumber uint64) (*big.Int, error) + type HeimdallClient struct + func NewHeimdallClient(urlString string) (*HeimdallClient, error) + func (h *HeimdallClient) Close() + func (h *HeimdallClient) Fetch(rawPath string, rawQuery string) (*ResponseWithHeight, error) + func (h *HeimdallClient) FetchStateSyncEvents(fromID uint64, to int64) ([]*EventRecordWithTime, error) + func (h *HeimdallClient) FetchWithRetry(rawPath string, rawQuery string) (*ResponseWithHeight, error) + type HeimdallSpan struct + ChainID string + SelectedProducers []Validator + ValidatorSet ValidatorSet + type IHeimdallClient interface + Close func() + Fetch func(path string, query string) (*ResponseWithHeight, error) + FetchStateSyncEvents func(fromID uint64, to int64) ([]*EventRecordWithTime, error) + FetchWithRetry func(path string, query string) (*ResponseWithHeight, error) + type InvalidStartEndBlockError struct + CurrentHeader uint64 + End uint64 + Start uint64 + func (e *InvalidStartEndBlockError) Error() string + type InvalidStateReceivedError struct + Event *EventRecordWithTime + LastStateID uint64 + Number uint64 + To *time.Time + func (e *InvalidStateReceivedError) Error() string + type MaxCheckpointLengthExceededError struct + End uint64 + Start uint64 + func (e *MaxCheckpointLengthExceededError) Error() string + type MinimalVal struct + ID uint64 + Signer common.Address + VotingPower uint64 + func SortMinimalValByAddress(a []MinimalVal) []MinimalVal + func ValidatorsToMinimalValidators(vals []Validator) (minVals []MinimalVal) + type MismatchingValidatorsError struct + Number uint64 + ValidatorSetHeader []byte + ValidatorSetSnap []byte + func (e *MismatchingValidatorsError) Error() string + type ResponseWithHeight struct + Height string + Result json.RawMessage + type SignerFn func(accounts.Account, string, []byte) ([]byte, error) + type Snapshot struct + Hash common.Hash + Number uint64 + Recents map[uint64]common.Address + ValidatorSet *ValidatorSet + func (s *Snapshot) Difficulty(signer common.Address) uint64 + func (s *Snapshot) GetSignerSuccessionNumber(signer common.Address) (int, error) + type Span struct + EndBlock uint64 + ID uint64 + StartBlock uint64 + type TotalVotingPowerExceededError struct + Sum int64 + Validators []*Validator + func (e *TotalVotingPowerExceededError) Error() string + type UnauthorizedProposerError struct + Number uint64 + Proposer []byte + func (e *UnauthorizedProposerError) Error() string + type UnauthorizedSignerError struct + Number uint64 + Signer []byte + func (e *UnauthorizedSignerError) Error() string + type Validator struct + Address common.Address + ID uint64 + ProposerPriority int64 + VotingPower int64 + func NewValidator(address common.Address, votingPower int64) *Validator + func ParseValidators(validatorsBytes []byte) ([]*Validator, error) + func (v *Validator) Cmp(other *Validator) *Validator + func (v *Validator) Copy() *Validator + func (v *Validator) HeaderBytes() []byte + func (v *Validator) MinimalVal() MinimalVal + func (v *Validator) PowerBytes() []byte + func (v *Validator) String() string + type ValidatorSet struct + Proposer *Validator + Validators []*Validator + func NewValidatorSet(valz []*Validator) *ValidatorSet + func (vals *ValidatorSet) Copy() *ValidatorSet + func (vals *ValidatorSet) CopyIncrementProposerPriority(times int) *ValidatorSet + func (vals *ValidatorSet) GetByAddress(address common.Address) (index int, val *Validator) + func (vals *ValidatorSet) GetByIndex(index int) (address []byte, val *Validator) + func (vals *ValidatorSet) GetProposer() (proposer *Validator) + func (vals *ValidatorSet) HasAddress(address []byte) bool + func (vals *ValidatorSet) IncrementProposerPriority(times int) + func (vals *ValidatorSet) IsNilOrEmpty() bool + func (vals *ValidatorSet) Iterate(fn func(index int, val *Validator) bool) + func (vals *ValidatorSet) RescalePriorities(diffMax int64) + func (vals *ValidatorSet) Size() int + func (vals *ValidatorSet) String() string + func (vals *ValidatorSet) StringIndented(indent string) string + func (vals *ValidatorSet) TotalVotingPower() int64 + func (vals *ValidatorSet) UpdateWithChangeSet(changes []*Validator) error + type ValidatorsByAddress []*Validator + func (valz ValidatorsByAddress) Len() int + func (valz ValidatorsByAddress) Less(i, j int) bool + func (valz ValidatorsByAddress) Swap(i, j int) + type WrongDifficultyError struct + Actual uint64 + Expected uint64 + Number uint64 + Signer []byte + func (e *WrongDifficultyError) Error() string