Documentation
¶
Index ¶
- func IsErrMethodNotAvailable(err error) bool
- func LoadJWTHexFile(file string) ([]byte, error)
- func MockGenesisBlock() (*types.Block, error)
- func MockPayloadID(params engine.ExecutableData, beaconRoot *common.Hash) (engine.PayloadID, error)
- func NewFuzzer(seed int64) *fuzz.Fuzzer
- func WithFarFutureUpgradePlan() func(mock *engineMock)
- func WithMockDelegation(validatorPubkey crypto.PubKey, delegatorAddr common.Address, ether int64) func(*engineMock)
- func WithMockEditValidator(pubkey crypto.PubKey, params *bindings.StakingEditValidatorParams) func(*engineMock)
- func WithMockSelfDelegation(pubkey crypto.PubKey, ether int64) func(*engineMock)
- func WithMockUndelegation(validatorPubkey crypto.PubKey, delegatorAddr common.Address, ether int64) func(*engineMock)
- func WithMockValidatorCreation(pubkey crypto.PubKey) func(*engineMock)
- func WithPortalRegister(network netconf.Network) func(*engineMock)
- func WithRandomErr(ctx context.Context, _ *testing.T) context.Context
- type Client
- type EngineClient
- type HeadType
- type Receipt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrMethodNotAvailable ¶
IsErrMethodNotAvailable returns true if the error indicates that the RPC method is not available on the server. This is useful to handle some endpoints that are not always enabled/configured.
func LoadJWTHexFile ¶
LoadJWTHexFile loads a hex encoded JWT secret from the provided file.
func MockGenesisBlock ¶
MockGenesisBlock returns a deterministic genesis block for testing.
func MockPayloadID ¶
MockPayloadID returns a deterministic payload id for the given payload.
func NewFuzzer ¶
NewFuzzer returns a new fuzzer for valid ethereum types. If seed is zero, it uses current nano time as the seed.
func WithFarFutureUpgradePlan ¶
func WithFarFutureUpgradePlan() func(mock *engineMock)
func WithMockDelegation ¶ added in v0.13.0
func WithMockDelegation(validatorPubkey crypto.PubKey, delegatorAddr common.Address, ether int64) func(*engineMock)
WithMockDelegation returns an option to add a delegation event to the mock from the specified address.
func WithMockEditValidator ¶ added in v0.13.0
func WithMockEditValidator(pubkey crypto.PubKey, params *bindings.StakingEditValidatorParams) func(*engineMock)
WithMockEditValidator returns an option to add an edit validator event to the mock.
func WithMockSelfDelegation ¶
WithMockSelfDelegation returns an option to add a self-delegation Delegate event to the mock.
func WithMockUndelegation ¶ added in v0.15.0
func WithMockUndelegation(validatorPubkey crypto.PubKey, delegatorAddr common.Address, ether int64) func(*engineMock)
WithMockUndelegation returns an option to add an undelegation event to the mock from the specified address.
func WithMockValidatorCreation ¶ added in v0.12.0
WithMockValidatorCreation returns an option to add a validator creation event to the mock.
func WithPortalRegister ¶
Types ¶
type Client ¶
type Client interface { ethereum.BlockNumberReader ethereum.ChainIDReader ethereum.ChainReader ethereum.ChainStateReader ethereum.ContractCaller ethereum.GasEstimator ethereum.GasPricer ethereum.GasPricer1559 ethereum.LogFilterer ethereum.PendingStateReader ethereum.TransactionReader ethereum.TransactionSender TxReceipt(ctx context.Context, hash common.Hash) (*Receipt, error) HeaderByType(ctx context.Context, typ HeadType) (*types.Header, error) EtherBalanceAt(ctx context.Context, addr common.Address) (float64, error) PeerCount(ctx context.Context) (uint64, error) SetHead(ctx context.Context, height uint64) error ProgressIfSyncing(ctx context.Context) (*ethereum.SyncProgress, bool, error) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error Address() string Name() string CloseIdleConnectionsForever(ctx context.Context) Close() }
Client defines all ethereum interfaces used in omni.
func DialContext ¶ added in v0.14.1
DialContext connects a client to the given URL. It returns a wrapped client adding metrics and wrapped errors and a header cache.
Note if the URL is http(s), it doesn't return an error if it cannot connect to the URL. It will retry connecting on every call to a wrapped method. In this case, the context is ignored. It will only return an error if the url is invalid.
type EngineClient ¶
type EngineClient interface { Client // NewPayloadV3 creates an Eth1 block, inserts it in the chain, and returns the status of the chain. NewPayloadV3(ctx context.Context, params engine.ExecutableData, versionedHashes []common.Hash, beaconRoot *common.Hash) (engine.PayloadStatusV1, error) // ForkchoiceUpdatedV3 is equivalent to V2 with the addition of parent beacon block root in the payload attributes. ForkchoiceUpdatedV3(ctx context.Context, update engine.ForkchoiceStateV1, payloadAttributes *engine.PayloadAttributes) (engine.ForkChoiceResponse, error) // GetPayloadV3 returns a cached payload by id. GetPayloadV3(ctx context.Context, payloadID engine.PayloadID) (*engine.ExecutionPayloadEnvelope, error) }
EngineClient defines the Engine API authenticated JSON-RPC endpoints. It extends the normal Client interface with the Engine API.
func NewAuthClient ¶
NewAuthClient returns a new authenticated JSON-RPc engineClient.
func NewEngineMock ¶
func NewEngineMock(opts ...func(mock *engineMock)) (EngineClient, error)
NewEngineMock returns a new mock engine API client.
Note only some methods are implemented, it will panic if you call an unimplemented method.
type Receipt ¶ added in v0.11.0
type Receipt struct { // Consensus fields: These fields are defined by the Yellow Paper Type uint8 `json:"type,omitempty"` PostState []byte `json:"root"` Status uint64 `json:"status"` CumulativeGasUsed uint64 `gencodec:"required" json:"cumulativeGasUsed"` Bloom types.Bloom `gencodec:"required" json:"logsBloom"` Logs []*types.Log `gencodec:"required" json:"logs"` // Implementation fields: These fields are added by geth when processing a transaction or retrieving a receipt. // gencodec annotated fields: these are stored in the chain database. TxHash common.Hash `gencodec:"required" json:"transactionHash"` ContractAddress common.Address `json:"contractAddress"` GasUsed uint64 `gencodec:"required" json:"gasUsed"` EffectiveGasPrice *big.Int `json:"effectiveGasPrice"` // required, but tag omitted for backwards compatibility BlobGasUsed uint64 `json:"blobGasUsed,omitempty"` BlobGasPrice *big.Int `json:"blobGasPrice,omitempty"` // Inclusion information: These fields provide information about the inclusion of the // transaction corresponding to this receipt. BlockHash common.Hash `json:"blockHash,omitempty"` BlockNumber *big.Int `json:"blockNumber,omitempty"` TransactionIndex uint `json:"transactionIndex"` // Optimism fields: extend receipts with L1 fee info OPDepositNonce *uint64 `json:"depositNonce,omitempty"` OPDepositReceiptVersion *uint64 `json:"depositReceiptVersion,omitempty"` OPL1GasPrice *big.Int `json:"l1GasPrice,omitempty"` // Present from pre-bedrock. L1 Basefee after Bedrock OPL1BlobBaseFee *big.Int `json:"l1BlobBaseFee,omitempty"` // Always nil prior to the Ecotone hardfork OPL1GasUsed *big.Int `json:"l1GasUsed,omitempty"` // Present from pre-bedrock, deprecated as of Fjord OPL1Fee *big.Int `json:"l1Fee,omitempty"` // Present from pre-bedrock OPL1FeeScalar *big.Float `json:"l1FeeScalar,omitempty"` // Present from pre-bedrock to Ecotone. Nil after Ecotone OPL1BaseFeeScalar *uint64 `json:"l1BaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork OPL1BlobBaseFeeScalar *uint64 `json:"l1BlobBaseFeeScalar,omitempty"` // Always nil prior to the Ecotone hardfork }
Receipt represents the results of a transaction.
func (Receipt) MarshalJSON ¶ added in v0.11.0
MarshalJSON marshals as JSON.
func (*Receipt) UnmarshalJSON ¶ added in v0.11.0
UnmarshalJSON unmarshals from JSON.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Command genwrap provides a code generator for ethclient.Client wrapper that adds prometheus metrics and error wrapping.
|
Command genwrap provides a code generator for ethclient.Client wrapper that adds prometheus metrics and error wrapping. |
Package headerdb provides a header db/cache implementation.
|
Package headerdb provides a header db/cache implementation. |
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |