slotleader

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: GPL-3.0 Imports: 27 Imported by: 3

Documentation

Index

Constants

View Source
const (
	LenProof    = 2
	LenProofMeg = 3
)
View Source
const (
	StageTwoProofCount = 2
	EpochLeaders       = "epochLeaders"
	SecurityMsg        = "securityMsg"
	CR                 = "cr"
	SlotLeader         = "slotLeader"
)

Variables

View Source
var APkiCache *lru.ARCCache
View Source
var RndCache *lru.ARCCache

Functions

func GetRecoveryEpochID

func GetRecoveryEpochID(epochID uint64) uint64

GetRecoveryEpochID used to get the recovery default epochID

func SlsInit

func SlsInit()

Types

type Pack

type Pack struct {
	Proof    [][]byte
	ProofMeg [][]byte
}

type SLS

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

func GetSlotLeaderSelection

func GetSlotLeaderSelection() *SLS

func (*SLS) GenerateDefaultSlotLeaders

func (s *SLS) GenerateDefaultSlotLeaders() error

func (*SLS) GetAllSlotLeaders

func (s *SLS) GetAllSlotLeaders(epochID uint64) (slotLeader []*ecdsa.PublicKey)

func (*SLS) GetChainReader

func (s *SLS) GetChainReader() consensus.ChainReader

GetChainReader can get a simple reader interface of blockchain

func (*SLS) GetCurrentStateDb

func (s *SLS) GetCurrentStateDb() (stateDb *state.StateDB, err error)

GetCurrentStateDb use to get stateDB instance of current state.

func (*SLS) GetEpochDefaultLeadersPK

func (s *SLS) GetEpochDefaultLeadersPK(epochID uint64) []*ecdsa.PublicKey

func (*SLS) GetEpochLeadersPK

func (s *SLS) GetEpochLeadersPK(epochID uint64) []*ecdsa.PublicKey

func (*SLS) GetInfoFromHeadExtra

func (s *SLS) GetInfoFromHeadExtra(epochID uint64, input []byte) ([]*big.Int, []*ecdsa.PublicKey, error)

func (*SLS) GetLocalPublicKey

func (s *SLS) GetLocalPublicKey() (*ecdsa.PublicKey, error)

func (*SLS) GetPreEpochLeadersPK

func (s *SLS) GetPreEpochLeadersPK(epochID uint64) (pks []*ecdsa.PublicKey, isDefault bool)

func (*SLS) GetSlotCreateStatusByEpochID

func (s *SLS) GetSlotCreateStatusByEpochID(epochID uint64) bool

func (*SLS) GetSlotLeader

func (s *SLS) GetSlotLeader(epochID uint64, slotID uint64) (slotLeader *ecdsa.PublicKey, err error)

func (*SLS) GetSma

func (s *SLS) GetSma(epochID uint64) (ret []*ecdsa.PublicKey, isGenesis bool, err error)

func (*SLS) Init

func (s *SLS) Init(blockChain *core.BlockChain, rc *rpc.Client, key *keystore.Key)

Init use to initial slotleader module and input some params.

func (*SLS) IsLocalPkInEpochLeaders

func (s *SLS) IsLocalPkInEpochLeaders(pks []*ecdsa.PublicKey) bool

func (*SLS) Loop

func (s *SLS) Loop(rc *rpc.Client, key *keystore.Key, epochID uint64, slotID uint64)

Loop check work every Slot time. Called by backend loop. It's all slotLeaderSelection's main workflow loop. It does not loop at all, it is loop called by the backend.

func (*SLS) PackSlotProof

func (s *SLS) PackSlotProof(epochID uint64, slotID uint64, prvKey *ecdsa.PrivateKey) ([]byte, error)

func (*SLS) ValidateBody

func (s *SLS) ValidateBody(block *types.Block) error

func (*SLS) ValidateState

func (s *SLS) ValidateState(block, parent *types.Block, state *state.StateDB, receipts types.Receipts, usedGas *big.Int) error

func (*SLS) VerifySlotProof

func (s *SLS) VerifySlotProof(block *types.Block, epochID uint64, slotID uint64, Proof []*big.Int, ProofMeg []*ecdsa.PublicKey) bool

ProofMes = [PK, Gt, skGt] []*PublicKey Proof = [e,z] []*big.Int

type SendTxFn

type SendTxFn func(rc *rpc.Client, tx map[string]interface{})

Jump to

Keyboard shortcuts

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