Skip to content

Commit

Permalink
compression helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak committed Jan 10, 2025
1 parent 1de9ee0 commit d2ba626
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions encoding/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,24 +643,10 @@ func GetHardforkName(config *params.ChainConfig, blockHeight, blockTimestamp uin
return "curie"
} else if !config.IsDarwinV2(blockTimestamp) {
return "darwin"
} else {
} else if !config.IsEuclid(blockTimestamp) {
return "darwinV2"
}
}

// GetCodecVersion returns the encoding codec version for the given block height and timestamp.
func GetCodecVersion(config *params.ChainConfig, blockHeight, blockTimestamp uint64) CodecVersion {
blockHeightBigInt := new(big.Int).SetUint64(blockHeight)
if !config.IsBernoulli(blockHeightBigInt) {
return CodecV0
} else if !config.IsCurie(blockHeightBigInt) {
return CodecV1
} else if !config.IsDarwin(blockTimestamp) {
return CodecV2
} else if !config.IsDarwinV2(blockTimestamp) {
return CodecV3
} else {
return CodecV4
return "euclid"
}
}

Expand Down Expand Up @@ -689,7 +675,7 @@ func GetChunkEnableCompression(codecVersion CodecVersion, chunk *Chunk) (bool, e
return false, nil
case CodecV2, CodecV3:
return true, nil
case CodecV4:
case CodecV4, CodecV5, CodecV6:
return CheckChunkCompressedDataCompatibility(chunk, codecVersion)
default:
return false, fmt.Errorf("unsupported codec version: %v", codecVersion)
Expand All @@ -703,7 +689,7 @@ func GetBatchEnableCompression(codecVersion CodecVersion, batch *Batch) (bool, e
return false, nil
case CodecV2, CodecV3:
return true, nil
case CodecV4:
case CodecV4, CodecV5, CodecV6:
return CheckBatchCompressedDataCompatibility(batch, codecVersion)
default:
return false, fmt.Errorf("unsupported codec version: %v", codecVersion)
Expand Down

0 comments on commit d2ba626

Please sign in to comment.