cannon

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScalarValue     = errors.New("invalid scalar value")
	ErrInvalidBlobKeyPreimage = errors.New("invalid blob key preimage")
)

Functions

This section is empty.

Types

type CannonMetricer

type CannonMetricer interface {
	RecordCannonExecutionTime(t float64)
}

type CannonPrestateProvider added in v1.4.2

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

func NewPrestateProvider added in v1.4.2

func NewPrestateProvider(prestate string) *CannonPrestateProvider

func (*CannonPrestateProvider) AbsolutePreStateCommitment added in v1.4.2

func (p *CannonPrestateProvider) AbsolutePreStateCommitment(_ context.Context) (common.Hash, error)

type CannonTraceProvider

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

func NewTraceProvider

func NewTraceProvider(logger log.Logger, m CannonMetricer, cfg *config.Config, localInputs LocalGameInputs, dir string, gameDepth types.Depth) *CannonTraceProvider

func (*CannonTraceProvider) AbsolutePreStateCommitment

func (p *CannonTraceProvider) AbsolutePreStateCommitment(_ context.Context) (common.Hash, error)

func (*CannonTraceProvider) Get

func (*CannonTraceProvider) GetStepData

func (*CannonTraceProvider) SetMaxDepth added in v1.2.0

func (p *CannonTraceProvider) SetMaxDepth(gameDepth types.Depth)

type CannonTraceProviderForTest added in v1.5.0

type CannonTraceProviderForTest struct {
	*CannonTraceProvider
}

CannonTraceProviderForTest is a CannonTraceProvider that can find the step referencing the preimage read Only to be used for testing

func NewTraceProviderForTest added in v1.5.0

func NewTraceProviderForTest(logger log.Logger, m CannonMetricer, cfg *config.Config, localInputs LocalGameInputs, dir string, gameDepth types.Depth) *CannonTraceProviderForTest

func (*CannonTraceProviderForTest) FindStep added in v1.5.1

func (p *CannonTraceProviderForTest) FindStep(ctx context.Context, start uint64, preimage PreimageOpt) (uint64, error)

type Executor

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

func NewExecutor

func NewExecutor(logger log.Logger, m CannonMetricer, cfg *config.Config, inputs LocalGameInputs) *Executor

func (*Executor) GenerateProof

func (e *Executor) GenerateProof(ctx context.Context, dir string, i uint64) error

GenerateProof executes cannon to generate a proof at the specified trace index. The proof is stored at the specified directory.

type GameInputsSource

type GameInputsSource interface {
	L1HeadSource
	GetProposals(ctx context.Context) (agreed contracts.Proposal, disputed contracts.Proposal, err error)
}

type L1HeadSource added in v1.4.2

type L1HeadSource interface {
	GetL1Head(ctx context.Context) (common.Hash, error)
}

type L2HeaderSource added in v1.4.2

type L2HeaderSource interface {
	HeaderByNumber(context.Context, *big.Int) (*ethtypes.Header, error)
}

type LocalGameInputs

type LocalGameInputs struct {
	L1Head        common.Hash
	L2Head        common.Hash
	L2OutputRoot  common.Hash
	L2Claim       common.Hash
	L2BlockNumber *big.Int
}

func FetchLocalInputs added in v1.4.2

func FetchLocalInputs(ctx context.Context, caller GameInputsSource, l2Client L2HeaderSource) (LocalGameInputs, error)

func FetchLocalInputsFromProposals added in v1.4.2

func FetchLocalInputsFromProposals(ctx context.Context, l1Head common.Hash, l2Client L2HeaderSource, agreedOutput contracts.Proposal, claimedOutput contracts.Proposal) (LocalGameInputs, error)

type PreimageOpt added in v1.5.1

type PreimageOpt func() preimageOpts

func FirstKeccakPreimageLoad added in v1.5.1

func FirstKeccakPreimageLoad() PreimageOpt

func FirstPrecompilePreimageLoad added in v1.7.2

func FirstPrecompilePreimageLoad() PreimageOpt

func FirstPreimageLoadOfType added in v1.5.1

func FirstPreimageLoadOfType(preimageType string) PreimageOpt

func PreimageLargerThan added in v1.5.1

func PreimageLargerThan(size int) PreimageOpt

func PreimageLoad added in v1.7.2

func PreimageLoad(key preimage.Key, offset uint32) PreimageOpt

type ProofGenerator

type ProofGenerator interface {
	// GenerateProof executes cannon to generate a proof at the specified trace index in dataDir.
	GenerateProof(ctx context.Context, dataDir string, proofAt uint64) error
}

Jump to

Keyboard shortcuts

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