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

Fix: make safe app id an int #3722

Merged
merged 6 commits into from
May 16, 2024
Merged

Fix: make safe app id an int #3722

merged 6 commits into from
May 16, 2024

Conversation

katspaugh
Copy link
Member

What it solves

Custom Safe Apps get a random id which might be a problem when validating messages.

Copy link

github-actions bot commented May 15, 2024

Copy link

github-actions bot commented May 15, 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 May 15, 2024

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

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

Eight Pages Changed Size

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

Page Size (compressed) First Load
/apps 50.04 KB (🟡 +21 B) 1.04 MB
/apps/custom 41.66 KB (🟡 +21 B) 1.03 MB
/apps/open 84.91 KB (🟡 +25 B) 1.07 MB
/balances/nfts 20.27 KB (🟡 +13 B) 1.01 MB
/home 63.61 KB (🟡 +27 B) 1.05 MB
/settings/safe-apps 25.35 KB (🟡 +14 B) 1.01 MB
/share/safe-app 10.67 KB (🟡 +12 B) 1023.05 KB
/swap 29.1 KB (🟡 +14 B) 1.02 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 May 15, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.24% (-0.03% 🔻)
11621/14666
🔴 Branches
58.14% (-0.02% 🔻)
2752/4733
🟡 Functions
66.3% (-0.01% 🔻)
1863/2810
🟢 Lines
80.59% (-0.03% 🔻)
10473/12995
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / useSyncSafeMessageSigner.ts
82% (-4.27% 🔻)
50% 62.5%
86.67% (-4.44% 🔻)
🟢
... / index.tsx
93.88% (-0.24% 🔻)
80% 75%
95.65% (-0.18% 🔻)

Test suite run success

1462 tests passing in 202 suites.

Report generated by 🧪jest coverage report action from 8b858f5

@katspaugh katspaugh requested a review from schmanu May 16, 2024 05:44
@@ -99,7 +99,7 @@ const fetchSafeAppFromManifest = async (
const iconUrl = getAppLogoUrl(normalizedAppUrl, appManifest)

return {
id: Math.random(),
id: Math.round(Math.random() * Math.pow(10, 18)),
Copy link
Member

Choose a reason for hiding this comment

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

This leads to a number space that can still include low numbers which are given to actual Safe apps.
Lets add a billion or so to the random number: id: Math.round(1_000_000_000 + Math.random() * Math.pow(10, 18)) to avoid collisions.

@katspaugh katspaugh requested review from schmanu May 16, 2024 07:00
@liliya-soroka
Copy link
Member

Verified , works with https://safe-apps-test-app.pages.dev/

@katspaugh katspaugh merged commit 33aad08 into dev May 16, 2024
14 checks passed
@katspaugh katspaugh deleted the safeapps branch May 16, 2024 11:55
@github-actions github-actions bot locked and limited conversation to collaborators May 16, 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.

3 participants