fix(hooks): add tx confirmation + signature validation to useCreateMarket#155
fix(hooks): add tx confirmation + signature validation to useCreateMarket#1556figpsolseeker wants to merge 1 commit intodcccrypto:mainfrom
Conversation
…rket All 5 market creation transactions were sent via MWA but none were confirmed on-chain. The app showed "Market deployed!" without verifying any transaction actually landed, risking half-initialized markets if transactions were dropped due to congestion or expired blockhashes. Changes: - Import confirmTransactionSafe from lib/confirmTransaction - Fetch lastValidBlockHeight once before the send loop (all 5 txs share the same blockhash window) - Validate each MWA signature is non-null before proceeding - Confirm each transaction on-chain before sending the next one (critical since each tx builds on state from the previous) - Use the baked-in recentBlockhash from each decoded transaction for confirmation (no extra RPC call per tx) - Add comprehensive test suite (21 tests) covering happy path, server errors, confirmation failures, empty signatures, input validation, simulation failure, untrusted programs, and reset Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 14 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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 |
Summary
lastValidBlockHeightonce before the send loop (all 5 txs share the same blockhash window)recentBlockhashfrom each decodedTransactionfor confirmation (no extra RPC call per tx)What changed
src/hooks/useCreateMarket.tsconfirmTransactionSafe, fetchlastValidBlockHeight, add signature null-check + sequential confirmation in send loop__tests__/hooks/useCreateMarket.test.tsWhy this matters
Market creation involves 5 sequential transactions where each depends on state from the previous one. Without confirmation:
Test plan
useCreateMarkettests pass🤖 Generated with Claude Code