forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.go
97 lines (86 loc) · 2.2 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package version
import (
"encoding/json"
"time"
_ "embed"
)
const (
Client = "avalanchego"
// RPCChainVMProtocol should be bumped anytime changes are made which
// require the plugin vm to upgrade to latest avalanchego release to be
// compatible.
RPCChainVMProtocol uint = 38
)
// These are globals that describe network upgrades and node versions
var (
Current = &Semantic{
Major: 1,
Minor: 12,
Patch: 0,
}
CurrentApp = &Application{
Name: Client,
Major: Current.Major,
Minor: Current.Minor,
Patch: Current.Patch,
}
MinimumCompatibleVersion = &Application{
Name: Client,
Major: 1,
Minor: 12,
Patch: 0,
}
PrevMinimumCompatibleVersion = &Application{
Name: Client,
Major: 1,
Minor: 11,
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,
}
//go:embed compatibility.json
rpcChainVMProtocolCompatibilityBytes []byte
// RPCChainVMProtocolCompatibility maps RPCChainVMProtocol versions to the
// set of avalanchego versions that supported that version. This is not used
// by avalanchego, but is useful for downstream libraries.
RPCChainVMProtocolCompatibility map[uint][]*Semantic
)
func init() {
var parsedRPCChainVMCompatibility map[uint][]string
err := json.Unmarshal(rpcChainVMProtocolCompatibilityBytes, &parsedRPCChainVMCompatibility)
if err != nil {
panic(err)
}
RPCChainVMProtocolCompatibility = make(map[uint][]*Semantic)
for rpcChainVMProtocol, versionStrings := range parsedRPCChainVMCompatibility {
versions := make([]*Semantic, len(versionStrings))
for i, versionString := range versionStrings {
version, err := Parse(versionString)
if err != nil {
panic(err)
}
versions[i] = version
}
RPCChainVMProtocolCompatibility[rpcChainVMProtocol] = versions
}
}
func GetCompatibility(minCompatibleTime time.Time) Compatibility {
return NewCompatibility(
CurrentApp,
MinimumCompatibleVersion,
minCompatibleTime,
PrevMinimumCompatibleVersion,
)
}