[#118] *: Encode semver in version number

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-07-29 14:44:53 +03:00 committed by Alex Vanin
parent a10f470311
commit 8bd25230fa
11 changed files with 19 additions and 29 deletions

View file

@ -21,8 +21,6 @@ const (
nameKey = "name" nameKey = "name"
notaryDisabledKey = "notary" notaryDisabledKey = "notary"
version = 1
) )
// OnNEP17Payment is a callback for NEP-17 compatible native GAS and NEO // OnNEP17Payment is a callback for NEP-17 compatible native GAS and NEO
@ -270,5 +268,5 @@ func Name() string {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }

View file

@ -36,8 +36,6 @@ func (a auditHeader) ID() []byte {
} }
const ( const (
version = 1
netmapContractKey = "netmapScriptHash" netmapContractKey = "netmapScriptHash"
notaryDisabledKey = "notary" notaryDisabledKey = "notary"
@ -212,7 +210,7 @@ loop:
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
// readNext reads length from first byte and then reads data (max 127 bytes). // readNext reads length from first byte and then reads data (max 127 bytes).

View file

@ -38,7 +38,6 @@ const (
symbol = "NEOFS" symbol = "NEOFS"
decimals = 12 decimals = 12
circulation = "MainnetGAS" circulation = "MainnetGAS"
version = 1
netmapContractKey = "netmapScriptHash" netmapContractKey = "netmapScriptHash"
containerContractKey = "containerScriptHash" containerContractKey = "containerScriptHash"
@ -431,7 +430,7 @@ func Burn(from interop.Hash160, amount int, txDetails []byte) {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
// getSupply gets the token totalSupply value from VM storage. // getSupply gets the token totalSupply value from VM storage.

9
common/version.go Normal file
View file

@ -0,0 +1,9 @@
package common
const (
major = 0
minor = 10
patch = 1
Version = major*1_000_000 + minor*1_000 + patch
)

View file

@ -43,8 +43,6 @@ type (
) )
const ( const (
version = 1
neofsIDContractKey = "identityScriptHash" neofsIDContractKey = "identityScriptHash"
balanceContractKey = "balanceScriptHash" balanceContractKey = "balanceScriptHash"
netmapContractKey = "netmapScriptHash" netmapContractKey = "netmapScriptHash"
@ -556,7 +554,7 @@ func StopContainerEstimation(epoch int) {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
func addContainer(ctx storage.Context, id, owner []byte, container Container) { func addContainer(ctx storage.Context, id, owner []byte, container Container) {

View file

@ -24,8 +24,6 @@ const (
candidateFeeConfigKey = "InnerRingCandidateFee" candidateFeeConfigKey = "InnerRingCandidateFee"
withdrawFeeConfigKey = "WithdrawFee" withdrawFeeConfigKey = "WithdrawFee"
version = 3
alphabetKey = "alphabet" alphabetKey = "alphabet"
candidatesKey = "candidates" candidatesKey = "candidates"
notaryDisabledKey = "notary" notaryDisabledKey = "notary"
@ -560,7 +558,7 @@ func InitConfig(args [][]byte) {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
// getNodes returns deserialized slice of nodes from storage. // getNodes returns deserialized slice of nodes from storage.

View file

@ -18,8 +18,6 @@ type (
) )
const ( const (
version = 1
netmapContractKey = "netmapScriptHash" netmapContractKey = "netmapScriptHash"
containerContractKey = "containerScriptHash" containerContractKey = "containerScriptHash"
notaryDisabledKey = "notary" notaryDisabledKey = "notary"
@ -235,7 +233,7 @@ func Key(owner []byte) [][]byte {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
func getUserInfo(ctx storage.Context, key interface{}) UserInfo { func getUserInfo(ctx storage.Context, key interface{}) UserInfo {

View file

@ -32,8 +32,6 @@ type (
) )
const ( const (
version = 1
configuredKey = "initconfig" configuredKey = "initconfig"
notaryDisabledKey = "notary" notaryDisabledKey = "notary"
innerRingKey = "innerring" innerRingKey = "innerring"
@ -534,7 +532,7 @@ func ListConfig() []record {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
func addToNetmap(ctx storage.Context, n storageNode) { func addToNetmap(ctx storage.Context, n storageNode) {

View file

@ -11,8 +11,6 @@ import (
) )
const ( const (
version = 1
neofsContractKey = "neofsScriptHash" neofsContractKey = "neofsScriptHash"
multiaddrMethod = "alphabetAddress" multiaddrMethod = "alphabetAddress"
@ -79,5 +77,5 @@ func Verify() bool {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }

View file

@ -12,8 +12,6 @@ import (
) )
const ( const (
version = 1
netmapContractKey = "netmapScriptHash" netmapContractKey = "netmapScriptHash"
) )
@ -82,5 +80,5 @@ func Verify() bool {
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }

View file

@ -13,8 +13,6 @@ import (
const ( const (
notaryDisabledKey = "notary" notaryDisabledKey = "notary"
version = 1
) )
func _deploy(data interface{}, isUpdate bool) { func _deploy(data interface{}, isUpdate bool) {
@ -162,7 +160,7 @@ loop:
// Version returns version of the contract. // Version returns version of the contract.
func Version() int { func Version() int {
return version return common.Version
} }
func storageID(epoch int, peerID []byte) []byte { func storageID(epoch int, peerID []byte) []byte {