[#50] Drop notaryless deploy parameter
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
09281e3ef3
commit
6e9c770142
16 changed files with 53 additions and 117 deletions
|
@ -18,8 +18,6 @@ const (
|
|||
indexKey = "index"
|
||||
totalKey = "threshold"
|
||||
nameKey = "name"
|
||||
|
||||
notaryDisabledKey = "notary"
|
||||
)
|
||||
|
||||
// OnNEP17Payment is a callback for NEP-17 compatible native GAS and NEO
|
||||
|
@ -34,8 +32,6 @@ func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
|||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
@ -43,8 +39,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrNetmap interop.Hash160
|
||||
addrProxy interop.Hash160
|
||||
name string
|
||||
|
|
|
@ -37,15 +37,11 @@ func (a auditHeader) ID() []byte {
|
|||
|
||||
const (
|
||||
netmapContractKey = "netmapScriptHash"
|
||||
|
||||
notaryDisabledKey = "notary"
|
||||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
@ -53,8 +49,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrNetmap interop.Hash160
|
||||
})
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ const (
|
|||
|
||||
netmapContractKey = "netmapScriptHash"
|
||||
containerContractKey = "containerScriptHash"
|
||||
notaryDisabledKey = "notary"
|
||||
)
|
||||
|
||||
var token Token
|
||||
|
@ -67,8 +66,6 @@ func init() {
|
|||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
@ -76,8 +73,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
// TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrNetmap interop.Hash160
|
||||
addrContainer interop.Hash160
|
||||
})
|
||||
|
|
|
@ -1,26 +1,11 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/util"
|
||||
)
|
||||
|
||||
const (
|
||||
panicMsgForNotaryDisabledEnv = "contract not applicable for notary-disabled environment"
|
||||
)
|
||||
|
||||
// BytesEqual compares two slices of bytes by wrapping them into strings,
|
||||
// which is necessary with new util.Equals interop behaviour, see neo-go#1176.
|
||||
func BytesEqual(a []byte, b []byte) bool {
|
||||
return util.Equals(string(a), string(b))
|
||||
}
|
||||
|
||||
// RmAndCheckNotaryDisabledKey remove notary disabled key from storage and
|
||||
// panic in notary disabled environment
|
||||
func RmAndCheckNotaryDisabledKey(data interface{}, key interface{}) {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled from args in future version
|
||||
storage.Delete(storage.GetContext(), key)
|
||||
if data.([]interface{})[0].(bool) {
|
||||
panic(panicMsgForNotaryDisabledEnv)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ const (
|
|||
nnsContractKey = "nnsScriptHash"
|
||||
nnsRootKey = "nnsRoot"
|
||||
nnsHasAliasKey = "nnsHasAlias"
|
||||
notaryDisabledKey = "notary"
|
||||
|
||||
// RegistrationFeeKey is a key in netmap config which contains fee for container registration.
|
||||
RegistrationFeeKey = "ContainerFee"
|
||||
|
@ -94,8 +93,6 @@ func OnNEP11Payment(a interop.Hash160, b int, c []byte, d interface{}) {
|
|||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
@ -123,8 +120,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrNetmap interop.Hash160
|
||||
addrBalance interop.Hash160
|
||||
addrID interop.Hash160
|
||||
|
|
|
@ -28,7 +28,6 @@ const (
|
|||
|
||||
alphabetKey = "alphabet"
|
||||
candidatesKey = "candidates"
|
||||
notaryDisabledKey = "notary"
|
||||
|
||||
processingContractKey = "processingScriptHash"
|
||||
|
||||
|
@ -47,8 +46,6 @@ var (
|
|||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
@ -56,8 +53,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrProc interop.Hash160
|
||||
keys []interop.PublicKey
|
||||
config [][]byte
|
||||
|
|
|
@ -22,15 +22,12 @@ const (
|
|||
const (
|
||||
netmapContractKey = "netmapScriptHash"
|
||||
containerContractKey = "containerScriptHash"
|
||||
notaryDisabledKey = "notary"
|
||||
ownerKeysPrefix = 'o'
|
||||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
@ -38,8 +35,6 @@ func _deploy(data interface{}, isUpdate bool) {
|
|||
}
|
||||
|
||||
args := data.(struct {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrNetmap interop.Hash160
|
||||
addrContainer interop.Hash160
|
||||
})
|
||||
|
|
|
@ -43,7 +43,6 @@ type Node struct {
|
|||
}
|
||||
|
||||
const (
|
||||
notaryDisabledKey = "notary"
|
||||
innerRingKey = "innerring"
|
||||
|
||||
// DefaultSnapshotCount contains the number of previous snapshots stored by this contract.
|
||||
|
@ -70,11 +69,7 @@ var (
|
|||
func _deploy(data interface{}, isUpdate bool) {
|
||||
ctx := storage.GetContext()
|
||||
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
var args = data.(struct {
|
||||
//TODO(@acid-ant): #9 remove notaryDisabled in future version
|
||||
notaryDisabled bool
|
||||
addrBalance interop.Hash160
|
||||
addrContainer interop.Hash160
|
||||
keys []interop.PublicKey
|
||||
|
|
|
@ -10,14 +10,11 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
notaryDisabledKey = "notary"
|
||||
reputationValuePrefix = 'r'
|
||||
reputationCountPrefix = 'c'
|
||||
)
|
||||
|
||||
func _deploy(data interface{}, isUpdate bool) {
|
||||
common.RmAndCheckNotaryDisabledKey(data, notaryDisabledKey)
|
||||
|
||||
if isUpdate {
|
||||
args := data.([]interface{})
|
||||
common.CheckVersion(args[len(args)-1].(int))
|
||||
|
|
|
@ -21,13 +21,12 @@ const alphabetPath = "../alphabet"
|
|||
func deployAlphabetContract(t *testing.T, e *neotest.Executor, addrNetmap, addrProxy util.Uint160, name string, index, total int64) util.Uint160 {
|
||||
c := neotest.CompileFile(t, e.CommitteeHash, alphabetPath, path.Join(alphabetPath, "config.yml"))
|
||||
|
||||
args := make([]interface{}, 6)
|
||||
args[0] = false
|
||||
args[1] = addrNetmap
|
||||
args[2] = addrProxy
|
||||
args[3] = name
|
||||
args[4] = index
|
||||
args[5] = total
|
||||
args := make([]interface{}, 5)
|
||||
args[0] = addrNetmap
|
||||
args[1] = addrProxy
|
||||
args[2] = name
|
||||
args[3] = index
|
||||
args[4] = total
|
||||
|
||||
e.DeployContract(t, c, args)
|
||||
return c.Hash
|
||||
|
|
|
@ -15,9 +15,8 @@ func deployBalanceContract(t *testing.T, e *neotest.Executor, addrNetmap, addrCo
|
|||
c := neotest.CompileFile(t, e.CommitteeHash, balancePath, path.Join(balancePath, "config.yml"))
|
||||
|
||||
args := make([]interface{}, 3)
|
||||
args[0] = false
|
||||
args[1] = addrNetmap
|
||||
args[2] = addrContainer
|
||||
args[0] = addrNetmap
|
||||
args[1] = addrContainer
|
||||
|
||||
e.DeployContract(t, c, args)
|
||||
return c.Hash
|
||||
|
|
|
@ -29,13 +29,12 @@ const (
|
|||
)
|
||||
|
||||
func deployContainerContract(t *testing.T, e *neotest.Executor, addrNetmap, addrBalance, addrNNS util.Uint160) util.Uint160 {
|
||||
args := make([]interface{}, 6)
|
||||
args[0] = int64(0)
|
||||
args[1] = addrNetmap
|
||||
args[2] = addrBalance
|
||||
args[3] = util.Uint160{} // not needed for now
|
||||
args[4] = addrNNS
|
||||
args[5] = "frostfs"
|
||||
args := make([]interface{}, 5)
|
||||
args[0] = addrNetmap
|
||||
args[1] = addrBalance
|
||||
args[2] = util.Uint160{} // not needed for now
|
||||
args[3] = addrNNS
|
||||
args[4] = "frostfs"
|
||||
|
||||
c := neotest.CompileFile(t, e.CommitteeHash, containerPath, path.Join(containerPath, "config.yml"))
|
||||
e.DeployContract(t, c, args)
|
||||
|
|
|
@ -22,16 +22,15 @@ const frostfsPath = "../frostfs"
|
|||
|
||||
func deployFrostFSContract(t *testing.T, e *neotest.Executor, addrProc util.Uint160,
|
||||
pubs keys.PublicKeys, config ...interface{}) util.Uint160 {
|
||||
args := make([]interface{}, 5)
|
||||
args[0] = false
|
||||
args[1] = addrProc
|
||||
args := make([]interface{}, 3)
|
||||
args[0] = addrProc
|
||||
|
||||
arr := make([]interface{}, len(pubs))
|
||||
for i := range pubs {
|
||||
arr[i] = pubs[i].Bytes()
|
||||
}
|
||||
args[2] = arr
|
||||
args[3] = append([]interface{}{}, config...)
|
||||
args[1] = arr
|
||||
args[2] = append([]interface{}{}, config...)
|
||||
|
||||
c := neotest.CompileFile(t, e.CommitteeHash, frostfsPath, path.Join(frostfsPath, "config.yml"))
|
||||
e.DeployContract(t, c, args)
|
||||
|
|
|
@ -17,10 +17,9 @@ import (
|
|||
const frostfsidPath = "../frostfsid"
|
||||
|
||||
func deployFrostFSIDContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 {
|
||||
args := make([]interface{}, 5)
|
||||
args[0] = false
|
||||
args[1] = addrNetmap
|
||||
args[2] = addrContainer
|
||||
args := make([]interface{}, 2)
|
||||
args[0] = addrNetmap
|
||||
args[1] = addrContainer
|
||||
|
||||
c := neotest.CompileFile(t, e.CommitteeHash, frostfsidPath, path.Join(frostfsidPath, "config.yml"))
|
||||
e.DeployContract(t, c, args)
|
||||
|
|
|
@ -24,12 +24,11 @@ func deployNetmapContract(t *testing.T, e *neotest.Executor, addrBalance, addrCo
|
|||
_, pubs, ok := vm.ParseMultiSigContract(e.Committee.Script())
|
||||
require.True(t, ok)
|
||||
|
||||
args := make([]interface{}, 5)
|
||||
args[0] = false
|
||||
args[1] = addrBalance
|
||||
args[2] = addrContainer
|
||||
args[3] = []interface{}{pubs[0]}
|
||||
args[4] = append([]interface{}{}, config...)
|
||||
args := make([]interface{}, 4)
|
||||
args[0] = addrBalance
|
||||
args[1] = addrContainer
|
||||
args[2] = []interface{}{pubs[0]}
|
||||
args[3] = append([]interface{}{}, config...)
|
||||
|
||||
c := neotest.CompileFile(t, e.CommitteeHash, netmapPath, path.Join(netmapPath, "config.yml"))
|
||||
e.DeployContract(t, c, args)
|
||||
|
|
|
@ -16,10 +16,7 @@ func deployReputationContract(t *testing.T, e *neotest.Executor) util.Uint160 {
|
|||
c := neotest.CompileFile(t, e.CommitteeHash, reputationPath,
|
||||
path.Join(reputationPath, "config.yml"))
|
||||
|
||||
args := make([]interface{}, 1)
|
||||
args[0] = false
|
||||
|
||||
e.DeployContract(t, c, args)
|
||||
e.DeployContract(t, c, []interface{}{})
|
||||
return c.Hash
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue