handler

package
v1.7.1-testnet Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrScanLogsUnavailable = errors.New("scan logs rpc unavailable")

	ErrScanLogsInvalidParams = errors.New("invalid scan logs params")
	ErrScanLogsInvalidCursor = errors.New("invalid scan logs cursor")

	ErrScanLogsConsistency       = errors.New("inconsistent canonical views")
	ErrScanLogsAssumptionFailure = errors.New("pivot assumption failed")
)

Functions

func EncodeScanLogsResult

func EncodeScanLogsResult[T any](result T) (cacheTypes.Lazy[T], error)

EncodeScanLogsResult serializes a result once, enforces the response-size limit on those exact bytes, and returns a Lazy value that reuses the payload.

func MustInitFromViper

func MustInitFromViper()

func NewScanLogsError

func NewScanLogsError(category, cause error) error

NewScanLogsError constructs a categorized scanLogs error. The category is the externally visible manifestation; cause is the concrete failure reason. Neither the returned error nor its category implements a JSON-RPC error code.

func NewScanLogsErrorf

func NewScanLogsErrorf(category error, format string, args ...any) error

NewScanLogsErrorf is the formatted counterpart of NewScanLogsError.

func RequireBoundChecks

func RequireBoundChecks(filter *types.LogFilter) bool

RequireBoundChecks determines if bound checks should be applied based on if there is any space to narrow down the log filter

func ToHexBigSlice

func ToHexBigSlice(arr []*big.Int) []*hexutil.Big

ToHexBigSlice converts a slice of `*big.Int` to a slice of `*hexutil.Big`.

Types

type BlockPriorityFee

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

BlockPriorityFee holds the gas fees of transactions within a single block.

func (*BlockPriorityFee) Append

func (b *BlockPriorityFee) Append(txnTips ...*TxnPriorityFee)

Append appends transaction priority fees to the block and sorts them in ascending order.

func (*BlockPriorityFee) Percentile

func (b *BlockPriorityFee) Percentile(p float64) *big.Int

Percentile calculates the percentile of transaction priority fees

func (*BlockPriorityFee) TipRange

func (b *BlockPriorityFee) TipRange() []*big.Int

TipRange returns the range of transaction priority fees in the block.

type CfxGasStationHandler

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

CfxGasStationHandler handles RPC requests for gas price estimation.

func MustNewCfxGasStationHandlerFromViper

func MustNewCfxGasStationHandlerFromViper(cp *node.CfxClientProvider) *CfxGasStationHandler

func (*CfxGasStationHandler) Suggest

type CfxInternalContractLogsApiHandler

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

CfxInternalContractLogsApiHandler handles log queries for registered internal contracts.

func MustNewCfxInternalContractLogsApiHandler

func MustNewCfxInternalContractLogsApiHandler(
	cfxDB *mysql.CfxStore,
	clientProvider *node.CfxClientProvider,
) *CfxInternalContractLogsApiHandler

func NewCfxInternalContractLogsApiHandler

func NewCfxInternalContractLogsApiHandler(
	registry *tracelog.Registry,
	logStore *mysql.InternalContractLogStore,
) *CfxInternalContractLogsApiHandler

func (*CfxInternalContractLogsApiHandler) FilterRegisteredInternalContractAddresses

func (h *CfxInternalContractLogsApiHandler) FilterRegisteredInternalContractAddresses(addrs []types.Address) []types.Address

FilterRegisteredInternalContractAddresses filters the given addresses to only include registered internal contracts.

func (*CfxInternalContractLogsApiHandler) GetLogs

GetLogs retrieves internal contract logs matching the given filter.

type CfxLogsApiHandler

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

CfxLogsApiHandler RPC handler to get core space event logs from store or fullnode.

func NewCfxLogsApiHandler

func NewCfxLogsApiHandler(ms *mysql.CfxStore, prunedHandler *CfxPrunedLogsHandler, maxAttempts int) *CfxLogsApiHandler

func (*CfxLogsApiHandler) GetLogs

func (handler *CfxLogsApiHandler) GetLogs(
	ctx context.Context,
	cfx sdk.ClientOperator,
	filter *types.LogFilter,
	delegatedRpcMethod string,
) ([]types.Log, bool, error)

func (*CfxLogsApiHandler) ScanLogs

