Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Oct 15, 2024
1 parent 2525895 commit c5c1edc
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion coordinator/internal/orm/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion rollup/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rollup/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion rollup/internal/controller/watcher/batch_proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
10 changes: 5 additions & 5 deletions rollup/internal/controller/watcher/batch_proposer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion rollup/internal/controller/watcher/chunk_proposer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion rollup/internal/orm/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration-test/orm/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c5c1edc

Please sign in to comment.