Documentation
¶
Index ¶
- Constants
- func NewEVMArchivalCheckConfig(contractAddress string, contractStartBlock uint64) *evmArchivalCheckConfig
- type EVMServiceQoSConfig
- type EndpointSelectionMetadata
- type EndpointSelectionResult
- type QoS
- func (ss QoS) ApplyObservations(observations *qosobservations.Observations) error
- func (ss QoS) CheckWebsocketConnection() bool
- func (ss QoS) GetRequiredQualityChecks(endpointAddr protocol.EndpointAddr) []gateway.RequestQoSContext
- func (qos *QoS) HydrateDisqualifiedEndpointsResponse(serviceID protocol.ServiceID, details *devtools.DisqualifiedEndpointResponse)
- func (qos *QoS) ParseHTTPRequest(_ context.Context, req *http.Request) (gateway.RequestQoSContext, bool)
- func (qos *QoS) ParseWebsocketRequest(_ context.Context) (gateway.RequestQoSContext, bool)
- func (ss QoS) SelectMultiple(availableEndpoints protocol.EndpointAddrList, numEndpoints uint) (protocol.EndpointAddrList, error)
- func (ss QoS) SelectWithMetadata(availableEndpoints protocol.EndpointAddrList) (EndpointSelectionResult, error)
- type ServiceQoSConfig
Constants ¶
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.
const QoSType = "evm"
QoSType is the QoS type for the EVM blockchain.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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 ¶
ServiceQoSConfig defines the base interface for service QoS configurations. This avoids circular dependency with the config package.
Source Files
¶
- check_archival.go
- check_blocknumber.go
- check_chainid.go
- context.go
- endpoint.go
- endpoint_selection.go
- endpoint_store.go
- error_context.go
- errors.go
- qos.go
- request_validator.go
- response.go
- response_blocknumber.go
- response_chainid.go
- response_empty.go
- response_generic.go
- response_getbalance.go
- response_none.go
- service_qos_config.go
- service_state.go
- state_archival.go