Documentation
¶
Index ¶
- Variables
- func ActionTypeString(act action.Action) string
- func ChainClient() iotexapi.APIServiceClient
- func ChainClientWithEndPoint(endpoint string, withInsecure bool) (iotexapi.APIServiceClient, error)
- func CheckInterfaceID(addr string, interfaceID [4]byte) (bool, error)
- func ComputeAuthorizationValidity(ctx context.Context, authority common.Address, blockHeight uint64, ...) (bool, error)
- func EthArchiveClient() (*ethclient.Client, error)
- func FairbankEffectiveHeight() uint64
- func Genesis() *genesis.Genesis
- func GetBlockByHeightFromBlockDAO(blkHeight uint64, dao BatchBlockDao) (blk *block.Block, err error)
- func GetBlockByHeightFromChain(ctx context.Context, height uint64) (*block.Block, error)
- func GetBlockDAOCtx(ctx context.Context) (blockdao.BlockDAO, bool)
- func GetBlocksFromChain(ctx context.Context, start, count uint64, cli iotexapi.APIServiceClient) ([]*block.Block, error)
- func GetConfigCtx(ctx context.Context) (string, bool)
- func GetEpochHeight(epochNum uint64) uint64
- func GetEpochLastBlockHeight(epochNum uint64) uint64
- func GetEpochNum(height uint64) uint64
- func GetPluginConfigCtx(ctx context.Context) ([]byte, bool)
- func GetSubEpochNum(height uint64) uint64
- func Init(cfg *config.Config)
- func IsErc721(addr string) (bool, error)
- func IsErc1155(addr string) (bool, error)
- func IsSBT(addr string) (bool, error)
- func NewVirtualDao() blockdao.BlockDAO
- func NumSubEpochs(height uint64) uint64
- func RewardAt(blk *block.Block, grantRewardActs map[hash.Hash256]bool) (*big.Int, *big.Int, *big.Int, *big.Int, uint64, error)
- func RewardInfoFromReceipt(receipt *action.Receipt) (map[string]*RewardInfo, error)
- func UnpackLog(a abi.ABI, out interface{}, event string, log *action.Log) error
- func WithBlockDAOCtx(ctx context.Context, dao blockdao.BlockDAO) context.Context
- func WithConfigCtx(ctx context.Context, config string) context.Context
- func WithPluginConfigCtx(ctx context.Context, config []byte) context.Context
- type AtomicBool
- type BatchBlockDao
- type CandidateActivateEvent
- type CandidateEndorsementEvent
- type CandidateRegisterEvent
- type RewardInfo
Constants ¶
This section is empty.
Variables ¶
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} )
var DefaultHTTPClient = &http.Client{ Transport: &http.Transport{ Dial: (&net.Dialer{ Timeout: 5 * time.Second, }).Dial, TLSHandshakeTimeout: 5 * time.Second, }, Timeout: time.Second * 10, }
var (
ErrBlockNotExist = errors.New("block not exist")
)
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 ActionTypeString ¶ added in v1.19.0
ActionTypeString names an action for the indexes that record a type column.
It lives here because two plugins — block_action and block_action_partition — both need it and both used to carry their own copy. When the reward grants were split into three types, only one copy was updated, and the API reads the other table: the explorer went on showing every IIP-59 voter payout as a generic "grantReward" even though the fix was in.
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 ComputeAuthorizationValidity ¶ added in v1.18.2
func ComputeAuthorizationValidity( ctx context.Context, authority common.Address, blockHeight uint64, chainID *uint256.Int, authNonce uint64, ) (bool, error)
ComputeAuthorizationValidity evaluates whether an EIP-7702 authorization would have been accepted by the chain at the time it was included.
Validity rules (mirroring iotex-core's validateAuthorization):
- chain_id is 0 or matches the network chain id
- authority's code at blockHeight-1 is empty OR a delegation designator
- authority's nonce at blockHeight-1 equals authNonce
The blacklist rule is intentionally skipped. Signature recovery is the caller's responsibility (the recovered authority is an input).
Returns:
- (true, nil) if all rules pass
- (false, nil) if any rule failed for a deterministic reason
- (false, err) only when RPC could not reach a decision after retries
func EthArchiveClient ¶ added in v1.18.2
EthArchiveClient returns a singleton eth-json-rpc client backed by the EthArchiveEndPoint config. The endpoint must be an archive node so that state-at-height queries (eth_getCode, eth_getTransactionCount) work for historical blocks.
func FairbankEffectiveHeight ¶ added in v1.4.0
func FairbankEffectiveHeight() uint64
FairbankEffectiveHeight returns the effective height of fairbank = 5166361
func GetBlockByHeightFromBlockDAO ¶
func GetBlockByHeightFromBlockDAO(blkHeight uint64, dao BatchBlockDao) (blk *block.Block, err error)
func GetBlockDAOCtx ¶
GetBlockDAOCtx gets blockDAOCtx
func GetBlocksFromChain ¶ added in v1.17.33
func GetConfigCtx ¶
GetConfigCtx gets configCtx
func GetEpochHeight ¶
GetEpochHeight returns the start height of an epoch
func GetEpochLastBlockHeight ¶
GetEpochLastBlockHeight returns the last height of an epoch
func GetEpochNum ¶
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
GetPluginConfigCtx gets plugin config
func GetSubEpochNum ¶
GetSubEpochNum returns the sub epoch number of a block height
func NewVirtualDao ¶
func NumSubEpochs ¶
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
UnpackLog parses the log data and returns the corresponding event name and arguments
func WithBlockDAOCtx ¶
WithBlockDAOCtx add blockDAOCtx into context.
func WithConfigCtx ¶
WithConfigCtx add config path 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
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
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