Commit graph

16 commits

Author SHA1 Message Date
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
c7b623cc38 *: drop pkg/util/slice, use slices.Reverse
This also removes bigint.FromBytesUnsigned(), it's not used very often and
it's somewhat misleading in the bigint package (which is supposed to use a
very specific enconding).

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-08-24 22:41:48 +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
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
Ekaterina Pavlova
1237c719e3 smartcontract: fix DO NOT EDIT warning to autogenerated files
The text must appear as the first line of a properly formatted Go //
comment, and that comment must appear before but not be attached to the
package clause and before any /* */ comment.

Closes #3254

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
2023-12-25 13:01:36 +03:00
Anna Shaleva
6476241b3a smartcontract: add DO NOT EDIT warning to autogenerated files
Close #3139.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-18 20:34:36 +03:00
Anna Shaleva
c42486587d smartcontract: apply gofmt to the resulting bindings
Close #3133.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-18 18:14:52 +03:00
Anna Shaleva
545dbbc668 go.mod: upgrade gnark to v0.9.0
Close #3079.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-16 15:06:30 +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
d27d2a8561 zkpbinding: fix example link
Should be a part of #3043.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 15:16:11 +03:00
Anna Shaleva
e2abb5cb7c zkpbinding: update templates of go.sum and go.mod for Verifier contract
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:46:05 +03:00
Anna Shaleva
ca71bd51d3 zkpbinding: format formulae in Verifier template
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:46:05 +03:00
Anna Shaleva
8c46517522 zkpbinding: use proper field size for BLS12-381
It's not differ from BN254, but we'd better use the proper package.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:46:05 +03:00
Anna Shaleva
ff260a6a9b zkpbinding: allow to handle serialisation format of gnark >= v0.9.0
An upgrade from gnark v0.8.X to v0.9.0 changes serialization format of verifying/proving keys
and proofs. In neo-go zkpbinding package we have to support both at least for now, because
gnark@v0.9.0 requires minimum go 1.19.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-10-05 13:46:05 +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