evm

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultEVMArchivalThreshold = 128

128 is the default archival threshold for EVM-based chains. This is an opinionated value that aligns with industry standard practices for defining what constitutes an archival block.

View Source
const QoSType = "evm"

QoSType is the QoS type for the EVM blockchain.

Variables

This section is empty.

Functions

func NewEVMArchivalCheckConfig

func NewEVMArchivalCheckConfig(
	contractAddress string,
	contractStartBlock uint64,
) *evmArchivalCheckConfig

Types

type EVMServiceQoSConfig

type EVMServiceQoSConfig interface {
	ServiceQoSConfig // Using locally defined interface to avoid circular dependency
	// contains filtered or unexported methods
}

EVMServiceQoSConfig is the configuration for the EVM service QoS.

func NewEVMServiceQoSConfig

func NewEVMServiceQoSConfig(
	serviceID protocol.ServiceID,
	evmChainID string,
	archivalCheckConfig *evmArchivalCheckConfig,
	supportedAPIs map[sharedtypes.RPCType]struct{},
) EVMServiceQoSConfig

NewEVMServiceQoSConfig creates a new EVM service configuration with the specified archival check settings.

type EndpointSelectionMetadata

type EndpointSelectionMetadata struct {
	// RandomEndpointFallback indicates random endpoint selection when all endpoints failed validation
	RandomEndpointFallback bool
	// ValidationResults contains detailed information about each validation attempt (both successful and failed)
	ValidationResults []*qosobservations.EndpointValidationResult
}

EndpointSelectionMetadata contains metadata about the endpoint selection process.

type EndpointSelectionResult

type EndpointSelectionResult struct {
	// SelectedEndpoint is the chosen endpoint address
	SelectedEndpoint protocol.EndpointAddr
	// Metadata contains endpoint selection process metadata
	Metadata EndpointSelectionMetadata
}

EndpointSelectionResult contains endpoint selection results and metadata.

type QoS

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

QoS implements ServiceQoS for EVM-based chains. It handles chain-specific:

  • Request parsing
  • Response building
  • Endpoint validation and selection

func NewQoSInstance

func NewQoSInstance(logger polylog.Logger, config EVMServiceQoSConfig) *QoS

NewQoSInstance builds and returns an instance of the EVM QoS service.

func (QoS) ApplyObservations

func (ss QoS) ApplyObservations(observations *qosobservations.Observations) error

ApplyObservations updates endpoint storage and blockchain state from observations.

func (QoS) CheckWebsocketConnection

func (ss QoS) CheckWebsocketConnection() bool

CheckWebsocketConnection returns true if the endpoint supports Websocket connections.

func (QoS) GetRequiredQualityChecks

func (ss QoS) GetRequiredQualityChecks(endpointAddr protocol.EndpointAddr) []gateway.RequestQoSContext

GetRequiredQualityChecks returns the list of quality checks required for an endpoint. It is called in the `gateway/hydrator.go` file on each run of the hydrator.

func (*QoS) HydrateDisqualifiedEndpointsResponse

func (qos *QoS) HydrateDisqualifiedEndpointsResponse(serviceID protocol.ServiceID, details *devtools.DisqualifiedEndpointResponse)

HydrateDisqualifiedEndpointsResponse hydrates the disqualified endpoint response with the QoS-specific data.

  • takes a pointer to the DisqualifiedEndpointResponse
  • called by the devtools.DisqualifiedEndpointReporter to fill it with the QoS-specific data.

func (*QoS) ParseHTTPRequest

func (qos *QoS) ParseHTTPRequest(_ context.Context, req *http.Request) (gateway.RequestQoSContext, bool)

ParseHTTPRequest builds a request context from an HTTP request. Returns (requestContext, true) if the request is valid JSONRPC Returns (errorContext, false) if the request is not valid JSONRPC.

Implements gateway.QoSService interface.

func (*QoS) ParseWebsocketRequest

func (qos *QoS) ParseWebsocketRequest(_ context.Context) (gateway.RequestQoSContext, bool)

ParseWebsocketRequest builds a request context from the provided Websocket request. Websocket connection requests do not have a body, so we don't need to parse it.

Implements gateway.QoSService interface.

func (QoS) SelectMultiple

func (ss QoS) SelectMultiple(availableEndpoints protocol.EndpointAddrList, numEndpoints uint) (protocol.EndpointAddrList, error)

SelectMultiple returns multiple endpoint addresses from the list of available endpoints. Available endpoints are filtered based on their validity first. Endpoints are selected with TLD diversity preference when possible. If numEndpoints is 0, it defaults to 1. If numEndpoints is greater than available endpoints, it returns all valid endpoints.

func (QoS) SelectWithMetadata

func (ss QoS) SelectWithMetadata(availableEndpoints protocol.EndpointAddrList) (EndpointSelectionResult, error)

SelectWithMetadata returns endpoint address and selection metadata. Filters endpoints by validity and captures detailed validation failure information. Selects random endpoint if all fail validation.

type ServiceQoSConfig

type ServiceQoSConfig interface {
	GetServiceID() protocol.ServiceID
	GetServiceQoSType() string
}

ServiceQoSConfig defines the base interface for service QoS configurations. This avoids circular dependency with the config package.

Jump to

Keyboard shortcuts

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