Skip to content
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

[Counterfactual] Show notification when submitting counterfactual tx #3226

Merged
merged 10 commits into from
Feb 12, 2024

Conversation

usame-algan
Copy link
Member

@usame-algan usame-algan commented Feb 8, 2024

What it solves

Resolves #

How this PR fixes it

  • Closes the deploy safe tx-flow when submitting the transaction
  • Shows a notification when submitting the deploy safe transaction
  • Shows an info screen on the first-tx + deploy flow breaking down the cost of the transaction
  • Fixes an issue where the counterfactual state was cleared even if the transaction failed
  • Estimates the actual gas costs of the signed transaction and uses that instead of what useDeployGasLimit returns

How to test it

  1. Create a counterfactual safe
  2. Choose the Activate now option from settings
  3. Submit the transaction
  4. Observe the modal closes
  5. Observe there is a notification
  6. Deploy the safe with the first transaction
  7. Observe there is an info screen visible
  8. Cancel the transaction in your wallet
  9. Observe an error notification shown
  10. The counterfactual state should not be cleared in that case

Screenshots

Screenshot 2024-02-08 at 17 54 18 Screenshot 2024-02-09 at 12 29 55

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@usame-algan usame-algan changed the title [Counterfactual] Show notification when submitting counterfactual tx and break d… [Counterfactual] Show notification when submitting counterfactual tx Feb 8, 2024
Copy link

github-actions bot commented Feb 8, 2024

Copy link

github-actions bot commented Feb 8, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Feb 8, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.02 MB (🟡 +234 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Two Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/home 41.17 KB (🟡 +14 B) 1.06 MB
/settings/setup 72.04 KB (🟡 +102 B) 1.09 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented Feb 8, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.87% (+0.02% 🔼)
11479/14555
🔴 Branches
56.69% (+0.14% 🔼)
2556/4509
🟡 Functions
63.58% (+0.03% 🔼)
1824/2869
🟢 Lines
80.18% (+0.03% 🔼)
10355/12915
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / utils.ts
46.34% (-0.23% 🔻)
21.05% (-9.72% 🔻)
30%
47.3% (+1.03% 🔼)

Test suite run success

1398 tests passing in 189 suites.

Report generated by 🧪jest coverage report action from d83ce80

)}{' '}
{chain?.nativeCurrency.symbol}
</strong>
. This is an estimation and the final cost can be slightly higher.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
. This is an estimation and the final cost can be slightly higher.
. This is an estimation and the final cost can be higher.

<Divider className={commonCss.nestedDivider} sx={{ pt: 3 }} />

Copy link
Member

@katspaugh katspaugh Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Waren gut, diese.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also happened another time but I can't figure out how they are deleted. Afaik we don't have any lint or prettier rules to remove these...

variant: 'info',
groupKey: 'cf-activate-account',
message: 'Transaction submitted',
detailedMessage: 'Your Safe Account will be deployed on-chain after the transaction has been executed.',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
detailedMessage: 'Your Safe Account will be deployed on-chain after the transaction has been executed.',
detailedMessage: 'Your Safe Account will be deployed onchain after the transaction is executed.',

src/features/counterfactual/CounterfactualForm.tsx Outdated Show resolved Hide resolved
@@ -65,8 +67,11 @@ export const dispatchTxExecutionAndDeploySafe = async (

const deploymentTx = await sdkUnchecked.wrapSafeTransactionIntoDeploymentBatch(signedTx, txOptions)

// We need to estimate the actual gasLimit after the user has signed since it is more accurate than what useDeployGasLimit returns
const gas = await signer.estimateGas({ data: deploymentTx.data, value: deploymentTx.value, to: deploymentTx.to })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we compare this to the estimation and give a prompt / warning if the difference is more than e.g. 50k gas?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea but this would only happen after the user has pressed Sign in their wallet. I am not sure how helpful it would be to see a warning somewhere in our UI at that point so I would leave it out for now and hope there are no substantial differences between those first transactions. Worst case we have the info text to warn the user about higher cost on execution.

src/features/counterfactual/hooks/useDeployGasLimit.ts Outdated Show resolved Hide resolved
Copy link

github-actions bot commented Feb 9, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@francovenica
Copy link
Contributor

Issue/Question:
1 - In this PR I cannot create a tx. I tried send funds and adding owners, but they always fail. I tried increasing the gas fee, but is to no avail.
Are regular tx working? I always get the same error. I want to verify the kind of notifications I see when I execute a send funds tx but currently I can't.
image

@usame-algan
Copy link
Member Author

In this PR I cannot create a tx. I tried send funds and adding owners, but they always fail. I tried increasing the gas fee, but is to no avail.

There was a small issue with our last commit but I just pushed a small fix. It should work again now.

@francovenica
Copy link
Contributor

I can execute tx like adding/swapping owners.

Some feedback (we can discuss what is possible to change or not)

  • When you execute the "Activate safe" tx, you get this notification, which is fine, but you have to click in the details to see the text and also in the list of notifications you cannot see the messege, since there is no "details" link to click, you only see a "transaction submitted" which it can be anything.
    (This one is fine, but you got to click on details, a minor feedback)
    image

This is the same tx, but saying just "tx submitted" doesn't describe that this was the tx that deployed the safe
image

  • Once the tx that deploys the safe is finally processed and fully executed, I'd expecte a green card notification saying "success" or something. Right now no notification shows up once the safe is finally deployed

  • When I execute a tx like swap owner. I only get only the notificaton of "check in blockexplorer" which is the one deploying the safe, but there is no message implying this for the user. I'd expect here for the notification I showed earlier to show up (The "your safe account will be deployed...." notification)
    image

@usame-algan
Copy link
Member Author

usame-algan commented Feb 12, 2024

When you execute the "Activate safe" tx, you get this notification, which is fine, but you have to click in the details to see the text and also in the list of notifications you cannot see the messege

I adjusted the wording to be more specific
Screenshot 2024-02-12 at 09 34 45

Once the tx that deploys the safe is finally processed and fully executed, I'd expecte a green card notification saying "success" or something. Right now no notification shows up once the safe is finally deployed

This didn't work because we usually show the green "Success" notification when we detect the transaction in the history which we can't for these transactions because they don't have a txId. I changed it to show the success event instead of the processed event when the transaction is successfully executed and when we clear the counterfactual state.

@liliya-soroka
Copy link
Member

liliya-soroka commented Feb 12, 2024

@usame-algan , I don't see success notification after the safe was activated :
activate safe using owner wallet
image

@usame-algan
Copy link
Member Author

I don't see success notification after the safe was activated :

Thanks, I added a success notification there as well.

@liliya-soroka
Copy link
Member

Verified

@usame-algan usame-algan merged commit 32747ba into dev Feb 12, 2024
14 of 15 checks passed
@usame-algan usame-algan deleted the cf-deployment-info branch February 12, 2024 13:15
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants