shared

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttesterSlashingsToConsensus

func AttesterSlashingsToConsensus(src []*AttesterSlashing) ([]*eth.AttesterSlashing, error)

func AttsToConsensus

func AttsToConsensus(src []*Attestation) ([]*eth.Attestation, error)

func DecodeHexWithLength

func DecodeHexWithLength(s string, length int) ([]byte, error)

DecodeHexWithLength takes a string and a length in bytes, and validates whether the string is a hex and has the correct length.

func DecodeHexWithMaxLength

func DecodeHexWithMaxLength(s string, maxLength int) ([]byte, error)

DecodeHexWithMaxLength takes a string and a length in bytes, and validates whether the string is a hex and has the correct length.

func DepositsToConsensus

func DepositsToConsensus(src []*Deposit) ([]*eth.Deposit, error)

func ExitsToConsensus

func ExitsToConsensus(src []*SignedVoluntaryExit) ([]*eth.SignedVoluntaryExit, error)

func IsOptimistic

func IsOptimistic(
	ctx context.Context,
	w http.ResponseWriter,
	optimisticModeFetcher blockchain.OptimisticModeFetcher,
) (bool, error)

IsOptimistic checks whether the beacon node is currently optimistic and writes it to the response.

func IsSyncing

func IsSyncing(
	ctx context.Context,
	w http.ResponseWriter,
	syncChecker sync.Checker,
	headFetcher blockchain.HeadFetcher,
	timeFetcher blockchain.TimeFetcher,
	optimisticModeFetcher blockchain.OptimisticModeFetcher,
) bool

IsSyncing checks whether the beacon node is currently syncing and writes out the sync status.

func ProposerSlashingsToConsensus

func ProposerSlashingsToConsensus(src []*ProposerSlashing) ([]*eth.ProposerSlashing, error)

func Uint256ToSSZBytes

func Uint256ToSSZBytes(num string) ([]byte, error)

func UintFromQuery

func UintFromQuery(w http.ResponseWriter, r *http.Request, name string) (bool, string, uint64)

func ValidateHex

func ValidateHex(w http.ResponseWriter, name string, s string, length int) ([]byte, bool)

func ValidateUint

func ValidateUint(w http.ResponseWriter, name string, s string) (uint64, bool)

func VerifyMaxLength

func VerifyMaxLength[T any](v []T, max int) error

VerifyMaxLength takes a slice and a maximum length and validates the length.

func WriteBlockFetchError

func WriteBlockFetchError(w http.ResponseWriter, blk interfaces.ReadOnlySignedBeaconBlock, err error) bool

WriteBlockFetchError writes an appropriate error based on the supplied argument. The argument error should be a result of fetching block.

func WriteStateFetchError

func WriteStateFetchError(w http.ResponseWriter, err error)

WriteStateFetchError writes an appropriate error based on the supplied argument. The argument error should be a result of fetching state.

Types

type AggregateAttestationAndProof

type AggregateAttestationAndProof struct {
	AggregatorIndex string       `json:"aggregator_index" validate:"required,number,gte=0"`
	Aggregate       *Attestation `json:"aggregate" validate:"required"`
	SelectionProof  string       `json:"selection_proof" validate:"required,hexadecimal"`
}

func (*AggregateAttestationAndProof) ToConsensus

type Attestation

type Attestation struct {
	AggregationBits string           `json:"aggregation_bits" validate:"required,hexadecimal"`
	Data            *AttestationData `json:"data" validate:"required"`
	Signature       string           `json:"signature" validate:"required,hexadecimal"`
}

func AttestationFromConsensus

func AttestationFromConsensus(a *eth.Attestation) *Attestation

func AttsFromConsensus

func AttsFromConsensus(src []*eth.Attestation) ([]*Attestation, error)

func (*Attestation) ToConsensus

func (a *Attestation) ToConsensus() (*eth.Attestation, error)

type AttestationData

type AttestationData struct {
	Slot            string      `json:"slot" validate:"required,number,gte=0"`
	CommitteeIndex  string      `json:"index" validate:"required,number,gte=0"`
	BeaconBlockRoot string      `json:"beacon_block_root" validate:"required,hexadecimal"`
	Source          *Checkpoint `json:"source" validate:"required"`
	Target          *Checkpoint `json:"target" validate:"required"`
}

func AttestationDataFromConsensus

func AttestationDataFromConsensus(a *eth.AttestationData) *AttestationData

func (*AttestationData) ToConsensus

func (a *AttestationData) ToConsensus() (*eth.AttestationData, error)

type AttesterSlashing

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

func AttesterSlashingsFromConsensus

func AttesterSlashingsFromConsensus(src []*eth.AttesterSlashing) ([]*AttesterSlashing, error)

type BeaconBlock

type BeaconBlock struct {
	Slot          string           `json:"slot" validate:"required"`
	ProposerIndex string           `json:"proposer_index" validate:"required"`
	ParentRoot    string           `json:"parent_root" validate:"required"`
	StateRoot     string           `json:"state_root" validate:"required"`
	Body          *BeaconBlockBody `json:"body" validate:"required"`
}

func BeaconBlockFromConsensus

func BeaconBlockFromConsensus(b *eth.BeaconBlock) (*BeaconBlock, error)

func (*BeaconBlock) ToConsensus

func (b *BeaconBlock) ToConsensus() (*eth.BeaconBlock, error)

func (*BeaconBlock) ToGeneric

func (b *BeaconBlock) ToGeneric() (*eth.GenericBeaconBlock, error)

type BeaconBlockAltair

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

func BeaconBlockAltairFromConsensus

func BeaconBlockAltairFromConsensus(b *eth.BeaconBlockAltair) (*BeaconBlockAltair, error)

func (*BeaconBlockAltair) ToConsensus

func (b *BeaconBlockAltair) ToConsensus() (*eth.BeaconBlockAltair, error)

func (*BeaconBlockAltair) ToGeneric

func (b *BeaconBlockAltair) ToGeneric() (*eth.GenericBeaconBlock, error)

type BeaconBlockBellatrix

type BeaconBlockBellatrix struct {
	Slot          string                    `json:"slot" validate:"required"`
	ProposerIndex string                    `json:"proposer_index" validate:"required"`
	ParentRoot    string                    `json:"parent_root" validate:"required"`
	StateRoot     string                    `json:"state_root" validate:"required"`
	Body          *BeaconBlockBodyBellatrix `json:"body" validate:"required"`
}

func BeaconBlockBellatrixFromConsensus

func BeaconBlockBellatrixFromConsensus(b *eth.BeaconBlockBellatrix) (*BeaconBlockBellatrix, error)

func (*BeaconBlockBellatrix) ToConsensus

func (b *BeaconBlockBellatrix) ToConsensus() (*eth.BeaconBlockBellatrix, error)

func (*BeaconBlockBellatrix) ToGeneric

func (b *BeaconBlockBellatrix) ToGeneric() (*eth.GenericBeaconBlock, error)

type BeaconBlockBody

type BeaconBlockBody struct {
	RandaoReveal      string                 `json:"randao_reveal" validate:"required"`
	Eth1Data          *Eth1Data              `json:"eth1_data" validate:"required"`
	Graffiti          string                 `json:"graffiti" validate:"required"`
	ProposerSlashings []*ProposerSlashing    `json:"proposer_slashings" validate:"required"`
	AttesterSlashings []*AttesterSlashing    `json:"attester_slashings" validate:"required"`
	Attestations      []*Attestation         `json:"attestations" validate:"required"`
	Deposits          []*Deposit             `json:"deposits" validate:"required"`
	VoluntaryExits    []*SignedVoluntaryExit `json:"voluntary_exits" validate:"required"`
}

type BeaconBlockBodyAltair

type BeaconBlockBodyAltair struct {
	RandaoReveal      string                 `json:"randao_reveal" validate:"required"`
	Eth1Data          *Eth1Data              `json:"eth1_data" validate:"required"`
	Graffiti          string                 `json:"graffiti" validate:"required"`
	ProposerSlashings []*ProposerSlashing    `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings []*AttesterSlashing    `json:"attester_slashings" validate:"required,dive"`
	Attestations      []*Attestation         `json:"attestations" validate:"required,dive"`
	Deposits          []*Deposit             `json:"deposits" validate:"required,dive"`
	VoluntaryExits    []*SignedVoluntaryExit `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate     *SyncAggregate         `json:"sync_aggregate" validate:"required"`
}

type BeaconBlockBodyBellatrix

type BeaconBlockBodyBellatrix struct {
	RandaoReveal      string                 `json:"randao_reveal" validate:"required"`
	Eth1Data          *Eth1Data              `json:"eth1_data" validate:"required"`
	Graffiti          string                 `json:"graffiti" validate:"required"`
	ProposerSlashings []*ProposerSlashing    `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings []*AttesterSlashing    `json:"attester_slashings" validate:"required,dive"`
	Attestations      []*Attestation         `json:"attestations" validate:"required,dive"`
	Deposits          []*Deposit             `json:"deposits" validate:"required,dive"`
	VoluntaryExits    []*SignedVoluntaryExit `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate     *SyncAggregate         `json:"sync_aggregate" validate:"required"`
	ExecutionPayload  *ExecutionPayload      `json:"execution_payload" validate:"required"`
}

type BeaconBlockBodyCapella

type BeaconBlockBodyCapella struct {
	RandaoReveal          string                        `json:"randao_reveal" validate:"required"`
	Eth1Data              *Eth1Data                     `json:"eth1_data" validate:"required"`
	Graffiti              string                        `json:"graffiti" validate:"required"`
	ProposerSlashings     []*ProposerSlashing           `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings     []*AttesterSlashing           `json:"attester_slashings" validate:"required,dive"`
	Attestations          []*Attestation                `json:"attestations" validate:"required,dive"`
	Deposits              []*Deposit                    `json:"deposits" validate:"required,dive"`
	VoluntaryExits        []*SignedVoluntaryExit        `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate         *SyncAggregate                `json:"sync_aggregate" validate:"required"`
	ExecutionPayload      *ExecutionPayloadCapella      `json:"execution_payload" validate:"required"`
	BlsToExecutionChanges []*SignedBlsToExecutionChange `json:"bls_to_execution_changes" validate:"required,dive"`
}

type BeaconBlockBodyDeneb

type BeaconBlockBodyDeneb struct {
	RandaoReveal          string                        `json:"randao_reveal" validate:"required"`
	Eth1Data              *Eth1Data                     `json:"eth1_data" validate:"required"`
	Graffiti              string                        `json:"graffiti" validate:"required"`
	ProposerSlashings     []*ProposerSlashing           `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings     []*AttesterSlashing           `json:"attester_slashings" validate:"required,dive"`
	Attestations          []*Attestation                `json:"attestations" validate:"required,dive"`
	Deposits              []*Deposit                    `json:"deposits" validate:"required,dive"`
	VoluntaryExits        []*SignedVoluntaryExit        `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate         *SyncAggregate                `json:"sync_aggregate" validate:"required"`
	ExecutionPayload      *ExecutionPayloadDeneb        `json:"execution_payload" validate:"required"`
	BlsToExecutionChanges []*SignedBlsToExecutionChange `json:"bls_to_execution_changes" validate:"required,dive"`
	BlobKzgCommitments    []string                      `json:"blob_kzg_commitments" validate:"required,dive"`
}

type BeaconBlockCapella

type BeaconBlockCapella struct {
	Slot          string                  `json:"slot" validate:"required"`
	ProposerIndex string                  `json:"proposer_index" validate:"required"`
	ParentRoot    string                  `json:"parent_root" validate:"required"`
	StateRoot     string                  `json:"state_root" validate:"required"`
	Body          *BeaconBlockBodyCapella `json:"body" validate:"required"`
}

func BeaconBlockCapellaFromConsensus

func BeaconBlockCapellaFromConsensus(b *eth.BeaconBlockCapella) (*BeaconBlockCapella, error)

func (*BeaconBlockCapella) ToConsensus

func (b *BeaconBlockCapella) ToConsensus() (*eth.BeaconBlockCapella, error)

func (*BeaconBlockCapella) ToGeneric

func (b *BeaconBlockCapella) ToGeneric() (*eth.GenericBeaconBlock, error)

type BeaconBlockContentsDeneb

type BeaconBlockContentsDeneb struct {
	Block        *BeaconBlockDeneb `json:"block" validate:"required"`
	BlobSidecars []*BlobSidecar    `json:"blob_sidecars" validate:"dive"`
}

func (*BeaconBlockContentsDeneb) ToConsensus

func (*BeaconBlockContentsDeneb) ToGeneric

type BeaconBlockDeneb

type BeaconBlockDeneb struct {
	Slot          string                `json:"slot" validate:"required"`
	ProposerIndex string                `json:"proposer_index" validate:"required"`
	ParentRoot    string                `json:"parent_root" validate:"required"`
	StateRoot     string                `json:"state_root" validate:"required"`
	Body          *BeaconBlockBodyDeneb `json:"body" validate:"required"`
}

func BeaconBlockDenebFromConsensus

func BeaconBlockDenebFromConsensus(b *eth.BeaconBlockDeneb) (*BeaconBlockDeneb, error)

func (*BeaconBlockDeneb) ToConsensus

func (b *BeaconBlockDeneb) ToConsensus() (*eth.BeaconBlockDeneb, error)

type BeaconBlockHeader

type BeaconBlockHeader struct {
	Slot          string `json:"slot" validate:"required"`
	ProposerIndex string `json:"proposer_index" validate:"required"`
	ParentRoot    string `json:"parent_root" validate:"required"`
	StateRoot     string `json:"state_root" validate:"required"`
	BodyRoot      string `json:"body_root" validate:"required"`
}

func BeaconBlockHeaderFromConsensus

func BeaconBlockHeaderFromConsensus(h *eth.BeaconBlockHeader) *BeaconBlockHeader

type BeaconCommitteeSubscription

type BeaconCommitteeSubscription struct {
	ValidatorIndex   string `json:"validator_index" validate:"required,number,gte=0"`
	CommitteeIndex   string `json:"committee_index" validate:"required,number,gte=0"`
	CommitteesAtSlot string `json:"committees_at_slot" validate:"required,number,gte=0"`
	Slot             string `json:"slot" validate:"required,number,gte=0"`
	IsAggregator     bool   `json:"is_aggregator"`
}

func (*BeaconCommitteeSubscription) ToConsensus

type BlindedBeaconBlockBellatrix

type BlindedBeaconBlockBellatrix struct {
	Slot          string                           `json:"slot" validate:"required"`
	ProposerIndex string                           `json:"proposer_index" validate:"required"`
	ParentRoot    string                           `json:"parent_root" validate:"required"`
	StateRoot     string                           `json:"state_root" validate:"required"`
	Body          *BlindedBeaconBlockBodyBellatrix `json:"body" validate:"required"`
}

func (*BlindedBeaconBlockBellatrix) ToConsensus

func (*BlindedBeaconBlockBellatrix) ToGeneric

type BlindedBeaconBlockBodyBellatrix

type BlindedBeaconBlockBodyBellatrix struct {
	RandaoReveal           string                  `json:"randao_reveal" validate:"required"`
	Eth1Data               *Eth1Data               `json:"eth1_data" validate:"required"`
	Graffiti               string                  `json:"graffiti" validate:"required"`
	ProposerSlashings      []*ProposerSlashing     `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings      []*AttesterSlashing     `json:"attester_slashings" validate:"required,dive"`
	Attestations           []*Attestation          `json:"attestations" validate:"required,dive"`
	Deposits               []*Deposit              `json:"deposits" validate:"required,dive"`
	VoluntaryExits         []*SignedVoluntaryExit  `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate          *SyncAggregate          `json:"sync_aggregate" validate:"required"`
	ExecutionPayloadHeader *ExecutionPayloadHeader `json:"execution_payload_header" validate:"required"`
}

type BlindedBeaconBlockBodyCapella

