api

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 9 Imported by: 0

README

API for cosmos-sdk-based chains

TODOs: after PoC

  • APIs to other module

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteTx

func ExecuteTx(
	vm VM,
	store KVStore,
	block *[]byte,
	tx *[]byte,
) (types.ExecutionResult, error)

ExecuteTx call ffi(`execute_tx`) to execute

func QueryTx added in v0.0.5

func QueryTx(
	vm VM,
	store KVStore,
	block *[]byte,
	tx *[]byte,
) (types.ExecutionResult, error)

func ReleaseVM

func ReleaseVM(vm VM)

ReleaseVM call ffi(`release_vm`) to release vm instance

Types

type DBState

type DBState struct {
	Store KVStore
	// CallID is used to lookup the proper frame for iterators associated with this contract call (iterator.go)
	CallID 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 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 VM

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

func InitVM

func InitVM(SPEC_ID uint8) VM

InitVM call ffi(`init_vm`) to initialize vm instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