util

package
v0.0.0-...-b2007cb Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalEpSlbyTd

func CalEpSlbyTd(blkTd uint64) (epochID uint64, slotID uint64)

func CalEpochSlotID

func CalEpochSlotID(time uint64) (epochId, slotId uint64)

func CalEpochSlotIDByNow

func CalEpochSlotIDByNow()

func CompressPk

func CompressPk(pk *ecdsa.PublicKey) ([]byte, error)

CompressPk

func FirstPosBlockNumber

func FirstPosBlockNumber() uint64

func FromWin

func FromWin(win *big.Int) float64

FromWin use to calc win to wan

func GetAbi

func GetAbi(abiString string) (abi.ABI, error)

func GetCurrentBlkEpochSlotID

func GetCurrentBlkEpochSlotID() (epochID, slotID uint64)

func GetEpochBlock

func GetEpochBlock(epochID uint64) uint64

this function only can return

func GetEpochBlockHash

func GetEpochBlockHash(epochID uint64) common.Hash

func GetEpochSlotID

func GetEpochSlotID() (uint64, uint64)

func GetEpochSlotIDFromDifficulty

func GetEpochSlotIDFromDifficulty(difficulty *big.Int) (epochID, slotID uint64)

GetEpochSlotIDFromDifficulty can get epochID and slotID from difficulty.

func GetProposerBn256PK

func GetProposerBn256PK(epochID uint64, idx uint64, addr common.Address) []byte

func IsPosBlock

func IsPosBlock(number uint64) bool

func IsWhiteAddr

func IsWhiteAddr(addr *common.Address) bool

func MemStat

func MemStat() uint64

Get app memory use

func PkEqual

func PkEqual(pk1, pk2 *ecdsa.PublicKey) bool

PkEqual only can use in same curve. return whether the two points equal

func SendPosTx

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

func SendTx

func SendTx(rc *rpc.Client, tx map[string]interface{}) (common.Hash, error)
type SendTxArgs struct {
 From     common.Address  `json:"from"`
 To       *common.Address `json:"to"`
 Gas      *hexutil.Big    `json:"gas"`
 GasPrice *hexutil.Big    `json:"gasPrice"`
 Value    *hexutil.Big    `json:"value"`
 Data     hexutil.Bytes   `json:"data"`
 Nonce    *hexutil.Uint64 `json:"nonce"`
}

func SetEpochBlock

func SetEpochBlock(epochID uint64, blockNumber uint64, hash common.Hash)

func SetEpocherInst

func SetEpocherInst(sor SelectLead)

func TryGetAndSaveAllStakerInfoBytes

func TryGetAndSaveAllStakerInfoBytes(epochId uint64) (*[][]byte, error)

func UncompressPk

func UncompressPk(buf []byte) (*ecdsa.PublicKey, error)

UncompressPk

func UpdateEpochBlock

func UpdateEpochBlock(block *types.Block)

Types

type SelectLead

type SelectLead interface {
	SelectLeadersLoop(epochId uint64) error
	GetProposerBn256PK(epochID uint64, idx uint64, addr common.Address) []byte
	GetRBProposerG1(epochID uint64) []bn256.G1
	GetEpochLeaders(epochID uint64) [][]byte
	GetEpochLastBlkNumber(targetEpochId uint64) uint64
	GetCurrentHeader() *types.Header
}

func GetEpocherInst

func GetEpocherInst() SelectLead

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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