kernel

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//https://eips.ethereum.org/EIPS/eip-721
	ERC721InterfaceID = [4]byte{0x80, 0xac, 0x58, 0xcd}
	//https://eips.ethereum.org/EIPS/eip-1155
	ERC1155InterfaceID = [4]byte{0xd9, 0xb6, 0x7a, 0x26}
	SBTInterfaceID     = [4]byte{180, 90, 60, 14}
)
View Source
var DefaultHTTPClient = &http.Client{
	Transport: &http.Transport{
		Dial: (&net.Dialer{
			Timeout: 5 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 5 * time.Second,
	},
	Timeout: time.Second * 10,
}
View Source
var (
	ErrBlockNotExist = errors.New("block not exist")
)
View Source
var (
	ProcessTimeMetric = prometheus.NewSummaryVec(
		prometheus.SummaryOpts{
			Name:       "iotex_analyser_plugin_inner_processing_seconds_per_block",
			Help:       "iotex analyser plugin inner processing seconds per block",
			Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
		},
		[]string{"name", "step"},
	)
)

Functions

func ChainClient

func ChainClient() iotexapi.APIServiceClient

func ChainClientWithEndPoint added in v1.4.0

func ChainClientWithEndPoint(endpoint string, withInsecure bool) (iotexapi.APIServiceClient, error)

func CheckInterfaceID added in v1.8.20

func CheckInterfaceID(addr string, interfaceID [4]byte) (bool, error)

func FairbankEffectiveHeight added in v1.4.0

func FairbankEffectiveHeight() uint64

FairbankEffectiveHeight returns the effective height of fairbank = 5166361

func Genesis added in v1.17.27

func Genesis() *genesis.Genesis

func GetBlockByHeightFromBlockDAO

func GetBlockByHeightFromBlockDAO(blkHeight uint64, dao BatchBlockDao) (blk *block.Block, err error)

func GetBlockByHeightFromChain

func GetBlockByHeightFromChain(ctx context.Context, height uint64) (*block.Block, error)

func GetBlockDAOCtx

func GetBlockDAOCtx(ctx context.Context) (blockdao.BlockDAO, bool)

GetBlockDAOCtx gets blockDAOCtx

func GetBlocksFromChain added in v1.17.33

func GetBlocksFromChain(ctx context.Context, start, count uint64, cli iotexapi.APIServiceClient) ([]*block.Block, error)

func GetConfigCtx

func GetConfigCtx(ctx context.Context) (string, bool)

GetConfigCtx gets configCtx

func GetEpochHeight

func GetEpochHeight(epochNum uint64) uint64

GetEpochHeight returns the start height of an epoch

func GetEpochLastBlockHeight

func GetEpochLastBlockHeight(epochNum uint64) uint64

GetEpochLastBlockHeight returns the last height of an epoch

func GetEpochNum

func GetEpochNum(height uint64) uint64

https://github.com/millken/iotex-core/blob/77950cec681d2e441a77b2b9a162ffa1c4ca4f55/action/protocol/rolldpos/epoch.go#L213 GetEpochNum returns the number of the epoch for a given height

func GetPluginConfigCtx added in v1.8.52

func GetPluginConfigCtx(ctx context.Context) ([]byte, bool)

GetPluginConfigCtx gets plugin config

func GetSubEpochNum

func GetSubEpochNum(height uint64) uint64

GetSubEpochNum returns the sub epoch number of a block height

func Init added in v1.17.17

func Init(cfg *config.Config)

func IsErc721 added in v1.8.20

func IsErc721(addr string) (bool, error)

func IsErc1155 added in v1.8.20

func IsErc1155(addr string) (bool, error)

func IsSBT added in v1.8.20

func IsSBT(addr string) (bool, error)

func NewVirtualDao

func NewVirtualDao() blockdao.BlockDAO

func NumSubEpochs

func NumSubEpochs(height uint64) uint64

NumSubEpochs returns the number of subEpochs given a block height

func RewardAt added in v1.15.0

func RewardAt(blk *block.Block, grantRewardActs map[hash.Hash256]bool) (*big.Int, *big.Int, *big.Int, *big.Int, uint64, error)

RewardAt returns all kinds of rewards in a block TODO: gasConsumed should not be returned here

func RewardInfoFromReceipt added in v1.15.0

func RewardInfoFromReceipt(receipt *action.Receipt) (map[string]*RewardInfo, error)

func UnpackLog added in v1.4.0

func UnpackLog(a abi.ABI, out interface{}, event string, log *action.Log) error

UnpackLog parses the log data and returns the corresponding event name and arguments

func WithBlockDAOCtx

func WithBlockDAOCtx(ctx context.Context, dao blockdao.BlockDAO) context.Context

WithBlockDAOCtx add blockDAOCtx into context.

func WithConfigCtx

func WithConfigCtx(ctx context.Context, config string) context.Context

WithConfigCtx add config path into context.

func WithPluginConfigCtx added in v1.8.52

func WithPluginConfigCtx(ctx context.Context, config []byte) context.Context

WithPluginConfigCtx add plugin config into context.

Types

type AtomicBool

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

func (*AtomicBool) Get

func (b *AtomicBool) Get() bool

func (*AtomicBool) Set

func (b *AtomicBool) Set(value bool)

type BatchBlockDao added in v1.17.33

type BatchBlockDao interface {
	blockdao.BlockDAO
	BatchGetBlocks(start, count uint64) (blks []*block.Block, err error)
}

func NewBatchBlockDao added in v1.17.33

func NewBatchBlockDao(dao blockdao.BlockDAO, cli iotexapi.APIServiceClient) BatchBlockDao

func NewLocalBatchBlockDao added in v1.17.33

func NewLocalBatchBlockDao(dao blockdao.BlockDAO) BatchBlockDao

type CandidateActivateEvent added in v1.17.27

type CandidateActivateEvent struct {
	BucketID  uint64
	Candidate address.Address
}

func ParseCandidateActivateEvent added in v1.17.27

func ParseCandidateActivateEvent(logs []*action.Log) (*CandidateActivateEvent, error)

ParseCandidateActivateEvent parses candidate activate event from logs

type CandidateEndorsementEvent added in v1.17.27

type CandidateEndorsementEvent struct {
	BucketID  uint64
	Candidate address.Address
	Op        action.CandidateEndorsementOp
}

func ParseCandidateEndorsementEvent added in v1.17.27

func ParseCandidateEndorsementEvent(logs []*action.Log) (*CandidateEndorsementEvent, error)

ParseCandidateEndorsementEvent parses candidate endorsement event from logs

type CandidateRegisterEvent added in v1.17.27

type CandidateRegisterEvent struct {
	BucketID  uint64
	Candidate address.Address
}

func ParseCandidateRegisterEvent added in v1.17.27

func ParseCandidateRegisterEvent(logs []*action.Log, postFairbankMigration bool, postBLS bool) (*CandidateRegisterEvent, error)

ParseCandidateRegisterEvent parses candidate register event from logs

type RewardInfo added in v1.15.0

type RewardInfo struct {
	BlockReward       *big.Int
	EpochReward       *big.Int
	FoundationBonus   *big.Int
	PriorityBonus     *big.Int
	UnproductiveSlash *big.Int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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