validatorapi

package
v0.0.0-...-5f8afbd Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateAttestation

func AggregateAttestation(ctx context.Context, cli eth2api.Client,
	attDataRoot common.Root, slot common.Slot, dest *phase0.Attestation) error

Aggregates all attestations matching given attestation data root and slot

func AttestationData

func AttestationData(ctx context.Context, cli eth2api.Client,
	slot common.Slot, committeeIndex common.CommitteeIndex,
	dest *phase0.AttestationData) error

Requests that the beacon node produce an AttestationData.

func AttesterDuties

func AttesterDuties(ctx context.Context, cli eth2api.Client,
	epoch common.Epoch, indices []common.ValidatorIndex, dest *eth2api.DependentAttesterDuties) (syncing bool, err error)

Requests the beacon node to provide a set of attestation duties, which should be performed by the requested validators, for a particular epoch.

Duties should only need to be checked once per epoch, however a chain reorganization (of > MIN_SEED_LOOKAHEAD epochs) could occur, resulting in a change of duties. For full safety, you should monitor head events and confirm the dependent root in this response matches:

  • event.previous_duty_dependent_root when `compute_epoch_at_slot(event.slot) == epoch`

  • event.current_duty_dependent_root when `compute_epoch_at_slot(event.slot) + 1 == epoch`

  • event.block otherwise

The dependent_root value is `get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch - 1) - 1)` or the genesis block root in the case of underflow.

Err will be non-nil when syncing.

func PrepareBeaconCommitteeSubnet

func PrepareBeaconCommitteeSubnet(ctx context.Context, cli eth2api.Client,
	signals []*eth2api.BeaconCommitteeSubscribeSignal) (syncing bool, err error)

Signal beacon node to prepare for a committee subnet.

After beacon node receives this request, search using discv5 for peers related to this subnet and replace current peers with those ones if necessary.

If validator `is_aggregator`, beacon node must: - announce subnet topic subscription on gossipsub - aggregate attestations received on that subnet

Success when the slot signature is valid and beacon node has prepared the attestation subnet. Note that, we cannot be certain Beacon node will find peers for that subnet for various reasons.

Err will be non-nil when syncing.

func PrepareSyncCommitteeSubnet

func PrepareSyncCommitteeSubnet(ctx context.Context, cli eth2api.Client,
	signals []*eth2api.SyncCommitteeSubscribeSignal) (syncing bool, err error)

Subscribe to a number of sync committee subnets

Sync committees are not present in phase0, but are required for Altair networks.

Subscribing to sync committee subnets is an action performed by VC to enable network participation in Altair networks, and only required if the VC has an active validator in an active sync committee.

Err will be non-nil when syncing.

func ProduceBlock

func ProduceBlock(ctx context.Context, cli eth2api.Client,
	slot common.Slot, randaoReveal common.BLSSignature, graffiti *common.Root, dest *phase0.BeaconBlock) (syncing bool, err error)

Requests a beacon node to produce a valid phase0 block, which can then be signed by a validator.

Err will be non-nil when syncing.

func ProduceBlockV2

func ProduceBlockV2(ctx context.Context, cli eth2api.Client,
	slot common.Slot, randaoReveal common.BLSSignature, graffiti *common.Root, dest *eth2api.VersionedBeaconBlock) (syncing bool, err error)

Requests a beacon node to produce a valid versioned block, which can then be signed by a validator.

Err will be non-nil when syncing.

func ProduceSyncCommitteeContribution

func ProduceSyncCommitteeContribution(ctx context.Context, cli eth2api.Client, slot common.Slot, subCommitteeIndex uint64,
	beaconBlockRoot common.Root, dest *altair.SyncCommitteeContribution) (syncing bool, err error)

Requests that the beacon node produces a sync committee contribution.

Err will be non-nil when syncing.

func ProposerDuties

func ProposerDuties(ctx context.Context, cli eth2api.Client, epoch common.Epoch, dest *eth2api.DependentProposerDuty) (syncing bool, err error)

Request beacon node to provide all validators that are scheduled to propose a block in the given epoch.

Duties should only need to be checked once per epoch, however a chain reorganization could occur that results in a change of duties. For full safety, you should monitor head events and confirm the dependent root in this response matches:

  • event.current_duty_dependent_root when `compute_epoch_at_slot(event.slot) == epoch`

  • event.block otherwise

The dependent_root value is `get_block_root_at_slot(state, compute_start_slot_at_epoch(epoch) - 1)` or the genesis block root in the case of underflow.

Err will be non-nil when syncing.

func PublishAggregateAndProofs

func PublishAggregateAndProofs(ctx context.Context, cli eth2api.Client,
	aggAndProofs []*phase0.SignedAggregateAndProof) error

Verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.

func PublishContributionAndProofs

func PublishContributionAndProofs(ctx context.Context, cli eth2api.Client, contribAndProofs []altair.SignedContributionAndProof) error

Publish multiple signed sync committee contribution and proofs

Err will be non-nil when syncing.

func SyncCommitteeDuties

func SyncCommitteeDuties(ctx context.Context, cli eth2api.Client,
	epoch common.Epoch, indices []common.ValidatorIndex, dest *[]eth2api.SyncCommitteeDuty) (syncing bool, err error)

Requests the beacon node to provide a set of sync committee duties for a particular epoch.

Types

This section is empty.

Jump to

Keyboard shortcuts

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