From bcf22c50a1fbe7ac46dc9fcef44c5c8ce5f6c5c0 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Mon, 19 Jun 2023 11:17:51 +0300 Subject: [PATCH] [#10] Use UpdateWithData call wrapper in Update methods Signed-off-by: Anton Nikiforov --- alphabet/alphabet_contract.go | 3 +-- audit/audit_contract.go | 4 +--- balance/balance_contract.go | 4 +--- container/container_contract.go | 3 +-- frostfs/frostfs_contract.go | 3 +-- frostfsid/frostfsid_contract.go | 4 +--- netmap/netmap_contract.go | 3 +-- nns/nns_contract.go | 3 +-- processing/processing_contract.go | 3 +-- proxy/proxy_contract.go | 4 +--- reputation/reputation_contract.go | 5 +---- 11 files changed, 11 insertions(+), 28 deletions(-) diff --git a/alphabet/alphabet_contract.go b/alphabet/alphabet_contract.go index 72aebe8..5a24a71 100644 --- a/alphabet/alphabet_contract.go +++ b/alphabet/alphabet_contract.go @@ -72,8 +72,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("alphabet contract updated") } diff --git a/audit/audit_contract.go b/audit/audit_contract.go index 638a76d..0dc8b2e 100644 --- a/audit/audit_contract.go +++ b/audit/audit_contract.go @@ -3,7 +3,6 @@ package audit import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/common" "github.com/nspcc-dev/neo-go/pkg/interop" - "github.com/nspcc-dev/neo-go/pkg/interop/contract" "github.com/nspcc-dev/neo-go/pkg/interop/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/native/crypto" "github.com/nspcc-dev/neo-go/pkg/interop/native/management" @@ -75,8 +74,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("audit contract updated") } diff --git a/balance/balance_contract.go b/balance/balance_contract.go index 3859c6e..39118e7 100644 --- a/balance/balance_contract.go +++ b/balance/balance_contract.go @@ -3,7 +3,6 @@ package balance import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/common" "github.com/nspcc-dev/neo-go/pkg/interop" - "github.com/nspcc-dev/neo-go/pkg/interop/contract" "github.com/nspcc-dev/neo-go/pkg/interop/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/std" @@ -93,8 +92,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("balance contract updated") } diff --git a/container/container_contract.go b/container/container_contract.go index 154c1f1..5cde579 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -171,8 +171,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("container contract updated") } diff --git a/frostfs/frostfs_contract.go b/frostfs/frostfs_contract.go index f902d30..468ee44 100644 --- a/frostfs/frostfs_contract.go +++ b/frostfs/frostfs_contract.go @@ -109,8 +109,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic(common.ErrAlphabetWitnessFailed) } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("frostfs contract updated") } diff --git a/frostfsid/frostfsid_contract.go b/frostfsid/frostfsid_contract.go index 58d6fbc..6119b06 100644 --- a/frostfsid/frostfsid_contract.go +++ b/frostfsid/frostfsid_contract.go @@ -3,7 +3,6 @@ package frostfsid import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/common" "github.com/nspcc-dev/neo-go/pkg/interop" - "github.com/nspcc-dev/neo-go/pkg/interop/contract" "github.com/nspcc-dev/neo-go/pkg/interop/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/runtime" @@ -62,8 +61,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("frostfsid contract updated") } diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index 150c461..34afdc6 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -127,8 +127,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("netmap contract updated") } diff --git a/nns/nns_contract.go b/nns/nns_contract.go index bf75fdf..8b739c3 100644 --- a/nns/nns_contract.go +++ b/nns/nns_contract.go @@ -82,8 +82,7 @@ func Update(nef []byte, manifest string, data interface{}) { // std and crypto contracts. This can be helpful on update // thus we provide `AllowCall` to management.Update. // management.Update(nef, []byte(manifest)) - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, nef, manifest, common.AppendVersion(data)) + management.UpdateWithData(nef, []byte(manifest), common.AppendVersion(data)) runtime.Log("nns contract updated") } diff --git a/processing/processing_contract.go b/processing/processing_contract.go index f96ffa6..d6a5afa 100644 --- a/processing/processing_contract.go +++ b/processing/processing_contract.go @@ -59,8 +59,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only side chain committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("processing contract updated") } diff --git a/proxy/proxy_contract.go b/proxy/proxy_contract.go index 3d22ad6..8556aff 100644 --- a/proxy/proxy_contract.go +++ b/proxy/proxy_contract.go @@ -3,7 +3,6 @@ package proxy import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/common" "github.com/nspcc-dev/neo-go/pkg/interop" - "github.com/nspcc-dev/neo-go/pkg/interop/contract" "github.com/nspcc-dev/neo-go/pkg/interop/native/gas" "github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/neo" @@ -35,8 +34,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("proxy contract updated") } diff --git a/reputation/reputation_contract.go b/reputation/reputation_contract.go index 2055204..8c9dc1f 100644 --- a/reputation/reputation_contract.go +++ b/reputation/reputation_contract.go @@ -2,8 +2,6 @@ package reputation import ( "git.frostfs.info/TrueCloudLab/frostfs-contract/common" - "github.com/nspcc-dev/neo-go/pkg/interop" - "github.com/nspcc-dev/neo-go/pkg/interop/contract" "github.com/nspcc-dev/neo-go/pkg/interop/convert" "github.com/nspcc-dev/neo-go/pkg/interop/iterator" "github.com/nspcc-dev/neo-go/pkg/interop/native/management" @@ -36,8 +34,7 @@ func Update(script []byte, manifest []byte, data interface{}) { panic("only committee can update contract") } - contract.Call(interop.Hash160(management.Hash), "update", - contract.All, script, manifest, common.AppendVersion(data)) + management.UpdateWithData(script, manifest, common.AppendVersion(data)) runtime.Log("reputation contract updated") }