Commit graph

8008 commits

Author SHA1 Message Date
dependabot[bot]
e5eef2fbc7
build(deps): bump github.com/consensys/gnark
Bumps [github.com/consensys/gnark](https://github.com/consensys/gnark) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/consensys/gnark/releases)
- [Changelog](https://github.com/Consensys/gnark/blob/master/CHANGELOG.md)
- [Commits](https://github.com/consensys/gnark/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: github.com/consensys/gnark
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-06 19:40:53 +00:00
Ekaterina Pavlova
6f2712ee55 network: make cash size of bqueue configurable
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-09-06 19:17:20 +04:00
Anna Shaleva
d9a6a7cd3f
Merge pull request #3572 from nspcc-dev/feat/add-for-range-linter
.golangci.yml: add `intrange` linter
2024-09-05 18:02:10 +05:00
Anna Shaleva
585af7e596
Merge pull request #3570 from nspcc-dev/dep-upgrade
Dependency upgrade
2024-09-05 18:01:46 +05:00
Pavel Karpy
f8549a4fb8 mpt: refactor lcp to be possible to use range
It took some time to understand why changing a regular `for` to a `range`
one leads to behavior changes; let it be more clear and explicit. Also, a
correct code is always better than a correct code with `nolint`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2024-09-04 14:15:44 +03:00
Pavel Karpy
32f91dd726 .golangci.yml: add intrange linter
It checks that go 1.22's range-over-numbers feature is not skipped. Also,
fix some warnings it found.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2024-09-04 14:15:32 +03:00
Roman Khimov
09921bb3a4 check_deps: fix the check for stable NeoGo revisions used in nft-nd-nns
vX.Y.Z-date-commit is very much different from vX.Y.Z and we can have any of
them for NeoGo (vX.Y.Z is even preferable). Previous code ended up this way
for v0.106.3:

++ sed -E -n -e 's/.*neo-go\s.+-.+-(\w+)/\1/ p' examples/nft-nd-nns//go.mod
+ NEO_GO_COMMIT=
+ git merge-base --is-ancestor '' HEAD
fatal: Not a valid object name
+ die 'examples/nft-nd-nns/: neo-go commit  was not found in git'
+ echo 'examples/nft-nd-nns/: neo-go commit  was not found in git'
examples/nft-nd-nns/: neo-go commit  was not found in git
+ exit 1

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 11:03:01 +03:00
Roman Khimov
f614cc3d45 scripts: move 'em to a separate Go module
Which allows to drop two direct dependencies specific to scripts from the main
go.mod.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
f0ecc9764d examples: update neo-go dependency to v0.106.3
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
d96f2db6dd examples: update github.com/stretchr/testify dependency to 1.9.0
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
9ebf04400e go.mod: upgrade golang.org/x/tools to v0.24.0
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
894e53e697 go.mod: upgrade golang.org/x/crypto to v0.26.0
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
a8e73a632d go.mod: update go.etcd.io/bbolt to v1.3.11
Minor fixes and Go 1.22.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
7da0c900ca go.mod: upgrade github.com/urfave/cli/v2 to v2.27.4
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
702ab131e3 go.mod: upgrade github.com/prometheus/client_golang to v1.20.2
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
50657ddf32 go.mod: update our internal dependencies
go-ordered-json and rfc6979, nothing has really changed there.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
da4500d8f1 go.mod: upgrade github.com/holiman/uint256 to v1.3.1
Heavily optimized one.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
fed47df11a go.mod: upgrade github.com/gorilla/websocket to v1.5.3
It's maintained now again! A lot of fixes went in, but it seems to be ok
in tests.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
4249fddc36 go.mod: update github.com/decred/dcrd/dcrec/secp256k1/v4 to v4.3.0
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
7c356163e2 go.mod: upgrade github.com/consensys/gnark-crypto to v0.13.0
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-09-04 10:49:58 +03:00
Roman Khimov
d47fe392fb
Merge pull request #3567 from nspcc-dev/go-1.22
Go 1.22
2024-09-02 22:32:40 +03:00
Roman Khimov
565f8cfb7a *: fix copyloopvar warnings
Go 1.22+ allows to drop these:

  The copy of the 'for' variable "i" can be deleted (Go 1.22+) (copyloopvar)

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 22:02:57 +03:00
Roman Khimov
74cf5cbeae vm: drop *vm.VM parameter of CheckMultisigPar()
It's unused. Maybe we can move it out of VM completely decoupling VM from
crypto.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 21:48:27 +03:00
Roman Khimov
1b83dc2476 *: improve for loop syntax
Mostly it's about Go 1.22+ syntax with ranging over integers, but it also
prefers ranging over slices where possible (it makes code a little better to
read).

Notice that we have a number of dangerous loops where slices are mutated
during loop execution, many of these can't be converted since we need proper
length evalutation at every iteration.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 21:45:18 +03:00
Roman Khimov
133cd1dcf8 rpcbinding: use slices.Delete* for element filtering
It's a bit easier this way, loops that change slices aren't fun.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 21:35:27 +03:00
Roman Khimov
0fec17d7c0 bqueue: simplify queue flush on Discard()
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 21:30:00 +03:00
Roman Khimov
8f45d57612 *: stop using math/rand
Mostly this switches to math/rand/v2, but sometimes randomness is not really needed.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 17:00:11 +03:00
Roman Khimov
a50723ff72 *: use cmp.Or where appropriate
It's slightly less efficient (all comparisons are always made), but for
strings/ints it's negligible performance difference, while the code looks a
tiny bit better.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 17:00:11 +03:00
Roman Khimov
357bc76882 *: use slices.Concat where appropriate
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 17:00:11 +03:00
Roman Khimov
d5b7fc54e7 manifest: deduplicate test logic a bit with slices.Concat
LIkely it's more readable this way.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 17:00:11 +03:00
Roman Khimov
dfcff64acb go.mod: update to Go 1.22+
This also changes workflows to test 1.22 and 1.23 only (refs. https://github.com/nspcc-dev/.github/issues/30).
Fixes #3310.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-30 17:00:11 +03:00
Anna Shaleva
ff979e7ad2
Merge pull request #3563 from nspcc-dev/go-1.21
Go 1.21
2024-08-30 16:24:11 +05:00
Roman Khimov
8bececb511 go.mod: update github.com/consensys/gnark to v0.10.0
Fixes a security issue, https://github.com/Consensys/gnark/issues/897

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 15:40:49 +03:00
Roman Khimov
c07604fbf3 notary: simplify key presence check with slices
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:51:12 +03:00
Roman Khimov
8925b42250 golangci.yml: replace outdated linter
level=warning msg="The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar."

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:51:12 +03:00
Roman Khimov
6d4ebdcef3 *: return errors.ErrUnsupported where appropriate
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:51:12 +03:00
Roman Khimov
97506fb48d keys: rework nep-2/wif encoding without bytes.Buffer
It doesn't make any sense here and the length check was just a dead code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
9bc67f9da6 keys: mute elliptic.Marshal deprecation warning
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
b4e4567c2b *: don't use CompareTo name for three-way comparison functions
"Compare" is almost a standard one now, although math/big uses Cmp for historic
reasons (keys.PublicKey does so too). This also fixes Fixed8 since int64 to int
conversion is lossy.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
a1a7e3d708 *: use slices package for sorting and searching
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
6581bd47fc interop: simplify code with slices.Insert
It's not performance-critical for sure.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
a0553f740d statesync: simplify Pool management code
* use slices.BinarySearchFunc with its boolean status
* use slices.Insert/slices.Delete, tnis can be a little less efficient, but it
  frees the memory faster and this code is more I/O (networking) bound to care
  about 1-3%

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
5431b31d84 core: fix extensible sender check
Looks like it was wrong since 9592f3e052 because
sort.Search can return an index that is not equal to the target.
slices.BinarySearchFunc can do that too, but it also return a very convenient
boolean status that can be used.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
74acfe5288 network: rework insertion into sorting in tryInitStateSync
Overall this'd be less operations and less allocations.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 12:29:44 +03:00
Roman Khimov
49438798b5 manifest: deduplicate duplicate-checking code
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Roman Khimov
db820cb0dc manifest: rework method duplicate check
Don't use an additional type, it's inconvenient and this method is not
performance-critical.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Roman Khimov
7f1690a840 manifest: use slices.SortFunc, deduplicate PermissionDesc code
Simplify Less and Equals, fix Equals as well for PermissionWildcard (it was
reporting false erroneously).

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Roman Khimov
e0cf47e6d0 consensus: don't do useless key sorting
They're already sorted out of smartcontract.CreateMultiSigRedeemScript().

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Roman Khimov
32e3310205 smartcontract: improve CreateMultiSigRedeemScript documentation
It was always like that, but this important aspect was never documented.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00
Roman Khimov
de665b5567 *: use slices.Sort() where appropriate
It's always faster for simple types.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-27 08:24:52 +03:00