flows

package
v0.7.0-beta5 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2025 License: Apache-2.0, MIT Imports: 23 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,
	committeeQuerier types.MultisigQuerier,
) (types.AggsenderFlow, error)

func TimeNowUTC added in v0.7.0

func TimeNowUTC() uint32

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

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,
	storage db.AggSenderStorage,
	l1InfoTreeQuerier types.L1InfoTreeDataQuerier,
	l2BridgeQuerier types.BridgeQuerier,
	l1Client aggkittypes.BaseEthereumClienter,
	signer signertypes.Signer,
	optimisticModeQuerier types.OptimisticModeQuerier,
	aggchainProofQuerier types.AggchainProofQuerier,
) *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) GenerateBuildParams

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

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

func (*AggchainProverFlow) Signer

Signer returns the signer used to sign the certificate

func (*AggchainProverFlow) UpdateAggchainData

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

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

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

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

func (*PPFlow) Signer

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

Signer returns the signer used to sign the certificate

func (*PPFlow) UpdateAggchainData

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

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

Jump to

Keyboard shortcuts

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