Commit graph

6905 commits

Author SHA1 Message Date
Anna Shaleva
e2580187a1 cli: fetch extended evet types from contract config
The user should specify it via parameter's `extendedtype` field and
via upper-level `namedtypes` field of the contract configuration YAML.

Also, as we have proper event structure source, make the `--guess-eventtype`
compilation option and make event types guess optional.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:53:41 +03:00
Anna Shaleva
194639bb15 compiler: fix typo in the method description
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:52:41 +03:00
Anna Shaleva
044ae477ca smartconract: generate RPC binding wrappers for events
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-31 15:52:39 +03:00
Anna Shaleva
ae52b2c2fa rpcbinding: fix binding indentation
New rule for writing blocks of code to our template: new line before
the block starts and new line after the block ends. This rule is the
same as the one we use during manual typing.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-30 17:37:06 +03:00
Anna Shaleva
0f0f7b364f rpcbinding: use typed return err value in etTypeConverter
Otherwise the resulting code can't be compiled.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-25 16:41:23 +03:00
Anna Shaleva
8beb9f23c3 smartcontract: add comments to binding config fields
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-25 16:41:23 +03:00
Anna Shaleva
36af361c2b smartcontract: add FromStackItem wrapper for RPC bindings
Make it exported and reusable from the user's code.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-24 11:27:49 +03:00
Anna Shaleva
b5ec1271d5 .gitignore: do not ignore compiler testdata
cli's testdata folder stores contracts examples and expected compilation
output, thus doesn't need to be ignored.

*.out files are the bindings outputs only, do not ignore them as far.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-24 11:27:49 +03:00
Anna Shaleva
7a06cea885 cli: allow to rewrite expected test output
Don't perform it manually every time.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-24 11:27:48 +03:00
Roman Khimov
aca12b58c0
Merge pull request #3020 from nspcc-dev/loadnef-enh-2
cli: properly load specified method for `run` VM CLI command
2023-05-19 16:39:41 +03:00
Anna Shaleva
ddfbf7a434 cli: remove code duplication in test
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-19 13:26:56 +03:00
Anna Shaleva
2f4fb3a079 cli: fix error description for run VM CLI command
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-19 13:26:56 +03:00
Anna Shaleva
b6b80f3abf cli: properly handle run VM CLI command
Properly load the provided method using NEF and hash specified. It allows
to have NEF properly set in the VM context and handle CALLT instruction
correctly.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-19 13:26:56 +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
Roman Khimov
7b86a54fc0
Merge pull request #3016 from nspcc-dev/emit-convertible
vm: allow to emit stackitem.Convertible
2023-05-17 21:06:21 +03:00
Anna Shaleva
fc6029d006 vm: allow to emit uint and uint64 as a part of array
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 19:29:42 +03:00
Roman Khimov
d463bad96f
Merge pull request #3013 from nspcc-dev/loadnef-enh
cli: autocomplete contract-related filenames for `compile` and `loadnef` commands
2023-05-17 15:05:00 +03:00
Anna Shaleva
aace790651 cli: guess manifest filename from nef for loadnef VM CLI command
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 13:09:31 +03:00
Anna Shaleva
ed2b59e077 cli: use cosigners separator for VM CLI commands where appropriate
Needed for further VM CLI commands improvement, we'll add another
positional args.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 13:09:31 +03:00
Anna Shaleva
a2449ae8ae cli: autocomplete output filenames for contract compile cmd
It's enough to specify the input file only to get the standard output:
```
$ neo-go contract compile -i ./1-print/1-print.go
$ neo-go contract compile -i ./1-print/
```

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 13:09:30 +03:00
Anna Shaleva
3dbb733324 cli: require contract config file for bindings generation
It's an error if config file isn't provided and bindings config needs
to be generated.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 13:00:39 +03:00
Anna Shaleva
15138b2004 vm: allow to emit convertible
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 12:47:31 +03:00
Anna Shaleva
8e085d3ca3 vm: allow to make stackitem from *Uint160 and *Uint256
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-17 11:16:32 +03:00
Roman Khimov
d493afc941
Merge pull request #3018 from nspcc-dev/upd-dbft
gomod: fetch dBFT update
2023-05-16 16:08:09 +03:00
Anna Shaleva
8599e25fc3 gomod: fetch dBFT update
Send PrepareRequest on timeout only: https://github.com/nspcc-dev/dbft/pull/75.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-16 16:03:34 +03:00
Roman Khimov
4afc71ab6d
Merge pull request #3014 from nspcc-dev/node-cfg
cli: allow to provide single node config file

Close #2978.
2023-05-16 14:42:38 +03:00
Anna Shaleva
4be9e4347a cli: allow to provide network-specific node config file
Close #2978.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-16 13:23:55 +03:00
Roman Khimov
abf3ef5af7
Merge pull request #3009 from nspcc-dev/new-version
network: add `neogo_version` metric, deprecate `serv_node_version`
2023-05-11 14:38:35 +03:00
Anna Shaleva
649b9ac7b0 network: add neogo_version metric, deprecate serv_node_version
Close #2999.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-11 13:48:38 +03:00
Roman Khimov
230f54c38a
Merge pull request #3010 from AnnaShaleva/AS/upload-release-asset
github: automatically attach binaries to the release
2023-05-10 22:32:29 +03:00
Anna Shaleva
778ddfb277 github: automatically attach binaries to the release
Close #3001.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-05-10 19:39:45 +03:00
Roman Khimov
b47a891b9e
Merge pull request #3004 from nspcc-dev/require-error-is
*: use require.ErrorIs instead of require.True(t, error.Is())
2023-05-04 18:14:36 +03:00
Roman Khimov
433275265f *: use require.ErrorIs instead of require.True(t, error.Is())
This is just a much better way to do the same thing. Inspired by
nspcc-dev/neofs-sdk-go#407.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-05-04 17:03:47 +03:00
Roman Khimov
8e6025fbc8
Merge pull request #3000 from nspcc-dev/conloss-error-for-wsclient
rpcclient: provide some exported error for disconnected WSClient
2023-05-03 16:42:12 +03:00
Roman Khimov
fcaa24f928 rpcclient: provide some exported error for disconnected WSClient
Regular Client doesn't care much about connections, because HTTP client's Do
method can reuse old ones or create additional ones on the fly. So one request
can fail and the next one easily succeed. WSClient is different, it works via
a single connection and if it breaks, it breaks forever for this
client. Callers will get some error on every request afterwards and it'd be
nice for this error to be the same so that API users could detect
disconnection this way too.

Related to nspcc-dev/neofs-node#2325.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-05-03 16:08:54 +03:00
Roman Khimov
8bd9a7d420
Merge pull request #2995 from nspcc-dev/neofs-sdk-update
NeoFS SDK update
2023-05-02 14:25:31 +03:00
Roman Khimov
cef7ac2510
Merge pull request #2997 from nspcc-dev/fix-Lint
github: use minimum supported go version for Linter job
2023-04-28 12:28:26 +03:00
Roman Khimov
a0aef0e92f
Merge pull request #2996 from nspcc-dev/fix-lint
core: add nolint comment for deprecated error format style
2023-04-28 12:27:10 +03:00
Anna Shaleva
98d29570d3 github: use minimum supported go version for Linter job
It should be this way because we can't provide some features golangci-lint
require us to do due to the need to support not only the latest Go version,
but also two versions below.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-04-28 12:17:08 +03:00
Anna Shaleva
9c0a45c65e core: add nolint comment for deprecated error format style
Should be a part of 67d4d891ef.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-04-28 12:13:21 +03:00
Roman Khimov
0a160ee93b *: use CompareAndSwap instead of CAS for atomics
go.uber.org/atomic deprecated CAS methods in version 1.10 (that introduced
CompareAndSwap), so we need to fix it.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-04-28 12:07:19 +03:00
Roman Khimov
2567c4c672 oracle: update NeoFS SDK to 1.0.0-rc.8
We were using _very_ old version, so there is a number of changes, including:
 * fix for unlimited reads
 * UTF-8 check for HTTP requests

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2023-04-27 21:29:59 +03:00
Roman Khimov
dcea3f6107
Merge pull request #2988 from nspcc-dev/client/close-blockers
rpcclient: close WSClient subscriber on overflow
2023-04-26 22:23:49 +03:00
Roman Khimov
1bd22adcb3
Merge pull request #2994 from nspcc-dev/fix-init-cache
core: rework natives cache initialization
2023-04-26 14:54:52 +03:00
Anna Shaleva
67d4d891ef core: prevent direct access to Notary contract if not active
Otherwise it will cause panic, which isn't expected behaviour.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-04-26 14:11:12 +03:00
Anna Shaleva
edb2d46d5b core: initialize natives cache wrt NativeActivations
If the contract was deployed then cache must be initialized after
in-memory data reset. If the contract isn't active yet, then no
cache will be initialized on deploy (i.e. on call to Initialize()
method by native Management).

Close #2984.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-04-26 13:57:45 +03:00
Anna Shaleva
33c971b0e4 core: add InitializeCache method to Contract interface
Make the contracts cache initialization unified. The order of cache
iniitialization is not important and Nottary contract is added to the
bc.contracts.Contracts wrt P2PSigExtensions setting, thus no functional
changes, just refactoring for future applications.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-04-26 12:57:48 +03:00
Roman Khimov
29b3df10b6
Merge pull request #2992 from nspcc-dev/init-metrics-on-start
*: adjust Prometheus metrics initialisation on node start
2023-04-25 16:27:38 +03:00
Anna Shaleva
e2782aef05 *: adjust Prometheus metrics initialisation on node start
Initialize Prometheus metrics on node start where appropriate and review
the usage of the following metrics:
```
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ find | grep prometheus.go
./pkg/network/prometheus.go
./pkg/core/stateroot/prometheus.go
./pkg/core/prometheus.go
./pkg/services/rpcsrv/prometheus.go
./pkg/services/metrics/prometheus.go
```

Close #2970.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
2023-04-25 16:25:18 +03:00
Roman Khimov
bbdfdc3099
Merge pull request #2991 from nspcc-dev/revert-mgmt-ids
Revert "native: make management compatible with C# node 3.5.0"
2023-04-25 12:42:01 +03:00