flows

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0, MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMaxL2BlockNumberExceededInARetryCert = errors.New("maxL2BlockNumberLimiter. " +
		"Max L2 block number exceeded in a retry certificate")
	ErrComplete = errors.New("maxL2BlockNumberLimiter. " +
		"All certs send, no more certificates can be sent")
	ErrBuildParamsIsNil = errors.New("maxL2BlockNumberLimiter. BuildParams is nil")
)

Functions

func NewBaseFlow added in v0.4.0

func NewBaseFlow(
	log types.Logger,
	l2BridgeQuerier types.BridgeQuerier,
	storage db.AggSenderStorage,
	l1InfoTreeDataQuerier types.L1InfoTreeDataQuerier,
	lerQuerier types.LERQuerier,
	cfg BaseFlowConfig,
) *baseFlow

NewBaseFlow creates a new instance of the base flow

func NewBuilderFlow added in v0.7.0

func NewBuilderFlow(
	ctx context.Context,
	cfg config.Config,
	logger *log.Logger,
	storage db.AggSenderStorage,
	l1Client aggkittypes.BaseEthereumClienter,
	l2Client aggkittypes.BaseEthereumClienter,
	l1InfoTreeSyncer types.L1InfoTreeSyncer,
	l2Syncer types.L2BridgeSyncer,
	rollupDataQuerier types.RollupDataQuerier,
	committeeQuerier types.MultisigQuerier,
) (types.AggsenderBuilderFlow, error)

NewBuilderFlow creates a new AggsenderBuilderFlow based on the provided configuration.

func NewLocalVerifier added in v0.7.0

NewLocalVerifier creates a new local verifier flow based on the provided configuration.

func TimeNowUTC added in v0.7.0

func TimeNowUTC() uint32

TimeNowUTC returns the current time in UTC as a uint32 timestamp.

Types

type AggchainProverBuilderFlow added in v0.7.0

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

AggchainProverBuilderFlow is a struct that holds the logic for the AggchainProver prover type flow

func NewAggchainProverBuilderFlow added in v0.7.0

func NewAggchainProverBuilderFlow(
	log types.Logger,
	aggChainProverConfig AggchainProverFlowConfig,
	baseFlow types.AggsenderFlowBaser,
	storage db.AggSenderStorage,
	l1InfoTreeQuerier types.L1InfoTreeDataQuerier,
	l2BridgeQuerier types.BridgeQuerier,
	l1Client aggkittypes.BaseEthereumClienter,
	signer signertypes.Signer,
	optimisticModeQuerier types.OptimisticModeQuerier,
	aggchainProofQuerier types.AggchainProofQuerier,
) *AggchainProverBuilderFlow

NewAggchainProverBuilderFlow returns a new instance of the AggchainProverBuilderFlow injecting baseFlow instead of creating it

func (*AggchainProverBuilderFlow) BuildCertificate added in v0.7.0

BuildCertificate builds a certificate based on the buildParams this function is the implementation of the FlowManager interface

func (*AggchainProverBuilderFlow) CheckInitialStatus added in v0.7.0

func (a *AggchainProverBuilderFlow) CheckInitialStatus(ctx context.Context) error

CheckInitialStatus checks that initial status is correct. For AggchainProverFlow checks that starting block and last certificate match

func (*AggchainProverBuilderFlow) GenerateBuildParams added in v0.7.0

GeneratePreBuildParams generates the pre-build parameters for the AggchainProverFlow Only used in aggsender validator

func (*AggchainProverBuilderFlow) GetCertificateBuildParams added in v0.7.0

func (a *AggchainProverBuilderFlow) GetCertificateBuildParams(
	ctx context.Context) (*types.CertificateBuildParams, error)

GetCertificateBuildParams returns the parameters to build a certificate this function is the implementation of the FlowManager interface What differentiates this function from the regular PP flow is that, if the last sent certificate is in error, we need to resend the exact same certificate also, it calls the aggchain prover to get the aggchain proof

func (*AggchainProverBuilderFlow) Signer added in v0.7.0

Signer returns the signer used to sign the certificate

func (*AggchainProverBuilderFlow) UpdateAggchainData added in v0.7.0

func (a *AggchainProverBuilderFlow) UpdateAggchainData(
	cert *agglayertypes.Certificate,
	multisig *agglayertypes.Multisig,
) error

UpdateAggchainData updates the AggchainData field in certificate with the multisig if provided.

type AggchainProverFlowConfig added in v0.4.0

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

AggchainProverFlowConfig holds the configuration for the AggchainProverFlow

func NewAggchainProverFlowConfig added in v0.4.0

func NewAggchainProverFlowConfig(
	maxL2BlockNumber uint64) AggchainProverFlowConfig

NewAggchainProverFlowConfig creates a new AggchainProverFlowConfig with the given base flow config

func NewAggchainProverFlowConfigDefault added in v0.4.0

func NewAggchainProverFlowConfigDefault() AggchainProverFlowConfig

NewAggchainProverFlowConfigDefault returns a default configuration for the AggchainProverFlow

type AggchainProverVerifierFlow added in v0.7.0

type AggchainProverVerifierFlow struct {
	*AggchainProverBuilderFlow
	// contains filtered or unexported fields
}

AggchainProverVerifierFlow is a struct that holds the logic for the aggchain prover flow verification

func NewAggchainProverVerifierFlow added in v0.7.0

func NewAggchainProverVerifierFlow(
	builderFlow *AggchainProverBuilderFlow,
	aggProofPublicValuesQuery types.AggProofPublicValuesQuerier,
) *AggchainProverVerifierFlow

NewAggchainProverVerifierFlow creates a new AggchainProverVerifierFlow

func (*AggchainProverVerifierFlow) VerifyCertificate added in v0.7.0

func (a *AggchainProverVerifierFlow) VerifyCertificate(
	ctx context.Context,
	cert *agglayertypes.Certificate,
	lastBlockInCert uint64,
	lastSettledBlock uint64) error

VerifyCertificate verifies the new certificate This function is used in the validator to verify the certificate

type BaseFlowConfig added in v0.4.0

type BaseFlowConfig struct {
	// MaxCertSize is the maximum size of the certificate in bytes. 0 means no limit
	MaxCertSize uint
	// StartL2Block is the L2 block number from which to start sending certificates.
	// It is used to determine the first block to include in the certificate.
	// It can be 0
	StartL2Block uint64
	// RequireNoFEPBlockGap indicates whether the flow requires no gap between the
	// first FEP block and last settled certificate.
	RequireNoFEPBlockGap bool
	// FullClaimsNeeded indicates whether the flow requires full claims data
	FullClaimsNeeded bool
}

BaseFlowConfig is a struct that holds the configuration for the base flow

func NewBaseFlowConfig added in v0.4.0

func NewBaseFlowConfig(
	maxCertSize uint,
	startL2Block uint64,
	requireNoFEPBlockGap bool,
	fullClaimsNeeded bool,
) BaseFlowConfig

NewBaseFlowConfig returns a BaseFlowConfig with the specified maxCertSize and startL2Block

func NewBaseFlowConfigDefault added in v0.4.0

func NewBaseFlowConfigDefault() BaseFlowConfig

NewBaseFlowConfigDefault returns a BaseFlowConfig with default values

type CommonFlowComponents added in v0.7.0

type CommonFlowComponents struct {
	L2BridgeQuerier       types.BridgeQuerier
	L1InfoTreeDataQuerier types.L1InfoTreeDataQuerier
	LERQuerier            types.LERQuerier
	BaseFlow              types.AggsenderFlowBaser
	Signer                signertypes.Signer
}

func CreateCommonFlowComponents added in v0.7.0

func CreateCommonFlowComponents(
	ctx context.Context,
	logger *log.Logger,
	storage db.AggSenderStorage,
	l1Client aggkittypes.BaseEthereumClienter,
	l1InfoTreeSyncer types.L1InfoTreeSyncer,
	l2Syncer types.L2BridgeSyncer,
	rollupDataQuerier types.RollupDataQuerier,
	committeeQuerier types.MultisigQuerier,
	startL2Block uint64,
	requireNoFEPBlockGap bool,
	maxCertSize uint,
	rollupCreationBlockL1 uint64,
	delayBetweenRetries time.Duration,
	signerCfg signertypes.SignerConfig,
	fullClaimsRequired bool,
	requireCommitteeMembershipCheck bool,
) (*CommonFlowComponents, error)

func NewVerifierFlow added in v0.7.0

