utils

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ProofsDir = "proofs"
)

Variables

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

Functions

func ReadLastStep

func ReadLastStep(dir string) (uint64, error)

ReadLastStep reads the tracked last step from disk.

func WriteLastStep

func WriteLastStep(dir string, proof *ProofData, step uint64) error

WriteLastStep writes the last step and proof to disk as a persistent cache.

Types

type GameInputsSource

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

type L1HeadSource

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

type L2HeaderSource

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
	AgreedPreState []byte
	L2Claim        common.Hash
	L2BlockNumber  *big.Int
}

func FetchLocalInputs

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

func FetchLocalInputsFromProposals

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

type PreimageLoader

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

func NewPreimageLoader

func NewPreimageLoader(makeSource PreimageSourceCreator) *PreimageLoader

func (*PreimageLoader) LoadPreimage

func (l *PreimageLoader) LoadPreimage(proof *ProofData) (*types.PreimageOracleData, error)

type PreimageOpt

type PreimageOpt func() preimageOpts

func FirstKeccakPreimageLoad

func FirstKeccakPreimageLoad() PreimageOpt

func FirstPrecompilePreimageLoad

func FirstPrecompilePreimageLoad() PreimageOpt

func FirstPreimageLoadOfType

func FirstPreimageLoadOfType(preimageType string) PreimageOpt

func PreimageLargerThan

func PreimageLargerThan(size int) PreimageOpt

func PreimageLoad

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

type PreimageSource added in v1.9.2

type PreimageSource interface {
	Get(key common.Hash) ([]byte, error)
	Close() error
}

type PreimageSourceCreator added in v1.9.2

type PreimageSourceCreator func() (PreimageSource, error)

type ProofData

type ProofData struct {
	ClaimValue   common.Hash   `json:"post"`
	StateData    hexutil.Bytes `json:"state-data"`
	ProofData    hexutil.Bytes `json:"proof-data"`
	OracleKey    hexutil.Bytes `json:"oracle-key,omitempty"`
	OracleValue  hexutil.Bytes `json:"oracle-value,omitempty"`
	OracleOffset uint32        `json:"oracle-offset,omitempty"`
}

type ProofGenerator

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

type Proposal added in v1.11.0

type Proposal struct {
	L2BlockNumber *big.Int
	OutputRoot    common.Hash
}

Jump to

Keyboard shortcuts

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