mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 01:32:18 +00:00
18fbdd53b9
* Rename elements for clarity * Merge branch 'master' of https://github.com/prysmaticlabs/Prysm into slasher-renames * Fix test * Rename more functions * Cleanup * Fix logs * Merge branch 'master' of https://github.com/prysmaticlabs/Prysm into slasher-renames * Reorganize and clean up logs * Address comments * Add comments
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
package db
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
|
)
|
|
|
|
const latestEpochKey = "LATEST_EPOCH_DETECTED"
|
|
|
|
var (
|
|
// Slasher
|
|
historicIndexedAttestationsBucket = []byte("historic-indexed-attestations-bucket")
|
|
historicBlockHeadersBucket = []byte("historic-block-headers-bucket")
|
|
slashingBucket = []byte("slashing-bucket")
|
|
compressedIdxAttsBucket = []byte("compressed-idx-atts-bucket")
|
|
validatorsPublicKeysBucket = []byte("validators-public-keys-bucket")
|
|
// In order to quickly detect surround and surrounded attestations we need to store
|
|
// the min and max span for each validator for each epoch.
|
|
// see https://github.com/protolambda/eth2-surround/blob/master/README.md#min-max-surround
|
|
validatorsMinMaxSpanBucket = []byte("validators-min-max-span-bucket")
|
|
)
|
|
|
|
func encodeEpochValidatorID(epoch uint64, validatorID uint64) []byte {
|
|
return append(bytesutil.Bytes8(epoch), bytesutil.Bytes8(validatorID)...)
|
|
}
|
|
|
|
func encodeEpochValidatorIDSig(epoch uint64, validatorID uint64, sig []byte) []byte {
|
|
return append(append(bytesutil.Bytes8(epoch), bytesutil.Bytes8(validatorID)...), sig...)
|
|
}
|
|
|
|
func encodeEpochSig(targetEpoch uint64, sig []byte) []byte {
|
|
return append(bytesutil.Bytes8(targetEpoch), sig...)
|
|
}
|
|
func encodeType(st SlashingType) []byte {
|
|
return []byte{byte(st)}
|
|
}
|
|
func encodeTypeRoot(st SlashingType, root [32]byte) []byte {
|
|
return append([]byte{byte(st)}, root[:]...)
|
|
}
|