jsonrpc

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 38 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// FilterTypeLog represents a filter of type log.
	FilterTypeLog = "log"
	// FilterTypeBlock represents a filter of type block.
	FilterTypeBlock = "block"
	// FilterTypePendingTx represent a filter of type pending Tx.
	FilterTypePendingTx = "pendingTx"
)
View Source
const (
	// APIEth represents the eth API prefix.
	APIEth = "eth"
	// APINet represents the net API prefix.
	APINet = "net"
	// APIDebug represents the debug API prefix.
	APIDebug = "debug"
	// APIZKEVM represents the zkevm API prefix.
	APIZKEVM = "zkevm"
	// APITxPool represents the txpool API prefix.
	APITxPool = "txpool"
	// APIWeb3 represents the web3 API prefix.
	APIWeb3 = "web3"
)

Variables

View Source
var ErrFilterInvalidPayload = errors.New("invalid argument 0: cannot specify both BlockHash and FromBlock/ToBlock, choose one or the other")

ErrFilterInvalidPayload indicates there is an invalid payload when creating a filter

View Source
var ErrNotFound = errors.New("object not found")

ErrNotFound represent a not found error.

Functions

func RPCErrorResponse added in v0.0.990

func RPCErrorResponse(code int, message string, err error, logError bool) (interface{}, types.Error)

RPCErrorResponse formats error to be returned through RPC

func RPCErrorResponseWithData added in v0.0.990

func RPCErrorResponseWithData(code int, message string, data []byte, err error, logError bool) (interface{}, types.Error)

RPCErrorResponseWithData formats error to be returned through RPC

Types

type Config

type Config struct {
	// Host defines the network adapter that will be used to serve the HTTP requests
	Host string `mapstructure:"Host"`

	// Port defines the port to serve the endpoints via HTTP
	Port int `mapstructure:"Port"`

	// ReadTimeout is the HTTP server read timeout
	// check net/http.server.ReadTimeout and net/http.server.ReadHeaderTimeout
	ReadTimeout types.Duration `mapstructure:"ReadTimeout"`

	// WriteTimeout is the HTTP server write timeout
	// check net/http.server.WriteTimeout
	WriteTimeout types.Duration `mapstructure:"WriteTimeout"`

	// MaxRequestsPerIPAndSecond defines how much requests a single IP can
	// send within a single second
	MaxRequestsPerIPAndSecond float64 `mapstructure:"MaxRequestsPerIPAndSecond"`

	// SequencerNodeURI is used allow Non-Sequencer nodes
	// to relay transactions to the Sequencer node
	SequencerNodeURI string `mapstructure:"SequencerNodeURI"`

	// MaxCumulativeGasUsed is the max gas allowed per batch
	MaxCumulativeGasUsed uint64

	// WebSockets configuration
	WebSockets WebSocketsConfig `mapstructure:"WebSockets"`

	// EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price.
	EnableL2SuggestedGasPricePolling bool `mapstructure:"EnableL2SuggestedGasPricePolling"`

	// BatchRequestsEnabled defines if the Batch requests are enabled or disabled
	BatchRequestsEnabled bool `mapstructure:"BatchRequestsEnabled"`

	// BatchRequestsLimit defines the limit of requests that can be incorporated into each batch request
	BatchRequestsLimit uint `mapstructure:"BatchRequestsLimit"`

	// L2Coinbase defines which address is going to receive the fees
	L2Coinbase common.Address

	// MaxLogsCount is a configuration to set the max number of logs that can be returned
	// in a single call to the state, if zero it means no limit
	MaxLogsCount uint64 `mapstructure:"MaxLogsCount"`

	// MaxLogsBlockRange is a configuration to set the max range for block number when querying TXs
	// logs in a single call to the state, if zero it means no limit
	MaxLogsBlockRange uint64 `mapstructure:"MaxLogsBlockRange"`

	// MaxNativeBlockHashBlockRange is a configuration to set the max range for block number when querying
	// native block hashes in a single call to the state, if zero it means no limit
	MaxNativeBlockHashBlockRange uint64 `mapstructure:"MaxNativeBlockHashBlockRange"`

	// EnableHttpLog allows the user to enable or disable the logs related to the HTTP
	// requests to be captured by the server.
	EnableHttpLog bool `mapstructure:"EnableHttpLog"`

	// ZKCountersLimits defines the ZK Counter limits
	ZKCountersLimits ZKCountersLimits
}

Config represents the configuration of the json rpc

type DBTxManager added in v0.0.990

type DBTxManager struct{}

DBTxManager allows to do scopped DB txs

func (*DBTxManager) NewDbTxScope added in v0.0.990

func (f *DBTxManager) NewDbTxScope(db DBTxer, scopedFn DBTxScopedFn) (interface{}, types.Error)

NewDbTxScope function to initiate DB scopped txs

type DBTxScopedFn added in v0.0.990

type DBTxScopedFn func(ctx context.Context, dbTx pgx.Tx) (interface{}, types.Error)

DBTxScopedFn function to do scopped DB txs

type DBTxer added in v0.0.990

type DBTxer interface {
	BeginStateTransaction(ctx context.Context) (pgx.Tx, error)
}

DBTxer interface to begin DB txs

type DebugEndpoints

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

DebugEndpoints is the debug jsonrpc endpoint

func NewDebugEndpoints added in v0.0.990

func NewDebugEndpoints(cfg Config, state types.StateInterface, etherman types.EthermanInterface) *DebugEndpoints

NewDebugEndpoints returns DebugEndpoints

func (*DebugEndpoints) TraceBatchByNumber added in v0.0.990

func (d *DebugEndpoints) TraceBatchByNumber(httpRequest *http.Request, number types.BatchNumber, cfg *traceConfig) (interface{}, types.Error)

TraceBatchByNumber creates a response for debug_traceBatchByNumber request. this endpoint tries to help clients to get traces at once for all the transactions attached to the same batch.

IMPORTANT: in order to take advantage of the infrastructure automatically scaling, instead of parallelizing the trace transaction internally and pushing all the load to a single jRPC and Executor instance, the code will redirect the trace transaction requests to the same url, making them external calls, so we can process in parallel with multiple jRPC and Executor instances.

the request flow will work as follows: -> user do a trace batch request -> jRPC balancer picks a jRPC server to handle the trace batch request -> picked jRPC sends parallel trace transaction requests for each transaction in the batch -> jRPC balancer sends each request to a different jRPC to handle the trace transaction requests -> picked jRPC server group trace transaction responses from other jRPC servers -> picked jRPC respond the initial request to the user with all the tx traces

func (*DebugEndpoints) TraceBlockByHash

func (d *DebugEndpoints) TraceBlockByHash(hash types.ArgHash, cfg *traceConfig) (interface{}, types.Error)

TraceBlockByHash creates a response for debug_traceBlockByHash request. See https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtraceblockbyhash

func (*DebugEndpoints) TraceBlockByNumber

func (d *DebugEndpoints) TraceBlockByNumber(number types.BlockNumber, cfg *traceConfig) (interface{}, types.Error)

TraceBlockByNumber creates a response for debug_traceBlockByNumber request. See https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtraceblockbynumber

func (*DebugEndpoints) TraceTransaction

func (d *DebugEndpoints) TraceTransaction(hash types.ArgHash, cfg *traceConfig) (interface{}, types.Error)

TraceTransaction creates a response for debug_traceTransaction request. See https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtracetransaction

type EthEndpoints

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

EthEndpoints contains implementations for the "eth" RPC endpoints

func NewEthEndpoints added in v0.0.990

func NewEthEndpoints(cfg Config, chainID uint64, p types.PoolInterface, s types.StateInterface, etherman types.EthermanInterface, storage storageInterface) *EthEndpoints

NewEthEndpoints creates an new instance of Eth

func (*EthEndpoints) BlockNumber

func (e *EthEndpoints) BlockNumber() (interface{}, types.Error)

BlockNumber returns current block number

func (*EthEndpoints) Call

