diff --git a/go.mod b/go.mod index 829137aa..322f96d8 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,8 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/multiformats/go-multiaddr v0.4.0 github.com/nspcc-dev/hrw v1.0.9 - github.com/nspcc-dev/neo-go v0.97.1 - github.com/nspcc-dev/neofs-api-go v1.29.1-0.20210929081312-010b1b011827 + github.com/nspcc-dev/neo-go v0.97.3 + 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/tzhash v1.4.0 github.com/panjf2000/ants/v2 v2.4.0 @@ -24,11 +24,7 @@ require ( go.etcd.io/bbolt v1.3.6 go.uber.org/atomic v1.9.0 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/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/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 9ef86245..3eab8681 100644 Binary files a/go.sum and b/go.sum differ diff --git a/pkg/morph/event/listener.go b/pkg/morph/event/listener.go index 9fd8a7a5..47a2297c 100644 --- a/pkg/morph/event/listener.go +++ b/pkg/morph/event/listener.go @@ -8,7 +8,7 @@ import ( "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/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/neofs-node/pkg/morph/client" "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 ( blockChan <-chan *block.Block - notaryChan <-chan *response.NotaryRequestEvent + notaryChan <-chan *subscriptions.NotaryRequestEvent 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 notaryEvent, err := l.notaryEventsPreparator.Prepare(nr.NotaryRequest) if err != nil { diff --git a/pkg/morph/event/notary_preparator_test.go b/pkg/morph/event/notary_preparator_test.go index 7ed3dc92..667f0b7c 100644 --- a/pkg/morph/event/notary_preparator_test.go +++ b/pkg/morph/event/notary_preparator_test.go @@ -1,7 +1,6 @@ package event import ( - "encoding/binary" "testing" "github.com/nspcc-dev/neo-go/pkg/vm" @@ -28,9 +27,6 @@ var ( dummyInvocationScript = append([]byte{byte(opcode.PUSHDATA1), 64}, make([]byte, 64)...) wrongDummyInvocationScript = append([]byte{byte(opcode.PUSHDATA1), 64, 1}, make([]byte, 63)...) - contractSysCall = make([]byte, 4) - wrongContractSysCall = make([]byte, 4) - scriptHash util.Uint160 ) @@ -45,9 +41,6 @@ func init() { 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") } @@ -74,7 +67,7 @@ func TestPrepare_IncorrectScript(t *testing.T) { emit.Int(bw.BinWriter, 4) emit.String(bw.BinWriter, "test") 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()) diff --git a/pkg/morph/subscriber/subscriber.go b/pkg/morph/subscriber/subscriber.go index e144b9e7..e475c74f 100644 --- a/pkg/morph/subscriber/subscriber.go +++ b/pkg/morph/subscriber/subscriber.go @@ -11,6 +11,7 @@ import ( "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/response" + "github.com/nspcc-dev/neo-go/pkg/rpc/response/result/subscriptions" "github.com/nspcc-dev/neo-go/pkg/util" "go.uber.org/zap" ) @@ -21,7 +22,7 @@ type ( SubscribeForNotification(...util.Uint160) (<-chan *state.NotificationEvent, error) UnsubscribeForNotification() BlockNotifications() (<-chan *block.Block, error) - SubscribeForNotaryRequests(mainTXSigner util.Uint160) (<-chan *response.NotaryRequestEvent, error) + SubscribeForNotaryRequests(mainTXSigner util.Uint160) (<-chan *subscriptions.NotaryRequestEvent, error) Close() } @@ -35,7 +36,7 @@ type ( blockChan chan *block.Block - notaryChan chan *response.NotaryRequestEvent + notaryChan chan *subscriptions.NotaryRequestEvent } // Params is a group of Subscriber constructor parameters. @@ -116,7 +117,7 @@ func (s *subscriber) BlockNotifications() (<-chan *block.Block, error) { 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 { 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 case response.NotaryRequestEventID: - notaryRequest, ok := notification.Value.(*response.NotaryRequestEvent) + notaryRequest, ok := notification.Value.(*subscriptions.NotaryRequestEvent) if !ok { s.log.Error("can't cast notify event value to the notary request struct") continue @@ -209,7 +210,7 @@ func New(ctx context.Context, p *Params) (Subscriber, error) { notifyChan: make(chan *state.NotificationEvent), notifyIDs: make(map[util.Uint160]string), 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