[#833] Upgrade Neo Go and NeoFS API Go libraries

Upgrade Neo Go lib to release v0.97.3.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-09-20 18:59:50 +03:00 committed by Alex Vanin
parent 96a65df32b
commit 3929f6b396
5 changed files with 12 additions and 22 deletions

8
go.mod
View file

@ -10,8 +10,8 @@ require (
github.com/mr-tron/base58 v1.2.0 github.com/mr-tron/base58 v1.2.0
github.com/multiformats/go-multiaddr v0.4.0 github.com/multiformats/go-multiaddr v0.4.0
github.com/nspcc-dev/hrw v1.0.9 github.com/nspcc-dev/hrw v1.0.9
github.com/nspcc-dev/neo-go v0.97.1 github.com/nspcc-dev/neo-go v0.97.3
github.com/nspcc-dev/neofs-api-go v1.29.1-0.20210929081312-010b1b011827 github.com/nspcc-dev/neofs-api-go v1.29.1-0.20210929152813-0117e90e9adb
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210520210714-9dee13f0d556
github.com/nspcc-dev/tzhash v1.4.0 github.com/nspcc-dev/tzhash v1.4.0
github.com/panjf2000/ants/v2 v2.4.0 github.com/panjf2000/ants/v2 v2.4.0
@ -24,11 +24,7 @@ require (
go.etcd.io/bbolt v1.3.6 go.etcd.io/bbolt v1.3.6
go.uber.org/atomic v1.9.0 go.uber.org/atomic v1.9.0
go.uber.org/zap v1.18.1 go.uber.org/zap v1.18.1
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b // indirect
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4 golang.org/x/term v0.0.0-20210429154555-c04ba851c2a4
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 // indirect
google.golang.org/grpc v1.41.0 google.golang.org/grpc v1.41.0
google.golang.org/protobuf v1.27.1 google.golang.org/protobuf v1.27.1
) )

BIN
go.sum

Binary file not shown.

View file

@ -8,7 +8,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/block" "github.com/nspcc-dev/neo-go/pkg/core/block"
"github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/state"
"github.com/nspcc-dev/neo-go/pkg/rpc/response" "github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/morph/client" "github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/subscriber" "github.com/nspcc-dev/neofs-node/pkg/morph/subscriber"
@ -189,7 +189,7 @@ func (l listener) listenLoop(ctx context.Context, chEvent <-chan *state.Notifica
var ( var (
blockChan <-chan *block.Block blockChan <-chan *block.Block
notaryChan <-chan *response.NotaryRequestEvent notaryChan <-chan *subscriptions.NotaryRequestEvent
err error err error
) )
@ -349,7 +349,7 @@ func (l listener) parseAndHandleNotification(notifyEvent *state.NotificationEven
} }
} }
func (l listener) parseAndHandleNotary(nr *response.NotaryRequestEvent) { func (l listener) parseAndHandleNotary(nr *subscriptions.NotaryRequestEvent) {
// prepare the notary event // prepare the notary event
notaryEvent, err := l.notaryEventsPreparator.Prepare(nr.NotaryRequest) notaryEvent, err := l.notaryEventsPreparator.Prepare(nr.NotaryRequest)
if err != nil { if err != nil {

View file

@ -1,7 +1,6 @@
package event package event
import ( import (
"encoding/binary"
"testing" "testing"
"github.com/nspcc-dev/neo-go/pkg/vm" "github.com/nspcc-dev/neo-go/pkg/vm"
@ -28,9 +27,6 @@ var (
dummyInvocationScript = append([]byte{byte(opcode.PUSHDATA1), 64}, make([]byte, 64)...) dummyInvocationScript = append([]byte{byte(opcode.PUSHDATA1), 64}, make([]byte, 64)...)
wrongDummyInvocationScript = append([]byte{byte(opcode.PUSHDATA1), 64, 1}, make([]byte, 63)...) wrongDummyInvocationScript = append([]byte{byte(opcode.PUSHDATA1), 64, 1}, make([]byte, 63)...)
contractSysCall = make([]byte, 4)
wrongContractSysCall = make([]byte, 4)
scriptHash util.Uint160 scriptHash util.Uint160
) )
@ -45,9 +41,6 @@ func init() {
wrongAlphaKeys = keys.PublicKeys{wrongPub} wrongAlphaKeys = keys.PublicKeys{wrongPub}
binary.LittleEndian.PutUint32(contractSysCall, interopnames.ToID([]byte(interopnames.SystemContractCall)))
binary.LittleEndian.PutUint32(wrongContractSysCall, interopnames.ToID([]byte(interopnames.SystemCallbackInvoke)))
scriptHash, _ = util.Uint160DecodeStringLE("21fce15191428e9c2f0e8d0329ff6d3dd14882de") scriptHash, _ = util.Uint160DecodeStringLE("21fce15191428e9c2f0e8d0329ff6d3dd14882de")
} }
@ -74,7 +67,7 @@ func TestPrepare_IncorrectScript(t *testing.T) {
emit.Int(bw.BinWriter, 4) emit.Int(bw.BinWriter, 4)
emit.String(bw.BinWriter, "test") emit.String(bw.BinWriter, "test")
emit.Bytes(bw.BinWriter, scriptHash.BytesBE()) emit.Bytes(bw.BinWriter, scriptHash.BytesBE())
emit.Syscall(bw.BinWriter, interopnames.SystemCallbackInvoke) emit.Syscall(bw.BinWriter, interopnames.SystemContractCallNative) // any != interopnames.SystemContractCall
nr := correctNR(bw.Bytes()) nr := correctNR(bw.Bytes())

View file

@ -11,6 +11,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/state"
"github.com/nspcc-dev/neo-go/pkg/rpc/client" "github.com/nspcc-dev/neo-go/pkg/rpc/client"
"github.com/nspcc-dev/neo-go/pkg/rpc/response" "github.com/nspcc-dev/neo-go/pkg/rpc/response"
"github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions"
"github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/util"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -21,7 +22,7 @@ type (
SubscribeForNotification(...util.Uint160) (<-chan *state.NotificationEvent, error) SubscribeForNotification(...util.Uint160) (<-chan *state.NotificationEvent, error)
UnsubscribeForNotification() UnsubscribeForNotification()
BlockNotifications() (<-chan *block.Block, error) BlockNotifications() (<-chan *block.Block, error)
SubscribeForNotaryRequests(mainTXSigner util.Uint160) (<-chan *response.NotaryRequestEvent, error) SubscribeForNotaryRequests(mainTXSigner util.Uint160) (<-chan *subscriptions.NotaryRequestEvent, error)
Close() Close()
} }
@ -35,7 +36,7 @@ type (
blockChan chan *block.Block blockChan chan *block.Block
notaryChan chan *response.NotaryRequestEvent notaryChan chan *subscriptions.NotaryRequestEvent
} }
// Params is a group of Subscriber constructor parameters. // Params is a group of Subscriber constructor parameters.
@ -116,7 +117,7 @@ func (s *subscriber) BlockNotifications() (<-chan *block.Block, error) {
return s.blockChan, nil return s.blockChan, nil
} }
func (s *subscriber) SubscribeForNotaryRequests(mainTXSigner util.Uint160) (<-chan *response.NotaryRequestEvent, error) { func (s *subscriber) SubscribeForNotaryRequests(mainTXSigner util.Uint160) (<-chan *subscriptions.NotaryRequestEvent, error) {
if _, err := s.client.SubscribeForNotaryRequests(nil, &mainTXSigner); err != nil { if _, err := s.client.SubscribeForNotaryRequests(nil, &mainTXSigner); err != nil {
return nil, fmt.Errorf("could not subscribe for notary request events: %w", err) return nil, fmt.Errorf("could not subscribe for notary request events: %w", err)
} }
@ -157,7 +158,7 @@ func (s *subscriber) routeNotifications(ctx context.Context) {
s.blockChan <- b s.blockChan <- b
case response.NotaryRequestEventID: case response.NotaryRequestEventID:
notaryRequest, ok := notification.Value.(*response.NotaryRequestEvent) notaryRequest, ok := notification.Value.(*subscriptions.NotaryRequestEvent)
if !ok { if !ok {
s.log.Error("can't cast notify event value to the notary request struct") s.log.Error("can't cast notify event value to the notary request struct")
continue continue
@ -209,7 +210,7 @@ func New(ctx context.Context, p *Params) (Subscriber, error) {
notifyChan: make(chan *state.NotificationEvent), notifyChan: make(chan *state.NotificationEvent),
notifyIDs: make(map[util.Uint160]string), notifyIDs: make(map[util.Uint160]string),
blockChan: make(chan *block.Block), blockChan: make(chan *block.Block),
notaryChan: make(chan *response.NotaryRequestEvent), notaryChan: make(chan *subscriptions.NotaryRequestEvent),
} }
// Worker listens all events from neo-go websocket and puts them // Worker listens all events from neo-go websocket and puts them