Documentation
¶
Index ¶
Constants ¶
const ( Client = "luxd" // RPCChainVMProtocol is the node<->plugin (rpcchainvm) wire-protocol version // and the ONE canonical definition of it: github.com/luxfi/api/zap and the // github.com/luxfi/vm plugin server both read RPCChainVMProtocol from here. // (github.com/luxfi/node/version carries an independent copy of the same // value; that duplicate should be collapsed to re-export THIS constant — // node already requires github.com/luxfi/version and this module never // imports node, so there is no cycle — so a future bump can never land on // only one of the two. Both are 42 today, so no skew exists.) // // BUMP THIS on ANY change to a ZAP VM-wire struct (github.com/luxfi/api/zap // Encode/Decode: Initialize/SetState/Block/Quasar/...) that an existing peer // cannot decode without the new code — a field inserted mid-struct, a // reorder, a type change, or a removed field. APPENDING a new TRAILING field // is EXEMPT iff its Decode is length-tolerant (guarded on Reader.Remaining()); // that is the forward-safe evolution path and needs no bump. History: api // v1.0.16 appended InitializeResponse.Capabilities WITHOUT length-tolerance // AND without bumping this constant → stale plugins hit "unexpected EOF" // decoding Initialize (the v1.36.11 incident). InitializeResponse.Decode is // length-tolerant as of that fix, so 42 now safely spans both the pre- and // post-Capabilities wire. RPCChainVMProtocol uint = 42 // RPCDAGVMProtocol should be bumped anytime changes are made which // require the DAG plugin vm to upgrade to latest node release to be // compatible. RPCDAGVMProtocol uint = 1 )
Variables ¶
var ( VersionMajor = "" VersionMinor = "" VersionPatch = "" )
These variables are set at build time via ldflags from git tag:
go build -ldflags "-X github.com/luxfi/version.VersionMajor=1 \
-X github.com/luxfi/version.VersionMinor=22 \
-X github.com/luxfi/version.VersionPatch=19"
Build with scripts/build.sh to automatically inject version from git tags.
var ( Current *Semantic CurrentApp *Application MinimumCompatibleVersion = &Application{ Name: Client, Major: 1, Minor: 13, Patch: 0, } PrevMinimumCompatibleVersion = &Application{ Name: Client, Major: 1, Minor: 12, Patch: 0, } CurrentDatabase = DatabaseVersion1_4_5 PrevDatabase = DatabaseVersion1_0_0 DatabaseVersion1_4_5 = &Semantic{ Major: 1, Minor: 4, Patch: 5, } DatabaseVersion1_0_0 = &Semantic{ Major: 1, Minor: 0, Patch: 0, } // RPCChainVMProtocolCompatibility maps RPCChainVMProtocol versions to the // set of node versions that supported that version. This is not used // by node, but is useful for downstream libraries. RPCChainVMProtocolCompatibility map[uint][]*Semantic )
These are globals that describe network upgrades and node versions
var GitCommit string
GitCommit is set in the build script at compile time
var ( // V1_0_0 is a useful version to use in tests Semantic1_0_0 = &Semantic{ Major: 1, Minor: 0, Patch: 0, } )
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
Name string `json:"name" yaml:"name"`
Major int `json:"major" yaml:"major"`
Minor int `json:"minor" yaml:"minor"`
Patch int `json:"patch" yaml:"patch"`
// contains filtered or unexported fields
}
func (*Application) Before ¶
func (a *Application) Before(o *Application) bool
func (*Application) Compare ¶
func (a *Application) Compare(o *Application) int
Compare returns a positive number if s > o, 0 if s == o, or a negative number if s < o.
func (*Application) Compatible ¶
func (a *Application) Compatible(o *Application) error
func (*Application) String ¶
func (a *Application) String() string
The only difference here between Application and Semantic is that Application prepends the client name rather than "v".
type Compatibility ¶
type Compatibility interface {
// Returns the local version
Version() *Application
// Returns nil if the provided version is compatible with the local version.
// This means that the version is connectable and that consensus messages
// can be made to them.
Compatible(*Application) error
}
Compatibility a utility for checking the compatibility of peer versions
func GetCompatibility ¶
func GetCompatibility(minCompatibleTime time.Time) Compatibility
func NewCompatibility ¶
func NewCompatibility( version *Application, minCompatible *Application, minCompatibleTime time.Time, prevMinCompatible *Application, ) Compatibility
NewCompatibility returns a compatibility checker with the provided options
type Semantic ¶
type Semantic struct {
Major int `json:"major" yaml:"major"`
Minor int `json:"minor" yaml:"minor"`
Patch int `json:"patch" yaml:"patch"`
// contains filtered or unexported fields
}
type Versions ¶
type Versions struct {
Application string `json:"application"`
Database string `json:"database"`
RPCChainVM uint64 `json:"rpcchainvm"`
// Commit may be empty if GitCommit was not set at compile time
Commit string `json:"commit"`
Go string `json:"go"`
}
Versions contains the versions relevant to a build of node. In addition to supporting construction of the string displayed by --version, it is used to produce the output of --version-json and can be used to unmarshal that output.
func GetVersions ¶
func GetVersions() *Versions