Documentation
¶
Index ¶
- Variables
- func DiffsBridgeExits(expected []*agglayertypes.BridgeExit, validating []*agglayertypes.BridgeExit) []string
- func DiffsCertificate(expectedCertificate *agglayertypes.Certificate, ...) []string
- func DiffsImportedBridgeExit(expected []*agglayertypes.ImportedBridgeExit, ...) []string
- func HashCertificateToSign(cert *agglayertypes.Certificate) (common.Hash, error)
- type CertificateValidator
- type Config
- type DBValidator
- type FlowInterface
- type L1InfoTreeRootByLeafQuerier
- type LerQuerierConfig
- type LocalValidator
- type PPConfig
- type RemoteValidator
- type ValidatorClient
- type ValidatorService
- type VerifyIncommingRequests
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilCertificate = errors.New("aggsender-validator nil certificate") ErrMetadataNotCompatible = errors.New("aggsender-validator metadata not compatible with the current version") )
Functions ¶
func DiffsBridgeExits ¶
func DiffsBridgeExits( expected []*agglayertypes.BridgeExit, validating []*agglayertypes.BridgeExit) []string
DiffsBridgeExits compares two slices of BridgeExit and returns a slice of strings containing the differences between them.
func DiffsCertificate ¶
func DiffsCertificate( expectedCertificate *agglayertypes.Certificate, validatingCertificate *agglayertypes.Certificate) []string
DiffsCertificate compares two certificates and returns a slice of strings containing the differences between them. If both certificates are nil, it returns an empty slice.
func DiffsImportedBridgeExit ¶
func DiffsImportedBridgeExit(expected []*agglayertypes.ImportedBridgeExit, validating []*agglayertypes.ImportedBridgeExit) []string
DiffsImportedBridgeExit compares two slices of ImportedBridgeExit and returns a slice of strings containing the differences between them.
func HashCertificateToSign ¶
func HashCertificateToSign(cert *agglayertypes.Certificate) (common.Hash, error)
HashCertificateToSign is the hash of the certificate that the validator will sign before returning result to the aggsender
Types ¶
type CertificateValidator ¶
type CertificateValidator struct {
// contains filtered or unexported fields
}
CertificateValidator is a object to validate a certificate
func NewAggsenderValidator ¶
func NewAggsenderValidator(logger aggkitcommon.Logger, flowPP FlowInterface, l1InfoTreeDataQuerier L1InfoTreeRootByLeafQuerier) *CertificateValidator
func (*CertificateValidator) ValidateCertificate ¶
func (a *CertificateValidator) ValidateCertificate(ctx context.Context, params VerifyIncommingRequests) error
ValidateCertificate validates the incoming certificate against the previous one.
type Config ¶
type Config struct {
// EnableRPC is a flag to enable the RPC for validator
EnableRPC bool `mapstructure:"EnableRPC"`
// Signer is the key which is used to sign valid certificates
Signer signertypes.SignerConfig `mapstructure:"Signer"`
// ServerConfig contains the configuration for the gRPC server.
ServerConfig aggkitgrpc.ServerConfig `mapstructure:"ServerConfig"`
// MaxCertSize is the maximum size of the certificate (the emitted certificate cannot be bigger that this size)
// 0 is infinite
MaxCertSize uint `mapstructure:"MaxCertSize"`
// MaxL2BlockNumber is the last L2 block number that is going to be included in a certificate
// 0 means disabled
MaxL2BlockNumber uint64 `mapstructure:"MaxL2BlockNumber"`
// DelayBetweenRetries is the delay between retries:
// is used on store Certificate and also in initial check
DelayBetweenRetries types.Duration `mapstructure:"DelayBetweenRetries"`
// LerQuerier contains the configuration for the LER querier
// which is used to query the LER data from the RollupManager contract
LerQuerier LerQuerierConfig `mapstructure:"LerQuerierConfig"`
// PPConfig specific configuration for Pessimistic mode
PPConfig `mapstructure:"PPConfig"`
// AgglayerClient is the Agglayer gRPC client configuration
AgglayerClient agglayer.ClientConfig `mapstructure:"AgglayerClient"`
}
Config defines the configuration for the validator validator service.
type DBValidator ¶
type DBValidator struct {
// contains filtered or unexported fields
}
func NewDBValidator ¶
func NewDBValidator( logger aggkitcommon.Logger, aggsenderValidator types.CertificateValidator, ) *DBValidator
func (*DBValidator) ValidateDB ¶
func (b *DBValidator) ValidateDB(dbPath string) (string, rpc.Error)
type FlowInterface ¶
type FlowInterface interface {
GenerateBuildParams(ctx context.Context,
preParams *types.CertificatePreBuildParams) (*types.CertificateBuildParams, error)
BuildCertificate(ctx context.Context,
buildParams *types.CertificateBuildParams) (*agglayertypes.Certificate, error)
}
type LerQuerierConfig ¶
type LerQuerierConfig struct {
// RollupManagerAddr is the address of the RollupManager contract on L1
RollupManagerAddr ethCommon.Address `mapstructure:"RollupManagerAddr"`
// RollupCreationBlockL1 is the block number when the rollup was created on L1
RollupCreationBlockL1 uint64 `mapstructure:"RollupCreationBlockL1"`
}
type LocalValidator ¶
type LocalValidator struct {
// contains filtered or unexported fields
}
LocalValidator is a struct that implements the types.Validator interface and is used to validate and sign certificates locally. This is a temporary check, in the future it will be replaced with a object that calls to aggsender-validator using grpc
func NewLocalValidator ¶
func NewLocalValidator( log aggkitcommon.Logger, storage db.AggSenderStorage, validator types.CertificateValidator, ) *LocalValidator
NewLocalValidator creates a new LocalValidator instance.
func (*LocalValidator) HealthCheck ¶
func (a *LocalValidator) HealthCheck(ctx context.Context) (*types.HealthCheckResponse, error)
func (*LocalValidator) String ¶
func (a *LocalValidator) String() string
String returns a string representation of the LocalValidator.
func (*LocalValidator) ValidateAndSignCertificate ¶
func (a *LocalValidator) ValidateAndSignCertificate( ctx context.Context, certificate *agglayertypes.Certificate, ) ([]byte, error)
ValidateAndSignCertificate validates the certificate. LocalValidator does not sign the certificate, it just validates it.
type PPConfig ¶
type PPConfig struct {
// RequireOneBridgeInPPCertificate is a flag to force the validator to have at least one bridge exit
// for the Pessimistic Proof certificates
RequireOneBridgeInPPCertificate bool `mapstructure:"RequireOneBridgeInPPCertificate"`
}
type RemoteValidator ¶
type RemoteValidator struct {
// contains filtered or unexported fields
}
RemoteValidator encapsulates the gRPC client and configuration required to interact with the AggsenderValidator service.
func NewRemoteValidator ¶
func NewRemoteValidator(cfg *grpc.ClientConfig, storage db.AggSenderStorage) (*RemoteValidator, error)
NewRemoteValidator initializes a new RemoteValidator with the provided gRPC client configuration. It returns an error if the gRPC client cannot be created.
func (*RemoteValidator) HealthCheck ¶
func (v *RemoteValidator) HealthCheck(ctx context.Context) (*types.HealthCheckResponse, error)
HealthCheck performs a health check on the AggsenderValidator service.
func (*RemoteValidator) String ¶
func (v *RemoteValidator) String() string
String returns a string representation of the RemoteValidator.
func (*RemoteValidator) ValidateAndSignCertificate ¶
func (v *RemoteValidator) ValidateAndSignCertificate( ctx context.Context, certificate *agglayertypes.Certificate, ) ([]byte, error)
ValidateAndSignCertificate sends a certificate to the AggsenderValidator service for validation.
type ValidatorClient ¶
type ValidatorClient struct {
// contains filtered or unexported fields
}
ValidatorClient encapsulates the gRPC client and configuration required to interact with the AggsenderValidator service.
func NewValidatorClient ¶
func NewValidatorClient(cfg *grpc.ClientConfig) (*ValidatorClient, error)
NewValidatorClient initializes a new ValidatorClient with the provided gRPC client configuration. It returns an error if the gRPC client cannot be created.
func (*ValidatorClient) HealthCheck ¶
func (v *ValidatorClient) HealthCheck(ctx context.Context) (*types.HealthCheckResponse, error)
func (*ValidatorClient) ValidateCertificate ¶
func (v *ValidatorClient) ValidateCertificate( ctx context.Context, previousCertificateID *common.Hash, certificate *agglayertypes.Certificate, ) ([]byte, error)
ValidateCertificate sends a certificate to the AggsenderValidator service for validation.
type ValidatorService ¶
type ValidatorService struct {
// Embed the generated server interface to ensure forward compatibility
v1.UnimplementedAggsenderValidatorServer
// contains filtered or unexported fields
}
ValidatorService implements the gRPC server for the AggsenderValidator service.
func NewValidatorService ¶
func NewValidatorService( logger aggkitcommon.Logger, validator types.CertificateValidator, agglayerClient agglayer.AggLayerClientCertificateIDQuerier, signer signertypes.Signer) *ValidatorService
func (*ValidatorService) HealthCheck ¶
func (s *ValidatorService) HealthCheck(ctx context.Context, in *emptypb.Empty) (*v1.HealthCheckResponse, error)
HealthCheck implements the HealthCheck method of the AggsenderValidator service.
func (*ValidatorService) ValidateCertificate ¶
func (s *ValidatorService) ValidateCertificate( ctx context.Context, req *v1.ValidateCertificateRequest) (*v1.ValidateCertificateResponse, error)
ValidateCertificate validates a new certificate
type VerifyIncommingRequests ¶
type VerifyIncommingRequests = types.VerifyIncomingRequest