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

Feat: upgrade to 1.4.1 #4645

Merged
merged 15 commits into from
Dec 19, 2024
Merged

Feat: upgrade to 1.4.1 #4645

merged 15 commits into from
Dec 19, 2024

Conversation

katspaugh
Copy link
Member

@katspaugh katspaugh commented Dec 12, 2024

What it solves

This PR contains the changes from #4642

  • Use the now audited Safe_migration contract to migrate 1.3.0 Safes to 1.4.1
  • Move all migration-related functions (including multi-chain l2 migration) to a separate util file
  • Instead of the SAFE_141 feature toggle, use the recommendedMasterCopyVersion field from ChainInfo

1.3.0 Safes:
Screenshot 2024-12-13 at 14 50 05

1.1.1 Safes:
Screenshot 2024-12-13 at 14 49 14

How to test

Case 1:

  • Open a 1.3.0 Safe on mainnet
  • Go to Settings and upgrade it to 1.4.1

Case 2:

  • In the config service on staging, pick an L2 chain and set its recommended master copy version to 1.4.1
  • Open a 1.3.0 Safe on that chain and upgrade it to 1.4.1

Case 3:

  • Open a 1.3.0 Safe with a custom fallback handler (e.g. TWAP)
  • Upgrade it to 1.4.1
  • Verify that the fallback handler is still installed

Copy link

github-actions bot commented Dec 12, 2024

Copy link

github-actions bot commented Dec 12, 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 1011.77 KB (🟡 +430 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!

Thirteen 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 33.79 KB (🟡 +4.06 KB) 1.02 MB
/apps/custom 31.85 KB (🟡 +4.06 KB) 1.02 MB
/apps/open 54.18 KB (🟡 +4.06 KB) 1.04 MB
/home 59.26 KB (🟡 +4.07 KB) 1.05 MB
/settings/safe-apps 18.36 KB (🔴 +4.06 KB) 1.01 MB
/settings/setup 30.81 KB (🟡 +1 B) 1.02 MB
/swap 752 B (🟡 +3 B) 1012.5 KB
/transactions 97.2 KB (🟡 +4.06 KB) 1.08 MB
/transactions/history 97.17 KB (🟡 +4.06 KB) 1.08 MB
/transactions/messages 58.95 KB (🟡 +4.06 KB) 1.05 MB
/transactions/msg 55.11 KB (🟡 +4.06 KB) 1.04 MB
/transactions/queue 48.06 KB (🟡 +4.06 KB) 1.03 MB
/transactions/tx 47.32 KB (🟡 +4.06 KB) 1.03 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 Dec 12, 2024

Coverage report

Caution

Test run failed

St.
Category Percentage Covered / Total
🟡 Statements
73.25% (-0.82% 🔻)
14358/19602
🔴 Branches
50.51% (-1.19% 🔻)
3386/6703
🔴 Functions
55.88% (-1.25% 🔻)
2016/3608
🟡 Lines
74.79% (-0.81% 🔻)
13025/17416
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / safe-migrations.ts
96.3% 81.48% 100% 96.08%
🟡
... / index.tsx
66.67% 0% 0% 75%
🟢
... / index.tsx
75% 100% 0% 100%
🟡
... / index.tsx
61.54% 0% 0% 66.67%
🔴
... / tracking.ts
10.53% 0% 0% 10.53%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / txHistorySlice.ts
63.64% (-27.27% 🔻)
9.09% (-63.64% 🔻)
40% (-20% 🔻)
60.71% (-32.14% 🔻)
🟡
... / transaction-guards.ts
70.41% (-2.28% 🔻)
42.06% (+1% 🔼)
69.44% (-1.57% 🔻)
71.28% (-2.2% 🔻)
🟢
... / deployments.ts
93.55% (-3.23% 🔻)
93.33%
87.5% (-6.25% 🔻)
95.74% (-2.13% 🔻)
🟢 src/utils/chains.ts 93.1%
90% (-1.67% 🔻)
100% 100%
🔴
... / safeCoreSDK.ts
50% (-44.23% 🔻)
13.33% (-60% 🔻)
42.86% (-57.14% 🔻)
47.83% (-45.65% 🔻)
🟡
... / transactions.ts
70% (-7.62% 🔻)
39.02% (-15.98% 🔻)
45% (-5% 🔻)
71.76% (-7.6% 🔻)
🟢
... / utils.ts
90.91% (+0.24% 🔼)
71.88% (-8.13% 🔻)
90%
95.08% (+0.17% 🔼)
🔴
... / txQueueSlice.ts
47.22% (-33.33% 🔻)
0% (-69.23% 🔻)
14.29% (-14.29% 🔻)
45.16% (-38.71% 🔻)
🔴
... / index.ts
7.27% (-5.45% 🔻)
100% 0%
14.29% (-10.71% 🔻)
🟢
... / index.tsx
96.77% (-0.2% 🔻)
96.15% (+3.3% 🔼)
100% 100%
🔴
... / useSafeWalletProvider.tsx
22.43% (-59.81% 🔻)
0% (-59.09% 🔻)
0% (-70.37% 🔻)
21.78% (-62.38% 🔻)
🟡
... / notifications.ts
78.57% (-21.43% 🔻)
100%
60% (-40% 🔻)
76.92% (-23.08% 🔻)
🔴
... / index.ts
30.77% (-15.38% 🔻)
0%
0% (-33.33% 🔻)
50%
🟢
... / index.tsx
93.33% (-2.67% 🔻)
70.83% (-1.39% 🔻)
100% 100%
🟡
... / index.tsx
76.47% (-1.65% 🔻)
10.53% (-0.58% 🔻)
100%
75.76% (-1.66% 🔻)
🔴
... / index.tsx
50% (-50% 🔻)
0% (-62.5% 🔻)
0% (-100% 🔻)
52.63% (-47.37% 🔻)
🟡
... / index.tsx
60% (-30% 🔻)
0% (-57.14% 🔻)
0% (-50% 🔻)
66.67% (-22.22% 🔻)
🟡
... / tx-history-filter.ts
64.44% (-35.56% 🔻)
29.03% (-61.29% 🔻)
69.23% (-30.77% 🔻)
67.57% (-32.43% 🔻)
🟢
... / index.tsx
76.74% (-16.28% 🔻)
50% (-44.44% 🔻)
35.71% (-42.86% 🔻)
86.49% (-8.11% 🔻)
🟢
... / safeUpdateParams.ts
92% (-3.24% 🔻)
0% 100%
91.67% (-3.33% 🔻)

Test suite run failed

Failed tests: 0/1672. Failed suites: 6/237.
  ● Test suite failed to run

    TypeError: Cannot read properties of undefined (reading 'AWAITING_CONFIRMATIONS')

      60 |
      61 | const BundleTxStatuses: Record<TransactionStatus, BundleStatus> = {
    > 62 |   [TransactionStatus.AWAITING_CONFIRMATIONS]: BundleStatus.PENDING,
         |                      ^
      63 |   [TransactionStatus.AWAITING_EXECUTION]: BundleStatus.PENDING,
      64 |   [TransactionStatus.CANCELLED]: BundleStatus.CONFIRMED,
      65 |   [TransactionStatus.FAILED]: BundleStatus.CONFIRMED,

      at Object.AWAITING_CONFIRMATIONS (src/services/safe-wallet-provider/index.ts:62:22)
      at Object.<anonymous> (src/utils/nested-safe-wallet.ts:1272:27)
      at Object.<anonymous> (src/components/common/WalletProvider/index.tsx:2006:27)
      at Object.<anonymous> (src/hooks/wallets/useWallet.ts:510:27)
      at Object.<anonymous> (src/hooks/useChainId.ts:1404:66)
      at Object.<anonymous> (src/hooks/useChains.ts:874:27)
      at Object.<anonymous> (src/hooks/wallets/useOnboard.ts:3936:67)
      at Object.<anonymous> (src/services/tx/tx-sender/sdk.ts:3583:27)
      at Object.<anonymous> (src/services/contracts/safeContracts.ts:1896:28)
      at Object.<anonymous> (src/utils/safe-migrations.ts:1471:28)
      at Object.<anonymous> (src/utils/transaction-guards.ts:8984:27)
      at Object.<anonymous> (src/store/txHistorySlice.ts:992:27)
      at Object.<anonymous> (src/store/slices.ts:549:14)
      at Object.<anonymous> (src/store/index.ts:2090:67)
      at Object.<anonymous> (src/tests/test-utils.tsx:30:16)
      at Object.<anonymous> (src/utils/__tests__/tx-history-filter.test.ts:20:20)


  ● Test suite failed to run

    ReferenceError: Cannot access '_default' before initialization

    

      at Object.default (src/hooks/useChains.ts:839:5)
      at requireActual (src/services/safe-wallet-provider/useSafeWalletProvider.test.tsx:38:11)
      at Object.<anonymous> (src/components/common/WalletProvider/index.tsx:2000:27)
      at Object.<anonymous> (src/hooks/wallets/useWallet.ts:510:27)
      at Object.<anonymous> (src/hooks/useChainId.ts:1404:66)
      at Object.<anonymous> (src/hooks/useChains.ts:874:27)
      at requireActual (src/services/safe-wallet-provider/useSafeWalletProvider.test.tsx:38:11)
      at Object.<anonymous> (src/hooks/wallets/useOnboard.ts:3936:67)
      at Object.<anonymous> (src/services/tx/tx-sender/sdk.ts:3583:27)
      at Object.<anonymous> (src/services/contracts/safeContracts.ts:1896:28)
      at Object.<anonymous> (src/utils/safe-migrations.ts:1471:28)
      at Object.<anonymous> (src/utils/transaction-guards.ts:8984:27)
      at Object.<anonymous> (src/store/txHistorySlice.ts:992:27)
      at Object.<anonymous> (src/store/slices.ts:549:14)
      at Object.<anonymous> (src/store/index.ts:2090:67)
      at Object.<anonymous> (src/tests/test-utils.tsx:30:16)
      at Object.<anonymous> (src/services/safe-wallet-provider/useSafeWalletProvider.test.tsx:22:20)


  ● Test suite failed to run

    ReferenceError: Cannot access '_getMinimumMultiSendCallOnlyVersion' before initialization

    

      at Object._getMinimumMultiSendCallOnlyVersion (src/services/contracts/safeContracts.ts:1828:5)
      at requireActual (src/hooks/coreSDK/__tests__/safeCoreSDK.test.ts:14:13)
      at Object.<anonymous> (src/utils/safe-migrations.ts:1471:28)
      at Object.<anonymous> (src/utils/transaction-guards.ts:8984:27)
      at Object.<anonymous> (src/store/txHistorySlice.ts:992:27)
      at Object.<anonymous> (src/store/slices.ts:549:14)
      at Object.<anonymous> (src/store/index.ts:2090:67)
      at Object.<anonymous> (src/hooks/useChains.ts:868:27)
      at Object.<anonymous> (src/hooks/wallets/useOnboard.ts:3936:67)
      at Object.<anonymous> (src/services/tx/tx-sender/sdk.ts:3583:27)
      at Object.<anonymous> (src/services/contracts/safeContracts.ts:1896:28)
      at requireActual (src/hooks/coreSDK/__tests__/safeCoreSDK.test.ts:14:13)
      at Object.<anonymous> (src/hooks/coreSDK/safeCoreSDK.ts:1602:28)
      at Object.<anonymous> (src/hooks/coreSDK/__tests__/safeCoreSDK.test.ts:43:22)


  ● Test suite failed to run

    ReferenceError: Cannot access '_default' before initialization

    

      at Object.default (src/hooks/useChains.ts:839:5)
      at requireActual (src/components/common/AddressBookInput/index.test.tsx:22:11)
      at Object.<anonymous> (src/components/common/WalletProvider/index.tsx:2000:27)
      at Object.<anonymous> (src/hooks/wallets/useWallet.ts:510:27)
      at Object.<anonymous> (src/hooks/useChainId.ts:1404:66)
      at Object.<anonymous> (src/hooks/useChains.ts:874:27)
      at requireActual (src/components/common/AddressBookInput/index.test.tsx:22:11)
      at Object.<anonymous> (src/hooks/wallets/useOnboard.ts:3936:67)
      at Object.<anonymous> (src/services/tx/tx-sender/sdk.ts:3583:27)
      at Object.<anonymous> (src/services/contracts/safeContracts.ts:1896:28)
      at Object.<anonymous> (src/utils/safe-migrations.ts:1471:28)
      at Object.<anonymous> (src/utils/transaction-guards.ts:8984:27)
      at Object.<anonymous> (src/store/txHistorySlice.ts:992:27)
      at Object.<anonymous> (src/store/slices.ts:549:14)
      at Object.<anonymous> (src/store/index.ts:2090:67)
      at Object.<anonymous> (src/tests/test-utils.tsx:30:16)
      at Object.<anonymous> (src/components/common/AddressBookInput/index.test.tsx:22:20)


  ● Test suite failed to run

    ReferenceError: Cannot access 'txQueueSlice' before initialization

    

      at Object.txQueueSlice (src/store/txQueueSlice.ts:1141:5)
      at Object.get [as txQueueSlice] (src/store/slices.ts:632:22)
      at Object.txQueueSlice (src/store/index.ts:37:11)
      at Object.<anonymous> (src/hooks/useChains.ts:868:27)
      at Object.<anonymous> (src/hooks/wallets/useOnboard.ts:3936:67)
      at Object.<anonymous> (src/services/tx/tx-sender/sdk.ts:3583:27)
      at Object.<anonymous> (src/services/contracts/safeContracts.ts:1896:28)
      at Object.<anonymous> (src/utils/safe-migrations.ts:1471:28)
      at Object.<anonymous> (src/utils/transaction-guards.ts:8984:27)
      at Object.<anonymous> (src/store/txQueueSlice.ts:1152:28)
      at Object.<anonymous> (src/store/__tests__/txQueueSlice.test.ts:8:23)


  ● Test suite failed to run

    ReferenceError: Cannot access 'txHistorySlice' before initialization

    

      at Object.txHistorySlice (src/store/txHistorySlice.ts:984:5)
      at Object.get [as txHistorySlice] (src/store/slices.ts:632:22)
      at Object.txHistorySlice (src/store/index.ts:36:11)
      at Object.<anonymous> (src/hooks/useChains.ts:868:27)
      at Object.<anonymous> (src/hooks/wallets/useOnboard.ts:3936:67)
      at Object.<anonymous> (src/services/tx/tx-sender/sdk.ts:3583:27)
      at Object.<anonymous> (src/services/contracts/safeContracts.ts:1896:28)
      at Object.<anonymous> (src/utils/safe-migrations.ts:1471:28)
      at Object.<anonymous> (src/utils/transaction-guards.ts:8984:27)
      at Object.<anonymous> (src/store/txHistorySlice.ts:992:27)
      at Object.<anonymous> (src/store/__tests__/txHistorySlice.test.ts:10:25)

Report generated by 🧪jest coverage report action from e452768

@katspaugh katspaugh marked this pull request as ready for review December 12, 2024 13:13
@katspaugh katspaugh changed the base branch from version to dev December 12, 2024 13:38
@@ -32,6 +34,10 @@ const getChangeFallbackHandlerCallData = async (
export const createUpdateSafeTxs = async (safe: SafeInfo, chain: ChainInfo): Promise<MetaTransactionData[]> => {
assertValidSafeVersion(safe.version)

if (semverSatisfies(safe.version, '>=1.3.0')) {
Copy link
Member

Choose a reason for hiding this comment

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

Are we sure this will also work with future safe version e.g. going from 1.4.1 to 1.5.0? Otherwise I would limit it to only target 1.3.0 versions instead of >=1.3.0

@@ -71,7 +70,7 @@ export const isRouteEnabled = (route: string, chain?: ChainInfo) => {
}

export const getLatestSafeVersion = (chain: ChainInfo | undefined): SafeVersion => {
const latestSafeVersion = chain && hasFeature(chain, FEATURES.SAFE_141) ? LATEST_SAFE_VERSION : FALLBACK_SAFE_VERSION
const latestSafeVersion = chain?.recommendedMasterCopyVersion || LATEST_SAFE_VERSION
Copy link
Member

Choose a reason for hiding this comment

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

What if a network doesn't have 1.4.1? Previously we would use FALLBACK_SAFE_VERSION which defaulted to 1.3.0 but now this won't be the case anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

It will fail somewhere down the line where it gets an actual deployment. 1.3.0 is also not guaranteed to exist on all chains.

@katspaugh katspaugh merged commit b344122 into dev Dec 19, 2024
6 of 15 checks passed
@katspaugh katspaugh deleted the upgrade branch December 19, 2024 14:53
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 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.

2 participants