From 11bfb55b81dcdc2d2abf348ad9e58c99644adb56 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 27 Apr 2022 12:46:43 +0300 Subject: [PATCH 01/12] core: consider Rules witness scope as valid --- pkg/core/transaction/signer.go | 2 +- pkg/core/transaction/signer_test.go | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/core/transaction/signer.go b/pkg/core/transaction/signer.go index 74400daf9..d90e50598 100644 --- a/pkg/core/transaction/signer.go +++ b/pkg/core/transaction/signer.go @@ -39,7 +39,7 @@ func (c *Signer) EncodeBinary(bw *io.BinWriter) { func (c *Signer) DecodeBinary(br *io.BinReader) { br.ReadBytes(c.Account[:]) c.Scopes = WitnessScope(br.ReadB()) - if c.Scopes & ^(Global|CalledByEntry|CustomContracts|CustomGroups|None) != 0 { + if c.Scopes & ^(Global|CalledByEntry|CustomContracts|CustomGroups|Rules|None) != 0 { br.Err = errors.New("unknown witness scope") return } diff --git a/pkg/core/transaction/signer_test.go b/pkg/core/transaction/signer_test.go index 85ae3823a..58242a8e9 100644 --- a/pkg/core/transaction/signer_test.go +++ b/pkg/core/transaction/signer_test.go @@ -4,14 +4,20 @@ import ( "testing" "github.com/nspcc-dev/neo-go/internal/testserdes" + "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" + "github.com/stretchr/testify/require" ) func TestCosignerEncodeDecode(t *testing.T) { + pk, err := keys.NewPrivateKey() + require.NoError(t, err) expected := &Signer{ Account: util.Uint160{1, 2, 3, 4, 5}, - Scopes: CustomContracts, + Scopes: CustomContracts | CustomGroups | Rules, AllowedContracts: []util.Uint160{{1, 2, 3, 4}, {6, 7, 8, 9}}, + AllowedGroups: []*keys.PublicKey{pk.PublicKey()}, + Rules: []WitnessRule{{Action: WitnessAllow, Condition: ConditionCalledByEntry{}}}, } actual := &Signer{} testserdes.EncodeDecodeBinary(t, expected, actual) From af7e4ce4fd683288a9b0dad4b7a3a935d4605ec6 Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Mon, 21 Mar 2022 16:39:27 +0300 Subject: [PATCH 02/12] github: adjust Docker image publishing workflows --- .github/workflows/publish_to_dockerhub.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/publish_to_dockerhub.yml b/.github/workflows/publish_to_dockerhub.yml index 8266c5693..33dd6ecce 100644 --- a/.github/workflows/publish_to_dockerhub.yml +++ b/.github/workflows/publish_to_dockerhub.yml @@ -73,6 +73,11 @@ jobs: # Allows to fetch all history for all branches and tags. Need this for proper versioning. fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build image run: make image @@ -141,6 +146,11 @@ jobs: - name: Show docker images run: docker images + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - name: Build image run: make image-wsc From 5a6cda329a7652630ff7b00ef9ad2aa364757afd Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Mon, 21 Mar 2022 18:31:38 +0300 Subject: [PATCH 03/12] github: add ability to manually trigger publishing workflow with `latest` tag In case if something goes wrong during release version publishing. --- .github/workflows/publish_to_dockerhub.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_to_dockerhub.yml b/.github/workflows/publish_to_dockerhub.yml index 33dd6ecce..551274139 100644 --- a/.github/workflows/publish_to_dockerhub.yml +++ b/.github/workflows/publish_to_dockerhub.yml @@ -22,6 +22,10 @@ on: description: 'Push images to DockerHub [default: false; examples: true, false]' required: false default: 'false' + use_latest_tag: + description: 'Use `latest` tag while pushing images to DockerHub (applied to Ubuntu image only) [default: false; examples: true, false]' + required: false + default: 'false' # Environment variables. env: @@ -82,7 +86,7 @@ jobs: run: make image - name: Build image with 'latest' tag - if: ${{ github.event_name == 'release' && github.event.release.target_commitish == 'master' }} + if: ${{ (github.event_name == 'release' && github.event.release.target_commitish == 'master') || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true' && github.event.inputs.use_latest_tag == 'true') }} run: make image-latest - name: Login to DockerHub @@ -96,7 +100,7 @@ jobs: run: make image-push - name: Push image with 'latest' tag to registry - if: ${{ github.event_name == 'release' && github.event.release.target_commitish == 'master' }} + if: ${{ (github.event_name == 'release' && github.event.release.target_commitish == 'master') || (github.event_name == 'workflow_dispatch' && github.event.inputs.push_image == 'true' && github.event.inputs.use_latest_tag == 'true') }} run: make image-push-latest tests_wsc: From 92a2ec5848022054cdf50654b65935c074c0f858 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Thu, 24 Mar 2022 17:15:43 +0300 Subject: [PATCH 04/12] network: check compressed payload size in `decompress` Signed-off-by: Evgeniy Stratonikov --- pkg/network/compress.go | 3 +++ pkg/network/fuzz_test.go | 26 ++++++++++++++++++++++++++ pkg/network/message_test.go | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 pkg/network/fuzz_test.go diff --git a/pkg/network/compress.go b/pkg/network/compress.go index a8e73915d..644cad135 100644 --- a/pkg/network/compress.go +++ b/pkg/network/compress.go @@ -21,6 +21,9 @@ func compress(source []byte) ([]byte, error) { // decompress decompresses bytes using lz4. func decompress(source []byte) ([]byte, error) { + if len(source) < 4 { + return nil, errors.New("invalid compressed payload") + } length := binary.LittleEndian.Uint32(source[:4]) if length > payload.MaxSize { return nil, errors.New("invalid uncompressed payload length") diff --git a/pkg/network/fuzz_test.go b/pkg/network/fuzz_test.go new file mode 100644 index 000000000..c6caa171b --- /dev/null +++ b/pkg/network/fuzz_test.go @@ -0,0 +1,26 @@ +//go:build go1.18 +// +build go1.18 + +package network + +import ( + "math/rand" + "testing" + + "github.com/nspcc-dev/neo-go/pkg/io" + "github.com/stretchr/testify/require" +) + +func FuzzMessageDecode(f *testing.F) { + for i := 0; i < 100; i++ { + seed := make([]byte, rand.Uint32()%1000) + rand.Read(seed) + f.Add(seed) + } + + f.Fuzz(func(t *testing.T, value []byte) { + m := new(Message) + r := io.NewBinReaderFromBuf(value) + require.NotPanics(t, func() { _ = m.Decode(r) }) + }) +} diff --git a/pkg/network/message_test.go b/pkg/network/message_test.go index 38b620189..57cd82d75 100644 --- a/pkg/network/message_test.go +++ b/pkg/network/message_test.go @@ -18,6 +18,13 @@ import ( "github.com/stretchr/testify/require" ) +func TestMessageDecodeFuzzCases(t *testing.T) { + raw := []byte("10\x0200") + m := new(Message) + r := io.NewBinReaderFromBuf(raw) + require.NotPanics(t, func() { _ = m.Decode(r) }) +} + func TestEncodeDecodeVersion(t *testing.T) { // message with tiny payload, shouldn't be compressed expected := NewMessage(CMDVersion, &payload.Version{ From d68f57b9f9937e06030809a3b26602ecad5e28f8 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 5 Apr 2022 11:28:26 +0300 Subject: [PATCH 05/12] rpc: avoid panic on double-call to *WSClient.Close() Although it's the caller's duty to avoid WSClient re-closing, we still can handle it. Fixes the following neofs-node error: ``` panic: close of closed channel goroutine 98 [running]: github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).Close(...) github.com/nspcc-dev/neo-go@v0.98.3-pre.0.20220321144433-3b639f518ebb/pkg/rpc/client/wsclient.go:120 github.com/nspcc-dev/neofs-node/pkg/morph/subscriber.(*subscriber).Close(0x13) github.com/nspcc-dev/neofs-node/pkg/morph/subscriber/subscriber.go:108 +0x29 github.com/nspcc-dev/neofs-node/pkg/morph/event.listener.Stop(...) github.com/nspcc-dev/neofs-node/pkg/morph/event/listener.go:573 created by github.com/nspcc-dev/neofs-node/pkg/innerring.(*Server).Stop github.com/nspcc-dev/neofs-node/pkg/innerring/innerring.go:285 +0x12f ``` --- pkg/rpc/client/wsclient.go | 23 ++++++++++++++--------- pkg/rpc/client/wsclient_test.go | 12 ++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/pkg/rpc/client/wsclient.go b/pkg/rpc/client/wsclient.go index 89bd4b934..88dc1cbfb 100644 --- a/pkg/rpc/client/wsclient.go +++ b/pkg/rpc/client/wsclient.go @@ -16,6 +16,7 @@ import ( "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/atomic" ) // WSClient is a websocket-enabled RPC client that can be used with appropriate @@ -34,10 +35,11 @@ type WSClient struct { // be closed, so make sure to handle this. Notifications chan Notification - ws *websocket.Conn - done chan struct{} - requests chan *request.Raw - shutdown chan struct{} + ws *websocket.Conn + done chan struct{} + requests chan *request.Raw + shutdown chan struct{} + closeCalled atomic.Bool subscriptionsLock sync.RWMutex subscriptions map[string]bool @@ -93,6 +95,7 @@ func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error ws: ws, shutdown: make(chan struct{}), done: make(chan struct{}), + closeCalled: *atomic.NewBool(false), respChannels: make(map[uint64]chan *response.Raw), requests: make(chan *request.Raw), subscriptions: make(map[string]bool), @@ -113,11 +116,13 @@ func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error // Close closes connection to the remote side rendering this client instance // unusable. func (c *WSClient) Close() { - // Closing shutdown channel send signal to wsWriter to break out of the - // loop. In doing so it does ws.Close() closing the network connection - // which in turn makes wsReader receieve err from ws,ReadJSON() and also - // break out of the loop closing c.done channel in its shutdown sequence. - close(c.shutdown) + if c.closeCalled.CAS(false, true) { + // Closing shutdown channel send signal to wsWriter to break out of the + // loop. In doing so it does ws.Close() closing the network connection + // which in turn makes wsReader receieve err from ws,ReadJSON() and also + // break out of the loop closing c.done channel in its shutdown sequence. + close(c.shutdown) + } <-c.done } diff --git a/pkg/rpc/client/wsclient_test.go b/pkg/rpc/client/wsclient_test.go index 0945aff77..019dead39 100644 --- a/pkg/rpc/client/wsclient_test.go +++ b/pkg/rpc/client/wsclient_test.go @@ -441,3 +441,15 @@ func TestWSConcurrentAccess(t *testing.T) { batchCount*3+1) // batchCount*requestsPerBatch+1 wsc.Close() } + +func TestWSDoubleClose(t *testing.T) { + srv := initTestServer(t, "") + + c, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), Options{}) + require.NoError(t, err) + + require.NotPanics(t, func() { + c.Close() + c.Close() + }) +} From a7fe85a2d89b3bea3ee67f12c24e1496e363faee Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 5 Apr 2022 15:12:40 +0300 Subject: [PATCH 06/12] services: fix changing of main tx size of Notary request --- pkg/services/notary/notary.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/services/notary/notary.go b/pkg/services/notary/notary.go index 5f6a8e747..f6537ac5b 100644 --- a/pkg/services/notary/notary.go +++ b/pkg/services/notary/notary.go @@ -218,8 +218,15 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) { r.minNotValidBefore = nvbFallback } } else { + // Avoid changes in main transaction witnesses got from notary request pool to + // keep the pooled tx valid. We will update its copy => the copy's size will be changed. + cp := *payload.MainTransaction + cp.Scripts = make([]transaction.Witness, len(payload.MainTransaction.Scripts)) + for i, w := range payload.MainTransaction.Scripts { + cp.Scripts[i] = w + } r = &request{ - main: payload.MainTransaction, + main: &cp, minNotValidBefore: nvbFallback, } n.requests[payload.MainTransaction.Hash()] = r @@ -227,6 +234,8 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) { if r.witnessInfo == nil && validationErr == nil { r.witnessInfo = newInfo } + // Allow modification of fallback transaction got from notary request pool. + // It has dummy Notary witness attached => its size won't be changed. r.fallbacks = append(r.fallbacks, payload.FallbackTransaction) if exists && r.isMainCompleted() || validationErr != nil { return From b1f74b549dbf8a12267f4cf30bfe54da6fa097c5 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 26 Apr 2022 17:19:51 +0300 Subject: [PATCH 07/12] rpc: avoid panic during request after WS connection is closed Fix the following panic: ``` panic: assignment to entry in nil map goroutine 131 [running]: github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).registerRespChannel(0xc00033c240, 0x0, 0xc00003e2a0) /home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/wsclient.go:244 +0x96 github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).makeWsRequest(0xc00033c240, 0xc002080000) /home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/wsclient.go:264 +0x69 github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).performRequest(0xc00033c240, {0xc9f173, 0xd}, {{0x13d09d0, 0x0, 0x0}}, {0xb44120, 0xc00147a000}) /home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/client.go:186 +0x15d github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).GetBlockCount(0xc001fb5440) /home/denis/go/pkg/mod/github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/rpc.go:73 +0x69 ... ``` --- pkg/rpc/client/wsclient.go | 17 +++++++++-------- pkg/rpc/client/wsclient_test.go | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/pkg/rpc/client/wsclient.go b/pkg/rpc/client/wsclient.go index 88dc1cbfb..9c4ff5272 100644 --- a/pkg/rpc/client/wsclient.go +++ b/pkg/rpc/client/wsclient.go @@ -243,12 +243,6 @@ func (c *WSClient) wsWriter() { } } -func (c *WSClient) registerRespChannel(id uint64, ch chan *response.Raw) { - c.respLock.Lock() - defer c.respLock.Unlock() - c.respChannels[id] = ch -} - func (c *WSClient) unregisterRespChannel(id uint64) { c.respLock.Lock() defer c.respLock.Unlock() @@ -266,8 +260,15 @@ func (c *WSClient) getResponseChannel(id uint64) chan *response.Raw { func (c *WSClient) makeWsRequest(r *request.Raw) (*response.Raw, error) { ch := make(chan *response.Raw) - c.registerRespChannel(r.ID, ch) - + c.respLock.Lock() + select { + case <-c.done: + c.respLock.Unlock() + return nil, errors.New("connection lost before registering response channel") + default: + c.respChannels[r.ID] = ch + c.respLock.Unlock() + } select { case <-c.done: return nil, errors.New("connection lost before sending the request") diff --git a/pkg/rpc/client/wsclient_test.go b/pkg/rpc/client/wsclient_test.go index 019dead39..531db6d5d 100644 --- a/pkg/rpc/client/wsclient_test.go +++ b/pkg/rpc/client/wsclient_test.go @@ -453,3 +453,18 @@ func TestWSDoubleClose(t *testing.T) { c.Close() }) } + +func TestWS_RequestAfterClose(t *testing.T) { + srv := initTestServer(t, "") + + c, err := NewWS(context.TODO(), httpURLtoWS(srv.URL), Options{}) + require.NoError(t, err) + + c.Close() + + require.NotPanics(t, func() { + _, err = c.GetBlockCount() + }) + require.Error(t, err) + require.True(t, strings.Contains(err.Error(), "connection lost before registering response channel")) +} From c410219cba5f6df8b875f0edeb3e332c8ce9bb2d Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 6 May 2022 10:08:09 +0300 Subject: [PATCH 08/12] transaction: fix Rules stringer, it's WitnessRules in C# See neo-project/neo#2720. --- pkg/core/transaction/witness_scope.go | 4 ++-- pkg/core/transaction/witness_scope_string.go | 4 ++-- pkg/network/message_string.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/core/transaction/witness_scope.go b/pkg/core/transaction/witness_scope.go index 8950290cd..f4d75157e 100644 --- a/pkg/core/transaction/witness_scope.go +++ b/pkg/core/transaction/witness_scope.go @@ -1,6 +1,6 @@ package transaction -//go:generate stringer -type=WitnessScope -output=witness_scope_string.go +//go:generate stringer -type=WitnessScope -linecomment -output=witness_scope_string.go import ( "encoding/json" "fmt" @@ -23,7 +23,7 @@ const ( // CustomGroups define custom pubkey for group members. CustomGroups WitnessScope = 0x20 // Rules is a set of conditions with boolean operators. - Rules WitnessScope = 0x40 + Rules WitnessScope = 0x40 // WitnessRules // Global allows this witness in all contexts (default Neo2 behavior). // This cannot be combined with other flags. Global WitnessScope = 0x80 diff --git a/pkg/core/transaction/witness_scope_string.go b/pkg/core/transaction/witness_scope_string.go index 5f6666af1..805ac1473 100644 --- a/pkg/core/transaction/witness_scope_string.go +++ b/pkg/core/transaction/witness_scope_string.go @@ -1,4 +1,4 @@ -// Code generated by "stringer -type=WitnessScope -output=witness_scope_string.go"; DO NOT EDIT. +// Code generated by "stringer -type=WitnessScope -linecomment -output=witness_scope_string.go"; DO NOT EDIT. package transaction @@ -20,7 +20,7 @@ const ( _WitnessScope_name_0 = "NoneCalledByEntry" _WitnessScope_name_1 = "CustomContracts" _WitnessScope_name_2 = "CustomGroups" - _WitnessScope_name_3 = "Rules" + _WitnessScope_name_3 = "WitnessRules" _WitnessScope_name_4 = "Global" ) diff --git a/pkg/network/message_string.go b/pkg/network/message_string.go index 2ebdacd9b..8e516f377 100644 --- a/pkg/network/message_string.go +++ b/pkg/network/message_string.go @@ -62,7 +62,7 @@ var ( func (i CommandType) String() string { switch { - case i <= 1: + case 0 <= i && i <= 1: return _CommandType_name_0[_CommandType_index_0[i]:_CommandType_index_0[i+1]] case 16 <= i && i <= 17: i -= 16 From 7dc0404306c07e8c0e00af58ddaeff164900b567 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 6 May 2022 10:20:55 +0300 Subject: [PATCH 09/12] transaction: fix maxSubitems handling in JSON scope unmarshaller Notice that binary deserializer (readArrayOfConditions) does it correctly. Can be checked with neo-project/neo#2720 case. --- pkg/core/transaction/witness_condition.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/transaction/witness_condition.go b/pkg/core/transaction/witness_condition.go index cb41b7746..80d01d369 100644 --- a/pkg/core/transaction/witness_condition.go +++ b/pkg/core/transaction/witness_condition.go @@ -491,7 +491,7 @@ func unmarshalArrayOfConditionJSONs(arr []json.RawMessage, maxDepth int) ([]Witn if l == 0 { return nil, errors.New("empty array of conditions") } - if l >= maxSubitems { + if l > maxSubitems { return nil, errors.New("too many elements") } res := make([]WitnessCondition, l) From 0b05007ff5abbc8adfc948fd2b4c7e67e3d2e8b3 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sat, 7 May 2022 18:09:32 +0300 Subject: [PATCH 10/12] CHANGELOG: release 0.98.3 --- CHANGELOG.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 481d0a0ee..7561df166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,27 @@ This document outlines major changes between releases. +## 0.98.3 "Liquidation" (07 May 2022) + +This is a hotfix release to fix t4 testnet incompatibility at block +1589202. The actual problem was found and fixed during 0.99.0 development +cycle, but 0.99.0 is expected to be incompatible with t4 testnet. This release +allows to continue working with it as well as mainnet (and contains some other +fixes for known problems). It does not require resynchronizing a node. + +Improvements: + * double call to `WSClient.Close()` method won't cause a panic (#2420) + +Bugs fixed: + * Rules scope considered as invalid in binary representation (#2452) + * incorrect compressed P2P message could lead to panic (#2409) + * notary-assisted transaction could be in inconsistent state on the Notary + node (#2424) + * WSClient panics if request is made after connection breakage (#2450) + * Rules scope JSON representation wasn't compatible with C# implementation + (#2466) + * JSONized Rules scope could only contain 15 conditions instead of 16 (#2466) + ## 0.98.2 "Karstification" (21 Mar 2022) We've decided to release one more 3.1.0-compatible version bringing all of the From 64710fc3f9bf3b1bfb911d1ab2aa986a91e697ba Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sat, 7 May 2022 18:32:48 +0300 Subject: [PATCH 11/12] ROADMAP: update it somewhat --- ROADMAP.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ROADMAP.md b/ROADMAP.md index bf3d33851..f75aebe23 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -7,5 +7,8 @@ functionality. ## Versions 0.7X.Y (as needed) * Neo 2.0 support (bug fixes, minor functionality additions) +## Version 0.99.0 (May 2022) +* 3.2.2 protocol update support + ## Version 1.0 (2022, TBD) -* full NEO N3 support and useful extensions +* stable version with full Neo N3 support and useful extensions From 711e21709f290084cfc73640f21a97d7d5531a8c Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Sat, 7 May 2022 18:38:50 +0300 Subject: [PATCH 12/12] rpc/notary: make this branch mergeable with master --- pkg/rpc/client/wsclient.go | 4 ++-- pkg/services/notary/notary.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/rpc/client/wsclient.go b/pkg/rpc/client/wsclient.go index 9c4ff5272..3c9e8990a 100644 --- a/pkg/rpc/client/wsclient.go +++ b/pkg/rpc/client/wsclient.go @@ -117,9 +117,9 @@ func NewWS(ctx context.Context, endpoint string, opts Options) (*WSClient, error // unusable. func (c *WSClient) Close() { if c.closeCalled.CAS(false, true) { - // Closing shutdown channel send signal to wsWriter to break out of the + // Closing shutdown channel sends a signal to wsWriter to break out of the // loop. In doing so it does ws.Close() closing the network connection - // which in turn makes wsReader receieve err from ws,ReadJSON() and also + // which in turn makes wsReader receive an err from ws.ReadJSON() and also // break out of the loop closing c.done channel in its shutdown sequence. close(c.shutdown) } diff --git a/pkg/services/notary/notary.go b/pkg/services/notary/notary.go index f6537ac5b..70ebea093 100644 --- a/pkg/services/notary/notary.go +++ b/pkg/services/notary/notary.go @@ -218,7 +218,7 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) { r.minNotValidBefore = nvbFallback } } else { - // Avoid changes in main transaction witnesses got from notary request pool to + // Avoid changes in the main transaction witnesses got from the notary request pool to // keep the pooled tx valid. We will update its copy => the copy's size will be changed. cp := *payload.MainTransaction cp.Scripts = make([]transaction.Witness, len(payload.MainTransaction.Scripts)) @@ -234,7 +234,7 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) { if r.witnessInfo == nil && validationErr == nil { r.witnessInfo = newInfo } - // Allow modification of fallback transaction got from notary request pool. + // Allow modification of a fallback transaction got from the notary request pool. // It has dummy Notary witness attached => its size won't be changed. r.fallbacks = append(r.fallbacks, payload.FallbackTransaction) if exists && r.isMainCompleted() || validationErr != nil {