fix: reduce load on RPC nodes#7523
Conversation
Deploying swap-dev with
|
| Latest commit: |
aaac8e3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c54cccd9.swap-dev-5u6.pages.dev |
| Branch Preview URL: | https://fix-rpc-node-consumption.swap-dev-5u6.pages.dev |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR introduces conditional optimization for pending transaction context evaluation and configures viem client batching behavior. The pending transactions hook now skips processing when no transactions are pending, and wallet configuration now includes explicit tuning for multicall batching and polling intervals across both Safe and standard configurations. ChangesTransaction Finalization and Configuration
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
elena-zh
left a comment
There was a problem hiding this comment.
Tested on all chains except ink where I was not able to get a qupte: works fine with Rabby and MM+WC.
As for Safe, was not able to fully test it because of the known issue, so txs are not finalized. But balances were updated there (tested on Base)
Summary
Fix A —
apps/cowswap-frontend/.../usePendingTransactionsContext.ts + FinalizeTxUpdater/index.tsx:Hook now takes
hasPendingTxs: boolean; when no pending txs exist, it returns null without callinggetTransactionCount.FinalizeTxUpdaterpassestransactions.length > 0. Behavior unchanged for users with pending txs; eliminates the nonce call for every connected user every block.Fix B + C —
libs/wallet/src/wagmi/config.ts:Added a single
VIEM_CLIENT_TUNINGconstant spread into both the Safe-iframe createConfig and theWagmiAdapterconstructor:batch.multicall: { wait: 130, batchSize: 30_000 }— auto-aggregates singularuseReadContractcalls intomulticall3I've checked the version before Viem migration, and we were making
eth_callwith ~24kb payload. Alchemy recommends keeping the payload less then 100kb, so 30kb looks a good trade-off here.Expected impact
To Test
Summary by CodeRabbit