runtime

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// v0.9 test API wasm
	// This wasm is generated using https://github.com/ChainSafe/polkadot-spec.
	HOST_API_TEST_RUNTIME     = "hostapi_runtime"
	HOST_API_TEST_RUNTIME_FP  = "hostapi_runtime.compact.wasm"
	HOST_API_TEST_RUNTIME_URL = "https://github.com/ChainSafe/polkadot-spec/raw/master/test/" +
		"runtimes/hostapi/hostapi_runtime.compact.wasm"

	// v0.9.29 polkadot
	POLKADOT_RUNTIME_v0929     = "polkadot_runtime-v929"
	POLKADOT_RUNTIME_V0929_FP  = "polkadot_runtime-v929.compact.wasm"
	POLKADOT_RUNTIME_V0929_URL = "https://github.com/paritytech/polkadot/releases/download/v0.9.29/" +
		"polkadot_runtime-v9290.compact.compressed.wasm?raw=true"

	// v0.9.29 westend
	WESTEND_RUNTIME_v0929     = "westend_runtime-v929"
	WESTEND_RUNTIME_V0929_FP  = "westend_runtime-v929.compact.wasm"
	WESTEND_RUNTIME_V0929_URL = "https://github.com/paritytech/polkadot/releases/download/v0.9.29/" +
		"westend_runtime-v9290.compact.compressed.wasm?raw=true"

	// v0.9.12 westend used for zero-address bug test
	WESTEND_RUNTIME_v0912     = "westend_runtime-v9111"
	WESTEND_RUNTIME_V0912_FP  = "westend_runtime-v9111.compact.wasm"
	WESTEND_RUNTIME_V0912_URL = "https://github.com/paritytech/polkadot/releases/download/v0.9.11/" +
		"westend_runtime-v9111.compact.compressed.wasm?raw=true"
)
View Source
const (
	// CoreVersion is the runtime API call Core_version
	CoreVersion = "Core_version"
	// CoreInitializeBlock is the runtime API call Core_initialize_block
	CoreInitializeBlock = "Core_initialize_block"
	// CoreExecuteBlock is the runtime API call Core_execute_block
	CoreExecuteBlock = "Core_execute_block"
	// Metadata is the runtime API call Metadata_metadata
	Metadata = "Metadata_metadata"
	// TaggedTransactionQueueValidateTransaction is the runtime API call TaggedTransactionQueue_validate_transaction
	TaggedTransactionQueueValidateTransaction = "TaggedTransactionQueue_validate_transaction"
	// GrandpaAuthorities is the runtime API call GrandpaApi_grandpa_authorities
	GrandpaAuthorities = "GrandpaApi_grandpa_authorities"
	// BabeAPIGenerateKeyOwnershipProof is the runtime API call BabeApi_generate_key_ownership_proof
	BabeAPIGenerateKeyOwnershipProof = "BabeApi_generate_key_ownership_proof"
	// BabeAPISubmitReportEquivocationUnsignedExtrinsic is the runtime API call
	// BabeApi_submit_report_equivocation_unsigned_extrinsic
	BabeAPISubmitReportEquivocationUnsignedExtrinsic = "BabeApi_submit_report_equivocation_unsigned_extrinsic"
	// GrandpaSubmitReportEquivocation is the runtime API call GrandpaApi_submit_report_equivocation_unsigned_extrinsic
	GrandpaSubmitReportEquivocation = "GrandpaApi_submit_report_equivocation_unsigned_extrinsic"
	// GrandpaGenerateKeyOwnershipProof is the runtime API call GrandpaApi_generate_key_ownership_proof
	GrandpaGenerateKeyOwnershipProof = "GrandpaApi_generate_key_ownership_proof"
	// BabeAPIConfiguration is the runtime API call BabeApi_configuration
	BabeAPIConfiguration = "BabeApi_configuration"
	// BlockBuilderInherentExtrinsics is the runtime API call BlockBuilder_inherent_extrinsics
	BlockBuilderInherentExtrinsics = "BlockBuilder_inherent_extrinsics"
	// BlockBuilderApplyExtrinsic is the runtime API call BlockBuilder_apply_extrinsic
	BlockBuilderApplyExtrinsic = "BlockBuilder_apply_extrinsic"
	// BlockBuilderFinalizeBlock is the runtime API call BlockBuilder_finalize_block
	BlockBuilderFinalizeBlock = "BlockBuilder_finalize_block"
	// DecodeSessionKeys is the runtime API call SessionKeys_decode_session_keys
	DecodeSessionKeys = "SessionKeys_decode_session_keys"
	// TransactionPaymentAPIQueryInfo returns information of a given extrinsic
	TransactionPaymentAPIQueryInfo = "TransactionPaymentApi_query_info"
	// TransactionPaymentCallAPIQueryCallInfo returns call query call info
	TransactionPaymentCallAPIQueryCallInfo = "TransactionPaymentCallApi_query_call_info"
	// TransactionPaymentCallAPIQueryCallFeeDetails returns call query call fee details
	TransactionPaymentCallAPIQueryCallFeeDetails = "TransactionPaymentCallApi_query_call_fee_details"
)

Variables

View Source
var (
	ErrRuntimeUnknown  = errors.New("runtime is not known")
	ErrHTTPStatusNotOK = errors.New("HTTP status code received is not OK")
	ErrOpenRuntimeFile = errors.New("cannot open the runtime target file")
)
View Source
var (
	ErrDecodingVersionField = errors.New("decoding version field")
)
View Source
var (
	ErrGenesisTopNotFound = errors.New("genesis top not found")
)

Functions

func GetAbsolutePath

func GetAbsolutePath(targetDir string) string

GetAbsolutePath returns the completePath for a given targetDir

func GetRuntime added in v0.7.0

func GetRuntime(ctx context.Context, runtime string) (
	runtimePath string, err error)

GetRuntime returns the runtime file path located in the /tmp/gossamer/runtimes directory (depending on OS and environment). If the file did not exist, the runtime WASM blob is downloaded to that file. If the runtime argument is not defined in the constants.go and is a valid file path, the runtime argument is returned.

func InitializeRuntimeToTest added in v0.7.0

func InitializeRuntimeToTest(t *testing.T, instance Instance, parentHeader *types.Header) *types.Block

InitializeRuntimeToTest sets a new block using the runtime functions to set initial data into the host

func NewInMemoryDB added in v0.3.0

func NewInMemoryDB(t *testing.T) database.Database

NewInMemoryDB creates a new in-memory database

func NewTestExtrinsic added in v0.7.0

func NewTestExtrinsic(t *testing.T, rt MetadataVersioner, genHash, blockHash common.Hash,
	nonce uint64, keyRingPair signature.KeyringPair, call string, args ...interface{}) string

NewTestExtrinsic builds a new extrinsic using centrifuge pkg

func NewTrieFromGenesis added in v0.8.0

func NewTrieFromGenesis(gen genesis.Genesis) (tr trie.Trie, err error)

NewTrieFromGenesis creates a new trie from the raw genesis data

func UnmarshalTransactionValidity added in v0.7.0

func UnmarshalTransactionValidity(res []byte) (*transaction.Validity, error)

UnmarshalTransactionValidity takes the result of the validateTransaction runtime call and unmarshalls it TODO use custom result issue #2780

Types

type APIItem added in v0.3.0

type APIItem struct {
	Name [8]byte
	Ver  uint32
}

APIItem struct to hold runtime API Name and Version

type Allocator added in v0.8.0

type Allocator interface {
	Allocate(mem Memory, size uint32) (uint32, error)
	Deallocate(mem Memory, ptr uint32) error
}

type AncientBirthBlock added in v0.7.0

type AncientBirthBlock struct{}

AncientBirthBlock The transaction birth block is ancient

func (AncientBirthBlock) Error added in v0.7.0

func (AncientBirthBlock) Error() string

Error returns the error message associated with the AncientBirthBlock

func (AncientBirthBlock) String added in v0.8.0

func (a AncientBirthBlock) String() string

type BadMandatory added in v0.7.0

type BadMandatory struct{}

BadMandatory An extrinsic with a Mandatory dispatch resulted in Error

func (BadMandatory) Error added in v0.7.0

func (BadMandatory) Error() string

Error returns the error message associated with the BadMandatory

func (BadMandatory) String added in v0.8.0

func (b BadMandatory) String() string

type BadProof added in v0.7.0

type BadProof struct{}

BadProof General error to do with the transaction’s proofs (e.g. signature)

func (BadProof) Error added in v0.7.0

func (BadProof) Error() string

Error returns the error message associated with the BadProof

func (BadProof) String added in v0.8.0

func (b BadProof) String() string

type BadSigner added in v0.8.0

type BadSigner struct{}

BadSigner A transaction with a mandatory dispatch

func (BadSigner) Error added in v0.8.0

func (BadSigner) Error() string

Error returns the error message associated with the MandatoryDispatch

func (BadSigner) String added in v0.8.0

func (b BadSigner) String() string

type BasicNetwork added in v0.2.0

type BasicNetwork interface {
	NetworkState() common.NetworkState
}

BasicNetwork interface for functions used by runtime network state function

type BasicStorage added in v0.2.0

type BasicStorage interface {
	Put(key []byte, value []byte) error
	Get(key []byte) ([]byte, error)
	Del(key []byte) error
}

BasicStorage interface for functions used by runtime offchain workers

type Call added in v0.7.0

type Call struct{}

Call The call of the transaction is not expected

func (Call) Error added in v0.7.0

func (Call) Error() string

Error returns the error message associated with the Call

func (Call) String added in v0.8.0

func (c Call) String() string

type Context added in v0.2.0

type Context struct {
	Storage         Storage
	Allocator       Allocator
	Keystore        *keystore.GlobalKeystore
	Validator       bool
	NodeStorage     NodeStorage
	Network         BasicNetwork
	Transaction     TransactionState
	SigVerifier     *crypto.SignatureVerifier
	OffchainHTTPSet *offchain.HTTPSet
	Version         *Version
}

Context is the context for the wasm interpreter's imported functions

type ExhaustsResources added in v0.7.0

type ExhaustsResources struct{}

ExhaustsResources The transaction would exhaust the resources of current block

func (ExhaustsResources) Error added in v0.7.0

func (ExhaustsResources) Error() string

Error returns the error message associated with the ExhaustsResources

func (ExhaustsResources) String added in v0.8.0

func (e ExhaustsResources) String() string

type Future added in v0.7.0

type Future struct{}

Future General error to do with the transaction not yet being valid (e.g. nonce too high)

func (Future) Error added in v0.7.0

func (Future) Error() string

Error returns the error message associated with the Future

func (Future) String added in v0.8.0

func (f Future) String() string

type Instance added in v0.2.0

type Instance interface {
	Stop()
	NodeStorage() NodeStorage
	NetworkService() BasicNetwork
	Keystore() *keystore.GlobalKeystore
	Validator() bool
	Exec(function string, data []byte) ([]byte, error)
	SetContextStorage(s Storage)
	GetCodeHash() common.Hash
	Version() (Version, error)
	Metadata() (metadata []byte, err error)
	BabeConfiguration() (*types.BabeConfiguration, error)
	GrandpaAuthorities() ([]types.Authority, error)
	ValidateTransaction(e types.Extrinsic) (*transaction.Validity, error)
	InitializeBlock(header *types.Header) error
	InherentExtrinsics(data []byte) ([]byte, error)
	ApplyExtrinsic(data types.Extrinsic) ([]byte, error)
	FinalizeBlock() (*types.Header, error)
	ExecuteBlock(block *types.Block) ([]byte, error)
	DecodeSessionKeys(enc []byte) ([]byte, error)
	PaymentQueryInfo(ext []byte) (*types.RuntimeDispatchInfo, error)
	CheckInherents()
	BabeGenerateKeyOwnershipProof(slot uint64, authorityID [32]byte) (
		types.OpaqueKeyOwnershipProof, error)
	BabeSubmitReportEquivocationUnsignedExtrinsic(
		equivocationProof types.BabeEquivocationProof,
		keyOwnershipProof types.OpaqueKeyOwnershipProof,
	) error
	RandomSeed()
	OffchainWorker()
	GenerateSessionKeys()
	GrandpaGenerateKeyOwnershipProof(authSetID uint64, authorityID ed25519.PublicKeyBytes) (
		types.GrandpaOpaqueKeyOwnershipProof, error)
	GrandpaSubmitReportEquivocationUnsignedExtrinsic(
		equivocationProof types.GrandpaEquivocationProof, keyOwnershipProof types.GrandpaOpaqueKeyOwnershipProof,
	) error
}

Instance for runtime methods

type InvalidCustom added in v0.7.0

type InvalidCustom uint8

InvalidCustom Any other custom invalid validity that is not covered

func (InvalidCustom) Error added in v0.7.0

func (i InvalidCustom) Error() string

Error returns the error message associated with the InvalidCustom

func (InvalidCustom) String added in v0.8.0

func (i InvalidCustom) String() string

type InvalidTransaction added in v0.7.0

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

InvalidTransaction is a child VDT of TransactionValidityError

func NewInvalidTransaction added in v0.7.0

func NewInvalidTransaction() InvalidTransaction

NewInvalidTransaction is constructor for InvalidTransaction

func (InvalidTransaction) Error added in v0.7.0

func (i InvalidTransaction) Error() string

Error returns the error message associated with the InvalidTransaction

func (InvalidTransaction) IndexValue added in v0.9.0

func (it InvalidTransaction) IndexValue() (index uint, value any, err error)

func (*InvalidTransaction) SetValue added in v0.9.0

func (it *InvalidTransaction) SetValue(value any) (err error)

func (InvalidTransaction) Value added in v0.7.0

func (it InvalidTransaction) Value() (value any, err error)

func (InvalidTransaction) ValueAt added in v0.9.0

func (it InvalidTransaction) ValueAt(index uint) (value any, err error)

type InvalidTransactionValues added in v0.9.0

type MandatoryDispatch added in v0.7.0

type MandatoryDispatch struct{}

MandatoryDispatch A transaction with a mandatory dispatch

func (MandatoryDispatch) Error added in v0.7.0

func (MandatoryDispatch) Error() string

Error returns the error message associated with the MandatoryDispatch

func (MandatoryDispatch) String added in v0.8.0

func (m MandatoryDispatch) String() string

type Memory added in v0.2.0

type Memory interface {
	// Size returns the size in bytes available. e.g. If the underlying memory
	// has 1 page: 65536
	//
	// See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#-hrefsyntax-instr-memorymathsfmemorysize%E2%91%A0
	Size() uint32

	// Grow increases memory by the delta in pages (65536 bytes per page).
	// The return val is the previous memory size in pages, or false if the
	// delta was ignored as it exceeds MemoryDefinition.Max.
	//
	// # Notes
	//
	//   - This is the same as the "memory.grow" instruction defined in the
	//	  WebAssembly Core Specification, except returns false instead of -1.
	//   - When this returns true, any shared views via Read must be refreshed.
	//
	// See MemorySizer Read and https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#grow-mem
	Grow(deltaPages uint32) (previousPages uint32, ok bool)

	// ReadByte reads a single byte from the underlying buffer at the offset or returns false if out of range.
	ReadByte(offset uint32) (byte, bool) //nolint:govet

	// ReadUint64Le reads a uint64 in little-endian encoding from the underlying buffer at the offset or returns false
	// if out of range.
	ReadUint64Le(offset uint32) (uint64, bool)

	// WriteUint64Le writes the value in little-endian encoding to the underlying buffer at the offset in or returns
	// false if out of range.
	WriteUint64Le(offset uint32, v uint64) bool

	// Read reads byteCount bytes from the underlying buffer at the offset or
	// returns false if out of range.
	//
	// For example, to search for a NUL-terminated string:
	//	buf, _ = memory.Read(offset, byteCount)
	//	n := bytes.IndexByte(buf, 0)
	//	if n < 0 {
	//		// Not found!
	//	}
	//
	// Write-through
	//
	// This returns a view of the underlying memory, not a copy. This means any
	// writes to the slice returned are visible to Wasm, and any updates from
	// Wasm are visible reading the returned slice.
	//
	// For example:
	//	buf, _ = memory.Read(offset, byteCount)
	//	buf[1] = 'a' // writes through to memory, meaning Wasm code see 'a'.
	//
	// If you don't intend-write through, make a copy of the returned slice.
	//
	// When to refresh Read
	//
	// The returned slice disconnects on any capacity change. For example,
	// `buf = append(buf, 'a')` might result in a slice that is no longer
	// shared. The same exists Wasm side. For example, if Wasm changes its
	// memory capacity, ex via "memory.grow"), the host slice is no longer
	// shared. Those who need a stable view must set Wasm memory min=max, or
	// use wazero.RuntimeConfig WithMemoryCapacityPages to ensure max is always
	// allocated.
	Read(offset, byteCount uint32) ([]byte, bool)

	// WriteByte writes a single byte to the underlying buffer at the offset in or returns false if out of range.
	WriteByte(offset uint32, v byte) bool //nolint:govet

	// Write writes the slice to the underlying buffer at the offset or returns false if out of range.
	Write(offset uint32, v []byte) bool
}

Memory is the interface for WASM memory

type MetadataVersioner added in v0.8.0

type MetadataVersioner interface {
	Metadataer
	Versioner
}

MetadataVersioner is an interface for getting metadata and version from a runtime.

type Metadataer added in v0.8.0

type Metadataer interface {
	Metadata() (metadata []byte, err error)
}

Metadataer returns the metadata from the runtime.

type NoUnsignedValidator added in v0.7.0

type NoUnsignedValidator struct{}

NoUnsignedValidator No validator found for the given unsigned transaction

func (NoUnsignedValidator) Error added in v0.7.0

func (NoUnsignedValidator) Error() string

Error returns the error message associated with the NoUnsignedValidator

func (NoUnsignedValidator) String added in v0.8.0

func (n NoUnsignedValidator) String() string

type NodeStorage added in v0.2.0

type NodeStorage struct {
	LocalStorage      BasicStorage
	PersistentStorage BasicStorage
	BaseDB            BasicStorage
}

NodeStorage struct for storage of runtime offchain worker data

func (*NodeStorage) GetLocal added in v0.7.0

func (n *NodeStorage) GetLocal(k []byte) ([]byte, error)

GetLocal retrieve a key and value from LOCAL node storage

func (*NodeStorage) GetPersistent added in v0.7.0

func (n *NodeStorage) GetPersistent(k []byte) ([]byte, error)

GetPersistent retrieve a key and value from PERSISTENT node storage

func (*NodeStorage) SetLocal added in v0.7.0

func (n *NodeStorage) SetLocal(k, v []byte) error

SetLocal persists a key and value into LOCAL node storage

func (*NodeStorage) SetPersistent added in v0.7.0

func (n *NodeStorage) SetPersistent(k, v []byte) error

SetPersistent persists a key and value into PERSISTENT node storage

type NodeStorageType added in v0.2.0

type NodeStorageType byte

NodeStorageType type to identify offchain storage type

const NodeStorageTypeLocal NodeStorageType = 2

NodeStorageTypeLocal flog to identify offchain storage as local (memory)

const NodeStorageTypePersistent NodeStorageType = 1

NodeStorageTypePersistent flag to identify offchain storage as persistent (db)

type Payment added in v0.7.0

type Payment struct{}

Payment General error to do with the inability to pay some fees (e.g. account balance too low)

func (Payment) Error added in v0.7.0

func (Payment) Error() string

Error returns the error message associated with the Payment

func (Payment) String added in v0.8.0

func (p Payment) String() string

type Stale added in v0.7.0

type Stale struct{}

Stale General error to do with the transaction being outdated (e.g. nonce too low)

func (Stale) Error added in v0.7.0

func (Stale) Error() string

Error returns the error message associated with the Stale

func (Stale) String added in v0.8.0

func (s Stale) String() string

type Storage

type Storage interface {
	Put(key []byte, value []byte) (err error)
	Get(key []byte) []byte
	Root() (common.Hash, error)
	SetChild(keyToChild []byte, child *trie.Trie) error
	SetChildStorage(keyToChild, key, value []byte) error
	GetChildStorage(keyToChild, key []byte) ([]byte, error)
	Delete(key []byte) (err error)
	DeleteChild(keyToChild []byte) (err error)
	DeleteChildLimit(keyToChild []byte, limit *[]byte) (
		deleted uint32, allDeleted bool, err error)
	ClearChildStorage(keyToChild, key []byte) error
	NextKey([]byte) []byte
	ClearPrefixInChild(keyToChild, prefix []byte) error
	ClearPrefixInChildWithLimit(keyToChild, prefix []byte, limit uint32) (uint32, bool, error)
	GetChildNextKey(keyToChild, key []byte) ([]byte, error)
	GetChild(keyToChild []byte) (*trie.Trie, error)
	ClearPrefix(prefix []byte) (err error)
	ClearPrefixLimit(prefix []byte, limit uint32) (
		deleted uint32, allDeleted bool, err error)
	StartTransaction()
	CommitTransaction()
	RollbackTransaction()
	LoadCode() []byte
	SetVersion(v trie.TrieLayout)
}

Storage runtime interface.

type TestRuntimeNetwork added in v0.2.0

type TestRuntimeNetwork struct{}

TestRuntimeNetwork ...

func (*TestRuntimeNetwork) NetworkState added in v0.2.0

func (*TestRuntimeNetwork) NetworkState() common.NetworkState

NetworkState ...

type TransactionState added in v0.2.0

type TransactionState interface {
	AddToPool(vt *transaction.ValidTransaction) common.Hash
}

TransactionState interface for adding transactions to pool

type TransactionValidityError added in v0.7.0

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

TransactionValidityError Information on a transaction's validity and, if valid, on how it relates to other transactions. It is a result of the form: Result<transaction.Validity, TransactionValidityError>

func NewTransactionValidityError added in v0.7.0

func NewTransactionValidityError() *TransactionValidityError

NewTransactionValidityError is constructor for TransactionValidityError

func (TransactionValidityError) Error added in v0.7.0

func (tve TransactionValidityError) Error() string

Error will return the error underlying TransactionValidityError

func (TransactionValidityError) IndexValue added in v0.9.0

func (mvdt TransactionValidityError) IndexValue() (index uint, value any, err error)

func (*TransactionValidityError) SetValue added in v0.9.0

func (mvdt *TransactionValidityError) SetValue(value any) (err error)

func (TransactionValidityError) Value added in v0.7.0

func (mvdt TransactionValidityError) Value() (value any, err error)

func (TransactionValidityError) ValueAt added in v0.9.0

func (mvdt TransactionValidityError) ValueAt(index uint) (value any, err error)

type TransactionValidityErrorValues added in v0.9.0

type TransactionValidityErrorValues interface {
	InvalidTransaction | UnknownTransaction
}

type UnknownCustom added in v0.7.0

type UnknownCustom uint8

UnknownCustom Any other custom unknown validity that is not covered

func (UnknownCustom) Error added in v0.7.0

func (m UnknownCustom) Error() string

Error returns the error message associated with the UnknownCustom

type UnknownTransaction added in v0.7.0

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

UnknownTransaction is the child VDT of TransactionValidityError

func NewUnknownTransaction added in v0.7.0

func NewUnknownTransaction() UnknownTransaction

NewUnknownTransaction is constructor for UnknownTransaction

func (UnknownTransaction) Error added in v0.7.0

func (u UnknownTransaction) Error() string

func (UnknownTransaction) IndexValue added in v0.9.0

func (mvdt UnknownTransaction) IndexValue() (index uint, value any, err error)

func (*UnknownTransaction) SetValue added in v0.9.0

func (mvdt *UnknownTransaction) SetValue(value any) (err error)

func (UnknownTransaction) Value added in v0.7.0

func (mvdt UnknownTransaction) Value() (value any, err error)

func (UnknownTransaction) ValueAt added in v0.9.0

func (mvdt UnknownTransaction) ValueAt(index uint) (value any, err error)

type UnknownTransactionValues added in v0.9.0

type UnknownTransactionValues interface {
	ValidityCannotLookup | NoUnsignedValidator | UnknownCustom
}

type ValidityCannotLookup added in v0.7.0

type ValidityCannotLookup struct{}

ValidityCannotLookup Could not look up some information that is required to validate the transaction

func (ValidityCannotLookup) Error added in v0.7.0

func (ValidityCannotLookup) Error() string

Error returns the error message associated with the ValidityCannotLookup

func (ValidityCannotLookup) String added in v0.8.0

func (v ValidityCannotLookup) String() string

type Version

type Version struct {
	SpecName           []byte
	ImplName           []byte
	AuthoringVersion   uint32
	SpecVersion        uint32
	ImplVersion        uint32
	APIItems           []APIItem
	TransactionVersion uint32
	StateVersion       uint8
}

Version is the runtime version info.

func DecodeVersion added in v0.7.0

func DecodeVersion(encoded []byte) (version Version, err error)

DecodeVersion scale decodes the encoded version data. For older version data with missing fields (such as `transaction_version`) the missing field is set to its zero value (such as `0`).

func (Version) TaggedTransactionQueueVersion added in v0.7.0

func (v Version) TaggedTransactionQueueVersion() (txQueueVersion uint32, err error)

TaggedTransactionQueueVersion returns the TaggedTransactionQueue API version

type Versioner added in v0.8.0

type Versioner interface {
	Version() (Version, error)
}

Versioner returns the version from the runtime. This should return the cached version and be cheap to execute.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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