proof

package
v0.0.0-...-4547e52 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: GPL-3.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIs

func APIs(backend Backend) []rpc.API

APIs return the collection of RPC services the tracer package offers.

func GenerateProof

func GenerateProof(backend Backend, ctx context.Context, startState *ExecutionState, config *ProverConfig) (*proof.OneStepProof, error)

Types

type Backend

type Backend interface {
	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
	BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)
	BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
	GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)
	RPCGasCap() uint64
	ChainConfig() *params.ChainConfig
	Engine() consensus.Engine
	ChainDb() ethdb.Database
	// StateAtBlock returns the state corresponding to the stateroot of the block.
	// N.B: For executing transactions on block N, the required stateRoot is block N-1,
	// so this method should be called with the parent.
	StateAtBlock(ctx context.Context, block *types.Block, reexec uint64, base *state.StateDB, checkLive, preferDisk bool) (*state.StateDB, error)
	StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (core.Message, vm.BlockContext, *state.StateDB, error)
}

Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.

type ExecutionState

type ExecutionState struct {
	VMHash         common.Hash
	Block          *types.Block
	TransactionIdx uint64
	StepIdx        uint64
}

func GenerateStates

func GenerateStates(
	backend Backend,
	ctx context.Context,
	startNum uint64,
	endNum uint64,
	config *ProverConfig,
) ([]*ExecutionState, error)

This function generates execution states across blocks [startNum, endNum) For example there are 2 transactions: a, b The states are: inter-state before a, intra-states in a, inter-state before b (after a), intra-states in b, inter-state after b

func (*ExecutionState) Hash

func (s *ExecutionState) Hash() common.Hash

func (*ExecutionState) MarshalJson

func (s *ExecutionState) MarshalJson() ([]byte, error)

type ProverAPI

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

ProverAPI is the collection of Specular one-step proof APIs.

func NewAPI

func NewAPI(backend Backend) *ProverAPI

NewAPI creates a new API definition for the Specular one-step proof services.

func (*ProverAPI) ProveTransaction

func (api *ProverAPI) ProveTransaction(ctx context.Context, hash common.Hash, target common.Hash, config *ProverConfig) (hexutil.Bytes, error)

type ProverConfig

type ProverConfig struct {
	Reexec *uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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