func (handler *CfxLogsApiHandler) ScanLogs(
	ctx context.Context,
	cfx cfxScanClient,
	req CfxScanLogParams,
	assumption *CfxPivotAssumption,
) (result *CfxScanLogResult, err error)

ScanLogs executes a scan whose epoch range was already normalized and frozen by the RPC layer.

Consistency uses two nested optimistic scopes:

outer DB generation:
  v0 -> capture watermarks/mappings -> DB assumption -> DB cache
  inner FN attempt (only if reached):
    before(H) -> logs/cursor/guard/boundary -> after(H)
  v1 -> common success/error commit gate

A changed FN checkpoint retries only the inner scope and reuses DB results. A changed DB reorgVersion invalidates mappings, plan, cache and all candidate outcomes. Canonical-dependent errors pass through the same gates as success.

type CfxPivotAssumption

type CfxPivotAssumption struct {
	EpochNumber    hexutil.Uint64 `json:"epochNumber"`
	PivotBlockHash cfxtypes.Hash  `json:"pivotBlockHash"`
}

`CfxPivotAssumption` identifies the canonical pivot block for an epoch. The same shape is used for the output guard.

func (*CfxPivotAssumption) UnmarshalJSON

func (a *CfxPivotAssumption) UnmarshalJSON(data []byte) error

type CfxPivotGuard

type CfxPivotGuard CfxPivotAssumption

type CfxPrunedLogsHandler

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

CfxPrunedLogsHandler RPC handler to get pruned event logs from some archive fullnodes in rate limited way or vip mode with dedicated fullnode.

func NewCfxPrunedLogsHandler

func NewCfxPrunedLogsHandler(
	pool *node.CfxClientProvider, store *mysql.UserStore, client *redis.Client) *CfxPrunedLogsHandler

func (*CfxPrunedLogsHandler) GetLogs

func (h *CfxPrunedLogsHandler) GetLogs(ctx context.Context, filter types.LogFilter) ([]types.Log, error)

type CfxScanLogFilter

type CfxScanLogFilter struct {
	FromEpoch *cfxtypes.Epoch     `json:"fromEpoch,omitempty"`
	ToEpoch   *cfxtypes.Epoch     `json:"toEpoch,omitempty"`
	Address   *cfxaddress.Address `json:"address,omitempty"`
	Topic0    *cfxtypes.Hash      `json:"topic0,omitempty"`
}

func (*CfxScanLogFilter) UnmarshalJSON

func (f *CfxScanLogFilter) UnmarshalJSON(data []byte) error

type CfxScanLogParams

type CfxScanLogParams struct {
	*CfxScanLogRequest
	EpochRange          types.RangeUint64
	WithPivotAssumption bool
}

CfxScanLogParams is the Handler input produced by the RPC normalization layer. EpochRange is numeric, frozen and validated for the entire request.

func NormalizeCfxScanLogRequest

func NormalizeCfxScanLogRequest(
	resolver cfxEpochNumberResolver,
	req CfxScanLogRequest,
	withPivotAssumption bool,
) (params CfxScanLogParams, err error)

type CfxScanLogRequest

type CfxScanLogRequest struct {
	Filter  CfxScanLogFilter `json:"filter"`
	Limit   uint64           `json:"limit"`
	Cursor  *ScanLogCursor   `json:"cursor,omitempty"`
	Reverse bool             `json:"reverse,omitempty"`
}

CfxScanLogRequest is the JSON-RPC request shape. Epoch bounds may still contain tags and must be normalized before entering the Handler.

func (CfxScanLogRequest) ContractAddress

func (r CfxScanLogRequest) ContractAddress() (string, bool)

func (*CfxScanLogRequest) UnmarshalJSON

func (r *CfxScanLogRequest) UnmarshalJSON(data []byte) error

type CfxScanLogResult

type CfxScanLogResult struct {
	Logs       []cfxtypes.Log `json:"logs"`
	NextCursor *ScanLogCursor `json:"nextCursor,omitempty"`
	PivotGuard *CfxPivotGuard `json:"pivotGuard,omitempty"`
	// contains filtered or unexported fields
}

type CfxStateHandler

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

CfxStateHandler handles core space state RPC method by redirecting requests to another full state node if state is not available on normal full node.

func NewCfxStateHandler

