ClearContracts / cardano-constitution-voting-app

Voting app to be used by delegates at the Cardano Consitution Convention in Buenos Aires to ratify the initial constitution. This voting app was commissioned by Intersect.
https://cardano-constitution-voting-app.vercel.app
GNU Affero General Public License v3.0
0 stars 0 forks source link

Improve error handling of TX signing #152

Closed mattlaux closed 5 days ago

mattlaux commented 5 days ago

In the first iteration of TX signing, there was not too much in the way of error handling. It simply had a while loop. If there was an error it would just request a new TX from the CO.

A couple of issues with this:

Now instead of a while loop, it will give the CO a detailed error message. They can then handle the error in the recommended way. And then pick up uploading votes on-chain from where the error was encountered.

Example of error toast if building the TX fails.: Screenshot 2024-11-20 at 6 31 36 PM This error case is pretty straight-forward as nothing was put on-chain. So we can have them create a new TX to be signed.

Example of error toast if TX successfully uploads on-chain but saving the TX ID to the DB fails: Screenshot 2024-11-20 at 5 26 27 PM This error case is significantly more difficult to handle. As the data is now on-chain, we do not want to just create and sign a new TX with the same metadata as this would create duplicate vote records on-chain. Instead, the CO receives an error toast with the TX ID and a message that it needs to manually be added to the DB.

This will require us to have SQL scripts ready to go, that can accept the TX ID and the associated metadata, and quickly update the DB records with that TX ID. The CO can then re-click the upload votes button and continue from where the error was encountered.

The good news is that it is highly unlikely this case will be encountered. But we should be prepared to handle it just in case.

I created a custom error toast for this message since it is an important message. It will stay on-screen until the CO dismisses it. We can always adjust the UI if we want since it isn't the prettiest.

vercel[bot] commented 5 days ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cardano-constitution-voting-app-mainnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 1:17am
cardano-constitution-voting-app-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 21, 2024 1:17am