From c5c1edc140bc5b79ffd7b313aec5d99fd9739212 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Tue, 15 Oct 2024 15:19:44 +0800 Subject: [PATCH] fix --- coordinator/internal/orm/chunk.go | 2 +- rollup/go.mod | 2 +- rollup/go.sum | 4 ++-- rollup/internal/controller/watcher/batch_proposer.go | 2 +- .../internal/controller/watcher/batch_proposer_test.go | 10 +++++----- rollup/internal/controller/watcher/chunk_proposer.go | 2 +- rollup/internal/orm/chunk.go | 2 +- tests/integration-test/orm/chunk.go | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/coordinator/internal/orm/chunk.go b/coordinator/internal/orm/chunk.go index 30c9b965a..3f1964c40 100644 --- a/coordinator/internal/orm/chunk.go +++ b/coordinator/internal/orm/chunk.go @@ -294,7 +294,7 @@ func (o *Chunk) InsertChunk(ctx context.Context, chunk *encoding.Chunk, dbTX ... StartBlockHash: chunk.Blocks[0].Header.Hash().Hex(), EndBlockNumber: chunk.Blocks[numBlocks-1].Header.Number.Uint64(), EndBlockHash: chunk.Blocks[numBlocks-1].Header.Hash().Hex(), - TotalL2TxGas: chunk.L2GasUsed(), + TotalL2TxGas: chunk.TotalGasUsed(), TotalL2TxNum: chunk.NumL2Transactions(), TotalL1CommitCalldataSize: totalL1CommitCalldataSize, TotalL1CommitGas: totalL1CommitGas, diff --git a/rollup/go.mod b/rollup/go.mod index c23e575f8..4680f9d62 100644 --- a/rollup/go.mod +++ b/rollup/go.mod @@ -11,7 +11,7 @@ require ( github.com/holiman/uint256 v1.2.4 github.com/mitchellh/mapstructure v1.5.0 github.com/prometheus/client_golang v1.16.0 - github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b + github.com/scroll-tech/da-codec v0.1.1-0.20241015063757-e36ee98736a0 github.com/scroll-tech/go-ethereum v1.10.14-0.20241011150208-4742882675d8 github.com/smartystreets/goconvey v1.8.0 github.com/spf13/viper v1.19.0 diff --git a/rollup/go.sum b/rollup/go.sum index b0591c391..ce9885857 100644 --- a/rollup/go.sum +++ b/rollup/go.sum @@ -265,8 +265,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= -github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b h1:5H6V6ybacXFJ2ti+eFwtf+12Otufod6goxK6/u7Nu1k= -github.com/scroll-tech/da-codec v0.1.1-0.20241014152913-2703f226fb0b/go.mod h1:48uxaqVgpD8ulH8p+nrBtfeLHZ9tX82bVVdPNkW3rPE= +github.com/scroll-tech/da-codec v0.1.1-0.20241015063757-e36ee98736a0 h1:ROmcrXa637V3nypHn/6acqWvls7yBdvp6Oux5JPKE7U= +github.com/scroll-tech/da-codec v0.1.1-0.20241015063757-e36ee98736a0/go.mod h1:48uxaqVgpD8ulH8p+nrBtfeLHZ9tX82bVVdPNkW3rPE= github.com/scroll-tech/go-ethereum v1.10.14-0.20241011150208-4742882675d8 h1:pEP6+ThQIgSRO5SILiO6iBpWnxAUjoRNBA9Nc6ooOS0= github.com/scroll-tech/go-ethereum v1.10.14-0.20241011150208-4742882675d8/go.mod h1:MBHX2RcAV9KLWblo9DSa/xyPYd1Wpwnt64JSDOy85po= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= diff --git a/rollup/internal/controller/watcher/batch_proposer.go b/rollup/internal/controller/watcher/batch_proposer.go index 419b1755b..46080d8f6 100644 --- a/rollup/internal/controller/watcher/batch_proposer.go +++ b/rollup/internal/controller/watcher/batch_proposer.go @@ -208,7 +208,7 @@ func (p *BatchProposer) updateDBBatchInfo(batch *encoding.Batch, codecVersion en var totalGasUsed uint64 for _, chunk := range batch.Chunks { - totalGasUsed += chunk.L2GasUsed() + totalGasUsed += chunk.TotalGasUsed() } p.batchProposeThroughput.Add(float64(totalGasUsed)) diff --git a/rollup/internal/controller/watcher/batch_proposer_test.go b/rollup/internal/controller/watcher/batch_proposer_test.go index 911f7edcf..428f7226f 100644 --- a/rollup/internal/controller/watcher/batch_proposer_test.go +++ b/rollup/internal/controller/watcher/batch_proposer_test.go @@ -122,9 +122,9 @@ func testBatchProposerCodecv0Limits(t *testing.T) { chunks, err := chunkOrm.GetChunksInRange(context.Background(), 1, 2) assert.NoError(t, err) - assert.Equal(t, uint64(6042), chunks[0].TotalL1CommitGas) + assert.Equal(t, uint64(5082), chunks[0].TotalL1CommitGas) assert.Equal(t, uint64(298), chunks[0].TotalL1CommitCalldataSize) - assert.Equal(t, uint64(94618), chunks[1].TotalL1CommitGas) + assert.Equal(t, uint64(93658), chunks[1].TotalL1CommitGas) assert.Equal(t, uint64(5737), chunks[1].TotalL1CommitCalldataSize) bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ @@ -641,9 +641,9 @@ func testBatchCommitGasAndCalldataSizeCodecv0Estimation(t *testing.T) { chunks, err := chunkOrm.GetChunksInRange(context.Background(), 1, 2) assert.NoError(t, err) - assert.Equal(t, uint64(6042), chunks[0].TotalL1CommitGas) + assert.Equal(t, uint64(5082), chunks[0].TotalL1CommitGas) assert.Equal(t, uint64(298), chunks[0].TotalL1CommitCalldataSize) - assert.Equal(t, uint64(94618), chunks[1].TotalL1CommitGas) + assert.Equal(t, uint64(93658), chunks[1].TotalL1CommitGas) assert.Equal(t, uint64(5737), chunks[1].TotalL1CommitCalldataSize) bp := NewBatchProposer(context.Background(), &config.BatchProposerConfig{ @@ -672,7 +672,7 @@ func testBatchCommitGasAndCalldataSizeCodecv0Estimation(t *testing.T) { assert.Equal(t, types.ProvingTaskUnassigned, types.ProvingStatus(chunk.ProvingStatus)) } - assert.Equal(t, uint64(258383), batches[0].TotalL1CommitGas) + assert.Equal(t, uint64(256463), batches[0].TotalL1CommitGas) assert.Equal(t, uint64(6035), batches[0].TotalL1CommitCalldataSize) } diff --git a/rollup/internal/controller/watcher/chunk_proposer.go b/rollup/internal/controller/watcher/chunk_proposer.go index bfe6dd3e2..99eaca9d4 100644 --- a/rollup/internal/controller/watcher/chunk_proposer.go +++ b/rollup/internal/controller/watcher/chunk_proposer.go @@ -221,7 +221,7 @@ func (p *ChunkProposer) updateDBChunkInfo(chunk *encoding.Chunk, codecVersion en if len(chunk.Blocks) > 0 { p.chunkProposeBlockHeight.Set(float64(chunk.Blocks[len(chunk.Blocks)-1].Header.Number.Uint64())) } - p.chunkProposeThroughput.Add(float64(chunk.L2GasUsed())) + p.chunkProposeThroughput.Add(float64(chunk.TotalGasUsed())) p.proposeChunkUpdateInfoTotal.Inc() err := p.db.Transaction(func(dbTX *gorm.DB) error { diff --git a/rollup/internal/orm/chunk.go b/rollup/internal/orm/chunk.go index a555b6789..18ee27609 100644 --- a/rollup/internal/orm/chunk.go +++ b/rollup/internal/orm/chunk.go @@ -222,7 +222,7 @@ func (o *Chunk) InsertChunk(ctx context.Context, chunk *encoding.Chunk, codecVer StartBlockHash: chunk.Blocks[0].Header.Hash().Hex(), EndBlockNumber: chunk.Blocks[numBlocks-1].Header.Number.Uint64(), EndBlockHash: chunk.Blocks[numBlocks-1].Header.Hash().Hex(), - TotalL2TxGas: chunk.L2GasUsed(), + TotalL2TxGas: chunk.TotalGasUsed(), TotalL2TxNum: chunk.NumL2Transactions(), TotalL1CommitCalldataSize: metrics.L1CommitCalldataSize, TotalL1CommitGas: metrics.L1CommitGas, diff --git a/tests/integration-test/orm/chunk.go b/tests/integration-test/orm/chunk.go index e4a535533..517f0ae94 100644 --- a/tests/integration-test/orm/chunk.go +++ b/tests/integration-test/orm/chunk.go @@ -146,7 +146,7 @@ func (o *Chunk) InsertChunk(ctx context.Context, chunk *encoding.Chunk, dbTX ... StartBlockHash: chunk.Blocks[0].Header.Hash().Hex(), EndBlockNumber: chunk.Blocks[numBlocks-1].Header.Number.Uint64(), EndBlockHash: chunk.Blocks[numBlocks-1].Header.Hash().Hex(), - TotalL2TxGas: chunk.L2GasUsed(), + TotalL2TxGas: chunk.TotalGasUsed(), TotalL2TxNum: chunk.NumL2Transactions(), TotalL1CommitCalldataSize: totalL1CommitCalldataSize, TotalL1CommitGas: totalL1CommitGas,