Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Failed transactions with safeTxGas 0 seem stuck to users #3126

Open
mmv08 opened this issue Dec 7, 2021 · 10 comments
Open

Failed transactions with safeTxGas 0 seem stuck to users #3126

mmv08 opened this issue Dec 7, 2021 · 10 comments
Labels
effort-mid Medium-effort issues Enhancement ✨ Minor Improvement / changes to existing functionality

Comments

@mmv08
Copy link
Member

mmv08 commented Dec 7, 2021

Background story

A user popped up on discord and asked if there were any problems with indexing on the backend because the execution transaction failed with GS013 (Safe 1.3.0, safeTxGas 0), but the status wasn't reflected in the UI. So we had to tell them to replace/cancel a transaction.

Overview

Our previous setup with 1.3.0 and 1.1.1 would always use the Safe nonce and move the transaction to the "History" tab regardless of whether it was successful or not.

Goals

Requirements

Screens

  • Figma:
  • Zeplin:

Technical background

  • Backend only indexes state-changing transactions
    State-changing means a transaction made a change to the Safe contract (e.g., increases the nonce)

  • With 1.3.0 contracts and safeTxGas 0, the internal transaction is required to be successful to change the Safe smart contract state (nonce)
    https://github.com/gnosis/safe-contracts/blob/main/contracts/GnosisSafe.sol#L180
    We did it to improve gas limit estimation because the way the estimation works is it tries to simulate the transaction and increases the gas limit until the transaction is successful (successful = doesn't throw any exceptions). With safe 1.1.1 (and previous 1.3.0 setup), in any case, a transaction would be state-changing and use Safe nonce, but the underlying transaction would fail. With 1.3.0, there is a require statement in the smart contract, and such statement reverts all the changes if an exception is thrown

@katspaugh
Copy link
Member

In #2911, Aaron added a function that grabs the last (?) error code from the Safe contract. Maybe we could use that to show an error message to the user.

@iamacook
Copy link
Member

iamacook commented Dec 7, 2021

If I understand @mikheevm, it sounds like an error notification was shown to the user.

It's strange that the transaction location didn't change if that was the previous behaviour. saveTxToHistory() is not called inside the catch statements of create/processTransaction(). Maybe we could simply include that to fix this?

@mmv08
Copy link
Member Author

mmv08 commented Dec 7, 2021

it sounds like an error notification was shown to the user

Yes, it should've been shown. But the problem is mostly about what to do after the notification. Previously such transactions would disappear from history and consider execute because it'd change the Safe nonce, now it stays in the queue

It's strange that the transaction location didn't change if that was the previous behaviour. saveTxToHistory() is not called inside the catch statements of create/processTransaction(). Maybe we could simply include that to fix this?

The thing is that the current behaviour is expected because of how Ethereum works under the hood and our back-end indexes.

@iamacook
Copy link
Member

iamacook commented Dec 7, 2021

Odd that it didn't show. I guess this ticket will also require looking into the error notifications as well then.

Do you have details of the transaction in question?

@mmv08
Copy link
Member Author

mmv08 commented Dec 7, 2021

Odd that it didn't show

It's not odd, this is expected because the backend only indexes transactions that make state changes to the contract. This transaction didn't make any changes because it reverted.

@katspaugh katspaugh added the Enhancement ✨ Minor Improvement / changes to existing functionality label Dec 9, 2021
@katspaugh
Copy link
Member

According to German, this was fixed on the Core SDK side, and we'll use the SDK for this estimation.
See #3075.

@katspaugh
Copy link
Member

@liliya-soroka says:

We should display a warning for the user that they should replace or cancel this tx.

@katspaugh katspaugh added the effort-mid Medium-effort issues label Feb 3, 2022
@katspaugh katspaugh added the Bug 🐛 Something isn't working label Apr 21, 2022
@johannesmoormann
Copy link

If the error message is shown, this is not a bug but an educational issue for the behavior of failing txs without state change.

@johannesmoormann johannesmoormann removed the Bug 🐛 Something isn't working label Apr 27, 2022
@liliya-soroka
Copy link
Member

Current result: #3772 - The general error "unable to decode contract error message" is displayed instead of GS013
Still not sure if such a message is recognised by the users as contract level problem instead of our back-end issue

@DiogoSoaress
Copy link
Member

Still not sure if such a message is recognised by the users as contract level problem instead of our back-end issue

We went for that generic message in the notification because we found GS013 misleading. However there is more complete information in the console. We also agreed that Notifications will be revisited in safe-global/safe-pm#83 so maybe we can drop there suggestions or feedback.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort-mid Medium-effort issues Enhancement ✨ Minor Improvement / changes to existing functionality
Projects
None yet
Development

No branches or pull requests

6 participants