Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm: minor C# compatibility fixes #1874

Merged
merged 3 commits into from
Mar 31, 2021
Merged

vm: minor C# compatibility fixes #1874

merged 3 commits into from
Mar 31, 2021

Conversation

AnnaShaleva
Copy link
Member

Does not affects states.

This PR includes the following fixes:

  1. More detailed error message during SYSCALL invocation
  2. System.Runtime.Notify refactoring
  3. THROW opcode handling refactoring

@AnnaShaleva AnnaShaleva added the bug Something isn't working label Mar 31, 2021
@roman-khimov roman-khimov added this to the v0.94.1 milestone Mar 31, 2021
pkg/vm/vm.go Outdated Show resolved Hide resolved
pkg/vm/vm.go Outdated Show resolved Hide resolved
It's convinient to know the failing syscall without dumping
smartcontract instructions.
@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #1874 (e8e13da) into master (1bd3ee2) will increase coverage by 0.08%.
The diff coverage is 72.22%.

❗ Current head e8e13da differs from pull request most recent head f57187e. Consider uploading reports for the commit f57187e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1874      +/-   ##
==========================================
+ Coverage   83.03%   83.11%   +0.08%     
==========================================
  Files         286      286              
  Lines       22661    22676      +15     
==========================================
+ Hits        18816    18847      +31     
+ Misses       2657     2639      -18     
- Partials     1188     1190       +2     
Impacted Files Coverage Δ
pkg/vm/vm.go 93.92% <68.75%> (-0.39%) ⬇️
pkg/core/interop/runtime/engine.go 100.00% <100.00%> (ø)
pkg/network/server.go 71.49% <0.00%> (+0.14%) ⬆️
pkg/services/notary/notary.go 92.42% <0.00%> (+1.01%) ⬆️
pkg/services/oracle/request.go 55.64% <0.00%> (+6.45%) ⬆️
pkg/services/oracle/oracle.go 90.58% <0.00%> (+11.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bd3ee2...f57187e. Read the comment docs.

The result is the same HALT state, but the exception message is the real
one got from user. Changes ported from C#:

1. Throw exception: https://github.com/neo-project/neo-vm/blob/59b8ac73d285aa9d607aee53eeadde82fcba9324/src/neo-vm/ExecutionEngine.cs#L1448
2. Prettify message: https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/VMUnhandledException.cs#L28

The result is that instead of
```
2021-03-31T17:02:54.508+0300	WARN	contract invocation failed	{"tx": "2aefeb705f3a609df8767d9b45e036b9dd1eb77407e5732375981915668889b8", "block": 30640, "error": "error encountered at instruction 970 (THROW): runtime error: invalid memory address or nil pointer dereference"}
```

we'll get
```
2021-03-31T17:33:56.299+0300	WARN	contract invocation failed	{"tx": "2aefeb705f3a609df8767d9b45e036b9dd1eb77407e5732375981915668889b8", "block": 30640, "error": "error encountered at instruction 970 (THROW): unhandled exception: No authorization."}
```
in the node logs.
@roman-khimov roman-khimov merged commit 218fa70 into master Mar 31, 2021
@roman-khimov roman-khimov deleted the fix-states-diff branch March 31, 2021 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants