Skip to content

Commit

Permalink
fix: no bridges return
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Feb 18, 2025
1 parent f1d93e4 commit 1c9543c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions aggsender/flow_aggchain_prover.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ func (a *aggchainProverFlow) GetCertificateBuildParams(ctx context.Context) (*ty
}
}

if buildParams.NumberOfBridges() == 0 {
// no bridges so no need to build the certificate
return nil, nil
}

proof, leaf, root, err := a.getFinalizedL1InfoTreeData(ctx)
if err != nil {
return nil, fmt.Errorf("aggchainProverFlow - error getting finalized L1 Info tree data: %w", err)
Expand Down
9 changes: 7 additions & 2 deletions aggsender/flow_pp.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (f *baseFlow) GetCertificateBuildParams(ctx context.Context) (*types.Certif
CreatedAt: uint32(time.Now().UTC().Unix()),
}

if buildParams.NumberOfBridges() == 0 {
// no bridges so no need to build the certificate
return nil, nil
}

buildParams, err = f.limitCertSize(buildParams)
if err != nil {
return nil, fmt.Errorf("error limitCertSize: %w", err)
Expand Down Expand Up @@ -116,7 +121,7 @@ func (f *baseFlow) limitCertSize(fullCert *types.CertificateBuildParams) (*types
for {
if currentCert.NumberOfBridges() == 0 {
// We can't reduce more the certificate, so this is the minium size
f.log.Warnf("We reach the minium size of bridge.Certificate size: %d >max size: %d",
f.log.Warnf("We reach the minium size of bridge. Certificate size: %d >max size: %d",
previousCert.EstimatedSize(), f.cfg.MaxCertSize)
return previousCert, nil
}
Expand All @@ -127,7 +132,7 @@ func (f *baseFlow) limitCertSize(fullCert *types.CertificateBuildParams) (*types

// Minimum size of the certificate
if currentCert.NumberOfBlocks() <= 1 {
f.log.Warnf("reach the minium num blocks [%d to %d].Certificate size: %d >max size: %d",
f.log.Warnf("reach the minium num blocks [%d to %d]. Certificate size: %d >max size: %d",
currentCert.FromBlock, currentCert.ToBlock, currentCert.EstimatedSize(), f.cfg.MaxCertSize)
return currentCert, nil
}
Expand Down

0 comments on commit 1c9543c

Please sign in to comment.