diff --git a/audit/audit_contract.go b/audit/audit_contract.go index 66f2064..ac9666c 100644 --- a/audit/audit_contract.go +++ b/audit/audit_contract.go @@ -95,13 +95,13 @@ func Get(id []byte) []byte { } func List() [][]byte { - it := storage.Find(ctx, []byte{}) + it := storage.Find(ctx, []byte{}, storage.KeysOnly) return list(it) } func ListByEpoch(epoch int) [][]byte { - it := storage.Find(ctx, epoch) + it := storage.Find(ctx, epoch, storage.KeysOnly) return list(it) } @@ -110,7 +110,7 @@ func ListByCID(epoch int, cid []byte) [][]byte { var buf interface{} = epoch prefix := append(buf.([]byte), cid...) - it := storage.Find(ctx, prefix) + it := storage.Find(ctx, prefix, storage.KeysOnly) return list(it) } @@ -122,7 +122,7 @@ func ListByNode(epoch int, cid []byte, key interop.PublicKey) [][]byte { from: key, } - it := storage.Find(ctx, hdr.ID()) + it := storage.Find(ctx, hdr.ID(), storage.KeysOnly) return list(it) } @@ -131,7 +131,7 @@ func list(it iterator.Iterator) [][]byte { var result [][]byte for iterator.Next(it) { - key := iterator.Key(it).([]byte) + key := iterator.Value(it).([]byte) // iterator MUST BE `storage.KeysOnly` if len(key) == netmapContractKeyLn { continue } diff --git a/balance/balance_contract.go b/balance/balance_contract.go index 15f3053..fcaa905 100644 --- a/balance/balance_contract.go +++ b/balance/balance_contract.go @@ -193,9 +193,9 @@ func NewEpoch(epochNum int) bool { n := common.Vote(ctx, epochID, irKey) if n >= threshold { common.RemoveVotes(ctx, epochID) - it := storage.Find(ctx, []byte{}) + it := storage.Find(ctx, []byte{}, storage.KeysOnly) for iterator.Next(it) { - addr := iterator.Key(it).([]byte) + addr := iterator.Value(it).([]byte) // it MUST BE `storage.KeysOnly` if len(addr) != 20 { continue } diff --git a/container/container_contract.go b/container/container_contract.go index 07e2669..e549840 100644 --- a/container/container_contract.go +++ b/container/container_contract.go @@ -322,12 +322,12 @@ func ListContainerSizes(epoch int) [][]byte { key := []byte(estimateKeyPrefix) key = append(key, buf.([]byte)...) - it := storage.Find(ctx, key) + it := storage.Find(ctx, key, storage.KeysOnly) var result [][]byte for iterator.Next(it) { - key := iterator.Key(it).([]byte) + key := iterator.Value(it).([]byte) // it MUST BE `storage.KeysOnly` result = append(result, key) } @@ -467,9 +467,9 @@ func remove(ctx storage.Context, key interface{}, value []byte) int { func getAllContainers(ctx storage.Context) [][]byte { var list [][]byte - it := storage.Find(ctx, []byte{}) + it := storage.Find(ctx, []byte{}, storage.KeysOnly) for iterator.Next(it) { - key := iterator.Key(it).([]byte) + key := iterator.Value(it).([]byte) // it MUST BE `storage.KeysOnly` if len(key) == containerIDSize { list = append(list, key) } @@ -577,9 +577,9 @@ func isStorageNode(key interop.PublicKey) bool { func keysToDelete(epoch int) [][]byte { results := [][]byte{} - it := storage.Find(ctx, []byte(estimateKeyPrefix)) + it := storage.Find(ctx, []byte(estimateKeyPrefix), storage.KeysOnly) for iterator.Next(it) { - k := iterator.Key(it).([]byte) + k := iterator.Value(it).([]byte) // it MUST BE `storage.KeysOnly` nbytes := k[len(estimateKeyPrefix) : len(k)-32] var n interface{} = nbytes diff --git a/neofs/neofs_contract.go b/neofs/neofs_contract.go index 4418a22..8f90ca8 100644 --- a/neofs/neofs_contract.go +++ b/neofs/neofs_contract.go @@ -477,10 +477,11 @@ func SetConfig(id, key, val []byte) bool { func ListConfig() []record { var config []record - it := storage.Find(ctx, configPrefix) + it := storage.Find(ctx, configPrefix, storage.None) for iterator.Next(it) { - key := iterator.Key(it).([]byte) - val := iterator.Value(it).([]byte) + pair := iterator.Value(it).([]interface{}) + key := pair[0].([]byte) + val := pair[1].([]byte) r := record{key: key[len(configPrefix):], val: val} config = append(config, r) diff --git a/netmap/netmap_contract.go b/netmap/netmap_contract.go index 65ac7af..21203f4 100644 --- a/netmap/netmap_contract.go +++ b/netmap/netmap_contract.go @@ -320,10 +320,11 @@ func InitConfig(args [][]byte) bool { func ListConfig() []record { var config []record - it := storage.Find(ctx, configPrefix) + it := storage.Find(ctx, configPrefix, storage.None) for iterator.Next(it) { - key := iterator.Key(it).([]byte) - val := iterator.Value(it).([]byte) + pair := iterator.Value(it).([]interface{}) + key := pair[0].([]byte) + val := pair[1].([]byte) r := record{key: key[len(configPrefix):], val: val} config = append(config, r)