Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for interval. #1926

Merged
merged 6 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions go/host/enclave/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,15 +629,13 @@ func (g *Guardian) periodicRollupProduction() {
func (g *Guardian) periodicBundleSubmission() {
defer g.logger.Info("Stopping bundle submission")

// check rollup every l1 block time

interval := g.rollupInterval
if interval == 0 {
interval = g.blockTime
}
interval := g.crossChainInterval
g.logger.Info("Starting cross chain bundle submission", "interval", interval)

bundleSubmissionTicker := time.NewTicker(interval)

fromSequenceNumber := uint64(0)

for {
select {
case <-bundleSubmissionTicker.C:
Expand All @@ -646,14 +644,20 @@ func (g *Guardian) periodicBundleSubmission() {
g.logger.Error("Unable to get bundle range from management contract", log.ErrKey, err)
continue
}
bundle, err := g.enclaveClient.ExportCrossChainData(context.Background(), from.Uint64(), to.Uint64())

if from.Uint64() > fromSequenceNumber {
fromSequenceNumber = from.Uint64()
}

bundle, err := g.enclaveClient.ExportCrossChainData(context.Background(), fromSequenceNumber, to.Uint64())
StefanIliev545 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
g.logger.Error("Unable to export cross chain bundle from enclave", log.ErrKey, err)
continue
}

if len(bundle.CrossChainRootHashes) == 0 {
g.logger.Debug("No cross chain data to submit. Skipping.")
g.logger.Debug("No cross chain data to submit")
fromSequenceNumber = to.Uint64() + 1
continue
}

Expand Down
4 changes: 0 additions & 4 deletions go/host/l1/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,6 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle)
return nil
}

if len(bundle.CrossChainRootHashes) == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am I missing something, or will this keep publishing every time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the guardian loop continues before calling this when empty

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

658
image

return fmt.Errorf("nothing to publish in cross chain bundle")
}

managementCtr, err := ManagementContract.NewManagementContract(*p.mgmtContractLib.GetContractAddr(), p.ethClient.EthClient())
if err != nil {
p.logger.Error("Unable to instantiate management contract client")
Expand Down
Loading