signer

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

README

Blox Eth Key Manager - Validator Signer

blox.io

Validator Signer has the responsibility to sign the basic 3 operations an eth 2.0 validator needs:

- sign attestation
- sign block proposal
- sign attestation aggregation
- return available public keys
Instantiation
   signer := &signer.SimpleSigner{
   	wallet,
   	slashingProtector
   }

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FarFutureMaxValidEpoch = int64(time.Minute.Seconds() * 20)

FarFutureMaxValidEpoch is the max epoch of far future signing

Functions

func IsValidFarFutureEpoch

func IsValidFarFutureEpoch(network core.Network, epoch phase0.Epoch) bool

IsValidFarFutureEpoch prevents far into the future signing request, verify a slot is within the current epoch https://github.com/ethereum/eth2.0-specs/blob/dev/specs/phase0/validator.md#protection-best-practices

func IsValidFarFutureSlot

func IsValidFarFutureSlot(network core.Network, slot phase0.Slot) bool

IsValidFarFutureSlot returns true if the given slot is valid

Types

type SimpleSigner

type SimpleSigner struct {
	// contains filtered or unexported fields
}

SimpleSigner implements ValidatorSigner interface

func NewSimpleSigner

func NewSimpleSigner(wallet core.Wallet, slashingProtector core.SlashingProtector, network core.Network) *SimpleSigner

NewSimpleSigner is the constructor of SimpleSigner

func (*SimpleSigner) SignAggregateAndProof

func (signer *SimpleSigner) SignAggregateAndProof(agg *phase0.AggregateAndProof, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignAggregateAndProof signs aggregate and proof

func (*SimpleSigner) SignBeaconAttestation

func (signer *SimpleSigner) SignBeaconAttestation(attestation *phase0.AttestationData, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignBeaconAttestation signs beacon attestation data

func (*SimpleSigner) SignBeaconBlock

func (signer *SimpleSigner) SignBeaconBlock(b *spec.VersionedBeaconBlock, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignBeaconBlock signs the given beacon block

func (*SimpleSigner) SignBlindedBeaconBlock added in v1.2.0

func (signer *SimpleSigner) SignBlindedBeaconBlock(b *api.VersionedBlindedBeaconBlock, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignBlindedBeaconBlock signs the given beacon block

func (*SimpleSigner) SignBlock added in v1.2.0

func (signer *SimpleSigner) SignBlock(block ssz.HashRoot, slot phase0.Slot, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignBlock signs the given beacon block

func (*SimpleSigner) SignEpoch

func (signer *SimpleSigner) SignEpoch(epoch phase0.Epoch, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignEpoch signs the given epoch

func (*SimpleSigner) SignRegistration added in v1.2.0

func (signer *SimpleSigner) SignRegistration(registration *apiv1.ValidatorRegistration, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignRegistration signs the given ValidatorRegistration.

func (*SimpleSigner) SignSlot

func (signer *SimpleSigner) SignSlot(slot phase0.Slot, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignSlot signes the given slot

func (*SimpleSigner) SignSyncCommittee added in v1.1.1

func (signer *SimpleSigner) SignSyncCommittee(msgBlockRoot []byte, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignSyncCommittee sign sync committee

func (*SimpleSigner) SignSyncCommitteeContributionAndProof added in v1.1.1

func (signer *SimpleSigner) SignSyncCommitteeContributionAndProof(contribAndProof *altair.ContributionAndProof, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignSyncCommitteeContributionAndProof sign sync committee

func (*SimpleSigner) SignSyncCommitteeSelectionData added in v1.1.1

func (signer *SimpleSigner) SignSyncCommitteeSelectionData(data *altair.SyncAggregatorSelectionData, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignSyncCommitteeSelectionData sign sync committee slection data

type ValidatorSigner

type ValidatorSigner interface {
	SignBeaconBlock(block *spec.VersionedBeaconBlock, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignBlindedBeaconBlock(block *api.VersionedBlindedBeaconBlock, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignBeaconAttestation(attestation *phase0.AttestationData, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignAggregateAndProof(agg *phase0.AggregateAndProof, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignSlot(slot phase0.Slot, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignEpoch(epoch phase0.Epoch, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignSyncCommittee(msgBlockRoot []byte, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignSyncCommitteeSelectionData(data *altair.SyncAggregatorSelectionData, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignSyncCommitteeContributionAndProof(contribAndProof *altair.ContributionAndProof, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignRegistration(registration *apiv1.ValidatorRegistration, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
}

ValidatorSigner represents the behavior of the validator signer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL