-
Notifications
You must be signed in to change notification settings - Fork 0
fix: add on-chain verification and salt nonce increment for Safe deployment #4
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,16 +72,37 @@ export async function deploySafe(account?: string) { | |
| return | ||
| } | ||
|
|
||
| if (safe.deployed) { | ||
| logError('Safe is already deployed') | ||
| return | ||
| } | ||
|
|
||
| if (!safe.predictedConfig) { | ||
| logError('Safe does not have deployment configuration') | ||
| return | ||
| } | ||
|
|
||
| // Verify on-chain deployment status | ||
| const chain = configStore.getChain(safe.chainId)! | ||
| const safeService = new SafeService(chain) | ||
|
|
||
| try { | ||
| const safeInfo = await safeService.getSafeInfo(address) | ||
|
Comment on lines
75
to
+85
|
||
|
|
||
| // If Safe is actually deployed on-chain | ||
| if (safeInfo.isDeployed) { | ||
| // Sync local storage with on-chain reality | ||
| if (!safe.deployed) { | ||
| safeStorage.updateSafe(chainId, address, { deployed: true }) | ||
| } | ||
| logError('Safe is already deployed on-chain') | ||
| return | ||
| } | ||
|
|
||
| // If local storage says deployed but on-chain says not deployed, fix the storage | ||
| if (safe.deployed && !safeInfo.isDeployed) { | ||
| safeStorage.updateSafe(chainId, address, { deployed: false }) | ||
| } | ||
| } catch { | ||
| // If we can't verify, log warning but continue | ||
| console.log(pc.yellow('⚠ Warning: Could not verify on-chain deployment status')) | ||
| } | ||
|
|
||
| // Get active wallet | ||
| const activeWallet = walletStorage.getActiveWallet() | ||
| if (!activeWallet) { | ||
|
|
@@ -90,7 +111,6 @@ export async function deploySafe(account?: string) { | |
| return | ||
| } | ||
|
|
||
| const chain = configStore.getChain(safe.chainId)! | ||
| const eip3770 = formatSafeAddress(safe.address as Address, safe.chainId, chains) | ||
|
|
||
| console.log('') | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error message doesn't distinguish between 'max attempts exceeded' and 'missing predictedAddress/safeAccountConfig'. The latter would indicate a logic error rather than exhausted attempts. Consider separate error messages: one for exceeding max attempts, and another for unexpected missing data.