safe-global / safe-wallet-web

Safe{Wallet} – smart contract wallet for Ethereum (ex-Gnosis Safe multisig)
https://app.safe.global
GNU General Public License v3.0
311 stars 360 forks source link

Fix: ignore nonce for risk scanning requests #3854

Closed katspaugh closed 1 week ago

katspaugh commented 2 weeks ago

What it solves

Tx nonce is updated in real-time when creating a new transaction. At first it takes the Safe nonce, then a recommended nonce is fetched and the safeTx object is updated with that.

This triggers two risk scanning requests where the only difference is the nonce.

How this PR fixes it

Since the risk API doesn't seem to care about nonces, I made it always send 0, as well as memoizing the payload as JSON.

Screenshot 2024-06-20 at 11 45 40

How to test it

On prod (so without this fix):

On this branch:

github-actions[bot] commented 2 weeks ago

Branch preview

⏳ Deploying a preview site...

github-actions[bot] commented 2 weeks ago

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

Report generated by eslint-plus-action

github-actions[bot] commented 2 weeks ago

πŸ“¦ Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. πŸ€–

πŸŽ‰ Global Bundle Size Decreased

Page Size (compressed)
global 1003.75Β KB (-2Β 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!

github-actions[bot] commented 2 weeks ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
79.16% (+0.01% πŸ”Ό)
11559/14602
πŸ”΄ Branches
58.32% (+0.02% πŸ”Ό)
2792/4787
🟑 Functions
66.13% (+0.01% πŸ”Ό)
1851/2799
🟒 Lines
80.48% (+0.01% πŸ”Ό)
10419/12946

Test suite run success

1444 tests passing in 199 suites.

Report generated by πŸ§ͺjest coverage report action from 8897eb370b01fcc93ed25f79a8d9166bb0122286

liliya-soroka commented 1 week ago

Verified. The regression run is also passed. one failed case related to the tooltip for remove owner can be ignored ( not related to the fix)