commands

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 97 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CALL               = "call"
	CALLCODE           = "callcode"
	DELEGATECALL       = "delegatecall"
	STATICCALL         = "staticcall"
	CREATE             = "create"
	SUICIDE            = "suicide"
	REWARD             = "reward"
	TraceTypeTrace     = "trace"
	TraceTypeStateDiff = "stateDiff"
	TraceTypeVmTrace   = "vmTrace"
)
View Source
const (
	// Default mode for TraceFilter. Unions results referred to addresses from FromAddress or ToAddress
	TraceFilterModeUnion = "union"
	// IntersectionMode retrives results referred to addresses provided both in FromAddress and ToAddress
	TraceFilterModeIntersection = "intersection"
)
View Source
const (
	MaxTotalVotingPower      = int64(math.MaxInt64) / 8
	PriorityWindowSizeFactor = 2
)
View Source
const API_LEVEL = 8

API_LEVEL Must be incremented every time new additions are made

View Source
const AccountRangeMaxResults = 256

AccountRangeMaxResults is the maximum number of results to be returned per call

View Source
const MaxBlockNum = ^uint64(0)
View Source
const NotAvailableChainData = "the function %s is not available, please use --private.api.addr option instead of --datadir option"

NotAvailableChainData x

View Source
const NotAvailableDeprecated = "the method has been deprecated: %s"

NotAvailableDeprecated x

View Source
const NotImplemented = "the method is currently not implemented: %s"

NotImplemented is the URI prefix for smartcard wallets.

Variables

View Source
var ErrWrongTag = fmt.Errorf("listStorageKeys wrong block tag or number: must be '%s' ('latest')", latestTag)

Functions

func APIList

func APIList(db kv.RoDB, borDb kv.RoDB, eth rpchelper.ApiBackend, txPool txpool.TxpoolClient, mining txpool.MiningClient,
	filters *rpchelper.Filters, stateCache kvcache.Cache,
	blockReader services.FullBlockReader, agg *libstate.AggregatorV3, cfg httpcfg.HttpCfg, engine consensus.EngineReader,
	l2RpcUrl string,
) (list []rpc.API)

APIList describes the list of available RPC apis

func AuthAPIList

func AuthAPIList(db kv.RoDB, eth rpchelper.ApiBackend, txPool txpool.TxpoolClient, mining txpool.MiningClient,
	filters *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader,
	agg *libstate.AggregatorV3,
	cfg httpcfg.HttpCfg, engine consensus.EngineReader,
) (list []rpc.API)

func IsErrTooMuchChange

func IsErrTooMuchChange(err error) bool

Types

type APIImpl

type APIImpl struct {
	*BaseAPI

	GasCap          uint64
	ReturnDataLimit int
	ZkRpcUrl        string
	// contains filtered or unexported fields
}

APIImpl is implementation of the EthAPI interface based on remote Db access

func NewEthAPI

func NewEthAPI(base *BaseAPI, db kv.RoDB, eth rpchelper.ApiBackend, txPool txpool.TxpoolClient, mining txpool.MiningClient, gascap uint64, returnDataLimit int, zkRpcUrl string) *APIImpl

NewEthAPI returns APIImpl instance

func (*APIImpl) Accounts

func (api *APIImpl) Accounts(ctx context.Context) ([]common.Address, error)

Accounts implements eth_accounts. Returns a list of addresses owned by the client. Deprecated: This function will be removed in the future.

func (*APIImpl) BlockNumber

func (api *APIImpl) BlockNumber(ctx context.Context) (hexutil.Uint64, error)

BlockNumber implements eth_blockNumber. Returns the block number of most recent block.

func (*APIImpl) Call

func (api *APIImpl) Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi2.StateOverrides) (hexutility.Bytes, error)

Call implements eth_call. Executes a new message call immediately without creating a transaction on the block chain.

func (*APIImpl) CallBundle

func (api *APIImpl) CallBundle(ctx context.Context, txHashes []common.Hash, stateBlockNumberOrHash rpc.BlockNumberOrHash, timeoutMilliSecondsPtr *int64) (map[string]interface{}, error)

func (*APIImpl) CallMany

func (api *APIImpl) CallMany(ctx context.Context, bundles []Bundle, simulateContext StateContext, stateOverride *ethapi.StateOverrides, timeoutMilliSecondsPtr *int64) ([][]map[string]interface{}, error)

func (*APIImpl) ChainID

func (api *APIImpl) ChainID(ctx context.Context) (hexutil.Uint64, error)

ChainID alias of ChainId - just for convenience

func (*APIImpl) ChainId

func (api *APIImpl) ChainId(ctx context.Context) (hexutil.Uint64, error)

ChainId implements eth_chainId. Returns the current ethereum chainId.

func (*APIImpl) Coinbase

func (api *APIImpl) Coinbase(ctx context.Context) (libcommon.Address, error)

Coinbase implements eth_coinbase. Returns the current client coinbase address.

func (*APIImpl) CreateAccessList

func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash, optimizeGas *bool) (*accessListResult, error)

CreateAccessList implements eth_createAccessList. It creates an access list for the given transaction. If the accesslist creation fails an error is returned. If the transaction itself fails, an vmErr is returned.

func (*APIImpl) EstimateGas

func (api *APIImpl) EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)

EstimateGas implements eth_estimateGas. Returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain.

func (*APIImpl) Exist

func (api *APIImpl) Exist(ctx context.Context, address libcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (bool, error)

Exist returns whether an account for a given address exists in the database.

func (*APIImpl) FeeHistory

func (api *APIImpl) FeeHistory(ctx context.Context, blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error)

func (*APIImpl) GasPrice

func (api *APIImpl) GasPrice(ctx context.Context) (*hexutil.Big, error)

GasPrice implements eth_gasPrice. Returns the current price per gas in wei.

func (*APIImpl) GetBalance

func (api *APIImpl) GetBalance(ctx context.Context, address libcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)

GetBalance implements eth_getBalance. Returns the balance of an account for a given address.

func (*APIImpl) GetBlockByHash

func (api *APIImpl) GetBlockByHash(ctx context.Context, numberOrHash rpc.BlockNumberOrHash, fullTx bool) (map[string]interface{}, error)

GetBlockByHash implements eth_getBlockByHash. Returns information about a block given the block's hash.

func (*APIImpl) GetBlockByNumber

func (api *APIImpl) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)

GetBlockByNumber implements eth_getBlockByNumber. Returns information about a block given the block's number.

func (*APIImpl) GetBlockReceipts

func (api *APIImpl) GetBlockReceipts(ctx context.Context, number rpc.BlockNumber) ([]map[string]interface{}, error)

GetBlockReceipts - receipts for individual block func (api *APIImpl) GetBlockReceipts(ctx context.Context, number rpc.BlockNumber) ([]map[string]interface{}, error) {

func (*APIImpl) GetBlockTransactionCountByHash

func (api *APIImpl) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) (*hexutil.Uint, error)

GetBlockTransactionCountByHash implements eth_getBlockTransactionCountByHash. Returns the number of transactions in a block given the block's block hash.

func (*APIImpl) GetBlockTransactionCountByNumber

func (api *APIImpl) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*hexutil.Uint, error)

GetBlockTransactionCountByNumber implements eth_getBlockTransactionCountByNumber. Returns the number of transactions in a block given the block's block number.

func (*APIImpl) GetCode

func (api *APIImpl) GetCode(ctx context.Context, address libcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutility.Bytes, error)

GetCode implements eth_getCode. Returns the byte code at a given address (if it's a smart contract).

func (*APIImpl) GetFilterChanges

func (api *APIImpl) GetFilterChanges(_ context.Context, index string) ([]any, error)

GetFilterChanges implements eth_getFilterChanges. Polling method for a previously-created filter returns an array of logs, block headers, or pending transactions which occurred since last poll.

func (*APIImpl) GetFilterLogs

func (api *APIImpl) GetFilterLogs(_ context.Context, index string) ([]*types.Log, error)

GetFilterLogs implements eth_getFilterLogs. Polling method for a previously-created filter returns an array of logs which occurred since last poll.

func (*APIImpl) GetLogs

func (api *APIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria) (types.Logs, error)

GetLogs implements eth_getLogs. Returns an array of logs matching a given filter object.

func (*APIImpl) GetProof

func (api *APIImpl) GetProof(ctx context.Context, address libcommon.Address, storageKeys []libcommon.Hash, blockNrOrHash rpc.BlockNumberOrHash) (*accounts.AccProofResult, error)

GetProof is partially implemented; no Storage proofs, and proofs must be for blocks within maxGetProofRewindBlockCount blocks of the head.

func (*APIImpl) GetRawTransactionByBlockHashAndIndex

func (api *APIImpl) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (hexutility.Bytes, error)

GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.

func (*APIImpl) GetRawTransactionByBlockNumberAndIndex

func (api *APIImpl) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (hexutility.Bytes, error)

GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.

func (*APIImpl) GetRawTransactionByHash

func (api *APIImpl) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutility.Bytes, error)

GetRawTransactionByHash returns the bytes of the transaction for the given hash.

func (*APIImpl) GetStorageAt

func (api *APIImpl) GetStorageAt(ctx context.Context, address libcommon.Address, index string, blockNrOrHash rpc.BlockNumberOrHash) (string, error)

GetStorageAt implements eth_getStorageAt. Returns the value from a storage position at a given address.

func (*APIImpl) GetTransactionByBlockHashAndIndex

func (api *APIImpl) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, txIndex hexutil.Uint64) (*RPCTransaction, error)

GetTransactionByBlockHashAndIndex implements eth_getTransactionByBlockHashAndIndex. Returns information about a transaction given the block's hash and a transaction index.

func (*APIImpl) GetTransactionByBlockNumberAndIndex

func (api *APIImpl) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, txIndex hexutil.Uint) (*RPCTransaction, error)

GetTransactionByBlockNumberAndIndex implements eth_getTransactionByBlockNumberAndIndex. Returns information about a transaction given a block number and transaction index.

func (*APIImpl) GetTransactionByHash

func (api *APIImpl) GetTransactionByHash(ctx context.Context, txnHash common.Hash) (*RPCTransaction, error)

GetTransactionByHash implements eth_getTransactionByHash. Returns information about a transaction given the transaction's hash.

func (*APIImpl) GetTransactionCount

func (api *APIImpl) GetTransactionCount(ctx context.Context, address libcommon.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)

GetTransactionCount implements eth_getTransactionCount. Returns the number of transactions sent from an address (the nonce).

func (*APIImpl) GetTransactionReceipt

func (api *APIImpl) GetTransactionReceipt(ctx context.Context, txnHash common.Hash) (map[string]interface{}, error)

GetTransactionReceipt implements eth_getTransactionReceipt. Returns the receipt of a transaction given the transaction's hash.

func (*APIImpl) GetUncleByBlockHashAndIndex

func (api *APIImpl) GetUncleByBlockHashAndIndex(ctx context.Context, hash common.Hash, index hexutil.Uint) (map[string]interface{}, error)

GetUncleByBlockHashAndIndex implements eth_getUncleByBlockHashAndIndex. Returns information about an uncle given a block's hash and the index of the uncle.

func (*APIImpl) GetUncleByBlockNumberAndIndex

func (api *APIImpl) GetUncleByBlockNumberAndIndex(ctx context.Context, number rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)

GetUncleByBlockNumberAndIndex implements eth_getUncleByBlockNumberAndIndex. Returns information about an uncle given a block's number and the index of the uncle.

func (*APIImpl) GetUncleCountByBlockHash

func (api *APIImpl) GetUncleCountByBlockHash(ctx context.Context, hash common.Hash) (*hexutil.Uint, error)

GetUncleCountByBlockHash implements eth_getUncleCountByBlockHash. Returns the number of uncles in the block, if any.

func (*APIImpl) GetUncleCountByBlockNumber

func (api *APIImpl) GetUncleCountByBlockNumber(ctx context.Context, number rpc.BlockNumber) (*hexutil.Uint, error)

GetUncleCountByBlockNumber implements eth_getUncleCountByBlockNumber. Returns the number of uncles in the block, if any.

func (*APIImpl) GetWork

func (api *APIImpl) GetWork(ctx context.Context) ([4]string, error)

GetWork returns a work package for external miner.

The work package consists of 3 strings:

result[0] - 32 bytes hex encoded current block header pow-hash
result[1] - 32 bytes hex encoded seed hash used for DAG
result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty
result[3] - hex encoded block number

func (*APIImpl) Hashrate

func (api *APIImpl) Hashrate(ctx context.Context) (uint64, error)

Hashrate implements eth_hashrate. Returns the number of hashes per second that the node is mining with.

func (*APIImpl) Logs

Logs send a notification each time a new log appears.

func (*APIImpl) MaxPriorityFeePerGas

func (api *APIImpl) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error)

MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic fee transactions.

func (*APIImpl) Mining

func (api *APIImpl) Mining(ctx context.Context) (bool, error)

Mining returns an indication if this node is currently mining.

func (*APIImpl) NewBlockFilter

func (api *APIImpl) NewBlockFilter(_ context.Context) (string, error)

NewBlockFilter implements eth_newBlockFilter. Creates a filter in the node, to notify when a new block arrives.

func (*APIImpl) NewFilter

func (api *APIImpl) NewFilter(_ context.Context, crit filters.FilterCriteria) (string, error)

NewFilter implements eth_newFilter. Creates an arbitrary filter object, based on filter options, to notify when the state changes (logs).

func (*APIImpl) NewHeads

func (api *APIImpl) NewHeads(ctx context.Context) (*rpc.Subscription, error)

NewHeads send a notification each time a new (header) block is appended to the chain.

func (*APIImpl) NewPendingTransactionFilter

func (api *APIImpl) NewPendingTransactionFilter(_ context.Context) (string, error)

NewPendingTransactionFilter new transaction filter

func (*APIImpl) NewPendingTransactions

func (api *APIImpl) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error)

NewPendingTransactions send a notification each time when a transaction had added into mempool.

func (*APIImpl) NewPendingTransactionsWithBody

func (api *APIImpl) NewPendingTransactionsWithBody(ctx context.Context) (*rpc.Subscription, error)

NewPendingTransactionsWithBody send a notification each time when a transaction had added into mempool.

func (*APIImpl) ProtocolVersion

func (api *APIImpl) ProtocolVersion(ctx context.Context) (hexutil.Uint, error)

ProtocolVersion implements eth_protocolVersion. Returns the current ethereum protocol version.

func (*APIImpl) SendRawTransaction

func (api *APIImpl) SendRawTransaction(ctx context.Context, encodedTx hexutility.Bytes) (common.Hash, error)

SendRawTransaction implements eth_sendRawTransaction. Creates new message call transaction or a contract creation for previously-signed transactions.

func (*APIImpl) SendTransaction

func (api *APIImpl) SendTransaction(_ context.Context, txObject interface{}) (common.Hash, error)

SendTransaction implements eth_sendTransaction. Creates new message call transaction or a contract creation if the data field contains code.

func (*APIImpl) Sign

Sign implements eth_sign. Calculates an Ethereum specific signature with: sign(keccak256('\\x19Ethereum Signed Message:\\n' + len(message) + message))). Deprecated: This function will be removed in the future.

func (*APIImpl) SignTransaction

func (api *APIImpl) SignTransaction(_ context.Context, txObject interface{}) (common.Hash, error)

SignTransaction deprecated

func (*APIImpl) SubmitHashrate

func (api *APIImpl) SubmitHashrate(ctx context.Context, hashRate hexutil.Uint64, id libcommon.Hash) (bool, error)

SubmitHashrate can be used for remote miners to submit their hash rate. This enables the node to report the combined hash rate of all miners which submit work through this node.

It accepts the miner hash rate and an identifier which must be unique

func (*APIImpl) SubmitWork

func (api *APIImpl) SubmitWork(ctx context.Context, nonce types.BlockNonce, powHash, digest libcommon.Hash) (bool, error)

SubmitWork can be used by external miner to submit their POW solution. It returns an indication if the work was accepted. Note either an invalid solution, a stale work a non-existent work will return false.

func (*APIImpl) Syncing

func (api *APIImpl) Syncing(ctx context.Context) (interface{}, error)

Syncing implements eth_syncing. Returns a data object detailing the status of the sync process or false if not syncing.

func (*APIImpl) UninstallFilter

func (api *APIImpl) UninstallFilter(_ context.Context, index string) (isDeleted bool, err error)

UninstallFilter new transaction filter

type AccountResult

type AccountResult struct {
	Balance  hexutil.Big      `json:"balance"`
	Nonce    hexutil.Uint64   `json:"nonce"`
	Code     hexutility.Bytes `json:"code"`
	CodeHash common.Hash      `json:"codeHash"`
}

type AdminAPI

type AdminAPI interface {
	// NodeInfo returns a collection of metadata known about the host.
	NodeInfo(ctx context.Context) (*p2p.NodeInfo, error)

	// Peers returns information about the connected remote nodes.
	// https://geth.ethereum.org/docs/rpc/ns-admin#admin_peers
	Peers(ctx context.Context) ([]*p2p.PeerInfo, error)
}

AdminAPI the interface for the admin_* RPC commands.

type AdminAPIImpl

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

AdminAPIImpl data structure to store things needed for admin_* commands.

func NewAdminAPI

func NewAdminAPI(eth rpchelper.ApiBackend) *AdminAPIImpl

NewAdminAPI returns AdminAPIImpl instance.

func (*AdminAPIImpl) NodeInfo

func (api *AdminAPIImpl) NodeInfo(ctx context.Context) (*p2p.NodeInfo, error)

func (*AdminAPIImpl) Peers

func (api *AdminAPIImpl) Peers(ctx context.Context) ([]*p2p.PeerInfo, error)

type BaseAPI

type BaseAPI struct {
	L2RpcUrl string
	// contains filtered or unexported fields
}

func NewBaseApi

func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader, agg *libstate.AggregatorV3, singleNodeMode bool, evmCallTimeout time.Duration, engine consensus.EngineReader, dirs datadir.Dirs, rpcUrl string) *BaseAPI

type BlockOverrides

type BlockOverrides struct {
	BlockNumber *hexutil.Uint64
	Coinbase    *common.Address
	Timestamp   *hexutil.Uint64
	GasLimit    *hexutil.Uint
	Difficulty  *hexutil.Uint
	BaseFee     *uint256.Int
	BlockHash   *map[uint64]common.Hash
}

type BlockProvider

type BlockProvider func() (nextBlock uint64, hasMore bool, err error)

func NewBackwardBlockProvider

func NewBackwardBlockProvider(chunkLocator ChunkLocator, maxBlock uint64) BlockProvider

Given a ChunkLocator, moves back over the chunks and inside each chunk, moves backwards over the block numbers.

func NewCallCursorBackwardBlockProvider

func NewCallCursorBackwardBlockProvider(cursor kv.Cursor, addr common.Address, maxBlock uint64) BlockProvider

func NewCallCursorForwardBlockProvider

func NewCallCursorForwardBlockProvider(cursor kv.Cursor, addr common.Address, minBlock uint64) BlockProvider

func NewForwardBlockProvider

func NewForwardBlockProvider(chunkLocator ChunkLocator, minBlock uint64) BlockProvider

Given a ChunkLocator, moves forward over the chunks and inside each chunk, moves forward over the block numbers.

type BorAPI

type BorAPI interface {
	// Bor snapshot related (see ./bor_snapshot.go)
	GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
	GetAuthor(number *rpc.BlockNumber) (*common.Address, error)
	GetSnapshotAtHash(hash common.Hash) (*Snapshot, error)
	GetSigners(number *rpc.BlockNumber) ([]common.Address, error)
	GetSignersAtHash(hash common.Hash) ([]common.Address, error)
	GetCurrentProposer() (common.Address, error)
	GetCurrentValidators() ([]*valset.Validator, error)
	GetRootHash(start uint64, end uint64) (string, error)
}

BorAPI Bor specific routines

type BorImpl

type BorImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

BorImpl is implementation of the BorAPI interface

func NewBorAPI

func NewBorAPI(base *BaseAPI, db kv.RoDB, borDb kv.RoDB) *BorImpl

NewBorAPI returns BorImpl instance

func (*BorImpl) GetAuthor

func (api *BorImpl) GetAuthor(number *rpc.BlockNumber) (*common.Address, error)

GetAuthor retrieves the author a block.

func (*BorImpl) GetCurrentProposer

func (api *BorImpl) GetCurrentProposer() (common.Address, error)

GetCurrentProposer gets the current proposer

func (*BorImpl) GetCurrentValidators

func (api *BorImpl) GetCurrentValidators() ([]*valset.Validator, error)

GetCurrentValidators gets the current validators

func (*BorImpl) GetRootHash

func (api *BorImpl) GetRootHash(start, end uint64) (string, error)

GetRootHash returns the merkle root of the start to end block headers

func (*BorImpl) GetSigners

func (api *BorImpl) GetSigners(number *rpc.BlockNumber) ([]common.Address, error)

GetSigners retrieves the list of authorized signers at the specified block.

func (*BorImpl) GetSignersAtHash

func (api *BorImpl) GetSignersAtHash(hash common.Hash) ([]common.Address, error)

GetSignersAtHash retrieves the list of authorized signers at the specified block.

func (*BorImpl) GetSnapshot

func (api *BorImpl) GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)

GetSnapshot retrieves the state snapshot at a given block.

func (*BorImpl) GetSnapshotAtHash

func (api *BorImpl) GetSnapshotAtHash(hash common.Hash) (*Snapshot, error)

GetSnapshotAtHash retrieves the state snapshot at a given block.

type Bundle

type Bundle struct {
	Transactions  []ethapi.CallArgs
	BlockOverride BlockOverrides
}

type CallTraceAction

type CallTraceAction struct {
	From     common.Address   `json:"from"`
	CallType string           `json:"callType"`
	Gas      hexutil.Big      `json:"gas"`
	Input    hexutility.Bytes `json:"input"`
	To       common.Address   `json:"to"`
	Value    hexutil.Big      `json:"value"`
}

type ChainTraffic

type ChainTraffic struct {
	CumulativeGasUsed           *hexutil.Big    `json:"cumulativeGasUsed"`
	CumulativeTransactionsCount *hexutil.Uint64 `json:"cumulativeTransactionsCount"`
}

type ChunkLocator

type ChunkLocator func(block uint64) (chunkProvider ChunkProvider, ok bool, err error)

Bootstrap a function able to locate a series of byte chunks containing related block numbers, starting from a specific block number (greater or equal than).

type ChunkProvider

type ChunkProvider func() (chunk []byte, ok bool, err error)

Allows to iterate over a set of byte chunks.

If err is not nil, it indicates an error and the other returned values should be ignored.

If err is nil and ok is true, the returned chunk should contain the raw chunk data.

If err is nil and ok is false, it indicates that there is no more data. Subsequent calls to the same function should return (nil, false, nil).

type ContractCreatorData

type ContractCreatorData struct {
	Tx      common.Hash    `json:"hash"`
	Creator common.Address `json:"creator"`
}

type CreateTraceAction

type CreateTraceAction struct {
	From  common.Address   `json:"from"`
	Gas   hexutil.Big      `json:"gas"`
	Init  hexutility.Bytes `json:"init"`
	Value hexutil.Big      `json:"value"`
}

type CreateTraceResult

type CreateTraceResult struct {
	// Do not change the ordering of these fields -- allows for easier comparison with other clients
	Address *common.Address  `json:"address,omitempty"`
	Code    hexutility.Bytes `json:"code"`
	GasUsed *hexutil.Big     `json:"gasUsed"`
}

type CreateTracer

type CreateTracer struct {
	DefaultTracer

	Creator common.Address
	Tx      types.Transaction
	// contains filtered or unexported fields
}

func NewCreateTracer

func NewCreateTracer(ctx context.Context, target common.Address) *CreateTracer

func (*CreateTracer) CaptureEnter

func (t *CreateTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*CreateTracer) CaptureStart

func (t *CreateTracer) CaptureStart(env vm.VMInterface, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*CreateTracer) Found

func (t *CreateTracer) Found() bool

func (*CreateTracer) SetTransaction

func (t *CreateTracer) SetTransaction(tx types.Transaction)

type DBAPI

type DBAPI interface {
	GetString(_ context.Context, _ string, _ string) (string, error)
	PutString(_ context.Context, _ string, _ string, _ string) (bool, error)
	GetHex(_ context.Context, _ string, _ string) (hexutility.Bytes, error)
	PutHex(_ context.Context, _ string, _ string, _ hexutility.Bytes) (bool, error)
}

DBAPI the interface for the db_ RPC commands (deprecated)

type DBAPIImpl

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

DBAPIImpl data structure to store things needed for db_ commands

func NewDBAPIImpl

func NewDBAPIImpl() *DBAPIImpl

NewDBAPIImpl returns NetAPIImplImpl instance

func (*DBAPIImpl) GetHex

func (api *DBAPIImpl) GetHex(_ context.Context, _ string, _ string) (hexutility.Bytes, error)

GetHex implements db_getHex. Returns binary data from the local database. Deprecated: This function will be removed in the future.

func (*DBAPIImpl) GetString

func (api *DBAPIImpl) GetString(_ context.Context, _ string, _ string) (string, error)

GetString implements db_getString. Returns string from the local database. Deprecated: This function will be removed in the future.

func (*DBAPIImpl) PutHex

func (api *DBAPIImpl) PutHex(_ context.Context, _ string, _ string, _ hexutility.Bytes) (bool, error)

PutHex implements db_putHex. Stores binary data in the local database. Deprecated: This function will be removed in the future.

func (*DBAPIImpl) PutString

func (api *DBAPIImpl) PutString(_ context.Context, _ string, _ string, _ string) (bool, error)

PutString implements db_putString. Stores a string in the local database. Deprecated: This function will be removed in the future.

type DefaultTracer

type DefaultTracer struct {
}

Helper implementation of vm.Tracer; since the interface is big and most custom tracers implement just a few of the methods, this is a base struct to avoid lots of empty boilerplate code

func (*DefaultTracer) CaptureEnd

func (t *DefaultTracer) CaptureEnd(output []byte, usedGas uint64, err error)

func (*DefaultTracer) CaptureEnter

func (t *DefaultTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*DefaultTracer) CaptureExit

func (t *DefaultTracer) CaptureExit(output []byte, usedGas uint64, err error)

func (*DefaultTracer) CaptureFault

func (t *DefaultTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)

func (*DefaultTracer) CaptureStart

func (t *DefaultTracer) CaptureStart(env vm.VMInterface, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*DefaultTracer) CaptureState

func (t *DefaultTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error)

func (*DefaultTracer) CaptureTxEnd

func (t *DefaultTracer) CaptureTxEnd(restGas uint64)

func (*DefaultTracer) CaptureTxStart

func (t *DefaultTracer) CaptureTxStart(gasLimit uint64)

type EngineAPI

type EngineAPI interface {
	NewPayloadV1(context.Context, *ExecutionPayload) (map[string]interface{}, error)
	NewPayloadV2(context.Context, *ExecutionPayload) (map[string]interface{}, error)
	ForkchoiceUpdatedV1(ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error)
	ForkchoiceUpdatedV2(ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error)
	GetPayloadV1(ctx context.Context, payloadID hexutility.Bytes) (*ExecutionPayload, error)
	GetPayloadV2(ctx context.Context, payloadID hexutility.Bytes) (*GetPayloadV2Response, error)
	ExchangeTransitionConfigurationV1(ctx context.Context, transitionConfiguration *TransitionConfiguration) (*TransitionConfiguration, error)
	GetPayloadBodiesByHashV1(ctx context.Context, hashes []common.Hash) ([]*ExecutionPayloadBodyV1, error)
	GetPayloadBodiesByRangeV1(ctx context.Context, start, count hexutil.Uint64) ([]*ExecutionPayloadBodyV1, error)
}

EngineAPI Beacon chain communication endpoint

type EngineImpl

type EngineImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

EngineImpl is implementation of the EngineAPI interface

func NewEngineAPI

func NewEngineAPI(base *BaseAPI, db kv.RoDB, api rpchelper.ApiBackend, internalCL bool) *EngineImpl

NewEngineAPI returns EngineImpl instance

func (*EngineImpl) ExchangeCapabilities

func (e *EngineImpl) ExchangeCapabilities(fromCl []string) []string

func (*EngineImpl) ExchangeTransitionConfigurationV1

func (e *EngineImpl) ExchangeTransitionConfigurationV1(ctx context.Context, beaconConfig *TransitionConfiguration) (*TransitionConfiguration, error)

Receives consensus layer's transition configuration and checks if the execution layer has the correct configuration. Can also be used to ping the execution layer (heartbeats). See https://github.com/ethereum/execution-apis/blob/v1.0.0-beta.1/src/engine/specification.md#engine_exchangetransitionconfigurationv1

func (*EngineImpl) ForkchoiceUpdatedV1

func (e *EngineImpl) ForkchoiceUpdatedV1(ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error)

func (*EngineImpl) ForkchoiceUpdatedV2

func (e *EngineImpl) ForkchoiceUpdatedV2(ctx context.Context, forkChoiceState *ForkChoiceState, payloadAttributes *PayloadAttributes) (map[string]interface{}, error)

func (*EngineImpl) GetPayloadBodiesByHashV1

func (e *EngineImpl) GetPayloadBodiesByHashV1(ctx context.Context, hashes []common.Hash) ([]*ExecutionPayloadBodyV1, error)

func (*EngineImpl) GetPayloadBodiesByRangeV1

func (e *EngineImpl) GetPayloadBodiesByRangeV1(ctx context.Context, start, count hexutil.Uint64) ([]*ExecutionPayloadBodyV1, error)

func (*EngineImpl) GetPayloadV1

func (e *EngineImpl) GetPayloadV1(ctx context.Context, payloadID hexutility.Bytes) (*ExecutionPayload, error)

func (*EngineImpl) GetPayloadV2

func (e *EngineImpl) GetPayloadV2(ctx context.Context, payloadID hexutility.Bytes) (*GetPayloadV2Response, error)

func (*EngineImpl) NewPayloadV1

func (e *EngineImpl) NewPayloadV1(ctx context.Context, payload *ExecutionPayload) (map[string]interface{}, error)

NewPayloadV1 processes new payloads (blocks) from the beacon chain without withdrawals. See https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#engine_newpayloadv1

func (*EngineImpl) NewPayloadV2

func (e *EngineImpl) NewPayloadV2(ctx context.Context, payload *ExecutionPayload) (map[string]interface{}, error)

NewPayloadV2 processes new payloads (blocks) from the beacon chain with withdrawals. See https://github.com/ethereum/execution-apis/blob/main/src/engine/shanghai.md#engine_newpayloadv2

type ErigonAPI

type ErigonAPI interface {
	// System related (see ./erigon_system.go)
	Forks(ctx context.Context) (Forks, error)
	BlockNumber(ctx context.Context, rpcBlockNumPtr *rpc.BlockNumber) (hexutil.Uint64, error)

	// Blocks related (see ./erigon_blocks.go)
	GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
	GetHeaderByHash(_ context.Context, hash common.Hash) (*types.Header, error)
	GetBlockByTimestamp(ctx context.Context, timeStamp rpc.Timestamp, fullTx bool) (map[string]interface{}, error)
	GetBalanceChangesInBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (map[common.Address]*hexutil.Big, error)

	// Receipt related (see ./erigon_receipts.go)
	GetLogsByHash(ctx context.Context, hash common.Hash) ([][]*types.Log, error)
	//GetLogsByNumber(ctx context.Context, number rpc.BlockNumber) ([][]*types.Log, error)
	GetLogs(ctx context.Context, crit ethFilters.FilterCriteria) (types.ErigonLogs, error)
	GetLatestLogs(ctx context.Context, crit filters.FilterCriteria, logOptions ethFilters.LogFilterOptions) (types.ErigonLogs, error)
	// Gets cannonical block receipt through hash. If the block is not cannonical returns error
	GetBlockReceiptsByBlockHash(ctx context.Context, cannonicalBlockHash common.Hash) ([]map[string]interface{}, error)

	// CumulativeChainTraffic / related to chain traffic (see ./erigon_cumulative_index.go)
	CumulativeChainTraffic(ctx context.Context, blockNr rpc.BlockNumber) (ChainTraffic, error)

	// NodeInfo returns a collection of metadata known about the host.
	NodeInfo(ctx context.Context) ([]p2p.NodeInfo, error)
}

ErigonAPI Erigon specific routines

type ErigonImpl

type ErigonImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

ErigonImpl is implementation of the ErigonAPI interface

func NewErigonAPI

func NewErigonAPI(base *BaseAPI, db kv.RoDB, eth rpchelper.ApiBackend) *ErigonImpl

NewErigonAPI returns ErigonImpl instance

func (*ErigonImpl) BlockNumber

func (api *ErigonImpl) BlockNumber(ctx context.Context, rpcBlockNumPtr *rpc.BlockNumber) (hexutil.Uint64, error)

Post the merge eth_blockNumber will return latest forkChoiceHead block number erigon_blockNumber will return latest executed block number or any block number requested

func (*ErigonImpl) CacheCheck

func (api *ErigonImpl) CacheCheck() (*kvcache.CacheValidationResult, error)

func (*ErigonImpl) CumulativeChainTraffic

func (api *ErigonImpl) CumulativeChainTraffic(ctx context.Context, blockNr rpc.BlockNumber) (ChainTraffic, error)

CumulativeGasIndex implements erigon_cumulativeChainTraffic. Returns how much traffic there has been at the specified block number. Aka. amount of gas used so far + total transactions issued to the network

func (*ErigonImpl) Forks

func (api *ErigonImpl) Forks(ctx context.Context) (Forks, error)

Forks implements erigon_forks. Returns the genesis block hash and a sorted list of all forks block numbers

func (*ErigonImpl) GetBalanceChangesInBlock

func (api *ErigonImpl) GetBalanceChangesInBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (map[common.Address]*hexutil.Big, error)

func (*ErigonImpl) GetBlockByTimestamp

func (api *ErigonImpl) GetBlockByTimestamp(ctx context.Context, timeStamp rpc.Timestamp, fullTx bool) (map[string]interface{}, error)

func (*ErigonImpl) GetBlockReceiptsByBlockHash

func (api *ErigonImpl) GetBlockReceiptsByBlockHash(ctx context.Context, cannonicalBlockHash common.Hash) ([]map[string]interface{}, error)

func (*ErigonImpl) GetHeaderByHash

func (api *ErigonImpl) GetHeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

GetHeaderByHash implements erigon_getHeaderByHash. Returns a block's header given a block's hash.

func (*ErigonImpl) GetHeaderByNumber

func (api *ErigonImpl) GetHeaderByNumber(ctx context.Context, blockNumber rpc.BlockNumber) (*types.Header, error)

GetHeaderByNumber implements erigon_getHeaderByNumber. Returns a block's header given a block number ignoring the block's transaction and uncle list (may be faster).

func (*ErigonImpl) GetLatestLogs

func (api *ErigonImpl) GetLatestLogs(ctx context.Context, crit filters.FilterCriteria, logOptions filters.LogFilterOptions) (types.ErigonLogs, error)

blockCount parameter is for better pagination. `crit` filter is the same filter.

Examples: {} or nil matches any topics list {{A}} matches topic A in any positions. Logs with {{B}, {A}} will be matched

func (*ErigonImpl) GetLogs

GetLogs implements erigon_getLogs. Returns an array of logs matching a given filter object.

func (*ErigonImpl) GetLogsByHash

func (api *ErigonImpl) GetLogsByHash(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

GetLogsByHash implements erigon_getLogsByHash. Returns an array of arrays of logs generated by the transactions in the block given by the block's hash.

func (*ErigonImpl) NodeInfo

func (api *ErigonImpl) NodeInfo(ctx context.Context) ([]p2p.NodeInfo, error)

type EthAPI

type EthAPI interface {
	// Block related (proposed file: ./eth_blocks.go)
	GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
	GetBlockByHash(ctx context.Context, hash rpc.BlockNumberOrHash, fullTx bool) (map[string]interface{}, error)
	GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*hexutil.Uint, error)
	GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) (*hexutil.Uint, error)

	// Transaction related (see ./eth_txs.go)
	GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error)
	GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, txIndex hexutil.Uint64) (*RPCTransaction, error)
	GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, txIndex hexutil.Uint) (*RPCTransaction, error)
	GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (hexutility.Bytes, error)
	GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (hexutility.Bytes, error)
	GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutility.Bytes, error)

	// Receipt related (see ./eth_receipts.go)
	GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
	GetLogs(ctx context.Context, crit ethFilters.FilterCriteria) (types.Logs, error)
	GetBlockReceipts(ctx context.Context, number rpc.BlockNumber) ([]map[string]interface{}, error)

	// Uncle related (see ./eth_uncles.go)
	GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (map[string]interface{}, error)
	GetUncleByBlockHashAndIndex(ctx context.Context, hash common.Hash, index hexutil.Uint) (map[string]interface{}, error)
	GetUncleCountByBlockNumber(ctx context.Context, number rpc.BlockNumber) (*hexutil.Uint, error)
	GetUncleCountByBlockHash(ctx context.Context, hash common.Hash) (*hexutil.Uint, error)

	// Filter related (see ./eth_filters.go)
	NewPendingTransactionFilter(_ context.Context) (string, error)
	NewBlockFilter(_ context.Context) (string, error)
	NewFilter(_ context.Context, crit ethFilters.FilterCriteria) (string, error)
	UninstallFilter(_ context.Context, index string) (bool, error)
	GetFilterChanges(_ context.Context, index string) ([]any, error)
	GetFilterLogs(_ context.Context, index string) ([]*types.Log, error)

	// Account related (see ./eth_accounts.go)
	Accounts(ctx context.Context) ([]common.Address, error)
	GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error)
	GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error)
	GetStorageAt(ctx context.Context, address common.Address, index string, blockNrOrHash rpc.BlockNumberOrHash) (string, error)
	GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutility.Bytes, error)

	// System related (see ./eth_system.go)
	BlockNumber(ctx context.Context) (hexutil.Uint64, error)
	Syncing(ctx context.Context) (interface{}, error)
	ChainId(ctx context.Context) (hexutil.Uint64, error) /* called eth_protocolVersion elsewhere */
	ProtocolVersion(_ context.Context) (hexutil.Uint, error)
	GasPrice(_ context.Context) (*hexutil.Big, error)

	// Sending related (see ./eth_call.go)
	Call(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *ethapi2.StateOverrides) (hexutility.Bytes, error)
	EstimateGas(ctx context.Context, argsOrNil *ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error)
	SendRawTransaction(ctx context.Context, encodedTx hexutility.Bytes) (common.Hash, error)
	SendTransaction(_ context.Context, txObject interface{}) (common.Hash, error)
	Sign(ctx context.Context, _ common.Address, _ hexutility.Bytes) (hexutility.Bytes, error)
	SignTransaction(_ context.Context, txObject interface{}) (common.Hash, error)
	GetProof(ctx context.Context, address common.Address, storageKeys []common.Hash, blockNr rpc.BlockNumberOrHash) (*accounts.AccProofResult, error)
	CreateAccessList(ctx context.Context, args ethapi2.CallArgs, blockNrOrHash *rpc.BlockNumberOrHash, optimizeGas *bool) (*accessListResult, error)

	// Mining related (see ./eth_mining.go)
	Coinbase(ctx context.Context) (common.Address, error)
	Hashrate(ctx context.Context) (uint64, error)
	Mining(ctx context.Context) (bool, error)
	GetWork(ctx context.Context) ([4]string, error)
	SubmitWork(ctx context.Context, nonce types.BlockNonce, powHash, digest common.Hash) (bool, error)
	SubmitHashrate(ctx context.Context, hashRate hexutil.Uint64, id common.Hash) (bool, error)
}

EthAPI is a collection of functions that are exposed in the

type ExecutionPayload

type ExecutionPayload struct {
	ParentHash    common.Hash         `json:"parentHash"    gencodec:"required"`
	FeeRecipient  common.Address      `json:"feeRecipient"  gencodec:"required"`
	StateRoot     common.Hash         `json:"stateRoot"     gencodec:"required"`
	ReceiptsRoot  common.Hash         `json:"receiptsRoot"  gencodec:"required"`
	LogsBloom     hexutility.Bytes    `json:"logsBloom"     gencodec:"required"`
	PrevRandao    common.Hash         `json:"prevRandao"    gencodec:"required"`
	BlockNumber   hexutil.Uint64      `json:"blockNumber"   gencodec:"required"`
	GasLimit      hexutil.Uint64      `json:"gasLimit"      gencodec:"required"`
	GasUsed       hexutil.Uint64      `json:"gasUsed"       gencodec:"required"`
	Timestamp     hexutil.Uint64      `json:"timestamp"     gencodec:"required"`
	ExtraData     hexutility.Bytes    `json:"extraData"     gencodec:"required"`
	BaseFeePerGas *hexutil.Big        `json:"baseFeePerGas" gencodec:"required"`
	BlockHash     common.Hash         `json:"blockHash"     gencodec:"required"`
	Transactions  []hexutility.Bytes  `json:"transactions"  gencodec:"required"`
	Withdrawals   []*types.Withdrawal `json:"withdrawals"`
	ExcessDataGas *hexutil.Big        `json:"excessDataGas"`
}

ExecutionPayload represents an execution payload (aka block)

type ExecutionPayloadBodyV1

type ExecutionPayloadBodyV1 struct {
	Transactions []hexutility.Bytes  `json:"transactions" gencodec:"required"`
	Withdrawals  []*types.Withdrawal `json:"withdrawals"  gencodec:"required"`
}

type ForkChoiceState

type ForkChoiceState struct {
	HeadHash           common.Hash `json:"headBlockHash"             gencodec:"required"`
	SafeBlockHash      common.Hash `json:"safeBlockHash"             gencodec:"required"`
	FinalizedBlockHash common.Hash `json:"finalizedBlockHash"        gencodec:"required"`
}

PayloadAttributes represent the attributes required to start assembling a payload

type Forks

type Forks struct {
	GenesisHash common.Hash `json:"genesis"`
	HeightForks []uint64    `json:"heightForks"`
	TimeForks   []uint64    `json:"timeForks"`
}

Forks is a data type to record a list of forks passed by this node

type GasPriceCache

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

func NewGasPriceCache

func NewGasPriceCache() *GasPriceCache

func (*GasPriceCache) GetLatest

func (c *GasPriceCache) GetLatest() (common.Hash, *big.Int)

func (*GasPriceCache) SetLatest

func (c *GasPriceCache) SetLatest(hash common.Hash, price *big.Int)

type GasPriceOracleBackend

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

func NewGasPriceOracleBackend

func NewGasPriceOracleBackend(tx kv.Tx, cc *chain.Config, baseApi *BaseAPI) *GasPriceOracleBackend

func (*GasPriceOracleBackend) BlockByNumber

func (b *GasPriceOracleBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)

func (*GasPriceOracleBackend) ChainConfig

func (b *GasPriceOracleBackend) ChainConfig() *chain.Config

func (*GasPriceOracleBackend) GetReceipts

func (b *GasPriceOracleBackend) GetReceipts(ctx context.Context, hash libcommon.Hash) (types.Receipts, error)

func (*GasPriceOracleBackend) HeaderByNumber

func (b *GasPriceOracleBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)

func (*GasPriceOracleBackend) PendingBlockAndReceipts

func (b *GasPriceOracleBackend) PendingBlockAndReceipts() (*types.Block, types.Receipts)

type GenericTracer

type GenericTracer interface {
	vm.EVMLogger
	SetTransaction(tx types.Transaction)
	Found() bool
}

type GetPayloadV2Response

type GetPayloadV2Response struct {
	ExecutionPayload *ExecutionPayload `json:"executionPayload" gencodec:"required"`
	BlockValue       *hexutil.Big      `json:"blockValue" gencodec:"required"`
}

GetPayloadV2Response represents the response of the getPayloadV2 method

type GethTrace

type GethTrace struct {
	Type    string     `json:"type"`
	Error   string     `json:"error"`
	From    string     `json:"from"`
	To      string     `json:"to"`
	Value   string     `json:"value"`
	Gas     string     `json:"gas"`
	GasUsed string     `json:"gasUsed"`
	Input   string     `json:"input"`
	Output  string     `json:"output"`
	Time    string     `json:"time"`
	Calls   GethTraces `json:"calls"`
}

GethTrace The trace as received from the existing Geth javascript tracer 'callTracer'

func (GethTrace) String

func (p GethTrace) String() string

Allows for easy printing of a geth trace for debugging

type GethTraces

type GethTraces []*GethTrace

GethTraces an array of GethTraces

type GraphQLAPI

type GraphQLAPI interface {
	GetBlockDetails(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
	GetChainID(ctx context.Context) (*big.Int, error)
}

type GraphQLAPIImpl

type GraphQLAPIImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

func NewGraphQLAPI

func NewGraphQLAPI(base *BaseAPI, db kv.RoDB) *GraphQLAPIImpl

func (*GraphQLAPIImpl) GetBlockDetails

func (api *GraphQLAPIImpl) GetBlockDetails(ctx context.Context, blockNumber rpc.BlockNumber) (map[string]interface{}, error)

func (*GraphQLAPIImpl) GetChainID

func (api *GraphQLAPIImpl) GetChainID(ctx context.Context) (*big.Int, error)

type InternalOperation

type InternalOperation struct {
	Type  OperationType  `json:"type"`
	From  common.Address `json:"from"`
	To    common.Address `json:"to"`
	Value *hexutil.Big   `json:"value"`
}

type MapTxNum2BlockNumIter

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

MapTxNum2BlockNumIter - enrich iterator by TxNumbers, adding more info:

  • blockNum
  • txIndex in block: -1 means first system tx
  • isFinalTxn: last system-txn. BlockRewards and similar things - are attribute to this virtual txn.
  • blockNumChanged: means this and previous txNum belongs to different blockNumbers

Expect: `it` to return sorted txNums, then blockNum will not change until `it.Next() < maxTxNumInBlock`

it allow certain optimizations.

func MapDescendTxNum2BlockNum

func MapDescendTxNum2BlockNum(tx kv.Tx, it iter.U64) *MapTxNum2BlockNumIter

func MapTxNum2BlockNum

func MapTxNum2BlockNum(tx kv.Tx, it iter.U64) *MapTxNum2BlockNumIter

func (*MapTxNum2BlockNumIter) HasNext

func (i *MapTxNum2BlockNumIter) HasNext() bool

func (*MapTxNum2BlockNumIter) Next

func (i *MapTxNum2BlockNumIter) Next() (txNum, blockNum uint64, txIndex int, isFinalTxn, blockNumChanged bool, err error)

type NetAPI

type NetAPI interface {
	Listening(_ context.Context) (bool, error)
	Version(_ context.Context) (string, error)
	PeerCount(_ context.Context) (hexutil.Uint, error)
}

NetAPI the interface for the net_ RPC commands

type NetAPIImpl

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

NetAPIImpl data structure to store things needed for net_ commands

func NewNetAPIImpl

func NewNetAPIImpl(eth rpchelper.ApiBackend) *NetAPIImpl

NewNetAPIImpl returns NetAPIImplImpl instance

func (*NetAPIImpl) Listening

func (api *NetAPIImpl) Listening(_ context.Context) (bool, error)

Listening implements net_listening. Returns true if client is actively listening for network connections. TODO: Remove hard coded value

func (*NetAPIImpl) PeerCount

func (api *NetAPIImpl) PeerCount(ctx context.Context) (hexutil.Uint, error)

PeerCount implements net_peerCount. Returns number of peers currently connected to the first sentry server.

func (*NetAPIImpl) Version

func (api *NetAPIImpl) Version(ctx context.Context) (string, error)

Version implements net_version. Returns the current network id.

type OeTracer

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

OpenEthereum-style tracer

func (*OeTracer) CaptureEnd

func (ot *OeTracer) CaptureEnd(output []byte, usedGas uint64, err error)

func (*OeTracer) CaptureEnter

func (ot *OeTracer) CaptureEnter(typ vm.OpCode, from libcommon.Address, to libcommon.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*OeTracer) CaptureExit

func (ot *OeTracer) CaptureExit(output []byte, usedGas uint64, err error)

func (*OeTracer) CaptureFault

func (ot *OeTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, opDepth int, err error)

func (*OeTracer) CaptureStart

func (ot *OeTracer) CaptureStart(env vm.VMInterface, from libcommon.Address, to libcommon.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*OeTracer) CaptureState

func (ot *OeTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, opDepth int, err error)

func (*OeTracer) CaptureTxEnd

func (ot *OeTracer) CaptureTxEnd(restGas uint64)

func (*OeTracer) CaptureTxStart

func (ot *OeTracer) CaptureTxStart(gasLimit uint64)

type OperationType

type OperationType int
const (
	OP_TRANSFER      OperationType = 0
	OP_SELF_DESTRUCT OperationType = 1
	OP_CREATE        OperationType = 2
	OP_CREATE2       OperationType = 3
)

type OperationsTracer

type OperationsTracer struct {
	DefaultTracer

	Results []*InternalOperation
	// contains filtered or unexported fields
}

func NewOperationsTracer

func NewOperationsTracer(ctx context.Context) *OperationsTracer

func (*OperationsTracer) CaptureEnter

func (t *OperationsTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

type OtterscanAPI

type OtterscanAPI interface {
	GetApiLevel() uint8
	GetInternalOperations(ctx context.Context, hash common.Hash) ([]*InternalOperation, error)
	SearchTransactionsBefore(ctx context.Context, addr common.Address, blockNum uint64, pageSize uint16) (*TransactionsWithReceipts, error)
	SearchTransactionsAfter(ctx context.Context, addr common.Address, blockNum uint64, pageSize uint16) (*TransactionsWithReceipts, error)
	GetBlockDetails(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)
	GetBlockDetailsByHash(ctx context.Context, hash common.Hash) (map[string]interface{}, error)
	GetBlockTransactions(ctx context.Context, number rpc.BlockNumber, pageNumber uint8, pageSize uint8) (map[string]interface{}, error)
	HasCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (bool, error)
	TraceTransaction(ctx context.Context, hash common.Hash) ([]*TraceEntry, error)
	GetTransactionError(ctx context.Context, hash common.Hash) (hexutility.Bytes, error)
	GetTransactionBySenderAndNonce(ctx context.Context, addr common.Address, nonce uint64) (*common.Hash, error)
	GetContractCreator(ctx context.Context, addr common.Address) (*ContractCreatorData, error)
}

type OtterscanAPIImpl

type OtterscanAPIImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

func NewOtterscanAPI

func NewOtterscanAPI(base *BaseAPI, db kv.RoDB) *OtterscanAPIImpl

func (*OtterscanAPIImpl) GetApiLevel

func (api *OtterscanAPIImpl) GetApiLevel() uint8

func (*OtterscanAPIImpl) GetBlockDetails

func (api *OtterscanAPIImpl) GetBlockDetails(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error)

func (*OtterscanAPIImpl) GetBlockDetailsByHash

func (api *OtterscanAPIImpl) GetBlockDetailsByHash(ctx context.Context, hash common.Hash) (map[string]interface{}, error)

TODO: remove duplication with GetBlockDetails

func (*OtterscanAPIImpl) GetBlockTransactions

func (api *OtterscanAPIImpl) GetBlockTransactions(ctx context.Context, number rpc.BlockNumber, pageNumber uint8, pageSize uint8) (map[string]interface{}, error)

func (*OtterscanAPIImpl) GetContractCreator

func (api *OtterscanAPIImpl) GetContractCreator(ctx context.Context, addr common.Address) (*ContractCreatorData, error)

func (*OtterscanAPIImpl) GetInternalOperations

func (api *OtterscanAPIImpl) GetInternalOperations(ctx context.Context, hash common.Hash) ([]*InternalOperation, error)

func (*OtterscanAPIImpl) GetTransactionBySenderAndNonce

func (api *OtterscanAPIImpl) GetTransactionBySenderAndNonce(ctx context.Context, addr common.Address, nonce uint64) (*common.Hash, error)

func (*OtterscanAPIImpl) GetTransactionError

func (api *OtterscanAPIImpl) GetTransactionError(ctx context.Context, hash common.Hash) (hexutility.Bytes, error)

func (*OtterscanAPIImpl) HasCode

func (api *OtterscanAPIImpl) HasCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (bool, error)

func (*OtterscanAPIImpl) SearchTransactionsAfter

func (api *OtterscanAPIImpl) SearchTransactionsAfter(ctx context.Context, addr common.Address, blockNum uint64, pageSize uint16) (*TransactionsWithReceipts, error)

Search transactions that touch a certain address.

It searches forward a certain block (excluding); the results are sorted descending.

The pageSize indicates how many txs may be returned. If there are less txs than pageSize, they are just returned. But it may return a little more than pageSize if there are more txs than the necessary to fill pageSize in the last found block, i.e., let's say you want pageSize == 25, you already found 24 txs, the next block contains 4 matches, then this function will return 28 txs.

func (*OtterscanAPIImpl) SearchTransactionsBefore

func (api *OtterscanAPIImpl) SearchTransactionsBefore(ctx context.Context, addr common.Address, blockNum uint64, pageSize uint16) (*TransactionsWithReceipts, error)

Search transactions that touch a certain address.

It searches back a certain block (excluding); the results are sorted descending.

The pageSize indicates how many txs may be returned. If there are less txs than pageSize, they are just returned. But it may return a little more than pageSize if there are more txs than the necessary to fill pageSize in the last found block, i.e., let's say you want pageSize == 25, you already found 24 txs, the next block contains 4 matches, then this function will return 28 txs.

func (*OtterscanAPIImpl) TraceTransaction

func (api *OtterscanAPIImpl) TraceTransaction(ctx context.Context, hash common.Hash) ([]*TraceEntry, error)

type ParityAPI

type ParityAPI interface {
	ListStorageKeys(ctx context.Context, account libcommon.Address, quantity int, offset *hexutility.Bytes, blockNumber rpc.BlockNumberOrHash) ([]hexutility.Bytes, error)
}

ParityAPI the interface for the parity_ RPC commands

type ParityAPIImpl

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

ParityAPIImpl data structure to store things needed for parity_ commands

func NewParityAPIImpl

func NewParityAPIImpl(db kv.RoDB) *ParityAPIImpl

NewParityAPIImpl returns ParityAPIImpl instance

func (*ParityAPIImpl) ListStorageKeys

func (api *ParityAPIImpl) ListStorageKeys(ctx context.Context, account libcommon.Address, quantity int, offset *hexutility.Bytes, blockNumberOrTag rpc.BlockNumberOrHash) ([]hexutility.Bytes, error)

ListStorageKeys implements parity_listStorageKeys. Returns all storage keys of the given address

type ParityTrace

type ParityTrace struct {
	// Do not change the ordering of these fields -- allows for easier comparison with other clients
	Action              interface{}  `json:"action"` // Can be either CallTraceAction or CreateTraceAction
	BlockHash           *common.Hash `json:"blockHash,omitempty"`
	BlockNumber         *uint64      `json:"blockNumber,omitempty"`
	Error               string       `json:"error,omitempty"`
	Result              interface{}  `json:"result"`
	Subtraces           int          `json:"subtraces"`
	TraceAddress        []int        `json:"traceAddress"`
	TransactionHash     *common.Hash `json:"transactionHash,omitempty"`
	TransactionPosition *uint64      `json:"transactionPosition,omitempty"`
	Type                string       `json:"type"`
}

ParityTrace A trace in the desired format (Parity/OpenEtherum) See: https://openethereum.github.io/wiki/JSONRPC-trace-module

func (ParityTrace) String

func (t ParityTrace) String() string

Allows for easy printing of a parity trace for debugging

type ParityTraces

type ParityTraces []ParityTrace

ParityTraces An array of parity traces

type PayloadAttributes

type PayloadAttributes struct {
	Timestamp             hexutil.Uint64      `json:"timestamp"             gencodec:"required"`
	PrevRandao            common.Hash         `json:"prevRandao"            gencodec:"required"`
	SuggestedFeeRecipient common.Address      `json:"suggestedFeeRecipient" gencodec:"required"`
	Withdrawals           []*types.Withdrawal `json:"withdrawals"`
}

PayloadAttributes represent the attributes required to start assembling a payload

type PrivateDebugAPI

type PrivateDebugAPI interface {
	StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex uint64, contractAddress common.Address, keyStart hexutility.Bytes, maxResult int) (StorageRangeResult, error)
	TraceTransaction(ctx context.Context, hash common.Hash, config *tracers.TraceConfig, stream *jsoniter.Stream) error
	TraceBlockByHash(ctx context.Context, hash common.Hash, config *tracers.TraceConfig, stream *jsoniter.Stream) error
	TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *tracers.TraceConfig, stream *jsoniter.Stream) error
	AccountRange(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, start []byte, maxResults int, nocode, nostorage bool) (state.IteratorDump, error)
	GetModifiedAccountsByNumber(ctx context.Context, startNum rpc.BlockNumber, endNum *rpc.BlockNumber) ([]common.Address, error)
	GetModifiedAccountsByHash(_ context.Context, startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
	TraceCall(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, config *tracers.TraceConfig, stream *jsoniter.Stream) error
	AccountAt(ctx context.Context, blockHash common.Hash, txIndex uint64, account common.Address) (*AccountResult, error)
}

PrivateDebugAPI Exposed RPC endpoints for debugging use

type PrivateDebugAPIImpl

type PrivateDebugAPIImpl struct {
	*BaseAPI

	GasCap uint64
	// contains filtered or unexported fields
}

PrivateDebugAPIImpl is implementation of the PrivateDebugAPI interface based on remote Db access

func NewPrivateDebugAPI

func NewPrivateDebugAPI(base *BaseAPI, db kv.RoDB, gascap uint64) *PrivateDebugAPIImpl

NewPrivateDebugAPI returns PrivateDebugAPIImpl instance

func (*PrivateDebugAPIImpl) AccountAt

func (api *PrivateDebugAPIImpl) AccountAt(ctx context.Context, blockHash common.Hash, txIndex uint64, address common.Address) (*AccountResult, error)

func (*PrivateDebugAPIImpl) AccountRange

func (api *PrivateDebugAPIImpl) AccountRange(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, startKey []byte, maxResults int, excludeCode, excludeStorage bool) (state.IteratorDump, error)

AccountRange implements debug_accountRange. Returns a range of accounts involved in the given block rangeb

func (*PrivateDebugAPIImpl) GetModifiedAccountsByHash

func (api *PrivateDebugAPIImpl) GetModifiedAccountsByHash(ctx context.Context, startHash common.Hash, endHash *common.Hash) ([]common.Address, error)

GetModifiedAccountsByHash implements debug_getModifiedAccountsByHash. Returns a list of accounts modified in the given block.

func (*PrivateDebugAPIImpl) GetModifiedAccountsByNumber

func (api *PrivateDebugAPIImpl) GetModifiedAccountsByNumber(ctx context.Context, startNumber rpc.BlockNumber, endNumber *rpc.BlockNumber) ([]common.Address, error)

GetModifiedAccountsByNumber implements debug_getModifiedAccountsByNumber. Returns a list of accounts modified in the given block. [from, to)

func (*PrivateDebugAPIImpl) StorageRangeAt

func (api *PrivateDebugAPIImpl) StorageRangeAt(ctx context.Context, blockHash common.Hash, txIndex uint64, contractAddress common.Address, keyStart hexutility.Bytes, maxResult int) (StorageRangeResult, error)

storageRangeAt implements debug_storageRangeAt. Returns information about a range of storage locations (if any) for the given address.

func (*PrivateDebugAPIImpl) TraceBlockByHash

func (api *PrivateDebugAPIImpl) TraceBlockByHash(ctx context.Context, hash common.Hash, config *tracers.TraceConfig, stream *jsoniter.Stream) error

TraceBlockByHash implements debug_traceBlockByHash. Returns Geth style block traces.

func (*PrivateDebugAPIImpl) TraceBlockByNumber

func (api *PrivateDebugAPIImpl) TraceBlockByNumber(ctx context.Context, blockNum rpc.BlockNumber, config *tracers.TraceConfig, stream *jsoniter.Stream) error

TraceBlockByNumber implements debug_traceBlockByNumber. Returns Geth style block traces.

func (*PrivateDebugAPIImpl) TraceCall

func (api *PrivateDebugAPIImpl) TraceCall(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, config *tracers.TraceConfig, stream *jsoniter.Stream) error

func (*PrivateDebugAPIImpl) TraceCallMany

func (api *PrivateDebugAPIImpl) TraceCallMany(ctx context.Context, bundles []Bundle, simulateContext StateContext, config *tracers.TraceConfig, stream *jsoniter.Stream) error

func (*PrivateDebugAPIImpl) TraceTransaction

func (api *PrivateDebugAPIImpl) TraceTransaction(ctx context.Context, hash common.Hash, config *tracers.TraceConfig, stream *jsoniter.Stream) error

TraceTransaction implements debug_traceTransaction. Returns Geth style transaction traces.

type RPCTransaction

type RPCTransaction struct {
	BlockHash        *common.Hash       `json:"blockHash"`
	BlockNumber      *hexutil.Big       `json:"blockNumber"`
	From             common.Address     `json:"from"`
	Gas              hexutil.Uint64     `json:"gas"`
	GasPrice         *hexutil.Big       `json:"gasPrice,omitempty"`
	Tip              *hexutil.Big       `json:"maxPriorityFeePerGas,omitempty"`
	FeeCap           *hexutil.Big       `json:"maxFeePerGas,omitempty"`
	Hash             common.Hash        `json:"hash"`
	Input            hexutility.Bytes   `json:"input"`
	Nonce            hexutil.Uint64     `json:"nonce"`
	To               *common.Address    `json:"to"`
	TransactionIndex *hexutil.Uint64    `json:"transactionIndex"`
	Value            *hexutil.Big       `json:"value"`
	Type             hexutil.Uint64     `json:"type"`
	Accesses         *types2.AccessList `json:"accessList,omitempty"`
	ChainID          *hexutil.Big       `json:"chainId,omitempty"`
	V                *hexutil.Big       `json:"v"`
	R                *hexutil.Big       `json:"r"`
	S                *hexutil.Big       `json:"s"`
}

RPCTransaction represents a transaction that will serialize to the RPC representation of a transaction

type RewardTraceAction

type RewardTraceAction struct {
	Author     common.Address `json:"author"`
	RewardType string         `json:"rewardType"`
	Value      hexutil.Big    `json:"value,omitempty"`
}

type Snapshot

type Snapshot struct {
	Number       uint64                    `json:"number"`       // Block number where the snapshot was created
	Hash         common.Hash               `json:"hash"`         // Block hash where the snapshot was created
	ValidatorSet *ValidatorSet             `json:"validatorSet"` // Validator set at this moment
	Recents      map[uint64]common.Address `json:"recents"`      // Set of recent signers for spam protections
	// contains filtered or unexported fields
}

func (*Snapshot) GetSignerSuccessionNumber

func (s *Snapshot) GetSignerSuccessionNumber(signer common.Address) (int, error)

GetSignerSuccessionNumber returns the relative position of signer in terms of the in-turn proposer

type StateContext

type StateContext struct {
	BlockNumber      rpc.BlockNumberOrHash
	TransactionIndex *int
}

type StateDiff

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

Implements core/state/StateWriter to provide state diffs

func (*StateDiff) CompareStates

func (sd *StateDiff) CompareStates(initialIbs, ibs *state.IntraBlockState)

CompareStates uses the addresses accumulated in the sdMap and compares balances, nonces, and codes of the accounts, and fills the rest of the sdMap

func (*StateDiff) CreateContract

func (sd *StateDiff) CreateContract(address libcommon.Address) error

func (*StateDiff) DeleteAccount

func (sd *StateDiff) DeleteAccount(address libcommon.Address, original *accounts.Account) error

func (*StateDiff) UpdateAccountCode

func (sd *StateDiff) UpdateAccountCode(address libcommon.Address, incarnation uint64, codeHash libcommon.Hash, code []byte) error

func (*StateDiff) UpdateAccountData

func (sd *StateDiff) UpdateAccountData(address libcommon.Address, original, account *accounts.Account) error

func (*StateDiff) WriteAccountStorage

func (sd *StateDiff) WriteAccountStorage(address libcommon.Address, incarnation uint64, key *libcommon.Hash, original, value *uint256.Int) error

type StateDiffAccount

type StateDiffAccount struct {
	Balance interface{}                               `json:"balance"` // Can be either string "=" or mapping "*" => {"from": "hex", "to": "hex"}
	Code    interface{}                               `json:"code"`
	Nonce   interface{}                               `json:"nonce"`
	Storage map[libcommon.Hash]map[string]interface{} `json:"storage"`
}

StateDiffAccount is the part of `trace_call` response that is under "stateDiff" tag

type StateDiffBalance

type StateDiffBalance struct {
	From *hexutil.Big `json:"from"`
	To   *hexutil.Big `json:"to"`
}

type StateDiffCode

type StateDiffCode struct {
	From hexutility.Bytes `json:"from"`
	To   hexutility.Bytes `json:"to"`
}

type StateDiffNonce

type StateDiffNonce struct {
	From hexutil.Uint64 `json:"from"`
	To   hexutil.Uint64 `json:"to"`
}

type StateDiffStorage

type StateDiffStorage struct {
	From libcommon.Hash `json:"from"`
	To   libcommon.Hash `json:"to"`
}

type StorageEntry

type StorageEntry struct {
	Key   *libcommon.Hash `json:"key"`
	Value libcommon.Hash  `json:"value"`
}

StorageEntry an entry in storage of the account

type StorageRangeResult

type StorageRangeResult struct {
	Storage storageMap      `json:"storage"`
	NextKey *libcommon.Hash `json:"nextKey"` // nil if Storage includes the last key in the trie.
}

StorageRangeResult is the result of a debug_storageRangeAt API call.

type SuicideTraceAction

type SuicideTraceAction struct {
	Address       common.Address `json:"address"`
	RefundAddress common.Address `json:"refundAddress"`
	Balance       hexutil.Big    `json:"balance"`
}

type TouchTracer

type TouchTracer struct {
	DefaultTracer

	Found bool
	// contains filtered or unexported fields
}

func NewTouchTracer

func NewTouchTracer(searchAddr common.Address) *TouchTracer

func (*TouchTracer) CaptureEnter

func (t *TouchTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*TouchTracer) CaptureStart

func (t *TouchTracer) CaptureStart(env vm.VMInterface, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

type TraceAPI

type TraceAPI interface {
	// Ad-hoc (see ./trace_adhoc.go)
	ReplayBlockTransactions(ctx context.Context, blockNr rpc.BlockNumberOrHash, traceTypes []string) ([]*TraceCallResult, error)
	ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string) (*TraceCallResult, error)
	Call(ctx context.Context, call TraceCallParam, types []string, blockNr *rpc.BlockNumberOrHash) (*TraceCallResult, error)
	CallMany(ctx context.Context, calls json.RawMessage, blockNr *rpc.BlockNumberOrHash) ([]*TraceCallResult, error)
	RawTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string) ([]interface{}, error)

	// Filtering (see ./trace_filtering.go)
	Transaction(ctx context.Context, txHash libcommon.Hash) (ParityTraces, error)
	Get(ctx context.Context, txHash libcommon.Hash, txIndicies []hexutil.Uint64) (*ParityTrace, error)
	Block(ctx context.Context, blockNr rpc.BlockNumber) (ParityTraces, error)
	Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream) error
}

TraceAPI RPC interface into tracing API

type TraceAPIImpl

type TraceAPIImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

TraceAPIImpl is implementation of the TraceAPI interface based on remote Db access

func NewTraceAPI

func NewTraceAPI(base *BaseAPI, kv kv.RoDB, cfg *httpcfg.HttpCfg) *TraceAPIImpl

NewTraceAPI returns NewTraceAPI instance

func (*TraceAPIImpl) Block

func (api *TraceAPIImpl) Block(ctx context.Context, blockNr rpc.BlockNumber) (ParityTraces, error)

Block implements trace_block

func (*TraceAPIImpl) Call

func (api *TraceAPIImpl) Call(ctx context.Context, args TraceCallParam, traceTypes []string, blockNrOrHash *rpc.BlockNumberOrHash) (*TraceCallResult, error)

Call implements trace_call.

func (*TraceAPIImpl) CallMany

func (api *TraceAPIImpl) CallMany(ctx context.Context, calls json.RawMessage, parentNrOrHash *rpc.BlockNumberOrHash) ([]*TraceCallResult, error)

CallMany implements trace_callMany.

func (*TraceAPIImpl) Filter

func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, stream *jsoniter.Stream) error

Filter implements trace_filter NOTE: We do not store full traces - we just store index for each address Pull blocks which have txs with matching address

func (*TraceAPIImpl) Get

func (api *TraceAPIImpl) Get(ctx context.Context, txHash common.Hash, indicies []hexutil.Uint64) (*ParityTrace, error)

Get implements trace_get

func (*TraceAPIImpl) RawTransaction

func (api *TraceAPIImpl) RawTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string) ([]interface{}, error)

RawTransaction implements trace_rawTransaction.

func (*TraceAPIImpl) ReplayBlockTransactions

func (api *TraceAPIImpl) ReplayBlockTransactions(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, traceTypes []string) ([]*TraceCallResult, error)

func (*TraceAPIImpl) ReplayTransaction

func (api *TraceAPIImpl) ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string) (*TraceCallResult, error)

func (*TraceAPIImpl) Transaction

func (api *TraceAPIImpl) Transaction(ctx context.Context, txHash common.Hash) (ParityTraces, error)

Transaction implements trace_transaction

type TraceAction

type TraceAction struct {
	// Do not change the ordering of these fields -- allows for easier comparison with other clients
	Author         string           `json:"author,omitempty"`
	RewardType     string           `json:"rewardType,omitempty"`
	SelfDestructed string           `json:"address,omitempty"`
	Balance        string           `json:"balance,omitempty"`
	CallType       string           `json:"callType,omitempty"`
	From           common.Address   `json:"from"`
	Gas            hexutil.Big      `json:"gas"`
	Init           hexutility.Bytes `json:"init,omitempty"`
	Input          hexutility.Bytes `json:"input,omitempty"`
	RefundAddress  string           `json:"refundAddress,omitempty"`
	To             string           `json:"to,omitempty"`
	Value          string           `json:"value,omitempty"`
}

TraceAction A parity formatted trace action

type TraceCallParam

type TraceCallParam struct {
	From                 *libcommon.Address `json:"from"`
	To                   *libcommon.Address `json:"to"`
	Gas                  *hexutil.Uint64    `json:"gas"`
	GasPrice             *hexutil.Big       `json:"gasPrice"`
	MaxPriorityFeePerGas *hexutil.Big       `json:"maxPriorityFeePerGas"`
	MaxFeePerGas         *hexutil.Big       `json:"maxFeePerGas"`
	Value                *hexutil.Big       `json:"value"`
	Data                 hexutility.Bytes   `json:"data"`
	AccessList           *types2.AccessList `json:"accessList"`
	// contains filtered or unexported fields
}

TraceCallParam (see SendTxArgs -- this allows optional prams plus don't use MixedcaseAddress

func (*TraceCallParam) ToMessage

func (args *TraceCallParam) ToMessage(globalGasCap uint64, baseFee *uint256.Int) (types.Message, error)

ToMessage converts CallArgs to the Message type used by the core evm

type TraceCallResult

type TraceCallResult struct {
	Output          hexutility.Bytes                        `json:"output"`
	StateDiff       map[libcommon.Address]*StateDiffAccount `json:"stateDiff"`
	Trace           []*ParityTrace                          `json:"trace"`
	VmTrace         *VmTrace                                `json:"vmTrace"`
	TransactionHash *libcommon.Hash                         `json:"transactionHash,omitempty"`
}

TraceCallResult is the response to `trace_call` method

type TraceEntry

type TraceEntry struct {
	Type  string           `json:"type"`
	Depth int              `json:"depth"`
	From  common.Address   `json:"from"`
	To    common.Address   `json:"to"`
	Value *hexutil.Big     `json:"value"`
	Input hexutility.Bytes `json:"input"`
}

type TraceFilterMode

type TraceFilterMode string

type TraceFilterRequest

type TraceFilterRequest struct {
	FromBlock   *hexutil.Uint64   `json:"fromBlock"`
	ToBlock     *hexutil.Uint64   `json:"toBlock"`
	FromAddress []*common.Address `json:"fromAddress"`
	ToAddress   []*common.Address `json:"toAddress"`
	Mode        TraceFilterMode   `json:"mode"`
	After       *uint64           `json:"after"`
	Count       *uint64           `json:"count"`
}

TraceFilterRequest represents the arguments for trace_filter

type TraceResult

type TraceResult struct {
	// Do not change the ordering of these fields -- allows for easier comparison with other clients
	GasUsed *hexutil.Big     `json:"gasUsed"`
	Output  hexutility.Bytes `json:"output"`
}

TraceResult A parity formatted trace result

type TransactionTracer

type TransactionTracer struct {
	DefaultTracer

	Results []*TraceEntry
	// contains filtered or unexported fields
}

func NewTransactionTracer

func NewTransactionTracer(ctx context.Context) *TransactionTracer

func (*TransactionTracer) CaptureEnter

func (t *TransactionTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

func (*TransactionTracer) CaptureExit

func (t *TransactionTracer) CaptureExit(output []byte, usedGas uint64, err error)

func (*TransactionTracer) CaptureStart

func (t *TransactionTracer) CaptureStart(env vm.VMInterface, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

type TransactionsWithReceipts

type TransactionsWithReceipts struct {
	Txs       []*RPCTransaction        `json:"txs"`
	Receipts  []map[string]interface{} `json:"receipts"`
	FirstPage bool                     `json:"firstPage"`
	LastPage  bool                     `json:"lastPage"`
}

type TransitionConfiguration

type TransitionConfiguration struct {
	TerminalTotalDifficulty *hexutil.Big `json:"terminalTotalDifficulty" gencodec:"required"`
	TerminalBlockHash       common.Hash  `json:"terminalBlockHash"       gencodec:"required"`
	TerminalBlockNumber     *hexutil.Big `json:"terminalBlockNumber"     gencodec:"required"`
}

TransitionConfiguration represents the correct configurations of the CL and the EL

type TxPoolAPI

type TxPoolAPI interface {
	Content(ctx context.Context) (map[string]map[string]map[string]*RPCTransaction, error)
}

NetAPI the interface for the net_ RPC commands

type TxPoolAPIImpl

type TxPoolAPIImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

TxPoolAPIImpl data structure to store things needed for net_ commands

func NewTxPoolAPI

func NewTxPoolAPI(base *BaseAPI, db kv.RoDB, pool proto_txpool.TxpoolClient) *TxPoolAPIImpl

NewTxPoolAPI returns NetAPIImplImpl instance

func (*TxPoolAPIImpl) Content

func (api *TxPoolAPIImpl) Content(ctx context.Context) (map[string]map[string]map[string]*RPCTransaction, error)

func (*TxPoolAPIImpl) Status

func (api *TxPoolAPIImpl) Status(ctx context.Context) (map[string]hexutil.Uint, error)

Status returns the number of pending and queued transaction in the pool.

type ValidatorSet

type ValidatorSet struct {
	// NOTE: persisted via reflect, must be exported.
	Validators []*valset.Validator `json:"validators"`
	Proposer   *valset.Validator   `json:"proposer"`
	// contains filtered or unexported fields
}

ValidatorSet represent a set of *Validator at a given height. The validators can be fetched by address or index. The index is in order of .Address, so the indices are fixed for all rounds of a given blockchain height - ie. the validators are sorted by their address. On the other hand, the .ProposerPriority of each validator and the designated .GetProposer() of a set changes every round, upon calling .IncrementProposerPriority(). NOTE: Not goroutine-safe. NOTE: All get/set to validators should copy the value for safety.

func NewValidatorSet

func NewValidatorSet(valz []*valset.Validator) *ValidatorSet

NewValidatorSet initializes a ValidatorSet by copying over the values from `valz`, a list of Validators. If valz is nil or empty, the new ValidatorSet will have an empty list of Validators. The addresses of validators in `valz` must be unique otherwise the function panics.

func (*ValidatorSet) Copy

func (vals *ValidatorSet) Copy() *ValidatorSet

Copy each validator into a new ValidatorSet.

func (*ValidatorSet) CopyIncrementProposerPriority

func (vals *ValidatorSet) CopyIncrementProposerPriority(times int) *ValidatorSet

Increment ProposerPriority and update the proposer on a copy, and return it.

func (*ValidatorSet) GetByAddress

func (vals *ValidatorSet) GetByAddress(address libcommon.Address) (index int, val *valset.Validator)

GetByAddress returns an index of the validator with address and validator itself if found. Otherwise, -1 and nil are returned.

func (*ValidatorSet) GetByIndex

func (vals *ValidatorSet) GetByIndex(index int) (address []byte, val *valset.Validator)

GetByIndex returns the validator's address and validator itself by index. It returns nil values if index is less than 0 or greater or equal to len(ValidatorSet.Validators).

func (*ValidatorSet) GetProposer

func (vals *ValidatorSet) GetProposer() (proposer *valset.Validator)

GetProposer returns the current proposer. If the validator set is empty, nil is returned.

func (*ValidatorSet) HasAddress

func (vals *ValidatorSet) HasAddress(address []byte) bool

HasAddress returns true if address given is in the validator set, false - otherwise.

func (*ValidatorSet) IncrementProposerPriority

func (vals *ValidatorSet) IncrementProposerPriority(times int)

IncrementProposerPriority increments ProposerPriority of each validator and updates the proposer. Panics if validator set is empty. `times` must be positive.

func (*ValidatorSet) IsNilOrEmpty

func (vals *ValidatorSet) IsNilOrEmpty() bool

Nil or empty validator sets are invalid.

func (*ValidatorSet) Iterate

func (vals *ValidatorSet) Iterate(fn func(index int, val *valset.Validator) bool)

Iterate will run the given function over the set.

func (*ValidatorSet) RescalePriorities

func (vals *ValidatorSet) RescalePriorities(diffMax int64)

func (*ValidatorSet) Size

func (vals *ValidatorSet) Size() int

Size returns the length of the validator set.

func (*ValidatorSet) String

func (vals *ValidatorSet) String() string

func (*ValidatorSet) StringIndented

func (vals *ValidatorSet) StringIndented(indent string) string

func (*ValidatorSet) TotalVotingPower

func (vals *ValidatorSet) TotalVotingPower() int64

TotalVotingPower returns the sum of the voting powers of all validators. It recomputes the total voting power if required.

func (*ValidatorSet) UpdateTotalVotingPower

func (vals *ValidatorSet) UpdateTotalVotingPower() error

Force recalculation of the set's total voting power.

func (*ValidatorSet) UpdateWithChangeSet

func (vals *ValidatorSet) UpdateWithChangeSet(changes []*valset.Validator) error

UpdateWithChangeSet attempts to update the validator set with 'changes'. It performs the following steps:

  • validates the changes making sure there are no duplicates and splits them in updates and deletes
  • verifies that applying the changes will not result in errors
  • computes the total voting power BEFORE removals to ensure that in the next steps the priorities across old and newly added validators are fair
  • computes the priorities of new validators against the final set
  • applies the updates against the validator set
  • applies the removals against the validator set
  • performs scaling and centering of priority values

If an error is detected during verification steps, it is returned and the validator set is not changed.

type ValidatorsByAddress

type ValidatorsByAddress []*valset.Validator

Sort validators by address.

func (ValidatorsByAddress) Len

func (valz ValidatorsByAddress) Len() int

func (ValidatorsByAddress) Less

func (valz ValidatorsByAddress) Less(i, j int) bool

func (ValidatorsByAddress) Swap

func (valz ValidatorsByAddress) Swap(i, j int)

type VmTrace

type VmTrace struct {
	Code hexutility.Bytes `json:"code"`
	Ops  []*VmTraceOp     `json:"ops"`
}

VmTrace is the part of `trace_call` response that is under "vmTrace" tag

type VmTraceEx

type VmTraceEx struct {
	Mem   *VmTraceMem   `json:"mem"`
	Push  []string      `json:"push"`
	Store *VmTraceStore `json:"store"`
	Used  int           `json:"used"`
}

type VmTraceMem

type VmTraceMem struct {
	Data string `json:"data"`
	Off  int    `json:"off"`
}

type VmTraceOp

type VmTraceOp struct {
	Cost int        `json:"cost"`
	Ex   *VmTraceEx `json:"ex"`
	Pc   int        `json:"pc"`
	Sub  *VmTrace   `json:"sub"`
	Op   string     `json:"op,omitempty"`
	Idx  string     `json:"idx,omitempty"`
}

VmTraceOp is one element of the vmTrace ops trace

type VmTraceStore

type VmTraceStore struct {
	Key string `json:"key"`
	Val string `json:"val"`
}

type Web3API

type Web3API interface {
	ClientVersion(_ context.Context) (string, error)
	Sha3(_ context.Context, input hexutility.Bytes) hexutility.Bytes
}

Web3API provides interfaces for the web3_ RPC commands

type Web3APIImpl

type Web3APIImpl struct {
	*BaseAPI
	// contains filtered or unexported fields
}

func NewWeb3APIImpl

func NewWeb3APIImpl(ethBackend rpchelper.ApiBackend) *Web3APIImpl

NewWeb3APIImpl returns Web3APIImpl instance

func (*Web3APIImpl) ClientVersion

func (api *Web3APIImpl) ClientVersion(ctx context.Context) (string, error)

ClientVersion implements web3_clientVersion. Returns the current client version.

func (*Web3APIImpl) Sha3

Sha3 implements web3_sha3. Returns Keccak-256 (not the standardized SHA3-256) of the given data.

type ZkEvmAPI

type ZkEvmAPI interface {
	ConsolidatedBlockNumber(ctx context.Context) (hexutil.Uint64, error)
	IsBlockConsolidated(ctx context.Context, blockNumber rpc.BlockNumber) (bool, error)
	IsBlockVirtualized(ctx context.Context, blockNumber rpc.BlockNumber) (bool, error)
	BatchNumberByBlockNumber(ctx context.Context, blockNumber rpc.BlockNumber) (hexutil.Uint64, error)
	BatchNumber(ctx context.Context) (hexutil.Uint64, error)
	VirtualBatchNumber(ctx context.Context) (hexutil.Uint64, error)
	VerifiedBatchNumber(ctx context.Context) (hexutil.Uint64, error)
	GetBatchByNumber(ctx context.Context, batchNumber rpc.BlockNumber, fullTx *bool) (json.RawMessage, error)
	GetFullBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (types.Block, error)
	GetFullBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (types.Block, error)
	GetBroadcastURI(ctx context.Context) (string, error)
}

ZkEvmAPI is a collection of functions that are exposed in the

type ZkEvmAPIImpl

type ZkEvmAPIImpl struct {
	ReturnDataLimit int
	ZkRpcUrl        string
	// contains filtered or unexported fields
}

APIImpl is implementation of the ZkEvmAPI interface based on remote Db access

func NewZkEvmAPI

func NewZkEvmAPI(base *APIImpl, db kv.RoDB, returnDataLimit int, zkRpcUrl string) *ZkEvmAPIImpl

NewEthAPI returns ZkEvmAPIImpl instance

func (*ZkEvmAPIImpl) BatchNumber

func (api *ZkEvmAPIImpl) BatchNumber(ctx context.Context) (hexutil.Uint64, error)

BatchNumber returns the latest batch number

func (*ZkEvmAPIImpl) BatchNumberByBlockNumber

func (api *ZkEvmAPIImpl) BatchNumberByBlockNumber(ctx context.Context, blockNumber rpc.BlockNumber) (hexutil.Uint64, error)

BatchNumberByBlockNumber returns the batch number of the block

func (*ZkEvmAPIImpl) ConsolidatedBlockNumber

func (api *ZkEvmAPIImpl) ConsolidatedBlockNumber(ctx context.Context) (hexutil.Uint64, error)

ConsolidatedBlockNumber returns the latest consolidated block number Once a batch is verified, it is connected to the blockchain, and the block number of the most recent block in that batch becomes the "consolidated block number.”

func (*ZkEvmAPIImpl) GetBatchByNumber

func (api *ZkEvmAPIImpl) GetBatchByNumber(ctx context.Context, batchNumber rpc.BlockNumber, fullTx *bool) (json.RawMessage, error)

GetBatchByNumber returns a batch from the current canonical chain. If number is nil, the latest known batch is returned.

func (*ZkEvmAPIImpl) GetBroadcastURI

func (api *ZkEvmAPIImpl) GetBroadcastURI(ctx context.Context) (string, error)

GetBroadcastURI returns the URI of the broadcaster - the trusted sequencer

func (*ZkEvmAPIImpl) GetFullBlockByHash

func (api *ZkEvmAPIImpl) GetFullBlockByHash(ctx context.Context, hash libcommon.Hash, fullTx bool) (types.Block, error)

GetFullBlockByHash returns a full block from the current canonical chain. If number is nil, the latest known block is returned.

func (*ZkEvmAPIImpl) GetFullBlockByNumber

func (api *ZkEvmAPIImpl) GetFullBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (types.Block, error)

GetFullBlockByNumber returns a full block from the current canonical chain. If number is nil, the latest known block is returned.

func (*ZkEvmAPIImpl) IsBlockConsolidated

func (api *ZkEvmAPIImpl) IsBlockConsolidated(ctx context.Context, blockNumber rpc.BlockNumber) (bool, error)

IsBlockConsolidated returns true if the block is consolidated

func (*ZkEvmAPIImpl) IsBlockVirtualized

func (api *ZkEvmAPIImpl) IsBlockVirtualized(ctx context.Context, blockNumber rpc.BlockNumber) (bool, error)

IsBlockVirtualized returns true if the block is virtualized (not confirmed on the L1 but exists in the L1 smart contract i.e. sequenced)

func (*ZkEvmAPIImpl) VerifiedBatchNumber

func (api *ZkEvmAPIImpl) VerifiedBatchNumber(ctx context.Context) (hexutil.Uint64, error)

VerifiedBatchNumber returns the latest verified batch number A batch is considered verified once its proof has been validated and accepted by the network.

func (*ZkEvmAPIImpl) VirtualBatchNumber

func (api *ZkEvmAPIImpl) VirtualBatchNumber(ctx context.Context) (hexutil.Uint64, error)

VirtualBatchNumber returns the latest virtual batch number A virtual batch is a batch that is in the process of being created and has not yet been verified. The virtual batch number represents the next batch to be verified using zero-knowledge proofs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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