diff --git a/block/production_test.go b/block/production_test.go index fa11a781c..3679f684d 100644 --- a/block/production_test.go +++ b/block/production_test.go @@ -13,7 +13,6 @@ import ( "github.com/dymensionxyz/dymint/mempool" mempoolv1 "github.com/dymensionxyz/dymint/mempool/v1" "github.com/dymensionxyz/dymint/node/events" - "github.com/dymensionxyz/dymint/types" uevent "github.com/dymensionxyz/dymint/utils/event" tmcfg "github.com/tendermint/tendermint/config" @@ -61,8 +60,8 @@ func TestCreateEmptyBlocksEnableDisable(t *testing.T) { go manager.ProduceBlockLoop(mCtx) go managerWithEmptyBlocks.ProduceBlockLoop(mCtx) - buf1 := make(chan struct{}, 100) //dummy to avoid unhealthy event - buf2 := make(chan struct{}, 100) //dummy to avoid unhealthy event + buf1 := make(chan struct{}, 100) // dummy to avoid unhealthy event + buf2 := make(chan struct{}, 100) // dummy to avoid unhealthy event go manager.AccumulatedDataLoop(mCtx, buf1) go managerWithEmptyBlocks.AccumulatedDataLoop(mCtx, buf2) <-mCtx.Done() @@ -176,44 +175,6 @@ func TestCreateEmptyBlocksNew(t *testing.T) { assert.True(foundTx) } -func TestInvalidBatch(t *testing.T) { - assert := assert.New(t) - require := require.New(t) - - manager, err := testutil.GetManager(testutil.GetManagerConfig(), nil, nil, 1, 1, 0, nil, nil) - require.NoError(err) - - batchSize := uint64(5) - syncTarget := uint64(10) - - // Create cases - cases := []struct { - startHeight uint64 - endHeight uint64 - shouldError bool - }{ - {startHeight: syncTarget + 1, endHeight: syncTarget + batchSize, shouldError: false}, - // batch with endHight < startHeight - {startHeight: syncTarget + 1, endHeight: syncTarget, shouldError: true}, - // batch with startHeight != previousEndHeight + 1 - {startHeight: syncTarget, endHeight: syncTarget + batchSize + batchSize, shouldError: true}, - } - for _, c := range cases { - batch := &types.Batch{ - StartHeight: c.startHeight, - EndHeight: c.endHeight, - } - - manager.UpdateSyncParams(syncTarget) - err := manager.ValidateBatch(batch) - if c.shouldError { - assert.Error(err) - } else { - assert.NoError(err) - } - } -} - // TestStopBlockProduction tests the block production stops when submitter is full // and resumes when submitter is ready to accept more batches func TestStopBlockProduction(t *testing.T) { diff --git a/block/submit.go b/block/submit.go index 9b077edaf..fb798fbd1 100644 --- a/block/submit.go +++ b/block/submit.go @@ -126,10 +126,6 @@ func (m *Manager) HandleSubmissionTrigger() error { return fmt.Errorf("create next batch to submit: %w", err) } - if err := m.ValidateBatch(nextBatch); err != nil { - return fmt.Errorf("validate batch: %w", err) - } - resultSubmitToDA, err := m.submitNextBatchToDA(nextBatch) if err != nil { return fmt.Errorf("submit next batch to da: %w", err) @@ -169,17 +165,6 @@ func (m *Manager) submitNextBatchToSL(batch *types.Batch, daResult *da.ResultSub return actualEndHeight, nil } -func (m *Manager) ValidateBatch(batch *types.Batch) error { - syncTarget := m.SyncTarget.Load() - if batch.StartHeight != syncTarget+1 { - return fmt.Errorf("batch start height != syncTarget + 1. StartHeight %d, m.SyncTarget %d", batch.StartHeight, syncTarget) - } - if batch.EndHeight < batch.StartHeight { - return fmt.Errorf("batch end height must be greater than start height. EndHeight %d, StartHeight %d", batch.EndHeight, batch.StartHeight) - } - return nil -} - func (m *Manager) CreateNextBatchToSubmit(startHeight uint64, endHeightInclusive uint64) (*types.Batch, error) { var height uint64 // Create the batch