rpc

package
v0.0.0-...-9c383ba Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT, MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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,
	}
	ErrInvalidLength = errors.New("invalid length")
	ErrSlotBMarshal  = errors.New("abi: cannot marshal in to go type: length insufficient 160 require 192")
)
View Source
var (
	ErrInvalidLenOfParams = errors.New("invalid length of parameters")
)

Functions

func BlockOnInterruptsContext

func BlockOnInterruptsContext(ctx context.Context, signals ...os.Signal)

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 an ethereum RPC client at the given URL with a backoff strategy. Added a retry limit so it doesn't retry endlessly

func SetHead

func SetHead(ctx context.Context, client *EthClient, headNum *big.Int) error

SetHead makes a `debug_setHead` RPC call to set the chain's head, should only be used for testing purpose.

func StringToBytes32

func StringToBytes32(str string) [32]byte

StringToBytes32 converts the given string to [32]byte.

func SubscribeBatchProposedPacaya

func SubscribeBatchProposedPacaya(
	taikoInbox *pacayaBindings.TaikoInboxClient,
	ch chan *pacayaBindings.TaikoInboxClientBatchProposed,
) event.Subscription

SubscribeBatchProposedPacaya subscribes the Pacaya protocol's BatchProposed events.

func SubscribeBatchesProvedPacaya

func SubscribeBatchesProvedPacaya(
	taikoInbox *pacayaBindings.TaikoInboxClient,
	ch chan *pacayaBindings.TaikoInboxClientBatchesProved,
) event.Subscription

SubscribeBatchesProvedPacaya subscribes the Pacaya protocol's BatchesProved events.

func SubscribeBatchesVerifiedPacaya

func SubscribeBatchesVerifiedPacaya(
	taikoInbox *pacayaBindings.TaikoInboxClient,
	ch chan *pacayaBindings.TaikoInboxClientBatchesVerified,
) event.Subscription

SubscribeBatchesVerifiedPacaya subscribes the Pacaya protocol's BatchesVerified events.

func SubscribeBlockProposedV2

func SubscribeBlockProposedV2(
	taikoL1 *ontakeBindings.TaikoL1Client,
	ch chan *ontakeBindings.TaikoL1ClientBlockProposedV2,
) event.Subscription

SubscribeBlockProposedV2 subscribes the protocol's BlockProposedV2 events.

func SubscribeBlockVerifiedV2

func SubscribeBlockVerifiedV2(
	taikoL1 *ontakeBindings.TaikoL1Client,
	ch chan *ontakeBindings.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 SubscribeTransitionContestedV2

func SubscribeTransitionContestedV2(
	taikoL1 *ontakeBindings.TaikoL1Client,
	ch chan *ontakeBindings.TaikoL1ClientTransitionContestedV2,
) event.Subscription

SubscribeTransitionContestedV2 subscribes the protocol's TransitionContestedV2 events.

func SubscribeTransitionProvedV2

func SubscribeTransitionProvedV2(
	taikoL1 *ontakeBindings.TaikoL1Client,
	ch chan *ontakeBindings.TaikoL1ClientTransitionProvedV2,
) event.Subscription

SubscribeTransitionProvedV2 subscribes the protocol's TransitionProvedV2 events.

Types

type BeaconClient

type BeaconClient struct {
	*beacon.Client

	SecondsPerSlot uint64
	SlotsPerEpoch  uint64
	// contains filtered or unexported fields
}

func NewBeaconClient

func NewBeaconClient(endpoint string, timeout time.Duration) (*BeaconClient, error)

NewBeaconClient returns a new beacon client.

func (*BeaconClient) CurrentEpoch

func (c *BeaconClient) CurrentEpoch() uint64

func (*BeaconClient) CurrentSlot

func (c *BeaconClient) CurrentSlot() uint64

func (*BeaconClient) GetBlobs

func (c *BeaconClient) GetBlobs(ctx context.Context, time uint64) ([]*structs.Sidecar, error)

GetBlobs returns the sidecars for a given slot.

func (*BeaconClient) SlotInEpoch

func (c *BeaconClient) SlotInEpoch() uint64

func (*BeaconClient) TimestampOfSlot

func (c *BeaconClient) TimestampOfSlot(slot uint64) uint64

type BlobData

type BlobData struct {
	BlobHash      string `json:"blob_hash"`
	KzgCommitment string `json:"kzg_commitment"`
	Blob          string `json:"blob"`
}

type BlobDataSeq

type BlobDataSeq struct {
	Data []*BlobData `json:"data"`
}

type BlobDataSource

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

func NewBlobDataSource

func NewBlobDataSource(
	ctx context.Context,
	client *Client,
	blobServerEndpoint *url.URL,
) *BlobDataSource

func (*BlobDataSource) GetBlobs

func (ds *BlobDataSource) GetBlobs(
	ctx context.Context,
	timestamp uint64,
	blobHash common.Hash,
) ([]*structs.Sidecar, error)

GetBlobs get blob sidecar by meta

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 *ontakeBindings.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 GetBatchProofStatus

func GetBatchProofStatus(
	ctx context.Context,
	cli *Client,
	batchID *big.Int,
) (*BlockProofStatus, error)

GetBatchesProofStatus checks whether the L2 blocks batch still needs a new proof. Here are the possible status: 1. No proof on chain at all. 2. An invalid proof has been submitted. 3. A valid proof has been submitted.

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
	OntakeClients *OntakeClients
	PacayaClients *PacayaClients
}

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,
	postPacaya bool,
	baseFeeConfig *pacayaBindings.LibSharedDataBaseFeeConfig,
	currentTimestamp uint64,
) (*big.Int, error)

