-
Notifications
You must be signed in to change notification settings - Fork 305
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
mock-consensus: 1️⃣ report non-zero status codes as errors #3876
Comments
No, I think that's the correct behavior — DeliverTx is fallible. Blocks can include transactions that fail to execute (and this has to be the case, because prior to PrepareProposal there's no way for the application to control transaction inclusion). |
do you think that this should include the i expect that in the majority of "happy path" cases, we would want to know about a transaction that failed to execute, right? for test cases that do want to send an invalid transaction to the app, they could still rely on the |
I'm not sure — and I'm not sure we should overthink it, since if we move to current ABCI this interface all changes anyways. One question I have is, why is it important for a test to know whether the transaction succeeded or not? Wouldn't we want to be writing assertions about the effects of the transaction, rather than reliance on a self described success code? And in that case do we need this anyways? For instance, in the spend case, wouldn't we want to write an assertion that, following the block, the nullifier is present in the state, that the MockClient detects the new output note, etc? |
Well, it's less about whether it's the correct choice in one or the other context, and more that it's the behavior specified by ABCI. A failed transaction is not an error. It's an Ok(I rejected this), at least according to ABCI. The errors bubbled up from the consensus harness should match its expected behavior.
Yes, to be clear, I absolutely want this burden to be placed on test writers. It is required for the tests to be meaningful. Our goal is to ensure that when we do X, we see effect Y. The value of the test is having to write down an executable specification of what the expected behavior is.
But this is even more true if we have an expectation that tests don't specify their invariants. While you discovered that the spend wasn't being performed by seeing a return code, trusting the return code is also a false sense of assurance. What if the handler didn't write the nullifier properly and still reported that execution succeeded?
Yes, invalid transactions are expected to be handled by any ABCI application, including ours. We should not be defining our own new set of semantics. We don't get benefit from doing so, because it's already handled by the stronger assertions we need to be writing, and because this API is one we want to migrate away from anyways. |
in #3866, i noticed that a non-zero status code in the response is not reported as an error in tests. see this log:
we should make sure that this results in an error when calling
BlockBuilder::execute
.The text was updated successfully, but these errors were encountered: