jsonrpc

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 93 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 (
	// TraceFilterModeUnion is default mode for TraceFilter.
	// Unions results referred to addresses from FromAddress or ToAddress
	TraceFilterModeUnion = "union"
	// TraceFilterModeIntersection retrieves results referred to addresses provided both in FromAddress and ToAddress
	TraceFilterModeIntersection = "intersection"
)
View Source
const API_LEVEL = 8

API_LEVEL Must be incremented every time new additions are made

View Source
const AccountRangeMaxResults = 8192

AccountRangeMaxResults is the maximum number of results to be returned

View Source
const AccountRangeMaxResultsWithStorage = 256

AccountRangeMaxResultsWithStorage is the maximum number of results to be returned if storage is asked to be enclosed. Contract storage is usually huge and we should be careful not overwhelming our clients or being stuck in db.

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, eth rpchelper.ApiBackend, txPool txpool.TxpoolClient, mining txpool.MiningClient,
	filters *rpchelper.Filters, stateCache kvcache.Cache,
	blockReader services.FullBlockReader, cfg *httpcfg.HttpCfg, engine consensus.EngineReader,
	logger log.Logger, bridgeReader bridgeReader, spanProducersReader spanProducersReader,
) (list []rpc.API)

APIList describes the list of available RPC apis

Types

type APIImpl

type APIImpl struct {
	*BaseAPI

	GasCap                      uint64
	FeeCap                      float64
	ReturnDataLimit             int
	AllowUnprotectedTxs         bool
	MaxGetProofRewindBlockCount int
	SubscribeLogsChannelSize    int
	// 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, feecap float64, returnDataLimit int, allowUnprotectedTxs bool, maxGetProofRewindBlockCount int, subscribeLogsChannelSize int, logger log.Logger) *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) BaseFee

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

BaseFee returns the base fee at the current head.

func (*APIImpl) BlobBaseFee

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

BlobBaseFee returns the base fee for blob gas at the current head.

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, overrides *ethapi2.StateOverrides) (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, numberOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error)

GetBlockReceipts - receipts for individual block

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, fullTx *bool) (*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)

	// AddPeer requests connecting to a remote node.
	AddPeer(ctx context.Context, url string) (bool, 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) AddPeer

func (api *AdminAPIImpl) AddPeer(ctx context.Context, url string) (bool, error)

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 {
	// contains filtered or unexported fields
}

func NewBaseApi

func NewBaseApi(f *rpchelper.Filters, stateCache kvcache.Cache, blockReader services.FullBlockReader, singleNodeMode bool, evmCallTimeout time.Duration, engine consensus.EngineReader, dirs datadir.Dirs, bridgeReader bridgeReader) *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 BlockSigners

type BlockSigners struct {
	Signers []difficultiesKV
	Diff    int
	Author  common.Address
}

type BorAPI

type BorAPI interface {
	// Bor snapshot related (see ./bor_snapshot.go)
	GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
	GetAuthor(blockNrOrHash *rpc.BlockNumberOrHash) (*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)
	GetSnapshotProposer(blockNrOrHash *rpc.BlockNumberOrHash) (common.Address, error)
	GetSnapshotProposerSequence(blockNrOrHash *rpc.BlockNumberOrHash) (BlockSigners, 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, spanProducersReader spanProducersReader) *BorImpl

NewBorAPI returns BorImpl instance

func (*BorImpl) GetAuthor

func (api *BorImpl) GetAuthor(blockNrOrHash *rpc.BlockNumberOrHash) (*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.

func (*BorImpl) GetSnapshotProposer

func (api *BorImpl) GetSnapshotProposer(blockNrOrHash *rpc.BlockNumberOrHash) (common.Address, error)

GetSnapshotProposer retrieves the in-turn signer at a given block.

func (*BorImpl) GetSnapshotProposerSequence

func (api *BorImpl) GetSnapshotProposerSequence(blockNrOrHash *rpc.BlockNumberOrHash) (BlockSigners, error)

func (*BorImpl) GetVoteOnHash

func (api *BorImpl) GetVoteOnHash(ctx context.Context, starBlockNr uint64, endBlockNr uint64, hash string, milestoneId string) (bool, error)

GetVoteOnHash gets the vote on milestone hash

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 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.EVM, 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 CreationCode

type CreationCode struct {
	Code *hexutility.Bytes `json:"code"`
}

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.EVM, 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 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 filters.FilterCriteria) (types.ErigonLogs, error)
	GetLatestLogs(ctx context.Context, crit filters.FilterCriteria, logOptions filters.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)

	// 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) 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)

GetLatestLogs implements erigon_getLatestLogs. Return specific number of logs or block matching a give filter objects by descend. IgnoreTopicsOrder option provide a way to match the logs with addresses and topics without caring about the topics' orders When IgnoreTopicsOrde option is true, once the logs have a topic that matched, it will be returned no matter what topic position it is in.

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, numberOrHash rpc.BlockNumberOrHash) ([]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, overrides *ethapi2.StateOverrides) (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 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, 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, block *types.Block) (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 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, txNumsReader rawdbv3.TxNumsReader, it stream.U64) *MapTxNum2BlockNumIter

func MapTxNum2BlockNum

func MapTxNum2BlockNum(tx kv.Tx, txNumsReader rawdbv3.TxNumsReader, it stream.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
}

OeTracer is an 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.EVM, 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 OeTracerConfig

type OeTracerConfig struct {
	IncludePrecompiles bool `json:"includePrecompiles"` // by default Parity/OpenEthereum format does not include precompiles
}

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, maxPageSize uint64) *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)

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 OverlayAPI

type OverlayAPI interface {
	GetLogs(ctx context.Context, crit filters.FilterCriteria, stateOverride *ethapi.StateOverrides) ([]*types.Log, error)
	CallConstructor(ctx context.Context, address common.Address, code *hexutility.Bytes) (*CreationCode, error)
}

type OverlayAPIImpl

type OverlayAPIImpl struct {
	*BaseAPI

	GasCap                    uint64
	OverlayGetLogsTimeout     time.Duration
	OverlayReplayBlockTimeout time.Duration
	OtsAPI                    OtterscanAPI
	// contains filtered or unexported fields
}

OverlayAPIImpl is implementation of the OverlayAPIImpl interface based on remote Db access

func NewOverlayAPI

func NewOverlayAPI(base *BaseAPI, db kv.RoDB, gascap uint64, overlayGetLogsTimeout time.Duration, overlayReplayBlockTimeout time.Duration, otsApi OtterscanAPI) *OverlayAPIImpl

NewOverlayAPI returns OverlayAPIImpl instance

func (*OverlayAPIImpl) CallConstructor

func (api *OverlayAPIImpl) CallConstructor(ctx context.Context, address common.Address, code *hexutility.Bytes) (*CreationCode, error)

func (*OverlayAPIImpl) GetLogs

func (api *OverlayAPIImpl) GetLogs(ctx context.Context, crit filters.FilterCriteria, stateOverride *ethapi.StateOverrides) ([]*types.Log, error)

type OverlayCreateTracer

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

func (*OverlayCreateTracer) CaptureEnd

func (ct *OverlayCreateTracer) CaptureEnd(output []byte, usedGas uint64, err error)

func (*OverlayCreateTracer) CaptureEnter

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

Rest of the frames

func (*OverlayCreateTracer) CaptureExit

func (ct *OverlayCreateTracer) CaptureExit(output []byte, usedGas uint64, err error)

func (*OverlayCreateTracer) CaptureFault

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

func (*OverlayCreateTracer) CaptureStart

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

Top call frame

func (*OverlayCreateTracer) CaptureState

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

Opcode level

func (*OverlayCreateTracer) CaptureTxEnd

func (ct *OverlayCreateTracer) CaptureTxEnd(restGas uint64)

func (*OverlayCreateTracer) CaptureTxStart

func (ct *OverlayCreateTracer) CaptureTxStart(gasLimit uint64)

Transaction level

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 {
	*BaseAPI
	// contains filtered or unexported fields
}

ParityAPIImpl data structure to store things needed for parity_ commands

func NewParityAPIImpl

func NewParityAPIImpl(base *BaseAPI, 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/OpenEthereum) 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 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 *tracersConfig.TraceConfig, stream *jsoniter.Stream) error
	TraceBlockByHash(ctx context.Context, hash common.Hash, config *tracersConfig.TraceConfig, stream *jsoniter.Stream) error
	TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *tracersConfig.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(ctx context.Context, startHash common.Hash, endHash *common.Hash) ([]common.Address, error)
	TraceCall(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, config *tracersConfig.TraceConfig, stream *jsoniter.Stream) error
	AccountAt(ctx context.Context, blockHash common.Hash, txIndex uint64, account common.Address) (*AccountResult, error)
	GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutility.Bytes, error)
	GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutility.Bytes, 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) GetRawBlock

func (api *PrivateDebugAPIImpl) GetRawBlock(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutility.Bytes, error)

func (*PrivateDebugAPIImpl) GetRawHeader

func (api *PrivateDebugAPIImpl) GetRawHeader(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (hexutility.Bytes, error)

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 *tracersConfig.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 *tracersConfig.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 *tracersConfig.TraceConfig, stream *jsoniter.Stream) error

TraceCall implements debug_traceCall. Returns Geth style call traces.

func (*PrivateDebugAPIImpl) TraceCallMany

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

func (*PrivateDebugAPIImpl) TraceTransaction

func (api *PrivateDebugAPIImpl) TraceTransaction(ctx context.Context, hash common.Hash, config *tracersConfig.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"`
	MaxFeePerBlobGas    *hexutil.Big               `json:"maxFeePerBlobGas,omitempty"`
	BlobVersionedHashes []common.Hash              `json:"blobVersionedHashes,omitempty"`
	Authorizations      *[]types.JsonAuthorization `json:"authorizationList,omitempty"`
	V                   *hexutil.Big               `json:"v"`
	YParity             *hexutil.Big               `json:"yParity,omitempty"`
	R                   *hexutil.Big               `json:"r"`
	S                   *hexutil.Big               `json:"s"`
}

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

func NewRPCTransaction

func NewRPCTransaction(txn types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int) *RPCTransaction

NewRPCTransaction returns a transaction that will serialize to the RPC representation, with the given location metadata set (if available).

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
	// contains filtered or unexported fields
}

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.EVM, from common.Address, to common.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte)

type TraceAPI

type TraceAPI interface {
	ReplayBlockTransactions(ctx context.Context, blockNr rpc.BlockNumberOrHash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) ([]*TraceCallResult, error)
	ReplayTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string, gasBailOut *bool, traceConfig *config.TraceConfig) (*TraceCallResult, error)
	Call(ctx context.Context, call TraceCallParam, types []string, blockNr *rpc.BlockNumberOrHash, traceConfig *config.TraceConfig) (*TraceCallResult, error)
	CallMany(ctx context.Context, calls json.RawMessage, blockNr *rpc.BlockNumberOrHash, traceConfig *config.TraceConfig) ([]*TraceCallResult, error)
	RawTransaction(ctx context.Context, txHash libcommon.Hash, traceTypes []string) ([]interface{}, error)

	Transaction(ctx context.Context, txHash libcommon.Hash, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error)
	Get(ctx context.Context, txHash libcommon.Hash, txIndicies []hexutil.Uint64, gasBailOut *bool, traceConfig *config.TraceConfig) (*ParityTrace, error)
	Block(ctx context.Context, blockNr rpc.BlockNumber, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error)
	Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, traceConfig *config.TraceConfig, 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, gasBailOut *bool, traceConfig *config.TraceConfig) (ParityTraces, error)

Block implements trace_block

func (*TraceAPIImpl) Call

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

Call implements trace_call.

func (*TraceAPIImpl) CallMany

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

CallMany implements trace_callMany.

func (*TraceAPIImpl) Filter

func (api *TraceAPIImpl) Filter(ctx context.Context, req TraceFilterRequest, gasBailOut *bool, traceConfig *config.TraceConfig, 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, gasBailOut *bool, traceConfig *config.TraceConfig) (*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, gasBailOut *bool, traceConfig *config.TraceConfig) ([]*TraceCallResult, error)

func (*TraceAPIImpl) ReplayTransaction

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

func (*TraceAPIImpl) Transaction

func (api *TraceAPIImpl) Transaction(ctx context.Context, txHash common.Hash, gasBailOut *bool, traceConfig *config.TraceConfig) (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"`
	MaxFeePerBlobGas     *hexutil.Big       `json:"maxFeePerBlobGas"`
	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"`
	Output hexutility.Bytes `json:"output"`
}

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) CaptureEnd

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

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.EVM, 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 TxPoolAPI

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

TxPoolAPI the interface for the txpool_ 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) ContentFrom

func (api *TxPoolAPIImpl) ContentFrom(ctx context.Context, addr libcommon.Address) (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 = valset.ValidatorSet

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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