Documentation
¶
Overview ¶
Package sources exports a number of clients used to access ethereum chain data.
There are a number of these exported clients used by the op-node: L1Client wraps an RPC client to retrieve L1 ethereum data. L2Client wraps an RPC client to retrieve L2 ethereum data. RollupClient wraps an RPC client to retrieve rollup data. EngineClient extends the L2Client providing engine API bindings.
Internally, the listed clients wrap an EthClient which itself wraps a specified RPC client.
Index ¶
- Variables
- func LimitRPC(c client.RPC, concurrentRequests int) client.RPC
- func ToCallArg(msg ethereum.CallMsg) interface{}
- func ValidRPCProviderKind(value RPCProviderKind) bool
- type BasicRPCReceiptsFetcher
- type BatcherAdminClient
- type BeaconHTTPClient
- func (cl *BeaconHTTPClient) BeaconBlobs(ctx context.Context, slot uint64, hashes []common.Hash) (eth.APIBeaconBlobsResponse, error)
- func (cl *BeaconHTTPClient) BeaconGenesis(ctx context.Context) (eth.APIGenesisResponse, error)
- func (cl *BeaconHTTPClient) ConfigSpec(ctx context.Context) (eth.APIConfigResponse, error)
- func (cl *BeaconHTTPClient) NodeVersion(ctx context.Context) (string, error)
- type BeaconHTTPClientOption
- type BuilderClient
- func (sc *BuilderClient) Cancel(ctx context.Context, jobID seqtypes.BuildJobID) error
- func (sc *BuilderClient) Close()
- func (sc *BuilderClient) CloseJob(id seqtypes.BuildJobID) error
- func (sc *BuilderClient) New(ctx context.Context, builderID seqtypes.BuilderID, opts *seqtypes.BuildOpts) (result seqtypes.BuildJobID, err error)
- func (sc *BuilderClient) Open(ctx context.Context, jobID seqtypes.BuildJobID) error
- func (sc *BuilderClient) Seal(ctx context.Context, jobID seqtypes.BuildJobID) (result work.Block, err error)
- func (sc *BuilderClient) Start(ctx context.Context) error
- func (sc *BuilderClient) Stop(ctx context.Context) error
- type CachingReceiptsProvider
- type ClientPool
- type ControlClient
- func (sc *ControlClient) BuildJob() (result seqtypes.BuildJobID, err error)
- func (sc *ControlClient) Commit(ctx context.Context) error
- func (sc *ControlClient) IncludeTx(ctx context.Context, tx hexutil.Bytes) error
- func (sc *ControlClient) New(ctx context.Context, opts seqtypes.BuildOpts) error
- func (sc *ControlClient) Next(ctx context.Context) error
- func (sc *ControlClient) Open(ctx context.Context) error
- func (sc *ControlClient) PrebuiltEnvelope(ctx context.Context, block *eth.ExecutionPayloadEnvelope) error
- func (sc *ControlClient) Publish(ctx context.Context) error
- func (sc *ControlClient) Seal(ctx context.Context) error
- func (sc *ControlClient) Sign(ctx context.Context) error
- func (sc *ControlClient) Start(ctx context.Context, head common.Hash) error
- func (sc *ControlClient) Stop(ctx context.Context) (result common.Hash, err error)
- type DebugClient
- type EngineAPIClient
- func (s *EngineAPIClient) EngineVersionProvider() EngineVersionProvider
- func (s *EngineAPIClient) ForkchoiceUpdate(ctx context.Context, fc *eth.ForkchoiceState, ...) (*eth.ForkchoiceUpdatedResult, error)
- func (s *EngineAPIClient) GetPayload(ctx context.Context, payloadInfo eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
- func (s *EngineAPIClient) NewPayload(ctx context.Context, payload *eth.ExecutionPayload, ...) (*eth.PayloadStatusV1, error)
- type EngineClient
- type EngineClientConfig
- type EngineVersionProvider
- type EthClient
- func (s *EthClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (s *EthClient) BlockRefByHash(ctx context.Context, hash common.Hash) (eth.BlockRef, error)
- func (s *EthClient) BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockRef, error)
- func (s *EthClient) BlockRefByNumber(ctx context.Context, num uint64) (eth.BlockRef, error)
- func (s *EthClient) Call(ctx context.Context, msg ethereum.CallMsg, blockNumber rpc.BlockNumber) ([]byte, error)
- func (s *EthClient) ChainID(ctx context.Context) (*big.Int, error)
- func (s *EthClient) Close()
- func (s *EthClient) CodeAtHash(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
- func (s *EthClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (s *EthClient) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
- func (s *EthClient) FetchReceiptsByNumber(ctx context.Context, number uint64) (eth.BlockInfo, types.Receipts, error)
- func (s *EthClient) GetProof(ctx context.Context, address common.Address, storage []common.Hash, ...) (*eth.AccountResult, error)
- func (s *EthClient) GetStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, ...) (common.Hash, error)
- func (s *EthClient) HeaderAndTxsByHash(ctx context.Context, hash common.Hash) (*types.Header, types.Transactions, error)
- func (s *EthClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (s *EthClient) HeaderByLabel(ctx context.Context, label eth.BlockLabel) (*types.Header, error)
- func (s *EthClient) HeaderByNumber(ctx context.Context, number uint64) (*types.Header, error)
- func (s *EthClient) InfoAndTxsByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, types.Transactions, error)
- func (s *EthClient) InfoAndTxsByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, types.Transactions, error)
- func (s *EthClient) InfoAndTxsByNumber(ctx context.Context, number uint64) (eth.BlockInfo, types.Transactions, error)
- func (s *EthClient) InfoByHash(ctx context.Context, hash common.Hash) (eth.BlockInfo, error)
- func (s *EthClient) InfoByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, error)
- func (s *EthClient) InfoByNumber(ctx context.Context, number uint64) (eth.BlockInfo, error)
- func (s *EthClient) NewMultiCaller(batchSize int) *batching.MultiCaller
- func (s *EthClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (s *EthClient) PayloadByHash(ctx context.Context, hash common.Hash) (*eth.ExecutionPayloadEnvelope, error)
- func (s *EthClient) PayloadByLabel(ctx context.Context, label eth.BlockLabel) (*eth.ExecutionPayloadEnvelope, error)
- func (s *EthClient) PayloadByNumber(ctx context.Context, number uint64) (*eth.ExecutionPayloadEnvelope, error)
- func (s *EthClient) PayloadExecutionWitness(ctx context.Context, parentHash common.Hash, ...) (*eth.ExecutionWitness, error)
- func (s *EthClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (s *EthClient) RPC() client.RPC
- func (s *EthClient) ReadStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, ...) (common.Hash, error)
- func (s *EthClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (s *EthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
- func (s *EthClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (s *EthClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- type EthClientConfig
- type FaucetClient
- type Flashblock
- type FlashblockClient
- type FollowClient
- type FollowStatus
- type InteropFilterClient
- func (cl *InteropFilterClient) CheckAccessList(ctx context.Context, inboxEntries []common.Hash, minSafety safety.Level, ...) error
- func (cl *InteropFilterClient) Close()
- func (cl *InteropFilterClient) GetBlockHashByNumber(ctx context.Context, chainID eth.ChainID, blockNum rpc.BlockNumber) (common.Hash, error)
- type L1BeaconClient
- type L1BeaconClientConfig
- type L1Client
- type L1ClientConfig
- type L2Client
- func (s *L2Client) L2BlockRefByHash(ctx context.Context, hash common.Hash) (eth.L2BlockRef, error)
- func (s *L2Client) L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L2BlockRef, error)
- func (s *L2Client) L2BlockRefByNumber(ctx context.Context, num uint64) (eth.L2BlockRef, error)
- func (s *L2Client) OutputV0AtBlock(ctx context.Context, blockHash common.Hash) (*eth.OutputV0, error)
- func (s *L2Client) OutputV0AtBlockNumber(ctx context.Context, blockNum uint64) (*eth.OutputV0, error)
- func (s *L2Client) RollupConfig() *rollup.Config
- func (s *L2Client) SystemConfigByL2Hash(ctx context.Context, hash common.Hash) (eth.SystemConfig, error)
- type L2ClientConfig
- type OPStackClient
- func (r *OPStackClient) CancelBlock(ctx context.Context, id eth.PayloadInfo) error
- func (r *OPStackClient) Close()
- func (r *OPStackClient) CommitBlock(ctx context.Context, envelope *opsigner.SignedExecutionPayloadEnvelope) error
- func (r *OPStackClient) OpenBlock(ctx context.Context, parent eth.BlockID, attrs *eth.PayloadAttributes) (eth.PayloadInfo, error)
- func (r *OPStackClient) PublishBlock(ctx context.Context, signed *opsigner.SignedExecutionPayloadEnvelope) error
- func (r *OPStackClient) SealBlock(ctx context.Context, id eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
- type P2PClient
- func (pc *P2PClient) BlockAddr(ctx context.Context, ip net.IP) error
- func (pc *P2PClient) BlockPeer(ctx context.Context, p peer.ID) error
- func (pc *P2PClient) BlockSubnet(ctx context.Context, ipnet *net.IPNet) error
- func (pc *P2PClient) ConnectPeer(ctx context.Context, addr string) error
- func (pc *P2PClient) DisconnectPeer(ctx context.Context, id peer.ID) error
- func (pc *P2PClient) DiscoveryTable(ctx context.Context) ([]*enode.Node, error)
- func (pc *P2PClient) ListBlockedAddrs(ctx context.Context) ([]net.IP, error)
- func (pc *P2PClient) ListBlockedPeers(ctx context.Context) ([]peer.ID, error)
- func (pc *P2PClient) ListBlockedSubnets(ctx context.Context) ([]*net.IPNet, error)
- func (pc *P2PClient) PeerStats(ctx context.Context) (*apis.PeerStats, error)
- func (pc *P2PClient) Peers(ctx context.Context, connected bool) (*apis.PeerDump, error)
- func (pc *P2PClient) ProtectPeer(ctx context.Context, p peer.ID) error
- func (pc *P2PClient) Self(ctx context.Context) (*apis.PeerInfo, error)
- func (pc *P2PClient) UnblockAddr(ctx context.Context, ip net.IP) error
- func (pc *P2PClient) UnblockPeer(ctx context.Context, p peer.ID) error
- func (pc *P2PClient) UnblockSubnet(ctx context.Context, ipnet *net.IPNet) error
- func (pc *P2PClient) UnprotectPeer(ctx context.Context, p peer.ID) error
- type RPCBlock
- type RPCHeader
- type RPCProviderKind
- type RPCReceiptsConfig
- type RPCReceiptsFetcher
- func (f *RPCReceiptsFetcher) FetchReceipts(ctx context.Context, blockInfo eth.BlockInfo, txHashes []common.Hash) (result types.Receipts, err error)
- func (f *RPCReceiptsFetcher) OnReceiptsMethodErr(m ReceiptsFetchingMethod, err error)
- func (f *RPCReceiptsFetcher) PickReceiptsMethod(txCount int) ReceiptsFetchingMethod
- type ReceiptsFetchingMethod
- type ReceiptsProvider
- type RollupClient
- func (r *RollupClient) Close()
- func (r *RollupClient) ConductorEnabled(ctx context.Context) (bool, error)
- func (r *RollupClient) DependencySet(ctx context.Context) (depset.DependencySet, error)
- func (r *RollupClient) OutputAtBlock(ctx context.Context, blockNum uint64) (*eth.OutputResponse, error)
- func (r *RollupClient) OverrideLeader(ctx context.Context) error
- func (r *RollupClient) PostUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
- func (r *RollupClient) RollupConfig(ctx context.Context) (*rollup.Config, error)
- func (r *RollupClient) SafeHeadAtL1Block(ctx context.Context, blockNum uint64) (*eth.SafeHeadResponse, error)
- func (r *RollupClient) SdmStatus(ctx context.Context) (apis.SdmStatus, error)
- func (r *RollupClient) SequencerActive(ctx context.Context) (bool, error)
- func (r *RollupClient) SetLogLevel(ctx context.Context, lvl slog.Level) error
- func (r *RollupClient) SetRecoverMode(ctx context.Context, mode bool) error
- func (r *RollupClient) SetSdmPostExecOptIn(ctx context.Context, enabled bool) error
- func (r *RollupClient) StartSequencer(ctx context.Context, unsafeHead common.Hash) error
- func (r *RollupClient) StopSequencer(ctx context.Context) (common.Hash, error)
- func (r *RollupClient) SyncStatus(ctx context.Context) (*eth.SyncStatus, error)
- func (r *RollupClient) Version(ctx context.Context) (string, error)
- type SuperNodeClient
- type SyncTesterClient
- func (cl *SyncTesterClient) ChainID(ctx context.Context) (eth.ChainID, error)
- func (cl *SyncTesterClient) DeleteSession(ctx context.Context) error
- func (cl *SyncTesterClient) GetSession(ctx context.Context) (*eth.SyncTesterSession, error)
- func (cl *SyncTesterClient) ListSessions(ctx context.Context) ([]string, error)
- func (cl *SyncTesterClient) ResetSession(ctx context.Context) error
- type TimeToSlotFn
- type WebsocketReader
Constants ¶
This section is empty.
Variables ¶
var P2PNamespaceRPC = "opp2p"
var RPCProviderKinds = []RPCProviderKind{ RPCKindAlchemy, RPCKindQuickNode, RPCKindInfura, RPCKindParity, RPCKindNethermind, RPCKindDebugGeth, RPCKindErigon, RPCKindBasic, RPCKindAny, RPCKindStandard, }
Functions ¶
func LimitRPC ¶
LimitRPC limits concurrent RPC requests (excluding subscriptions) to a given number by wrapping the client with a semaphore.
func ValidRPCProviderKind ¶
func ValidRPCProviderKind(value RPCProviderKind) bool
Types ¶
type BasicRPCReceiptsFetcher ¶
type BasicRPCReceiptsFetcher struct {
// contains filtered or unexported fields
}
func NewBasicRPCReceiptsFetcher ¶
func NewBasicRPCReceiptsFetcher(client rpcClient, maxBatchSize int) *BasicRPCReceiptsFetcher
func (*BasicRPCReceiptsFetcher) FetchReceipts ¶
func (f *BasicRPCReceiptsFetcher) FetchReceipts(ctx context.Context, blockInfo eth.BlockInfo, txHashes []common.Hash) (types.Receipts, error)
FetchReceipts fetches receipts for the given block and transaction hashes it does not validate receipts, and expects the caller to do so
type BatcherAdminClient ¶
type BatcherAdminClient struct {
// contains filtered or unexported fields
}
func NewBatcherAdminClient ¶
func NewBatcherAdminClient(client client.RPC) *BatcherAdminClient
func (*BatcherAdminClient) FlushBatcher ¶
func (cl *BatcherAdminClient) FlushBatcher(ctx context.Context) error
func (*BatcherAdminClient) StartBatcher ¶
func (cl *BatcherAdminClient) StartBatcher(ctx context.Context) error
func (*BatcherAdminClient) StopBatcher ¶
func (cl *BatcherAdminClient) StopBatcher(ctx context.Context) error
type BeaconHTTPClient ¶
type BeaconHTTPClient struct {
// contains filtered or unexported fields
}
BeaconHTTPClient implements BeaconClient. It provides golang types over the basic Beacon API.
func NewBeaconHTTPClient ¶
func NewBeaconHTTPClient(cl client.HTTP, opts ...BeaconHTTPClientOption) *BeaconHTTPClient
func (*BeaconHTTPClient) BeaconBlobs ¶
func (cl *BeaconHTTPClient) BeaconBlobs(ctx context.Context, slot uint64, hashes []common.Hash) (eth.APIBeaconBlobsResponse, error)
func (*BeaconHTTPClient) BeaconGenesis ¶
func (cl *BeaconHTTPClient) BeaconGenesis(ctx context.Context) (eth.APIGenesisResponse, error)
func (*BeaconHTTPClient) ConfigSpec ¶
func (cl *BeaconHTTPClient) ConfigSpec(ctx context.Context) (eth.APIConfigResponse, error)
func (*BeaconHTTPClient) NodeVersion ¶
func (cl *BeaconHTTPClient) NodeVersion(ctx context.Context) (string, error)
type BeaconHTTPClientOption ¶ added in v1.17.0
type BeaconHTTPClientOption func(*BeaconHTTPClient)
func WithSlotDurationOverride ¶ added in v1.17.0
func WithSlotDurationOverride(slotDuration uint64) BeaconHTTPClientOption
WithSlotDurationOverride makes ConfigSpec return a synthesized response with the given SECONDS_PER_SLOT value instead of issuing an HTTP request to the beacon /eth/v1/config/spec endpoint. A value of 0 leaves the default behavior unchanged.
type BuilderClient ¶
type BuilderClient struct {
// contains filtered or unexported fields
}
func NewBuilderClient ¶
func NewBuilderClient(client client.RPC) *BuilderClient
func (*BuilderClient) Cancel ¶
func (sc *BuilderClient) Cancel(ctx context.Context, jobID seqtypes.BuildJobID) error
func (*BuilderClient) Close ¶
func (sc *BuilderClient) Close()
func (*BuilderClient) CloseJob ¶
func (sc *BuilderClient) CloseJob(id seqtypes.BuildJobID) error
func (*BuilderClient) New ¶
func (sc *BuilderClient) New(ctx context.Context, builderID seqtypes.BuilderID, opts *seqtypes.BuildOpts) (result seqtypes.BuildJobID, err error)
func (*BuilderClient) Open ¶
func (sc *BuilderClient) Open(ctx context.Context, jobID seqtypes.BuildJobID) error
func (*BuilderClient) Seal ¶
func (sc *BuilderClient) Seal(ctx context.Context, jobID seqtypes.BuildJobID) (result work.Block, err error)
type CachingReceiptsProvider ¶
type CachingReceiptsProvider struct {
// contains filtered or unexported fields
}
A CachingReceiptsProvider caches successful receipt fetches from the inner ReceiptsProvider. It also avoids duplicate in-flight requests per block hash.
func NewCachingRPCReceiptsProvider ¶
func NewCachingRPCReceiptsProvider(client rpcClient, log log.Logger, config RPCReceiptsConfig, m caching.Metrics, cacheSize int) *CachingReceiptsProvider
func NewCachingReceiptsProvider ¶
func NewCachingReceiptsProvider(inner ReceiptsProvider, m caching.Metrics, cacheSize int) *CachingReceiptsProvider
func (*CachingReceiptsProvider) FetchReceipts ¶
func (p *CachingReceiptsProvider) FetchReceipts(ctx context.Context, blockInfo eth.BlockInfo, txHashes []common.Hash) (types.Receipts, error)
FetchReceipts fetches receipts for the given block and transaction hashes it expects that the inner FetchReceipts implementation handles validation
type ClientPool ¶
type ClientPool[T any] struct { // contains filtered or unexported fields }
func NewClientPool ¶
func NewClientPool[T any](clients ...T) *ClientPool[T]
func (*ClientPool[T]) Get ¶
func (p *ClientPool[T]) Get() T
func (*ClientPool[T]) Len ¶
func (p *ClientPool[T]) Len() int
func (*ClientPool[T]) MoveToNext ¶
func (p *ClientPool[T]) MoveToNext()
type ControlClient ¶
type ControlClient struct {
// contains filtered or unexported fields
}
func NewControlClient ¶
func NewControlClient(client client.RPC) *ControlClient
func (*ControlClient) BuildJob ¶
func (sc *ControlClient) BuildJob() (result seqtypes.BuildJobID, err error)
func (*ControlClient) PrebuiltEnvelope ¶
func (sc *ControlClient) PrebuiltEnvelope(ctx context.Context, block *eth.ExecutionPayloadEnvelope) error
type DebugClient ¶
type DebugClient struct {
// contains filtered or unexported fields
}
func NewDebugClient ¶
func NewDebugClient(callContext batching.CallContextFn) *DebugClient
func (*DebugClient) CodeByHash ¶
func (*DebugClient) NodeByHash ¶
type EngineAPIClient ¶
EngineAPIClient is an RPC client for the Engine API functions.
func NewEngineAPIClient ¶
func NewEngineAPIClient(rpc client.RPC, l log.Logger, evp EngineVersionProvider) *EngineAPIClient
func (*EngineAPIClient) EngineVersionProvider ¶
func (s *EngineAPIClient) EngineVersionProvider() EngineVersionProvider
EngineVersionProvider returns the underlying engine version provider used for resolving the correct Engine API versions.
func (*EngineAPIClient) ForkchoiceUpdate ¶
func (s *EngineAPIClient) ForkchoiceUpdate(ctx context.Context, fc *eth.ForkchoiceState, attributes *eth.PayloadAttributes) (*eth.ForkchoiceUpdatedResult, error)
ForkchoiceUpdate updates the forkchoice on the execution client. If attributes is not nil, the engine client will also begin building a block based on attributes after the new head block and return the payload ID. It's the caller's responsibility to check the error type, and in case of an rpc.Error, check the ErrorCode.
func (*EngineAPIClient) GetPayload ¶
func (s *EngineAPIClient) GetPayload(ctx context.Context, payloadInfo eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
GetPayload gets the execution payload associated with the PayloadId. It's the caller's responsibility to check the error type, and in case of an rpc.Error, check the ErrorCode.
func (*EngineAPIClient) NewPayload ¶
func (s *EngineAPIClient) NewPayload(ctx context.Context, payload *eth.ExecutionPayload, parentBeaconBlockRoot *common.Hash) (*eth.PayloadStatusV1, error)
NewPayload executes a full block on the execution engine. This returns a PayloadStatusV1 which encodes any validation/processing error, and this type of error is kept separate from the returned `error` used for RPC errors, like timeouts.
type EngineClient ¶
type EngineClient struct {
*L2Client
*EngineAPIClient
}
EngineClient extends L2Client with engine API bindings.
func NewEngineClient ¶
func NewEngineClient(client client.RPC, log log.Logger, metrics caching.Metrics, config *EngineClientConfig) (*EngineClient, error)
type EngineClientConfig ¶
type EngineClientConfig struct {
L2ClientConfig
}
func EngineClientDefaultConfig ¶
func EngineClientDefaultConfig(config *rollup.Config) *EngineClientConfig
type EngineVersionProvider ¶
type EngineVersionProvider interface {
ForkchoiceUpdatedVersion(attr *eth.PayloadAttributes) eth.EngineAPIMethod
NewPayloadVersion(timestamp uint64) eth.EngineAPIMethod
GetPayloadVersion(timestamp uint64) eth.EngineAPIMethod
}
type EthClient ¶
type EthClient struct {
// contains filtered or unexported fields
}
EthClient retrieves ethereum data with optimized batch requests, cached results, and flag to not trust the RPC.
func NewEthClient ¶
func NewEthClient(client client.RPC, log log.Logger, metrics caching.Metrics, config *EthClientConfig) (*EthClient, error)
NewEthClient returns an EthClient, wrapping an RPC with bindings to fetch ethereum data with added error logging, metric tracking, and caching. The EthClient uses a LimitRPC wrapper to limit the number of concurrent RPC requests.
func (*EthClient) BalanceAt ¶
func (s *EthClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt returns the wei balance of the given account.
func (*EthClient) BlockRefByHash ¶
BlockRefByHash returns the eth.BlockRef for the given block hash. We cache the block reference by hash as it is safe to assume collision will not occur.
func (*EthClient) BlockRefByLabel ¶
func (s *EthClient) BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockRef, error)
BlockRefByLabel returns the eth.BlockRef for the given block label. Notice, we cannot cache a block reference by label because labels are not guaranteed to be unique.
func (*EthClient) BlockRefByNumber ¶
BlockRefByNumber returns an eth.BlockRef for the given block number. Notice, we cannot cache a block reference by number because L1 re-orgs can invalidate the cached block reference.
func (*EthClient) Call ¶
func (s *EthClient) Call(ctx context.Context, msg ethereum.CallMsg, blockNumber rpc.BlockNumber) ([]byte, error)
Call executes a message call transaction but never mined into the blockchain.
func (*EthClient) CodeAtHash ¶
func (s *EthClient) CodeAtHash(ctx context.Context, account common.Address, blockHash common.Hash) ([]byte, error)
CodeAtHash returns the contract code of the given account.
func (*EthClient) EstimateGas ¶
EstimateGas tries to estimate the gas needed to execute a specific transaction.
func (*EthClient) FetchReceipts ¶
func (s *EthClient) FetchReceipts(ctx context.Context, blockHash common.Hash) (eth.BlockInfo, types.Receipts, error)
FetchReceipts returns a block info and all of the receipts associated with transactions in the block. It verifies the receipt hash in the block header against the receipt hash of the fetched receipts to ensure that the execution engine did not fail to return any receipts.
func (*EthClient) FetchReceiptsByNumber ¶
func (s *EthClient) FetchReceiptsByNumber(ctx context.Context, number uint64) (eth.BlockInfo, types.Receipts, error)
FetchReceiptsByNumber returns a block info and all of the receipts associated with transactions in the block. It fetches the block hash and calls FetchReceipts.
func (*EthClient) GetProof ¶
func (s *EthClient) GetProof(ctx context.Context, address common.Address, storage []common.Hash, blockTag string) (*eth.AccountResult, error)
GetProof returns an account proof result, with any optional requested storage proofs. The retrieval does sanity-check that storage proofs for the expected keys are present in the response, but does not verify the result. Call accountResult.Verify(stateRoot) to verify the result.
func (*EthClient) GetStorageAt ¶
func (s *EthClient) GetStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, blockTag string) (common.Hash, error)
GetStorageAt returns the storage value at the given address and storage slot, **without verifying the correctness of the result**. This should only ever be used as alternative to GetProof when the user opts in. E.g. Erigon L1 node users may have to use this, since Erigon does not support eth_getProof, see https://github.com/ledgerwatch/erigon/issues/1349
func (*EthClient) HeaderAndTxsByHash ¶ added in v1.18.0
func (s *EthClient) HeaderAndTxsByHash(ctx context.Context, hash common.Hash) (*types.Header, types.Transactions, error)
HeaderAndTxsByHash returns the *types.Header and transactions for the given block hash. Source of truth for block fetching: HeaderAndTxs* and InfoAndTxs* both flow through this and blockCall.
func (*EthClient) HeaderByHash ¶ added in v1.18.0
HeaderByHash returns the *types.Header for the given block hash. It is the source of truth for header fetching: HeaderBy* and InfoBy* both flow through the same headersCache + headerCall path.
func (*EthClient) HeaderByLabel ¶ added in v1.18.0
HeaderByLabel returns the *types.Header for the given block label.
func (*EthClient) HeaderByNumber ¶ added in v1.18.0
HeaderByNumber returns the *types.Header for the given block number.
func (*EthClient) InfoAndTxsByHash ¶
func (*EthClient) InfoAndTxsByLabel ¶
func (s *EthClient) InfoAndTxsByLabel(ctx context.Context, label eth.BlockLabel) (eth.BlockInfo, types.Transactions, error)
func (*EthClient) InfoAndTxsByNumber ¶
func (*EthClient) InfoByHash ¶
func (*EthClient) InfoByLabel ¶
func (*EthClient) InfoByNumber ¶
func (*EthClient) NewMultiCaller ¶
func (s *EthClient) NewMultiCaller(batchSize int) *batching.MultiCaller
func (*EthClient) NonceAt ¶
func (s *EthClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAt returns the account nonce of the given account in the state at the given block number. A nil block number may be used to get the latest state.
func (*EthClient) PayloadByHash ¶
func (*EthClient) PayloadByLabel ¶
func (s *EthClient) PayloadByLabel(ctx context.Context, label eth.BlockLabel) (*eth.ExecutionPayloadEnvelope, error)
func (*EthClient) PayloadByNumber ¶
func (*EthClient) PayloadExecutionWitness ¶
func (s *EthClient) PayloadExecutionWitness(ctx context.Context, parentHash common.Hash, payloadAttributes eth.PayloadAttributes) (*eth.ExecutionWitness, error)
PayloadExecutionWitness generates a block from a payload and returns execution witness data.
func (*EthClient) PendingNonceAt ¶
PendingNonceAt returns the account nonce of the given account in the pending state.
func (*EthClient) ReadStorageAt ¶
func (s *EthClient) ReadStorageAt(ctx context.Context, address common.Address, storageSlot common.Hash, blockHash common.Hash) (common.Hash, error)
ReadStorageAt is a convenience method to read a single storage value at the given slot in the given account. The storage slot value is verified against the state-root of the given block if we do not trust the RPC provider, or directly retrieved without proof if we do trust the RPC.
func (*EthClient) SendTransaction ¶
SendTransaction submits a signed transaction.
func (*EthClient) SubscribeNewHead ¶
func (s *EthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
SubscribeNewHead subscribes to notifications about the current blockchain head on the given channel.
func (*EthClient) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
type EthClientConfig ¶
type EthClientConfig struct {
// Maximum number of requests to make per batch
MaxRequestsPerBatch int
// limit concurrent requests, applies to the source as a whole
MaxConcurrentRequests int
// Number of blocks worth of receipts to cache
ReceiptsCacheSize int
// Number of blocks worth of transactions to cache
TransactionsCacheSize int
// Number of block headers to cache
HeadersCacheSize int
// Number of payloads to cache
PayloadsCacheSize int
BlockRefsCacheSize int
// If the RPC is untrusted, then we should not use cached information from responses,
// and instead verify against the block-hash.
// Of real L1 blocks no deposits can be missed/faked, no batches can be missed/faked,
// only the wrong L1 blocks can be retrieved.
TrustRPC bool
// If the RPC must ensure that the results fit the ExecutionPayload(Header) format.
// If this is not checked, disabled header fields like the nonce or difficulty
// may be used to get a different block-hash.
MustBePostMerge bool
// RPCProviderKind is a hint at what type of RPC provider we are dealing with
RPCProviderKind RPCProviderKind
// Method reset duration defines how long we stick to available RPC methods,
// till we re-attempt the user-preferred methods.
// If this is 0 then the client does not fall back to less optimal but available methods.
MethodResetDuration time.Duration
}
func DefaultEthClientConfig ¶
func DefaultEthClientConfig(cacheSize int) *EthClientConfig
DefaultEthClientConfig creates a new eth client config, with caching of data using the given cache-size (in number of blocks).
func (*EthClientConfig) Check ¶
func (c *EthClientConfig) Check() error
type FaucetClient ¶
type FaucetClient struct {
// contains filtered or unexported fields
}
func NewFaucetClient ¶
func NewFaucetClient(client client.RPC) *FaucetClient
func (*FaucetClient) RequestETH ¶
type Flashblock ¶
type Flashblock struct {
PayloadID string `json:"payload_id"`
Index int `json:"index"`
Diff struct {
StateRoot string `json:"state_root"`
ReceiptsRoot string `json:"receipts_root"`
LogsBloom string `json:"logs_bloom"`
GasUsed string `json:"gas_used"`
BlockHash string `json:"block_hash"`
Transactions []any `json:"transactions"`
PostExecTx *hexutil.Bytes `json:"post_exec_tx"`
Withdrawals []any `json:"withdrawals"`
} `json:"diff"`
Metadata struct {
BlockNumber int `json:"block_number"`
NewAccountBalances map[string]string `json:"new_account_balances"`
Receipts map[string]interface{} `json:"receipts"`
} `json:"metadata"`
}
func (*Flashblock) UnmarshalJSON ¶
func (f *Flashblock) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom unmarshaling for Flashblock to lower case the keys of .metadata.new_account_balances.
type FlashblockClient ¶
type FlashblockClient struct {
// contains filtered or unexported fields
}
FlashblockClient wraps a WSClient and delivers parsed Flashblock values on a channel.
func NewFlashblockClient ¶
func NewFlashblockClient(ws WebsocketReader, logger log.Logger, bufferSize uint) *FlashblockClient
NewFlashblockClient creates a new FlashblockClient. Call Start to begin reading.
func (*FlashblockClient) Next ¶
func (c *FlashblockClient) Next() <-chan *Flashblock
Next returns the receive-only channel of parsed flashblocks. A nil value signals that the read loop has exited; the channel is then closed.
func (*FlashblockClient) Start ¶
func (c *FlashblockClient) Start(ctx context.Context) error
Start begins the background read loop. It reads from the websocket until ctx is cancelled, unmarshals each message into a *Flashblock, and sends it on the channel returned by Next. When the loop exits, a nil is sent and the channel is closed.
type FollowClient ¶
type FollowClient struct {
// contains filtered or unexported fields
}
func NewFollowClient ¶
func NewFollowClient(client client.RPC) (*FollowClient, error)
func (*FollowClient) GetFollowStatus ¶
func (s *FollowClient) GetFollowStatus(ctx context.Context) (*FollowStatus, error)
type FollowStatus ¶
type FollowStatus struct {
SafeL2 eth.L2BlockRef
LocalSafeL2 eth.L2BlockRef
FinalizedL2 eth.L2BlockRef
CurrentL1 eth.L1BlockRef
}
type InteropFilterClient ¶ added in v1.19.0
type InteropFilterClient struct {
// contains filtered or unexported fields
}
func NewInteropFilterClient ¶ added in v1.19.0
func NewInteropFilterClient(client client.RPC) *InteropFilterClient
func (*InteropFilterClient) CheckAccessList ¶ added in v1.19.0
func (cl *InteropFilterClient) CheckAccessList(ctx context.Context, inboxEntries []common.Hash, minSafety safety.Level, executingDescriptor messages.ExecutingDescriptor) error
func (*InteropFilterClient) Close ¶ added in v1.19.0
func (cl *InteropFilterClient) Close()
func (*InteropFilterClient) GetBlockHashByNumber ¶ added in v1.19.0
func (cl *InteropFilterClient) GetBlockHashByNumber(ctx context.Context, chainID eth.ChainID, blockNum rpc.BlockNumber) (common.Hash, error)
type L1BeaconClient ¶
type L1BeaconClient struct {
// contains filtered or unexported fields
}
L1BeaconClient is a high level golang client for the Beacon API.
func NewL1BeaconClient ¶
func NewL1BeaconClient(cl apis.BeaconClient, cfg L1BeaconClientConfig, fallbacks ...apis.BeaconClient) *L1BeaconClient
NewL1BeaconClient returns a client for making requests to an L1 consensus layer node. Fallbacks are optional clients that will be used for fetching blobs. L1BeaconClient will rotate between the `cl` and the fallbacks whenever a client runs into an error while fetching blobs.
func (*L1BeaconClient) GetBlobsByHash ¶
func (cl *L1BeaconClient) GetBlobsByHash(ctx context.Context, time uint64, hashes []common.Hash) ([]*eth.Blob, error)
GetBlobsByHash fetches blobs that were confirmed at the given timestamp with the given versioned hashes. The order of the returned blobs will match the order of `hashes`. Confirms each blob's validity by recomputing the commitment and confirming the commitment hashes to the expected value. Returns error if any blob is found invalid.
func (*L1BeaconClient) GetVersion ¶
func (cl *L1BeaconClient) GetVersion(ctx context.Context) (string, error)
GetVersion fetches the version of the Beacon-node.
type L1BeaconClientConfig ¶
type L1BeaconClientConfig struct {
FetchAllSidecars bool
}
type L1Client ¶
type L1Client struct {
*EthClient
}
L1Client provides typed bindings to retrieve L1 data from an RPC source, with optimized batch requests, cached results, and flag to not trust the RPC (i.e. to verify all returned contents against corresponding block hashes).
func NewL1Client ¶
func NewL1Client(client client.RPC, log log.Logger, metrics caching.Metrics, config *L1ClientConfig) (*L1Client, error)
NewL1Client wraps a RPC with bindings to fetch L1 data, while logging errors, tracking metrics (optional), and caching.
func (*L1Client) L1BlockRefByHash ¶
L1BlockRefByHash returns the eth.L1BlockRef for the given block hash. We cache the block reference by hash as it is safe to assume collision will not occur.
func (*L1Client) L1BlockRefByLabel ¶
func (s *L1Client) L1BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L1BlockRef, error)
L1BlockRefByLabel returns the eth.L1BlockRef for the given block label. Notice, we cannot cache a block reference by label because labels are not guaranteed to be unique.
func (*L1Client) L1BlockRefByNumber ¶
L1BlockRefByNumber returns an eth.L1BlockRef for the given block number. Notice, we cannot cache a block reference by number because L1 re-orgs can invalidate the cached block reference.
type L1ClientConfig ¶
type L1ClientConfig struct {
EthClientConfig
}
func L1ClientDefaultConfig ¶
func L1ClientDefaultConfig(config *rollup.Config, trustRPC bool, kind RPCProviderKind) *L1ClientConfig
func L1ClientSimpleConfig ¶
func L1ClientSimpleConfig(trustRPC bool, kind RPCProviderKind, cacheSize int) *L1ClientConfig
type L2Client ¶
type L2Client struct {
*EthClient
// contains filtered or unexported fields
}
L2Client extends EthClient with functions to fetch and cache eth.L2BlockRef values.
func NewL2Client ¶
func NewL2Client(client client.RPC, log log.Logger, metrics caching.Metrics, config *L2ClientConfig) (*L2Client, error)
NewL2Client constructs a new L2Client instance. The L2Client is a thin wrapper around the EthClient with added functions for fetching and caching eth.L2BlockRef values. This includes fetching an L2BlockRef by block number, label, or hash. See: [L2BlockRefByLabel], [L2BlockRefByNumber], [L2BlockRefByHash]
func (*L2Client) L2BlockRefByHash ¶
L2BlockRefByHash returns the eth.L2BlockRef for the given block hash. The returned BlockRef may not be in the canonical chain.
func (*L2Client) L2BlockRefByLabel ¶
func (s *L2Client) L2BlockRefByLabel(ctx context.Context, label eth.BlockLabel) (eth.L2BlockRef, error)
L2BlockRefByLabel returns the eth.L2BlockRef for the given block label.
func (*L2Client) L2BlockRefByNumber ¶
L2BlockRefByNumber returns the eth.L2BlockRef for the given block number.
func (*L2Client) OutputV0AtBlock ¶
func (*L2Client) OutputV0AtBlockNumber ¶
func (*L2Client) RollupConfig ¶
func (*L2Client) SystemConfigByL2Hash ¶
func (s *L2Client) SystemConfigByL2Hash(ctx context.Context, hash common.Hash) (eth.SystemConfig, error)
SystemConfigByL2Hash returns the eth.SystemConfig (matching the config updates up to and including the L1 origin) for the given L2 block hash. The returned eth.SystemConfig may not be in the canonical chain when the hash is not canonical.
type L2ClientConfig ¶
type L2ClientConfig struct {
EthClientConfig
L2BlockRefsCacheSize int
L1ConfigsCacheSize int
FetchWithdrawalRootFromState bool
RollupCfg *rollup.Config
}
func L2ClientDefaultConfig ¶
func L2ClientDefaultConfig(config *rollup.Config, trustRPC bool) *L2ClientConfig
func L2ClientSimpleConfig ¶
func L2ClientSimpleConfig(config *rollup.Config, trustRPC bool, span, fullSpan int) *L2ClientConfig
type OPStackClient ¶
type OPStackClient struct {
// contains filtered or unexported fields
}
func NewOPStackClient ¶
func NewOPStackClient(rpc client.RPC) *OPStackClient
func (*OPStackClient) CancelBlock ¶
func (r *OPStackClient) CancelBlock(ctx context.Context, id eth.PayloadInfo) error
func (*OPStackClient) Close ¶
func (r *OPStackClient) Close()
func (*OPStackClient) CommitBlock ¶
func (r *OPStackClient) CommitBlock(ctx context.Context, envelope *opsigner.SignedExecutionPayloadEnvelope) error
func (*OPStackClient) OpenBlock ¶
func (r *OPStackClient) OpenBlock(ctx context.Context, parent eth.BlockID, attrs *eth.PayloadAttributes) (eth.PayloadInfo, error)
func (*OPStackClient) PublishBlock ¶
func (r *OPStackClient) PublishBlock(ctx context.Context, signed *opsigner.SignedExecutionPayloadEnvelope) error
func (*OPStackClient) SealBlock ¶
func (r *OPStackClient) SealBlock(ctx context.Context, id eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error)
type P2PClient ¶
type P2PClient struct {
// contains filtered or unexported fields
}
func NewP2PClient ¶
func (*P2PClient) BlockSubnet ¶
func (*P2PClient) ConnectPeer ¶
func (*P2PClient) DisconnectPeer ¶
func (*P2PClient) DiscoveryTable ¶
func (*P2PClient) ListBlockedAddrs ¶
func (*P2PClient) ListBlockedPeers ¶
func (*P2PClient) ListBlockedSubnets ¶
func (*P2PClient) ProtectPeer ¶
func (*P2PClient) UnblockAddr ¶
func (*P2PClient) UnblockPeer ¶
func (*P2PClient) UnblockSubnet ¶
type RPCBlock ¶
type RPCBlock struct {
RPCHeader
Transactions []*types.Transaction `json:"transactions"`
Withdrawals *types.Withdrawals `json:"withdrawals,omitempty"`
}
func (*RPCBlock) ExecutionPayloadEnvelope ¶
func (block *RPCBlock) ExecutionPayloadEnvelope(trustCache bool) (*eth.ExecutionPayloadEnvelope, error)
type RPCHeader ¶
type RPCHeader struct {
ParentHash common.Hash `json:"parentHash"`
UncleHash common.Hash `json:"sha3Uncles"`
Coinbase common.Address `json:"miner"`
Root common.Hash `json:"stateRoot"`
TxHash common.Hash `json:"transactionsRoot"`
ReceiptHash common.Hash `json:"receiptsRoot"`
Bloom eth.Bytes256 `json:"logsBloom"`
Difficulty hexutil.Big `json:"difficulty"`
Number hexutil.Uint64 `json:"number"`
GasLimit hexutil.Uint64 `json:"gasLimit"`
GasUsed hexutil.Uint64 `json:"gasUsed"`
Time hexutil.Uint64 `json:"timestamp"`
Extra hexutil.Bytes `json:"extraData"`
MixDigest common.Hash `json:"mixHash"`
Nonce types.BlockNonce `json:"nonce"`
// BaseFee was added by EIP-1559 and is ignored in legacy headers.
BaseFee *hexutil.Big `json:"baseFeePerGas"`
// WithdrawalsRoot was added by EIP-4895 and is ignored in legacy headers.
WithdrawalsRoot *common.Hash `json:"withdrawalsRoot,omitempty"`
// BlobGasUsed was added by EIP-4844 and is ignored in legacy headers.
BlobGasUsed *hexutil.Uint64 `json:"blobGasUsed,omitempty"`
// ExcessBlobGas was added by EIP-4844 and is ignored in legacy headers.
ExcessBlobGas *hexutil.Uint64 `json:"excessBlobGas,omitempty"`
// ParentBeaconRoot was added by EIP-4788 and is ignored in legacy headers.
ParentBeaconRoot *common.Hash `json:"parentBeaconBlockRoot,omitempty"`
// RequestsHash was added by EIP-7685 and is ignored in legacy headers.
RequestsHash *common.Hash `json:"requestsHash,omitempty" rlp:"optional"`
// untrusted info included by RPC, may have to be checked
Hash common.Hash `json:"hash"`
}
func (*RPCHeader) CreateGethHeader ¶
type RPCProviderKind ¶
type RPCProviderKind string
RPCProviderKind identifies an RPC provider, used to hint at the optimal receipt fetching approach.
const ( RPCKindAlchemy RPCProviderKind = "alchemy" RPCKindQuickNode RPCProviderKind = "quicknode" RPCKindInfura RPCProviderKind = "infura" RPCKindParity RPCProviderKind = "parity" RPCKindNethermind RPCProviderKind = "nethermind" RPCKindDebugGeth RPCProviderKind = "debug_geth" RPCKindErigon RPCProviderKind = "erigon" RPCKindBasic RPCProviderKind = "basic" // try only the standard most basic receipt fetching RPCKindAny RPCProviderKind = "any" // try any method available RPCKindStandard RPCProviderKind = "standard" // try standard methods, including newer optimized standard RPC methods )
func (*RPCProviderKind) Clone ¶
func (kind *RPCProviderKind) Clone() any
func (*RPCProviderKind) Set ¶
func (kind *RPCProviderKind) Set(value string) error
func (RPCProviderKind) String ¶
func (kind RPCProviderKind) String() string
type RPCReceiptsConfig ¶
type RPCReceiptsConfig struct {
MaxBatchSize int
ProviderKind RPCProviderKind
MethodResetDuration time.Duration
}
type RPCReceiptsFetcher ¶
type RPCReceiptsFetcher struct {
// contains filtered or unexported fields
}
func NewRPCReceiptsFetcher ¶
func NewRPCReceiptsFetcher(client rpcClient, log log.Logger, config RPCReceiptsConfig) *RPCReceiptsFetcher
func (*RPCReceiptsFetcher) FetchReceipts ¶
func (*RPCReceiptsFetcher) OnReceiptsMethodErr ¶
func (f *RPCReceiptsFetcher) OnReceiptsMethodErr(m ReceiptsFetchingMethod, err error)
func (*RPCReceiptsFetcher) PickReceiptsMethod ¶
func (f *RPCReceiptsFetcher) PickReceiptsMethod(txCount int) ReceiptsFetchingMethod
type ReceiptsFetchingMethod ¶
type ReceiptsFetchingMethod uint64
ReceiptsFetchingMethod is a bitfield with 1 bit for each receipts fetching type. Depending on errors, tx counts and preferences the code may select different sets of fetching methods.
const ( // EthGetTransactionReceiptBatch is standard per-tx receipt fetching with JSON-RPC batches. // Available in: standard, everywhere. // - Alchemy: 15 CU / tx // - Quicknode: 2 credits / tx // Method: eth_getTransactionReceipt // See: https://ethereum.github.io/execution-apis/api-documentation/ EthGetTransactionReceiptBatch ReceiptsFetchingMethod = 1 << iota // AlchemyGetTransactionReceipts is a special receipt fetching method provided by Alchemy. // Available in: // - Alchemy: 250 CU total // Method: alchemy_getTransactionReceipts // Params: // - object with "blockNumber" or "blockHash" field // Returns: "array of receipts" - docs lie, array is wrapped in a struct with single "receipts" field // See: https://docs.alchemy.com/reference/alchemy-gettransactionreceipts#alchemy_gettransactionreceipts AlchemyGetTransactionReceipts // DebugGetRawReceipts is a debug method from Geth, faster by avoiding serialization and metadata overhead. // Ideal for fast syncing from a local geth node. // Available in: // - Geth: free // - QuickNode: 22 credits maybe? Unknown price, undocumented ("debug_getblockreceipts" exists in table though?) // Method: debug_getRawReceipts // Params: // - string presenting a block number or hash // Returns: list of strings, hex encoded RLP of receipts data. "consensus-encoding of all receipts in a single block" // See: https://geth.ethereum.org/docs/rpc/ns-debug#debug_getrawreceipts DebugGetRawReceipts // ParityGetBlockReceipts is an old parity method, which has been adopted by Nethermind and some RPC providers. // Available in: // - Alchemy: 500 CU total // - QuickNode: 59 credits - docs are wrong, not actually available anymore. // - Any open-ethereum/parity legacy: free // - Nethermind: free // Method: parity_getBlockReceipts // Params: // Parity: "quantity or tag" // Alchemy: string with block hash, number in hex, or block tag. // Nethermind: very flexible: tag, number, hex or object with "requireCanonical"/"blockHash" fields. // Returns: array of receipts // See: // - Parity: https://openethereum.github.io/JSONRPC-parity-module#parity_getblockreceipts // - QuickNode: undocumented. // - Alchemy: https://docs.alchemy.com/reference/eth-getblockreceipts // - Nethermind: https://docs.nethermind.io/nethermind/ethereum-client/json-rpc/parity#parity_getblockreceipts ParityGetBlockReceipts // EthGetBlockReceipts is a previously non-standard receipt fetching method in the eth namespace, // supported by some RPC platforms. // This since has been standardized in https://github.com/ethereum/execution-apis/pull/438 and adopted in Geth: // https://github.com/ethereum/go-ethereum/pull/27702 // Available in: // - Alchemy: 500 CU total (and deprecated) // - QuickNode: 59 credits total (does not seem to work with block hash arg, inaccurate docs) // - Standard, incl. Geth, Besu and Reth, and Nethermind has a PR in review. // Method: eth_getBlockReceipts // Params: // - QuickNode: string, "quantity or tag", docs say incl. block hash, but API does not actually accept it. // - Alchemy: string, block hash / num (hex) / block tag // Returns: array of receipts // See: // - QuickNode: https://www.quicknode.com/docs/ethereum/eth_getBlockReceipts // - Alchemy: https://docs.alchemy.com/reference/eth-getblockreceipts // Erigon has this available, but does not support block-hash argument to the method: // https://github.com/ledgerwatch/erigon/blob/287a3d1d6c90fc6a7a088b5ae320f93600d5a167/cmd/rpcdaemon/commands/eth_receipts.go#L571 EthGetBlockReceipts // ErigonGetBlockReceiptsByBlockHash is an Erigon-specific receipt fetching method, // the same as EthGetBlockReceipts but supporting a block-hash argument. // Available in: // - Erigon // Method: erigon_getBlockReceiptsByBlockHash // Params: // - Erigon: string, hex-encoded block hash // Returns: // - Erigon: array of json-ified receipts // See: // https://github.com/ledgerwatch/erigon/blob/287a3d1d6c90fc6a7a088b5ae320f93600d5a167/cmd/rpcdaemon/commands/erigon_receipts.go#LL391C24-L391C51 ErigonGetBlockReceiptsByBlockHash )
func AvailableReceiptsFetchingMethods ¶
func AvailableReceiptsFetchingMethods(kind RPCProviderKind) ReceiptsFetchingMethod
AvailableReceiptsFetchingMethods selects receipt fetching methods based on the RPC provider kind.
func PickBestReceiptsFetchingMethod ¶
func PickBestReceiptsFetchingMethod(kind RPCProviderKind, available ReceiptsFetchingMethod, txCount uint64) ReceiptsFetchingMethod
PickBestReceiptsFetchingMethod selects an RPC method that is still available, and optimal for fetching the given number of tx receipts from the specified provider kind.
func (ReceiptsFetchingMethod) String ¶
func (r ReceiptsFetchingMethod) String() string
type ReceiptsProvider ¶
type ReceiptsProvider interface {
// FetchReceipts returns a block info and all of the receipts associated with transactions in the block.
// It verifies the receipt hash in the block header against the receipt hash of the fetched receipts
// to ensure that the execution engine did not fail to return any receipts.
FetchReceipts(ctx context.Context, blockInfo eth.BlockInfo, txHashes []common.Hash) (types.Receipts, error)
}
type RollupClient ¶
type RollupClient struct {
// contains filtered or unexported fields
}
func NewRollupClient ¶
func NewRollupClient(rpc client.RPC) *RollupClient
func (*RollupClient) Close ¶
func (r *RollupClient) Close()
func (*RollupClient) ConductorEnabled ¶
func (r *RollupClient) ConductorEnabled(ctx context.Context) (bool, error)
func (*RollupClient) DependencySet ¶
func (r *RollupClient) DependencySet(ctx context.Context) (depset.DependencySet, error)
func (*RollupClient) OutputAtBlock ¶
func (r *RollupClient) OutputAtBlock(ctx context.Context, blockNum uint64) (*eth.OutputResponse, error)
func (*RollupClient) OverrideLeader ¶
func (r *RollupClient) OverrideLeader(ctx context.Context) error
func (*RollupClient) PostUnsafePayload ¶
func (r *RollupClient) PostUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
func (*RollupClient) RollupConfig ¶
func (*RollupClient) SafeHeadAtL1Block ¶
func (r *RollupClient) SafeHeadAtL1Block(ctx context.Context, blockNum uint64) (*eth.SafeHeadResponse, error)
func (*RollupClient) SequencerActive ¶
func (r *RollupClient) SequencerActive(ctx context.Context) (bool, error)
func (*RollupClient) SetLogLevel ¶
func (*RollupClient) SetRecoverMode ¶
func (r *RollupClient) SetRecoverMode(ctx context.Context, mode bool) error
func (*RollupClient) SetSdmPostExecOptIn ¶ added in v1.19.1
func (r *RollupClient) SetSdmPostExecOptIn(ctx context.Context, enabled bool) error
func (*RollupClient) StartSequencer ¶
func (*RollupClient) StopSequencer ¶
func (*RollupClient) SyncStatus ¶
func (r *RollupClient) SyncStatus(ctx context.Context) (*eth.SyncStatus, error)
type SuperNodeClient ¶
type SuperNodeClient struct {
// contains filtered or unexported fields
}
func NewSuperNodeClient ¶
func NewSuperNodeClient(rpc client.RPC) *SuperNodeClient
func (*SuperNodeClient) Close ¶
func (cl *SuperNodeClient) Close()
func (*SuperNodeClient) SuperRootAtTimestamp ¶
func (c *SuperNodeClient) SuperRootAtTimestamp(ctx context.Context, timestamp uint64) (result eth.SuperRootAtTimestampResponse, err error)
func (*SuperNodeClient) SyncStatus ¶
func (c *SuperNodeClient) SyncStatus(ctx context.Context) (result eth.SuperNodeSyncStatusResponse, err error)
type SyncTesterClient ¶
type SyncTesterClient struct {
// contains filtered or unexported fields
}
func NewSyncTesterClient ¶
func NewSyncTesterClient(client client.RPC) *SyncTesterClient
func (*SyncTesterClient) DeleteSession ¶
func (cl *SyncTesterClient) DeleteSession(ctx context.Context) error
func (*SyncTesterClient) GetSession ¶
func (cl *SyncTesterClient) GetSession(ctx context.Context) (*eth.SyncTesterSession, error)
func (*SyncTesterClient) ListSessions ¶
func (cl *SyncTesterClient) ListSessions(ctx context.Context) ([]string, error)
func (*SyncTesterClient) ResetSession ¶
func (cl *SyncTesterClient) ResetSession(ctx context.Context) error
type TimeToSlotFn ¶
type WebsocketReader ¶
Source Files
¶
- batcher_admin_client.go
- debug_client.go
- engine_client.go
- eth_client.go
- faucet_client.go
- flashblock_client.go
- follow_client.go
- interop_filter_client.go
- l1_beacon_client.go
- l1_client.go
- l2_client.go
- limit.go
- opstack_client.go
- p2p_client.go
- receipts.go
- receipts_basic.go
- receipts_caching.go
- receipts_rpc.go
- rollupclient.go
- supernode_client.go
- sync_tester_client.go
- test_sequencer_builder_client.go
- test_sequencer_control_client.go
- types.go