v1

package
v5.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Overview

Package v1 defines mappings of types as defined by the web3signer official specification for its v1 version i.e. /api/v1/eth2

Web3Signer Specs are found by searching Consensys' Web3Signer API specification

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateAndProof

type AggregateAndProof struct {
	AggregatorIndex string        `json:"aggregator_index"` /* uint64 */
	Aggregate       *Attestation  `json:"aggregate"`
	SelectionProof  hexutil.Bytes `json:"selection_proof"` /* 96 bytes */
}

AggregateAndProof a sub property of AggregateAndProofSignRequest.

func MapAggregateAndProof

func MapAggregateAndProof(from *ethpb.AggregateAttestationAndProof) (*AggregateAndProof, error)

MapAggregateAndProof maps the eth2.AggregateAndProof proto to the Web3Signer spec.

type AggregateAndProofSignRequest

type AggregateAndProofSignRequest struct {
	Type              string             `json:"type" validate:"required"`
	ForkInfo          *ForkInfo          `json:"fork_info" validate:"required"`
	SigningRoot       hexutil.Bytes      `json:"signingRoot"`
	AggregateAndProof *AggregateAndProof `json:"aggregate_and_proof" validate:"required"`
}

AggregateAndProofSignRequest is a request object for web3signer sign api.

func GetAggregateAndProofSignRequest

func GetAggregateAndProofSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*AggregateAndProofSignRequest, error)

GetAggregateAndProofSignRequest maps the request for signing type AGGREGATE_AND_PROOF.

type AggregationSlot

type AggregationSlot struct {
	Slot string `json:"slot"`
}

AggregationSlot a sub property of AggregationSlotSignRequest.

type AggregationSlotSignRequest

type AggregationSlotSignRequest struct {
	Type            string           `json:"type" validate:"required"`
	ForkInfo        *ForkInfo        `json:"fork_info" validate:"required"`
	SigningRoot     hexutil.Bytes    `json:"signingRoot"`
	AggregationSlot *AggregationSlot `json:"aggregation_slot" validate:"required"`
}

AggregationSlotSignRequest is a request object for web3signer sign api.

func GetAggregationSlotSignRequest

func GetAggregationSlotSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*AggregationSlotSignRequest, error)

GetAggregationSlotSignRequest maps the request for signing type AGGREGATION_SLOT.

type Attestation

type Attestation struct {
	AggregationBits hexutil.Bytes    `json:"aggregation_bits"` /*hex bitlist*/
	Data            *AttestationData `json:"data"`
	Signature       hexutil.Bytes    `json:"signature"`
}

Attestation a sub property of AggregateAndProofSignRequest.

func MapAttestation

func MapAttestation(attestation *ethpb.Attestation) (*Attestation, error)

MapAttestation maps the eth2.Attestation proto to the Web3Signer spec.

type AttestationData

type AttestationData struct {
	Slot            string        `json:"slot"`  /* uint64 */
	Index           string        `json:"index"` /* uint64 */ // Prysm uses CommitteeIndex but web3signer uses index.
	BeaconBlockRoot hexutil.Bytes `json:"beacon_block_root"`
	Source          *Checkpoint   `json:"source"`
	Target          *Checkpoint   `json:"target"`
}

AttestationData a sub property of Attestation.

func MapAttestationData

func MapAttestationData(data *ethpb.AttestationData) (*AttestationData, error)

MapAttestationData maps the eth2.AttestationData proto to the Web3Signer spec.

type AttestationSignRequest

type AttestationSignRequest struct {
	Type        string           `json:"type" validate:"required"`
	ForkInfo    *ForkInfo        `json:"fork_info" validate:"required"`
	SigningRoot hexutil.Bytes    `json:"signingRoot"`
	Attestation *AttestationData `json:"attestation" validate:"required"`
}

AttestationSignRequest is a request object for web3signer sign api.

func GetAttestationSignRequest

func GetAttestationSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*AttestationSignRequest, error)

GetAttestationSignRequest maps the request for signing type ATTESTATION.

type AttesterSlashing

type AttesterSlashing struct {
	Attestation1 *IndexedAttestation `json:"attestation_1"`
	Attestation2 *IndexedAttestation `json:"attestation_2"`
}

AttesterSlashing a sub property of BeaconBlockBody.

func MapAttesterSlashing

func MapAttesterSlashing(slashing *ethpb.AttesterSlashing) (*AttesterSlashing, error)

MapAttesterSlashing maps the eth2.AttesterSlashing proto to the Web3Signer spec.

type BeaconBlock

type BeaconBlock struct {
	Slot          string           `json:"slot"`           /* uint64 */
	ProposerIndex string           `json:"proposer_index"` /* uint64 */
	ParentRoot    hexutil.Bytes    `json:"parent_root"`
	StateRoot     hexutil.Bytes    `json:"state_root"`
	Body          *BeaconBlockBody `json:"body"`
}

BeaconBlock a sub property of BeaconBlockBlockV2.

type BeaconBlockAltair

type BeaconBlockAltair struct {
	Slot          string                 `json:"slot"`
	ProposerIndex string                 `json:"proposer_index"`
	ParentRoot    hexutil.Bytes          `json:"parent_root"`
	StateRoot     hexutil.Bytes          `json:"state_root"`
	Body          *BeaconBlockBodyAltair `json:"body"`
}

BeaconBlockAltair a sub property of BeaconBlockAltairBlockV2.

func MapBeaconBlockAltair

func MapBeaconBlockAltair(block *ethpb.BeaconBlockAltair) (*BeaconBlockAltair, error)

MapBeaconBlockAltair maps the eth2.BeaconBlockAltair proto to the Web3Signer spec.

type BeaconBlockAltairBlockV2

type BeaconBlockAltairBlockV2 struct {
	Version string             `json:"version" enum:"true"`
	Block   *BeaconBlockAltair `json:"block"`
}

BeaconBlockAltairBlockV2 a sub property of BlockAltairSignRequest.

type BeaconBlockBlockV2

type BeaconBlockBlockV2 struct {
	Version string       `json:"version" enum:"true"`
	Block   *BeaconBlock `json:"beacon_block"`
}

BeaconBlockBlockV2 a sub property of BlockV2SignRequest.

type BeaconBlockBody

type BeaconBlockBody struct {
	RandaoReveal      hexutil.Bytes          `json:"randao_reveal"`
	Eth1Data          *Eth1Data              `json:"eth1_data"`
	Graffiti          hexutil.Bytes          `json:"graffiti"` // 32 bytes
	ProposerSlashings []*ProposerSlashing    `json:"proposer_slashings"`
	AttesterSlashings []*AttesterSlashing    `json:"attester_slashings"`
	Attestations      []*Attestation         `json:"attestations"`
	Deposits          []*Deposit             `json:"deposits"`
	VoluntaryExits    []*SignedVoluntaryExit `json:"voluntary_exits"`
}

BeaconBlockBody a sub property of BeaconBlock.

func MapBeaconBlockBody

func MapBeaconBlockBody(body *ethpb.BeaconBlockBody) (*BeaconBlockBody, error)

MapBeaconBlockBody maps the eth2.BeaconBlockBody proto to the Web3Signer spec.

type BeaconBlockBodyAltair

type BeaconBlockBodyAltair struct {
	RandaoReveal      hexutil.Bytes          `json:"randao_reveal"`
	Eth1Data          *Eth1Data              `json:"eth1_data"`
	Graffiti          hexutil.Bytes          `json:"graffiti"` /* Hash32 */
	ProposerSlashings []*ProposerSlashing    `json:"proposer_slashings"`
	AttesterSlashings []*AttesterSlashing    `json:"attester_slashings"`
	Attestations      []*Attestation         `json:"attestations"`
	Deposits          []*Deposit             `json:"deposits"`
	VoluntaryExits    []*SignedVoluntaryExit `json:"voluntary_exits"`
	SyncAggregate     *SyncAggregate         `json:"sync_aggregate"`
}

BeaconBlockBodyAltair a sub property of BeaconBlockAltair.

func MapBeaconBlockBodyAltair

func MapBeaconBlockBodyAltair(body *ethpb.BeaconBlockBodyAltair) (*BeaconBlockBodyAltair, error)

MapBeaconBlockBodyAltair maps the eth2.BeaconBlockBodyAltair proto to the Web3Signer spec.

type BeaconBlockHeader

type BeaconBlockHeader struct {
	Slot          string        `json:"slot"`           /* uint64 */
	ProposerIndex string        `json:"proposer_index"` /* uint64 */
	ParentRoot    hexutil.Bytes `json:"parent_root"`    /* Hash32 */
	StateRoot     hexutil.Bytes `json:"state_root"`     /* Hash32 */
	BodyRoot      hexutil.Bytes `json:"body_root"`      /* Hash32 */
}

BeaconBlockHeader is a sub property of SignedBeaconBlockHeader.

type BeaconBlockV2Blinded

type BeaconBlockV2Blinded struct {
	Version     string             `json:"version" enum:"true"`
	BlockHeader *BeaconBlockHeader `json:"block_header"`
}

BeaconBlockV2Blinded a field of BlockV2BlindedSignRequest. Supports Bellatrix(merge) and Capella

type BlockAltairSignRequest

type BlockAltairSignRequest struct {
	Type        string                    `json:"type" validate:"required"`
	ForkInfo    *ForkInfo                 `json:"fork_info" validate:"required"`
	SigningRoot hexutil.Bytes             `json:"signingRoot"`
	BeaconBlock *BeaconBlockAltairBlockV2 `json:"beacon_block" validate:"required"`
}

BlockAltairSignRequest is a request object for web3signer sign api.

func GetBlockAltairSignRequest

func GetBlockAltairSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*BlockAltairSignRequest, error)

GetBlockAltairSignRequest maps the request for signing type BLOCK_V2.

type BlockSignRequest

type BlockSignRequest struct {
	Type        string        `json:"type" validate:"required"`
	ForkInfo    *ForkInfo     `json:"fork_info" validate:"required"`
	SigningRoot hexutil.Bytes `json:"signingRoot"`
	Block       *BeaconBlock  `json:"block" validate:"required"`
}

BlockSignRequest is a request object for web3signer sign api.

func GetBlockSignRequest

func GetBlockSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*BlockSignRequest, error)

GetBlockSignRequest maps the request for signing type BLOCK.

type BlockV2BlindedSignRequest

type BlockV2BlindedSignRequest struct {
	Type        string                `json:"type" validate:"required"`
	ForkInfo    *ForkInfo             `json:"fork_info" validate:"required"`
	SigningRoot hexutil.Bytes         `json:"signingRoot"`
	BeaconBlock *BeaconBlockV2Blinded `json:"beacon_block" validate:"required"`
}

BlockV2BlindedSignRequest is a request object for web3signer sign api Supports Bellatrix(merge) and Capella

func GetBlockV2BlindedSignRequest

func GetBlockV2BlindedSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*BlockV2BlindedSignRequest, error)

GetBlockV2BlindedSignRequest maps the request for signing types (GetBlockV2 id defined by the remote signer interface and not the beacon APIs) Supports Bellatrix, Capella, Deneb

type Checkpoint

type Checkpoint struct {
	Epoch string `json:"epoch"`
	Root  string `json:"root"`
}

Checkpoint a sub property of AttestationData.

func MapCheckPoint

func MapCheckPoint(checkpoint *ethpb.Checkpoint) (*Checkpoint, error)

MapCheckPoint maps the eth2.Checkpoint proto to the Web3Signer spec.

type ContributionAndProof

type ContributionAndProof struct {
	AggregatorIndex string                     `json:"aggregator_index"` /* uint64 */
	SelectionProof  hexutil.Bytes              `json:"selection_proof"`  /* 96 byte hexadecimal */
	Contribution    *SyncCommitteeContribution `json:"contribution"`
}

ContributionAndProof a sub property of AggregatorSelectionSignRequest.

func MapContributionAndProof

func MapContributionAndProof(contribution *ethpb.ContributionAndProof) (*ContributionAndProof, error)

MapContributionAndProof maps the eth2.ContributionAndProof proto to the Web3Signer spec.

type Deposit

type Deposit struct {
	Proof []string     `json:"proof"`
	Data  *DepositData `json:"data"`
}

Deposit a sub property of DepositSignRequest.

func MapDeposit

func MapDeposit(deposit *ethpb.Deposit) (*Deposit, error)

MapDeposit maps the eth2.Deposit proto to the Web3Signer spec.

type DepositData

type DepositData struct {
	PublicKey             hexutil.Bytes `json:"pubkey"`
	WithdrawalCredentials hexutil.Bytes `json:"withdrawal_credentials"`
	Amount                string        `json:"amount"` /* uint64 */
	Signature             hexutil.Bytes `json:"signature"`
}

DepositData a sub property of Deposit. DepositData Prysm uses Deposit_data instead of DepositData which is inconsistent naming

type Eth1Data

type Eth1Data struct {
	DepositRoot  hexutil.Bytes `json:"deposit_root"`
	DepositCount string        `json:"deposit_count"` /* uint64 */
	BlockHash    hexutil.Bytes `json:"block_hash"`
}

Eth1Data a sub property of BeaconBlockBody.

type Fork

type Fork struct {
	PreviousVersion hexutil.Bytes `json:"previous_version"`
	CurrentVersion  hexutil.Bytes `json:"current_version"`
	Epoch           string        `json:"epoch"` /*uint64*/
}

Fork a sub property of ForkInfo.

type ForkInfo

type ForkInfo struct {
	Fork                  *Fork         `json:"fork"`
	GenesisValidatorsRoot hexutil.Bytes `json:"genesis_validators_root"`
}

ForkInfo a sub property object of the Sign request

func MapForkInfo

func MapForkInfo(slot primitives.Slot, genesisValidatorsRoot []byte) (*ForkInfo, error)

MapForkInfo maps the eth2.ForkInfo proto to the Web3Signer spec.

type IndexedAttestation

type IndexedAttestation struct {
	AttestingIndices []string         `json:"attesting_indices"` /* uint64[] */
	Data             *AttestationData `json:"data"`
	Signature        hexutil.Bytes    `json:"signature"`
}

IndexedAttestation a sub property of AttesterSlashing.

func MapIndexedAttestation

func MapIndexedAttestation(attestation *ethpb.IndexedAttestation) (*IndexedAttestation, error)

MapIndexedAttestation maps the eth2.IndexedAttestation proto to the Web3Signer spec.

type ProposerSlashing

type ProposerSlashing struct {
	// Prysm uses Header_1 but web3signer uses signed_header_1.
	Signedheader1 *SignedBeaconBlockHeader `json:"signed_header_1"`
	// Prysm uses Header_2 but web3signer uses signed_header_2.
	Signedheader2 *SignedBeaconBlockHeader `json:"signed_header_2"`
}

ProposerSlashing a sub property of BeaconBlockBody.

func MapProposerSlashing

func MapProposerSlashing(slashing *ethpb.ProposerSlashing) (*ProposerSlashing, error)

MapProposerSlashing maps the eth2.ProposerSlashing proto to the Web3Signer spec.

type RandaoReveal

type RandaoReveal struct {
	Epoch string `json:"epoch"` /* uint64 */
}

RandaoReveal a sub property of RandaoRevealSignRequest.

type RandaoRevealSignRequest

type RandaoRevealSignRequest struct {
	Type         string        `json:"type" validate:"required"`
	ForkInfo     *ForkInfo     `json:"fork_info" validate:"required"`
	SigningRoot  hexutil.Bytes `json:"signingRoot"`
	RandaoReveal *RandaoReveal `json:"randao_reveal" validate:"required"`
}

RandaoRevealSignRequest is a request object for web3signer sign api.

func GetRandaoRevealSignRequest

func GetRandaoRevealSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*RandaoRevealSignRequest, error)

GetRandaoRevealSignRequest maps the request for signing type RANDAO_REVEAL.

type SignedBeaconBlockHeader

type SignedBeaconBlockHeader struct {
	Message   *BeaconBlockHeader `json:"message"`
	Signature hexutil.Bytes      `json:"signature"`
}

SignedBeaconBlockHeader is a sub property of ProposerSlashing.

func MapSignedBeaconBlockHeader

func MapSignedBeaconBlockHeader(signedHeader *ethpb.SignedBeaconBlockHeader) (*SignedBeaconBlockHeader, error)

MapSignedBeaconBlockHeader maps the eth2.AttesterSlashing proto to the Web3Signer spec.

type SignedVoluntaryExit

type SignedVoluntaryExit struct {
	// Prysm uses Exit instead of Message
	Message   *VoluntaryExit `json:"message"`
	Signature hexutil.Bytes  `json:"signature"`
}

SignedVoluntaryExit is a sub property of BeaconBlockBody.

func MapSignedVoluntaryExit

func MapSignedVoluntaryExit(signedVoluntaryExit *ethpb.SignedVoluntaryExit) (*SignedVoluntaryExit, error)

MapSignedVoluntaryExit maps the eth2.SignedVoluntaryExit proto to the Web3Signer spec.

type SyncAggregate

type SyncAggregate struct {
	SyncCommitteeBits      hexutil.Bytes `json:"sync_committee_bits"`      /* SSZ hexadecimal string */
	SyncCommitteeSignature hexutil.Bytes `json:"sync_committee_signature"` /* 96 byte hexadecimal string */
}

SyncAggregate is a sub property of BeaconBlockBodyAltair.

type SyncAggregatorSelectionData

type SyncAggregatorSelectionData struct {
	Slot              string `json:"slot"`               /* uint64 */
	SubcommitteeIndex string `json:"subcommittee_index"` /* uint64 */
}

SyncAggregatorSelectionData a sub property of SyncAggregatorSelectionSignRequest.

func MapSyncAggregatorSelectionData

func MapSyncAggregatorSelectionData(data *ethpb.SyncAggregatorSelectionData) (*SyncAggregatorSelectionData, error)

MapSyncAggregatorSelectionData maps the eth2.SyncAggregatorSelectionData proto to the Web3Signer spec.

type SyncCommitteeContribution

type SyncCommitteeContribution struct {
	Slot              string        `json:"slot"`               /* uint64 */
	BeaconBlockRoot   hexutil.Bytes `json:"beacon_block_root"`  /* Hash32 */ // Prysm uses BlockRoot instead of BeaconBlockRoot
	SubcommitteeIndex string        `json:"subcommittee_index"` /* uint64 */
	AggregationBits   hexutil.Bytes `json:"aggregation_bits"`   /* SSZ hexadecimal string */
	Signature         hexutil.Bytes `json:"signature"`          /* 96 byte hexadecimal string */
}

SyncCommitteeContribution a sub property of AggregatorSelectionSignRequest.

type SyncCommitteeContributionAndProofSignRequest

type SyncCommitteeContributionAndProofSignRequest struct {
	Type                 string                `json:"type" validate:"required"`
	ForkInfo             *ForkInfo             `json:"fork_info" validate:"required"`
	SigningRoot          hexutil.Bytes         `json:"signingRoot"`
	ContributionAndProof *ContributionAndProof `json:"contribution_and_proof" validate:"required"`
}

SyncCommitteeContributionAndProofSignRequest is a request object for web3signer sign api.

func GetSyncCommitteeContributionAndProofSignRequest

func GetSyncCommitteeContributionAndProofSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*SyncCommitteeContributionAndProofSignRequest, error)

GetSyncCommitteeContributionAndProofSignRequest maps the request for signing type SYNC_COMMITTEE_CONTRIBUTION_AND_PROOF.

type SyncCommitteeMessage

type SyncCommitteeMessage struct {
	BeaconBlockRoot hexutil.Bytes `json:"beacon_block_root"` /* Hash32 */
	Slot            string        `json:"slot"`              /* uint64 */

}

