mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Add ProtecingKeymanager interface and calls (#4982)
* Add ProtectedKeymanager interface and calls * Rename interface Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
This commit is contained in:
@@ -19,6 +19,7 @@ go_library(
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/interop:go_default_library",
|
||||
"//validator/accounts:go_default_library",
|
||||
"@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
"@com_github_wealdtech_go_eth2_wallet//:go_default_library",
|
||||
"@com_github_wealdtech_go_eth2_wallet_store_filesystem//:go_default_library",
|
||||
|
||||
@@ -3,6 +3,7 @@ package keymanager
|
||||
import (
|
||||
"errors"
|
||||
|
||||
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
)
|
||||
|
||||
@@ -12,6 +13,9 @@ var ErrNoSuchKey = errors.New("no such key")
|
||||
// ErrCannotSign is returned whenever a signing attempt fails.
|
||||
var ErrCannotSign = errors.New("cannot sign")
|
||||
|
||||
// ErrCouldSlash is returned whenever a signing attempt is refused due to a potential slashing event.
|
||||
var ErrCouldSlash = errors.New("could result in a slashing event")
|
||||
|
||||
// KeyManager controls access to private keys by the validator.
|
||||
type KeyManager interface {
|
||||
// FetchValidatingKeys fetches the list of public keys that should be used to validate with.
|
||||
@@ -19,3 +23,12 @@ type KeyManager interface {
|
||||
// Sign signs a message for the validator to broadcast.
|
||||
Sign(pubKey [48]byte, root [32]byte, domain uint64) (*bls.Signature, error)
|
||||
}
|
||||
|
||||
// ProtectingKeyManager provides access to a keymanager that protects its clients from slashing events.
|
||||
type ProtectingKeyManager interface {
|
||||
// SignProposal signs a block proposal for the validator to broadcast.
|
||||
SignProposal(pubKey [48]byte, domain uint64, data *ethpb.BeaconBlock) (*bls.Signature, error)
|
||||
|
||||
// SignAttestation signs an attestation for the validator to broadcast.
|
||||
SignAttestation(pubKey [48]byte, domain uint64, data *ethpb.AttestationData) (*bls.Signature, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user