Files
prysm/beacon-chain/db/kv/key.go
Bastin 207f36065a state-diff configs & kv functions (#15903)
* state-diff configs

* state diff kv functions

* potuz's comments

* Update config.go

* fix merge conflicts

* apply bazel's suggestion and fix some bugs

* preston's feedback
2025-11-19 19:27:56 +00:00

90 lines
2.0 KiB
Go

package kv
import "bytes"
func hasPhase0Key(enc []byte) bool {
if len(phase0Key) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(phase0Key)], phase0Key)
}
// In order for an encoding to be Altair compatible, it must be prefixed with altair key.
func hasAltairKey(enc []byte) bool {
if len(altairKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(altairKey)], altairKey)
}
func hasBellatrixKey(enc []byte) bool {
if len(bellatrixKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(bellatrixKey)], bellatrixKey)
}
func hasBellatrixBlindKey(enc []byte) bool {
if len(bellatrixBlindKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(bellatrixBlindKey)], bellatrixBlindKey)
}
func hasCapellaKey(enc []byte) bool {
if len(capellaKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(capellaKey)], capellaKey)
}
func hasCapellaBlindKey(enc []byte) bool {
if len(capellaBlindKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(capellaBlindKey)], capellaBlindKey)
}
func hasDenebKey(enc []byte) bool {
if len(denebKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(denebKey)], denebKey)
}
func hasDenebBlindKey(enc []byte) bool {
if len(denebBlindKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(denebBlindKey)], denebBlindKey)
}
// HasElectraKey verifies if the encoding is Electra compatible.
func HasElectraKey(enc []byte) bool {
if len(ElectraKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(ElectraKey)], ElectraKey)
}
func hasElectraBlindKey(enc []byte) bool {
if len(electraBlindKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(electraBlindKey)], electraBlindKey)
}
func hasFuluKey(enc []byte) bool {
if len(fuluKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(fuluKey)], fuluKey)
}
func hasFuluBlindKey(enc []byte) bool {
if len(fuluBlindKey) >= len(enc) {
return false
}
return bytes.Equal(enc[:len(fuluBlindKey)], fuluBlindKey)
}