common

package
v0.0.0-...-7d5141f Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigToLittleEndian

func BigToLittleEndian(input *big.Int) [32]byte

func CeilLog2

func CeilLog2(x int) uint64

ceilLog2 calculates the ceiling of the base-2 logarithm of x.

func ComputeMerkleTreeFromLeaves

func ComputeMerkleTreeFromLeaves(values []phase0.Root, numLayers uint64) ([][]phase0.Root, error)

func ConvertTo32ByteArray

func ConvertTo32ByteArray(b []byte) [32]byte

func ConvertUint64ToRoot

func ConvertUint64ToRoot(n uint64) phase0.Root

func GetDepth

func GetDepth(d uint64) uint8

func GetSlotTimestamp

func GetSlotTimestamp(beaconState *deneb.BeaconState, blockHeader *phase0.BeaconBlockHeader) uint64

func LogTreeByLevel

func LogTreeByLevel(tree [][]phase0.Root)

func NextPowerOfTwo

func NextPowerOfTwo(v uint64) uint

func ReadFile

func ReadFile(fileName string) ([]byte, error)

func ValidateProof

func ValidateProof(root phase0.Root, proof [][32]byte, element phase0.Root, index uint64) bool

Types

type Bytes32

type Bytes32 [32]byte

func ConvertUint64ToBytes32

func ConvertUint64ToBytes32(n uint64) Bytes32

func ConvertValidatorToValidatorFields

func ConvertValidatorToValidatorFields(v *phase0.Validator) []Bytes32

func (*Bytes32) MarshalJSON

func (p *Bytes32) MarshalJSON() ([]byte, error)

func (*Bytes32) UnmarshalJSON

func (p *Bytes32) UnmarshalJSON(data []byte) error

type Proof

type Proof [][32]byte

func ComputeMerkleProofFromTree

func ComputeMerkleProofFromTree(tree [][]phase0.Root, index, numLayers uint64) (Proof, error)

This proof is from the bottom to the top

func GetProof

func GetProof(leaves []phase0.Root, index uint64, numLayers uint64) (Proof, error)

func (Proof) MarshalJSON

func (p Proof) MarshalJSON() ([]byte, error)

func (Proof) ToByteSlice

func (p Proof) ToByteSlice() []byte

func (*Proof) UnmarshalJSON

func (p *Proof) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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