Fix isSuccess
always returning true, even if transaction fails
#826
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
馃敆 Related Issue: #819
This PR addresses the following improvements:
The problem was that the
transactionStatus
query checks if a transaction has been successfully broadcasted and included in a block. However, when a zkApp transaction fails, it is still technically included in a block but without applying any updates.isSucess
checks for initial request errors, and if the transaction is broadcasted, then it's true.Consequently, the
transactionStatus
query reports that the transaction has been included, leading to.wait()
succeeding andisSuccess
status of true since it was broadcasted correctly. Using thebestChain
query to verify applied zkApp transactions, we can more accurately determine if AccountUpdates have failed and identify the reason for the failure. If we call.wait()
, and a transaction fails, an error is thrown.Lastly, this PR enhances the error messages for better user experience and understanding.
Testing
This PR was manually tested using the following script to deploy and ensure that the expected transaction (payout 2) fails and
isSucess
shows false.