Skip to content

Viem Migration - feat: transaction dedup guard and fillability fix#7289

Open
brunota20 wants to merge 327 commits intodevelopfrom
bernardo/cow-572-feat-tx-order-fixes
Open

Viem Migration - feat: transaction dedup guard and fillability fix#7289
brunota20 wants to merge 327 commits intodevelopfrom
bernardo/cow-572-feat-tx-order-fixes

Conversation

@brunota20
Copy link
Copy Markdown
Collaborator

@brunota20 brunota20 commented Apr 8, 2026

Summary

Re-adds features reverted from the viem migration PR to keep migration scope minimal:

  • finalizeEthereumTransaction: Dedup set prevents same tx finalized multiple times. Page-load guard suppresses stale "Transaction mined" notifications on reload.
  • getRemainingSellAmountForFillability: Computes remaining sell amount for partially-filled TWAP orders, fixing false "Unfillable" status.

brunota20 and others added 20 commits April 6, 2026 17:19
The branch fixed hyphenated SVG attributes (stroke-width → strokeWidth) and
added a safeSize guard against division-by-zero. React silently ignores
hyphenated SVG attributes, making the progress circle invisible.

Reverting because this bug also exists on develop and is not related to the
viem migration. Can be addressed in a separate PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The branch added a pre-check against tokensByAddress map to avoid false
"Import token" prompts for tokens already in active lists, plus a loading
guard to prevent flickering during SWR fetch.

Reverting because this bug also exists on develop and is not related to the
viem migration. Can be addressed in a separate PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The branch expanded the Cancelling status guard so that failed Safe
cancellation transactions reset the order back to Pending. Without this,
orders stay stuck in "Cancelling" permanently after a rejected Safe tx.

Reverting because this bug also exists on develop and is not related to the
viem migration. Can be addressed in a separate PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
   Removed the deduplication set (finalizedEthereumTxDedupeKeys) that prevented
   the same transaction from being finalized twice, and the pageLoadTime guard
   that suppressed notifications for transactions added before page load.

   These fixes address pre-existing bugs on develop (duplicate finalization on
   fast re-renders, stale "Transaction mined" toasts on page reload) but are
   not related to the viem migration. Keeping only the viem-required changes:
   import swap to viem TransactionReceipt and Hex cast for safeTransactionHash.

   Also reverted finalizeEthFlowTx and finalizeOnChainCancellation to develop
   (they had shouldShowNotification parameter added for the page-load guard).
Removed the module-level swap flow lock (acquireSwapFlowLock/releaseSwapFlowLock)
that prevented concurrent swap flows across component instances. The per-component
flowInProgressRef already provides re-entrancy protection.

This was new logic not related to the viem migration. The lack of a cross-instance
guard is a pre-existing condition on develop. Can be addressed separately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed the new utility that computed outstanding sell amount for
partially-filled TWAP orders. No callers remain (the import was already
removed from useOrdersFillability in a previous change).

This was new logic not related to the viem migration. The TWAP partial-fill
fillability bug is a pre-existing condition on develop. Can be addressed
in a separate PR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reverted TwapOrdersUpdater.tsx to develop structure (re-inlined logic),
keeping only the ComposableCoW → ComposableCowContractData type swap.

Deleted new files not related to viem migration:
- twapOrdersUpdater.helpers.ts (extracted helpers + new orphan/stale-nonce logic)
- shouldCheckOrderAuth.ts (extracted auth check)
- useTwapOrdersUpdateInterval.ts (extracted interval hook)

Removed mergePersistedSigningTwapOrders from buildTwapOrdersItems.ts
(new WaitSigning/Cancelling reconciliation logic). Kept the Hex casts
required by viem migration.

These were refactoring and new features not related to viem migration.
Pre-existing bugs can be addressed in separate PRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restored tradeButtonsMap back into tradeButtonsMap.tsx (as on develop).
Deleted the extracted files: tradeButtonsMap.record.tsx,
tradeButtonsMap.types.ts, tradeButtonsMap.utils.ts.

This was a pure code organization refactor not related to viem migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restored the original useState + useEffect accumulation pattern from
develop. The useMemo simplification was not related to viem migration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed the onTxFailed callback and TX_REPLACED listener from
processTwapCancellation. Kept the viem-required change: receipt.status
comparison from === 1 to === 'success'.

The onTxFailed/TX_REPLACED handling was new logic not related to viem
migration. The stuck Cancelling state bug is pre-existing on develop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Re-adds features reverted from the viem migration PR:
- finalizeEthereumTransaction: dedup set prevents same tx finalized twice,
  page-load guard suppresses stale notifications on reload
- getRemainingSellAmountForFillability: computes remaining sell amount for
  partially-filled TWAP orders to fix false "Unfillable" status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cowfi Ready Ready Preview Apr 8, 2026 4:59pm
explorer-dev Ready Ready Preview Apr 8, 2026 4:59pm
sdk-tools Error Error Apr 8, 2026 4:59pm
swap-dev Ready Ready Preview Apr 8, 2026 4:59pm
widget-configurator Ready Ready Preview Apr 8, 2026 4:59pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cosmos Ignored Ignored Apr 8, 2026 4:59pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c388b46f-e6e9-422c-9a10-e28c28f309ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bernardo/cow-572-feat-tx-order-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Base automatically changed from bernardo/cow-572-m7-cleanup-documentation to develop April 14, 2026 08:10
@lgahdl lgahdl changed the title feat: transaction dedup guard and fillability fix Viem Migration - feat: transaction dedup guard and fillability fix Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants