version

package
v0.2103.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 8 Imported by: 21

Documentation

Overview

Package version implements Oasis protocol and runtime versioning.

For a more detailed explanation of Oasis Core's versioning, see: https://docs.oasis.dev/oasis-core/processes/versioning.

Index

Constants

View Source
const VersionUndefined = "undefined"

VersionUndefined represents an undefined version.

Variables

View Source
var (
	// SoftwareVersion represents the Oasis Core's version and should be set
	// by the linker.
	SoftwareVersion = "0.0-unset"

	// GitBranch is the name of the git branch of Oasis Core.
	//
	// This is mostly used for reporting and metrics.
	GitBranch = ""

	// ConsensusProtocol versions all data structures and processing used by
	// the epochtime, beacon, registry, roothash, etc. modules that are
	// backend by consensus.
	//
	// NOTE: Consensus protocol version compatibility is currently not directly
	// checked in Oasis Core.
	// It is converted to TendermintAppVersion whose compatibility is checked
	// via Tendermint's version checks.
	ConsensusProtocol = Version{Major: 4, Minor: 0, Patch: 0}

	// RuntimeHostProtocol versions the protocol between the Oasis node(s) and
	// the runtime.
	//
	// NOTE: This version must be synced with runtime/src/common/version.rs.
	RuntimeHostProtocol = Version{Major: 4, Minor: 0, Patch: 0}

	// RuntimeCommitteeProtocol versions the P2P protocol used by the runtime
	// committee members.
	RuntimeCommitteeProtocol = Version{Major: 3, Minor: 0, Patch: 0}

	// TendermintAppVersion is Tendermint ABCI application's version computed by
	// masking non-major consensus protocol version segments to 0 to be
	// compatible with Tendermint's version checks.
	//
	// NOTE: Tendermint's version checks compare the whole version uint64
	// directly. For example:
	// https://github.com/tendermint/tendermint/blob/1635d1339c73ae6a82e062cd2dc7191b029efa14/state/validation.go#L21-L22.
	TendermintAppVersion = ConsensusProtocol.MaskNonMajor().ToU64()

	// Toolchain is the version of the Go compiler/standard library.
	Toolchain = parseSemVerStr(strings.TrimPrefix(runtime.Version(), "go"))
)

Versions are current protocol versions.

Functions

func ConvertGoModulesVersion added in v0.2012.3

func ConvertGoModulesVersion(goModVersion string) string

Convert Go Modules compatible version to Oasis Core's canonical version.

Types

type ProtocolVersions added in v0.2100.0

type ProtocolVersions struct {
	ConsensusProtocol        Version `json:"consensus_protocol"`
	RuntimeHostProtocol      Version `json:"runtime_host_protocol"`
	RuntimeCommitteeProtocol Version `json:"runtime_committee_protocol"`
}

ProtocolVersions are the protocol versions.

func (*ProtocolVersions) Compatible added in v0.2100.0

func (pv *ProtocolVersions) Compatible(other ProtocolVersions) bool

Compatible returns if the two protocol versions are compatible.

func (ProtocolVersions) PrettyPrint added in v0.2100.0

func (pv ProtocolVersions) PrettyPrint(ctx context.Context, prefix string, w io.Writer)

PrettyPrint writes a pretty-printed representation of ProtocolVersions to the given writer.

func (ProtocolVersions) PrettyType added in v0.2100.0

func (pv ProtocolVersions) PrettyType() (interface{}, error)

PrettyType returns a representation of ProtocolVersions that can be used for pretty printing.

func (ProtocolVersions) String added in v0.2100.0

func (pv ProtocolVersions) String() string

String returns the protocol versions as a string.

func (*ProtocolVersions) ValidateBasic added in v0.2101.0

func (pv *ProtocolVersions) ValidateBasic() error

ValidateBasic does basic validation checks of the protocol versions.

type Version

type Version struct {
	Major uint16 `json:"major,omitempty"`
	Minor uint16 `json:"minor,omitempty"`
	Patch uint16 `json:"patch,omitempty"`
}

Version is a protocol version.

func FromU64

func FromU64(v uint64) Version

FromU64 returns the version from platform-dependent uint64.

func (Version) MaskNonMajor added in v0.2100.0

func (v Version) MaskNonMajor() Version

MaskNonMajor masks all non-major version segments to 0 and returns a new protocol version.

This is useful for comparing protocol versions for backward-incompatible changes.

func (Version) String

func (v Version) String() string

String returns the protocol version as a string.

func (Version) ToU64

func (v Version) ToU64() uint64

ToU64 returns the version as platform-dependent uint64.

func (Version) ValidateBasic added in v0.2101.0

func (v Version) ValidateBasic() error

ValidateBasic does basic validation of a protocol version.

Jump to

Keyboard shortcuts

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