func NewVerifierFlow(
	ctx context.Context,
	cfg validator.Config,
	logger *log.Logger,
	l1Client aggkittypes.BaseEthereumClienter,
	l1InfoTreeSyncer types.L1InfoTreeSyncer,
	l2Syncer types.L2BridgeSyncer,
	rollupDataQuerier types.RollupDataQuerier,
	committeeQuerier types.MultisigQuerier,
) (types.AggsenderVerifierFlow, *CommonFlowComponents, error)

NewVerifierFlow creates a new verifier flow based on the provided configuration.

type MaxL2BlockNumberLimiter added in v0.4.0

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

func NewMaxL2BlockNumberLimiter added in v0.4.0

func NewMaxL2BlockNumberLimiter(
	maxL2BlockNumber uint64,
	log types.Logger,
	allowToResizeRetryCert bool,
	requireOneBridgeInCertificate bool,
) *MaxL2BlockNumberLimiter

func (*MaxL2BlockNumberLimiter) AdaptCertificate added in v0.4.0

AdaptCertificate adjusts the certificate build parameters to ensure that

func (*MaxL2BlockNumberLimiter) IsAllowedBlockNumber added in v0.4.0

func (f *MaxL2BlockNumberLimiter) IsAllowedBlockNumber(toBlock uint64) bool

func (*MaxL2BlockNumberLimiter) IsEnabled added in v0.4.0

func (f *MaxL2BlockNumberLimiter) IsEnabled() bool

type PPBuilderFlow added in v0.7.0

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

PPBuilderFlow is a struct that holds the logic for the regular pessimistic proof flow

func NewPPBuilderFlow added in v0.7.0

func NewPPBuilderFlow(log types.Logger,
	baseFlow types.AggsenderFlowBaser,
	storage db.AggSenderStorage,
	l1InfoTreeQuerier types.L1InfoTreeDataQuerier,
	l2BridgeQuerier types.BridgeQuerier,
	signer signertypes.Signer,
	forceOneBridgeExit bool,
	maxL2BlockNumber uint64) *PPBuilderFlow

NewPPBuilderFlow returns a new instance of the PPBuilderFlow

func (*PPBuilderFlow) BuildCertificate added in v0.7.0

func (p *PPBuilderFlow) BuildCertificate(ctx context.Context,
	buildParams *types.CertificateBuildParams) (*agglayertypes.Certificate, error)

BuildCertificate builds a certificate based on the buildParams this function is the implementation of the FlowManager interface

func (*PPBuilderFlow) CheckInitialStatus added in v0.7.0

func (p *PPBuilderFlow) CheckInitialStatus(ctx context.Context) error

CheckInitialStatus checks that initial status is correct. For PPFlow there are no special checks to do, so it just returns nil

func (*PPBuilderFlow) GenerateBuildParams added in v0.7.0

func (p *PPBuilderFlow) GenerateBuildParams(ctx context.Context,
	preParams *types.CertificatePreBuildParams) (*types.CertificateBuildParams, error)

func (*PPBuilderFlow) GetCertificateBuildParams added in v0.7.0

func (p *PPBuilderFlow) GetCertificateBuildParams(ctx context.Context) (*types.CertificateBuildParams, error)

GetCertificateBuildParams returns the parameters to build a certificate this function is the implementation of the FlowManager interface

func (*PPBuilderFlow) Signer added in v0.7.0

func (p *PPBuilderFlow) Signer() signertypes.Signer

Signer returns the signer used to sign the certificate

func (*PPBuilderFlow) UpdateAggchainData added in v0.7.0

func (p *PPBuilderFlow) UpdateAggchainData(
	cert *agglayertypes.Certificate,
	multisig *agglayertypes.Multisig) error

UpdateAggchainData updates the AggchainData field in certificate with the multisig if needed

type PPVerifierFlow added in v0.7.0

type PPVerifierFlow struct {
	*PPBuilderFlow
}

PPVerifierFlow is a struct that holds the logic for the regular pessimistic proof flow verification

func NewPPVerifierFlow added in v0.7.0

func NewPPVerifierFlow(builderFlow *PPBuilderFlow) *PPVerifierFlow

NewPPVerifierFlow returns a new instance of the PPVerifierFlow

func (*PPVerifierFlow) VerifyCertificate added in v0.7.0

func (p *PPVerifierFlow) VerifyCertificate(
	ctx context.Context,
	cert *agglayertypes.Certificate,
	lastBlockInCert uint64,
	lastSettledBlock uint64) error

VerifyCertificate verifies the new certificate This function is used in the validator to verify the certificate

Jump to

Keyboard shortcuts

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