[#50] Replace interface{}
with any
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
dacac0b53d
commit
d890a7eba4
25 changed files with 103 additions and 103 deletions
|
@ -22,18 +22,18 @@ const (
|
||||||
|
|
||||||
// OnNEP17Payment is a callback for NEP-17 compatible native GAS and NEO
|
// OnNEP17Payment is a callback for NEP-17 compatible native GAS and NEO
|
||||||
// contracts.
|
// contracts.
|
||||||
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
func OnNEP17Payment(from interop.Hash160, amount int, data any) {
|
||||||
caller := runtime.GetCallingScriptHash()
|
caller := runtime.GetCallingScriptHash()
|
||||||
if !common.BytesEqual(caller, []byte(gas.Hash)) && !common.BytesEqual(caller, []byte(neo.Hash)) {
|
if !common.BytesEqual(caller, []byte(gas.Hash)) && !common.BytesEqual(caller, []byte(neo.Hash)) {
|
||||||
common.AbortWithMessage("alphabet contract accepts GAS and NEO only")
|
common.AbortWithMessage("alphabet contract accepts GAS and NEO only")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ type (
|
||||||
const maxKeySize = 24 // 24 + 32 (container ID length) + 8 (epoch length) = 64
|
const maxKeySize = 24 // 24 + 32 (container ID length) + 8 (epoch length) = 64
|
||||||
|
|
||||||
func (a auditHeader) ID() []byte {
|
func (a auditHeader) ID() []byte {
|
||||||
var buf interface{} = a.epoch
|
var buf any = a.epoch
|
||||||
|
|
||||||
hashedKey := crypto.Sha256(a.from)
|
hashedKey := crypto.Sha256(a.from)
|
||||||
shortedKey := hashedKey[:maxKeySize]
|
shortedKey := hashedKey[:maxKeySize]
|
||||||
|
@ -39,11 +39,11 @@ const (
|
||||||
netmapContractKey = "netmapScriptHash"
|
netmapContractKey = "netmapScriptHash"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ func List() [][]byte {
|
||||||
// the specified epoch.
|
// the specified epoch.
|
||||||
func ListByEpoch(epoch int) [][]byte {
|
func ListByEpoch(epoch int) [][]byte {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
it := storage.Find(ctx, buf.([]byte), storage.KeysOnly)
|
it := storage.Find(ctx, buf.([]byte), storage.KeysOnly)
|
||||||
|
|
||||||
return list(it)
|
return list(it)
|
||||||
|
@ -136,7 +136,7 @@ func ListByEpoch(epoch int) [][]byte {
|
||||||
func ListByCID(epoch int, cid []byte) [][]byte {
|
func ListByCID(epoch int, cid []byte) [][]byte {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
|
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
|
|
||||||
prefix := append(buf.([]byte), cid...)
|
prefix := append(buf.([]byte), cid...)
|
||||||
it := storage.Find(ctx, prefix, storage.KeysOnly)
|
it := storage.Find(ctx, prefix, storage.KeysOnly)
|
||||||
|
@ -188,7 +188,7 @@ func Version() int {
|
||||||
|
|
||||||
// readNext reads the length from the first byte, and then reads data (max 127 bytes).
|
// readNext reads the length from the first byte, and then reads data (max 127 bytes).
|
||||||
func readNext(input []byte) ([]byte, int) {
|
func readNext(input []byte) ([]byte, int) {
|
||||||
var buf interface{} = input[0]
|
var buf any = input[0]
|
||||||
ln := buf.(int)
|
ln := buf.(int)
|
||||||
|
|
||||||
return input[1 : 1+ln], 1 + ln
|
return input[1 : 1+ln], 1 + ln
|
||||||
|
@ -199,7 +199,7 @@ func newAuditHeader(input []byte) auditHeader {
|
||||||
offset := int(input[1])
|
offset := int(input[1])
|
||||||
offset = 2 + offset + 1 // version prefix + version len + epoch prefix
|
offset = 2 + offset + 1 // version prefix + version len + epoch prefix
|
||||||
|
|
||||||
var buf interface{} = input[offset : offset+8] // [ 8 integer bytes ]
|
var buf any = input[offset : offset+8] // [ 8 integer bytes ]
|
||||||
epoch := buf.(int)
|
epoch := buf.(int)
|
||||||
|
|
||||||
offset = offset + 8
|
offset = offset + 8
|
||||||
|
|
|
@ -63,11 +63,11 @@ func init() {
|
||||||
token = createToken()
|
token = createToken()
|
||||||
}
|
}
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ func BalanceOf(account interop.Hash160) int {
|
||||||
//
|
//
|
||||||
// It produces Transfer and TransferX notifications. TransferX notification
|
// It produces Transfer and TransferX notifications. TransferX notification
|
||||||
// will have empty details field.
|
// will have empty details field.
|
||||||
func Transfer(from, to interop.Hash160, amount int, data interface{}) bool {
|
func Transfer(from, to interop.Hash160, amount int, data any) bool {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
return token.transfer(ctx, from, to, amount, false, nil)
|
return token.transfer(ctx, from, to, amount, false, nil)
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ func isUsableAddress(addr interop.Hash160) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAccount(ctx storage.Context, key interface{}) Account {
|
func getAccount(ctx storage.Context, key any) Account {
|
||||||
data := storage.Get(ctx, key)
|
data := storage.Get(ctx, key)
|
||||||
if data != nil {
|
if data != nil {
|
||||||
acc := std.Deserialize(data.([]byte)).(account)
|
acc := std.Deserialize(data.([]byte)).(account)
|
||||||
|
@ -382,7 +382,7 @@ func getAccount(ctx storage.Context, key interface{}) Account {
|
||||||
return Account{}
|
return Account{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func setAccount(ctx storage.Context, key interface{}, acc Account) {
|
func setAccount(ctx storage.Context, key any, acc Account) {
|
||||||
common.SetSerialized(ctx, key, account{
|
common.SetSerialized(ctx, key, account{
|
||||||
Balance: common.ToFixedWidth64(acc.Balance),
|
Balance: common.ToFixedWidth64(acc.Balance),
|
||||||
Until: common.ToFixedWidth64(acc.Until),
|
Until: common.ToFixedWidth64(acc.Until),
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetSerialized serializes data and puts it into contract storage.
|
// SetSerialized serializes data and puts it into contract storage.
|
||||||
func SetSerialized(ctx storage.Context, key interface{}, value interface{}) {
|
func SetSerialized(ctx storage.Context, key any, value interface{}) {
|
||||||
data := std.Serialize(value)
|
data := std.Serialize(value)
|
||||||
storage.Put(ctx, key, data)
|
storage.Put(ctx, key, data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ func LockTransferDetails(txDetails []byte) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnlockTransferDetails(epoch int) []byte {
|
func UnlockTransferDetails(epoch int) []byte {
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
return append(unlockPrefix, buf.([]byte)...)
|
return append(unlockPrefix, buf.([]byte)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ func CheckVersion(from int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendVersion appends current contract version to the list of deploy arguments.
|
// AppendVersion appends current contract version to the list of deploy arguments.
|
||||||
func AppendVersion(data interface{}) []interface{} {
|
func AppendVersion(data any) []interface{} {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return []interface{}{Version}
|
return []any{Version}
|
||||||
}
|
}
|
||||||
return append(data.([]interface{}), Version)
|
return append(data.([]any), Version)
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,14 +85,14 @@ const (
|
||||||
var eACLPrefix = []byte("eACL")
|
var eACLPrefix = []byte("eACL")
|
||||||
|
|
||||||
// OnNEP11Payment is needed for registration with contract as the owner to work.
|
// OnNEP11Payment is needed for registration with contract as the owner to work.
|
||||||
func OnNEP11Payment(a interop.Hash160, b int, c []byte, d interface{}) {
|
func OnNEP11Payment(a interop.Hash160, b int, c []byte, d any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
|
|
||||||
it := storage.Find(ctx, []byte{}, storage.None)
|
it := storage.Find(ctx, []byte{}, storage.None)
|
||||||
|
@ -160,7 +160,7 @@ func registerNiceNameTLD(addrNNS interop.Hash160, nnsRoot string) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// by committee only.
|
// by committee only.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ func Delete(containerID []byte, signature interop.Signature, publicKey interop.P
|
||||||
// and inability to delete a container. We should also check if we own the record in case.
|
// and inability to delete a container. We should also check if we own the record in case.
|
||||||
nnsContractAddr := storage.Get(ctx, nnsContractKey).(interop.Hash160)
|
nnsContractAddr := storage.Get(ctx, nnsContractKey).(interop.Hash160)
|
||||||
res := contract.Call(nnsContractAddr, "getRecords", contract.ReadStates|contract.AllowCall, domain, 16 /* TXT */)
|
res := contract.Call(nnsContractAddr, "getRecords", contract.ReadStates|contract.AllowCall, domain, 16 /* TXT */)
|
||||||
if res != nil && std.Base58Encode(containerID) == string(res.([]interface{})[0].(string)) {
|
if res != nil && std.Base58Encode(containerID) == string(res.([]any)[0].(string)) {
|
||||||
contract.Call(nnsContractAddr, "deleteRecords", contract.All, domain, 16 /* TXT */)
|
contract.Call(nnsContractAddr, "deleteRecords", contract.All, domain, 16 /* TXT */)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ func GetContainerSize(id []byte) containerSizes {
|
||||||
func ListContainerSizes(epoch int) [][]byte {
|
func ListContainerSizes(epoch int) [][]byte {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
|
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
|
|
||||||
key := []byte(estimateKeyPrefix)
|
key := []byte(estimateKeyPrefix)
|
||||||
key = append(key, buf.([]byte)...)
|
key = append(key, buf.([]byte)...)
|
||||||
|
@ -572,7 +572,7 @@ func ListContainerSizes(epoch int) [][]byte {
|
||||||
func IterateContainerSizes(epoch int) iterator.Iterator {
|
func IterateContainerSizes(epoch int) iterator.Iterator {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
|
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
|
|
||||||
key := []byte(estimateKeyPrefix)
|
key := []byte(estimateKeyPrefix)
|
||||||
key = append(key, buf.([]byte)...)
|
key = append(key, buf.([]byte)...)
|
||||||
|
@ -690,7 +690,7 @@ func ownerFromBinaryContainer(container []byte) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func estimationKey(epoch int, cid []byte, key interop.PublicKey) []byte {
|
func estimationKey(epoch int, cid []byte, key interop.PublicKey) []byte {
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
|
|
||||||
hash := crypto.Ripemd160(key)
|
hash := crypto.Ripemd160(key)
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ func cleanupContainers(ctx storage.Context, epoch int) {
|
||||||
// V2 format
|
// V2 format
|
||||||
nbytes := k[len(estimateKeyPrefix) : len(k)-containerIDSize-estimatePostfixSize]
|
nbytes := k[len(estimateKeyPrefix) : len(k)-containerIDSize-estimatePostfixSize]
|
||||||
|
|
||||||
var n interface{} = nbytes
|
var n any = nbytes
|
||||||
|
|
||||||
if epoch-n.(int) > TotalCleanupDelta {
|
if epoch-n.(int) > TotalCleanupDelta {
|
||||||
storage.Delete(ctx, k)
|
storage.Delete(ctx, k)
|
||||||
|
|
|
@ -41,11 +41,11 @@ const (
|
||||||
var configPrefix = []byte("config")
|
var configPrefix = []byte("config")
|
||||||
|
|
||||||
// _deploy sets up initial alphabet node keys.
|
// _deploy sets up initial alphabet node keys.
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by sidechain committee.
|
// only by sidechain committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
blockHeight := ledger.CurrentIndex()
|
blockHeight := ledger.CurrentIndex()
|
||||||
alphabetKeys := roles.GetDesignatedByRole(roles.NeoFSAlphabet, uint32(blockHeight+1))
|
alphabetKeys := roles.GetDesignatedByRole(roles.NeoFSAlphabet, uint32(blockHeight+1))
|
||||||
alphabetCommittee := common.Multiaddress(alphabetKeys, true)
|
alphabetCommittee := common.Multiaddress(alphabetKeys, true)
|
||||||
|
@ -183,7 +183,7 @@ func InnerRingCandidateAdd(key interop.PublicKey) {
|
||||||
// It takes no more than 9000.0 GAS. Native GAS has precision 8, and
|
// It takes no more than 9000.0 GAS. Native GAS has precision 8, and
|
||||||
// FrostFS balance contract has precision 12. Values bigger than 9000.0 can
|
// FrostFS balance contract has precision 12. Values bigger than 9000.0 can
|
||||||
// break JSON limits for integers when precision is converted.
|
// break JSON limits for integers when precision is converted.
|
||||||
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
func OnNEP17Payment(from interop.Hash160, amount int, data any) {
|
||||||
rcv := data.(interop.Hash160)
|
rcv := data.(interop.Hash160)
|
||||||
if common.BytesEqual(rcv, []byte(ignoreDepositNotification)) {
|
if common.BytesEqual(rcv, []byte(ignoreDepositNotification)) {
|
||||||
return
|
return
|
||||||
|
@ -314,7 +314,7 @@ func Unbind(user []byte, keys []interop.PublicKey) {
|
||||||
|
|
||||||
// Config returns configuration value of FrostFS configuration. If the key does
|
// Config returns configuration value of FrostFS configuration. If the key does
|
||||||
// not exists, returns nil.
|
// not exists, returns nil.
|
||||||
func Config(key []byte) interface{} {
|
func Config(key []byte) any {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
return getConfig(ctx, key)
|
return getConfig(ctx, key)
|
||||||
}
|
}
|
||||||
|
@ -369,7 +369,7 @@ func getAlphabetNodes(ctx storage.Context) []interop.PublicKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
// getConfig returns the installed frostfs configuration value or nil if it is not set.
|
// getConfig returns the installed frostfs configuration value or nil if it is not set.
|
||||||
func getConfig(ctx storage.Context, key interface{}) interface{} {
|
func getConfig(ctx storage.Context, key any) interface{} {
|
||||||
postfix := key.([]byte)
|
postfix := key.([]byte)
|
||||||
storageKey := append(configPrefix, postfix...)
|
storageKey := append(configPrefix, postfix...)
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ func getConfig(ctx storage.Context, key interface{}) interface{} {
|
||||||
}
|
}
|
||||||
|
|
||||||
// setConfig sets a frostfs configuration value in the contract storage.
|
// setConfig sets a frostfs configuration value in the contract storage.
|
||||||
func setConfig(ctx storage.Context, key, val interface{}) {
|
func setConfig(ctx storage.Context, key, val any) {
|
||||||
postfix := key.([]byte)
|
postfix := key.([]byte)
|
||||||
storageKey := append(configPrefix, postfix...)
|
storageKey := append(configPrefix, postfix...)
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@ const (
|
||||||
ownerKeysPrefix = 'o'
|
ownerKeysPrefix = 'o'
|
||||||
)
|
)
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ func Version() int {
|
||||||
return common.Version
|
return common.Version
|
||||||
}
|
}
|
||||||
|
|
||||||
func getUserInfo(ctx storage.Context, key interface{}) UserInfo {
|
func getUserInfo(ctx storage.Context, key any) UserInfo {
|
||||||
it := storage.Find(ctx, key, storage.KeysOnly|storage.RemovePrefix)
|
it := storage.Find(ctx, key, storage.KeysOnly|storage.RemovePrefix)
|
||||||
pubs := [][]byte{}
|
pubs := [][]byte{}
|
||||||
for iterator.Next(it) {
|
for iterator.Next(it) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// _deploy function sets up initial list of inner ring public keys.
|
// _deploy function sets up initial list of inner ring public keys.
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
ctx := storage.GetContext()
|
ctx := storage.GetContext()
|
||||||
|
|
||||||
args := data.(struct {
|
args := data.(struct {
|
||||||
|
@ -117,7 +117,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ func SnapshotByEpoch(epoch int) []Node {
|
||||||
|
|
||||||
// Config returns configuration value of FrostFS configuration. If key does
|
// Config returns configuration value of FrostFS configuration. If key does
|
||||||
// not exists, returns nil.
|
// not exists, returns nil.
|
||||||
func Config(key []byte) interface{} {
|
func Config(key []byte) any {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
return getConfig(ctx, key)
|
return getConfig(ctx, key)
|
||||||
}
|
}
|
||||||
|
@ -538,14 +538,14 @@ func getSnapshot(ctx storage.Context, key string) []Node {
|
||||||
return []Node{}
|
return []Node{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getConfig(ctx storage.Context, key interface{}) interface{} {
|
func getConfig(ctx storage.Context, key any) interface{} {
|
||||||
postfix := key.([]byte)
|
postfix := key.([]byte)
|
||||||
storageKey := append(configPrefix, postfix...)
|
storageKey := append(configPrefix, postfix...)
|
||||||
|
|
||||||
return storage.Get(ctx, storageKey)
|
return storage.Get(ctx, storageKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setConfig(ctx storage.Context, key, val interface{}) {
|
func setConfig(ctx storage.Context, key, val any) {
|
||||||
postfix := key.([]byte)
|
postfix := key.([]byte)
|
||||||
storageKey := append(configPrefix, postfix...)
|
storageKey := append(configPrefix, postfix...)
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ type RecordState struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates NameService contract.
|
// Update updates NameService contract.
|
||||||
func Update(nef []byte, manifest string, data interface{}) {
|
func Update(nef []byte, manifest string, data any) {
|
||||||
checkCommittee()
|
checkCommittee()
|
||||||
// Calculating keys and serializing requires calling
|
// Calculating keys and serializing requires calling
|
||||||
// std and crypto contracts. This can be helpful on update
|
// std and crypto contracts. This can be helpful on update
|
||||||
|
@ -87,9 +87,9 @@ func Update(nef []byte, manifest string, data interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// _deploy initializes defaults (total supply and registration price) on contract deploy.
|
// _deploy initializes defaults (total supply and registration price) on contract deploy.
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -128,10 +128,10 @@ func OwnerOf(tokenID []byte) interop.Hash160 {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Properties returns a domain name and an expiration date of the specified domain.
|
// Properties returns a domain name and an expiration date of the specified domain.
|
||||||
func Properties(tokenID []byte) map[string]interface{} {
|
func Properties(tokenID []byte) map[string]any {
|
||||||
ctx := storage.GetReadOnlyContext()
|
ctx := storage.GetReadOnlyContext()
|
||||||
ns := getNameState(ctx, tokenID)
|
ns := getNameState(ctx, tokenID)
|
||||||
return map[string]interface{}{
|
return map[string]any{
|
||||||
"name": ns.Name,
|
"name": ns.Name,
|
||||||
"expiration": ns.Expiration,
|
"expiration": ns.Expiration,
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ func TokensOf(owner interop.Hash160) iterator.Iterator {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transfer transfers the domain with the specified name to a new owner.
|
// Transfer transfers the domain with the specified name to a new owner.
|
||||||
func Transfer(to interop.Hash160, tokenID []byte, data interface{}) bool {
|
func Transfer(to interop.Hash160, tokenID []byte, data any) bool {
|
||||||
if !isValid(to) {
|
if !isValid(to) {
|
||||||
panic(`invalid receiver`)
|
panic(`invalid receiver`)
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ func updateBalance(ctx storage.Context, tokenId []byte, acc interop.Hash160, dif
|
||||||
|
|
||||||
// postTransfer sends Transfer notification to the network and calls onNEP11Payment
|
// postTransfer sends Transfer notification to the network and calls onNEP11Payment
|
||||||
// method.
|
// method.
|
||||||
func postTransfer(from, to interop.Hash160, tokenID []byte, data interface{}) {
|
func postTransfer(from, to interop.Hash160, tokenID []byte, data any) {
|
||||||
runtime.Notify("Transfer", from, to, 1, tokenID)
|
runtime.Notify("Transfer", from, to, 1, tokenID)
|
||||||
if management.GetContract(to) != nil {
|
if management.GetContract(to) != nil {
|
||||||
contract.Call(to, "onNEP11Payment", contract.All, from, 1, tokenID, data)
|
contract.Call(to, "onNEP11Payment", contract.All, from, 1, tokenID, data)
|
||||||
|
|
|
@ -17,7 +17,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// _deploy function sets up initial list of inner ring public keys.
|
// _deploy function sets up initial list of inner ring public keys.
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func storageKey(prefix Kind, entityName, name string) []byte {
|
func storageKey(prefix Kind, entityName, name string) []byte {
|
||||||
|
|
|
@ -19,16 +19,16 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// OnNEP17Payment is a callback for NEP-17 compatible native GAS contract.
|
// OnNEP17Payment is a callback for NEP-17 compatible native GAS contract.
|
||||||
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
func OnNEP17Payment(from interop.Hash160, amount int, data any) {
|
||||||
caller := runtime.GetCallingScriptHash()
|
caller := runtime.GetCallingScriptHash()
|
||||||
if !common.BytesEqual(caller, []byte(gas.Hash)) {
|
if !common.BytesEqual(caller, []byte(gas.Hash)) {
|
||||||
common.AbortWithMessage("processing contract accepts GAS only")
|
common.AbortWithMessage("processing contract accepts GAS only")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by the sidechain committee.
|
// only by the sidechain committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
blockHeight := ledger.CurrentIndex()
|
blockHeight := ledger.CurrentIndex()
|
||||||
alphabetKeys := roles.GetDesignatedByRole(roles.NeoFSAlphabet, uint32(blockHeight+1))
|
alphabetKeys := roles.GetDesignatedByRole(roles.NeoFSAlphabet, uint32(blockHeight+1))
|
||||||
alphabetCommittee := common.Multiaddress(alphabetKeys, true)
|
alphabetCommittee := common.Multiaddress(alphabetKeys, true)
|
||||||
|
|
|
@ -10,16 +10,16 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// OnNEP17Payment is a callback for NEP-17 compatible native GAS contract.
|
// OnNEP17Payment is a callback for NEP-17 compatible native GAS contract.
|
||||||
func OnNEP17Payment(from interop.Hash160, amount int, data interface{}) {
|
func OnNEP17Payment(from interop.Hash160, amount int, data any) {
|
||||||
caller := runtime.GetCallingScriptHash()
|
caller := runtime.GetCallingScriptHash()
|
||||||
if !common.BytesEqual(caller, []byte(gas.Hash)) {
|
if !common.BytesEqual(caller, []byte(gas.Hash)) {
|
||||||
common.AbortWithMessage("proxy contract accepts GAS only")
|
common.AbortWithMessage("proxy contract accepts GAS only")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ const (
|
||||||
reputationCountPrefix = 'c'
|
reputationCountPrefix = 'c'
|
||||||
)
|
)
|
||||||
|
|
||||||
func _deploy(data interface{}, isUpdate bool) {
|
func _deploy(data any, isUpdate bool) {
|
||||||
if isUpdate {
|
if isUpdate {
|
||||||
args := data.([]interface{})
|
args := data.([]any)
|
||||||
common.CheckVersion(args[len(args)-1].(int))
|
common.CheckVersion(args[len(args)-1].(int))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ func _deploy(data interface{}, isUpdate bool) {
|
||||||
|
|
||||||
// Update method updates contract source code and manifest. It can be invoked
|
// Update method updates contract source code and manifest. It can be invoked
|
||||||
// only by committee.
|
// only by committee.
|
||||||
func Update(script []byte, manifest []byte, data interface{}) {
|
func Update(script []byte, manifest []byte, data any) {
|
||||||
if !common.HasUpdateAccess() {
|
if !common.HasUpdateAccess() {
|
||||||
panic("only committee can update contract")
|
panic("only committee can update contract")
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ func Version() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func storageID(epoch int, peerID []byte) []byte {
|
func storageID(epoch int, peerID []byte) []byte {
|
||||||
var buf interface{} = epoch
|
var buf any = epoch
|
||||||
|
|
||||||
return append(buf.([]byte), peerID...)
|
return append(buf.([]byte), peerID...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ const alphabetPath = "../alphabet"
|
||||||
func deployAlphabetContract(t *testing.T, e *neotest.Executor, addrNetmap, addrProxy util.Uint160, name string, index, total int64) util.Uint160 {
|
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"))
|
c := neotest.CompileFile(t, e.CommitteeHash, alphabetPath, path.Join(alphabetPath, "config.yml"))
|
||||||
|
|
||||||
args := make([]interface{}, 5)
|
args := make([]any, 5)
|
||||||
args[0] = addrNetmap
|
args[0] = addrNetmap
|
||||||
args[1] = addrProxy
|
args[1] = addrProxy
|
||||||
args[2] = name
|
args[2] = name
|
||||||
|
@ -87,8 +87,8 @@ func TestVote(t *testing.T) {
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
cNewAlphabet := c.WithSigners(newAlphabet)
|
cNewAlphabet := c.WithSigners(newAlphabet)
|
||||||
|
|
||||||
cNewAlphabet.InvokeFail(t, common.ErrAlphabetWitnessFailed, method, int64(0), []interface{}{newAlphabetPub})
|
cNewAlphabet.InvokeFail(t, common.ErrAlphabetWitnessFailed, method, int64(0), []any{newAlphabetPub})
|
||||||
c.InvokeFail(t, "invalid epoch", method, int64(1), []interface{}{newAlphabetPub})
|
c.InvokeFail(t, "invalid epoch", method, int64(1), []any{newAlphabetPub})
|
||||||
|
|
||||||
setAlphabetRole(t, e, newAlphabetPub)
|
setAlphabetRole(t, e, newAlphabetPub)
|
||||||
transferNeoToContract(t, c)
|
transferNeoToContract(t, c)
|
||||||
|
@ -108,7 +108,7 @@ func TestVote(t *testing.T) {
|
||||||
newInvoker := neoInvoker.WithSigners(newAlphabet)
|
newInvoker := neoInvoker.WithSigners(newAlphabet)
|
||||||
|
|
||||||
newInvoker.Invoke(t, stackitem.NewBool(true), "registerCandidate", newAlphabetPub)
|
newInvoker.Invoke(t, stackitem.NewBool(true), "registerCandidate", newAlphabetPub)
|
||||||
c.Invoke(t, stackitem.Null{}, method, int64(0), []interface{}{newAlphabetPub})
|
c.Invoke(t, stackitem.Null{}, method, int64(0), []any{newAlphabetPub})
|
||||||
|
|
||||||
// wait one block util
|
// wait one block util
|
||||||
// a new committee is accepted
|
// a new committee is accepted
|
||||||
|
@ -138,7 +138,7 @@ func setAlphabetRole(t *testing.T, e *neotest.Executor, new []byte) {
|
||||||
designInvoker := e.CommitteeInvoker(designSH)
|
designInvoker := e.CommitteeInvoker(designSH)
|
||||||
|
|
||||||
// set committee as NeoFSAlphabet
|
// set committee as NeoFSAlphabet
|
||||||
designInvoker.Invoke(t, stackitem.Null{}, "designateAsRole", int64(noderoles.NeoFSAlphabet), []interface{}{new})
|
designInvoker.Invoke(t, stackitem.Null{}, "designateAsRole", int64(noderoles.NeoFSAlphabet), []any{new})
|
||||||
}
|
}
|
||||||
|
|
||||||
func getAlphabetAcc(t *testing.T, e *neotest.Executor) *wallet.Account {
|
func getAlphabetAcc(t *testing.T, e *neotest.Executor) *wallet.Account {
|
||||||
|
|
|
@ -14,7 +14,7 @@ const balancePath = "../balance"
|
||||||
func deployBalanceContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 {
|
func deployBalanceContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 {
|
||||||
c := neotest.CompileFile(t, e.CommitteeHash, balancePath, path.Join(balancePath, "config.yml"))
|
c := neotest.CompileFile(t, e.CommitteeHash, balancePath, path.Join(balancePath, "config.yml"))
|
||||||
|
|
||||||
args := make([]interface{}, 3)
|
args := make([]any, 3)
|
||||||
args[0] = addrNetmap
|
args[0] = addrNetmap
|
||||||
args[1] = addrContainer
|
args[1] = addrContainer
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func deployContainerContract(t *testing.T, e *neotest.Executor, addrNetmap, addrBalance, addrNNS util.Uint160) util.Uint160 {
|
func deployContainerContract(t *testing.T, e *neotest.Executor, addrNetmap, addrBalance, addrNNS util.Uint160) util.Uint160 {
|
||||||
args := make([]interface{}, 5)
|
args := make([]any, 5)
|
||||||
args[0] = addrNetmap
|
args[0] = addrNetmap
|
||||||
args[1] = addrBalance
|
args[1] = addrBalance
|
||||||
args[2] = util.Uint160{} // not needed for now
|
args[2] = util.Uint160{} // not needed for now
|
||||||
|
@ -171,7 +171,7 @@ func TestContainerPut(t *testing.T) {
|
||||||
acc := c.NewAccount(t)
|
acc := c.NewAccount(t)
|
||||||
cnt := dummyContainer(acc)
|
cnt := dummyContainer(acc)
|
||||||
|
|
||||||
putArgs := []interface{}{cnt.value, cnt.sig, cnt.pub, cnt.token}
|
putArgs := []any{cnt.value, cnt.sig, cnt.pub, cnt.token}
|
||||||
c.InvokeFail(t, "insufficient balance to create container", "put", putArgs...)
|
c.InvokeFail(t, "insufficient balance to create container", "put", putArgs...)
|
||||||
|
|
||||||
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
||||||
|
@ -187,7 +187,7 @@ func TestContainerPut(t *testing.T) {
|
||||||
|
|
||||||
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
||||||
|
|
||||||
putArgs := []interface{}{cnt.value, cnt.sig, cnt.pub, cnt.token, "mycnt", ""}
|
putArgs := []any{cnt.value, cnt.sig, cnt.pub, cnt.token, "mycnt", ""}
|
||||||
t.Run("no fee for alias", func(t *testing.T) {
|
t.Run("no fee for alias", func(t *testing.T) {
|
||||||
c.InvokeFail(t, "insufficient balance to create container", "putNamed", putArgs...)
|
c.InvokeFail(t, "insufficient balance to create container", "putNamed", putArgs...)
|
||||||
})
|
})
|
||||||
|
@ -222,7 +222,7 @@ func TestContainerPut(t *testing.T) {
|
||||||
|
|
||||||
balanceMint(t, cBal, acc, (containerFee+containerAliasFee)*1, []byte{})
|
balanceMint(t, cBal, acc, (containerFee+containerAliasFee)*1, []byte{})
|
||||||
|
|
||||||
putArgs := []interface{}{cnt.value, cnt.sig, cnt.pub, cnt.token, "domain", "cdn"}
|
putArgs := []any{cnt.value, cnt.sig, cnt.pub, cnt.token, "domain", "cdn"}
|
||||||
c2 := c.WithSigners(c.Committee, acc)
|
c2 := c.WithSigners(c.Committee, acc)
|
||||||
c2.Invoke(t, stackitem.Null{}, "putNamed", putArgs...)
|
c2.Invoke(t, stackitem.Null{}, "putNamed", putArgs...)
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ func TestContainerPut(t *testing.T) {
|
||||||
acc := c.NewAccount(t)
|
acc := c.NewAccount(t)
|
||||||
balanceMint(t, cBal, acc, totalPrice*totalContainers, []byte{})
|
balanceMint(t, cBal, acc, totalPrice*totalContainers, []byte{})
|
||||||
cnt := dummyContainer(acc)
|
cnt := dummyContainer(acc)
|
||||||
putArgs := []interface{}{cnt.value, cnt.sig, cnt.pub, cnt.token, "precreated", ""}
|
putArgs := []any{cnt.value, cnt.sig, cnt.pub, cnt.token, "precreated", ""}
|
||||||
c.Invoke(t, stackitem.Null{}, "putNamed", putArgs...)
|
c.Invoke(t, stackitem.Null{}, "putNamed", putArgs...)
|
||||||
|
|
||||||
txs := make([]*transaction.Transaction, 0, containerPerBlock)
|
txs := make([]*transaction.Transaction, 0, containerPerBlock)
|
||||||
|
@ -313,7 +313,7 @@ func TestContainerDelete(t *testing.T) {
|
||||||
|
|
||||||
t.Run("gas costs are the same for different epochs", func(t *testing.T) {
|
t.Run("gas costs are the same for different epochs", func(t *testing.T) {
|
||||||
_, cnt2 := addContainer(t, c, cBal)
|
_, cnt2 := addContainer(t, c, cBal)
|
||||||
args := []interface{}{cnt2.id[:], cnt2.sig, cnt2.pub, cnt2.token}
|
args := []any{cnt2.id[:], cnt2.sig, cnt2.pub, cnt2.token}
|
||||||
|
|
||||||
tx := c.PrepareInvoke(t, "delete", args...)
|
tx := c.PrepareInvoke(t, "delete", args...)
|
||||||
for _, e := range []int{126, 127, 128, 129, 65536} {
|
for _, e := range []int{126, 127, 128, 129, 65536} {
|
||||||
|
@ -404,7 +404,7 @@ func TestContainerSetEACL(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
e := dummyEACL(cnt.id)
|
e := dummyEACL(cnt.id)
|
||||||
setArgs := []interface{}{e.value, e.sig, e.pub, e.token}
|
setArgs := []any{e.value, e.sig, e.pub, e.token}
|
||||||
cAcc := c.WithSigners(acc)
|
cAcc := c.WithSigners(acc)
|
||||||
cAcc.InvokeFail(t, common.ErrAlphabetWitnessFailed, "setEACL", setArgs...)
|
cAcc.InvokeFail(t, common.ErrAlphabetWitnessFailed, "setEACL", setArgs...)
|
||||||
|
|
||||||
|
|
|
@ -21,24 +21,24 @@ import (
|
||||||
const frostfsPath = "../frostfs"
|
const frostfsPath = "../frostfs"
|
||||||
|
|
||||||
func deployFrostFSContract(t *testing.T, e *neotest.Executor, addrProc util.Uint160,
|
func deployFrostFSContract(t *testing.T, e *neotest.Executor, addrProc util.Uint160,
|
||||||
pubs keys.PublicKeys, config ...interface{},
|
pubs keys.PublicKeys, config ...any,
|
||||||
) util.Uint160 {
|
) util.Uint160 {
|
||||||
args := make([]interface{}, 3)
|
args := make([]any, 3)
|
||||||
args[0] = addrProc
|
args[0] = addrProc
|
||||||
|
|
||||||
arr := make([]interface{}, len(pubs))
|
arr := make([]any, len(pubs))
|
||||||
for i := range pubs {
|
for i := range pubs {
|
||||||
arr[i] = pubs[i].Bytes()
|
arr[i] = pubs[i].Bytes()
|
||||||
}
|
}
|
||||||
args[1] = arr
|
args[1] = arr
|
||||||
args[2] = append([]interface{}{}, config...)
|
args[2] = append([]any{}, config...)
|
||||||
|
|
||||||
c := neotest.CompileFile(t, e.CommitteeHash, frostfsPath, path.Join(frostfsPath, "config.yml"))
|
c := neotest.CompileFile(t, e.CommitteeHash, frostfsPath, path.Join(frostfsPath, "config.yml"))
|
||||||
e.DeployContract(t, c, args)
|
e.DeployContract(t, c, args)
|
||||||
return c.Hash
|
return c.Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFrostFSInvoker(t *testing.T, n int, config ...interface{}) (*neotest.ContractInvoker, neotest.Signer, keys.PublicKeys) {
|
func newFrostFSInvoker(t *testing.T, n int, config ...any) (*neotest.ContractInvoker, neotest.Signer, keys.PublicKeys) {
|
||||||
e := newExecutor(t)
|
e := newExecutor(t)
|
||||||
|
|
||||||
accounts := make([]*wallet.Account, n)
|
accounts := make([]*wallet.Account, n)
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
const frostfsidPath = "../frostfsid"
|
const frostfsidPath = "../frostfsid"
|
||||||
|
|
||||||
func deployFrostFSIDContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 {
|
func deployFrostFSIDContract(t *testing.T, e *neotest.Executor, addrNetmap, addrContainer util.Uint160) util.Uint160 {
|
||||||
args := make([]interface{}, 2)
|
args := make([]any, 2)
|
||||||
args[0] = addrNetmap
|
args[0] = addrNetmap
|
||||||
args[1] = addrContainer
|
args[1] = addrContainer
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ func TestFrostFSID_AddKey(t *testing.T) {
|
||||||
acc := e.NewAccount(t)
|
acc := e.NewAccount(t)
|
||||||
owner := signerToOwner(acc)
|
owner := signerToOwner(acc)
|
||||||
e.Invoke(t, stackitem.Null{}, "addKey", owner,
|
e.Invoke(t, stackitem.Null{}, "addKey", owner,
|
||||||
[]interface{}{pubs[0], pubs[1]})
|
[]any{pubs[0], pubs[1]})
|
||||||
|
|
||||||
sort.Slice(pubs[:2], func(i, j int) bool {
|
sort.Slice(pubs[:2], func(i, j int) bool {
|
||||||
return bytes.Compare(pubs[i], pubs[j]) == -1
|
return bytes.Compare(pubs[i], pubs[j]) == -1
|
||||||
|
@ -68,8 +68,8 @@ func TestFrostFSID_AddKey(t *testing.T) {
|
||||||
e.Invoke(t, stackitem.NewArray(arr), "key", owner)
|
e.Invoke(t, stackitem.NewArray(arr), "key", owner)
|
||||||
|
|
||||||
t.Run("multiple addKey per block", func(t *testing.T) {
|
t.Run("multiple addKey per block", func(t *testing.T) {
|
||||||
tx1 := e.PrepareInvoke(t, "addKey", owner, []interface{}{pubs[2]})
|
tx1 := e.PrepareInvoke(t, "addKey", owner, []any{pubs[2]})
|
||||||
tx2 := e.PrepareInvoke(t, "addKey", owner, []interface{}{pubs[3], pubs[4]})
|
tx2 := e.PrepareInvoke(t, "addKey", owner, []any{pubs[3], pubs[4]})
|
||||||
e.AddNewBlock(t, tx1, tx2)
|
e.AddNewBlock(t, tx1, tx2)
|
||||||
e.CheckHalt(t, tx1.Hash(), stackitem.Null{})
|
e.CheckHalt(t, tx1.Hash(), stackitem.Null{})
|
||||||
e.CheckHalt(t, tx2.Hash(), stackitem.Null{})
|
e.CheckHalt(t, tx2.Hash(), stackitem.Null{})
|
||||||
|
@ -88,7 +88,7 @@ func TestFrostFSID_AddKey(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
e.Invoke(t, stackitem.Null{}, "removeKey", owner,
|
e.Invoke(t, stackitem.Null{}, "removeKey", owner,
|
||||||
[]interface{}{pubs[1], pubs[5]})
|
[]any{pubs[1], pubs[5]})
|
||||||
arr = []stackitem.Item{
|
arr = []stackitem.Item{
|
||||||
stackitem.NewBuffer(pubs[0]),
|
stackitem.NewBuffer(pubs[0]),
|
||||||
stackitem.NewBuffer(pubs[2]),
|
stackitem.NewBuffer(pubs[2]),
|
||||||
|
@ -98,8 +98,8 @@ func TestFrostFSID_AddKey(t *testing.T) {
|
||||||
e.Invoke(t, stackitem.NewArray(arr), "key", owner)
|
e.Invoke(t, stackitem.NewArray(arr), "key", owner)
|
||||||
|
|
||||||
t.Run("multiple removeKey per block", func(t *testing.T) {
|
t.Run("multiple removeKey per block", func(t *testing.T) {
|
||||||
tx1 := e.PrepareInvoke(t, "removeKey", owner, []interface{}{pubs[2]})
|
tx1 := e.PrepareInvoke(t, "removeKey", owner, []any{pubs[2]})
|
||||||
tx2 := e.PrepareInvoke(t, "removeKey", owner, []interface{}{pubs[0], pubs[4]})
|
tx2 := e.PrepareInvoke(t, "removeKey", owner, []any{pubs[0], pubs[4]})
|
||||||
e.AddNewBlock(t, tx1, tx2)
|
e.AddNewBlock(t, tx1, tx2)
|
||||||
e.CheckHalt(t, tx1.Hash(), stackitem.Null{})
|
e.CheckHalt(t, tx1.Hash(), stackitem.Null{})
|
||||||
e.CheckHalt(t, tx2.Hash(), stackitem.Null{})
|
e.CheckHalt(t, tx2.Hash(), stackitem.Null{})
|
||||||
|
|
|
@ -20,22 +20,22 @@ import (
|
||||||
|
|
||||||
const netmapPath = "../netmap"
|
const netmapPath = "../netmap"
|
||||||
|
|
||||||
func deployNetmapContract(t *testing.T, e *neotest.Executor, addrBalance, addrContainer util.Uint160, config ...interface{}) util.Uint160 {
|
func deployNetmapContract(t *testing.T, e *neotest.Executor, addrBalance, addrContainer util.Uint160, config ...any) util.Uint160 {
|
||||||
_, pubs, ok := vm.ParseMultiSigContract(e.Committee.Script())
|
_, pubs, ok := vm.ParseMultiSigContract(e.Committee.Script())
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
|
|
||||||
args := make([]interface{}, 4)
|
args := make([]any, 4)
|
||||||
args[0] = addrBalance
|
args[0] = addrBalance
|
||||||
args[1] = addrContainer
|
args[1] = addrContainer
|
||||||
args[2] = []interface{}{pubs[0]}
|
args[2] = []any{pubs[0]}
|
||||||
args[3] = append([]interface{}{}, config...)
|
args[3] = append([]any{}, config...)
|
||||||
|
|
||||||
c := neotest.CompileFile(t, e.CommitteeHash, netmapPath, path.Join(netmapPath, "config.yml"))
|
c := neotest.CompileFile(t, e.CommitteeHash, netmapPath, path.Join(netmapPath, "config.yml"))
|
||||||
e.DeployContract(t, c, args)
|
e.DeployContract(t, c, args)
|
||||||
return c.Hash
|
return c.Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
func newNetmapInvoker(t *testing.T, config ...interface{}) *neotest.ContractInvoker {
|
func newNetmapInvoker(t *testing.T, config ...any) *neotest.ContractInvoker {
|
||||||
e := newExecutor(t)
|
e := newExecutor(t)
|
||||||
|
|
||||||
ctrNNS := neotest.CompileFile(t, e.CommitteeHash, nnsPath, path.Join(nnsPath, "config.yml"))
|
ctrNNS := neotest.CompileFile(t, e.CommitteeHash, nnsPath, path.Join(nnsPath, "config.yml"))
|
||||||
|
|
|
@ -141,8 +141,8 @@ func TestTLDRecord(t *testing.T) {
|
||||||
func TestNNSRegisterMulti(t *testing.T) {
|
func TestNNSRegisterMulti(t *testing.T) {
|
||||||
c := newNNSInvoker(t, true)
|
c := newNNSInvoker(t, true)
|
||||||
|
|
||||||
newArgs := func(domain string, account neotest.Signer) []interface{} {
|
newArgs := func(domain string, account neotest.Signer) []any {
|
||||||
return []interface{}{
|
return []any{
|
||||||
domain, account.ScriptHash(), "doesnt@matter.com",
|
domain, account.ScriptHash(), "doesnt@matter.com",
|
||||||
int64(101), int64(102), int64(103), int64(104),
|
int64(101), int64(102), int64(103), int64(104),
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ const processingPath = "../processing"
|
||||||
func deployProcessingContract(t *testing.T, e *neotest.Executor, addrFrostFS util.Uint160) util.Uint160 {
|
func deployProcessingContract(t *testing.T, e *neotest.Executor, addrFrostFS util.Uint160) util.Uint160 {
|
||||||
c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml"))
|
c := neotest.CompileFile(t, e.CommitteeHash, processingPath, path.Join(processingPath, "config.yml"))
|
||||||
|
|
||||||
args := make([]interface{}, 1)
|
args := make([]any, 1)
|
||||||
args[0] = addrFrostFS
|
args[0] = addrFrostFS
|
||||||
|
|
||||||
e.DeployContract(t, c, args)
|
e.DeployContract(t, c, args)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
const proxyPath = "../proxy"
|
const proxyPath = "../proxy"
|
||||||
|
|
||||||
func deployProxyContract(t *testing.T, e *neotest.Executor, addrNetmap util.Uint160) util.Uint160 {
|
func deployProxyContract(t *testing.T, e *neotest.Executor, addrNetmap util.Uint160) util.Uint160 {
|
||||||
args := make([]interface{}, 1)
|
args := make([]any, 1)
|
||||||
args[0] = addrNetmap
|
args[0] = addrNetmap
|
||||||
|
|
||||||
c := neotest.CompileFile(t, e.CommitteeHash, proxyPath, path.Join(proxyPath, "config.yml"))
|
c := neotest.CompileFile(t, e.CommitteeHash, proxyPath, path.Join(proxyPath, "config.yml"))
|
||||||
|
|
|
@ -16,7 +16,7 @@ func deployReputationContract(t *testing.T, e *neotest.Executor) util.Uint160 {
|
||||||
c := neotest.CompileFile(t, e.CommitteeHash, reputationPath,
|
c := neotest.CompileFile(t, e.CommitteeHash, reputationPath,
|
||||||
path.Join(reputationPath, "config.yml"))
|
path.Join(reputationPath, "config.yml"))
|
||||||
|
|
||||||
e.DeployContract(t, c, []interface{}{})
|
e.DeployContract(t, c, []any{})
|
||||||
return c.Hash
|
return c.Hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue