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

feat (runtime): Wasmer ExceptionCode support #2505

Merged
merged 34 commits into from
Apr 21, 2020
Merged

Conversation

lexfrl
Copy link
Contributor

@lexfrl lexfrl commented Apr 20, 2020

On top of #2332

The PR just adds Wasmer ExceptionCode support, introduced in Wasmer 0.16. Introduces new Tx Error types, so chain/jsonrpc/res/rpc_errors_schema.json updated.

FunctionCallError::WasmUnknownError introduced.

Wasmer never returns ExceptionCode today (at least for a single-pass), that's why tests for traps return FunctionCallError::WasmUnknownError.

wasmerio/wasmer#1338

lexfrl and others added 27 commits March 27, 2020 18:48
@gitpod-io
Copy link

gitpod-io bot commented Apr 20, 2020

@lexfrl lexfrl force-pushed the fckt/wasmer-exception-code branch 2 times, most recently from a4a71b2 to e5d7efc Compare April 20, 2020 15:45
@lexfrl lexfrl force-pushed the fckt/wasmer-exception-code branch from e5d7efc to 7de946b Compare April 20, 2020 15:47
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It there a way to have tests for this?

@lexfrl
Copy link
Contributor Author

lexfrl commented Apr 20, 2020

@frol
Nice thing is that the current tests will fail when Wasmer starts return Traps (ExceptionCodes) (as it should be).

For example, when we'll updated to a fixed Wasmer version this test will fail (since the call will return VMError::FunctionCallError(FunctionCallError::WasmTrap(WasmTrap::Unreachable)) and not VMError::FunctionCallError(FunctionCallError::WasmUnknownError))). So we'll have to fix this test. The same applies to MemoryOutOfBounds and others.

@lexfrl lexfrl merged commit 2c139f4 into master Apr 21, 2020
@lexfrl lexfrl mentioned this pull request Apr 21, 2020
@bowenwang1996 bowenwang1996 deleted the fckt/wasmer-exception-code branch April 27, 2020 23:55
nearprotocol-bulldozer bot pushed a commit that referenced this pull request Apr 28, 2020
Due to wasmerio/wasmer#1409 we need to rollback Wasmer to older version. I am replacing some of Wasmer generated error with Unknown to avoid undoing too much code from this PR: #2505

After the following PR lands wasmerio/wasmer#1401 we would need to revisit error handling from Wasmer anyway. CC @fckt  

### Testing

Ran near-evm test. CI passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants