diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index 3d865ba1..da1bf523 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -308,7 +308,7 @@ func (a *Aggregator) handleReceivedDataStream(entry *datastreamer.FileEntry, cli } // Encode batch - if a.currentStreamBatch.Type != datastream.BatchType_BATCH_TYPE_INVALID { + if a.currentStreamBatch.Type != datastream.BatchType_BATCH_TYPE_INVALID && a.currentStreamBatch.Type != datastream.BatchType_BATCH_TYPE_INJECTED { batchl2Data, err = state.EncodeBatchV2(&a.currentStreamBatchRaw) if err != nil { log.Errorf("Error encoding batch: %v", err) @@ -317,14 +317,14 @@ func (a *Aggregator) handleReceivedDataStream(entry *datastreamer.FileEntry, cli } // If the batch is marked as Invalid in the DS we enforce retrieve the data from L1 - if a.cfg.UseL1BatchData || a.currentStreamBatch.Type == datastream.BatchType_BATCH_TYPE_INVALID { + if a.cfg.UseL1BatchData || a.currentStreamBatch.Type == datastream.BatchType_BATCH_TYPE_INVALID || a.currentStreamBatch.Type == datastream.BatchType_BATCH_TYPE_INJECTED { a.currentStreamBatch.BatchL2Data = virtualBatch.BatchL2Data } else { a.currentStreamBatch.BatchL2Data = batchl2Data } // Compare BatchL2Data from L1 and DataStream - if common.Bytes2Hex(batchl2Data) != common.Bytes2Hex(virtualBatch.BatchL2Data) { + if common.Bytes2Hex(batchl2Data) != common.Bytes2Hex(virtualBatch.BatchL2Data) && a.currentStreamBatch.Type != datastream.BatchType_BATCH_TYPE_INJECTED { log.Warnf("BatchL2Data from L1 and data stream are different for batch %d", a.currentStreamBatch.BatchNumber) if a.currentStreamBatch.Type == datastream.BatchType_BATCH_TYPE_INVALID { @@ -744,6 +744,7 @@ func (a *Aggregator) settleWithAggLayer( return false } + log.Debug("final proof: %+v", tx) log.Debug("final proof signedTx: ", signedTx.Tx.ZKP.Proof.Hex()) txHash, err := a.aggLayerClient.SendTx(*signedTx) if err != nil { @@ -855,7 +856,7 @@ func (a *Aggregator) buildFinalProof(ctx context.Context, prover proverInterface if common.BytesToHash(finalProof.Public.NewStateRoot).String() != finalDBBatch.Batch.StateRoot.String() { for { - log.Errorf("State root from the final proof does not match the expected for batch %d: Proof = [%s] Expected = [%s]", proof.BatchNumberFinal, string(finalProof.Public.NewStateRoot), finalDBBatch.Batch.StateRoot.String()) + log.Errorf("State root from the final proof does not match the expected for batch %d: Proof = [%s] Expected = [%s]", proof.BatchNumberFinal, common.BytesToHash(finalProof.Public.NewStateRoot).String(), finalDBBatch.Batch.StateRoot.String()) time.Sleep(a.cfg.RetryTime.Duration) } } else { diff --git a/go.mod b/go.mod index 559d3985..2cd03b57 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/0xPolygon/cdk-rpc v0.0.0-20240419104226-c0a62ba0f49d github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3 github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240716105056-c051c96d0234 - github.com/0xPolygonHermez/zkevm-synchronizer-l1 v0.6.4 + github.com/0xPolygonHermez/zkevm-synchronizer-l1 v0.6.6 github.com/ethereum/go-ethereum v1.14.5 github.com/hermeznetwork/tracerr v0.3.2 github.com/iden3/go-iden3-crypto v0.0.16 diff --git a/go.sum b/go.sum index 1857b541..0e2126db 100644 --- a/go.sum +++ b/go.sum @@ -1,17 +1,5 @@ -github.com/0xPolygon/cdk-contracts-tooling v0.0.0-20240726125827-301fa4c59245 h1:BBmVd50JQID9UyUR3vWFMKr2pMHD3mrqjpuB9DDepBw= -github.com/0xPolygon/cdk-contracts-tooling v0.0.0-20240726125827-301fa4c59245/go.mod h1:mFlcEjsm2YBBsu8atHJ3zyVnwM+Z/fMXpVmIJge+WVU= -github.com/0xPolygon/cdk-contracts-tooling v0.0.0-20240816153044-04551a6747e1 h1:51BkwYm+mGPkI+M1HHPk0L/7jOeo/TAljLWffVFZDVI= -github.com/0xPolygon/cdk-contracts-tooling v0.0.0-20240816153044-04551a6747e1/go.mod h1:mFlcEjsm2YBBsu8atHJ3zyVnwM+Z/fMXpVmIJge+WVU= github.com/0xPolygon/cdk-contracts-tooling v0.0.0-20240819092536-5a65d4761b2f h1:i9oCNDG4N7ha3fNkEKbito/HF3o4gjnW6//cpTwnp8E= github.com/0xPolygon/cdk-contracts-tooling v0.0.0-20240819092536-5a65d4761b2f/go.mod h1:mFlcEjsm2YBBsu8atHJ3zyVnwM+Z/fMXpVmIJge+WVU= -github.com/0xPolygon/cdk-data-availability v0.0.8 h1:bMmOYZ7Ei683y80ric3KzMPXtRGmchAmfjIRzghaHb4= -github.com/0xPolygon/cdk-data-availability v0.0.8/go.mod h1:3XkZ0zn0GsvAT01MPQMmukF534CVSFmtrcoK3F/BK6Q= -github.com/0xPolygon/cdk-data-availability v0.0.9-0.20240815124433-d1436f1a29c8 h1:M4dqgOJtUjAJiQ2m+SNH1cTYnBuFsXJJpEJ3eOG/V20= -github.com/0xPolygon/cdk-data-availability v0.0.9-0.20240815124433-d1436f1a29c8/go.mod h1:5A+CU4FGeyG8zTDJc0khMzRxPzFzmpRydeEWmLztgh4= -github.com/0xPolygon/cdk-data-availability v0.0.9-0.20240815125053-230aa34389ca h1:UL6pfroUyI4HXNdZcbvBjfwrrwExoFlbFYUpQvk6u3c= -github.com/0xPolygon/cdk-data-availability v0.0.9-0.20240815125053-230aa34389ca/go.mod h1:5A+CU4FGeyG8zTDJc0khMzRxPzFzmpRydeEWmLztgh4= -github.com/0xPolygon/cdk-data-availability v0.0.9-0.20240815125241-f3d73dfba97a h1:LuPvswDi+86NGwDHITt3kroG1idrQYHLCjeFOTVGtgE= -github.com/0xPolygon/cdk-data-availability v0.0.9-0.20240815125241-f3d73dfba97a/go.mod h1:5A+CU4FGeyG8zTDJc0khMzRxPzFzmpRydeEWmLztgh4= github.com/0xPolygon/cdk-data-availability v0.0.9 h1:KkP+hJH9nY5fljpSNtW2pfP5YQCJOsSRzfnl0yT78rI= github.com/0xPolygon/cdk-data-availability v0.0.9/go.mod h1:5A+CU4FGeyG8zTDJc0khMzRxPzFzmpRydeEWmLztgh4= github.com/0xPolygon/cdk-rpc v0.0.0-20240419104226-c0a62ba0f49d h1:sxh6hZ2jF/sxxj2jd5o1vuNNCZjYmn4aRG9SRlVaEFs= @@ -20,8 +8,8 @@ github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3 h1:zJ06KCGLMDOap4slop/QmiM github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3/go.mod h1:bv7DjATsczN2WvFt26jv34TWv6rfvYM1SqegrgrFwfI= github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240716105056-c051c96d0234 h1:QElCysO7f2xaknY/RDjxcs7IVmcgORfsCX2g+YD0Ko4= github.com/0xPolygonHermez/zkevm-ethtx-manager v0.1.10-0.20240716105056-c051c96d0234/go.mod h1:zBZWxwOHKlw+ghd9roQLgIkDZWA7e7qO3EsfQQT/+oQ= -github.com/0xPolygonHermez/zkevm-synchronizer-l1 v0.6.4 h1:6hk1NCKyR+JycmRFG7Uy7Ko3GghZ3DXYMf5muo3F29Q= -github.com/0xPolygonHermez/zkevm-synchronizer-l1 v0.6.4/go.mod h1:/LHf8jPQeBYKABM1xUmN1dKaFVIJc9jMQDSGBDJ7CS0= +github.com/0xPolygonHermez/zkevm-synchronizer-l1 v0.6.6 h1:BlX6ucNiBVkulBUGBhDHFpK7/D9TrDprc9nxxmQ0Qp4= +github.com/0xPolygonHermez/zkevm-synchronizer-l1 v0.6.6/go.mod h1:xUTgenGeFS7rAoTVMrlkr94b72gXXdzYcqDyBuY1Kwc= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= diff --git a/lastgersync/e2e_test.go b/lastgersync/e2e_test.go index 59a2e834..888f4b84 100644 --- a/lastgersync/e2e_test.go +++ b/lastgersync/e2e_test.go @@ -59,7 +59,7 @@ func TestE2E(t *testing.T) { syncerUpToDate = true break } - time.Sleep(time.Millisecond * 10) + time.Sleep(time.Millisecond * 100) errMsg = fmt.Sprintf("last block from client: %d, last block from syncer: %d", lb, lpb) } require.True(t, syncerUpToDate, errMsg) diff --git a/sequencesender/sequencesender.go b/sequencesender/sequencesender.go index a2572d6e..82e60034 100644 --- a/sequencesender/sequencesender.go +++ b/sequencesender/sequencesender.go @@ -900,14 +900,6 @@ func (s *SequenceSender) handleReceivedDataStream(entry *datastreamer.FileEntry, log.Infof("received BatchStart entry, batchStart.Number: %d, entry.Number: %d", batch.Number, entry.Number) - // Sanity checks - if !(prevEntryType == datastream.EntryType_ENTRY_TYPE_BATCH_END) { - log.Fatalf("unexpected BatchStart entry received, entry.Number: %d, batchStart.Number: %d, prevEntry.Type: %s, prevEntry.Number: %d", - entry.Number, batch.Number, s.entryTypeToString(prevEntryType), s.prevStreamEntry.Number) - } else if batch.Number != s.wipBatch+1 { - log.Fatalf("unexpected BatchStart.Number %d received, if should be wipBatch %d+1, entry.Number: %d", s.wipBatch, batch.Number, entry.Number) - } - // Add batch start data s.addInfoSequenceBatchStart(batch)