-
Notifications
You must be signed in to change notification settings - Fork 365
Display readable Safe contract errors #2911
Conversation
CLA Assistant Lite All Contributors have signed the CLA. |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
Pull Request Test Coverage Report for Build 1467862977
💛 - Coveralls |
|
E2E Tests Passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 👍
Thanks for the assessment @francovenica. I'll look into this a bit deeper. |
As I understand, module/owner interactions weren't affected in this PR. It's only about Send Funds. |
Correct. Contract error messages are only retrieved in |
@iamacook Snapshots and how to reproduce them: New Transaction > Contract interaction New Transaction > Contract interaction |
Thanks for looking into this again @francovenica. If you look at the error object, it seems as though The current code checks whether code ? `${code}: ${CONTRACT_ERRORS[code]}` : err.message I'll look into what |
I've looked into your findings some more @francovenica. We don't currently show snackbars for 'Gas estimation failed' notifications. I don't think anything needs to be changed here. What do you think? @katspaugh I am still looking into the 'Transaction failed' errors. It seems like we have been using a depricated ABI decoder. |
After discussing this through with @katspaugh, it seems like the current implementation is sufficient. I've cleaned up the code a bit, as well as added a few small fixes for other bugs I found on the way:
This is now open for testing again @francovenica, but nothing will have visually changed when compared to your original findings. For future reference: it seems as though 'Transaction failed' is occurring from within the |
const returnBuffer = Buffer.from(returnData.slice(2), 'hex') | ||
contractError = abi.rawDecode(['string'], returnBuffer.slice(4))[0] | ||
} catch (e) { | ||
contractError = e.message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should return null in this case?
And display the original tx err.
src/routes/index.tsx
Outdated
}, [location, trackPage]) | ||
|
||
// Track when pathname changes | ||
}, [location.pathname, trackPage]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Please add the search too.
ESLint Summary View Full Report
Report generated by eslint-plus-action |
I tried again and I have the same results as my previous comment I was ok having the errors at least popping up in the console, like I showed in this comment: Also, the Acceptance criteria of this ticket I believe, was to show in the snackbar all the GS error messages, but after all the discussions we had with Aaron and Ivan it seems that's not possible. |
@francovenica a simple question, does this PR make the situation better or worse? Does it introduce new bugs? |
@francovenica, I am unable to find the root cause of why that specific log is no longer showing. As discussed, the contract errors that occur during the creation/processing of transactions are now displayed as we agreed in our group call. Other error messages may be present in the notifications middleware, as explained in my above comment. I feel like this this PR is now getting out of hand. In order to show all errors, this will require a great deal more of research/trial and error. I think it should be split into two further tickets:
Please can you also give your opinions @katspaugh @johannesmoormann |
I think the AC's specified in the description (see the Scope section) are met. We explicitly say that not all GS errors would be caught. The disappearance of the log bothers me, but I think the improvements outweigh this. Merging now. Edit: @francovenica I do get your point and appreciate your diligence. As the reporter, I accept this ticket while being aware of the things you mentioned. |
agree with @katspaugh and his decision. if we want to spend more time on this issue, it needs to be rediscussed, as the implementation already took some considerable time compared to the effort that was originally estimated. |
What it solves
Resolves #2804
How this PR fixes it
Errors returned from the contract are verified against the
CONTRACT_ERRORS
map and, if found, displayed in a snackbar notification.A map of errors codes-messages was added and a decoding function created. If an if found, it returns
[CODE]: [MESSAGE]
otherwise the message. Thenotification
object increateTransaction
/processTransaction
was moved to facilitate adding the returned error.How to test it
Trigger a contract-level error and await a notification which should contain the formatted message, i.e.
Screenshots