rpc

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	RPCHealthCheckMethod      = "RPCServerAggregator.HealthCheck"
	RPCServerAggregatorMethod = "RPCServerAggregator.CollectResponseSignature"
)

Variables

This section is empty.

Functions

func DefaultDBProvider

func DefaultDBProvider(ctx *DBContext) (dbm.DB, error)

DefaultDBProvider creates a database using the configuration specified in the context implementing the standard database initialization process

Types

type DBContext

type DBContext struct {
	ID     string
	Config *config.Config
}

DBContext holds the necessary information for initializing a database including configuration and identifier

type DBProvider

type DBProvider func(*DBContext) (dbm.DB, error)

DBProvider defines a function type that creates and returns a database based on the provided context

type OperatorStakeInfo

type OperatorStakeInfo struct {
	Operator   common.Address
	OperatorID types.OperatorID
	Stake      *big.Int
}

OperatorStakeInfo holds information about an operator's stake. It combines the operator's blockchain address, system identifier, and current stake amount for use in threshold calculations.

type OperatorStateInfo

type OperatorStateInfo struct {
	Operators        map[types.OperatorID]common.Address
	GroupStakes      map[types.GroupNumber]*big.Int
	GroupOperatorMap map[types.GroupNumber][]OperatorStakeInfo
}

OperatorStateInfo contains the current state of operators in the system. It tracks operator mappings, group stake totals, and the distribution of operators across validation groups for consensus determination.

type RPCClientAggregator

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

RPCClientAggregator provides a client implementation of the Aggregator interface communicating with the aggregator service over RPC

func NewRPCClientAggregator

func NewRPCClientAggregator(address string, logger log.Logger) (*RPCClientAggregator, error)

NewRPCClientAggregator creates a new client instance connected to the specified address establishing a connection to the aggregator RPC server

func (*RPCClientAggregator) CollectResponseSignature

func (ra *RPCClientAggregator) CollectResponseSignature(response *aggTypes.ResponseWithSignature, validatedResponseCh chan<- aggTypes.ValidatedResponse) error

CollectResponseSignature implements the Aggregator interface by forwarding the request to the RPC server and receiving the validated response

func (*RPCClientAggregator) HealthCheck added in v0.3.1

func (ra *RPCClientAggregator) HealthCheck() (bool, error)

HealthCheck performs a health check on the aggregator service

type RPCServerAggregator

type RPCServerAggregator struct {
	service.BaseService

	Logger log.Logger
	// contains filtered or unexported fields
}

RPCServerAggregator implements the Aggregator interface over RPC. It manages signature collection tasks, provides thread-safe access to shared resources, handles network communication, and coordinates the entire aggregation workflow for distributed validation requests.

func NewRPCServerAggregator

func NewRPCServerAggregator(
	ctx context.Context,
	cfg *config.Config,
	aggConfig *aggregator.AggregatorConfig,
	logger log.Logger,
) (*RPCServerAggregator, error)

NewRPCServerAggregator creates a new instance of the RPC server aggregator initializing all required components and connections

func (*RPCServerAggregator) CollectResponseSignature

func (ra *RPCServerAggregator) CollectResponseSignature(response *aggregator.ResponseWithSignature, result *aggregator.ValidatedResponse) error

CollectResponseSignature processes operator signature submissions creating or updating tasks and managing the aggregation process

func (*RPCServerAggregator) HealthCheck added in v0.3.1

func (ra *RPCServerAggregator) HealthCheck(_ struct{}, reply *bool) error

HealthCheck provides a simple health check for the RPC server

func (*RPCServerAggregator) IsRunning

func (ra *RPCServerAggregator) IsRunning() bool

IsRunning checks if the server is currently running implementing the service interface requirement

func (*RPCServerAggregator) OnStart

func (ra *RPCServerAggregator) OnStart() error

OnStart initializes and starts the RPC server registering handlers and beginning to accept connections

func (*RPCServerAggregator) OnStop

func (ra *RPCServerAggregator) OnStop()

OnStop gracefully shuts down the RPC server closing the network listener

type ResultDigest

type ResultDigest [32]byte

ResultDigest represents a 32-byte hash of a response result. It serves as a unique identifier for operator response consensus and is used to group matching responses during aggregation.

type Task

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

Task represents an ongoing signature collection and aggregation job. It tracks operator responses, manages communication channels, and stores state information needed for the aggregation process including operator information, group mappings, and threshold requirements.

Jump to

Keyboard shortcuts

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