You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add decoding mehods
* add tests for codecv0 and ccodecv1
* decompressing
* add decompressing for codecv2
* fix
* change zstd library from c binding to full go port
* handle error
* sync with main
* add v3 decoding
* refactor: make DAChunkRawTx an alias
* address comments
* comment
* comment
* address comments
* fix test
* support v4
* address renaming nit-picks
---------
Co-authored-by: jonastheis <[email protected]>
returnnil, fmt.Errorf("skippedL1MessageBitmap length doesn't match, skippedL1MessageBitmap length should be equal 0 modulo 32, length of skippedL1MessageBitmap: %v", length)
72
+
}
73
+
iflength*8<totalL1MessagePopped {
74
+
returnnil, fmt.Errorf("skippedL1MessageBitmap length is too small, skippedL1MessageBitmap length should be at least %v, length of skippedL1MessageBitmap: %v", (totalL1MessagePopped+7)/8, length)
returnnil, fmt.Errorf("chunk size doesn't match, next tx size is less then 4, byte length of chunk: %v, expected minimum length: %v, txNum without l1 msgs: %d", len(chunk), currentIndex+TxLenByteSize, i)
returnnil, fmt.Errorf("invalid chunk, length is less than 1")
108
+
}
109
+
110
+
numBlocks:=int(chunk[0])
111
+
iflen(chunk) <1+numBlocks*BlockContextByteSize {
112
+
returnnil, fmt.Errorf("chunk size doesn't match with numBlocks, byte length of chunk: %v, expected length: %v", len(chunk), 1+numBlocks*BlockContextByteSize)
113
+
}
114
+
115
+
blocks:=make([]*DABlock, numBlocks)
116
+
fori:=0; i<numBlocks; i++ {
117
+
startIdx:=1+i*BlockContextByteSize// add 1 to skip numBlocks byte
118
+
endIdx:=startIdx+BlockContextByteSize
119
+
blocks[i] =&DABlock{}
120
+
err:=blocks[i].Decode(chunk[startIdx:endIdx])
121
+
iferr!=nil {
122
+
returnnil, err
123
+
}
124
+
}
125
+
126
+
vartransactions []types.Transactions
127
+
128
+
chunks=append(chunks, &DAChunkRawTx{
129
+
Blocks: blocks,
130
+
Transactions: transactions, // Transactions field is still empty in the phase of DecodeDAChunksRawTx, because txs moved to bobs and filled in DecodeTxsFromBlob method.
0 commit comments