eth2

package
v1.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ABIJSON = "" /* 4616-byte string literal not displayed */
View Source
const BLSPubkeyLength = 48
View Source
const BeaconBlockBodyTreeExecutionPayloadIndex uint64 = 25
View Source
const BeaconHeaderABIJSON = "" /* 459-byte string literal not displayed */
View Source
const ChainIdABIJSON = "{\"internalType\":\"uint64\",\"type\":\"uint64\"}"
View Source
const DomainByteLength = 4

DomainByteLength length of domain byte array.

View Source
const EpochsPerSyncCommitteePeriod uint64 = 256
View Source
const ExecutionPayloadProofSize int = 4
View Source
const FinalizedRootIndex uint32 = 105
View Source
const ForkVersionByteLength = 4

ForkVersionByteLength length of fork version byte array.

View Source
const L1BeaconBlockBodyProofSize uint64 = 4
View Source
const L1BeaconBlockBodyTreeExecutionPayloadIndex uint64 = 25
View Source
const L2ExecutionPayloadProofSize uint64 = 4
View Source
const L2ExecutionPayloadTreeExecutionBlockIndex uint64 = 28
View Source
const MinSyncCommitteeParticipants uint64 = 1
View Source
const NextSyncCommitteeIndex uint32 = 55
View Source
const SlotsPerEpoch uint64 = 32
View Source
const SyncCommitteeABIJSON = "" /* 231-byte string literal not displayed */
View Source
const UpdateABIJSON = "" /* 3200-byte string literal not displayed */

Variables

View Source
var DomainSyncCommittee = [4]byte{0x07, 0x00, 0x00, 0x00}

Functions

func ComputeDomain

func ComputeDomain(domainType [DomainByteLength]byte, forkVersion, genesisValidatorsRoot []byte) ([]byte, error)

ComputeDomain returns the domain version for BLS private key to sign and verify with a zeroed 4-byte array as the fork version.

def compute_domain(domain_type: DomainType, fork_version: Version=None, genesis_validators_root: Root=None) -> Domain:

"""
Return the domain for the ``domain_type`` and ``fork_version``.
"""
if fork_version is None:
    fork_version = GENESIS_FORK_VERSION
if genesis_validators_root is None:
    genesis_validators_root = Root()  # all bytes zero by default
fork_data_root = compute_fork_data_root(fork_version, genesis_validators_root)
return Domain(domain_type + fork_data_root[:28])

func ComputeSigningRoot

func ComputeSigningRoot(object fssz.HashRoot, domain []byte) ([32]byte, error)

ComputeSigningRoot computes the root of the object by calculating the hash tree root of the signing data with the given domain.

Spec pseudocode definition:

	def compute_signing_root(ssz_object: SSZObject, domain: Domain) -> Root:
   """
   Return the signing root for the corresponding signing data.
   """
   return hash_tree_root(SigningData(
       object_root=hash_tree_root(ssz_object),
       domain=domain,
   ))

func PadTo

func PadTo(b []byte, size int) []byte

PadTo pads a byte slice to the given size. If the byte slice is larger than the given size, the original slice is returned.

func ReverseByteOrder

func ReverseByteOrder(input []byte) []byte

ReverseByteOrder Switch the endianness of a byte slice by reversing its order. this function does not modify the actual input bytes.

func SyncCommitteeRoot

func SyncCommitteeRoot(committee *SyncCommittee) ([32]byte, error)

SyncCommitteeRoot computes the HashTreeRoot Merkleization of a committee root. a SyncCommitteeRoot struct according to the eth2 Simple Serialize specification.

func VerifyLightClientUpdate

func VerifyLightClientUpdate(input []byte) error

Types

type BeaconBlockHeader

type BeaconBlockHeader struct {
	Slot          uint64
	ProposerIndex ValidatorIndex
	ParentRoot    []byte
	StateRoot     []byte
	BodyRoot      []byte
}

func (*BeaconBlockHeader) HashTreeRoot

func (b *BeaconBlockHeader) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the BeaconBlockHeader object

func (*BeaconBlockHeader) HashTreeRootWith

func (b *BeaconBlockHeader) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the BeaconBlockHeader object with a hasher

type DomainType

type DomainType [4]byte

type ExecutionPayload

type ExecutionPayload struct {
	ParentHash       common.Hash
	FeeRecipient     common.Address
	StateRoot        common.Hash
	ReceiptsRoot     common.Hash
	LogsBloom        []byte
	PrevRandao       common.Hash
	BlockNumber      *big.Int
	GasLimit         uint64
	GasUsed          uint64
	Timestamp        uint64
	ExtraData        []byte
	BaseFeePerGas    *big.Int
	BlockHash        common.Hash
	TransactionsRoot common.Hash
	WithdrawalsRoot  common.Hash
}

func (*ExecutionPayload) HashTreeRoot

func (e *ExecutionPayload) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the ExecutionPayload object

func (*ExecutionPayload) HashTreeRootWith

func (e *ExecutionPayload) HashTreeRootWith(hh *fssz.Hasher) (err error)

HashTreeRootWith ssz hashes the ExecutionPayload object with a hasher

type ForkData

type ForkData struct {
	CurrentVersion        []byte
	GenesisValidatorsRoot []byte
}

func (*ForkData) HashTreeRoot

func (f *ForkData) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the ForkData object

func (*ForkData) HashTreeRootWith

func (f *ForkData) HashTreeRootWith(hh *ssz.Hasher) (err error)

type ForkVersion

type ForkVersion [4]byte

type ILightClientUpdate

type ILightClientUpdate interface {
	GetAttestedHeader() *BeaconBlockHeader
	GetNextSyncCommittee() *SyncCommittee
	GetNextSyncCommitteeBranch() [][]byte
	GetFinalizedHeader() *BeaconBlockHeader
	GetFinalityBranch() [][]byte
	GetSyncAggregate() *SyncAggregate
	GetSignatureSlot() uint64
}

type ILightNodeBeaconBlockHeader

type ILightNodeBeaconBlockHeader struct {
	Slot          uint64
	ProposerIndex uint64
	ParentRoot    [32]byte
	StateRoot     [32]byte
	BodyRoot      [32]byte
}

ILightNodeBeaconBlockHeader is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeBlockHeader

type ILightNodeBlockHeader struct {
	ParentHash       []byte
	Sha3Uncles       []byte
	Miner            common.Address
	StateRoot        []byte
	TransactionsRoot []byte
	ReceiptsRoot     []byte
	LogsBloom        []byte
	Difficulty       *big.Int
	Number           *big.Int
	GasLimit         *big.Int
	GasUsed          *big.Int
	Timestamp        *big.Int
	ExtraData        []byte
	MixHash          []byte
	Nonce            []byte
	BaseFeePerGas    *big.Int
}

ILightNodeBlockHeader is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeExecution

type ILightNodeExecution struct {
	ParentHash       [32]byte
	FeeRecipient     common.Address
	StateRoot        [32]byte
	ReceiptsRoot     [32]byte
	LogsBloom        []byte
	PrevRandao       [32]byte
	BlockNumber      *big.Int
	GasLimit         *big.Int
	GasUsed          *big.Int
	Timestamp        *big.Int
	ExtraData        []byte
	BaseFeePerGas    *big.Int
	BlockHash        [32]byte
	TransactionsRoot [32]byte
	WithdrawalsRoot  [32]byte
}

ILightNodeExecution is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeLightClientState

type ILightNodeLightClientState struct {
	FinalizedHeader      ILightNodeBeaconBlockHeader
	CurrentSyncCommittee ILightNodeSyncCommittee
	NextSyncCommittee    ILightNodeSyncCommittee
	ChainID              uint64
}

ILightNodeLightClientState is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeLightClientUpdateV1

type ILightNodeLightClientUpdateV1 struct {
	AttestedHeader          ILightNodeBeaconBlockHeader
	NextSyncCommittee       ILightNodeSyncCommittee
	NextSyncCommitteeBranch [][32]byte
	FinalizedHeader         ILightNodeBeaconBlockHeader
	FinalityBranch          [][32]byte
	FinalizedExeHeader      ILightNodeBlockHeader
	ExeFinalityBranch       [][32]byte
	SyncAggregate           ILightNodeSyncAggregate
	SignatureSlot           uint64
}

ILightNodeLightClientUpdate is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeLightClientUpdateV2

type ILightNodeLightClientUpdateV2 struct {
	AttestedHeader          ILightNodeBeaconBlockHeader
	NextSyncCommittee       ILightNodeSyncCommittee
	NextSyncCommitteeBranch [][32]byte
	FinalizedHeader         ILightNodeBeaconBlockHeader
	FinalityBranch          [][32]byte
	FinalizedExecution      ILightNodeExecution
	ExecutionBranch         [][32]byte
	SyncAggregate           ILightNodeSyncAggregate
	SignatureSlot           uint64
}

ILightNodeLightClientUpdateV2 is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeLightClientVerify

type ILightNodeLightClientVerify struct {
	Update ILightNodeLightClientUpdateV1
	State  ILightNodeLightClientState
}

ILightNodeLightClientVerify is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeSyncAggregate

type ILightNodeSyncAggregate struct {
	SyncCommitteeBits      []byte
	SyncCommitteeSignature []byte
}

ILightNodeSyncAggregate is an auto generated low-level Go binding around an user-defined struct.

type ILightNodeSyncCommittee

type ILightNodeSyncCommittee struct {
	Pubkeys         []byte
	AggregatePubkey []byte
}

ILightNodeSyncCommittee is an auto generated low-level Go binding around an user-defined struct.

type LightClientState

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

func ConvertToLightClientState

func ConvertToLightClientState(
	finalizedBeaconHeader *ILightNodeBeaconBlockHeader,
	curSyncCommittee *ILightNodeSyncCommittee,
	nextSyncCommittee *ILightNodeSyncCommittee,
	chainId uint64) *LightClientState

type LightClientUpdateV1

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

func (LightClientUpdateV1) GetAttestedHeader

func (l LightClientUpdateV1) GetAttestedHeader() *BeaconBlockHeader

func (LightClientUpdateV1) GetFinalityBranch

func (l LightClientUpdateV1) GetFinalityBranch() [][]byte

func (LightClientUpdateV1) GetFinalizedHeader

func (l LightClientUpdateV1) GetFinalizedHeader() *BeaconBlockHeader

func (LightClientUpdateV1) GetNextSyncCommittee

func (l LightClientUpdateV1) GetNextSyncCommittee() *SyncCommittee

func (LightClientUpdateV1) GetNextSyncCommitteeBranch

func (l LightClientUpdateV1) GetNextSyncCommitteeBranch() [][]byte

func (LightClientUpdateV1) GetSignatureSlot

func (l LightClientUpdateV1) GetSignatureSlot() uint64

func (LightClientUpdateV1) GetSyncAggregate

func (l LightClientUpdateV1) GetSyncAggregate() *SyncAggregate

type LightClientUpdateV2

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

func (LightClientUpdateV2) GetAttestedHeader

func (l LightClientUpdateV2) GetAttestedHeader() *BeaconBlockHeader

func (LightClientUpdateV2) GetFinalityBranch

func (l LightClientUpdateV2) GetFinalityBranch() [][]byte

func (LightClientUpdateV2) GetFinalizedHeader

func (l LightClientUpdateV2) GetFinalizedHeader() *BeaconBlockHeader

func (LightClientUpdateV2) GetNextSyncCommittee

func (l LightClientUpdateV2) GetNextSyncCommittee() *SyncCommittee

func (LightClientUpdateV2) GetNextSyncCommitteeBranch

func (l LightClientUpdateV2) GetNextSyncCommitteeBranch() [][]byte

func (LightClientUpdateV2) GetSignatureSlot

func (l LightClientUpdateV2) GetSignatureSlot() uint64

func (LightClientUpdateV2) GetSyncAggregate

func (l LightClientUpdateV2) GetSyncAggregate() *SyncAggregate

type LightClientVerify

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

func ConvertToLightClientVerify

func ConvertToLightClientVerify(update *ILightNodeLightClientUpdateV2,
	finalizedBeaconHeader *ILightNodeBeaconBlockHeader,
	curSyncCommittee *ILightNodeSyncCommittee,
	nextSyncCommittee *ILightNodeSyncCommittee,
	chainId uint64) *LightClientVerify

type NetworkConfig

type NetworkConfig struct {
	GenesisValidatorsRoot [32]byte
	BellatrixForkVersion  ForkVersion
	BellatrixForkEpoch    uint64
	CapellaForkVersion    ForkVersion
	CapellaForkEpoch      uint64
}

type Root

type Root []byte

type SigningData

type SigningData struct {
	ObjectRoot []byte `protobuf:"bytes,1,opt,name=object_root,json=objectRoot,proto3" json:"object_root,omitempty" ssz-size:"32"`
	Domain     []byte `protobuf:"bytes,2,opt,name=domain,proto3" json:"domain,omitempty" ssz-size:"32"`
	// contains filtered or unexported fields
}

func (*SigningData) HashTreeRoot

func (s *SigningData) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the SigningData object

func (*SigningData) HashTreeRootWith

func (s *SigningData) HashTreeRootWith(hh *ssz.Hasher) (err error)

HashTreeRootWith ssz hashes the SigningData object with a hasher

type SyncAggregate

type SyncAggregate struct {
	SyncCommitteeBits      bitfield.Bitvector512
	SyncCommitteeSignature []byte
}

type SyncCommittee

type SyncCommittee struct {
	Pubkeys         [][]byte
	AggregatePubkey []byte
}

type ValidatorIndex

type ValidatorIndex uint64

Directories

Path Synopsis
Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
Package bls implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
blst
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
Package blst implements a go-wrapper around a library implementing the the BLS12-381 curve and signature scheme.
common
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
Package common provides the BLS interfaces that are implemented by the various BLS wrappers.
Package hashutil includes all hash-function related helpers for Prysm.
Package hashutil includes all hash-function related helpers for Prysm.
htr
Package rand defines methods of obtaining random number generators.
Package rand defines methods of obtaining random number generators.
Package ssz defines HashTreeRoot utility functions.
Package ssz defines HashTreeRoot utility functions.

Jump to

Keyboard shortcuts

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