Documentation ¶
Index ¶
- func GetStorageProof(db vm.StateDB, address common.Address, key common.Hash) (*MPTProof, *MPTProof, error)
- func IsStackError(err error) bool
- func IsStopTokenError(err error) bool
- type BlockHashMerkleProof
- type BlockHashProof
- type BlockStateProof
- type CodeProof
- type InterStateProof
- type IntraStateProof
- type LogProof
- type MPTProof
- type MemoryAppendProof
- type MemoryCombinedReadProof
- type MemoryCombinedWriteProof
- type MemoryReadProof
- type MemoryWriteProof
- type OneStepProof
- func EmptyProof() *OneStepProof
- func GetBlockFinalizationProof(interState *state.InterState) (*OneStepProof, error)
- func GetBlockInitiationProof(blockState *state.BlockState) (*OneStepProof, error)
- func GetIntraProof(ctx ProofGenContext, currState, nextState *state.IntraState, vmerr error) (*OneStepProof, error)
- func GetTransactionInitaitionProof(chainConfig *params.ChainConfig, vmctx *vm.BlockContext, tx *types.Transaction, ...) (*OneStepProof, error)
- type Proof
- type ProofGenContext
- type ReceiptProof
- type SelfDestructSetProof
- type StackProof
- type VerifierType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStorageProof ¶
func IsStackError ¶
func IsStopTokenError ¶
Types ¶
type BlockHashMerkleProof ¶
func GetBlockHashMerkleProof ¶
func GetBlockHashMerkleProof(tree *state.BlockHashTree, blockNum uint64) (*BlockHashMerkleProof, error)
func (*BlockHashMerkleProof) Encode ¶
func (p *BlockHashMerkleProof) Encode() []byte
type BlockHashProof ¶
func (*BlockHashProof) Encode ¶
func (b *BlockHashProof) Encode() []byte
type BlockStateProof ¶
type BlockStateProof struct { BlockNumber uint64 GlobalStateRoot common.Hash BlockHashRoot common.Hash }
func BlockStateProofFromBlockState ¶
func BlockStateProofFromBlockState(s *state.BlockState) *BlockStateProof
func (*BlockStateProof) Encode ¶
func (s *BlockStateProof) Encode() []byte
type InterStateProof ¶
type InterStateProof struct { BlockNumber uint64 TransactionIdx uint64 GlobalStateRoot common.Hash BlockGasUsed uint256.Int BlockHashRoot common.Hash TransactionTireRoot common.Hash ReceiptTrieRoot common.Hash LogsBloom types.Bloom }
func InterStateProofFromInterState ¶
func InterStateProofFromInterState(s *state.InterState) *InterStateProof
func (*InterStateProof) Encode ¶
func (s *InterStateProof) Encode() []byte
type IntraStateProof ¶
type IntraStateProof struct { BlockNumber uint64 TransactionIdx uint64 Depth uint16 Gas uint64 Refund uint64 LastDepthHash common.Hash ContractAddress common.Address Caller common.Address Value uint256.Int CallFlag state.CallFlag Out uint64 OutSize uint64 Pc uint64 OpCode vm.OpCode CodeHash common.Hash StackHash common.Hash StackSize uint64 MemorySize uint64 MemoryRoot common.Hash InputDataSize uint64 InputDataRoot common.Hash ReturnDataSize uint64 ReturnDataRoot common.Hash CommittedGlobalStateRoot common.Hash GlobalStateRoot common.Hash SelfDestructAcc common.Hash LogAcc common.Hash BlockHashRoot common.Hash AccesslistRoot common.Hash }
func StateProofFromState ¶
func StateProofFromState(s *state.IntraState) *IntraStateProof
func (*IntraStateProof) Encode ¶
func (s *IntraStateProof) Encode() []byte
func (*IntraStateProof) Hash ¶
func (s *IntraStateProof) Hash() common.Hash
type LogProof ¶
func LogProofFromLogSeries ¶
type MemoryAppendProof ¶
func (*MemoryAppendProof) Encode ¶
func (m *MemoryAppendProof) Encode() []byte
type MemoryCombinedReadProof ¶
type MemoryCombinedReadProof struct { Cells []uint256.Int AppendCells []uint256.Int Proof []common.Hash }
func (*MemoryCombinedReadProof) Encode ¶
func (m *MemoryCombinedReadProof) Encode() []byte
type MemoryCombinedWriteProof ¶
type MemoryCombinedWriteProof struct { Cells []uint256.Int UpdatedCells []uint256.Int AppendCells []uint256.Int Proof []common.Hash }
func (*MemoryCombinedWriteProof) Encode ¶
func (m *MemoryCombinedWriteProof) Encode() []byte
type MemoryReadProof ¶
func (*MemoryReadProof) Encode ¶
func (m *MemoryReadProof) Encode() []byte
type MemoryWriteProof ¶
func (*MemoryWriteProof) Encode ¶
func (m *MemoryWriteProof) Encode() []byte
type OneStepProof ¶
type OneStepProof struct { VerifierType VerifierType Proofs []Proof TotalCodeSize uint64 // for statistics }
func EmptyProof ¶
func EmptyProof() *OneStepProof
func GetBlockFinalizationProof ¶
func GetBlockFinalizationProof(interState *state.InterState) (*OneStepProof, error)
Type 6 InterState -> BlockState: block finalization The verifier needs to first pack the block header and calculate the block hash; then, the verifier can simulate changing the block hash in the block hash tree using the plain Merkle tree proof.
func GetBlockInitiationProof ¶
func GetBlockInitiationProof(blockState *state.BlockState) (*OneStepProof, error)
Type 1 BlockState -> InterState: block initiation A BlockStateProof suffices to prove this state transition.
The verifier can generate the first InterState by setting the transaction trie root and receipt trie root to the empty trie root, logs bloom to empty, and setting the block gas used to 0.
func GetIntraProof ¶
func GetIntraProof(ctx ProofGenContext, currState, nextState *state.IntraState, vmerr error) (*OneStepProof, error)
Type 4 IntraState -> IntraState: one-step EVM execution Type 5 IntraState -> InterState: transaction finalization
func GetTransactionInitaitionProof ¶
func GetTransactionInitaitionProof( chainConfig *params.ChainConfig, vmctx *vm.BlockContext, tx *types.Transaction, txctx *vm.Context, interState *state.InterState, statedb vm.StateDB, ) (*OneStepProof, error)
Type 2 InterState -> IntraState: transaction initiation Type 3 InterState -> InterState: EOA transfer transaction See go-ethereum/core/state_transition.go for the full state transition logic.
- Provide the inter state proof.
- Provide the MPT proof for the sender account. Verifier can perform nonce check and balance check through the MPT proof.
- Simulate the transaction initation including nonce increment, gas buying, and balance transfer. If error, stop. Note: sadly EVM does not expose methods for these so we have to implement them by ourselves.
- Provide the MPT proof for the recipient account, based on the simulated state. Verifier can construct the state trie root after transfer.
- If EOA transfer, also provde the MPT proof for both transaction trie, receipt trie, and account proof of coinbase so verifier can finalize the transaction.
func (*OneStepProof) AddProof ¶
func (p *OneStepProof) AddProof(proof Proof)
func (*OneStepProof) Encode ¶
func (p *OneStepProof) Encode() []byte
func (*OneStepProof) SetVerifierType ¶
func (p *OneStepProof) SetVerifierType(ty VerifierType)
type ProofGenContext ¶
type ProofGenContext struct {
// contains filtered or unexported fields
}
func NewProofGenContext ¶
func NewProofGenContext(rules params.Rules, coinbase common.Address, transaction *types.Transaction, receipt *types.Receipt, actualCode []byte) ProofGenContext
type ReceiptProof ¶
type ReceiptProof struct {
RLPEncodedReceipt []byte
}
func ReceiptProofFromReceipt ¶
func ReceiptProofFromReceipt(r *types.Receipt) *ReceiptProof
func (*ReceiptProof) Encode ¶
func (s *ReceiptProof) Encode() []byte
type SelfDestructSetProof ¶
func SelfDestructSetProofFromSelfDestructSet ¶
func SelfDestructSetProofFromSelfDestructSet(selfDestructSet *state.SelfDestructSet) *SelfDestructSetProof
func (*SelfDestructSetProof) Encode ¶
func (p *SelfDestructSetProof) Encode() []byte
type StackProof ¶
func (*StackProof) Encode ¶
func (s *StackProof) Encode() []byte
type VerifierType ¶
type VerifierType int
const ( VerifierTypeStackOp VerifierType = 0 VerifierTypeEnvironmentalOp VerifierType = 1 VerifierTypeMemoryOp VerifierType = 2 VerifierTypeStorageOp VerifierType = 3 VerifierTypeCallOp VerifierType = 4 VerifierTypeInvalidOp VerifierType = 5 VerifierTypeInterTx VerifierType = 6 VerifierTypeBlockInit VerifierType = 7 VerifierTypeBlockFinal VerifierType = 8 )