signer

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 13 Imported by: 3

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 ComputeETHSigningRoot added in v1.3.0

func ComputeETHSigningRoot(obj ssz.HashRoot, domain phase0.Domain) (phase0.Root, error)

ComputeETHSigningRoot returns computed root for eth signing

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 SSZBytes added in v1.3.0

type SSZBytes []byte

SSZBytes --

func (SSZBytes) GetTree added in v1.3.0

func (b SSZBytes) GetTree() (*ssz.Node, error)

GetTree --

func (SSZBytes) HashTreeRoot added in v1.3.0

func (b SSZBytes) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (SSZBytes) HashTreeRootWith added in v1.3.0

func (b SSZBytes) HashTreeRootWith(hh ssz.HashWalker) error

HashTreeRootWith --

type SSZUint64 added in v1.3.0

type SSZUint64 uint64

SSZUint64 --

func (SSZUint64) GetTree added in v1.3.0

func (s SSZUint64) GetTree() (*ssz.Node, error)

GetTree --

func (SSZUint64) HashTreeRoot added in v1.3.0

func (s SSZUint64) HashTreeRoot() ([32]byte, error)

HashTreeRoot --

func (SSZUint64) HashTreeRootWith added in v1.3.0

func (s SSZUint64) HashTreeRootWith(hh ssz.HashWalker) error

HashTreeRootWith --

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) SignBLSToExecutionChange added in v1.3.0

func (signer *SimpleSigner) SignBLSToExecutionChange(blsToExecutionChange *capella.BLSToExecutionChange, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignBLSToExecutionChange signs the given BLSToExecutionChange. OFFLINE operation

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 *api.VersionedValidatorRegistration, 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

func (*SimpleSigner) SignVoluntaryExit added in v1.3.0

func (signer *SimpleSigner) SignVoluntaryExit(voluntaryExit *phase0.VoluntaryExit, domain phase0.Domain, pubKey []byte) ([]byte, []byte, error)

SignVoluntaryExit signs the given VoluntaryExit.

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 *api.VersionedValidatorRegistration, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignVoluntaryExit(voluntaryExit *phase0.VoluntaryExit, domain phase0.Domain, pubKey []byte) (sig []byte, root []byte, err error)
	SignBLSToExecutionChange(blsToExecutionChange *capella.BLSToExecutionChange, 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