This code was never invoked since we had no native contract enabled
starting from some hardfork, Notary is the first one. And luckily, we
have plenty of tests that fail due to this bug.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
It doesn't work for contracts enabled starting from non-nil hardfork:
```
--- FAIL: TestStateroot_GetLatestStateHeight (0.00s)
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO initial gas supply is not set or wrong, setting default value {"InitialGASSupply": "52000000"}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO mempool size is not set or wrong, setting default value {"MemPoolSize": 50000}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO P2PNotaryRequestPayloadPool size is not set or wrong, setting default value {"P2PNotaryRequestPayloadPoolSize": 1000}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO MaxBlockSize is not set or wrong, setting default value {"MaxBlockSize": 262144}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO MaxBlockSystemFee is not set or wrong, setting default value {"MaxBlockSystemFee": 900000000000}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO MaxTransactionsPerBlock is not set or wrong, using default value {"MaxTransactionsPerBlock": 512}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO MaxValidUntilBlockIncrement is not set or wrong, using default value {"MaxValidUntilBlockIncrement": 86400}
logger.go:146: 2024-06-04T17:08:35.263+0300 INFO Hardforks are not set, using default value
logger.go:146: 2024-06-04T17:08:35.266+0300 INFO no storage version found! creating genesis block
chain.go:227:
Error Trace: /home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/neotest/chain/chain.go:227
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/neotest/chain/chain.go:217
/home/anna/Documents/GitProjects/nspcc-dev/neo-go/pkg/services/stateroot/service_test.go:319
Error: Received unexpected error:
onPersist failed: VM has failed: at instruction 0 (SYSCALL): native contract descriptor cache is not initialized: contract c1e14f19c3e60d0b9244d06dd7ba9b113135ec3b, hardfork Default
Test: TestStateroot_GetLatestStateHeight
FAIL
coverage: 28.6% of statements
```
It happens because ActiveIn hardfork wasn't taken into account during
`latestHF` computation. This commit also removes the reusage of
`activeIn` variable in deploy procedure, it's misleading and not
necessary startign from #3444.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
According to https://golangci-lint.run/usage/linters/#govet,
`check-shadowing` no longer exists. Now it should be
```yaml
govet:
disable: [shadow]
```
but `shadow` is disabled by default. Thus, whole `govet` section is not
needed anymore.
```
$ golangci-lint --version
golangci-lint has version 1.59.1 built with go1.22.3 from 1a55854a on 2024-06-09T18:08:33Z
```
Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
This fixes
```
$ golangci-lint --version
golangci-lint has version 1.59.1 built with go1.22.3 from 1a55854a on 2024-06-09T18:08:33Z
$ golangci-lint run ./...
WARN [config_reader] The configuration option `output.format` is deprecated, please use `output.formats`
```
The configuration file is updated according to
https://golangci-lint.run/usage/configuration/.
Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
It's needed to give user a hint about what's wrong with the witness
during `calculatenetworkfee` RPC request processing.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This code was accidentally removed by
https://github.com/nspcc-dev/neo-go/pull/3477, it's important to have
these fields set by default.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit adds a single test that covers the
previously uncovered branch in the mptdata
decoding algorithm.
Signed-off-by: Furetur <furetur@gmail.com>
Refs #3415
This commit introduces a small new change
that implements the Hooks API and more
specifically the OnExecHook. This feature
can be used to implement test coverage
collection, tracing, breakpoints, and etc.
To be more specific, this commit:
1. adds a new `hooks` field to the `VM`
(this field contains the OnExecHook
function)
2. sets the default value of this hook
to be a NOP function
3. adds the `VM.SetOnExecHook` method
Signed-off-by: Furetur <furetur@gmail.com>
If `config-path` is not passed, default configs are used according to
the set network. In VM CLI the default privnet config with InMemory db
is used.
Close#3450Close#3459
Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
Signers are very important for notary checks and keeping/passing an additional
copy of them is very inconvenient. Exposing them from invoker makes them
available in actors too.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Most of the time people are interested in successful executions. Unfortunately,
unwrap package can't help here because of a different result structure (some
interface abstract can help, but it's still mostly stack-oriented and sessions
can be a problem), so this additional interface is needed.
Signed-off-by: Roman Khimov <roman@nspcc.ru>
Add a note about System.Runtime.GetNotifications refcounting to Domovoi
hardfork. Ref. https://github.com/neo-project/neo/pull/3301 and
https://github.com/nspcc-dev/neo-go/pull/3485.
Although NeoGo doesn't have anything to be updated, there's a
behaviour difference between C# and Go nodes before Domovoi hardfork, it
deserves a comment.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
It's not correct to use an updated contract state got from Management to
check for the allowed method call. We need to use manifest from the
currently executing context for that. It may be critical for cases when
executing contract is being updated firstly, and after that calls
another contract. So we need an old (executing) contract manifest for
this check.
This change likely does not affect the mainnet's state since it's hard
to meet the trigger criteria, but I'd put it under the hardfork anyway.
Ref. https://github.com/neo-project/neo/pull/3290.
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>