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: decoding of migrateToL2 #4718

Merged
merged 1 commit into from
Dec 31, 2024
Merged

fix: decoding of migrateToL2 #4718

merged 1 commit into from
Dec 31, 2024

Conversation

schmanu
Copy link
Member

@schmanu schmanu commented Dec 30, 2024

What it solves

Upgrading a Safe from 1.3.0 to 1.4.1 breaks the Migration decoding

How this PR fixes it

Less strict by ignoring the to address when decoding migrateToL2 transactions.

How to test it

Open e.g. this transaction

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) 🧑‍💻

@schmanu schmanu requested a review from katspaugh December 30, 2024 15:10
Copy link

github-actions bot commented Dec 30, 2024

Copy link

Copy link

📦 Next.js Bundle Analysis for @safe-global/web

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

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1 MB (🟡 +14.8 KB)
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!

Thirty-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
/ 508 B (🟢 -2 B) 1 MB
/address-book 23.21 KB (🟡 +142 B) 1.03 MB
/apps 35.8 KB (🟡 +2.08 KB) 1.04 MB
/apps/custom 33.87 KB (🟡 +2.08 KB) 1.04 MB
/apps/open 55.57 KB (🟡 +1.96 KB) 1.06 MB
/balances 29.88 KB (🟡 +176 B) 1.03 MB
/balances/nfts 9.52 KB (🟢 -24 B) 1.01 MB
/bridge 2.56 KB (🟡 +1 B) 1.01 MB
/cookie 8.77 KB (🟡 +1 B) 1.01 MB
/home 61.38 KB (🟡 +2.12 KB) 1.06 MB
/new-safe/advanced-create 26.38 KB (🟢 -75 B) 1.03 MB
/new-safe/create 25.52 KB (🟢 -74 B) 1.03 MB
/new-safe/load 6.08 KB (🟢 -5 B) 1.01 MB
/privacy 14.57 KB (🟡 +2 B) 1.02 MB
/settings/appearance 2.25 KB (🟡 +2 B) 1.01 MB
/settings/environment-variables 3.27 KB (🟢 -1 B) 1.01 MB
/settings/modules 4.06 KB (🟡 +1 B) 1.01 MB
/settings/notifications 21 KB (🟢 -324 B) 1.02 MB
/settings/safe-apps 20.35 KB (🟡 +2.08 KB) 1.02 MB
/settings/security 2.34 KB (🟡 +1 B) 1.01 MB
/settings/setup 30.82 KB (🟡 +92 B) 1.03 MB
/share/safe-app 7.56 KB (🟢 -5 B) 1.01 MB
/stake 618 B (🟢 -1 B) 1 MB
/swap 764 B (🟡 +4 B) 1 MB
/terms 12.93 KB (🟡 +1 B) 1.02 MB
/transactions 99.47 KB (🟡 +2.9 KB) 1.1 MB
/transactions/history 99.43 KB (🟡 +2.9 KB) 1.1 MB
/transactions/messages 60.26 KB (🟡 +1.96 KB) 1.06 MB
/transactions/msg 56.51 KB (🟡 +1.96 KB) 1.06 MB
/transactions/queue 49.37 KB (🟡 +1.97 KB) 1.05 MB
/transactions/tx 48.73 KB (🟡 +1.96 KB) 1.05 MB
/welcome/accounts 409 B (🟡 +2 B) 1 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

Coverage report for apps/web

Caution

Test run failed

St.
Category Percentage Covered / Total
🟡 Statements
74.11% (-0% 🔻)
14573/19665
🔴 Branches 51.7% 3478/6727
🔴 Functions 57.11% 2064/3614
🟡 Lines
75.65% (-0% 🔻)
13219/17474
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🔴
... / index.tsx
38.1% (-1.44% 🔻)
0% 0%
39.02% (-1.45% 🔻)

Test suite run failed

Failed tests: 5/1758. Failed suites: 3/238.
  ● ConfirmationView › should display a confirmation screen for a SETTINGS_CHANGE transaction

    expect(received).toMatchSnapshot()

    Snapshot name: `ConfirmationView should display a confirmation screen for a SETTINGS_CHANGE transaction 1`

    - Snapshot  - 9
    + Received  + 9

    @@ -121,19 +121,19 @@
              style="--Paper-shadow: none;"
            >
              <h3
                class="MuiAccordion-heading css-cy7rkm-MuiAccordion-heading"
              >
    -           <div
    +           <button
                  aria-expanded="false"
    -             class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-6csn7x-MuiButtonBase-root-MuiAccordionSummary-root"
    +             class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-10sjung-MuiButtonBase-root-MuiAccordionSummary-root"
                  data-testid="decoded-tx-summary"
    -             role="button"
                  tabindex="0"
    +             type="button"
                >
    -             <div
    -               class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1pnrdlh-MuiAccordionSummary-content"
    +             <span
    +               class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1r0e0ir-MuiAccordionSummary-content"
                  >
                    Advanced details
                    <span
                      class=""
                      data-mui-internal-clone-element="true"
    @@ -146,12 +146,12 @@
                    </span>
                    <div
                      class="MuiBox-root css-i9gxme"
                    />
                    addOwnerWithThreshold
    -             </div>
    -             <div
    +             </span>
    +             <span
                    class="MuiAccordionSummary-expandIconWrapper css-1wqf3nl-MuiAccordionSummary-expandIconWrapper"
                  >
                    <svg
                      aria-hidden="true"
                      class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
    @@ -161,12 +161,12 @@
                    >
                      <path
                        d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
                      />
                    </svg>
    -             </div>
    -           </div>
    +             </span>
    +           </button>
              </h3>
              <div
                class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-hidden css-cwrbtg-MuiCollapse-root"
                style="min-height: 0px;"
              >

      116 |     )
      117 |
    > 118 |     expect(container).toMatchSnapshot()
          |                       ^
      119 |   })
      120 |
      121 |   it("should display a confirmation with method call when the transaction type is not found in the ConfirmationView's mapper", () => {

      at Object.toMatchSnapshot (src/components/tx/confirmation-views/ConfirmationView.test.tsx:118:23)

  ● ConfirmationView › should display a confirmation with method call when the transaction type is not found in the ConfirmationView's mapper

    expect(received).toMatchSnapshot()

    Snapshot name: `ConfirmationView should display a confirmation with method call when the transaction type is not found in the ConfirmationView's mapper 1`

    - Snapshot  - 9
    + Received  + 9

    @@ -10,19 +10,19 @@
              style="--Paper-shadow: none;"
            >
              <h3
                class="MuiAccordion-heading css-cy7rkm-MuiAccordion-heading"
              >
    -           <div
    +           <button
                  aria-expanded="false"
    -             class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-6csn7x-MuiButtonBase-root-MuiAccordionSummary-root"
    +             class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-10sjung-MuiButtonBase-root-MuiAccordionSummary-root"
                  data-testid="decoded-tx-summary"
    -             role="button"
                  tabindex="0"
    +             type="button"
                >
    -             <div
    -               class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1pnrdlh-MuiAccordionSummary-content"
    +             <span
    +               class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1r0e0ir-MuiAccordionSummary-content"
                  >
                    Advanced details
                    <span
                      class=""
                      data-mui-internal-clone-element="true"
    @@ -35,12 +35,12 @@
                    </span>
                    <div
                      class="MuiBox-root css-i9gxme"
                    />
                    addOwnerWithThreshold
    -             </div>
    -             <div
    +             </span>
    +             <span
                    class="MuiAccordionSummary-expandIconWrapper css-1wqf3nl-MuiAccordionSummary-expandIconWrapper"
                  >
                    <svg
                      aria-hidden="true"
                      class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
    @@ -50,12 +50,12 @@
                    >
                      <path
                        d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
                      />
                    </svg>
    -             </div>
    -           </div>
    +             </span>
    +           </button>
              </h3>
              <div
                class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-hidden css-cwrbtg-MuiCollapse-root"
                style="min-height: 0px;"
              >

      131 |     )
      132 |
    > 133 |     expect(container).toMatchSnapshot()
          |                       ^
      134 |   })
      135 | })
      136 |

      at Object.toMatchSnapshot (src/components/tx/confirmation-views/ConfirmationView.test.tsx:133:23)


  ● SignOrExecute › should display a confirmation screen

    expect(received).toMatchSnapshot()

    Snapshot name: `SignOrExecute should display a confirmation screen 1`

    - Snapshot  - 9
    + Received  + 9

    @@ -17,19 +17,19 @@
                  style="--Paper-shadow: none;"
                >
                  <h3
                    class="MuiAccordion-heading css-cy7rkm-MuiAccordion-heading"
                  >
    -               <div
    +               <button
                      aria-expanded="false"
    -                 class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-6csn7x-MuiButtonBase-root-MuiAccordionSummary-root"
    +                 class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-10sjung-MuiButtonBase-root-MuiAccordionSummary-root"
                      data-testid="decoded-tx-summary"
    -                 role="button"
                      tabindex="0"
    +                 type="button"
                    >
    -                 <div
    -                   class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1pnrdlh-MuiAccordionSummary-content"
    +                 <span
    +                   class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1r0e0ir-MuiAccordionSummary-content"
                      >
                        Advanced details
                        <span
                          class=""
                          data-mui-internal-clone-element="true"
    @@ -41,12 +41,12 @@
                          />
                        </span>
                        <div
                          class="MuiBox-root css-i9gxme"
                        />
    -                 </div>
    -                 <div
    +                 </span>
    +                 <span
                        class="MuiAccordionSummary-expandIconWrapper css-1wqf3nl-MuiAccordionSummary-expandIconWrapper"
                      >
                        <svg
                          aria-hidden="true"
                          class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
    @@ -56,12 +56,12 @@
                        >
                          <path
                            d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
                          />
                        </svg>
    -                 </div>
    -               </div>
    +                 </span>
    +               </button>
                  </h3>
                  <div
                    class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-hidden css-cwrbtg-MuiCollapse-root"
                    style="min-height: 0px;"
                  >

      54 |
      55 |     expect(getByTestId('sign-btn')).toBeInTheDocument()
    > 56 |     expect(container).toMatchSnapshot()
         |                       ^
      57 |   })
      58 |
      59 |   it('should display an error screen', async () => {

      at Object.toMatchSnapshot (src/components/tx/SignOrExecuteForm/__tests__/SignOrExecute.test.tsx:56:23)

  ● SignOrExecute › should display an error screen

    expect(received).toMatchSnapshot()

    Snapshot name: `SignOrExecute should display an error screen 1`

    - Snapshot  - 9
    + Received  + 9

    @@ -17,19 +17,19 @@
                  style="--Paper-shadow: none;"
                >
                  <h3
                    class="MuiAccordion-heading css-cy7rkm-MuiAccordion-heading"
                  >
    -               <div
    +               <button
                      aria-expanded="false"
    -                 class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-6csn7x-MuiButtonBase-root-MuiAccordionSummary-root"
    +                 class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-10sjung-MuiButtonBase-root-MuiAccordionSummary-root"
                      data-testid="decoded-tx-summary"
    -                 role="button"
                      tabindex="0"
    +                 type="button"
                    >
    -                 <div
    -                   class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1pnrdlh-MuiAccordionSummary-content"
    +                 <span
    +                   class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1r0e0ir-MuiAccordionSummary-content"
                      >
                        Advanced details
                        <span
                          class=""
                          data-mui-internal-clone-element="true"
    @@ -41,12 +41,12 @@
                          />
                        </span>
                        <div
                          class="MuiBox-root css-i9gxme"
                        />
    -                 </div>
    -                 <div
    +                 </span>
    +                 <span
                        class="MuiAccordionSummary-expandIconWrapper css-1wqf3nl-MuiAccordionSummary-expandIconWrapper"
                      >
                        <svg
                          aria-hidden="true"
                          class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
    @@ -56,12 +56,12 @@
                        >
                          <path
                            d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
                          />
                        </svg>
    -                 </div>
    -               </div>
    +                 </span>
    +               </button>
                  </h3>
                  <div
                    class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-hidden css-cwrbtg-MuiCollapse-root"
                    style="min-height: 0px;"
                  >

      73 |
      74 |     expect(container.querySelector('sign-btn')).not.toBeInTheDocument()
    > 75 |     expect(container).toMatchSnapshot()
         |                       ^
      76 |   })
      77 | })
      78 |

      at Object.toMatchSnapshot (src/components/tx/SignOrExecuteForm/__tests__/SignOrExecute.test.tsx:75:23)


  ● BatchTransactions › should render a list of batch transactions

    expect(received).toMatchSnapshot()

    Snapshot name: `BatchTransactions should render a list of batch transactions 1`

    - Snapshot  - 9
    + Received  + 9

    @@ -15,18 +15,18 @@
              style="--Paper-shadow: none;"
            >
              <h3
                class="MuiAccordion-heading css-cy7rkm-MuiAccordion-heading"
              >
    -           <div
    +           <button
                  aria-expanded="false"
    -             class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-6csn7x-MuiButtonBase-root-MuiAccordionSummary-root"
    -             role="button"
    +             class="MuiButtonBase-root MuiAccordionSummary-root MuiAccordionSummary-gutters accordion css-10sjung-MuiButtonBase-root-MuiAccordionSummary-root"
                  tabindex="0"
    +             type="button"
                >
    -             <div
    -               class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1pnrdlh-MuiAccordionSummary-content"
    +             <span
    +               class="MuiAccordionSummary-content MuiAccordionSummary-contentGutters css-1r0e0ir-MuiAccordionSummary-content"
                  >
                    <div
                      class="MuiBox-root css-mvjamn"
                    >
                      <div
    @@ -58,12 +58,12 @@
                             
                          </b>
                        </span>
                      </div>
                    </div>
    -             </div>
    -             <div
    +             </span>
    +             <span
                    class="MuiAccordionSummary-expandIconWrapper css-1wqf3nl-MuiAccordionSummary-expandIconWrapper"
                  >
                    <svg
                      aria-hidden="true"
                      class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-1dhtbeh-MuiSvgIcon-root"
    @@ -73,12 +73,12 @@
                    >
                      <path
                        d="M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"
                      />
                    </svg>
    -             </div>
    -           </div>
    +             </span>
    +           </button>
              </h3>
              <div
                class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-hidden css-cwrbtg-MuiCollapse-root"
                style="min-height: 0px;"
              >

      10 |     const { container, getByText } = render(<BatchTransactions />)
      11 |
    > 12 |     expect(container).toMatchSnapshot()
         |                       ^
      13 |     expect(getByText('GnosisSafeProxy')).toBeDefined()
      14 |   })
      15 | })

      at Object.toMatchSnapshot (src/components/tx/confirmation-views/BatchTransactions/BatchTransactions.test.tsx:12:23)

Report generated by 🧪jest coverage report action from 5cabc14

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

Thanks!
Looks like jest snapshots need to be updated.

@katspaugh
Copy link
Member

Actually the tests are fine, it failed because of the coverage report.

@katspaugh katspaugh merged commit ca09816 into dev Dec 31, 2024
8 of 15 checks passed
@katspaugh katspaugh deleted the fix/migrate-l2-decoding branch December 31, 2024 06:49
@github-actions github-actions bot locked and limited conversation to collaborators Dec 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants