From 3929f6b396aa83184f1b2c5084305e7c3f11f41f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Mon, 20 Sep 2021 18:59:50 +0300 Subject: [PATCH] [#833] Upgrade Neo Go and NeoFS API Go libraries Upgrade Neo Go lib to release v0.97.3. Signed-off-by: Leonard Lyubich --- go.mod | 8 ++------ go.sum | Bin 98276 -> 98523 bytes pkg/morph/event/listener.go | 6 +++--- pkg/morph/event/notary_preparator_test.go | 9 +-------- pkg/morph/subscriber/subscriber.go | 11 ++++++----- 5 files changed, 12 insertions(+), 22 deletions(-) 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 9ef86245dfd09d714de3a62bba701c3bd0b97475..3eab86811d900322915d4ac23adf15ddfe4d3602 100644 GIT binary patch delta 469 zcmZ|JNlwC00LJlXqA@Pq8cj@GnkdrO@jZ8xJ_;>R84AUfEp(#H)jn`%;t6b=7T&>x zTX+RmCMF(%rP3V>J;3+-{$D>EAGe!ti~IQGeJ@V~3IPrPnx|391{U9L+XB;}=tB>j zDQy zUBZzs=9N;e!57B7Kj4HM*0QB`)pIHX$8;!M&v1I;&KLKu>lBkL$Jc)PqNRAQ30R%v z$fT%rkKt9iA3}Rjujxdbs+q9cE7;+3xgVz=wvcejtb8+|X!kIbx$*^(`}TQu7A#R- z9G%Z_(5p8rEy5l*#nBC13P*GK5v+-Tqak2Y6aa#aC>xm_E2-fb)|2tEDjQ}{t_H3M znTbABu*jC0ffM>_R$_~j8e?ef#EQF5JB2@}l{z&G>j;EF!G+!HNcV(Z#k4|FK?<+- b2L_&u@^DNf|H{ZL#e;bGvOT|izWe?KGC7>t delta 288 zcmccJ$oAwv>xS=>Hou!Zm&w3TA;Zwh(KjcsC@9Lm+|}1u-!C~ZpfoYqBfzY}*x55T z(j}re*hM=p)!on3(ja~E#;Hn{=6Z(u>G^uO`6(dXmFcDBfldYCz9AkJ2IiiA-ubRM zULh9l>4}Cup(!E3nFi@0=BAb9US<}PH_p)5Y&YGI(aFHV(AdyO*TB#q$uP;l(9puj z9AuW8Q-EuLNw&Xhc0_K4NpgNlh`xbGwx>ssyO(xuUTKnXUU*4bagvdVYb4MtGfynW zAi2!hF*Ur{v&6{ByC~h*y`<8@AU{3OFCxz^tiY?p&?4K^)Y0ERr>eNvsT^pU>}KDY Gea`_D31AZd 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