refactor(batch): removing db fields in batch encoding type (#1196)

This commit is contained in:
colin
2024-03-19 10:16:54 +08:00
committed by GitHub
parent 395a0b7fe2
commit 4c6d7b7deb
15 changed files with 214 additions and 161 deletions

View File

@@ -99,10 +99,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err := EstimateBatchL1CommitCalldataSize(batch)
@@ -154,10 +150,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)
@@ -211,10 +203,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)
@@ -276,20 +264,11 @@ func TestCodecV0(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 61, len(chunkBytes2))
daChunk1Hash, err := daChunk1.Hash()
assert.NoError(t, err)
daChunk2Hash, err := daChunk2.Hash()
assert.NoError(t, err)
batch = &encoding.Batch{
Index: 1,
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk1, chunk2},
StartChunkIndex: 0,
EndChunkIndex: 1,
StartChunkHash: daChunk1Hash,
EndChunkHash: daChunk2Hash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)
@@ -343,10 +322,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 37,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)
@@ -400,10 +375,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)
@@ -457,10 +428,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)
@@ -514,10 +481,6 @@ func TestCodecV0(t *testing.T) {
TotalL1MessagePoppedBefore: 0,
ParentBatchHash: parentBatchHash,
Chunks: []*encoding.Chunk{chunk},
StartChunkIndex: 0,
EndChunkIndex: 0,
StartChunkHash: daChunkHash,
EndChunkHash: daChunkHash,
}
batchL1CommitCalldataSize, err = EstimateBatchL1CommitCalldataSize(batch)

View File

@@ -27,12 +27,6 @@ type Batch struct {
TotalL1MessagePoppedBefore uint64
ParentBatchHash common.Hash
Chunks []*Chunk
// Only used in updating db info.
StartChunkIndex uint64
EndChunkIndex uint64
StartChunkHash common.Hash
EndChunkHash common.Hash
}
// NumL1Messages returns the number of L1 messages in this block.

View File

@@ -5,7 +5,7 @@ import (
"runtime/debug"
)
var tag = "v4.3.71"
var tag = "v4.3.72"
var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {