Documentation ¶
Index ¶
- Variables
- func BlockOnInterruptsContext(ctx context.Context, signals ...os.Signal)
- func CheckProverBalance(ctx context.Context, rpc *Client, prover common.Address, ...) (bool, error)
- func CtxWithTimeoutOrDefault(ctx context.Context, defaultTimeout time.Duration) (context.Context, context.CancelFunc)
- func DialClientWithBackoff(ctx context.Context, url string, retryInterval time.Duration, maxRetrys uint64) (*ethclient.Client, error)
- func GetProtocolConfigs(taikoL1Client *bindings.TaikoL1Client, opts *bind.CallOpts) (bindings.TaikoDataConfig, error)
- func GetProtocolStateVariables(taikoL1Client *bindings.TaikoL1Client, opts *bind.CallOpts) (..., error)
- func IsMaxPriorityFeePerGasNotFoundError(err error) bool
- func SetHead(ctx context.Context, client *EthClient, headNum *big.Int) error
- func StringToBytes32(str string) [32]byte
- func SubscribeBlockProposed(taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProposed) event.Subscription
- func SubscribeBlockProposedV2(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- func SubscribeBlockVerified(taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockVerified) event.Subscription
- func SubscribeBlockVerifiedV2(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- func SubscribeChainHead(client *EthClient, ch chan *types.Header) event.Subscription
- func SubscribeEvent(eventName string, ...) event.Subscription
- func SubscribeTransitionContested(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- func SubscribeTransitionContestedV2(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- func SubscribeTransitionProved(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- func SubscribeTransitionProvedV2(taikoL1 *bindings.TaikoL1Client, ...) event.Subscription
- type BeaconClient
- type BlobData
- type BlobDataSeq
- type BlobDataSource
- type BlobServerResponse
- type BlockProofStatus
- type Client
- func (c *Client) CalculateBaseFee(ctx context.Context, l2Head *types.Header, anchorBlockID *big.Int, ...) (*big.Int, error)
- func (c *Client) CheckL1Reorg(ctx context.Context, blockID *big.Int) (*ReorgCheckResult, error)
- func (c *Client) GetGenesisL1Header(ctx context.Context) (*types.Header, error)
- func (c *Client) GetGuardianProverAddress(ctx context.Context) (common.Address, error)
- func (c *Client) GetL2BlockInfo(ctx context.Context, blockID *big.Int) (bindings.TaikoDataBlockV2, error)
- func (c *Client) GetL2BlockInfoV2(ctx context.Context, blockID *big.Int) (bindings.TaikoDataBlockV2, error)
- func (c *Client) GetLastVerifiedBlockHash(ctx context.Context) (common.Hash, error)
- func (c *Client) GetPoolContent(ctx context.Context, beneficiary common.Address, blockMaxGasLimit uint32, ...) ([]*miner.PreBuiltTxList, error)
- func (c *Client) GetProtocolStateVariables(opts *bind.CallOpts) (..., error)
- func (c *Client) GetTaikoDataSlotBByNumber(ctx context.Context, number uint64) (*bindings.TaikoDataSlotB, error)
- func (c *Client) GetTiers(ctx context.Context) ([]*TierProviderTierWithID, error)
- func (c *Client) GetTransition(ctx context.Context, blockID *big.Int, transactionID uint32) (bindings.TaikoDataTransitionState, 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) WaitL1NewPendingTransaction(ctx context.Context, address common.Address, oldPendingNonce uint64) error
- func (c *Client) WaitL2Header(ctx context.Context, blockID *big.Int) (*types.Header, error)
- func (c *Client) WaitTillL2ExecutionEngineSynced(ctx context.Context) error
- type ClientConfig
- type ConfigSpec
- type EngineClient
- func (c *EngineClient) ExchangeTransitionConfiguration(ctx context.Context, cfg *engine.TransitionConfigurationV1) (*engine.TransitionConfigurationV1, error)
- 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)
- func (c *EngineClient) TxPoolContentWithMinTip(ctx context.Context, beneficiary common.Address, baseFee *big.Int, ...) ([]*miner.PreBuiltTxList, error)
- type EthClient
- func (c *EthClient) BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *EthClient) BatchBlocksByHashes(ctx context.Context, hashes []common.Hash) ([]*types.Block, error)
- func (c *EthClient) BatchHeadersByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.Header, error)
- func (c *EthClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
- func (c *EthClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (c *EthClient) BlockNumber(ctx context.Context) (uint64, error)
- func (c *EthClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *EthClient) CallContractAtHash(ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash) ([]byte, error)
- func (c *EthClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
- func (c *EthClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (c *EthClient) FeeHistory(ctx context.Context, blockCount uint64, lastBlock *big.Int, ...) (*ethereum.FeeHistory, error)
- func (c *EthClient) FillTransaction(ctx context.Context, args *TransactionArgs) (*types.Transaction, error)
- func (c *EthClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
- func (c *EthClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (c *EthClient) NetworkID(ctx context.Context) (*big.Int, error)
- func (c *EthClient) NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
- func (c *EthClient) PeerCount(ctx context.Context) (uint64, error)
- func (c *EthClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)
- func (c *EthClient) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
- func (c *EthClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
- func (c *EthClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
- func (c *EthClient) PendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)
- func (c *EthClient) PendingTransactionCount(ctx context.Context) (uint, error)
- func (c *EthClient) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (c *EthClient) StorageAt(ctx context.Context, account common.Address, key common.Hash, ...) ([]byte, error)
- func (c *EthClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (c *EthClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
- func (c *EthClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)
- func (c *EthClient) TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (c *EthClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)
- func (c *EthClient) TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
- func (c *EthClient) TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
- type GenesisResponse
- type L2SyncProgress
- type ReorgCheckResult
- type SignTransactionResult
- type TierProviderTierWithID
- type TransactionArgs
Constants ¶
This section is empty.
Variables ¶
var ( ZeroAddress common.Address BlobBytes = params.BlobTxBytesPerFieldElement * params.BlobTxFieldElementsPerBlob BlockMaxTxListBytes uint64 = (params.BlobTxBytesPerFieldElement - 1) * params.BlobTxFieldElementsPerBlob // DefaultInterruptSignals is a set of default interrupt signals. DefaultInterruptSignals = []os.Signal{ os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGQUIT, } )
var (
ErrInvalidLenOfParams = errors.New("invalid length of parameters")
)
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 BlockOnInterruptsContext ¶
BlockOnInterruptsContext blocks until a SIGTERM is received. Passing in signals will override the default signals. The function will stop blocking if the context is closed.
func CheckProverBalance ¶
func CheckProverBalance( ctx context.Context, rpc *Client, prover common.Address, address common.Address, bond *big.Int, ) (bool, error)
CheckProverBalance checks if the prover has the necessary allowance and balance for a prover to pay the liveness bond.
func CtxWithTimeoutOrDefault ¶
func CtxWithTimeoutOrDefault(ctx context.Context, defaultTimeout time.Duration) (context.Context, context.CancelFunc)
CtxWithTimeoutOrDefault sets a context timeout if the deadline has not passed or is not set, and otherwise returns the context as passed in. cancel func is always set to an empty function so is safe to defer the cancel.
func DialClientWithBackoff ¶
func DialClientWithBackoff( ctx context.Context, url string, retryInterval time.Duration, maxRetrys uint64) (*ethclient.Client, error)
DialClientWithBackoff connects a ethereum RPC client at the given URL with a backoff strategy. Added a retry limit so it doesn't retry endlessly
func GetProtocolConfigs ¶
func GetProtocolConfigs( taikoL1Client *bindings.TaikoL1Client, opts *bind.CallOpts, ) (bindings.TaikoDataConfig, error)
GetProtocolConfigs gets the protocol configs from TaikoL1 contract.
func GetProtocolStateVariables ¶
func GetProtocolStateVariables( taikoL1Client *bindings.TaikoL1Client, opts *bind.CallOpts, ) (*struct { A bindings.TaikoDataSlotA B bindings.TaikoDataSlotB }, error)
GetProtocolStateVariables gets the protocol states from TaikoL1 contract.
func IsMaxPriorityFeePerGasNotFoundError ¶
IsMaxPriorityFeePerGasNotFoundError returns true if the provided error signals that the backend does not support the eth_maxPriorityFeePerGas 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.
func StringToBytes32 ¶
StringToBytes32 converts the given string to [32]byte.
func SubscribeBlockProposed ¶
func SubscribeBlockProposed( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProposed, ) event.Subscription
SubscribeBlockProposed subscribes the protocol's BlockProposed events.
func SubscribeBlockProposedV2 ¶
func SubscribeBlockProposedV2( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockProposedV2, ) event.Subscription
SubscribeBlockProposedV2 subscribes the protocol's BlockProposedV2 events.
func SubscribeBlockVerified ¶
func SubscribeBlockVerified( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockVerified, ) event.Subscription
SubscribeBlockVerified subscribes the protocol's BlockVerified events.
func SubscribeBlockVerifiedV2 ¶
func SubscribeBlockVerifiedV2( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientBlockVerifiedV2, ) event.Subscription
SubscribeBlockVerifiedV2 subscribes the protocol's BlockVerifiedV2 events.
func SubscribeChainHead ¶
func SubscribeChainHead( client *EthClient, ch chan *types.Header, ) event.Subscription
SubscribeChainHead subscribes the new chain heads.
func SubscribeEvent ¶
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 SubscribeTransitionContested ¶
func SubscribeTransitionContested( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientTransitionContested, ) event.Subscription
SubscribeTransitionContested subscribes the protocol's TransitionContested events.
func SubscribeTransitionContestedV2 ¶
func SubscribeTransitionContestedV2( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientTransitionContestedV2, ) event.Subscription
SubscribeTransitionContestedV2 subscribes the protocol's TransitionContestedV2 events.
func SubscribeTransitionProved ¶
func SubscribeTransitionProved( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientTransitionProved, ) event.Subscription
SubscribeTransitionProved subscribes the protocol's TransitionProved events.
func SubscribeTransitionProvedV2 ¶
func SubscribeTransitionProvedV2( taikoL1 *bindings.TaikoL1Client, ch chan *bindings.TaikoL1ClientTransitionProvedV2, ) event.Subscription
SubscribeTransitionProvedV2 subscribes the protocol's TransitionProvedV2 events.
Types ¶
type BeaconClient ¶
func NewBeaconClient ¶
func NewBeaconClient(endpoint string, timeout time.Duration) (*BeaconClient, error)
NewBeaconClient returns a new beacon client.
type BlobDataSeq ¶
type BlobDataSeq struct {
Data []*BlobData `json:"data"`
}
type BlobDataSource ¶
type BlobDataSource struct {
// contains filtered or unexported fields
}
func NewBlobDataSource ¶
type BlobServerResponse ¶
type BlobServerResponse struct { Commitment string `json:"commitment"` Data string `json:"data"` VersionedHash string `json:"versionedHash"` }
func (*BlobServerResponse) UnmarshalJSON ¶
func (p *BlobServerResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON overwrites to parse data based on different json keys
type BlockProofStatus ¶
type BlockProofStatus struct { IsSubmitted bool Invalid bool CurrentTransitionState *bindings.TaikoDataTransitionState ParentHeader *types.Header }
BlockProofStatus represents the proving status of the given L2 block.
func BatchGetBlocksProofStatus ¶
func BatchGetBlocksProofStatus( ctx context.Context, cli *Client, ids []*big.Int, proverAddress common.Address, proverSetAddress common.Address, ) ([]*BlockProofStatus, error)
BatchGetBlocksProofStatus checks whether the batch of L2 blocks still need new proofs or new contests. Here are the possible status: 1. No proof on chain at all. 2. A valid proof has been submitted. 3. An invalid proof has been submitted, and there is no valid contest. 4. An invalid proof has been submitted, and there is a valid contest.
func GetBlockProofStatus ¶
func GetBlockProofStatus( ctx context.Context, cli *Client, id *big.Int, proverAddress common.Address, proverSetAddress common.Address, ) (*BlockProofStatus, error)
GetBlockProofStatus checks whether the L2 block still needs a new proof or a new contest. Here are the possible status: 1. No proof on chain at all. 2. A valid proof has been submitted. 3. An invalid proof has been submitted, and there is no valid contest. 4. An invalid proof has been submitted, and there is a valid contest.
type Client ¶
type Client struct { // Geth ethclient clients L1 *EthClient L2 *EthClient L2CheckPoint *EthClient // Geth Engine API clients L2Engine *EngineClient // Beacon clients L1Beacon *BeaconClient // Protocol contracts clients TaikoL1 *bindings.TaikoL1Client LibProposing *bindings.LibProposing TaikoL2 *bindings.TaikoL2Client TaikoToken *bindings.TaikoToken GuardianProverMajority *bindings.GuardianProver GuardianProverMinority *bindings.GuardianProver ProverSet *bindings.ProverSet }
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 software.
func (*Client) CalculateBaseFee ¶
func (c *Client) CalculateBaseFee( ctx context.Context, l2Head *types.Header, anchorBlockID *big.Int, isOntake bool, baseFeeConfig *bindings.LibSharedDataBaseFeeConfig, currentTimestamp uint64, ) (*big.Int, error)
CalculateBaseFee calculates the base fee from the L2 protocol.
func (*Client) CheckL1Reorg ¶
CheckL1Reorg checks whether the L2 block's corresponding L1 block has been reorged or not. We will skip the reorg check if:
- When the L2 chain has just finished a P2P sync, so there is no L1Origin information recorded in its local database, and we assume the last verified L2 block is old enough, so its corresponding L1 block should have also been finalized.
Then we will check: 1. If the L2 block's corresponding L1 block which in L1Origin has been reorged 2. If the L1 information which in the given L2 block's anchor transaction has been reorged
And if a reorg is detected, we return a new L1 block cursor which need to reset to.
func (*Client) GetGenesisL1Header ¶
GetGenesisL1Header fetches the L1 header that including L2 genesis block.
func (*Client) GetGuardianProverAddress ¶
GetGuardianProverAddress fetches the guardian prover address from the protocol.
func (*Client) GetL2BlockInfo ¶
func (c *Client) GetL2BlockInfo(ctx context.Context, blockID *big.Int) (bindings.TaikoDataBlockV2, error)
GetL2BlockInfo fetches the L2 block information from the protocol.
func (*Client) GetL2BlockInfoV2 ¶
func (c *Client) GetL2BlockInfoV2(ctx context.Context, blockID *big.Int) (bindings.TaikoDataBlockV2, error)
GetL2BlockInfoV2 fetches the V2 L2 block information from the protocol.
func (*Client) GetLastVerifiedBlockHash ¶
GetLastVerifiedBlockHash gets the last verified block hash from TaikoL1 contract.
func (*Client) GetPoolContent ¶
func (c *Client) GetPoolContent( ctx context.Context, beneficiary common.Address, blockMaxGasLimit uint32, maxBytesPerTxList uint64, locals []common.Address, maxTransactionsLists uint64, minTip uint64, chainConfig *config.ChainConfig, ) ([]*miner.PreBuiltTxList, error)
GetPoolContent fetches the transactions list from L2 execution engine's transactions pool with given upper limit.
func (*Client) GetProtocolStateVariables ¶
func (c *Client) GetProtocolStateVariables(opts *bind.CallOpts) (*struct { A bindings.TaikoDataSlotA B bindings.TaikoDataSlotB }, error)
GetProtocolStateVariables gets the protocol states from TaikoL1 contract.
func (*Client) GetTaikoDataSlotBByNumber ¶
func (c *Client) GetTaikoDataSlotBByNumber(ctx context.Context, number uint64) (*bindings.TaikoDataSlotB, error)
GetTaikoDataSlotBByNumber fetches the state variables by block number.
func (*Client) GetTiers ¶
func (c *Client) GetTiers(ctx context.Context) ([]*TierProviderTierWithID, error)
GetTiers fetches all protocol supported tiers.
func (*Client) GetTransition ¶
func (c *Client) GetTransition( ctx context.Context, blockID *big.Int, transactionID uint32, ) (bindings.TaikoDataTransitionState, error)
GetTransition fetches the L2 block's corresponding transition state from the protocol.
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 ¶
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, if we can't find the L1Origin data, we will use the L1 genesis header instead.
func (*Client) WaitL1NewPendingTransaction ¶
func (c *Client) WaitL1NewPendingTransaction( ctx context.Context, address common.Address, oldPendingNonce uint64, ) error
WaitL1NewPendingTransaction waits until the L1 account has a new pending transaction.
func (*Client) WaitL2Header ¶
type ClientConfig ¶
type ClientConfig struct { L1Endpoint string L2Endpoint string L1BeaconEndpoint string L2CheckPoint string TaikoL1Address common.Address TaikoL2Address common.Address TaikoTokenAddress common.Address GuardianProverMinorityAddress common.Address GuardianProverMajorityAddress common.Address ProverSetAddress common.Address L2EngineEndpoint string JwtSecret string Timeout time.Duration }
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 ConfigSpec ¶
type ConfigSpec struct {
SecondsPerSlot string `json:"SECONDS_PER_SLOT"`
}
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/shanghai.md
func DialEngineClientWithBackoff ¶
func DialEngineClientWithBackoff( ctx context.Context, url string, jwtSecret string, retryInterval time.Duration, maxRetry uint64, ) (*EngineClient, error)
DialEngineClientWithBackoff connects an ethereum engine RPC client at the given URL with a backoff strategy. Added a retry limit so it doesn't retry endlessly
func NewJWTEngineClient ¶
func NewJWTEngineClient(url, jwtSecret string) (*EngineClient, error)
func (*EngineClient) ExchangeTransitionConfiguration ¶
func (c *EngineClient) ExchangeTransitionConfiguration( ctx context.Context, cfg *engine.TransitionConfigurationV1, ) (*engine.TransitionConfigurationV1, error)
ExchangeTransitionConfiguration exchanges transition configs with the L2 execution engine.
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)
NewPayload executes a built block on the execution engine.
func (*EngineClient) TxPoolContentWithMinTip ¶
func (c *EngineClient) TxPoolContentWithMinTip( ctx context.Context, beneficiary common.Address, baseFee *big.Int, blockMaxGasLimit uint64, maxBytesPerTxList uint64, locals []string, maxTransactionsLists uint64, minTip uint64, ) ([]*miner.PreBuiltTxList, error)
TxPoolContentWithMinTip fetches the transaction pool content from the L2 execution engine.
type EthClient ¶
EthClient is a wrapper for go-ethereum eth client with a timeout attached.
func NewEthClient ¶
NewEthClient creates a new EthClient instance.
func (*EthClient) BalanceAt ¶
func (c *EthClient) BalanceAt( ctx context.Context, account common.Address, blockNumber *big.Int, ) (*big.Int, error)
BalanceAt returns the wei balance of the given account. The block number can be nil, in which case the balance is taken from the latest known block.
func (*EthClient) BatchBlocksByHashes ¶
func (*EthClient) BatchHeadersByNumbers ¶
func (*EthClient) BlockByHash ¶
BlockByHash returns the given full block.
Note that loading full blocks requires two requests. Use HeaderByHash if you don't need all transactions or uncle headers.
func (*EthClient) BlockByNumber ¶
BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.
Note that loading full blocks requires two requests. Use HeaderByNumber if you don't need all transactions or uncle headers.
func (*EthClient) BlockNumber ¶
BlockNumber returns the most recent block number
func (*EthClient) CallContract ¶
func (c *EthClient) CallContract( ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int, ) ([]byte, error)
CallContract executes a message call transaction, which is directly executed in the VM of the node, but never mined into the blockchain.
blockNumber selects the block height at which the call runs. It can be nil, in which case the code is taken from the latest known block. Note that state from very old blocks might not be available.
func (*EthClient) CallContractAtHash ¶
func (c *EthClient) CallContractAtHash( ctx context.Context, msg ethereum.CallMsg, blockHash common.Hash, ) ([]byte, error)
CallContractAtHash is almost the same as CallContract except that it selects the block by block hash instead of block height.
func (*EthClient) CodeAt ¶
func (c *EthClient) CodeAt( ctx context.Context, account common.Address, blockNumber *big.Int, ) ([]byte, error)
CodeAt returns the contract code of the given account. The block number can be nil, in which case the code is taken from the latest known block.
func (*EthClient) EstimateGas ¶
EstimateGas tries to estimate the gas needed to execute a specific transaction based on the current pending state of the backend blockchain. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.
func (*EthClient) FeeHistory ¶
func (c *EthClient) FeeHistory( ctx context.Context, blockCount uint64, lastBlock *big.Int, rewardPercentiles []float64, ) (*ethereum.FeeHistory, error)
FeeHistory retrieves the fee market history.
func (*EthClient) FillTransaction ¶
func (c *EthClient) FillTransaction(ctx context.Context, args *TransactionArgs) (*types.Transaction, error)
FillTransaction fill transaction.
func (*EthClient) HeaderByHash ¶
HeaderByHash returns the block header with the given hash.
func (*EthClient) HeaderByNumber ¶
HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.
func (*EthClient) NonceAt ¶
func (c *EthClient) NonceAt( ctx context.Context, account common.Address, blockNumber *big.Int, ) (uint64, error)
NonceAt returns the account nonce of the given account. The block number can be nil, in which case the nonce is taken from the latest known block.
func (*EthClient) PeerCount ¶
PeerCount returns the number of p2p peers as reported by the net_peerCount method.
func (*EthClient) PendingBalanceAt ¶
PendingBalanceAt returns the wei balance of the given account in the pending state.
func (*EthClient) PendingCallContract ¶
PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.
func (*EthClient) PendingCodeAt ¶
PendingCodeAt returns the contract code of the given account in the pending state.
func (*EthClient) PendingNonceAt ¶
PendingNonceAt returns the account nonce of the given account in the pending state. This is the nonce that should be used for the next transaction.
func (*EthClient) PendingStorageAt ¶
func (c *EthClient) PendingStorageAt( ctx context.Context, account common.Address, key common.Hash, ) ([]byte, error)
PendingStorageAt returns the value of key in the contract storage of the given account in the pending state.
func (*EthClient) PendingTransactionCount ¶
PendingTransactionCount returns the total number of transactions in the pending state.
func (*EthClient) SendTransaction ¶
SendTransaction injects a signed transaction into the pending pool for execution.
If the transaction was a contract creation use the TransactionReceipt method to get the contract address after the transaction has been mined.
func (*EthClient) StorageAt ¶
func (c *EthClient) StorageAt( ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int, ) ([]byte, error)
StorageAt returns the value of key in the contract storage of the given account. The block number can be nil, in which case the value is taken from the latest known block.
func (*EthClient) SuggestGasPrice ¶
SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.
func (*EthClient) SuggestGasTipCap ¶
SuggestGasTipCap retrieves the currently suggested gas tip cap after 1559 to allow a timely execution of a transaction.
func (*EthClient) SyncProgress ¶
SyncProgress retrieves the current progress of the sync algorithm. If there's no sync currently running, it returns nil.
func (*EthClient) TransactionByHash ¶
func (c *EthClient) TransactionByHash( ctx context.Context, hash common.Hash, ) (tx *types.Transaction, isPending bool, err error)
TransactionByHash returns the transaction with the given hash.
func (*EthClient) TransactionCount ¶
TransactionCount returns the total number of transactions in the given block.
func (*EthClient) TransactionInBlock ¶
func (c *EthClient) TransactionInBlock( ctx context.Context, blockHash common.Hash, index uint, ) (*types.Transaction, error)
TransactionInBlock returns a single transaction at index in the given block.
func (*EthClient) TransactionSender ¶
func (c *EthClient) TransactionSender( ctx context.Context, tx *types.Transaction, block common.Hash, index uint, ) (common.Address, error)
TransactionSender returns the sender address of the given transaction. The transaction must be known to the remote node and included in the blockchain at the given block and index. The sender is the one derived by the protocol at the time of inclusion.
There is a fast-path for transactions retrieved by TransactionByHash and TransactionInBlock. Getting their sender address can be done without an RPC interaction.
type GenesisResponse ¶
type GenesisResponse struct { Data struct { GenesisTime string `json:"genesis_time"` } `json:"data"` }
type L2SyncProgress ¶
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.
type ReorgCheckResult ¶
type ReorgCheckResult struct { IsReorged bool L1CurrentToReset *types.Header LastHandledBlockIDToReset *big.Int }
ReorgCheckResult represents the information about whether the L1 block has been reorged and how to reset the L1 cursor.
type SignTransactionResult ¶
type SignTransactionResult struct { Raw hexutil.Bytes `json:"raw"` Tx *types.Transaction `json:"tx"` }
SignTransactionResult represents a RLP encoded signed transaction.
type TierProviderTierWithID ¶
type TierProviderTierWithID struct { ID uint16 bindings.ITierProviderTier }
TierProviderTierWithID wraps protocol ITierProviderTier struct with an ID.
type TransactionArgs ¶
type TransactionArgs struct { From *common.Address `json:"from"` To *common.Address `json:"to"` Gas *hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` Nonce *hexutil.Uint64 `json:"nonce"` // We accept "data" and "input" for backwards-compatibility reasons. // "input" is the newer name and should be preferred by clients. // Issue detail: https://github.com/ethereum/go-ethereum/issues/15628 Data *hexutil.Bytes `json:"data"` Input *hexutil.Bytes `json:"input"` // Introduced by AccessListTxType transaction. AccessList *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` // Introduced by EIP-4844. BlobFeeCap *hexutil.Big `json:"maxFeePerBlobGas"` BlobHashes []common.Hash `json:"blobVersionedHashes,omitempty"` }
TransactionArgs represents the arguments to construct a new transaction or a message call.