mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-16 23:08:45 +00:00
a069738c20
* update shared/params * update eth2-types deps * update protobufs * update shared/* * fix testutil/state * update beacon-chain/state * update beacon-chain/db * update tests * fix test * update beacon-chain/core * update beacon-chain/blockchain * update beacon-chain/cache * beacon-chain/forkchoice * update beacon-chain/operations * update beacon-chain/p2p * update beacon-chain/rpc * update sync/initial-sync * update deps * update deps * go fmt * update beacon-chain/sync * update endtoend/ * bazel build //beacon-chain - works w/o issues * update slasher code * udpate tools/ * update validator/ * update fastssz * fix build * fix test building * update tests * update ethereumapis deps * fix tests * update state/stategen * fix build * fix test * add FarFutureSlot * go imports * Radek's suggestions * Ivan's suggestions * type conversions * Nishant's suggestions * add more tests to rpc_send_request * fix test * clean up * fix conflicts Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: nisdas <nishdas93@gmail.com>
49 lines
2.0 KiB
Go
49 lines
2.0 KiB
Go
package kv
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/eth2-types"
|
|
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
|
dbtypes "github.com/prysmaticlabs/prysm/slasher/db/types"
|
|
)
|
|
|
|
const (
|
|
latestEpochKey = "LATEST_EPOCH_DETECTED"
|
|
chainHeadKey = "CHAIN_HEAD"
|
|
)
|
|
|
|
var (
|
|
indexedAttestationsRootsByTargetBucket = []byte("indexed-attestations-roots-by-target")
|
|
indexedAttestationsBucket = []byte("indexed-attestations")
|
|
// Slasher-related buckets.
|
|
historicIndexedAttestationsBucket = []byte("historic-indexed-attestations-bucket")
|
|
historicBlockHeadersBucket = []byte("historic-block-headers-bucket")
|
|
highestAttestationBucket = []byte("highest-attestation-bucket")
|
|
slashingBucket = []byte("slashing-bucket")
|
|
chainDataBucket = []byte("chain-data-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")
|
|
validatorsMinMaxSpanBucketNew = []byte("validators-min-max-span-bucket-new")
|
|
)
|
|
|
|
func encodeSlotValidatorID(slot types.Slot, validatorID uint64) []byte {
|
|
return append(bytesutil.Bytes8(uint64(slot)), bytesutil.Bytes8(validatorID)...)
|
|
}
|
|
|
|
func encodeSlotValidatorIDSig(slot types.Slot, validatorID uint64, sig []byte) []byte {
|
|
return append(append(bytesutil.Bytes8(uint64(slot)), bytesutil.Bytes8(validatorID)...), sig...)
|
|
}
|
|
|
|
func encodeEpochSig(targetEpoch types.Epoch, sig []byte) []byte {
|
|
return append(bytesutil.Bytes8(uint64(targetEpoch)), sig...)
|
|
}
|
|
func encodeType(st dbtypes.SlashingType) []byte {
|
|
return []byte{byte(st)}
|
|
}
|
|
func encodeTypeRoot(st dbtypes.SlashingType, root [32]byte) []byte {
|
|
return append([]byte{byte(st)}, root[:]...)
|
|
}
|