Skip to content

Commit

Permalink
add CheckChunkCompressedDataCompatibility & CheckBatchCompressedDataC…
Browse files Browse the repository at this point in the history
…ompatibility
  • Loading branch information
colinlyguo committed Oct 7, 2024
1 parent 6934f3d commit 0079225
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions encoding/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,3 +605,21 @@ func GetMaxChunksPerBatch(config *params.ChainConfig, blockHeight, blockTimestam
return 45
}
}

// CheckChunkCompressedDataCompatibility checks compressed data compatibility of a batch built by a single chunk.
func CheckChunkCompressedDataCompatibility(chunk *Chunk, codecVersion CodecVersion) (bool, error) {
codec, err := CodecFromVersion(codecVersion)
if err != nil {
return false, fmt.Errorf("failed to get codec from version: %w", err)
}
return codec.CheckChunkCompressedDataCompatibility(chunk)
}

// CheckBatchCompressedDataCompatibility checks compressed data compatibility of a batch built by a single chunk.
func CheckBatchCompressedDataCompatibility(batch *Batch, codecVersion CodecVersion) (bool, error) {
codec, err := CodecFromVersion(codecVersion)
if err != nil {
return false, fmt.Errorf("failed to get codec from version: %w", err)
}
return codec.CheckBatchCompressedDataCompatibility(batch)
}

0 comments on commit 0079225

Please sign in to comment.