Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NeoFS SDK update #2995

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,66 @@ require (
github.com/consensys/gnark-crypto v0.9.1
github.com/davecgh/go-spew v1.1.1
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1
github.com/google/uuid v1.2.0
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.4.2
github.com/hashicorp/golang-lru v0.5.4
github.com/hashicorp/golang-lru v0.6.0
github.com/holiman/uint256 v1.2.0
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/mr-tron/base58 v1.2.0
github.com/nspcc-dev/dbft v0.0.0-20230404091436-0108387748cd
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20230420112658-c50ab951645a
github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.8
github.com/nspcc-dev/rfc6979 v0.2.0
github.com/pierrec/lz4 v2.6.1+incompatible
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.13.0
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.1
github.com/syndtr/goleveldb v1.0.1-0.20210305035536-64b5b1c73954
github.com/twmb/murmur3 v1.1.5
github.com/urfave/cli v1.22.5
go.etcd.io/bbolt v1.3.6
go.uber.org/atomic v1.9.0
go.uber.org/atomic v1.10.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.4.0
golang.org/x/term v0.5.0
golang.org/x/text v0.7.0
golang.org/x/tools v0.1.12
golang.org/x/tools v0.2.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20221202181307-76fa05c21b12 // indirect
github.com/benbjohnson/clock v1.1.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/frankban/quicktest v1.14.5 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/nspcc-dev/hrw v1.0.9 // indirect
github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 // indirect
github.com/nspcc-dev/neofs-api-go/v2 v2.14.0 // indirect
github.com/nspcc-dev/neofs-crypto v0.4.0 // indirect
github.com/nspcc-dev/tzhash v1.6.1 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20221227203929-1b447090c38c // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.5.0 // indirect
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 // indirect
google.golang.org/grpc v1.41.0 // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Expand Down
173 changes: 42 additions & 131 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func (s *service) Name() string {
}

func (s *service) Start() {
if s.started.CAS(false, true) {
if s.started.CompareAndSwap(false, true) {
s.log.Info("starting consensus service")
b, _ := s.Chain.GetBlock(s.Chain.CurrentBlockHash()) // Can't fail, we have some current block!
s.lastTimestamp = b.Timestamp
Expand All @@ -288,7 +288,7 @@ func (s *service) Start() {

// Shutdown implements the Service interface.
func (s *service) Shutdown() {
if s.started.CAS(true, false) {
if s.started.CompareAndSwap(true, false) {
s.log.Info("stopping consensus service")
close(s.quit)
<-s.finished
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/bqueue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (bq *Queue) LastQueued() (uint32, int) {

// Discard stops the queue and prevents it from accepting more blocks to enqueue.
func (bq *Queue) Discard() {
if bq.discarded.CAS(false, true) {
if bq.discarded.CompareAndSwap(false, true) {
bq.queueLock.Lock()
close(bq.checkBlocks)
// Technically we could bq.queue = nil, but this would cost
Expand Down
6 changes: 3 additions & 3 deletions pkg/network/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ func (s *Server) tryStartServices() {
return
}

if s.IsInSync() && s.syncReached.CAS(false, true) {
if s.IsInSync() && s.syncReached.CompareAndSwap(false, true) {
s.log.Info("node reached synchronized state, starting services")
if s.chain.P2PSigExtensionsEnabled() {
s.notaryRequestPool.RunSubscriptions() // WSClient is also a subscriber.
Expand Down Expand Up @@ -1277,14 +1277,14 @@ func getRequestBlocksPayload(p Peer, currHeight uint32, lastRequestedHeight *ato
old := lastRequestedHeight.Load()
if old <= currHeight {
needHeight = currHeight + 1
if !lastRequestedHeight.CAS(old, needHeight) {
if !lastRequestedHeight.CompareAndSwap(old, needHeight) {
continue
}
} else if old < currHeight+(bqueue.CacheSize-payload.MaxHashesCount) {
needHeight = currHeight + 1
if peerHeight > old+payload.MaxHashesCount {
needHeight = old + payload.MaxHashesCount
if !lastRequestedHeight.CAS(old, needHeight) {
if !lastRequestedHeight.CompareAndSwap(old, needHeight) {
continue
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rpcclient/wsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func NewWS(ctx context.Context, endpoint string, opts WSOptions) (*WSClient, err
// Close closes connection to the remote side rendering this client instance
// unusable.
func (c *WSClient) Close() {
if c.closeCalled.CAS(false, true) {
if c.closeCalled.CompareAndSwap(false, true) {
c.setCloseErr(errConnClosedByUser)
// 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
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewService(name string, httpServers []*http.Server, cfg config.BasicService
// Start runs http service with the exposed endpoint on the configured port.
func (ms *Service) Start() error {
if ms.config.Enabled {
if !ms.started.CAS(false, true) {
if !ms.started.CompareAndSwap(false, true) {
ms.log.Info("service already started")
return nil
}
Expand Down Expand Up @@ -66,7 +66,7 @@ func (ms *Service) ShutDown() {
if !ms.config.Enabled {
return
}
if !ms.started.CAS(true, false) {
if !ms.started.CompareAndSwap(true, false) {
return
}
for _, srv := range ms.http {
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/notary/notary.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (n *Notary) Name() string {
// Start runs a Notary module in a separate goroutine.
// The Notary only starts once, subsequent calls to Start are no-op.
func (n *Notary) Start() {
if !n.started.CAS(false, true) {
if !n.started.CompareAndSwap(false, true) {
return
}
n.Config.Log.Info("starting notary service")
Expand Down Expand Up @@ -221,7 +221,7 @@ drainLoop:
// to Shutdown on the same instance are no-op. The instance that was stopped can
// not be started again by calling Start (use a new instance if needed).
func (n *Notary) Shutdown() {
if !n.started.CAS(true, false) {
if !n.started.CompareAndSwap(true, false) {
return
}
n.Config.Log.Info("stopping notary service")
Expand Down
Loading