prover

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SYNC_COMMITTEE_DOMAIN phase0.DomainType = [4]byte{7, 0, 0, 0}
)

Functions

func ByteArrayToU16Array

func ByteArrayToU16Array(src []byte) []uint16

func CountSetBits

func CountSetBits(arr [64]byte) int

func SliceTo32Bytes

func SliceTo32Bytes(in []byte) [32]byte

func U16ArrayTo32ByteArray

func U16ArrayTo32ByteArray(src []uint16) [32]byte

func U16ArrayToByteArray

func U16ArrayToByteArray(src []uint16) []byte

Types

type BeaconClient

type BeaconClient interface {
	BeaconBlockRoot(ctx context.Context, opts *api.BeaconBlockRootOpts) (*api.Response[*phase0.Root], error)
	Domain(ctx context.Context, domainType phase0.DomainType, epoch phase0.Epoch) (phase0.Domain, error)
}

type EvmProof

type EvmProof[T any] struct {
	Proof []byte
	Input T
}

type LightClient

type LightClient interface {
	FinalityUpdate() (*consensus.LightClientFinalityUpdateDeneb, error)
	Updates(period uint64) ([]*consensus.LightClientUpdateDeneb, error)
	Bootstrap(blockRoot string) (*consensus.LightClientBootstrapDeneb, error)
}

type Prover

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

func NewProver

func NewProver(
	proverClient ProverClient,
	beaconClient BeaconClient,
	lightClient LightClient,
	spec Spec,
	finalityTreshold uint64,
	slotsPerEpoch uint64,
) *Prover

func (*Prover) RotateArgs

func (p *Prover) RotateArgs(period uint64) (*RotateArgs, error)

func (*Prover) RotateProof

func (p *Prover) RotateProof(args *RotateArgs) (*EvmProof[struct{}], error)

RotateProof generates the proof for the sync committee rotation for the period

func (*Prover) StepArgs

func (p *Prover) StepArgs() (*StepArgs, error)

func (*Prover) StepProof

func (p *Prover) StepProof(args *StepArgs) (*EvmProof[message.SyncStepInput], error)

StepProof generates the proof for the sync step

type ProverClient

type ProverClient interface {
	CallFor(ctx context.Context, reply interface{}, method string, args ...interface{}) error
}

type ProverResponse

type ProverResponse struct {
	Proof      []uint16 `json:"proof"`
	Commitment string   `json:"committee_poseidon"`
}

type RotateArgs

type RotateArgs struct {
	Spec    Spec
	Update  *consensus.LightClientUpdateDeneb
	Pubkeys [512][48]byte
	Domain  phase0.Domain
}

type Spec

type Spec string
const (
	TESTNET_SPEC Spec = "testnet"
	MINIMAL_SPEC Spec = "minimal"
	MAINNET_SPEC Spec = "mainnet"
)

type StepArgs

type StepArgs struct {
	Spec    Spec
	Pubkeys [512][48]byte
	Domain  phase0.Domain
	Update  *consensus.LightClientFinalityUpdateDeneb
}

Jump to

Keyboard shortcuts

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