challenge

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusNone is regarded as a challenge is not in progress.
	// The other status are regarded as a challenge is in progress.
	StatusNone uint8 = iota
	StatusChallengerTurn
	StatusAsserterTurn
	StatusChallengerTimeout
	StatusAsserterTimeout
	StatusReadyToProve
)

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte) []*big.Int

Types

type Fetcher

type Fetcher struct {
	Client JsonRPCProverClient
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher(rpcURL string, timeout time.Duration, logger log.Logger) (*Fetcher, error)

func (*Fetcher) FetchProofAndPair

func (f *Fetcher) FetchProofAndPair(ctx context.Context, trace string) (*ProofAndPair, error)

type Hash

type Hash = [32]byte

type JsonRPCProverClient

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

func (JsonRPCProverClient) Prove

func (c JsonRPCProverClient) Prove(ctx context.Context, traceString string, proofType ProofType) (*ProveResponse, error)

type JsonRpcError

type JsonRpcError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

func (*JsonRpcError) Error

func (j *JsonRpcError) Error() string

type ProofAndPair

type ProofAndPair struct {
	Proof []*big.Int
	Pair  []*big.Int
}

type ProofType

type ProofType int32

type ProveResponse

type ProveResponse struct {
	FinalPair []byte `json:"final_pair,omitempty"`
	Proof     []byte `json:"proof,omitempty"`
}

type ProverClient

type ProverClient interface {
	Prove(ctx context.Context, traceString string, proofType ProofType) (*ProveResponse, error)
}

type Segments

type Segments struct {
	Start  uint64
	Size   uint64
	Degree uint64
	Hashes []Hash
}

func NewEmptySegments

func NewEmptySegments(start, size, sections uint64) *Segments

func NewSegments

func NewSegments(start, size uint64, hashes []Hash) *Segments

func (*Segments) BlockNumbers

func (s *Segments) BlockNumbers() []uint64

func (*Segments) NextSegmentsRange

func (s *Segments) NextSegmentsRange(position uint64) (start, size uint64)

func (*Segments) SetHashValue

func (s *Segments) SetHashValue(index int, hash Hash)

Jump to

Keyboard shortcuts

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