api

package
v1.4.1-patch.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: AGPL-3.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzeCode

func AnalyzeCode(
	cache Cache,
	codeHash []byte,
) (*v1types.AnalysisReport, error)

func Create

func Create(cache Cache, wasm []byte) ([]byte, error)

func CreateAttestationReport

func CreateAttestationReport(spid []byte, apiKey []byte) (bool, error)

CreateAttestationReport Send CreateAttestationReport request to enclave

func GetCode

func GetCode(cache Cache, code_id []byte) ([]byte, error)

func GetEncryptedSeed

func GetEncryptedSeed(cert []byte) ([]byte, error)

func Handle

func Handle(
	cache Cache,
	code_id []byte,
	params []byte,
	msg []byte,
	gasMeter *GasMeter,
	store KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
	sigInfo []byte,
	handleType types.HandleType,
) ([]byte, uint64, error)

func HealthCheck

func HealthCheck() ([]byte, error)

func InitBootstrap

func InitBootstrap(spid []byte, apiKey []byte) ([]byte, error)

func InitEnclaveRuntime

func InitEnclaveRuntime(moduleCacheSize uint8) error

func Instantiate

func Instantiate(
	cache Cache,
	code_id []byte,
	params []byte,
	msg []byte,
	gasMeter *GasMeter,
	store KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
	sigInfo []byte,
) ([]byte, uint64, error)

func KeyGen

func KeyGen() ([]byte, error)

KeyGen Send KeyGen request to enclave

func LoadSeedToEnclave

func LoadSeedToEnclave(masterCert []byte, seed []byte) (bool, error)

func Query

func Query(
	cache Cache,
	code_id []byte,
	params []byte,
	msg []byte,
	gasMeter *GasMeter,
	store KVStore,
	api *GoAPI,
	querier *Querier,
	gasLimit uint64,
) ([]byte, uint64, error)

func ReleaseCache

func ReleaseCache(cache Cache)

Types

type Cache

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

func InitCache

func InitCache(dataDir string, supportedFeatures string, cacheSize uint64) (Cache, error)

type CanonicalizeAddress

type CanonicalizeAddress func(string) ([]byte, uint64, error)

type DBState

type DBState struct {
	Store KVStore
	// IteratorStackID is used to lookup the proper stack frame for iterators associated with this DB (iterator.go)
	IteratorStackID uint64
}

type Gas

type Gas = uint64

type GasMeter

type GasMeter interface {
	GasConsumed() Gas
}

GasMeter is a copy of an interface declaration from cosmos-sdk https://github.com/cosmos/cosmos-sdk/blob/18890a225b46260a9adc587be6fa1cc2aff101cd/store/types/gas.go#L34

type GoAPI

type GoAPI struct {
	HumanAddress     HumanizeAddress
	CanonicalAddress CanonicalizeAddress
}

type HumanizeAddress

type HumanizeAddress func([]byte) (string, uint64, error)

type KVStore

type KVStore interface {
	Get(key []byte) []byte
	Set(key, value []byte)
	Delete(key []byte)

	// Iterator over a domain of keys in ascending order. End is exclusive.
	// Start must be less than end, or the Iterator is invalid.
	// Iterator must be closed by caller.
	// To iterate over entire domain, use store.Iterator(nil, nil)
	Iterator(start, end []byte) dbm.Iterator

	// Iterator over a domain of keys in descending order. End is exclusive.
	// Start must be less than end, or the Iterator is invalid.
	// Iterator must be closed by caller.
	ReverseIterator(start, end []byte) dbm.Iterator
}

KVStore copies a subset of types from cosmos-sdk We may wish to make this more generic sometime in the future, but not now https://github.com/cosmos/cosmos-sdk/blob/bef3689245bab591d7d169abd6bea52db97a70c7/store/types/store.go#L170

type Querier

type Querier = types.Querier

Jump to

Keyboard shortcuts

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