Update neo-go to v0.103.0 #752

Merged
fyrchik merged 6 commits from fyrchik/frostfs-node:update-neogo into master 2024-09-04 19:51:03 +00:00
2 changed files with 21 additions and 3 deletions
Showing only changes of commit cddc58ace2 - Show all commits

View file

@ -1,7 +1,6 @@
package innerring
import (
"bytes"
"fmt"
"sync"
"time"
@ -113,10 +112,9 @@ func (s *innerRingIndexer) AlphabetIndex() (int32, error) {
// index of the key.
func keyPosition(key *keys.PublicKey, list keys.PublicKeys) (result int32) {
result = -1
rawBytes := key.Bytes()
for i := range list {
if bytes.Equal(list[i].Bytes(), rawBytes) {
if key.Equal(list[i]) {
result = int32(i)
break
}

View file

@ -223,3 +223,23 @@ func (f *testIRFetcher) InnerRingKeys() (keys.PublicKeys, error) {
f.calls.Add(1)
return f.keys, f.err
}
func BenchmarkKeyPosition(b *testing.B) {
list := make(keys.PublicKeys, 7)
for i := range list {
p, err := keys.NewPrivateKey()
require.NoError(b, err)
list[i] = p.PublicKey()
}
key := new(keys.PublicKey)
require.NoError(b, key.DecodeBytes(list[5].Bytes()))
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
if keyPosition(key, list) != 5 {
b.FailNow()
}
}
}