Documentation ¶
Index ¶
- Constants
- Variables
- func CapellaExecutionPayloadToScale(e *state.ExecutionPayloadCapella, activeSpec config.ActiveSpec) (scale.ExecutionPayloadHeaderCapella, error)
- func SyncAggregateToScale(s state.SyncAggregate) scale.SyncAggregate
- type AttestationDataResponse
- type AttestationResponse
- type AttesterSlashingResponse
- type BLSToExecutionChangeResponse
- type BeaconAPI
- type BeaconBlock
- type BeaconBlockResponse
- type BeaconClient
- func (b *BeaconClient) DownloadBeaconState(stateIdOrSlot string) (string, error)
- func (b *BeaconClient) GetBeaconBlock(blockID common.Hash) (state.BeaconBlock, error)
- func (b *BeaconClient) GetBeaconBlockBySlot(slot uint64) (BeaconBlockResponse, error)
- func (b *BeaconClient) GetBeaconBlockRoot(slot uint64) (common.Hash, error)
- func (b *BeaconClient) GetBootstrap(blockRoot common.Hash) (BootstrapResponse, error)
- func (b *BeaconClient) GetFinalizedCheckpoint() (FinalizedCheckpoint, error)
- func (b *BeaconClient) GetGenesis() (Genesis, error)
- func (b *BeaconClient) GetHeader(blockRoot common.Hash) (BeaconHeader, error)
- func (b *BeaconClient) GetHeaderBySlot(slot uint64) (BeaconHeader, error)
- func (b *BeaconClient) GetLatestFinalizedUpdate() (LatestFinalisedUpdateResponse, error)
- func (b *BeaconClient) GetSyncCommitteePeriodUpdate(from uint64) (SyncCommitteePeriodUpdateResponse, error)
- type BeaconHeader
- type BeaconHeaderResponse
- type Bootstrap
- type BootstrapResponse
- type BranchResponse
- type CheckpointResponse
- type DepositDataResponse
- type DepositResponse
- type ErrorMessage
- type FinalizedCheckpoint
- type FinalizedCheckpointResponse
- type ForkResponse
- type Genesis
- type GenesisResponse
- type HeaderResponse
- type IndexedAttestationResponse
- type LatestFinalisedUpdateResponse
- type LatestHeaderUpdateResponse
- type ProposerSlashingResponse
- type SignedBLSToExecutionChangeResponse
- type SignedHeaderResponse
- type SignedVoluntaryExitResponse
- type SyncAggregateResponse
- type SyncCommitteePeriodUpdateResponse
- type SyncCommitteeResponse
- type VoluntaryExitResponse
- type WithdrawalResponse
Constants ¶
View Source
const ( ConstructRequestErrorMessage = "construct header request" DoHTTPRequestErrorMessage = "do http request" HTTPStatusNotOKErrorMessage = "http status not ok" ReadResponseBodyErrorMessage = "read response body" UnmarshalBodyErrorMessage = "unmarshal body" )
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrSyncCommitteeUpdateNotAvailable = errors.New("no sync committee update available") )
Functions ¶
func CapellaExecutionPayloadToScale ¶
func CapellaExecutionPayloadToScale(e *state.ExecutionPayloadCapella, activeSpec config.ActiveSpec) (scale.ExecutionPayloadHeaderCapella, error)
func SyncAggregateToScale ¶
func SyncAggregateToScale(s state.SyncAggregate) scale.SyncAggregate
Types ¶
type AttestationDataResponse ¶
type AttestationDataResponse struct { Slot string `json:"slot"` Index string `json:"index"` BeaconBlockRoot string `json:"beacon_block_root"` Source CheckpointResponse `json:"source"` Target CheckpointResponse `json:"target"` }
func (AttestationDataResponse) ToFastSSZ ¶
func (a AttestationDataResponse) ToFastSSZ() (*state.AttestationData, error)
func (AttestationDataResponse) ToScale ¶
func (a AttestationDataResponse) ToScale() (scale.AttestationData, error)
type AttestationResponse ¶
type AttestationResponse struct { AggregationBits string `json:"aggregation_bits"` Data AttestationDataResponse `json:"data"` Signature string `json:"signature"` }
func (AttestationResponse) ToFastSSZ ¶
func (a AttestationResponse) ToFastSSZ() (*state.Attestation, error)
func (AttestationResponse) ToScale ¶
func (a AttestationResponse) ToScale() (scale.Attestation, error)
type AttesterSlashingResponse ¶
type AttesterSlashingResponse struct { Attestation1 IndexedAttestationResponse `json:"attestation_1"` Attestation2 IndexedAttestationResponse `json:"attestation_2"` }
func (AttesterSlashingResponse) ToFastSSZ ¶
func (a AttesterSlashingResponse) ToFastSSZ() (*state.AttesterSlashing, error)
func (AttesterSlashingResponse) ToScale ¶
func (a AttesterSlashingResponse) ToScale() (scale.AttesterSlashing, error)
type BeaconAPI ¶
type BeaconAPI interface { GetHeader(blockRoot common.Hash) (BeaconHeader, error) GetHeaderBySlot(slot uint64) (BeaconHeader, error) GetSyncCommitteePeriodUpdate(from uint64) (SyncCommitteePeriodUpdateResponse, error) GetBeaconBlock(slot uint64) (BeaconBlockResponse, error) GetInitialSync(blockRoot string) (BootstrapResponse, error) GetFinalizedCheckpoint() (FinalizedCheckpoint, error) GetGenesis() (Genesis, error) GetLatestFinalizedUpdate() (LatestFinalisedUpdateResponse, error) GetBootstrap(blockRoot common.Hash) (Bootstrap, error) }
type BeaconBlock ¶
type BeaconBlockResponse ¶
type BeaconBlockResponse struct { Data struct { Message struct { Slot string `json:"slot"` ProposerIndex string `json:"proposer_index"` ParentRoot string `json:"parent_root"` StateRoot string `json:"state_root"` Body struct { RandaoReveal string `json:"randao_reveal"` Eth1Data struct { DepositRoot string `json:"deposit_root"` DepositCount string `json:"deposit_count"` BlockHash string `json:"block_hash"` } `json:"eth1_data"` Graffiti string `json:"graffiti"` ProposerSlashings []ProposerSlashingResponse `json:"proposer_slashings"` AttesterSlashings []AttesterSlashingResponse `json:"attester_slashings"` Attestations []AttestationResponse `json:"attestations"` Deposits []DepositResponse `json:"deposits"` VoluntaryExits []SignedVoluntaryExitResponse `json:"voluntary_exits"` SyncAggregate SyncAggregateResponse `json:"sync_aggregate"` ExecutionPayload struct { ParentHash string `json:"parent_hash"` FeeRecipient string `json:"fee_recipient"` StateRoot string `json:"state_root"` ReceiptsRoot string `json:"receipts_root"` LogsBloom string `json:"logs_bloom"` PrevRandao string `json:"prev_randao"` BlockNumber string `json:"block_number"` GasLimit string `json:"gas_limit"` GasUsed string `json:"gas_used"` Timestamp string `json:"timestamp"` ExtraData string `json:"extra_data"` BaseFeePerGas string `json:"base_fee_per_gas"` BlockHash string `json:"block_hash"` Transactions []string `json:"transactions"` Withdrawals []WithdrawalResponse `json:"withdrawals"` } `json:"execution_payload"` BlsToExecutionChanges []SignedBLSToExecutionChangeResponse `json:"bls_to_execution_changes"` } `json:"body"` } `json:"message"` } `json:"data"` }
func (BeaconBlockResponse) ToFastSSZ ¶
func (b BeaconBlockResponse) ToFastSSZ(activeSpec config.ActiveSpec, epoch uint64) (state.BeaconBlock, error)
ToFastSSZ can be removed once Lodestar supports returning block data as SSZ instead of JSON only. Because it only returns JSON, we need this interim step where we convert the block JSON to the data types that the FastSSZ lib expects. When Lodestar supports SSZ block response, we can remove all these and directly unmarshal SSZ bytes to state.BeaconBlock.
func (BeaconBlockResponse) ToScale ¶
func (b BeaconBlockResponse) ToScale() (scale.BeaconBlock, error)
type BeaconClient ¶
type BeaconClient struct {
// contains filtered or unexported fields
}
func NewBeaconClient ¶
func NewBeaconClient(endpoint string, activeSpec config.ActiveSpec, slotsInEpoch uint64) *BeaconClient
func (*BeaconClient) DownloadBeaconState ¶
func (b *BeaconClient) DownloadBeaconState(stateIdOrSlot string) (string, error)
func (*BeaconClient) GetBeaconBlock ¶
func (b *BeaconClient) GetBeaconBlock(blockID common.Hash) (state.BeaconBlock, error)
func (*BeaconClient) GetBeaconBlockBySlot ¶
func (b *BeaconClient) GetBeaconBlockBySlot(slot uint64) (BeaconBlockResponse, error)
func (*BeaconClient) GetBeaconBlockRoot ¶
func (b *BeaconClient) GetBeaconBlockRoot(slot uint64) (common.Hash, error)
func (*BeaconClient) GetBootstrap ¶
func (b *BeaconClient) GetBootstrap(blockRoot common.Hash) (BootstrapResponse, error)
func (*BeaconClient) GetFinalizedCheckpoint ¶
func (b *BeaconClient) GetFinalizedCheckpoint() (FinalizedCheckpoint, error)
func (*BeaconClient) GetGenesis ¶
func (b *BeaconClient) GetGenesis() (Genesis, error)
func (*BeaconClient) GetHeader ¶
func (b *BeaconClient) GetHeader(blockRoot common.Hash) (BeaconHeader, error)
func (*BeaconClient) GetHeaderBySlot ¶
func (b *BeaconClient) GetHeaderBySlot(slot uint64) (BeaconHeader, error)
func (*BeaconClient) GetLatestFinalizedUpdate ¶
func (b *BeaconClient) GetLatestFinalizedUpdate() (LatestFinalisedUpdateResponse, error)
func (*BeaconClient) GetSyncCommitteePeriodUpdate ¶
func (b *BeaconClient) GetSyncCommitteePeriodUpdate(from uint64) (SyncCommitteePeriodUpdateResponse, error)
type BeaconHeader ¶
type BeaconHeader struct { Slot uint64 `json:"slot"` ProposerIndex uint64 `json:"proposer_index"` ParentRoot common.Hash `json:"parent_root"` StateRoot common.Hash `json:"state_root"` BodyRoot common.Hash `json:"body_root"` }
func (BeaconHeader) ToScale ¶
func (h BeaconHeader) ToScale() (scale.BeaconHeader, error)
type BeaconHeaderResponse ¶
type BeaconHeaderResponse struct { Data struct { Root string `json:"root"` Canonical bool `json:"canonical"` Header struct { Message HeaderResponse `json:"message"` Signature string `json:"signature"` } `json:"header"` } `json:"data"` }
type Bootstrap ¶
type Bootstrap struct { Header HeaderResponse CurrentSyncCommittee beaconjson.SyncCommittee CurrentSyncCommitteeBranch []string }
type BootstrapResponse ¶
type BootstrapResponse struct { Data struct { Header struct { Beacon HeaderResponse `json:"beacon"` } `json:"header"` CurrentSyncCommittee SyncCommitteeResponse `json:"current_sync_committee"` CurrentSyncCommitteeBranch []string `json:"current_sync_committee_branch"` } `json:"data"` }
type BranchResponse ¶
type BranchResponse []string
type CheckpointResponse ¶
func (CheckpointResponse) ToFastSSZ ¶
func (c CheckpointResponse) ToFastSSZ() (*state.Checkpoint, error)
func (CheckpointResponse) ToScale ¶
func (c CheckpointResponse) ToScale() (scale.Checkpoint, error)
type DepositDataResponse ¶
type DepositResponse ¶
type DepositResponse struct { Proof []string `json:"proof"` Data DepositDataResponse `json:"data"` }
type ErrorMessage ¶
type FinalizedCheckpoint ¶
type FinalizedCheckpointResponse ¶
type FinalizedCheckpointResponse struct { Data struct { Finalized struct { Root string `json:"root"` } `json:"finalized"` } `json:"data"` }
type ForkResponse ¶
type GenesisResponse ¶
type HeaderResponse ¶
type HeaderResponse struct { Slot string `json:"slot"` ProposerIndex string `json:"proposer_index"` ParentRoot string `json:"parent_root"` StateRoot string `json:"state_root"` BodyRoot string `json:"body_root"` }
func (*HeaderResponse) ToBeaconHeader ¶
func (h *HeaderResponse) ToBeaconHeader() (BeaconHeader, error)
func (*HeaderResponse) ToFastSSZ ¶
func (h *HeaderResponse) ToFastSSZ() (*state.BeaconBlockHeader, error)
func (*HeaderResponse) ToScale ¶
func (h *HeaderResponse) ToScale() (scale.BeaconHeader, error)
type IndexedAttestationResponse ¶
type IndexedAttestationResponse struct { AttestingIndices []string `json:"attesting_indices"` Data AttestationDataResponse `json:"data"` Signature string `json:"signature"` }
func (IndexedAttestationResponse) ToFastSSZ ¶
func (i IndexedAttestationResponse) ToFastSSZ() (*state.IndexedAttestation, error)
func (IndexedAttestationResponse) ToScale ¶
func (i IndexedAttestationResponse) ToScale() (scale.IndexedAttestation, error)
type LatestFinalisedUpdateResponse ¶
type LatestFinalisedUpdateResponse struct { Data struct { AttestedHeader struct { Beacon HeaderResponse `json:"beacon"` } `json:"attested_header"` FinalizedHeader struct { Beacon HeaderResponse `json:"beacon"` } `json:"finalized_header"` FinalityBranch []string `json:"finality_branch"` SyncAggregate SyncAggregateResponse `json:"sync_aggregate"` SignatureSlot string `json:"signature_slot"` } `json:"data"` }
type LatestHeaderUpdateResponse ¶
type LatestHeaderUpdateResponse struct { Data struct { AttestedHeader HeaderResponse `json:"attested_header"` SyncAggregate SyncAggregateResponse `json:"sync_aggregate"` } `json:"data"` }
type ProposerSlashingResponse ¶
type ProposerSlashingResponse struct { SignedHeader1 SignedHeaderResponse `json:"signed_header_1"` SignedHeader2 SignedHeaderResponse `json:"signed_header_2"` }
func (ProposerSlashingResponse) ToFastSSZ ¶
func (p ProposerSlashingResponse) ToFastSSZ() (*state.ProposerSlashing, error)
func (ProposerSlashingResponse) ToScale ¶
func (p ProposerSlashingResponse) ToScale() (scale.ProposerSlashing, error)
type SignedBLSToExecutionChangeResponse ¶
type SignedBLSToExecutionChangeResponse struct { Message *BLSToExecutionChangeResponse `json:"message,omitempty"` Signature string `json:"signature,omitempty"` }
func (*SignedBLSToExecutionChangeResponse) ToFastSSZ ¶
func (s *SignedBLSToExecutionChangeResponse) ToFastSSZ() (*state.SignedBLSToExecutionChange, error)
type SignedHeaderResponse ¶
type SignedHeaderResponse struct { Message HeaderResponse `json:"message"` Signature []byte `json:"signature"` }
func (SignedHeaderResponse) ToFastSSZ ¶
func (s SignedHeaderResponse) ToFastSSZ() (*state.SignedBeaconBlockHeader, error)
func (SignedHeaderResponse) ToScale ¶
func (s SignedHeaderResponse) ToScale() (scale.SignedHeader, error)
type SignedVoluntaryExitResponse ¶
type SignedVoluntaryExitResponse struct { Message VoluntaryExitResponse `json:"message"` Signature string `json:"signature"` }
func (SignedVoluntaryExitResponse) ToFastSSZ ¶
func (d SignedVoluntaryExitResponse) ToFastSSZ() (*state.SignedVoluntaryExit, error)
func (SignedVoluntaryExitResponse) ToScale ¶
func (d SignedVoluntaryExitResponse) ToScale() (scale.SignedVoluntaryExit, error)
type SyncAggregateResponse ¶
type SyncAggregateResponse struct { SyncCommitteeBits string `json:"sync_committee_bits"` SyncCommitteeSignature string `json:"sync_committee_signature"` }
func (SyncAggregateResponse) ToScale ¶
func (s SyncAggregateResponse) ToScale() (scale.SyncAggregate, error)
type SyncCommitteePeriodUpdateResponse ¶
type SyncCommitteePeriodUpdateResponse struct { Data struct { AttestedHeader struct { Beacon HeaderResponse `json:"beacon"` } `json:"attested_header"` NextSyncCommittee SyncCommitteeResponse `json:"next_sync_committee"` NextSyncCommitteeBranch []string `json:"next_sync_committee_branch"` FinalizedHeader struct { Beacon HeaderResponse `json:"beacon"` } `json:"finalized_header"` FinalityBranch []string `json:"finality_branch"` SyncAggregate SyncAggregateResponse `json:"sync_aggregate"` SignatureSlot string `json:"signature_slot"` } `json:"data"` }
type SyncCommitteeResponse ¶
type SyncCommitteeResponse struct { Pubkeys []string `json:"pubkeys"` AggregatePubkey string `json:"aggregate_pubkey"` }
func (SyncCommitteeResponse) ToScale ¶
func (s SyncCommitteeResponse) ToScale() (scale.SyncCommittee, error)
type VoluntaryExitResponse ¶
type WithdrawalResponse ¶
type WithdrawalResponse struct { Index string `json:"index"` ValidatorIndex string `json:"validator_index"` Address string `json:"address"` Amount string `json:"amount"` }
func (*WithdrawalResponse) ToFastSSZ ¶
func (w *WithdrawalResponse) ToFastSSZ() (*state.Withdrawal, error)
Click to show internal directories.
Click to hide internal directories.