type BlindedBeaconBlockBodyCapella struct {
	RandaoReveal           string                         `json:"randao_reveal" validate:"required"`
	Eth1Data               *Eth1Data                      `json:"eth1_data" validate:"required"`
	Graffiti               string                         `json:"graffiti" validate:"required"`
	ProposerSlashings      []*ProposerSlashing            `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings      []*AttesterSlashing            `json:"attester_slashings" validate:"required,dive"`
	Attestations           []*Attestation                 `json:"attestations" validate:"required,dive"`
	Deposits               []*Deposit                     `json:"deposits" validate:"required,dive"`
	VoluntaryExits         []*SignedVoluntaryExit         `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate          *SyncAggregate                 `json:"sync_aggregate" validate:"required"`
	ExecutionPayloadHeader *ExecutionPayloadHeaderCapella `json:"execution_payload_header" validate:"required"`
	BlsToExecutionChanges  []*SignedBlsToExecutionChange  `json:"bls_to_execution_changes" validate:"required,dive"`
}

type BlindedBeaconBlockBodyDeneb

type BlindedBeaconBlockBodyDeneb struct {
	RandaoReveal           string                        `json:"randao_reveal" validate:"required"`
	Eth1Data               *Eth1Data                     `json:"eth1_data" validate:"required"`
	Graffiti               string                        `json:"graffiti" validate:"required"`
	ProposerSlashings      []*ProposerSlashing           `json:"proposer_slashings" validate:"required,dive"`
	AttesterSlashings      []*AttesterSlashing           `json:"attester_slashings" validate:"required,dive"`
	Attestations           []*Attestation                `json:"attestations" validate:"required,dive"`
	Deposits               []*Deposit                    `json:"deposits" validate:"required,dive"`
	VoluntaryExits         []*SignedVoluntaryExit        `json:"voluntary_exits" validate:"required,dive"`
	SyncAggregate          *SyncAggregate                `json:"sync_aggregate" validate:"required"`
	ExecutionPayloadHeader *ExecutionPayloadHeaderDeneb  `json:"execution_payload_header" validate:"required"`
	BlsToExecutionChanges  []*SignedBlsToExecutionChange `json:"bls_to_execution_changes" validate:"required,dive"`
	BlobKzgCommitments     []string                      `json:"blob_kzg_commitments" validate:"required,dive,hexadecimal"`
}

type BlindedBeaconBlockCapella

type BlindedBeaconBlockCapella struct {
	Slot          string                         `json:"slot" validate:"required"`
	ProposerIndex string                         `json:"proposer_index" validate:"required"`
	ParentRoot    string                         `json:"parent_root" validate:"required"`
	StateRoot     string                         `json:"state_root" validate:"required"`
	Body          *BlindedBeaconBlockBodyCapella `json:"body" validate:"required"`
}

func (*BlindedBeaconBlockCapella) ToConsensus

func (*BlindedBeaconBlockCapella) ToGeneric

type BlindedBeaconBlockContentsDeneb

type BlindedBeaconBlockContentsDeneb struct {
	BlindedBlock        *BlindedBeaconBlockDeneb `json:"blinded_block" validate:"required"`
	BlindedBlobSidecars []*BlindedBlobSidecar    `json:"blinded_blob_sidecars" validate:"dive"`
}

func (*BlindedBeaconBlockContentsDeneb) ToGeneric

type BlindedBeaconBlockDeneb

type BlindedBeaconBlockDeneb struct {
	Slot          string                       `json:"slot" validate:"required"`
	ProposerIndex string                       `json:"proposer_index" validate:"required"`
	ParentRoot    string                       `json:"parent_root" validate:"required"`
	StateRoot     string                       `json:"state_root" validate:"required"`
	Body          *BlindedBeaconBlockBodyDeneb `json:"body" validate:"required"`
}

func BlindedBeaconBlockDenebFromConsensus

func BlindedBeaconBlockDenebFromConsensus(b *eth.BlindedBeaconBlockDeneb) (*BlindedBeaconBlockDeneb, error)

func (*BlindedBeaconBlockDeneb) ToConsensus

type BlindedBlobSidecar

type BlindedBlobSidecar struct {
	BlockRoot       string `json:"block_root" validate:"required"`
	Index           string `json:"index" validate:"required"`
	Slot            string `json:"slot" validate:"required"`
	BlockParentRoot string `json:"block_parent_root" validate:"required"`
	ProposerIndex   string `json:"proposer_index" validate:"required"`
	BlobRoot        string `json:"blob_root" validate:"required"`
	KzgCommitment   string `json:"kzg_commitment" validate:"required"` // pattern: "^0x[a-fA-F0-9]{96}$" ssz-size:"48"
	KzgProof        string `json:"kzg_proof" validate:"required"`      // pattern: "^0x[a-fA-F0-9]{96}$" ssz-size:"48"
}

func BlindedBlobSidecarFromConsensus

func BlindedBlobSidecarFromConsensus(b *eth.BlindedBlobSidecar) (*BlindedBlobSidecar, error)

func (*BlindedBlobSidecar) ToConsensus

func (s *BlindedBlobSidecar) ToConsensus() (*eth.BlindedBlobSidecar, error)

type BlobSidecar

type BlobSidecar struct {
	BlockRoot       string `json:"block_root" validate:"required"`
	Index           string `json:"index" validate:"required"`
	Slot            string `json:"slot" validate:"required"`
	BlockParentRoot string `json:"block_parent_root" validate:"required"`
	ProposerIndex   string `json:"proposer_index" validate:"required"`
	Blob            string `json:"blob" validate:"required"`           // pattern: "^0x[a-fA-F0-9]{262144}$"
	KzgCommitment   string `json:"kzg_commitment" validate:"required"` // pattern: "^0x[a-fA-F0-9]{96}$" ssz-size:"48"
	KzgProof        string `json:"kzg_proof" validate:"required"`      // pattern: "^0x[a-fA-F0-9]{96}$" ssz-size:"48"
}