SyncCommitteeMessage a sub property of SyncCommitteeSignRequest.

type SyncCommitteeMessageSignRequest

type SyncCommitteeMessageSignRequest struct {
	Type                 string                `json:"type" validate:"required"`
	ForkInfo             *ForkInfo             `json:"fork_info" validate:"required"`
	SigningRoot          hexutil.Bytes         `json:"signingRoot"`
	SyncCommitteeMessage *SyncCommitteeMessage `json:"sync_committee_message" validate:"required"`
}

SyncCommitteeMessageSignRequest is a request object for web3signer sign api.

func GetSyncCommitteeMessageSignRequest

func GetSyncCommitteeMessageSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*SyncCommitteeMessageSignRequest, error)

GetSyncCommitteeMessageSignRequest maps the request for signing type SYNC_COMMITTEE_MESSAGE.

type SyncCommitteeSelectionProofSignRequest

type SyncCommitteeSelectionProofSignRequest struct {
	Type                        string                       `json:"type" validate:"required"`
	ForkInfo                    *ForkInfo                    `json:"fork_info" validate:"required"`
	SigningRoot                 hexutil.Bytes                `json:"signingRoot"`
	SyncAggregatorSelectionData *SyncAggregatorSelectionData `json:"sync_aggregator_selection_data" validate:"required"`
}

SyncCommitteeSelectionProofSignRequest is a request object for web3signer sign api.

func GetSyncCommitteeSelectionProofSignRequest

func GetSyncCommitteeSelectionProofSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*SyncCommitteeSelectionProofSignRequest, error)

GetSyncCommitteeSelectionProofSignRequest maps the request for signing type SYNC_COMMITTEE_SELECTION_PROOF.

type ValidatorRegistration

type ValidatorRegistration struct {
	FeeRecipient hexutil.Bytes `json:"fee_recipient" validate:"required"` /* 42 hexadecimal string */
	GasLimit     string        `json:"gas_limit" validate:"required"`     /* uint64 */
	Timestamp    string        `json:"timestamp" validate:"required"`     /* uint64 */
	Pubkey       hexutil.Bytes `json:"pubkey"  validate:"required"`       /* bls hexadecimal string */
}

ValidatorRegistration a sub property of ValidatorRegistrationSignRequest

type ValidatorRegistrationSignRequest

type ValidatorRegistrationSignRequest struct {
	Type                  string                 `json:"type" validate:"required"`
	SigningRoot           hexutil.Bytes          `json:"signingRoot"`
	ValidatorRegistration *ValidatorRegistration `json:"validator_registration" validate:"required"`
}

ValidatorRegistrationSignRequest a request object for web3signer sign api.

func GetValidatorRegistrationSignRequest

func GetValidatorRegistrationSignRequest(request *validatorpb.SignRequest) (*ValidatorRegistrationSignRequest, error)

GetValidatorRegistrationSignRequest maps the request for signing type VALIDATOR_REGISTRATION.

type VoluntaryExit

type VoluntaryExit struct {
	Epoch          string `json:"epoch"`           /* uint64 */
	ValidatorIndex string `json:"validator_index"` /* uint64 */
}

VoluntaryExit a sub property of SignedVoluntaryExit.

type VoluntaryExitSignRequest

type VoluntaryExitSignRequest struct {
	Type          string         `json:"type" validate:"required"`
	ForkInfo      *ForkInfo      `json:"fork_info"`
	SigningRoot   hexutil.Bytes  `json:"signingRoot" validate:"required"`
	VoluntaryExit *VoluntaryExit `json:"voluntary_exit" validate:"required"`
}

VoluntaryExitSignRequest is a request object for web3signer sign api.

func GetVoluntaryExitSignRequest

func GetVoluntaryExitSignRequest(request *validatorpb.SignRequest, genesisValidatorsRoot []byte) (*VoluntaryExitSignRequest, error)

GetVoluntaryExitSignRequest maps the request for signing type VOLUNTARY_EXIT.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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