-
Notifications
You must be signed in to change notification settings - Fork 632
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
Upgrade the downcasting of RuntimeError
in Wasmer
#2316
Comments
If we put Runtime errors into 2 categories:
This is where we make a decision on the category: Deterministic errors:
Non-deterministic:
All deterministic errors are considered as a valid FunctionCall outputs. Is everything correct so far? |
RuntimeError
in WasmerRuntimeError
in Wasmer
These tests are still returning "unknown" errors from Wasmer ( |
FYI @olonho We have a lot of complexity around error handling in Wasm that you should be aware of. |
Added more context here: wasmerio/wasmer#1338. For now let's keep unknown error, since we don't have sharding and slashing it will not cause slashing. I asked Wasmer to prioritize it. Closing this issue since we #2055 |
But even with a single shard, why couldn't this cause state to diverge? |
Great question! I guess, the logic is the following: imagine, there is no guarantee that (due to internal errors) node producer is not following the protocol (it could be an internal error). It means that it will produce non-valid block (since the healthy validators output will be deterministic). The assumption that the non-valid blocks will be ignored by the subsequent block producers (validators). But I don't know the specific details of how block producers behave in this case, so this is an open question for me too. |
@fckt what you said is true, but it may cause the network to diverge when more than 1/3 block producers have the same post state root while the rest has another. It can cause the network to stall for quite a while if that happens. Actually if an attacker finds a way to leverage this non-determinism it is possible that they can stall the network indefinitely. |
Right now we can't do anything. Wasm spec defined as deterministic (with exceptions we eliminated). The problem is that we can't separate Internal Wasmer (and internal host) errors from Wasm traps and Host logic errors today.. This issue is only about updating Wasmer. We hoped it will solve the problem. But it's not, due to bug in Wasmer - it doesn't return ExceprionCode's in the relevant cases (#2316 (comment)). |
Currently we are printing an error when we cannot downcast
RuntimeError
into the error type that we return through the host functions: https://github.com/nearprotocol/nearcore/blob/a08944db6672185618e2454fce5e7be0e327b47a/runtime/near-vm-runner/src/errors.rs#L78The printed error also says that the output is non-deterministic.
As of
0.14.0
Wasmer returnsExceptionCode
there that we can try to downcast to. We should switch to this downcasting and also do not print that the output is non-deterministic anymore.The text was updated successfully, but these errors were encountered: