utils

package
v0.0.0-...-a36dab5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregationBytesToAggregationBits

func AggregationBytesToAggregationBits(input []uint8) [common.LenOfValidators]uint8

func DecodeHex

func DecodeHex(hexString string) []byte

func DecodeHexTo32Bytes

func DecodeHexTo32Bytes(hexString string) [common.LenOfHash]byte

func DecodeHexTo48Bytes

func DecodeHexTo48Bytes(hexString string) [common.LenOfPubKey]byte

func Power2Index

func Power2Index(n uint64) int

func PubKeysMiMCHash

func PubKeysMiMCHash(h hash.Hash, pubKeys [][]byte) ([]byte, error)

func ReadCcs

func ReadCcs(ccsFile string) (constraint.ConstraintSystem, error)

func ReadCcsAndVk

func ReadCcsAndVk(ccsFile, vkFile string) (constraint.ConstraintSystem, native_plonk.VerifyingKey, error)

func ReadPk

func ReadPk(pkFile string) (native_plonk.ProvingKey, error)

func ReadProofAndWts

func ReadProofAndWts(proofFile, pubWitnessFile string) (native_plonk.Proof, witness.Witness, error)

func ReadSrs

func ReadSrs(size int, srsDir string, srs kzg.SRS, srsLagrange kzg.SRS) error

func ReadVk

func ReadVk(vkFile string) (native_plonk.VerifyingKey, error)

func RestoreMerkleRoot

func RestoreMerkleRoot(index uint64, leaf [common.LenOfHash]byte, branches [][common.LenOfHash]byte) [common.LenOfHash]byte

func SSZQuarterSyncCommittee

func SSZQuarterSyncCommittee(pubKeys [common.QuarterLenOfValidators][common.LenOfPubKey]byte) []byte

func SSZRoot

func SSZRoot(
	input []byte,
	depth int,
) []byte

func SSZSyncCommittee

func SSZSyncCommittee(pubKeys [common.LenOfValidators][common.LenOfPubKey]byte, aggPubKey []byte) []byte

func U64To32LittleEndianBytes

func U64To32LittleEndianBytes(val uint64) [32]byte

func WriteCcsAndPkVk

func WriteCcsAndPkVk(circuit frontend.Circuit, ccsFile string, srsDir string, pkFile string, vkFile string) error

func WriteProofAndWts

func WriteProofAndWts(assignment frontend.Circuit, ccs constraint.ConstraintSystem, pk native_plonk.ProvingKey, vk native_plonk.VerifyingKey, proofFile string, witnessFile string) error

Types

type BeaconBlockHeader

type BeaconBlockHeader 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"`
}

type BinaryMerkleTree

type BinaryMerkleTree [][common.LenOfHash]byte

func BuildBinaryMerkleTree

func BuildBinaryMerkleTree(leaves [][common.LenOfHash]byte) BinaryMerkleTree

func (BinaryMerkleTree) Proof

func (tree BinaryMerkleTree) Proof(index uint64) ([][common.LenOfHash]byte, error)

func (BinaryMerkleTree) Root

func (tree BinaryMerkleTree) Root() [common.LenOfHash]byte

type LightClientUpdateInfo

type LightClientUpdateInfo struct {
	Version                 string             `json:"version"`
	AttestedHeader          *BeaconBlockHeader `json:"attested_header"`
	CurrentSyncCommittee    *SyncCommittee     `json:"current_sync_committee,omitempty"`     //current_sync_committee
	SyncAggregate           *SyncAggregate     `json:"sync_aggregate"`                       //sync_aggregate for attested_header, signed by current_sync_committee
	FinalizedHeader         *BeaconBlockHeader `json:"finalized_header,omitempty"`           //finalized_header in attested_header.state_root
	FinalityBranch          []string           `json:"finality_branch,omitempty"`            // finality_branch in attested_header.state_root
	NextSyncCommittee       *SyncCommittee     `json:"next_sync_committee,omitempty"`        //next_sync_committee in finalized_header.state_root
	NextSyncCommitteeBranch []string           `json:"next_sync_committee_branch,omitempty"` //next_sync_committee branch in finalized_header.state_root
	SignatureSlot           string             `json:"signature_slot"`
}

func LoadUpdateInfo

func LoadUpdateInfo(file string) (LightClientUpdateInfo, error)

type SyncAggregate

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

type SyncCommittee

type SyncCommittee struct {
	PubKeys         []string `json:"pubkeys"`
	AggregatePubKey string   `json:"aggregate_pubkey"`
}

Jump to

Keyboard shortcuts

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