Commit graph

5603 commits

Author SHA1 Message Date
Evgeniy Stratonikov
304900e765 compiler: improve debugging experience
Currently one instruction can correspond to multiple sequence points
because of inlining. This leads to a bad user experience as only
the last one is used. In this commit we create a sequence point for each
inlined call and also make sure that each time a new sequence point is
created the corresponding opcode can easily be seen in code.

The NOPs increase contract size, but not to a large degree. Other
solutions considered:
1. Discard NOPs if a special flag is provided. Still leads to bad
   debugging experience if deployed contract differs from the debugged
   one.
2. Create an issue for a debugger. When multiple sequence points are
   provided for a single instruction they can be used to emulate
   non-inline behaviour with pseudo-NOPs. I believe this is what windows
   debugger does (the last paragraph https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/debugging-optimized-code-and-inline-functions-external )
3. Emit debug info for inlined functions even without creating a
   function in the NEF itself. This should be done for each called
   instance and would also create overlapping opcode ranges for
   the enclosing function. However this approach can also ensure
   consistent values view for inlined function parameters.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-14 13:48:24 +03:00
Roman Khimov
6ff11baa1b
Merge pull request #2427 from nspcc-dev/add-hash-to-debug-info
Add hash to debug info and use absolute path
2022-04-06 16:11:47 +03:00
Roman Khimov
f5d5019b70 compiler: use absolute paths for debug data
It's not a perfect thing, but neo-debugger just doesn't work at all with
relative pathes. Notice that `saveSequencePoint` still used absolute ones
leading to invalid debug.json data, but fixing it there doesn't help,
neo-debugger can't load source code using relatives.
2022-04-06 15:46:54 +03:00
Roman Khimov
e390981747 compiler: add hash field to debug info
New debugger won't work without it.
2022-04-06 15:27:01 +03:00
Roman Khimov
017326dca4
Merge pull request #2417 from nspcc-dev/interop-update
*: natives update
2022-04-05 19:02:59 +03:00
Roman Khimov
0c3327af25
Merge pull request #2426 from nspcc-dev/notary-ignore-erralreadyexists
cli/server: don't spit out error if notary request already exists
2022-04-05 18:41:17 +03:00
Roman Khimov
2c16e042cd cli/server: don't spit out error if notary request already exists
It could be sent by another actor and that's OK.
2022-04-05 17:37:17 +03:00
Roman Khimov
bdcb527ead
Merge pull request #2420 from nspcc-dev/fix-ws
rpc: avoid panic on double-call to *WSClient.Close()
2022-04-05 16:41:51 +03:00
Roman Khimov
1cd1fd1a79
Merge pull request #2424 from nspcc-dev/fix-notary-size-caching
services: avoid changes in mempooled main notary tx
2022-04-05 16:39:12 +03:00
Anna Shaleva
850f56b367 rpc: avoid panic on double-call to *WSClient.Close()
Although it's the caller's duty to avoid WSClient re-closing, we
still can handle it.

Fixes the following neofs-node error:
```
panic: close of closed channel

goroutine 98 [running]:
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*WSClient).Close(...)
        github.com/nspcc-dev/neo-go@v0.98.3-pre.0.20220321144433-3b639f518ebb/pkg/rpc/client/wsclient.go:120
github.com/nspcc-dev/neofs-node/pkg/morph/subscriber.(*subscriber).Close(0x13)
        github.com/nspcc-dev/neofs-node/pkg/morph/subscriber/subscriber.go:108 +0x29
github.com/nspcc-dev/neofs-node/pkg/morph/event.listener.Stop(...)
        github.com/nspcc-dev/neofs-node/pkg/morph/event/listener.go:573
created by github.com/nspcc-dev/neofs-node/pkg/innerring.(*Server).Stop
        github.com/nspcc-dev/neofs-node/pkg/innerring/innerring.go:285 +0x12f
```
2022-04-05 16:31:51 +03:00
Anna Shaleva
5771bbb52a services: fix changing of main tx size of Notary request 2022-04-05 16:00:12 +03:00
Anna Shaleva
72ec354039 compiler: add test for murmur32 interop API 2022-04-05 10:51:12 +03:00
Anna Shaleva
9dcceadab6 examples: update neo-go dependency 2022-04-05 10:50:50 +03:00
Anna Shaleva
7b5ff25a40 gomod: update interop dependency 2022-04-05 10:49:10 +03:00
Anna Shaleva
16f952270c core: add murmur32 to CryptoLib native contract
Close #2415.
2022-04-05 10:46:52 +03:00
Anna Shaleva
0e8bf83dda compiler: add tests for GetTransactionVMState 2022-04-05 10:46:52 +03:00
Anna Shaleva
31aa90d6b5 examples: update neo-go dependency 2022-04-05 10:46:11 +03:00
Anna Shaleva
5388c895d2 gomod: update interop version 2022-04-05 10:39:58 +03:00
Anna Shaleva
b431e47d2a core: add GetTransactionVMState to native Ledger contract
Close #2343.
2022-04-05 10:37:02 +03:00
Anna Shaleva
4254407a9b dao: add GetTxExecResult method 2022-04-05 10:36:50 +03:00
Anna Shaleva
18c5f638b9 dao: adjust usages of Internal DB inconsistency error 2022-04-04 19:16:58 +03:00
Roman Khimov
20c0e2f2e2
Merge pull request #2416 from nspcc-dev/interop-license
interop: add a physical copy of LICENSE.md
2022-04-04 14:25:30 +03:00
Anna Shaleva
2972569a0a vm: make byte representation of VMState compatible with C# 2022-04-04 13:52:29 +03:00
Anna Shaleva
6343720adf dao: return ErrKeyNotFound from GetAppExecResults for dummy txs
Otherwise decoding error may be returned which can be misleading.
2022-04-04 12:49:52 +03:00
Roman Khimov
7b3cc27b5f LICENSE.md: add NSPCC copyright 2022-04-04 12:34:18 +03:00
Anna Shaleva
9a41356a3b core: add getUint256FromItem helper to native ledger 2022-04-04 12:33:29 +03:00
Roman Khimov
3f57ff76ab interop: add a physical copy of LICENSE.md
Seems like pkg.go.dev can't pick it up from the symlink.
2022-04-04 12:32:17 +03:00
Roman Khimov
4c80de3afb
Merge pull request #2405 from ixje/patch-1
Update generate-wrapper usage text to reflect requirements
2022-04-01 18:47:29 +03:00
Roman Khimov
2d60d4021b
Merge pull request #2413 from nspcc-dev/smartcontract-big-numbers
smartcontract: allow to use `*big.Int` numbers for integers
2022-04-01 10:38:33 +03:00
Roman Khimov
4e375fd8f4
Merge pull request #2414 from nspcc-dev/eliminate-getstorageitems
Eliminate GetStorageItems
2022-04-01 09:16:42 +03:00
Evgeniy Stratonikov
739db259e3 smartcontract: remove unused ParameterFromStackItem
It is exists from the times we used `smartcontract.Parameter` somewhere
in the `NotificationEvent`/`ApplicationLog`. `stackitem.ToJSON` now
handles this.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
fe0cd5fe32 smartcontract: remove EncodeBinary for Parameter
It seems, we don't use it anywhere.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:35 +03:00
Evgeniy Stratonikov
0b0d39f797 smartcontract: allow to use *big.Int numbers for integers
Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
2022-04-01 08:38:34 +03:00
Roman Khimov
c12a3b71d4 dao: drop GetStorageItems* APIs
They're just adding another useless caching layer to the Seek.
2022-03-31 19:18:51 +03:00
Roman Khimov
60375e9db3 core: drop GetStorageItems interface
It's not used and not useful.
2022-03-31 16:46:41 +03:00
Roman Khimov
3ab2ab5cba core: drop outdated comment from storageFind 2022-03-31 16:39:11 +03:00
Roman Khimov
df2bca0f40
Merge pull request #2393 from nspcc-dev/core/refactor-TestCreateBasicChain
*: rebase core tests onto neotest
2022-03-31 15:29:09 +03:00
Anna Shaleva
8965441288 core: rebase core tests onto neotest 2022-03-30 19:00:53 +03:00
Anna Shaleva
35ef58a47e core: move Oracle response script creation to a separate function 2022-03-30 18:59:43 +03:00
Anna Shaleva
35590f0c96 circleci: update cache key to avoid fetching outdated cache
Avoid the following problem:
```
Found a cache from build 55879 at deps-
Size: 178 MiB
Cached paths:
  * /go/pkg/mod

Downloading cache archive...
Validating cache...

Unarchiving cache...

Failed to unarchive cache

Error untarring cache: Error extracting tarball /tmp/cache87609141 : tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go/@v: Cannot mkdir: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go/@v/list: Cannot open: No such file or directory tar: go: Cannot mkdir: Permission denied tar: go/pkg/mod/cache/download/cloud.google.com/go/@v/list.lock: Cannot open: No such file or directory tar: go: Cannot mkdir: Pe: exit status 2
```
2022-03-30 12:18:01 +03:00
Anna Shaleva
a4dab3a5ba core: adjust error message of native call 2022-03-30 12:18:01 +03:00
Anna Shaleva
59f3fa1ef1 neotest: adapt framework to work with *testing.B 2022-03-30 12:17:55 +03:00
Anna Shaleva
ff13af804d core: adjust persist-related Blockchain tests
`newTestChain` runs blockchain, so persist is likely already happened
before the first test iteration. Explicit call to persist makes no sence
here.
2022-03-30 11:46:44 +03:00
Anna Shaleva
28e936eb95 core: export GetMaxNotValidBeforeDelta blockchain API
Mostly for tests, but it can also be useful as a separate API.
2022-03-30 11:46:44 +03:00
Anna Shaleva
e0ab4ec6f0 core: adjust helper test contract
Method is allowed to have single return value on stack after its invocation.
Make sure that test contract follows this rule.
2022-03-30 11:46:44 +03:00
Anna Shaleva
9dd43583e0 core: fix helper test contract
Second management helper contract should have valid ABI (at least one method should
be mentioned in the ABI).
2022-03-30 11:46:44 +03:00
Anna Shaleva
13252bb941 core: refactor helper test contracts generation
* Move generator to a separate package.
* Move loader to a separate package and get rid of the code duplications.
2022-03-30 11:46:29 +03:00
Anna Shaleva
889a7ec378 rpc: regenerate basic chain and adjust RPC server tests 2022-03-30 11:32:30 +03:00
Anna Shaleva
4a74c117ee *: refactor TestCreateBasicChain and its dependencies
Close #2355
2022-03-30 11:32:26 +03:00
AnnaShaleva
3b45325319 neotest: extend multichain constructor 2022-03-29 15:01:10 +03:00