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: rm circular dependency #4697

Merged
merged 2 commits into from
Dec 19, 2024
Merged

Fix: rm circular dependency #4697

merged 2 commits into from
Dec 19, 2024

Conversation

katspaugh
Copy link
Member

What it solves

#4645 introduced a circular dependency: transaction-guards imported something from safe-migration utils which indirectly imports transaction-guards.

I've extracted the common part into a separate module.

@katspaugh katspaugh requested a review from compojoom December 19, 2024 17:45
Copy link

github-actions bot commented Dec 19, 2024

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code review by ChatGPT

@@ -6,7 +6,7 @@ import useSafeInfo from '@/hooks/useSafeInfo'
import { getExplorerLink } from '@/utils/gateway'
import ErrorMessage from '../ErrorMessage'
import { isValidMasterCopy } from '@/services/contracts/safeContracts'
import { extractMigrationL2MasterCopyAddress } from '@/utils/safe-migrations'
import { extractMigrationL2MasterCopyAddress } from '@/features/multichain/utils/extract-migration-data'

const UnknownContractError = ({ txData }: { txData: TransactionData | undefined }): ReactElement | null => {
const { safe, safeAddress } = useSafeInfo()

Choose a reason for hiding this comment

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

Unknown contract plea,
Master copy swapped with ease,
Paths diverge with glee.

@@ -3,7 +3,7 @@ import { Alert, AlertTitle, Box, SvgIcon, Typography } from '@mui/material'
import type { TransactionData } from '@safe-global/safe-gateway-typescript-sdk'
import InfoOutlinedIcon from '@/public/images/notifications/info.svg'
import NamedAddressInfo from '@/components/common/NamedAddressInfo'
import { extractMigrationL2MasterCopyAddress } from '@/utils/safe-migrations'
import { extractMigrationL2MasterCopyAddress } from '@/features/multichain/utils/extract-migration-data'

export const MigrateToL2Information = ({
variant,

Choose a reason for hiding this comment

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

In folder of code,
Paths diverge like crossroads now,
Functions find new homes.

}

return undefined
}

Choose a reason for hiding this comment

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

Migration happens,
MultiSend decodes the truth—
L2 awaits you.

@@ -4,7 +4,8 @@ import {
type TransactionData,
} from '@safe-global/safe-gateway-typescript-sdk'
import { OperationType } from '@safe-global/safe-core-sdk-types'
import { extractMigrationL2MasterCopyAddress, prependSafeToL2Migration } from '../safe-migrations'
import { prependSafeToL2Migration } from '../safe-migrations'
import { extractMigrationL2MasterCopyAddress } from '@/features/multichain/utils/extract-migration-data'
import { extendedSafeInfoBuilder } from '@/tests/builders/safe'
import { chainBuilder } from '@/tests/builders/chains'
import { safeSignatureBuilder, safeTxBuilder, safeTxDataBuilder } from '@/tests/builders/safeTx'

Choose a reason for hiding this comment

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

Imports rearranged,
Functions find their new homes now,
Code change journey starts.


return undefined
}

export const createUpdateMigration = (chain: ChainInfo): MetaTransactionData => {
const interfce = Safe_migration__factory.createInterface()

Choose a reason for hiding this comment

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

Transaction code
trims excess with great delight—
less is always more.

@@ -69,7 +69,7 @@ import { isMultiSendCalldata } from './transaction-calldata'
import { decodeMultiSendData } from '@safe-global/protocol-kit/dist/src/utils'
import { OperationType } from '@safe-global/safe-core-sdk-types'
import { LATEST_SAFE_VERSION } from '@/config/constants'
import { extractMigrationL2MasterCopyAddress } from './safe-migrations'
import { extractMigrationL2MasterCopyAddress } from '@/features/multichain/utils/extract-migration-data'

export const isTxQueued = (value: TransactionStatus): boolean => {
return [TransactionStatus.AWAITING_CONFIRMATIONS, TransactionStatus.AWAITING_EXECUTION].includes(value)

Choose a reason for hiding this comment

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

A path changes course,
Multichain utils emerge,
Code dances anew.

Copy link
Contributor

@compojoom compojoom left a comment

Choose a reason for hiding this comment

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

👍

Copy link

github-actions bot commented Dec 19, 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 1012.62 KB (🟡 +154 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!

Copy link

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
74.09% (+0.8% 🔼)
14566/19659
🔴 Branches
51.65% (+1.1% 🔼)
3469/6717
🔴 Functions
57.07% (+1.22% 🔼)
2062/3613
🟡 Lines
75.64% (+0.8% 🔼)
13212/17468
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / extract-migration-data.ts
95% 66.67% 100% 94.74%

Test suite run success

1752 tests passing in 237 suites.

Report generated by 🧪jest coverage report action from 073ee15

@katspaugh katspaugh merged commit 371be06 into dev Dec 19, 2024
12 of 15 checks passed
@katspaugh katspaugh deleted the fixdep branch December 19, 2024 18:03
@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
None yet
Development

Successfully merging this pull request may close these issues.

2 participants