diff --git a/go/host/enclave/guardian.go b/go/host/enclave/guardian.go index 4c5840bbc9..7c472e2d94 100644 --- a/go/host/enclave/guardian.go +++ b/go/host/enclave/guardian.go @@ -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: @@ -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()) 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 } diff --git a/go/host/l1/publisher.go b/go/host/l1/publisher.go index 4c56d6761f..94d0ea8220 100644 --- a/go/host/l1/publisher.go +++ b/go/host/l1/publisher.go @@ -286,10 +286,6 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle) return nil } - if len(bundle.CrossChainRootHashes) == 0 { - 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") diff --git a/integration/simulation/devnetwork/node.go b/integration/simulation/devnetwork/node.go index 9258f50f21..2d6d1669d5 100644 --- a/integration/simulation/devnetwork/node.go +++ b/integration/simulation/devnetwork/node.go @@ -151,6 +151,7 @@ func (n *InMemNodeOperator) createHostContainer() *hostcontainer.HostContainer { BatchInterval: n.config.BatchInterval, RollupInterval: n.config.RollupInterval, L1BlockTime: n.config.L1BlockTime, + CrossChainInterval: n.config.CrossChainInterval, MaxRollupSize: 1024 * 64, } diff --git a/integration/simulation/network/network_utils.go b/integration/simulation/network/network_utils.go index 57ca8d2fd1..b760bb4176 100644 --- a/integration/simulation/network/network_utils.go +++ b/integration/simulation/network/network_utils.go @@ -73,6 +73,7 @@ func createInMemObscuroNode( ManagementContractAddress: *mgtContractAddress, MessageBusAddress: l1BusAddress, BatchInterval: batchInterval, + CrossChainInterval: config.DefaultHostParsedConfig().CrossChainInterval, IsInboundP2PDisabled: incomingP2PDisabled, L1BlockTime: l1BlockTime, UseInMemoryDB: true,