flows

package
v0.5.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: Apache-2.0, MIT Imports: 26 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 NewFlow added in v0.4.0

func NewFlow(
	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,
) (types.AggsenderFlow, error)

NewFlow creates a new Aggsender flow based on the provided configuration.

Types

type AggchainProverFlow

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

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

func NewAggchainProverFlow

func NewAggchainProverFlow(
	log types.Logger,
	aggChainProverConfig AggchainProverFlowConfig,
	baseFlow types.AggsenderFlowBaser,
	aggkitProverClient types.AggchainProofClientInterface,
	storage db.AggSenderStorage,
	l1InfoTreeQuerier types.L1InfoTreeDataQuerier,
	l2BridgeQuerier types.BridgeQuerier,
	gerQuerier types.GERQuerier,
	l1Client aggkittypes.BaseEthereumClienter,
	signer signertypes.Signer,
	optimisticModeQuerier types.OptimisticModeQuerier,
	optimisticSigner types.OptimisticSigner,
) *AggchainProverFlow

NewAggchainProverFlow returns a new instance of the AggchainProverFlow injecting baseFlow instead of creating it

func (*AggchainProverFlow) BuildCertificate

func (a *AggchainProverFlow) 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 (*AggchainProverFlow) CheckInitialStatus

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

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

func (*AggchainProverFlow) GenerateAggchainProof

func (a *AggchainProverFlow) GenerateAggchainProof(
	ctx context.Context,
	lastProvenBlock, toBlock uint64,
	certBuildParams *types.CertificateBuildParams,
) (*types.AggchainProof, *treetypes.Root, error)

GenerateAggchainProof calls the aggkit prover to generate the aggchain proof for the given block range

func (*AggchainProverFlow) GetCertificateBuildParams

func (a *AggchainProverFlow) 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

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 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
}

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) 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 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 PPFlow

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

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

func NewPPFlow

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

NewPPFlow returns a new instance of the PPFlow

func (*PPFlow) BuildCertificate

func (p *PPFlow) 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 (*PPFlow) CheckInitialStatus

func (p *PPFlow) 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 (*PPFlow) GetCertificateBuildParams

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

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

Jump to

Keyboard shortcuts

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