func NewCfxStateHandler(cp *node.CfxClientProvider) *CfxStateHandler

func (*CfxStateHandler) Call

func (*CfxStateHandler) CheckBalanceAgainstTransaction

func (h *CfxStateHandler) CheckBalanceAgainstTransaction(
	ctx context.Context,
	cfx sdk.ClientOperator,
	accountAddress types.Address,
	contractAddress types.Address,
	gasLimit *hexutil.Big,
	gasPrice *hexutil.Big,
	storageLimit *hexutil.Big,
	epoch ...*types.Epoch,
) (types.CheckBalanceAgainstTransactionResponse, error)

func (*CfxStateHandler) DebugGetEpochReceiptProofByTransaction

func (h *CfxStateHandler) DebugGetEpochReceiptProofByTransaction(
	ctx context.Context,
	cfx sdk.ClientOperator,
	txHash types.Hash,
) (*types.EpochReceiptProof, error)

func (*CfxStateHandler) DebugGetTransactionsByBlock

func (h *CfxStateHandler) DebugGetTransactionsByBlock(
	ctx context.Context,
	cfx sdk.ClientOperator,
	blockHash types.Hash,
) ([]types.WrapTransaction, error)

func (*CfxStateHandler) DebugGetTransactionsByEpoch

func (h *CfxStateHandler) DebugGetTransactionsByEpoch(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch types.Epoch,
) ([]types.WrapTransaction, error)

func (*CfxStateHandler) EstimateGasAndCollateral

func (h *CfxStateHandler) EstimateGasAndCollateral(
	ctx context.Context,
	cfx sdk.ClientOperator,
	request types.CallRequest,
	epoch ...*types.Epoch,
) (types.Estimate, error)

func (*CfxStateHandler) GetAccountInfo

func (h *CfxStateHandler) GetAccountInfo(
	ctx context.Context,
	cfx sdk.ClientOperator,
	account types.Address,
	epoch ...*types.Epoch,
) (types.AccountInfo, error)

func (*CfxStateHandler) GetAccumulateInterestRate

func (h *CfxStateHandler) GetAccumulateInterestRate(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch ...*types.Epoch,
) (*hexutil.Big, error)

func (*CfxStateHandler) GetAdmin

func (h *CfxStateHandler) GetAdmin(
	ctx context.Context,
	cfx sdk.ClientOperator,
	contractAddress types.Address,
	epoch ...*types.Epoch,
) (*types.Address, error)

func (*CfxStateHandler) GetBalance

func (h *CfxStateHandler) GetBalance(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	epoch ...*types.EpochOrBlockHash,
) (*hexutil.Big, error)

func (*CfxStateHandler) GetCode

func (h *CfxStateHandler) GetCode(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	epoch ...*types.EpochOrBlockHash,
) (hexutil.Bytes, error)

func (*CfxStateHandler) GetCollateralForStorage

func (h *CfxStateHandler) GetCollateralForStorage(
	ctx context.Context,
	cfx sdk.ClientOperator,
	account types.Address,
	epoch ...*types.Epoch,
) (*hexutil.Big, error)

func (*CfxStateHandler) GetCollateralInfo

func (h *CfxStateHandler) GetCollateralInfo(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch ...*types.Epoch,
) (types.StorageCollateralInfo, error)

func (*CfxStateHandler) GetDepositList

func (h *CfxStateHandler) GetDepositList(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	epoch ...*types.Epoch,
) ([]types.DepositInfo, error)

func (*CfxStateHandler) GetInterestRate

func (h *CfxStateHandler) GetInterestRate(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch ...*types.Epoch,
) (*hexutil.Big, error)

func (*CfxStateHandler) GetNextNonce

func (h *CfxStateHandler) GetNextNonce(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	epoch ...*types.EpochOrBlockHash,
) (*hexutil.Big, error)

func (*CfxStateHandler) GetParamsFromVote

func (h *CfxStateHandler) GetParamsFromVote(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch ...*types.Epoch,
) (postypes.VoteParamsInfo, error)

func (*CfxStateHandler) GetPoSEconomics

func (h *CfxStateHandler) GetPoSEconomics(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch ...*types.Epoch,
) (types.PoSEconomics, error)

func (*CfxStateHandler) GetSponsorInfo

func (h *CfxStateHandler) GetSponsorInfo(
	ctx context.Context,
	cfx sdk.ClientOperator,
	contractAddress types.Address,
	epoch ...*types.Epoch,
) (sponsor types.SponsorInfo, err error)

func (*CfxStateHandler) GetStakingBalance

func (h *CfxStateHandler) GetStakingBalance(
	ctx context.Context,
	cfx sdk.ClientOperator,
	account types.Address,
	epoch ...*types.Epoch,
) (*hexutil.Big, error)

func (*CfxStateHandler) GetStorageAt

func (h *CfxStateHandler) GetStorageAt(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	position *hexutil.Big,
	epoch ...*types.EpochOrBlockHash,
) (hexutil.Bytes, error)

func (*CfxStateHandler) GetStorageRoot

func (h *CfxStateHandler) GetStorageRoot(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	epoch ...*types.Epoch,
) (*types.StorageRoot, error)

func (*CfxStateHandler) GetSupplyInfo

func (h *CfxStateHandler) GetSupplyInfo(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch ...*types.Epoch,
) (types.TokenSupplyInfo, error)

func (*CfxStateHandler) GetVoteList

func (h *CfxStateHandler) GetVoteList(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address types.Address,
	epoch ...*types.Epoch,
) ([]types.VoteStakeInfo, error)

func (*CfxStateHandler) PosGetAccount

func (h *CfxStateHandler) PosGetAccount(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address postypes.Address,
	view ...hexutil.Uint64,
) (postypes.Account, error)

func (*CfxStateHandler) PosGetAccountByPowAddress

func (h *CfxStateHandler) PosGetAccountByPowAddress(
	ctx context.Context,
	cfx sdk.ClientOperator,
	address cfxaddress.Address,
	blockNumber ...hexutil.Uint64,
) (postypes.Account, error)

func (*CfxStateHandler) PosGetCommittee

func (h *CfxStateHandler) PosGetCommittee(
	ctx context.Context,
	cfx sdk.ClientOperator,
	view ...hexutil.Uint64,
) (postypes.CommitteeState, error)

func (*CfxStateHandler) PosGetEpochState

func (h *CfxStateHandler) PosGetEpochState(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epochNumber hexutil.Uint64,
) (*postypes.EpochState, error)

func (*CfxStateHandler) PosGetLedgerInfoByBlockNumber

func (h *CfxStateHandler) PosGetLedgerInfoByBlockNumber(
	ctx context.Context,
	cfx sdk.ClientOperator,
	blockNumber postypes.BlockNumber,
) (*postypes.LedgerInfoWithSignatures, error)

func (*CfxStateHandler) PosGetLedgerInfoByEpoch

func (h *CfxStateHandler) PosGetLedgerInfoByEpoch(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epochNumber hexutil.Uint64,
) (*postypes.LedgerInfoWithSignatures, error)

func (*CfxStateHandler) PosGetLedgerInfoByEpochAndRound

func (h *CfxStateHandler) PosGetLedgerInfoByEpochAndRound(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epochNumber hexutil.Uint64,
	round hexutil.Uint64,
) (*postypes.LedgerInfoWithSignatures, error)

func (*CfxStateHandler) PosGetLedgerInfosByEpoch

func (h *CfxStateHandler) PosGetLedgerInfosByEpoch(
	ctx context.Context,
	cfx sdk.ClientOperator,
	startEpoch hexutil.Uint64,
	endEpoch hexutil.Uint64,
) ([]*postypes.LedgerInfoWithSignatures, error)

func (*CfxStateHandler) PosGetRewardsByEpoch

func (h *CfxStateHandler) PosGetRewardsByEpoch(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epochNumber hexutil.Uint64,
) (postypes.EpochReward, error)

func (*CfxStateHandler) TraceBlock

func (h *CfxStateHandler) TraceBlock(
	ctx context.Context,
	cfx sdk.ClientOperator,
	blockHash types.Hash,
) (*types.LocalizedBlockTrace, error)

func (*CfxStateHandler) TraceEpoch

func (h *CfxStateHandler) TraceEpoch(
	ctx context.Context,
	cfx sdk.ClientOperator,
	epoch types.Epoch,
) (types.EpochTrace, error)

func (*CfxStateHandler) TraceFilter

func (h *CfxStateHandler) TraceFilter(
	ctx context.Context,
	cfx sdk.ClientOperator,
	filter types.TraceFilter,
) ([]types.LocalizedTrace, error)

func (*CfxStateHandler) TraceTransaction

func (h *CfxStateHandler) TraceTransaction(
	ctx context.Context,
	cfx sdk.ClientOperator,
	txHash types.Hash,
) ([]types.LocalizedTrace, error)

type CfxStoreHandler

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

CfxStoreHandler RPC handler to get block/txn/receipt data from store.

func NewCfxStoreHandler

func NewCfxStoreHandler(sname string, store *mysql.CfxStore) *CfxStoreHandler

func (*CfxStoreHandler) GetBlockByBlockNumber

func (h *CfxStoreHandler) GetBlockByBlockNumber(
	ctx context.Context, blockNumer hexutil.Uint64, includeTxs bool,
) (block interface{}, err error)

func (*CfxStoreHandler) GetBlockByEpochNumber

func (h *CfxStoreHandler) GetBlockByEpochNumber(
	ctx context.Context, epoch *types.Epoch, includeTxs bool,
) (block interface{}, err error)

func (*CfxStoreHandler) GetBlockByHash

func (h *CfxStoreHandler) GetBlockByHash(
	ctx context.Context, blockHash types.Hash, includeTxs bool,
) (block interface{}, err error)

func (*CfxStoreHandler) GetBlocksByEpoch

func (h *CfxStoreHandler) GetBlocksByEpoch(ctx context.Context, epoch *types.Epoch) ([]types.Hash, error)

func (*CfxStoreHandler) GetTransactionByHash

func (h *CfxStoreHandler) GetTransactionByHash(ctx context.Context, txHash types.Hash) (*types.Transaction, error)

func (*CfxStoreHandler) GetTransactionReceipt

func (h *CfxStoreHandler) GetTransactionReceipt(ctx context.Context, txHash types.Hash) (*types.TransactionReceipt, error)

type CfxTxnHandler

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

CfxTxnHandler RPC handler to optimize sending transaction by relaying txn broadcasting asynchronously and replicating txn sending synchronously to all full nodes of some node group to improve consistency and availability once consistent hashing LB repartitioned.

func MustNewCfxTxnHandler

func MustNewCfxTxnHandler(relayer relay.TxnRelayer) *CfxTxnHandler

func (*CfxTxnHandler) SendRawTxn

func (h *CfxTxnHandler) SendRawTxn(cfx sdk.ClientOperator, group node.Group, signedTx hexutil.Bytes) (types.Hash, error)

type EthGasStationHandler

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

EthGasStationHandler handles RPC requests for gas price estimation.

func MustNewEthGasStationHandlerFromViper

func MustNewEthGasStationHandlerFromViper(cp *node.EthClientProvider) *EthGasStationHandler

func (*EthGasStationHandler) Suggest

type EthLogsApiHandler

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

EthLogsApiHandler RPC handler to get evm space event logs from store or fullnode.

func NewEthLogsApiHandler

func NewEthLogsApiHandler(es *mysql.EthStore, maxAttempts int) *EthLogsApiHandler

func (*EthLogsApiHandler) GetLogs

func (handler *EthLogsApiHandler) GetLogs(
	ctx context.Context,
	eth *client.RpcEthClient,
	filter *types.FilterQuery,
	delegatedRpcMethod string,
) ([]types.Log, bool, error)

func (*EthLogsApiHandler) RequiresBoundChecks

func (handler *EthLogsApiHandler) RequiresBoundChecks(filter *types.FilterQuery) bool

RequiresBoundChecks determines if bound checks should be applied based on if there is any space to narrow down the log filter

func (*EthLogsApiHandler) ScanLogs

func (handler *EthLogsApiHandler) ScanLogs(
	ctx context.Context,
	eth ethScanClient,
	req EthScanLogParams,
	assumption *EthPivotAssumption,
) (result *EthScanLogResult, err error)

ScanLogs executes an eSpace scan over an already frozen numeric request. It uses the same two-level protocol as Core:

outer: v0 -> DB coverage/assumption/cache -> v1
inner: blockHash(H) before -> FN dependencies/boundary -> blockHash(H) after

FN checkpoint changes rebuild only the inner candidate; DB version changes rebuild the generation and invalidate its cache. Success and canonical errors share the same commit gate.

type EthPivotAssumption

type EthPivotAssumption struct {
	BlockNumber hexutil.Uint64 `json:"blockNumber"`
	BlockHash   common.Hash    `json:"blockHash"`
}

EthPivotAssumption identifies one canonical eSpace block and doubles as the output guard shape.

func (*EthPivotAssumption) UnmarshalJSON

func (a *EthPivotAssumption) UnmarshalJSON(data []byte) error

type EthPivotGuard

type EthPivotGuard EthPivotAssumption

type EthScanLogFilter

type EthScanLogFilter struct {
	FromBlock *web3types.BlockNumber `json:"fromBlock,omitempty"`
	ToBlock   *web3types.BlockNumber `json:"toBlock,omitempty"`
	Address   *common.Address        `json:"address,omitempty"`
	Topic0    *common.Hash           `json:"topic0,omitempty"`
}

func (*EthScanLogFilter) UnmarshalJSON

func (f *EthScanLogFilter) UnmarshalJSON(data []byte) error

type EthScanLogParams

type EthScanLogParams struct {
	*EthScanLogRequest
	BlockRange          types.RangeUint64
	WithPivotAssumption bool
}

func NormalizeEthScanLogRequest

func NormalizeEthScanLogRequest(
	resolver ethBlockNumberResolver,
	hardfork web3types.BlockNumber,
	req EthScanLogRequest,
	withPivotAssumption bool,
) (params EthScanLogParams, err error)

type EthScanLogRequest

type EthScanLogRequest struct {
	Filter  EthScanLogFilter `json:"filter"`
	Limit   uint64           `json:"limit"`
	Cursor  *ScanLogCursor   `json:"cursor,omitempty"`
	Reverse bool             `json:"reverse,omitempty"`
}

func (EthScanLogRequest) ContractAddress

func (r EthScanLogRequest) ContractAddress() (string, bool)

func (*EthScanLogRequest) UnmarshalJSON

func (r *EthScanLogRequest) UnmarshalJSON(data []byte) error

type EthScanLogResult

type EthScanLogResult struct {
	Logs       []web3types.Log `json:"logs"`
	NextCursor *ScanLogCursor  `json:"nextCursor,omitempty"`
	PivotGuard *EthPivotGuard  `json:"pivotGuard,omitempty"`
	// contains filtered or unexported fields
}

EthScanLogResult keeps native web3go logs. The unexported usage field tracks the internal canonical read-set and is never serialized in the RPC response.

type EthStateHandler

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

EthStateHandler handles evm space state RPC method by redirecting requests to another full state node if state is not available on normal full node.

func NewEthStateHandler

func NewEthStateHandler(cp *node.EthClientProvider) *EthStateHandler

func (*EthStateHandler) Balance

func (h *EthStateHandler) Balance(
	ctx context.Context,
	w3c *node.Web3goClient,
	addr common.Address,
	block *types.BlockNumberOrHash,
) (*big.Int, error)

func (*EthStateHandler) Call

func (h *EthStateHandler) Call(
	ctx context.Context,
	w3c *node.Web3goClient,
	callRequest types.CallRequest,
	blockNum *types.BlockNumberOrHash,
	overrides *types.StateOverride,
	blockOverrides *types.BlockOverrides,
) ([]byte, error)

func (*EthStateHandler) CodeAt

func (h *EthStateHandler) CodeAt(
	ctx context.Context,
	w3c *node.Web3goClient,
	addr common.Address,
	blockNum *types.BlockNumberOrHash,
) ([]byte, error)

func (*EthStateHandler) CreateAccessList

func (h *EthStateHandler) CreateAccessList(
	ctx context.Context,
	w3c *node.Web3goClient,
	callRequest types.CallRequest,
	blockNum *types.BlockNumberOrHash,
	overrides *types.StateOverride,
) (*types.CreateAccessListResult, error)

func (*EthStateHandler) DebugTraceBlockByHash

func (h *EthStateHandler) DebugTraceBlockByHash(
	ctx context.Context,
	w3c *node.Web3goClient,
	blockHash common.Hash,
	opts ...*types.GethDebugTracingOptions,
) ([]*types.GethTraceResult, error)

func (*EthStateHandler) DebugTraceBlockByNumber

func (h *EthStateHandler) DebugTraceBlockByNumber(
	ctx context.Context,
	w3c *node.Web3goClient,
	blockNumber types.BlockNumber,
	opts ...*types.GethDebugTracingOptions,
) ([]*types.GethTraceResult, error)

func (*EthStateHandler) DebugTraceCall

func (h *EthStateHandler) DebugTraceCall(
	ctx context.Context,
	w3c *node.Web3goClient,
	request types.CallRequest,
	blockNumber *types.BlockNumber,
	opts ...*types.GethDebugTracingOptions,
) (*types.GethTrace, error)

func (*EthStateHandler) DebugTraceTransaction

func (h *EthStateHandler) DebugTraceTransaction(
	ctx context.Context,
	w3c *node.Web3goClient,
	txnHash common.Hash,
	opts ...*types.GethDebugTracingOptions,
) (*types.GethTrace, error)

func (*EthStateHandler) EstimateGas

func (h *EthStateHandler) EstimateGas(
	ctx context.Context,
	w3c *node.Web3goClient,
	callRequest types.CallRequest,
	blockNum *types.BlockNumberOrHash,
	overrides *types.StateOverride,
	blockOverrides *types.BlockOverrides,
) (*big.Int, error)

func (*EthStateHandler) LazyTrace

func (h *EthStateHandler) LazyTrace(
	ctx context.Context,
	w3c *node.Web3goClient,
	txHash common.Hash,
	indexes []uint,
) (cacheTypes.Lazy[*types.LocalizedTrace], error)

func (*EthStateHandler) LazyTraceBlock

func (h *EthStateHandler) LazyTraceBlock(
	ctx context.Context,
	w3c *node.Web3goClient,
	blockNumOrHash types.BlockNumberOrHash,
) (res cacheTypes.Lazy[[]types.LocalizedTrace], err error)

func (*EthStateHandler) LazyTraceTransaction

func (h *EthStateHandler) LazyTraceTransaction(
	ctx context.Context,
	w3c *node.Web3goClient,
	txHash common.Hash,
) (res cacheTypes.Lazy[[]types.LocalizedTrace], err error)

func (*EthStateHandler) StorageAt

func (h *EthStateHandler) StorageAt(
	ctx context.Context,
	w3c *node.Web3goClient,
	addr common.Address,
	location *big.Int,
	block *types.BlockNumberOrHash,
) (common.Hash, error)

func (*EthStateHandler) TraceBlock

func (h *EthStateHandler) TraceBlock(
	ctx context.Context,
	w3c *node.Web3goClient,
	blockNumOrHash types.BlockNumberOrHash,
) ([]types.LocalizedTrace, error)

func (*EthStateHandler) TraceBlockSetAuth

func (h *EthStateHandler) TraceBlockSetAuth(
	ctx context.Context,
	w3c *node.Web3goClient,
	blockNumber types.BlockNumberOrHash,
) ([]types.LocalizedSetAuthTrace, error)

func (*EthStateHandler) TraceCall

func (h *EthStateHandler) TraceCall(
	ctx context.Context,
	w3c *node.Web3goClient,
	callRequest types.CallRequest,
	options types.TraceOptions,
	blockNum *types.BlockNumberOrHash,
) (types.TraceResults, error)

func (*EthStateHandler) TraceFilter

func (h *EthStateHandler) TraceFilter(
	ctx context.Context,
	w3c *node.Web3goClient,
	filter types.TraceFilter,
) ([]types.LocalizedTrace, error)

func (*EthStateHandler) TraceTransaction

func (h *EthStateHandler) TraceTransaction(
	ctx context.Context,
	w3c *node.Web3goClient,
	txHash common.Hash,
) ([]types.LocalizedTrace, error)

func (*EthStateHandler) TransactionCount

func (h *EthStateHandler) TransactionCount(
	ctx context.Context,
	w3c *node.Web3goClient,
	addr common.Address,
	blockNum *types.BlockNumberOrHash,
) (*big.Int, error)

type EthStoreHandler

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

EthStoreHandler RPC handler to get block/txn/receipt data from store.

func NewEthStoreHandler

func NewEthStoreHandler(store *mysql.EthStore) *EthStoreHandler

func (*EthStoreHandler) GetBlockByHash

func (h *EthStoreHandler) GetBlockByHash(
	ctx context.Context, blockHash common.Hash, includeTxs bool,
) (*web3Types.Block, error)

func (*EthStoreHandler) GetBlockByNumber

func (h *EthStoreHandler) GetBlockByNumber(
	ctx context.Context, blockNum web3Types.BlockNumber, includeTxs bool,
) (*web3Types.Block, error)

func (*EthStoreHandler) GetLogs

func (h *EthStoreHandler) GetLogs(ctx context.Context, filter store.LogFilter) (logs []web3Types.Log, err error)

func (*EthStoreHandler) GetTransactionByHash

func (h *EthStoreHandler) GetTransactionByHash(ctx context.Context, txHash common.Hash) (*web3Types.TransactionDetail, error)

func (*EthStoreHandler) GetTransactionReceipt

func (h *EthStoreHandler) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*web3Types.Receipt, error)

type EthTxnHandler

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

EthTxnHandler evm space RPC handler to optimize sending transaction by relay and replication.

func MustNewEthTxnHandler

func MustNewEthTxnHandler(relayer relay.TxnRelayer) *EthTxnHandler

func (*EthTxnHandler) SendRawTxn

func (h *EthTxnHandler) SendRawTxn(w3c *node.Web3goClient, group node.Group, signedTx hexutil.Bytes) (common.Hash, error)

type GasStationConfig

type GasStationConfig struct {
	// Whether to enable gas station.
	Enabled bool
	// Number of blocks/epochs to peek for gas price estimation.
	HistoricalPeekCount int `default:"100"`
	// Percentiles for average txn gas price mapped to three levels of urgency (`low`, `medium` and `high`).
	Percentiles [3]float64 `default:"[1, 50, 99]"`
}

type GasStationStatus

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

GasStationStatus represents the status of gas station.

var (
	StationStatusOk                GasStationStatus = GasStationStatus{}
	StationStatusClientUnavailable GasStationStatus = GasStationStatus{node.ErrClientUnavailable}
)

type GasStats

type GasStats struct {
	NetworkCongestion          float64           // Current congestion on the network (0 to 1)
	LatestPriorityFeeRange     []*big.Int        // Range of priority fees for recent transactions
	HistoricalPriorityFeeRange []*big.Int        // Range of priority fees over a historical period
	HistoricalBaseFeeRange     []*big.Int        // Range of base fees over a historical period
	AvgPercentiledPriorityFee  []*big.Int        // Average priority fee per gas by given percentiles
	PriorityFeeTrend           types.GasFeeTrend // Current trend in priority fees
	BaseFeeTrend               types.GasFeeTrend // Current trend in base fees
}

type PriorityFeeWindow

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

PriorityFeeWindow holds priority fees of the latest blocks using a sliding window mechanism.

func NewPriorityFeeWindow

func NewPriorityFeeWindow(capacity int) *PriorityFeeWindow

NewPriorityFeeWindow creates a new `PriorityFeeWindow` with the specified capacity.

func (*PriorityFeeWindow) Calculate

func (w *PriorityFeeWindow) Calculate(percentiles []float64) (stats GasStats)

Calculate calculates the gas fee statistics from the data within the window.

func (*PriorityFeeWindow) Push

func (w *PriorityFeeWindow) Push(blockFee *BlockPriorityFee)

Push adds a new block to the window.

func (*PriorityFeeWindow) Remove

func (w *PriorityFeeWindow) Remove(blockHashes ...string)

Remove removes blocks from the window.

func (*PriorityFeeWindow) Size

func (w *PriorityFeeWindow) Size() int

Size returns the number of blocks in the window.

type ScanLogCursor

type ScanLogCursor struct {
	BlockNumber hexutil.Uint64 `json:"blockNumber"`
	LogIndex    hexutil.Uint64 `json:"logIndex"`
}

ScanLogCursor is the public exclusive keyset cursor shared by Core space and eSpace. Store has the same logical key in its own package; conversion happens only at the Handler -> Store boundary so the public JSON type does not leak into storage APIs and the storage type does not leak into RPC parameters.

func (*ScanLogCursor) UnmarshalJSON

func (cursor *ScanLogCursor) UnmarshalJSON(data []byte) error

type TxnPriorityFee

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

TxnPriorityFee holds the priority fee information of a single transaction.

Jump to

Keyboard shortcuts

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