CalculateBaseFee calculates the base fee from the L2 protocol.

func (*Client) CheckL1Reorg

func (c *Client) CheckL1Reorg(ctx context.Context, blockID *big.Int) (*ReorgCheckResult, error)

CheckL1Reorg checks whether the L2 block's corresponding L1 block has been reorged or not. We will skip the reorg check if:

  1. 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) GetBatchByID

func (c *Client) GetBatchByID(ctx context.Context, batchID *big.Int) (*pacayaBindings.ITaikoInboxBatch, error)

GetBatchByID fetches the batch by ID from the Pacaya protocol.

func (*Client) GetForcedInclusionPacaya

func (c *Client) GetForcedInclusionPacaya(ctx context.Context) (
	*pacayaBindings.IForcedInclusionStoreForcedInclusion,
	*big.Int,
	error,
)

GetLastVerifiedTransitionPacaya gets the last verified transition from TaikoInbox contract.

func (*Client) GetGenesisL1Header

func (c *Client) GetGenesisL1Header(ctx context.Context) (*types.Header, error)

GetGenesisL1Header fetches the L1 header that including L2 genesis block.

func (*Client) GetGuardianProverAddress

func (c *Client) GetGuardianProverAddress(ctx context.Context) (common.Address, error)

GetGuardianProverAddress fetches the guardian prover address from the protocol.

func (*Client) GetL2BlockInfoV2

func (c *Client) GetL2BlockInfoV2(ctx context.Context, blockID *big.Int) (ontakeBindings.TaikoDataBlockV2, error)

GetL2BlockInfoV2 fetches the V2 L2 block information from the protocol.

func (*Client) GetLastVerifiedBlockOntake

func (c *Client) GetLastVerifiedBlockOntake(ctx context.Context) (*struct {
	BlockId    uint64 //nolint:stylecheck
	BlockHash  [32]byte
	StateRoot  [32]byte
	VerifiedAt uint64
}, error)

GetLastVerifiedBlockOntake gets the last verified block from TaikoL1 contract.

func (*Client) GetLastVerifiedTransitionPacaya

func (c *Client) GetLastVerifiedTransitionPacaya(ctx context.Context) (*struct {
	BatchId uint64                                    //nolint:stylecheck
	BlockId uint64                                    //nolint:stylecheck
	Ts      pacayaBindings.ITaikoInboxTransitionState //nolint:stylecheck
}, error)

GetLastVerifiedTransitionPacaya gets the last verified transition from TaikoInbox contract.

func (*Client) GetNextPreconfWhiteListOperator

func (c *Client) GetNextPreconfWhiteListOperator(opts *bind.CallOpts) (common.Address, error)

GetNextPreconfWhiteListOperator resolves the next preconf whitelist operator address.

func (*Client) GetOPVerifierPacaya

func (c *Client) GetOPVerifierPacaya(opts *bind.CallOpts) (common.Address, error)

GetOPVerifierPacaya resolves the Pacaya op verifier address.

func (*Client) GetPivotVerifierPacaya

func (c *Client) GetPivotVerifierPacaya(opts *bind.CallOpts) (common.Address, error)

GetPivotVerifierPacaya resolves the Pacaya pivot verifier address.

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,
	baseFeeConfig *pacayaBindings.LibSharedDataBaseFeeConfig,
) ([]*miner.PreBuiltTxList, error)

GetPoolContent fetches the transactions list from L2 execution engine's transactions pool with given upper limit.

func (*Client) GetPreconfWhiteListOperator

func (c *Client) GetPreconfWhiteListOperator(opts *bind.CallOpts) (common.Address, error)

GetPreconfWhiteListOperator resolves the current preconf whitelist operator address.

func (*Client) GetProofVerifierPacaya

func (c *Client) GetProofVerifierPacaya(opts *bind.CallOpts) (common.Address, error)

GetProofVerifierPacaya resolves the Pacaya proof verifier address.

func (*Client) GetProtocolConfigs

func (c *Client) GetProtocolConfigs(opts *bind.CallOpts) (config.ProtocolConfigs, error)

GetProtocolConfigs gets the protocol configs from TaikoInbox or TaikoL2 contract.

func (*Client) GetProtocolStateVariablesOntake

func (c *Client) GetProtocolStateVariablesOntake(opts *bind.CallOpts) (
	ontakeBindings.TaikoDataSlotA,
	ontakeBindings.TaikoDataSlotB,
	error,
)

GetProtocolStateVariables gets the protocol states from TaikoL1 contract.

func (*Client) GetProtocolStateVariablesPacaya

func (c *Client) GetProtocolStateVariablesPacaya(opts *bind.CallOpts) (*struct {
	Stats1 pacayaBindings.ITaikoInboxStats1
	Stats2 pacayaBindings.ITaikoInboxStats2
}, error)

GetProtocolStateVariablesPacaya gets the protocol states from TaikoL1 contract.

func (*Client) GetRISC0VerifierPacaya

func (c *Client) GetRISC0VerifierPacaya(opts *bind.CallOpts) (common.Address, error)

GetRISC0VerifierPacaya resolves the Pacaya risc0 verifier address.

func (*Client) GetSGXVerifierPacaya

func (c *Client) GetSGXVerifierPacaya(opts *bind.CallOpts) (common.Address, error)

GetSGXVerifierPacaya resolves the Pacaya sgx verifier address.

func (*Client) GetSP1VerifierPacaya

func (c *Client) GetSP1VerifierPacaya(opts *bind.CallOpts) (common.Address, error)

GetSP1VerifierPacaya resolves the Pacaya sp1 verifier address.

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,
) (ontakeBindings.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) L2ParentByCurrentBlockID

func (c *Client) L2ParentByCurrentBlockID(ctx context.Context, blockID *big.Int) (*types.Header, error)

L2ParentByCurrentBlockID fetches the block header from L2 execution engine with the largest block id that smaller than the given `blockId`.

func (*Client) LatestL2KnownL1Header

func (c *Client) LatestL2KnownL1Header(ctx context.Context) (*types.Header, error)

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) WaitL2Header

func (c *Client) WaitL2Header(ctx context.Context, blockID *big.Int) (*types.Header, error)

WaitL2Header keeps waiting for the L2 block header of the given block ID.

func (*Client) WaitTillL2ExecutionEngineSynced

func (c *Client) WaitTillL2ExecutionEngineSynced(ctx context.Context) error

WaitTillL2ExecutionEngineSynced keeps waiting until the L2 execution engine is fully synced.

type ClientConfig

type ClientConfig struct {
	L1Endpoint                    string
	L2Endpoint                    string
	L1BeaconEndpoint              string
	L2CheckPoint                  string
	TaikoL1Address                common.Address
	TaikoWrapperAddress           common.Address
	TaikoL2Address                common.Address
	TaikoTokenAddress             common.Address
	ForcedInclusionStoreAddress   common.Address
	PreconfWhitelistAddress       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"`
	SlotsPerEpoch  string `json:"SLOTS_PER_EPOCH"`
}

type EngineClient

type EngineClient struct {
	*rpc.Client
}

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)

NewJWTEngineClient creates a new EngineClient with JWT authentication.

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) SetHeadL1Origin

func (c *EngineClient) SetHeadL1Origin(ctx context.Context, blockID *big.Int) (*big.Int, error)

SetHeadL1Origin sets the latest L2 block's corresponding L1 origin.

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.

func (*EngineClient) UpdateL1Origin

func (c *EngineClient) UpdateL1Origin(ctx context.Context, l1Origin *rawdb.L1Origin) (*rawdb.L1Origin, error)

UpdateL1Origin sets the L2 block's corresponding L1 origin.

type EthClient

type EthClient struct {
	ChainID *big.Int

	*rpc.Client
	// contains filtered or unexported fields
}

EthClient is a wrapper for go-ethereum eth client with a timeout attached.

func NewEthClient

func NewEthClient(ctx context.Context, url string, timeout time.Duration) (*EthClient, error)

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 (c *EthClient) BatchBlocksByHashes(ctx context.Context, hashes []common.Hash) ([]*types.Block, error)

func (*EthClient) BatchHeadersByNumbers

func (c *EthClient) BatchHeadersByNumbers(ctx context.Context, numbers []*big.Int) ([]*types.Header, error)

func (*EthClient) BlockByHash

func (c *EthClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

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

func (c *EthClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

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

func (c *EthClient) BlockNumber(ctx context.Context) (uint64, error)

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

func (c *EthClient) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

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 fills in the missing fields of a transaction and signs it.

func (*EthClient) HeaderByHash

func (c *EthClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

HeaderByHash returns the block header with the given hash.

func (*EthClient) HeaderByNumber

func (c *EthClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

HeaderByNumber returns a block header from the current canonical chain. If number is nil, the latest known header is returned.

func (*EthClient) NetworkID

func (c *EthClient) NetworkID(ctx context.Context) (*big.Int, error)

NetworkID returns the network ID for this client.

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

func (c *EthClient) PeerCount(ctx context.Context) (uint64, error)

PeerCount returns the number of p2p peers as reported by the net_peerCount method.

func (*EthClient) PendingBalanceAt

func (c *EthClient) PendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)

PendingBalanceAt returns the wei balance of the given account in the pending state.

func (*EthClient) PendingCallContract

func (c *EthClient) PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)

PendingCallContract executes a message call transaction using the EVM. The state seen by the contract call is the pending state.

func (*EthClient) PendingCodeAt

func (c *EthClient) PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)

PendingCodeAt returns the contract code of the given account in the pending state.

func (*EthClient) PendingNonceAt

func (c *EthClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

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

func (c *EthClient) PendingTransactionCount(ctx context.Context) (uint, error)

PendingTransactionCount returns the total number of transactions in the pending state.

func (*EthClient) SendTransaction

func (c *EthClient) SendTransaction(ctx context.Context, tx *types.Transaction) error

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

func (c *EthClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)

SuggestGasPrice retrieves the currently suggested gas price to allow a timely execution of a transaction.

func (*EthClient) SuggestGasTipCap

func (c *EthClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

SuggestGasTipCap retrieves the currently suggested gas tip cap after 1559 to allow a timely execution of a transaction.

func (*EthClient) SyncProgress

func (c *EthClient) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error)

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

func (c *EthClient) TransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)

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.

func (*L2SyncProgress) IsSyncing

func (p *L2SyncProgress) IsSyncing() bool

IsSyncing returns true if the L2 execution engine is syncing with L1.

type OntakeClients

type OntakeClients struct {
	TaikoL1                *ontakeBindings.TaikoL1Client
	LibProposing           *ontakeBindings.LibProposing
	TaikoL2                *ontakeBindings.TaikoL2Client
	TaikoToken             *ontakeBindings.TaikoToken
	GuardianProverMajority *ontakeBindings.GuardianProver
	GuardianProverMinority *ontakeBindings.GuardianProver
	ProverSet              *ontakeBindings.ProverSet
	ForkRouter             *ontakeBindings.ForkRouter
	ForkHeight             uint64
}

OntakeClients contains all smart contract clients for Ontake fork.

type PacayaClients

type PacayaClients struct {
	TaikoInbox           *pacayaBindings.TaikoInboxClient
	TaikoWrapper         *pacayaBindings.TaikoWrapperClient
	ForcedInclusionStore *pacayaBindings.ForcedInclusionStore
	TaikoAnchor          *pacayaBindings.TaikoAnchorClient
	TaikoToken           *pacayaBindings.TaikoToken
	ProverSet            *pacayaBindings.ProverSet
	ForkRouter           *pacayaBindings.ForkRouter
	ComposeVerifier      *pacayaBindings.ComposeVerifier
	PreconfWhitelist     *pacayaBindings.PreconfWhitelist
	ForkHeight           uint64
}

PacayaClients contains all smart contract clients for Pacaya fork.

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
	ontakeBindings.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.

Jump to

Keyboard shortcuts

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