Fix OKX approval sync before follow-up transactions#402
Conversation
|
🚅 Deployed to the euler-lite-pr-402 environment in euler-lite
|
📝 WalkthroughWalkthroughPost-approval timing for OKX wallet transactions is refactored from a fixed delay to a block-based confirmation strategy. OKX detection is performed once per execution instead of per approval step. New timing constants, a sleep helper, and a block confirmation polling function enable concurrent minimum-delay and block-confirmation waiting after each approval step. ChangesOKX Post-Approval Block Confirmation Timing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@composables/useEulerOperations/execution.ts`:
- Around line 10-13: The hard 15000ms cap (OKX_POST_APPROVE_BLOCK_TIMEOUT_MS)
can expire before approvalBlock + OKX_POST_APPROVE_CONFIRMATION_BLOCKS on slow
chains; replace the fixed cap with a dynamic timeout computed from an estimated
block time (e.g., estimatedBlockTimeMs * OKX_POST_APPROVE_CONFIRMATION_BLOCKS)
plus a small buffer, or fetch recent block timestamps from the provider to
calculate a runtime block-time and use max(dynamicTimeout, a sensible minimum
like 15s) when polling (the poll loop that uses OKX_POST_APPROVE_MIN_DELAY_MS,
OKX_POST_APPROVE_BLOCK_POLL_MS, and OKX_POST_APPROVE_BLOCK_TIMEOUT_MS should
instead use this dynamicTimeout); alternatively expose the timeout as
configurable so environments with ~12s blocks can increase it.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: euler-xyz/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ff3319e1-b4c2-46bc-a798-b14a669e1b33
📒 Files selected for processing (1)
composables/useEulerOperations/execution.ts
Summary
Why
OKX can open the follow-up transaction review before its asset-change simulation sees the freshly confirmed approval. In that state it may show "Unable to decode asset changes" and disable confirmation. Waiting past the approval receipt block gives OKX more time to validate allowance state before the final tx prompt.
Test plan
Summary by CodeRabbit