Documentation ¶
Index ¶
- func APIs(backend Backend) []rpc.API
- func GenerateProof(ctx context.Context, backend Backend, startState *ExecutionState, ...) (*proof.OneStepProof, error)
- type Backend
- type ExecutionState
- type ProverAPI
- func (api *ProverAPI) GenerateProofForOpcode(ctx context.Context, fraud bool, hash common.Hash, opcode int64, ...) (json.RawMessage, error)
- func (api *ProverAPI) GenerateProofForStep(ctx context.Context, fraud bool, hash common.Hash, step int64, ...) (json.RawMessage, error)
- func (api *ProverAPI) GenerateStateHashes(ctx context.Context, startNum, endNum uint64, config *ProverConfig) ([]common.Hash, error)
- func (api *ProverAPI) ProveBlocksForBenchmark(ctx context.Context, startNum, endNum uint64, config *ProverConfig) ([]hexutil.Bytes, error)
- func (api *ProverAPI) ProveTransaction(ctx context.Context, hash common.Hash, target common.Hash, ...) (hexutil.Bytes, error)
- func (api *ProverAPI) SetFraudProof(ctx context.Context, fraud bool, step, opcode int64, config *ProverConfig) (json.RawMessage, error)
- type ProverConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateProof ¶
func GenerateProof(ctx context.Context, backend Backend, startState *ExecutionState, config *ProverConfig) (*proof.OneStepProof, error)
GenerateProof serves as an entrypoint for one-step proof generation. There are 6 types of one-step proofs:
- BlockState -> InterState: block initiation
- InterState -> IntraState: transaction initiation (contract call or creation)
- InterState -> InterState: EOA transfer transaction
- IntraState -> IntraState: one-step EVM execution (require tracing)
- IntraState -> InterState: transaction finalization (require tracing)
- InterState -> BlockState: block finalization
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) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) RPCGasCap() *big.Int 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.Context, *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 BlockGasUsed *big.Int StateType proofState.StateType Block *types.Block TransactionIdx uint64 StepIdx uint64 }
func GenerateStates ¶
func GenerateStates(backend Backend, ctx context.Context, startNum, endNum uint64, config *ProverConfig) ([]*ExecutionState, error)
GenerateStates generates execution states across blocks [startNum, endNum)
For example there are 2 blocks: block A with transactions A1, A2; block B without transactions.
The states are (in order):
- the BlockState of the block right before A
- the InterState before A1
- the IntraStates of A1 if A1 is not an EOA transfer
- the InterState before A2 (after A1)
- the IntraStates of A2 if A2 is not an EOA transfer
- the InterState after A2
- the BlockState of the block A
- a dummy InterState
- the BlockState of the block 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 (*ProverAPI) GenerateProofForOpcode ¶
func (*ProverAPI) GenerateProofForStep ¶
func (*ProverAPI) GenerateStateHashes ¶
func (*ProverAPI) ProveBlocksForBenchmark ¶
func (*ProverAPI) ProveTransaction ¶
func (*ProverAPI) SetFraudProof ¶
func (api *ProverAPI) SetFraudProof(ctx context.Context, fraud bool, step, opcode int64, config *ProverConfig) (json.RawMessage, error)
type ProverConfig ¶
type ProverConfig struct {
Reexec *uint64
}
Click to show internal directories.
Click to hide internal directories.