[#100] *: Use full scope in migration

As soon as migration required changes in memory, we
need bigger scope. Otherwise in requires two step migration
which is unpleasant and annoying.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-06-30 13:59:32 +03:00 committed by Alex Vanin
parent da56f4b53e
commit af21f33657
8 changed files with 13 additions and 9 deletions

View file

@ -82,7 +82,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("alphabet contract updated") runtime.Log("alphabet contract updated")
return true return true

View file

@ -2,6 +2,7 @@ package auditcontract
import ( import (
"github.com/nspcc-dev/neo-go/pkg/interop" "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/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/crypto" "github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/management"
@ -82,7 +83,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("audit contract updated") runtime.Log("audit contract updated")
return true return true

View file

@ -2,6 +2,7 @@ package balancecontract
import ( import (
"github.com/nspcc-dev/neo-go/pkg/interop" "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/iterator"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"github.com/nspcc-dev/neo-go/pkg/interop/native/std" "github.com/nspcc-dev/neo-go/pkg/interop/native/std"
@ -101,7 +102,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("balance contract updated") runtime.Log("balance contract updated")
return true return true

View file

@ -65,7 +65,7 @@ const (
publicKeySize = 33 publicKeySize = 33
maxBalanceAmount = 9000 // Max integer of Fixed12 in JSON bound (2**53-1) maxBalanceAmount = 9000 // Max integer of Fixed12 in JSON bound (2**53-1)
maxBalanceAmountGAS = maxBalanceAmount * 1_0000_0000 maxBalanceAmountGAS = maxBalanceAmount * 1_0000_0000
// hardcoded value to ignore deposit notification in onReceive // hardcoded value to ignore deposit notification in onReceive
@ -138,7 +138,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("neofs contract updated") runtime.Log("neofs contract updated")
return true return true

View file

@ -2,6 +2,7 @@ package neofsidcontract
import ( import (
"github.com/nspcc-dev/neo-go/pkg/interop" "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/crypto" "github.com/nspcc-dev/neo-go/pkg/interop/native/crypto"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"github.com/nspcc-dev/neo-go/pkg/interop/native/std" "github.com/nspcc-dev/neo-go/pkg/interop/native/std"
@ -67,7 +68,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("neofsid contract updated") runtime.Log("neofsid contract updated")
return true return true

View file

@ -120,7 +120,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("netmap contract updated") runtime.Log("netmap contract updated")
return true return true

View file

@ -58,7 +58,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("processing contract updated") runtime.Log("processing contract updated")
return true return true

View file

@ -2,6 +2,7 @@ package proxycontract
import ( import (
"github.com/nspcc-dev/neo-go/pkg/interop" "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/gas"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management" "github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"github.com/nspcc-dev/neo-go/pkg/interop/native/neo" "github.com/nspcc-dev/neo-go/pkg/interop/native/neo"
@ -56,7 +57,7 @@ func Migrate(script []byte, manifest []byte, data interface{}) bool {
return false return false
} }
management.UpdateWithData(script, manifest, data) contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("proxy contract updated") runtime.Log("proxy contract updated")
return true return true