Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeDomain(domainType [DomainByteLength]byte, forkVersion, genesisValidatorsRoot []byte) ([]byte, error)
- func ComputeSigningRoot(object fssz.HashRoot, domain []byte) ([32]byte, error)
- func PadTo(b []byte, size int) []byte
- func ReverseByteOrder(input []byte) []byte
- func SyncCommitteeRoot(committee *SyncCommittee) ([32]byte, error)
- func VerifyLightClientUpdate(input []byte) error
- type BeaconBlockHeader
- type DomainType
- type ExecutionPayload
- type ForkData
- type ForkVersion
- type ILightClientUpdate
- type ILightNodeBeaconBlockHeader
- type ILightNodeBlockHeader
- type ILightNodeExecution
- type ILightNodeLightClientState
- type ILightNodeLightClientUpdateV1
- type ILightNodeLightClientUpdateV2
- type ILightNodeLightClientVerify
- type ILightNodeSyncAggregate
- type ILightNodeSyncCommittee
- type LightClientState
- type LightClientUpdateV1
- func (l LightClientUpdateV1) GetAttestedHeader() *BeaconBlockHeader
- func (l LightClientUpdateV1) GetFinalityBranch() [][]byte
- func (l LightClientUpdateV1) GetFinalizedHeader() *BeaconBlockHeader
- func (l LightClientUpdateV1) GetNextSyncCommittee() *SyncCommittee
- func (l LightClientUpdateV1) GetNextSyncCommitteeBranch() [][]byte
- func (l LightClientUpdateV1) GetSignatureSlot() uint64
- func (l LightClientUpdateV1) GetSyncAggregate() *SyncAggregate
- type LightClientUpdateV2
- func (l LightClientUpdateV2) GetAttestedHeader() *BeaconBlockHeader
- func (l LightClientUpdateV2) GetFinalityBranch() [][]byte
- func (l LightClientUpdateV2) GetFinalizedHeader() *BeaconBlockHeader
- func (l LightClientUpdateV2) GetNextSyncCommittee() *SyncCommittee
- func (l LightClientUpdateV2) GetNextSyncCommitteeBranch() [][]byte
- func (l LightClientUpdateV2) GetSignatureSlot() uint64
- func (l LightClientUpdateV2) GetSyncAggregate() *SyncAggregate
- type LightClientVerify
- type NetworkConfig
- type Root
- type SigningData
- type SyncAggregate
- type SyncCommittee
- type ValidatorIndex
Constants ¶
const ABIJSON = "" /* 4616-byte string literal not displayed */
const BLSPubkeyLength = 48
const BeaconBlockBodyTreeExecutionPayloadIndex uint64 = 25
const BeaconHeaderABIJSON = "" /* 459-byte string literal not displayed */
const ChainIdABIJSON = "{\"internalType\":\"uint64\",\"type\":\"uint64\"}"
const DomainByteLength = 4
DomainByteLength length of domain byte array.
const EpochsPerSyncCommitteePeriod uint64 = 256
const ExecutionPayloadProofSize int = 4
const ExecutionProofSize = L1BeaconBlockBodyProofSize + L2ExecutionPayloadProofSize
const FinalizedRootIndex uint32 = 105
const ForkVersionByteLength = 4
ForkVersionByteLength length of fork version byte array.
const L1BeaconBlockBodyProofSize uint64 = 4
const L1BeaconBlockBodyTreeExecutionPayloadIndex uint64 = 25
const L2ExecutionPayloadProofSize uint64 = 4
const L2ExecutionPayloadTreeExecutionBlockIndex uint64 = 28
const MinSyncCommitteeParticipants uint64 = 1
const NextSyncCommitteeIndex uint32 = 55
const SlotsPerEpoch uint64 = 32
const SyncCommitteeABIJSON = "" /* 231-byte string literal not displayed */
const UpdateABIJSON = "" /* 3200-byte string literal not displayed */
Variables ¶
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 ¶
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 ¶ added in v1.1.3
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 ¶ added in v1.1.3
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 ¶
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 ¶ added in v1.1.3
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 ¶ added in v1.1.3
func (e *ExecutionPayload) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the ExecutionPayload object
func (*ExecutionPayload) HashTreeRootWith ¶ added in v1.1.3
func (e *ExecutionPayload) HashTreeRootWith(hh *fssz.Hasher) (err error)
HashTreeRootWith ssz hashes the ExecutionPayload object with a hasher
type ForkData ¶
func (*ForkData) HashTreeRoot ¶
HashTreeRoot ssz hashes the ForkData object
type ForkVersion ¶
type ForkVersion [4]byte
type ILightClientUpdate ¶ added in v1.1.3
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 ¶ added in v1.1.3
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 ¶ added in v1.1.3
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 ¶ added in v1.1.3
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 ¶
ILightNodeSyncAggregate is an auto generated low-level Go binding around an user-defined struct.
type ILightNodeSyncCommittee ¶
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 ¶ added in v1.1.3
func ConvertToLightClientState( finalizedBeaconHeader *ILightNodeBeaconBlockHeader, curSyncCommittee *ILightNodeSyncCommittee, nextSyncCommittee *ILightNodeSyncCommittee, chainId uint64) *LightClientState
type LightClientUpdateV1 ¶ added in v1.1.3
type LightClientUpdateV1 struct {
// contains filtered or unexported fields
}
func (LightClientUpdateV1) GetAttestedHeader ¶ added in v1.1.3
func (l LightClientUpdateV1) GetAttestedHeader() *BeaconBlockHeader
func (LightClientUpdateV1) GetFinalityBranch ¶ added in v1.1.3
func (l LightClientUpdateV1) GetFinalityBranch() [][]byte
func (LightClientUpdateV1) GetFinalizedHeader ¶ added in v1.1.3
func (l LightClientUpdateV1) GetFinalizedHeader() *BeaconBlockHeader
func (LightClientUpdateV1) GetNextSyncCommittee ¶ added in v1.1.3
func (l LightClientUpdateV1) GetNextSyncCommittee() *SyncCommittee
func (LightClientUpdateV1) GetNextSyncCommitteeBranch ¶ added in v1.1.3
func (l LightClientUpdateV1) GetNextSyncCommitteeBranch() [][]byte
func (LightClientUpdateV1) GetSignatureSlot ¶ added in v1.1.3
func (l LightClientUpdateV1) GetSignatureSlot() uint64
func (LightClientUpdateV1) GetSyncAggregate ¶ added in v1.1.3
func (l LightClientUpdateV1) GetSyncAggregate() *SyncAggregate
type LightClientUpdateV2 ¶ added in v1.1.3
type LightClientUpdateV2 struct {
// contains filtered or unexported fields
}
func (LightClientUpdateV2) GetAttestedHeader ¶ added in v1.1.3
func (l LightClientUpdateV2) GetAttestedHeader() *BeaconBlockHeader
func (LightClientUpdateV2) GetFinalityBranch ¶ added in v1.1.3
func (l LightClientUpdateV2) GetFinalityBranch() [][]byte
func (LightClientUpdateV2) GetFinalizedHeader ¶ added in v1.1.3
func (l LightClientUpdateV2) GetFinalizedHeader() *BeaconBlockHeader
func (LightClientUpdateV2) GetNextSyncCommittee ¶ added in v1.1.3
func (l LightClientUpdateV2) GetNextSyncCommittee() *SyncCommittee
func (LightClientUpdateV2) GetNextSyncCommitteeBranch ¶ added in v1.1.3
func (l LightClientUpdateV2) GetNextSyncCommitteeBranch() [][]byte
func (LightClientUpdateV2) GetSignatureSlot ¶ added in v1.1.3
func (l LightClientUpdateV2) GetSignatureSlot() uint64
func (LightClientUpdateV2) GetSyncAggregate ¶ added in v1.1.3
func (l LightClientUpdateV2) GetSyncAggregate() *SyncAggregate
type LightClientVerify ¶
type LightClientVerify struct {
// contains filtered or unexported fields
}
func ConvertToLightClientVerify ¶ added in v1.1.3
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 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 ValidatorIndex ¶
type ValidatorIndex uint64
Source Files ¶
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. |
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. |