Commit graph

227 commits

Author SHA1 Message Date
Anna Shaleva
524ba5fd1b examples: fix linter issues
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-10-11 12:24:02 +03:00
Roman Khimov
594612bbdf nft-nd-nns: update to coverage-enabled NeoGo
It's to be updated to the final release eventually, but it's a good contract
to showcase the coverage feature, quite a lot of code with good overall
percentage.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-10-09 15:52:06 +03:00
Roman Khimov
9f93123301 nft-nd-nns: fix test runs
./nns_test.go:161:6: declared and not used: i

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-10-09 15:50:18 +03:00
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
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
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
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
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
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
f21edef43b *: bump min Go to 1.21, use 1.23 by default
Fixes #3089.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-23 19:11:06 +03:00
Roman Khimov
19aad75242 *: update interops
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-27 12:56:56 +03:00
Anna Shaleva
aa5a0cb49b *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-21 12:36:51 +03:00
Anna Shaleva
e275495850 *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-13 10:16:04 +03:00
Anna Shaleva
ac70f069ff Revert "build(deps): bump github.com/consensys/gnark"
This reverts commit 874ed1ac2e.
We can't allow this gnark update since minimum required Go version for
NeoGo and all examples is 1.20. It will be done as a part of #3089.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-05-01 15:24:07 +03:00
dependabot[bot]
874ed1ac2e
build(deps): bump github.com/consensys/gnark
Bumps [github.com/consensys/gnark](https://github.com/consensys/gnark) from 0.9.1 to 0.10.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.9.1...v0.10.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-25 13:49:06 +00:00
Ekaterina Pavlova
6d1a22dcb3 *: update interop deps
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-03-22 17:17:30 +03:00
Ekaterina Pavlova
f8ebed2da4 *: update interop deps
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2024-03-22 16:48:58 +03:00
Roman Khimov
45c6a7dcd7
Merge pull request #3352 from nspcc-dev/dependabot/go_modules/examples/zkp/cubic_circuit/google.golang.org/protobuf-1.33.0
build(deps): bump google.golang.org/protobuf from 1.31.0 to 1.33.0 in /examples/zkp/cubic_circuit
2024-03-14 08:28:56 +03:00
dependabot[bot]
57d828c4ab
build(deps): bump google.golang.org/protobuf in /examples/nft-nd-nns
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 23:07:18 +00:00
dependabot[bot]
b78b715259
build(deps): bump google.golang.org/protobuf
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-13 23:06:06 +00:00
Anna Shaleva
13ff95a3d3 go.mod: upgrade minimum required Go version to 1.20
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-03-05 13:54:10 +03:00
Anna Shaleva
46a3ff3348 *: regenerate all wallets with adjusted parameters
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2024-03-01 19:19:03 +03:00
Roman Khimov
2df0ba7c10
Merge pull request #3270 from nspcc-dev/dependabot/go_modules/examples/zkp/cubic_circuit/golang.org/x/crypto-0.17.0
build(deps): bump golang.org/x/crypto from 0.14.0 to 0.17.0 in /examples/zkp/cubic_circuit
2023-12-19 09:03:20 +03:00
dependabot[bot]
0baa35ed77
build(deps): bump golang.org/x/crypto in /examples/nft-nd-nns
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 23:42:52 +00:00
dependabot[bot]
ad122aec41
build(deps): bump golang.org/x/crypto in /examples/zkp/cubic_circuit
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](https://github.com/golang/crypto/compare/v0.14.0...v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 23:40:58 +00:00
Roman Khimov
e8e964e3da
Merge pull request #3234 from nspcc-dev/add-response-source
examples: improve cubic circuit documentation
2023-11-28 17:07:12 +03:00
Anna Shaleva
d7b84c0b47 examples: improve ZKP production example
Add more detailed errors and comments.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-28 17:00:34 +03:00
Anna Shaleva
29f344fd9b examples: add one more source of suitable response* files for Groth16
Turns out that Zcash swiched to BLS12-381 since https://github.com/zcash/zcash/issues/2502,
thanks to @EdgeDLT for pointing that out. I've checked that our
TestCubicCircuit_EndToEnd_Prod test passes with response file downloaded
from the attestations page of Zcash ceremony, thus I propose to put theirs
attestations link before the link to PPoT, because PPoT attestations contain
outdated links and not all responses can be downloaded.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-28 17:00:33 +03:00
Anna Shaleva
a159054f10 *: update interop dependency
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-28 10:49:39 +03:00
Anna Shaleva
626f1ee198 examples: do not replace neo-go library for ZKP examples
0.103.1 contains all necessary changes to run tests.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-24 09:21:09 +03:00
Anna Shaleva
c6d259b285 *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-21 13:44:02 +03:00
Anna Shaleva
16b7a83f30 *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 19:25:52 +03:00
Anna Shaleva
06c99fb2af *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-11-20 14:50:30 +03:00
Anna Shaleva
0e458f473f examples: update neo-go dependency and fetch fresh gnark-crypto
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-20 21:20:45 +03:00
Anna Shaleva
1605496002 *: update interop dependencies
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-20 19:38:20 +03:00
dependabot[bot]
19cfbc8d85
build(deps): bump github.com/consensys/gnark
Bumps [github.com/consensys/gnark](https://github.com/consensys/gnark) from 0.9.0 to 0.9.1.
- [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.9.0...v0.9.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-18 07:20:33 +00:00
Anna Shaleva
645076d04f examples: update neo-go dependency
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-12 18:19:30 +03:00
Anna Shaleva
3c13a3d74d *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-12 18:09:08 +03:00
Anna Shaleva
995d774ff8 *: bump minimum required go version to 1.19
For all components.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-12 13:28:59 +03:00
Anna Shaleva
fc6e87af2f *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:46:56 +03:00
Anna Shaleva
1745b21142 *: upgrade gnark-crypto up to v0.12.0
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:46:05 +03:00
Anna Shaleva
03951c94b0 examples: add production CRS generation instructions for ZKP examples
Add an example and instructions for production CRS generation to ZKP examples
with gnark >= v0.9.0.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:45:58 +03:00
Anna Shaleva
9e74fc5b47 zkp: add end-to-end Groth-16 proof generation/verification example
The example shows that the proover knows the solution of the cubic
equation: y = x^3 + x + 5. The example is constructed for BLS12-381
curve points using Groth-16 prooving algorithm. The example includes
everything that developer needs to start using ZKP on the NEO platform
with Go SDK:
1. The described cubic circuit implementation.
2. The off-chain proof generation with the help of gnark-crypto library.
3. Go verification contract generation and deployment with the help of
   NeoGo libraries.
4. The on-chain proof verification for various sets of input data.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 12:32:47 +03:00
Anna Shaleva
0a3260c22c examples: add compatibility example for Groth16 veification
Port the C# contract provided in the
https://github.com/neo-project/neo/issues/2647#issuecomment-1129849870 and
add an integration test for it. Part of the #3002.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 11:01:25 +03:00
omahs
edf21e0b79 examples: fix typo
Signed-off-by: omahs <73983677+omahs@users.noreply.github.com>
2023-08-31 14:14:14 +02:00
Anna Shaleva
de43b39c2a *: update interop deps
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-08-10 12:54:06 +03:00
Anna Shaleva
4e6b1c4a38 examples: extend storage contract
Add method that returns iterator. It's needed for the workshop.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-08-08 18:30:22 +03:00
Anna Shaleva
a0d991a500 rpcbinding: support map[any]any conversion for extended types
Unfortunately, without pre-set user extended types configuration for events
and without --guess-eventtypes flag set we are allowed to rely only on manifest
information about types. Manifest can't give us a lot of information, but we
still need to be able to generate RPC binding. Arrays and structs are correctly
handled by the current code, but maps always rely on the fact that map's value
type is set. It's not true in the described case, so make the maps type convertor
handle this situation in a similar way how arrays are handled.

Without this commit the following panic occurs on attempt to generate RPC binding:
```
    --- FAIL: TestAssistedRPCBindings/testdata/notifications (0.01s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7f7c0e]

goroutine 190 [running]:
testing.tRunner.func1.2({0x109cb40, 0x1d58760})
	/usr/local/go/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1399 +0x39f
panic({0x109cb40, 0x1d58760})
	/usr/local/go/src/runtime/panic.go:884 +0x212
github.com/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding.extendedTypeToGo({0x22, {0x0, 0x0}, {0x0, 0x0}, 0x0, 0x0, {0x0, 0x0, 0x0}}, ...)
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding/binding.go:515 +0x36e
github.com/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding.scTypeToGo({0xc000206d92?, 0xc000206d80?}, 0x22, 0xc0005d70e0)
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding/binding.go:643 +0x138
github.com/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding.scTemplateToRPC({{0xc00049bb07, 0x7}, 0xc0004c89c0, {0x33, 0x22, 0x11, 0x0, 0xff, 0xee, 0xdd, ...}, ...}, ...)
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding/binding.go:686 +0xbc4
github.com/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding.Generate({{0xc00049bb07, 0x7}, 0xc0004c89c0, {0x33, 0x22, 0x11, 0x0, 0xff, 0xee, 0xdd, ...}, ...})
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/smartcontract/rpcbinding/binding.go:421 +0x387
github.com/nspcc-dev/neo-go/cli/smartcontract.contractGenerateSomething(0xc00043e2c0, 0x137cd00)
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/cli/smartcontract/generate.go:99 +0x855
github.com/nspcc-dev/neo-go/cli/smartcontract.contractGenerateRPCWrapper(0xc00043e2c0?)
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/cli/smartcontract/generate.go:60 +0x25
github.com/urfave/cli.HandleAction({0x1048380?, 0x137c660?}, 0x13?)
	/home/anna/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:524 +0x50
github.com/urfave/cli.Command.Run({{0x123539d, 0x13}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x12577ad, 0x2a}, {0x127ad35, ...}, ...}, ...)
	/home/anna/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:173 +0x65b
github.com/urfave/cli.(*App).RunAsSubcommand(0xc0001f4000, 0xc00043e000)
	/home/anna/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:405 +0x91b
github.com/urfave/cli.Command.startApp({{0x12281e1, 0x8}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1254d8a, 0x28}, {0x0, ...}, ...}, ...)
	/home/anna/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:372 +0x6e7
github.com/urfave/cli.Command.Run({{0x12281e1, 0x8}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1254d8a, 0x28}, {0x0, ...}, ...}, ...)
	/home/anna/go/pkg/mod/github.com/urfave/cli@v1.22.5/command.go:102 +0x825
github.com/urfave/cli.(*App).Run(0xc00024e000, {0xc0004f6420, 0xb, 0xb})
	/home/anna/go/pkg/mod/github.com/urfave/cli@v1.22.5/app.go:277 +0x8a7
github.com/nspcc-dev/neo-go/cli/smartcontract.TestAssistedRPCBindings.func1.1(0x9f8829?)
	/home/anna/Documents/GitProjects/nspcc-dev/neo-go/cli/smartcontract/generate_test.go:395 +0x5fc
testing.tRunner(0xc0006824e0, 0xc0004a3680)
	/usr/local/go/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1493 +0x35f
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:53:43 +03:00
Anna Shaleva
35c3518b37 examples: fix owner's verification of Runtime example contract
`update` and `destroy` methods of the contract should check for owner
witness without checking the trigger (and that's the way how Verify
method works for this contract).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-19 13:26:56 +03:00