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 GetProtocolStateVariables(taikoL1Client *bindings.TaikoL1Client, opts *bind.CallOpts) (*bindings.TaikoDataStateVariables, error)
- func GetReceiptsByBlock(ctx context.Context, cli *rpc.Client, block *types.Block) (types.Receipts, error)
- func IsMaxPriorityFeePerGasNotFoundError(err error) bool
- func NeedNewProof(ctx context.Context, cli *Client, id *big.Int, proverAddress common.Address, ...) (bool, error)
- func NeedNewSystemProof(ctx context.Context, cli *Client, id *big.Int, realProofSkipSize *big.Int) (bool, error)
- func SetHead(ctx context.Context, rpc *rpc.Client, headNum *big.Int) error
- func StringToBytes32(str string) [32]byte
- func SubscribeBlockProposed(taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProposed) event.Subscription
- func SubscribeBlockProven(taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProven) event.Subscription
- func SubscribeBlockVerified(taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockVerified) event.Subscription
- func SubscribeChainHead(client *ethclient.Client, ch chan *types.Header) event.Subscription
- func SubscribeEvent(eventName string, ...) event.Subscription
- func SubscribeXchainSynced(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- 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) CheckL1Reorg(ctx context.Context, blockID *big.Int) (bool, *types.Header, *big.Int, error)
- func (c *Client) GetGenesisL1Header(ctx context.Context) (*types.Header, error)
- func (c *Client) GetPoolContent(ctx context.Context, maxTransactionsPerBlock uint64, blockMaxGasLimit uint64, ...) ([]types.Transactions, error)
- func (c *Client) GetProtocolStateVariables(opts *bind.CallOpts) (*bindings.TaikoDataStateVariables, error)
- func (c *Client) GetStorageRoot(ctx context.Context, gethclient *gethclient.Client, contract common.Address, ...) (common.Hash, error)
- func (c *Client) L2AccountNonce(ctx context.Context, account common.Address, height *big.Int) (uint64, error)
- func (c *Client) L2ExecutionEngineSyncProgress(ctx context.Context) (*L2SyncProgress, error)
- func (c *Client) L2ParentByBlockId(ctx context.Context, blockID *big.Int) (*types.Header, error)
- func (c *Client) LatestL2KnownL1Header(ctx context.Context) (*types.Header, error)
- func (c *Client) WaitL1Origin(ctx context.Context, blockID *big.Int) (*rawdb.L1Origin, error)
- func (c *Client) WaitTillL2ExecutionEngineSynced(ctx context.Context) error
- type ClientConfig
- type EngineClient
- func (c *EngineClient) ForkchoiceUpdate(ctx context.Context, fc *engine.ForkchoiceStateV1, ...) (*engine.ForkChoiceResponse, error)
- func (c *EngineClient) GetPayload(ctx context.Context, payloadID *engine.PayloadID) (*engine.ExecutableData, error)
- func (c *EngineClient) NewPayload(ctx context.Context, payload *engine.ExecutableData) (*engine.PayloadStatusV1, error)
- type L2SyncProgress
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 GetProtocolStateVariables ¶ added in v0.1.8
func GetProtocolStateVariables( taikoL1Client *bindings.TaikoL1Client, opts *bind.CallOpts, ) (*bindings.TaikoDataStateVariables, error)
GetProtocolStateVariables gets the protocol states from TaikoL1 contract.
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 NeedNewProof ¶ added in v0.9.0
func NeedNewProof( ctx context.Context, cli *Client, id *big.Int, proverAddress common.Address, realProofSkipSize *big.Int, ) (bool, error)
NeedNewProof checks whether the L2 block still needs a new proof.
func NeedNewSystemProof ¶ added in v0.10.0
func NeedNewSystemProof(ctx context.Context, cli *Client, id *big.Int, realProofSkipSize *big.Int) (bool, error)
NeedNewSystemProof checks whether the L2 block still needs a new system proof.
func SetHead ¶
SetHead makes a `debug_setHead` RPC call to set the chain's head, should only be used for testing purpose.
func StringToBytes32 ¶ added in v0.9.0
StringToBytes32 converts the given string to [32]byte.
func SubscribeBlockProposed ¶ added in v0.2.3
func SubscribeBlockProposed( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProposed, ) event.Subscription
SubscribeBlockProposed subscribes the protocol's BlockProposed events.
func SubscribeBlockProven ¶ added in v0.2.3
func SubscribeBlockProven( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProven, ) event.Subscription
SubscribeBlockProven subscribes the protocol's BlockProven events.
func SubscribeBlockVerified ¶ added in v0.2.3
func SubscribeBlockVerified( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockVerified, ) event.Subscription
SubscribeBlockVerified subscribes the protocol's BlockVerified events.
func SubscribeChainHead ¶ added in v0.2.3
SubscribeChainHead subscribes the new chain heads.
func SubscribeEvent ¶ added in v0.2.3
func SubscribeEvent( eventName string, handler func(ctx context.Context) (event.Subscription, error), ) event.Subscription
SubscribeEvent creates a event subscription, will retry if the established subscription failed.
func SubscribeXchainSynced ¶ added in v0.7.0
func SubscribeXchainSynced( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientCrossChainSynced, ) event.Subscription
SubscribeXchainSynced subscribes the protocol's XchainSynced events.
Types ¶
type Client ¶
type Client struct { // Geth ethclient clients L1 *ethclient.Client L2 *ethclient.Client L2CheckPoint *ethclient.Client // Geth gethclient clients L1GethClient *gethclient.Client L2GethClient *gethclient.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.TaikoL2Client // 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) CheckL1Reorg ¶ added in v0.9.0
func (c *Client) CheckL1Reorg(ctx context.Context, blockID *big.Int) (bool, *types.Header, *big.Int, error)
CheckL1Reorg checks whether the L1 chain has been reorged, if so, returns the l1Current cursor and L2 blockID that need to reset to.
func (*Client) GetGenesisL1Header ¶
GetGenesisL1Header fetches the L1 header that including L2 genesis block.
func (*Client) GetPoolContent ¶ added in v0.5.0
func (c *Client) GetPoolContent( ctx context.Context, maxTransactionsPerBlock uint64, blockMaxGasLimit uint64, maxBytesPerTxList uint64, locals []common.Address, ) ([]types.Transactions, error)
GetPoolContent fetches the transactions list from L2 execution engine's transactions pool with given upper limit.
func (*Client) GetProtocolStateVariables ¶ added in v0.1.8
func (c *Client) GetProtocolStateVariables(opts *bind.CallOpts) (*bindings.TaikoDataStateVariables, error)
GetProtocolStateVariables gets the protocol states from TaikoL1 contract.
func (*Client) GetStorageRoot ¶ added in v0.7.0
func (c *Client) GetStorageRoot( ctx context.Context, gethclient *gethclient.Client, contract common.Address, height *big.Int, ) (common.Hash, error)
GetStorageRoot returns a contract's storage root at the given height.
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) L2ExecutionEngineSyncProgress ¶ added in v0.2.4
func (c *Client) L2ExecutionEngineSyncProgress(ctx context.Context) (*L2SyncProgress, error)
L2ExecutionEngineSyncProgress fetches the sync progress of the given L2 execution engine.
func (*Client) L2ParentByBlockId ¶
L2ParentByBlockId fetches the block header from L2 execution engine with the largest block id that smaller than the given `blockId`.
func (*Client) LatestL2KnownL1Header ¶
LatestL2KnownL1Header fetches the L2 execution engine's latest known L1 header.
func (*Client) WaitL1Origin ¶
WaitL1Origin keeps waiting until the L1Origin with given block ID appears on the L2 execution engine.
type ClientConfig ¶
type ClientConfig struct { L1Endpoint string L2Endpoint string L2CheckPoint 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 *engine.ForkchoiceStateV1, attributes *engine.PayloadAttributes, ) (*engine.ForkChoiceResponse, error)
ForkchoiceUpdate updates the forkchoice on the execution client.
func (*EngineClient) GetPayload ¶
func (c *EngineClient) GetPayload( ctx context.Context, payloadID *engine.PayloadID, ) (*engine.ExecutableData, error)
GetPayload gets the execution payload associated with the payload ID.
func (*EngineClient) NewPayload ¶
func (c *EngineClient) NewPayload( ctx context.Context, payload *engine.ExecutableData, ) (*engine.PayloadStatusV1, error)
ExecutePayload executes a built block on the execution engine.
type L2SyncProgress ¶ added in v0.2.4
type L2SyncProgress struct { *ethereum.SyncProgress CurrentBlockID *big.Int HighestBlockID *big.Int }
L2SyncProgress represents the sync progress of a L2 execution engine, `ethereum.SyncProgress` is used to check the sync progress of verified blocks, and block IDs are used to check the sync progress of pending blocks.