mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
b50f1583f3
* store validator min max span * terence feedback * terence feedback * raul feedback * raul formatting feedback * raul formatting feedback * raul validatorIdx feedback * fix * shorter err * Update slasher/db/min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/min_max-span_test.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/db/min_max-span_test.go
31 lines
1.2 KiB
Go
31 lines
1.2 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")
|
|
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(sourceEpoch uint64, targetEpoch uint64, sig []byte) []byte {
|
|
st := append(bytesutil.Bytes8(sourceEpoch), bytesutil.Bytes8(targetEpoch)...)
|
|
return append(st, sig...)
|
|
}
|