func BlobSidecarFromConsensus

func BlobSidecarFromConsensus(b *eth.BlobSidecar) (*BlobSidecar, error)

func (*BlobSidecar) ToConsensus

func (s *BlobSidecar) ToConsensus() (*eth.BlobSidecar, error)

type BlsToExecutionChange

type BlsToExecutionChange struct {
	ValidatorIndex     string `json:"validator_index" validate:"required"`
	FromBlsPubkey      string `json:"from_bls_pubkey" validate:"required"`
	ToExecutionAddress string `json:"to_execution_address" validate:"required"`
}

type Checkpoint

type Checkpoint struct {
	Epoch string `json:"epoch" validate:"required,number,gte=0"`
	Root  string `json:"root" validate:"required,hexadecimal"`
}

func CheckpointFromConsensus

func CheckpointFromConsensus(c *eth.Checkpoint) *Checkpoint

func (*Checkpoint) ToConsensus

func (c *Checkpoint) ToConsensus() (*eth.Checkpoint, error)

type Committee

type Committee struct {
	Index      string   `json:"index"`
	Slot       string   `json:"slot"`
	Validators []string `json:"validators"`
}

type ContributionAndProof

type ContributionAndProof struct {
	AggregatorIndex string                     `json:"aggregator_index" validate:"required,number,gte=0"`
	Contribution    *SyncCommitteeContribution `json:"contribution" validate:"required"`
	SelectionProof  string                     `json:"selection_proof" validate:"required,hexadecimal"`
}

func (*ContributionAndProof) ToConsensus

func (c *ContributionAndProof) ToConsensus() (*eth.ContributionAndProof, error)

type DecodeError

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

DecodeError represents an error resulting from trying to decode an HTTP request. It tracks the full field name for which decoding failed.

func NewDecodeError

func NewDecodeError(err error, field string) *DecodeError

NewDecodeError wraps an error (either the initial decoding error or another DecodeError). The current field that failed decoding must be passed in.

func (*DecodeError) Error

func (e *DecodeError) Error() string

Error returns the formatted error message which contains the full field name and the actual decoding error.

type Deposit

type Deposit struct {
	Proof []string     `json:"proof" validate:"required,dive,hexadecimal"`
	Data  *DepositData `json:"data" validate:"required"`
}

func DepositsFromConsensus

func DepositsFromConsensus(src []*eth.Deposit) ([]*Deposit, error)

type DepositData

type DepositData struct {
	Pubkey                string `json:"pubkey" validate:"required"`
	WithdrawalCredentials string `json:"withdrawal_credentials" validate:"required"`
	Amount                string `json:"amount" validate:"required"`
	Signature             string `json:"signature" validate:"required"`
}

type Eth1Data

type Eth1Data struct {
	DepositRoot  string `json:"deposit_root" validate:"required"`
	DepositCount string `json:"deposit_count" validate:"required"`
	BlockHash    string `json:"block_hash" validate:"required"`
}

type ExecutionPayload

type ExecutionPayload struct {
	ParentHash    string   `json:"parent_hash" validate:"required"`
	FeeRecipient  string   `json:"fee_recipient" validate:"required"`
	StateRoot     string   `json:"state_root" validate:"required"`
	ReceiptsRoot  string   `json:"receipts_root" validate:"required"`
	LogsBloom     string   `json:"logs_bloom" validate:"required"`
	PrevRandao    string   `json:"prev_randao" validate:"required"`
	BlockNumber   string   `json:"block_number" validate:"required"`
	GasLimit      string   `json:"gas_limit" validate:"required"`
	GasUsed       string   `json:"gas_used" validate:"required"`
	Timestamp     string   `json:"timestamp" validate:"required"`
	ExtraData     string   `json:"extra_data" validate:"required"`
	BaseFeePerGas string   `json:"base_fee_per_gas" validate:"required"`
	BlockHash     string   `json:"block_hash" validate:"required"`
	Transactions  []string `json:"transactions" validate:"required,dive,hexadecimal"`
}

type ExecutionPayloadCapella

type ExecutionPayloadCapella struct {
	ParentHash    string        `json:"parent_hash" validate:"required"`
	FeeRecipient  string        `json:"fee_recipient" validate:"required"`
	StateRoot     string        `json:"state_root" validate:"required"`
	ReceiptsRoot  string        `json:"receipts_root" validate:"required"`
	LogsBloom     string        `json:"logs_bloom" validate:"required"`
	PrevRandao    string        `json:"prev_randao" validate:"required"`
	BlockNumber   string        `json:"block_number" validate:"required"`
	GasLimit      string        `json:"gas_limit" validate:"required"`
	GasUsed       string        `json:"gas_used" validate:"required"`
	Timestamp     string        `json:"timestamp" validate:"required"`
	ExtraData     string        `json:"extra_data" validate:"required"`
	BaseFeePerGas string        `json:"base_fee_per_gas" validate:"required"`
	BlockHash     string        `json:"block_hash" validate:"required"`
	Transactions  []string      `json:"transactions" validate:"required,dive"`
	Withdrawals   []*Withdrawal `json:"withdrawals" validate:"required,dive"`
}

type ExecutionPayloadDeneb

type ExecutionPayloadDeneb struct {
	ParentHash    string        `json:"parent_hash" validate:"required"`
	FeeRecipient  string        `json:"fee_recipient" validate:"required"`
	StateRoot     string        `json:"state_root" validate:"required"`
	ReceiptsRoot  string        `json:"receipts_root" validate:"required"`
	LogsBloom     string        `json:"logs_bloom" validate:"required"`
	PrevRandao    string        `json:"prev_randao" validate:"required"`
	BlockNumber   string        `json:"block_number" validate:"required"`
	GasLimit      string        `json:"gas_limit" validate:"required"`
	GasUsed       string        `json:"gas_used" validate:"required"`
	Timestamp     string        `json:"timestamp" validate:"required"`
	ExtraData     string        `json:"extra_data" validate:"required"`
	BaseFeePerGas string        `json:"base_fee_per_gas" validate:"required"`
	BlobGasUsed   string        `json:"blob_gas_used" validate:"required"`   // new in deneb
	ExcessBlobGas string        `json:"excess_blob_gas" validate:"required"` // new in deneb
	BlockHash     string        `json:"block_hash" validate:"required"`
	Transactions  []string      `json:"transactions" validate:"required,dive,hexadecimal"`
	Withdrawals   []*Withdrawal `json:"withdrawals" validate:"required,dive"`
}

type ExecutionPayloadHeader

type ExecutionPayloadHeader struct {
	ParentHash       string `json:"parent_hash" validate:"required"`
	FeeRecipient     string `json:"fee_recipient" validate:"required"`
	StateRoot        string `json:"state_root" validate:"required"`
	ReceiptsRoot     string `json:"receipts_root" validate:"required"`
	LogsBloom        string `json:"logs_bloom" validate:"required"`
	PrevRandao       string `json:"prev_randao" validate:"required"`
	BlockNumber      string `json:"block_number" validate:"required"`
	GasLimit         string `json:"gas_limit" validate:"required"`
	GasUsed          string `json:"gas_used" validate:"required"`
	Timestamp        string `json:"timestamp" validate:"required"`
	ExtraData        string `json:"extra_data" validate:"required"`
	BaseFeePerGas    string `json:"base_fee_per_gas" validate:"required"`
	BlockHash        string `json:"block_hash" validate:"required"`
	TransactionsRoot string `json:"transactions_root" validate:"required"`
}

type ExecutionPayloadHeaderCapella

type ExecutionPayloadHeaderCapella struct {
	ParentHash       string `json:"parent_hash" validate:"required"`
	FeeRecipient     string `json:"fee_recipient" validate:"required"`
	StateRoot        string `json:"state_root" validate:"required"`
	ReceiptsRoot     string `json:"receipts_root" validate:"required"`
	LogsBloom        string `json:"logs_bloom" validate:"required"`
	PrevRandao       string `json:"prev_randao" validate:"required"`
	BlockNumber      string `json:"block_number" validate:"required"`
	GasLimit         string `json:"gas_limit" validate:"required"`
	GasUsed          string `json:"gas_used" validate:"required"`
	Timestamp        string `json:"timestamp" validate:"required"`
	ExtraData        string `json:"extra_data" validate:"required"`
	BaseFeePerGas    string `json:"base_fee_per_gas" validate:"required"`
	BlockHash        string `json:"block_hash" validate:"required"`
	TransactionsRoot string `json:"transactions_root" validate:"required"`
	WithdrawalsRoot  string `json:"withdrawals_root" validate:"required"`
}

type ExecutionPayloadHeaderDeneb

type ExecutionPayloadHeaderDeneb struct {
	ParentHash       string `json:"parent_hash" validate:"required"`
	FeeRecipient     string `json:"fee_recipient" validate:"required"`
	StateRoot        string `json:"state_root" validate:"required"`
	ReceiptsRoot     string `json:"receipts_root" validate:"required"`
	LogsBloom        string `json:"logs_bloom" validate:"required"`
	PrevRandao       string `json:"prev_randao" validate:"required"`
	BlockNumber      string `json:"block_number" validate:"required"`
	GasLimit         string `json:"gas_limit" validate:"required"`
	GasUsed          string `json:"gas_used" validate:"required"`
	Timestamp        string `json:"timestamp" validate:"required"`
	ExtraData        string `json:"extra_data" validate:"required"`
	BaseFeePerGas    string `json:"base_fee_per_gas" validate:"required"`
	BlobGasUsed      string `json:"blob_gas_used" validate:"required"`   // new in deneb
	ExcessBlobGas    string `json:"excess_blob_gas" validate:"required"` // new in deneb
	BlockHash        string `json:"block_hash" validate:"required"`
	TransactionsRoot string `json:"transactions_root" validate:"required"`
	WithdrawalsRoot  string `json:"withdrawals_root" validate:"required"`
}

type FeeRecipient

type FeeRecipient struct {
	ValidatorIndex string `json:"validator_index"`
	FeeRecipient   string `json:"fee_recipient"`
}

type Fork

type Fork struct {
	PreviousVersion string `json:"previous_version"`
	CurrentVersion  string `json:"current_version"`
	Epoch           string `json:"epoch"`
}

func (*Fork) ToConsensus

func (s *Fork) ToConsensus() (*eth.Fork, error)

type IndexedAttestation

type IndexedAttestation struct {
	AttestingIndices []string         `json:"attesting_indices" validate:"required,dive"`
	Data             *AttestationData `json:"data" validate:"required"`
	Signature        string           `json:"signature" validate:"required"`
}

type IndexedVerificationFailure

type IndexedVerificationFailure struct {
	Index   int    `json:"index"`
	Message string `json:"message"`
}

IndexedVerificationFailure represents an issue when verifying a single indexed object e.g. an item in an array.

type IndexedVerificationFailureError

type IndexedVerificationFailureError struct {
	Message  string                        `json:"message"`
	Code     int                           `json:"code"`
	Failures []*IndexedVerificationFailure `json:"failures"`
}

IndexedVerificationFailureError wraps a collection of verification failures.

func (*IndexedVerificationFailureError) StatusCode

func (e *IndexedVerificationFailureError) StatusCode() int

type ProposerSlashing

type ProposerSlashing struct {
	SignedHeader1 *SignedBeaconBlockHeader `json:"signed_header_1" validate:"required"`
	SignedHeader2 *SignedBeaconBlockHeader `json:"signed_header_2" validate:"required"`
}

func ProposerSlashingsFromConsensus

func ProposerSlashingsFromConsensus(src []*eth.ProposerSlashing) ([]*ProposerSlashing, error)

type SignedAggregateAttestationAndProof

type SignedAggregateAttestationAndProof struct {
	Message   *AggregateAttestationAndProof `json:"message" validate:"required"`
	Signature string                        `json:"signature" validate:"required,hexadecimal"`
}

func (*SignedAggregateAttestationAndProof) ToConsensus

type SignedBeaconBlock

type SignedBeaconBlock struct {
	Message   *BeaconBlock `json:"message" validate:"required"`
	Signature string       `json:"signature" validate:"required"`
}

func (*SignedBeaconBlock) ToGeneric

type SignedBeaconBlockAltair

type SignedBeaconBlockAltair struct {
	Message   *BeaconBlockAltair `json:"message" validate:"required"`
	Signature string             `json:"signature" validate:"required"`
}

func (*SignedBeaconBlockAltair) ToGeneric

type SignedBeaconBlockBellatrix

type SignedBeaconBlockBellatrix struct {
	Message   *BeaconBlockBellatrix `json:"message" validate:"required"`
	Signature string                `json:"signature" validate:"required"`
}

func (*SignedBeaconBlockBellatrix) ToGeneric

type SignedBeaconBlockCapella

type SignedBeaconBlockCapella struct {
	Message   *BeaconBlockCapella `json:"message" validate:"required"`
	Signature string              `json:"signature" validate:"required"`
}

func (*SignedBeaconBlockCapella) ToGeneric

type SignedBeaconBlockContentsDeneb

type SignedBeaconBlockContentsDeneb struct {
	SignedBlock        *SignedBeaconBlockDeneb `json:"signed_block" validate:"required"`
	SignedBlobSidecars []*SignedBlobSidecar    `json:"signed_blob_sidecars"  validate:"dive"`
}

func (*SignedBeaconBlockContentsDeneb) ToGeneric

func (*SignedBeaconBlockContentsDeneb) ToUnsigned

type SignedBeaconBlockDeneb

type SignedBeaconBlockDeneb struct {
	Message   *BeaconBlockDeneb `json:"message" validate:"required"`
	Signature string            `json:"signature" validate:"required"`
}

func SignedBeaconBlockDenebFromConsensus

func SignedBeaconBlockDenebFromConsensus(b *eth.SignedBeaconBlockDeneb) (*SignedBeaconBlockDeneb, error)

func (*SignedBeaconBlockDeneb) ToConsensus

type SignedBeaconBlockHeader

type SignedBeaconBlockHeader struct {
	Message   *BeaconBlockHeader `json:"message" validate:"required"`
	Signature string             `json:"signature" validate:"required"`
}

type SignedBeaconBlockHeaderContainer

type SignedBeaconBlockHeaderContainer struct {
	Header    *SignedBeaconBlockHeader `json:"header"`
	Root      string                   `json:"root"`
	Canonical bool                     `json:"canonical"`
}

type SignedBlindedBeaconBlockBellatrix

type SignedBlindedBeaconBlockBellatrix struct {
	Message   *BlindedBeaconBlockBellatrix `json:"message" validate:"required"`
	Signature string                       `json:"signature" validate:"required"`
}

func (*SignedBlindedBeaconBlockBellatrix) ToGeneric

type SignedBlindedBeaconBlockCapella

type SignedBlindedBeaconBlockCapella struct {
	Message   *BlindedBeaconBlockCapella `json:"message" validate:"required"`
	Signature string                     `json:"signature" validate:"required"`
}

func (*SignedBlindedBeaconBlockCapella) ToGeneric

type SignedBlindedBeaconBlockContentsDeneb

type SignedBlindedBeaconBlockContentsDeneb struct {
	SignedBlindedBlock        *SignedBlindedBeaconBlockDeneb `json:"signed_blinded_block" validate:"required"`
	SignedBlindedBlobSidecars []*SignedBlindedBlobSidecar    `json:"signed_blinded_blob_sidecars" validate:"dive"`
}

func (*SignedBlindedBeaconBlockContentsDeneb) ToGeneric

func (*SignedBlindedBeaconBlockContentsDeneb) ToUnsigned

type SignedBlindedBeaconBlockDeneb

type SignedBlindedBeaconBlockDeneb struct {
	Message   *BlindedBeaconBlockDeneb `json:"message" validate:"required"`
	Signature string                   `json:"signature" validate:"required"`
}

func (*SignedBlindedBeaconBlockDeneb) ToConsensus

type SignedBlindedBlobSidecar

type SignedBlindedBlobSidecar struct {
	Message   *BlindedBlobSidecar `json:"message" validate:"required"`
	Signature string              `json:"signature" validate:"required"`
}

func (*SignedBlindedBlobSidecar) ToConensus

type SignedBlobSidecar

type SignedBlobSidecar struct {
	Message   *BlobSidecar `json:"message" validate:"required"`
	Signature string       `json:"signature" validate:"required"`
}

func SignedBlobSidecarFromConsensus

func SignedBlobSidecarFromConsensus(b *eth.SignedBlobSidecar) (*SignedBlobSidecar, error)

func (*SignedBlobSidecar) ToConsensus

func (s *SignedBlobSidecar) ToConsensus() (*eth.SignedBlobSidecar, error)

type SignedBlsToExecutionChange

type SignedBlsToExecutionChange struct {
	Message   *BlsToExecutionChange `json:"message" validate:"required"`
	Signature string                `json:"signature" validate:"required"`
}

type SignedContributionAndProof

type SignedContributionAndProof struct {
	Message   *ContributionAndProof `json:"message" validate:"required"`
	Signature string                `json:"signature" validate:"required,hexadecimal"`
}

func (*SignedContributionAndProof) ToConsensus

type SignedValidatorRegistration

type SignedValidatorRegistration struct {
	Message   *ValidatorRegistration `json:"message" validate:"required"`
	Signature string                 `json:"signature" validate:"required,hexadecimal"`
}

func (*SignedValidatorRegistration) ToConsensus

type SignedVoluntaryExit

type SignedVoluntaryExit struct {
	Message   *VoluntaryExit `json:"message" validate:"required"`
	Signature string         `json:"signature" validate:"required,hexadecimal"`
}

func ExitsFromConsensus

func ExitsFromConsensus(src []*eth.SignedVoluntaryExit) ([]*SignedVoluntaryExit, error)

func SignedVoluntaryExitFromConsensus

func SignedVoluntaryExitFromConsensus(e *eth.SignedVoluntaryExit) *SignedVoluntaryExit

func (*SignedVoluntaryExit) ToConsensus

func (e *SignedVoluntaryExit) ToConsensus() (*eth.SignedVoluntaryExit, error)

type SyncAggregate

type SyncAggregate struct {
	SyncCommitteeBits      string `json:"sync_committee_bits" validate:"required"`
	SyncCommitteeSignature string `json:"sync_committee_signature" validate:"required"`
}

type SyncCommitteeContribution

type SyncCommitteeContribution struct {
	Slot              string `json:"slot" validate:"required,number,gte=0"`
	BeaconBlockRoot   string `json:"beacon_block_root" hex:"true" validate:"required,hexadecimal"`
	SubcommitteeIndex string `json:"subcommittee_index" validate:"required,number,gte=0"`
	AggregationBits   string `json:"aggregation_bits" hex:"true" validate:"required,hexadecimal"`
	Signature         string `json:"signature" hex:"true" validate:"required,hexadecimal"`
}

func (*SyncCommitteeContribution) ToConsensus

type SyncCommitteeMessage

type SyncCommitteeMessage struct {
	Slot            string `json:"slot" validate:"required,number,gte=0"`
	BeaconBlockRoot string `json:"beacon_block_root" validate:"required,hexadecimal"`
	ValidatorIndex  string `json:"validator_index" validate:"required,number,gte=0"`
	Signature       string `json:"signature" validate:"required,hexadecimal"`
}

func (*SyncCommitteeMessage) ToConsensus

func (m *SyncCommitteeMessage) ToConsensus() (*eth.SyncCommitteeMessage, error)

type SyncCommitteeSubscription

type SyncCommitteeSubscription struct {
	ValidatorIndex       string   `json:"validator_index" validate:"required,number,gte=0"`
	SyncCommitteeIndices []string `json:"sync_committee_indices" validate:"required,dive,number,gte=0"`
	UntilEpoch           string   `json:"until_epoch" validate:"required,number,gte=0"`
}

func (*SyncCommitteeSubscription) ToConsensus

type SyncDetails

type SyncDetails struct {
	HeadSlot     string `json:"head_slot"`
	SyncDistance string `json:"sync_distance"`
	IsSyncing    bool   `json:"is_syncing"`
	IsOptimistic bool   `json:"is_optimistic"`
	ElOffline    bool   `json:"el_offline"`
}

SyncDetails contains information about node sync status.

type SyncDetailsContainer

type SyncDetailsContainer struct {
	Data *SyncDetails `json:"data"`
}

SyncDetailsContainer is a wrapper for Data.

type ValidatorRegistration

type ValidatorRegistration struct {
	FeeRecipient string `json:"fee_recipient" validate:"required,hexadecimal"`
	GasLimit     string `json:"gas_limit" validate:"required,number,gte=0"`
	Timestamp    string `json:"timestamp" validate:"required,number,gte=0"`
	Pubkey       string `json:"pubkey" validate:"required,hexadecimal"`
}

func ValidatorRegistrationFromConsensus

func ValidatorRegistrationFromConsensus(vr *eth.ValidatorRegistrationV1) (*ValidatorRegistration, error)

func (*ValidatorRegistration) ToConsensus

type VoluntaryExit

type VoluntaryExit struct {
	Epoch          string `json:"epoch" validate:"required,number,gte=0"`
	ValidatorIndex string `json:"validator_index" validate:"required,number,gte=0"`
}

func VoluntaryExitFromConsensus

func VoluntaryExitFromConsensus(e *eth.VoluntaryExit) *VoluntaryExit

func (*VoluntaryExit) ToConsensus

func (e *VoluntaryExit) ToConsensus() (*eth.VoluntaryExit, error)

type Withdrawal

type Withdrawal struct {
	WithdrawalIndex  string `json:"index" validate:"required"`
	ValidatorIndex   string `json:"validator_index" validate:"required"`
	ExecutionAddress string `json:"address" validate:"required"`
	Amount           string `json:"amount" validate:"required"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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