-
Notifications
You must be signed in to change notification settings - Fork 418
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
Return minimal info on errors returned to contracts #759
Comments
This would not change the contract interface, just the actual error strings returned by wasmd (which are not guaranteed in any case). It would be a breaking change for |
The error message is helpful for debugging issues but should not be used to build logic on. We could follow the ABCI model and reduce any error to their ABCI code id, indeed. That should be straight forward. Unknown errors would be redacted to "internal". With tracing flag set, we can still print the full error to the console for debugging. |
When contract A sends a message to contract B and it fails, we usually get an error message that is quite helpful for debugging (e.g message missing some field, etc). If we just replace that with We should think about this and pick one of these: A. Don't care, just lock everything down. Every error that gets sent to a contract in reply is redacted. Note that in any case, we don't redact the error messages returned over the tendermint abci interface, this is just about the errors sent into the contracts in the reply block. Also, if we don't catch the error case, these messages would probably propagate the the users anyway without passing through reply. I prefer (A) for its simplicity. |
I am in favour of B) as it could be very helpful for local development. |
I like the idea of logging this info with the --trace flag. Same behavior for the contract (redact error), but we output to the log (maybe warn level?) Since this is only for local development, they should have access to the logs. Now, if only tendermint wasn't so verbose, and you could actually find anything in those logs |
I wonder which call or code route we are talking about here. There are at least the two cases: 1. synconous queries where we have two levels of errors (
Are there other cases in IBC? The problem I see with removing the error messages emitted by other contracts is we have no error code to replace those. |
Good pont about the Querier interface, I forgot that one.
They all have some sdk error code, maybe it is just |
Yes, events are a potential issue. They have bumped those in patch releases (I think 0.42.6 -> 0.42.7 for example). But they are guaranteed to be the same on all build systems for the same version of the sdk, where error messages have been proven to be different on different OS/libc versions. I would investigate those more later. And many cases they are essential for contract functioning, while errors are only for developer debugging and not contract execution. |
IBC doesn't pass in errors. The lemma "never rely not the error string" really coming home |
I agree and would leave events as is. Just focus on error string, which provide small value and large problem error. Steps:
1 is pretty straight forward and minimal impact on dev experience. |
@ethanfrey Can we get some more insight on what kind of non-determinism this is trying to avoid? I have been spending the past several days trying to track down a smart contract bug, and it would have taken only minutes if the contract error from a SmartQuery were forwarded all the way to the transaction rather than being redacted to |
Could you please open a new issue for that. See also https://twitter.com/simon_warta/status/1615679335008030720. |
Thanks for the quick reply. Opened a new issue here: #1160 |
When discussing what information that can be returned in Interchain Accounts, we realized that error messages and events are not guaranteed to be the same on every system (they are not part of consensus).
We can safely return data and error code. They have changed events in the sdk in minor upgrades, but for the same version, it will be the same on all systems (regardless of build system).
I would start limiting what we return to the contract and for the error returned in the reply section, not include error strings, rather the error code. This will make it harder to debug, but it will remove an attack vector that has popped up unexpectedly time after time. (Not in attacks, but in issues with different build systems)
@webmaster128 what do you think about this? I know this was also a concern of yours for windows and arm64 builds.
@alpe I wonder if there is a subset of info we could safely whitelist, like messages generated from x/wasm itself that don't include strings that come from other parts of the sdk.
The text was updated successfully, but these errors were encountered: