mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 01:32:18 +00:00
0b35743d2c
* Merge branch 'master' of github.com:prysmaticlabs/prysm into update_validators # Conflicts: # slasher/flags/flags.go # slasher/main.go # slasher/service/data_update.go # slasher/service/service.go # slasher/service/service_test.go * proposal and attester store * day to status * comment change * one bucket * Merge branch 'master' of github.com:prysmaticlabs/prysm into attester_proposer_slashing_store # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. added comments * comment * typo fix * raul review fix * raul review fix full * nishant feedback * test fix * fix tests and remove update gofmt goimports * remove blank line in imports * nishant fixes * comment and fir delete proposer slashings * avoid marshal twice * remove space * Update slasher/db/attester_slashings.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * terence feedback Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: terence tsao <terence@prysmaticlabs.com>
37 lines
1.4 KiB
Go
37 lines
1.4 KiB
Go
package db
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
|
)
|
|
|
|
var (
|
|
// Slasher
|
|
historicIndexedAttestationsBucket = []byte("historic-indexed-attestations-bucket")
|
|
historicBlockHeadersBucket = []byte("historic-block-headers-bucket")
|
|
slashingBucket = []byte("slashing-bucket")
|
|
indexedAttestationsIndicesBucket = []byte("indexed-attestations-indices-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[:]...)
|
|
}
|