Skip to content

Commit

Permalink
add sanity check for version to deserialization of committedBatchMetaV7
Browse files Browse the repository at this point in the history
  • Loading branch information
jonastheis committed Feb 12, 2025
1 parent 4022989 commit d4cc897
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/rawdb/accessors_rollup_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ func ReadCommittedBatchMeta(db ethdb.Reader, batchIndex uint64) (*CommittedBatch
// Try decoding from the newest format for future proofness, then the older one for old data.
cbm7 := new(committedBatchMetaV7)
if err = rlp.Decode(bytes.NewReader(data), cbm7); err == nil {
if encoding.CodecVersion(cbm7.Version) < encoding.CodecV7 {
return nil, fmt.Errorf("unexpected committed batch metadata version: batch index %d, version %d", batchIndex, cbm7.Version)
}
return &CommittedBatchMeta{
Version: cbm7.Version,
ChunkBlockRanges: cbm7.ChunkBlockRanges,
Expand Down

0 comments on commit d4cc897

Please sign in to comment.