Documentation ¶
Index ¶
- Variables
- func DialClientWithBackoff(ctx context.Context, url string) (*ethclient.Client, error)
- func DialEngineClient(ctx context.Context, endpointUrl string, jwtSecret string) (*rpc.Client, error)
- func GetReceiptsByBlock(ctx context.Context, cli *rpc.Client, block *types.Block) (types.Receipts, error)
- func IsMaxPriorityFeePerGasNotFoundError(err error) bool
- func SetHead(ctx context.Context, rpc *rpc.Client, headNum *big.Int) error
- func WaitConfirmations(ctx context.Context, client *ethclient.Client, confirmations uint64, ...) error
- func WaitReceipt(ctx context.Context, client *ethclient.Client, tx *types.Transaction) (*types.Receipt, error)
- type Client
- func (c *Client) GetBlockMetadataByID(blockID *big.Int) (*bindings.LibDataBlockMetadata, error)
- func (c *Client) GetGenesisL1Header(ctx context.Context) (*types.Header, error)
- func (c *Client) GetProtocolConstants(opts *bind.CallOpts) (*bindings.ProtocolConstants, error)
- func (c *Client) L2AccountNonce(ctx context.Context, account common.Address, height *big.Int) (uint64, error)
- func (c *Client) L2ParentByBlockId(ctx context.Context, blockID *big.Int) (*types.Header, error)
- func (c *Client) L2PoolContent(ctx context.Context) (pending PoolContent, queued PoolContent, err error)
- func (c *Client) LatestL2KnownL1Header(ctx context.Context) (*types.Header, error)
- func (c *Client) WaitL1Origin(ctx context.Context, blockID *big.Int) (*rawdb.L1Origin, error)
- type ClientConfig
- type EngineClient
- func (c *EngineClient) ForkchoiceUpdate(ctx context.Context, fc *beacon.ForkchoiceStateV1, ...) (*beacon.ForkChoiceResponse, error)
- func (c *EngineClient) GetPayload(ctx context.Context, payloadID *beacon.PayloadID) (*beacon.ExecutableDataV1, error)
- func (c *EngineClient) NewPayload(ctx context.Context, payload *beacon.ExecutableDataV1) (*beacon.PayloadStatusV1, error)
- type PoolContent
- type TxLists
Constants ¶
This section is empty.
Variables ¶
var ( // FallbackGasTipCap is the default fallback gasTipCap used when we are // unable to query an L1 backend for a suggested gasTipCap. FallbackGasTipCap = big.NewInt(1500000000) )
Functions ¶
func DialClientWithBackoff ¶
DialClientWithBackoff connects a ethereum RPC client at the given URL with a backoff strategy.
func DialEngineClient ¶
func DialEngineClient(ctx context.Context, endpointUrl string, jwtSecret string) (*rpc.Client, error)
DialEngineClient initializes an RPC connection with authentication headers. Taken from https://github.com/prysmaticlabs/prysm/blob/v2.1.4/beacon-chain/execution/rpc_connection.go#L151
func GetReceiptsByBlock ¶
func GetReceiptsByBlock(ctx context.Context, cli *rpc.Client, block *types.Block) (types.Receipts, error)
GetReceiptsByBlock fetches all transaction receipts in a block.
func IsMaxPriorityFeePerGasNotFoundError ¶
IsMaxPriorityFeePerGasNotFoundError returns true if the provided error signals that the backend does not support the eth_maxPrirorityFeePerGas method. In this case, the caller should fallback to using the constant above.
func SetHead ¶
SetHead makes a `debug_setHead` RPC call to set the chain's head, should only be used for testing purpose.
Types ¶
type Client ¶
type Client struct { // Geth ethclient clients L1 *ethclient.Client L2 *ethclient.Client // Geth raw RPC clients L1RawRPC *rpc.Client L2RawRPC *rpc.Client // Geth Engine API clients L2Engine *EngineClient // Protocol contracts clients TaikoL1 *bindings.TaikoL1Client TaikoL2 *bindings.V1TaikoL2Client // Chain IDs L1ChainID *big.Int L2ChainID *big.Int }
Client contains all L1/L2 RPC clients that a driver needs.
func NewClient ¶
func NewClient(ctx context.Context, cfg *ClientConfig) (*Client, error)
NewClient initializes all RPC clients used by Taiko client softwares.
func (*Client) GetBlockMetadataByID ¶
GetBlockMetadataByID fetches the L2 block metadata with given block ID. TODO: add start height and end height in filter options.
func (*Client) GetGenesisL1Header ¶
GetGenesisL1Header fetches the L1 header that including L2 genesis block.
func (*Client) GetProtocolConstants ¶ added in v0.1.6
GetProtocolConstants gets the protocol constants from TaikoL1 contract.
func (*Client) L2AccountNonce ¶
func (c *Client) L2AccountNonce( ctx context.Context, account common.Address, height *big.Int, ) (uint64, error)
L2AccountNonce fetches the nonce of the given L2 account at a specified height.
func (*Client) L2ParentByBlockId ¶
L2ParentByBlockId fetches the block header from L2 node with the largest block id that smaller than the given `blockId`.
func (*Client) L2PoolContent ¶
func (c *Client) L2PoolContent(ctx context.Context) (pending PoolContent, queued PoolContent, err error)
L2PoolContent fetches the transaction pool content from L2 node.
func (*Client) LatestL2KnownL1Header ¶
LatestL2KnownL1Header fetches the L2 node's latest known L1 header.
type ClientConfig ¶
type ClientConfig struct { L1Endpoint string L2Endpoint string TaikoL1Address common.Address TaikoL2Address common.Address L2EngineEndpoint string JwtSecret string }
ClientConfig contains all configs which will be used to initializing an RPC client. If not providing L2EngineEndpoint or JwtSecret, then the L2Engine client won't be initialized.
type EngineClient ¶
EngineClient represents a RPC client connecting to an Ethereum Engine API endpoint. ref: https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md
func DialEngineClientWithBackoff ¶
func DialEngineClientWithBackoff(ctx context.Context, url string, jwtSecret string) (*EngineClient, error)
DialEngineClientWithBackoff connects an ethereum engine RPC client at the given URL with a backoff strategy.
func (*EngineClient) ForkchoiceUpdate ¶
func (c *EngineClient) ForkchoiceUpdate( ctx context.Context, fc *beacon.ForkchoiceStateV1, attributes *beacon.PayloadAttributesV1, ) (*beacon.ForkChoiceResponse, error)
ForkchoiceUpdate updates the forkchoice on the execution client.
func (*EngineClient) GetPayload ¶
func (c *EngineClient) GetPayload( ctx context.Context, payloadID *beacon.PayloadID, ) (*beacon.ExecutableDataV1, error)
GetPayload gets the execution payload associated with the payload ID.
func (*EngineClient) NewPayload ¶
func (c *EngineClient) NewPayload( ctx context.Context, payload *beacon.ExecutableDataV1, ) (*beacon.PayloadStatusV1, error)
ExecutePayload executes a built block on the execution engine.
type PoolContent ¶
type PoolContent map[common.Address]map[string]*types.Transaction
PoolContent represents a response body of a `txpool_content` RPC call.
func (PoolContent) ToTxLists ¶
func (pc PoolContent) ToTxLists() TxLists
ToTxLists flattens all transactions in pool content into transactions lists, each list contains transactions from a single account sorted by nonce.