func (e *EthEndpoints) Call(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

Call executes a new message call immediately and returns the value of executed contract and potential error. Note, this function doesn't make any changes in the state/blockchain and is useful to execute view/pure methods and retrieve values.

func (*EthEndpoints) ChainId

func (e *EthEndpoints) ChainId() (interface{}, types.Error)

ChainId returns the chain id of the client

func (*EthEndpoints) Coinbase added in v0.0.990

func (e *EthEndpoints) Coinbase() (interface{}, types.Error)

Coinbase Returns the client coinbase address.

func (*EthEndpoints) EstimateGas

func (e *EthEndpoints) EstimateGas(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

EstimateGas generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

func (*EthEndpoints) GasPrice

func (e *EthEndpoints) GasPrice() (interface{}, types.Error)

GasPrice returns the average gas price based on the last x blocks

func (*EthEndpoints) GetBalance

func (e *EthEndpoints) GetBalance(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

GetBalance returns the account's balance at the referenced block

func (*EthEndpoints) GetBlockByHash

func (e *EthEndpoints) GetBlockByHash(hash types.ArgHash, fullTx bool, includeExtraInfo *bool) (interface{}, types.Error)

GetBlockByHash returns information about a block by hash

func (*EthEndpoints) GetBlockByNumber

func (e *EthEndpoints) GetBlockByNumber(number types.BlockNumber, fullTx bool, includeExtraInfo *bool) (interface{}, types.Error)

GetBlockByNumber returns information about a block by block number

func (*EthEndpoints) GetBlockTransactionCountByHash

func (e *EthEndpoints) GetBlockTransactionCountByHash(hash types.ArgHash) (interface{}, types.Error)

GetBlockTransactionCountByHash returns the number of transactions in a block from a block matching the given block hash.

func (*EthEndpoints) GetBlockTransactionCountByNumber

func (e *EthEndpoints) GetBlockTransactionCountByNumber(number *types.BlockNumber) (interface{}, types.Error)

GetBlockTransactionCountByNumber returns the number of transactions in a block from a block matching the given block number.

func (*EthEndpoints) GetCode

func (e *EthEndpoints) GetCode(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

GetCode returns account code at given block number

func (*EthEndpoints) GetCompilers

func (e *EthEndpoints) GetCompilers() (interface{}, types.Error)

GetCompilers eth_getCompilers

func (*EthEndpoints) GetFilterChanges

func (e *EthEndpoints) GetFilterChanges(filterID string) (interface{}, types.Error)

GetFilterChanges polling method for a filter, which returns an array of logs which occurred since last poll.

func (*EthEndpoints) GetFilterLogs

func (e *EthEndpoints) GetFilterLogs(filterID string) (interface{}, types.Error)

GetFilterLogs returns an array of all logs matching filter with given id.

func (*EthEndpoints) GetLogs

func (e *EthEndpoints) GetLogs(filter LogFilter) (interface{}, types.Error)

GetLogs returns a list of logs accordingly to the provided filter

func (*EthEndpoints) GetStorageAt

func (e *EthEndpoints) GetStorageAt(address types.ArgAddress, storageKeyStr string, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

GetStorageAt gets the value stored for an specific address and position

func (*EthEndpoints) GetTransactionByBlockHashAndIndex

func (e *EthEndpoints) GetTransactionByBlockHashAndIndex(hash types.ArgHash, index types.Index, includeExtraInfo *bool) (interface{}, types.Error)

GetTransactionByBlockHashAndIndex returns information about a transaction by block hash and transaction index position.

func (*EthEndpoints) GetTransactionByBlockNumberAndIndex

func (e *EthEndpoints) GetTransactionByBlockNumberAndIndex(number *types.BlockNumber, index types.Index, includeExtraInfo *bool) (interface{}, types.Error)

GetTransactionByBlockNumberAndIndex returns information about a transaction by block number and transaction index position.

func (*EthEndpoints) GetTransactionByHash

func (e *EthEndpoints) GetTransactionByHash(hash types.ArgHash, includeExtraInfo *bool) (interface{}, types.Error)

GetTransactionByHash returns a transaction by his hash

func (*EthEndpoints) GetTransactionCount

func (e *EthEndpoints) GetTransactionCount(address types.ArgAddress, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

GetTransactionCount returns account nonce

func (*EthEndpoints) GetTransactionReceipt

func (e *EthEndpoints) GetTransactionReceipt(hash types.ArgHash) (interface{}, types.Error)

GetTransactionReceipt returns a transaction receipt by his hash

func (*EthEndpoints) GetUncleByBlockHashAndIndex

func (e *EthEndpoints) GetUncleByBlockHashAndIndex(hash types.ArgHash, index types.Index) (interface{}, types.Error)

GetUncleByBlockHashAndIndex returns information about a uncle of a block by hash and uncle index position

func (*EthEndpoints) GetUncleByBlockNumberAndIndex

func (e *EthEndpoints) GetUncleByBlockNumberAndIndex(number types.BlockNumber, index types.Index) (interface{}, types.Error)

GetUncleByBlockNumberAndIndex returns information about a uncle of a block by number and uncle index position

func (*EthEndpoints) GetUncleCountByBlockHash

func (e *EthEndpoints) GetUncleCountByBlockHash(hash types.ArgAddress) (interface{}, types.Error)

GetUncleCountByBlockHash returns the number of uncles in a block matching the given block hash

func (*EthEndpoints) GetUncleCountByBlockNumber

func (e *EthEndpoints) GetUncleCountByBlockNumber(number types.BlockNumber) (interface{}, types.Error)

GetUncleCountByBlockNumber returns the number of uncles in a block matching the given block number

func (*EthEndpoints) NewBlockFilter

func (e *EthEndpoints) NewBlockFilter() (interface{}, types.Error)

NewBlockFilter creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.

func (*EthEndpoints) NewFilter

func (e *EthEndpoints) NewFilter(filter LogFilter) (interface{}, types.Error)

NewFilter creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.

func (*EthEndpoints) NewPendingTransactionFilter

func (e *EthEndpoints) NewPendingTransactionFilter() (interface{}, types.Error)

NewPendingTransactionFilter creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.

func (*EthEndpoints) ProtocolVersion

func (e *EthEndpoints) ProtocolVersion() (interface{}, types.Error)

ProtocolVersion returns the protocol version.

func (*EthEndpoints) SendRawTransaction

func (e *EthEndpoints) SendRawTransaction(httpRequest *http.Request, input string) (interface{}, types.Error)

SendRawTransaction has two different ways to handle new transactions: - for Sequencer nodes it tries to add the tx to the pool - for Non-Sequencer nodes it relays the Tx to the Sequencer node

func (*EthEndpoints) Subscribe

func (e *EthEndpoints) Subscribe(wsConn *concurrentWsConn, name string, logFilter *LogFilter) (interface{}, types.Error)

Subscribe Creates a new subscription over particular events. The node will return a subscription id. For each event that matches the subscription a notification with relevant data is sent together with the subscription id.

func (*EthEndpoints) Syncing

func (e *EthEndpoints) Syncing() (interface{}, types.Error)

Syncing returns an object with data about the sync status or false. https://eth.wiki/json-rpc/API#eth_syncing

func (*EthEndpoints) UninstallFilter

func (e *EthEndpoints) UninstallFilter(filterID string) (interface{}, types.Error)

UninstallFilter uninstalls a filter with given id.

func (*EthEndpoints) Unsubscribe

func (e *EthEndpoints) Unsubscribe(wsConn *concurrentWsConn, filterID string) (interface{}, types.Error)

Unsubscribe uninstalls the filter based on the provided filterID

type Filter

type Filter struct {
	ID         string
	Type       FilterType
	Parameters interface{}
	LastPoll   time.Time
	WsConn     *concurrentWsConn
	// contains filtered or unexported fields
}

Filter represents a filter.

func (*Filter) EnqueueSubscriptionDataToBeSent added in v0.3.4

func (f *Filter) EnqueueSubscriptionDataToBeSent(data []byte)

EnqueueSubscriptionDataToBeSent enqueues subscription data to be sent via web sockets connection

func (*Filter) SendEnqueuedSubscriptionData added in v0.3.4

func (f *Filter) SendEnqueuedSubscriptionData()

SendEnqueuedSubscriptionData consumes all the enqueued subscription data and sends it via web sockets connection.

type FilterType

type FilterType string

FilterType express the type of the filter, block, logs, pending transactions

type Handler

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

Handler manage services to handle jsonrpc requests

Services are public structures containing public methods matching the name of the jsonrpc method.

Services must be registered with a prefix to identify the service and its methods, for example a service registered with a prefix `eth` will have all the public methods exposed as eth_<methodName> through the json rpc server.

Go public methods requires the first char of its name to be in uppercase, but the exposition of the method will consider it to lower case, for example a method `func MyMethod()` provided by the service registered with `eth` prefix will be triggered when the method eth_myMethod is specified

the public methods must follow the conventions: - return interface{}, rpcError - if the method depend on a Web Socket connection, it must be the first parameters as f(*websocket.Conn) - parameter types must match the type of the data provided for the method

check the `eth.go` file for more example on how the methods are implemented

func (*Handler) Handle

func (h *Handler) Handle(req handleRequest) types.Response

Handle is the function that knows which and how a function should be executed when a JSON RPC request is received

func (*Handler) HandleWs

func (h *Handler) HandleWs(reqBody []byte, wsConn *concurrentWsConn, httpReq *http.Request) ([]byte, error)

HandleWs handle websocket requests

func (*Handler) RemoveFilterByWsConn

func (h *Handler) RemoveFilterByWsConn(wsConn *concurrentWsConn)

RemoveFilterByWsConn uninstalls the filter attached to this websocket connection

type LogFilter

type LogFilter struct {
	BlockHash *common.Hash
	FromBlock *types.BlockNumber
	ToBlock   *types.BlockNumber
	Addresses []common.Address
	Topics    [][]common.Hash
	Since     *time.Time
}

LogFilter is a filter for logs

func (*LogFilter) GetNumericBlockNumbers added in v0.0.990

func (f *LogFilter) GetNumericBlockNumbers(ctx context.Context, cfg Config, s types.StateInterface, e types.EthermanInterface, dbTx pgx.Tx) (uint64, uint64, types.Error)

GetNumericBlockNumbers load the numeric block numbers from state accordingly to the provided from and to block number

func (*LogFilter) MarshalJSON

func (f *LogFilter) MarshalJSON() ([]byte, error)

MarshalJSON allows to customize the JSON representation.

func (*LogFilter) Match

func (f *LogFilter) Match(log *types.Log) bool

Match returns whether the receipt includes topics for this filter

func (*LogFilter) ShouldFilterByBlockHash added in v0.0.990

func (f *LogFilter) ShouldFilterByBlockHash() bool

ShouldFilterByBlockHash if the filter should consider the block hash value

func (*LogFilter) ShouldFilterByBlockRange added in v0.0.990

func (f *LogFilter) ShouldFilterByBlockRange() bool

ShouldFilterByBlockRange if the filter should consider the block range values

func (*LogFilter) UnmarshalJSON

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

UnmarshalJSON decodes a json object

func (*LogFilter) Validate added in v0.0.990

func (f *LogFilter) Validate() error

Validate check if the filter instance is valid

type NativeBlockHashBlockRangeFilter added in v0.0.990

type NativeBlockHashBlockRangeFilter struct {
	FromBlock types.BlockNumber `json:"fromBlock"`
	ToBlock   types.BlockNumber `json:"toBlock"`
}

NativeBlockHashBlockRangeFilter is a filter to filter native block hash by block by number

func (*NativeBlockHashBlockRangeFilter) GetNumericBlockNumbers added in v0.0.990

func (f *NativeBlockHashBlockRangeFilter) GetNumericBlockNumbers(ctx context.Context, cfg Config, s types.StateInterface, e types.EthermanInterface, dbTx pgx.Tx) (uint64, uint64, types.Error)

GetNumericBlockNumbers load the numeric block numbers from state accordingly to the provided from and to block number

type NetEndpoints

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

NetEndpoints contains implementations for the "net" RPC endpoints

func NewNetEndpoints added in v0.0.990

func NewNetEndpoints(cfg Config, chainID uint64) *NetEndpoints

NewNetEndpoints returns NetEndpoints

func (*NetEndpoints) Version

func (n *NetEndpoints) Version() (interface{}, types.Error)

Version returns the current network id

type Server

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

Server is an API backend to handle RPC requests

func NewServer

func NewServer(
	cfg Config,
	chainID uint64,
	p types.PoolInterface,
	s types.StateInterface,
	storage storageInterface,
	services []Service,
) *Server

NewServer returns the JsonRPC server

func (*Server) Start

func (s *Server) Start() error

Start initializes the JSON RPC server to listen for request

func (*Server) Stop

func (s *Server) Stop() error

Stop shutdown the rpc server

type Service added in v0.0.990

type Service struct {
	Name    string
	Service interface{}
}

Service defines a struct that will provide public methods to be exposed by the RPC server as endpoints, the endpoints will be prefixed with the value in the Name property followed by an underscore and the method name starting with a lower case char, resulting in a mix of snake case and camel case, for example:

A service with name `eth` and with a public method BlockNumber() will allow the RPC server to expose this method as `eth_blockNumber`.

type Storage

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

Storage uses memory to store the data related to the json rpc server

func NewStorage

func NewStorage() *Storage

NewStorage creates and initializes an instance of Storage

func (*Storage) GetAllBlockFiltersWithWSConn

func (s *Storage) GetAllBlockFiltersWithWSConn() []*Filter

GetAllBlockFiltersWithWSConn returns an array with all filter that have a web socket connection and are filtering by new blocks

func (*Storage) GetAllLogFiltersWithWSConn

func (s *Storage) GetAllLogFiltersWithWSConn() []*Filter

GetAllLogFiltersWithWSConn returns an array with all filter that have a web socket connection and are filtering by new logs

func (*Storage) GetFilter

func (s *Storage) GetFilter(filterID string) (*Filter, error)

GetFilter gets a filter by its id

func (*Storage) NewBlockFilter

func (s *Storage) NewBlockFilter(wsConn *concurrentWsConn) (string, error)

NewBlockFilter persists a new block log filter

func (*Storage) NewLogFilter

func (s *Storage) NewLogFilter(wsConn *concurrentWsConn, filter LogFilter) (string, error)

NewLogFilter persists a new log filter

func (*Storage) NewPendingTransactionFilter

func (s *Storage) NewPendingTransactionFilter(wsConn *concurrentWsConn) (string, error)

NewPendingTransactionFilter persists a new pending transaction filter

func (*Storage) UninstallFilter

func (s *Storage) UninstallFilter(filterID string) error

UninstallFilter deletes a filter by its id

func (*Storage) UninstallFilterByWSConn

func (s *Storage) UninstallFilterByWSConn(wsConn *concurrentWsConn) error

UninstallFilterByWSConn deletes all filters connected to the provided web socket connection

func (*Storage) UpdateFilterLastPoll

func (s *Storage) UpdateFilterLastPoll(filterID string) error

UpdateFilterLastPoll updates the last poll to now

type TxPoolEndpoints

type TxPoolEndpoints struct{}

TxPoolEndpoints is the txpool jsonrpc endpoint

func (*TxPoolEndpoints) Content

func (e *TxPoolEndpoints) Content() (interface{}, types.Error)

Content creates a response for txpool_content request. See https://geth.ethereum.org/docs/rpc/ns-txpool#txpool_content.

type Web3Endpoints

type Web3Endpoints struct {
}

Web3Endpoints contains implementations for the "web3" RPC endpoints

func (*Web3Endpoints) ClientVersion

func (e *Web3Endpoints) ClientVersion() (interface{}, types.Error)

ClientVersion returns the client version.

func (*Web3Endpoints) Sha3

func (e *Web3Endpoints) Sha3(data types.ArgBig) (interface{}, types.Error)

Sha3 returns the keccak256 hash of the given data.

type WebSocketsConfig

type WebSocketsConfig struct {
	// Enabled defines if the WebSocket requests are enabled or disabled
	Enabled bool `mapstructure:"Enabled"`

	// Host defines the network adapter that will be used to serve the WS requests
	Host string `mapstructure:"Host"`

	// Port defines the port to serve the endpoints via WS
	Port int `mapstructure:"Port"`

	// ReadLimit defines the maximum size of a message read from the client (in bytes)
	ReadLimit int64 `mapstructure:"ReadLimit"`
}

WebSocketsConfig has parameters to config the rpc websocket support

type ZKCountersLimits added in v0.5.13

type ZKCountersLimits struct {
	MaxKeccakHashes     uint32
	MaxPoseidonHashes   uint32
	MaxPoseidonPaddings uint32
	MaxMemAligns        uint32
	MaxArithmetics      uint32
	MaxBinaries         uint32
	MaxSteps            uint32
	MaxSHA256Hashes     uint32
}

ZKCountersLimits defines the ZK Counter limits

type ZKEVMEndpoints

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

ZKEVMEndpoints contains implementations for the "zkevm" RPC endpoints

func NewZKEVMEndpoints added in v0.0.990

func NewZKEVMEndpoints(cfg Config, pool types.PoolInterface, state types.StateInterface, etherman types.EthermanInterface) *ZKEVMEndpoints

NewZKEVMEndpoints returns ZKEVMEndpoints

func (*ZKEVMEndpoints) BatchNumber

func (z *ZKEVMEndpoints) BatchNumber() (interface{}, types.Error)

BatchNumber returns the latest trusted batch number

func (*ZKEVMEndpoints) BatchNumberByBlockNumber

func (z *ZKEVMEndpoints) BatchNumberByBlockNumber(blockNumber types.ArgUint64) (interface{}, types.Error)

BatchNumberByBlockNumber returns the batch number from which the passed block number is created

func (*ZKEVMEndpoints) ConsolidatedBlockNumber

func (z *ZKEVMEndpoints) ConsolidatedBlockNumber() (interface{}, types.Error)

ConsolidatedBlockNumber returns last block number related to the last verified batch

func (*ZKEVMEndpoints) EstimateCounters added in v0.5.13

func (z *ZKEVMEndpoints) EstimateCounters(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

EstimateCounters returns an estimation of the counters that are going to be used while executing this transaction.

func (*ZKEVMEndpoints) EstimateFee added in v0.4.5

func (z *ZKEVMEndpoints) EstimateFee(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

EstimateFee returns an estimate fee for the transaction.

func (*ZKEVMEndpoints) EstimateGasPrice added in v0.5.13

func (z *ZKEVMEndpoints) EstimateGasPrice(arg *types.TxArgs, blockArg *types.BlockNumberOrHash) (interface{}, types.Error)

EstimateGasPrice returns an estimate gas price for the transaction.

func (*ZKEVMEndpoints) GetBatchByNumber

func (z *ZKEVMEndpoints) GetBatchByNumber(batchNumber types.BatchNumber, fullTx bool) (interface{}, types.Error)

GetBatchByNumber returns information about a batch by batch number

func (*ZKEVMEndpoints) GetExitRootsByGER added in v0.5.0

func (z *ZKEVMEndpoints) GetExitRootsByGER(globalExitRoot common.Hash) (interface{}, types.Error)

GetExitRootsByGER returns the exit roots accordingly to the provided Global Exit Root

func (*ZKEVMEndpoints) GetFullBlockByHash added in v0.0.990

func (z *ZKEVMEndpoints) GetFullBlockByHash(hash types.ArgHash, fullTx bool) (interface{}, types.Error)

GetFullBlockByHash returns information about a block by hash

func (*ZKEVMEndpoints) GetFullBlockByNumber added in v0.0.990

func (z *ZKEVMEndpoints) GetFullBlockByNumber(number types.BlockNumber, fullTx bool) (interface{}, types.Error)

GetFullBlockByNumber returns information about a block by block number

func (*ZKEVMEndpoints) GetLatestGlobalExitRoot added in v0.5.0

func (z *ZKEVMEndpoints) GetLatestGlobalExitRoot() (interface{}, types.Error)

GetLatestGlobalExitRoot returns the last global exit root used by l2

func (*ZKEVMEndpoints) GetNativeBlockHashesInRange added in v0.0.990

func (z *ZKEVMEndpoints) GetNativeBlockHashesInRange(filter NativeBlockHashBlockRangeFilter) (interface{}, types.Error)

GetNativeBlockHashesInRange return the state root for the blocks in range

func (*ZKEVMEndpoints) GetTransactionByL2Hash added in v0.5.0

func (z *ZKEVMEndpoints) GetTransactionByL2Hash(hash types.ArgHash) (interface{}, types.Error)

GetTransactionByL2Hash returns a transaction by his l2 hash

func (*ZKEVMEndpoints) GetTransactionReceiptByL2Hash added in v0.5.0

func (z *ZKEVMEndpoints) GetTransactionReceiptByL2Hash(hash types.ArgHash) (interface{}, types.Error)

GetTransactionReceiptByL2Hash returns a transaction receipt by his hash

func (*ZKEVMEndpoints) IsBlockConsolidated

func (z *ZKEVMEndpoints) IsBlockConsolidated(blockNumber types.ArgUint64) (interface{}, types.Error)

IsBlockConsolidated returns the consolidation status of a provided block number

func (*ZKEVMEndpoints) IsBlockVirtualized

func (z *ZKEVMEndpoints) IsBlockVirtualized(blockNumber types.ArgUint64) (interface{}, types.Error)

IsBlockVirtualized returns the virtualization status of a provided block number

func (*ZKEVMEndpoints) VerifiedBatchNumber

func (z *ZKEVMEndpoints) VerifiedBatchNumber() (interface{}, types.Error)

VerifiedBatchNumber returns the latest verified batch number

func (*ZKEVMEndpoints) VirtualBatchNumber

func (z *ZKEVMEndpoints) VirtualBatchNumber() (interface{}, types.Error)

VirtualBatchNumber returns the latest virtualized batch number

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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