Skip to content

feat: rework L1 staking timing and blocking logic#662

Draft
nelitow wants to merge 16 commits intomainfrom
feat/rework-l1-staking-timing-and-blocking
Draft

feat: rework L1 staking timing and blocking logic#662
nelitow wants to merge 16 commits intomainfrom
feat/rework-l1-staking-timing-and-blocking

Conversation

@nelitow
Copy link
Copy Markdown
Contributor

@nelitow nelitow commented Feb 9, 2026

Closes FE-1797

Implementation Summary

  • Dynamic Timing Engine: Updated useETA hook to support step-specific fallback durations (2m for sync, 10m for committing) when backend data is missing.
  • Improved Blocking Logic: Modified stakingEvents to unblock funds once they reach the "Synced to Sequencer" phase, allowing concurrent withdrawals or staking.
  • Code Refactoring: Centralized withdrawal timing logic into a shared getWithdrawStepTiming utility to ensure consistency across the UI.
  • Bug Fixes:
    • Fixed dateExpectedToComplete being used as a start date instead of an end date.
    • Resolved useETA stale state issues when switching between transactions.
    • Fixed missing useMemo and useETA imports in WithdrawStatusDialog.

Testing Checklist

1. Timing & ETA Display

  • Initial Sync UX: Verify "Synchronizing with Sequencer" shows a ~2 minute countdown.
  • Committing Phase: Verify "Sequencer committing to L1" shows a ~10 minute countdown before backend data arrives.
  • Finalization Accuracy: Verify timer updates to the specific backend timestamp once received.
  • UI Consistency: Verify ETAs match exactly between the Status Dialog and the Transaction History list.
  • State Cleanup: Verify no stale ETA "flickers" when switching between different transactions.

2. Blocking Logic (Faster Unblocking)

  • Phase Unblocking: Verify that once a withdrawal reaches "Sequencer committing to L1", you can initiate a NEW withdrawal or stake funds.
  • Initial Phase Guarding: Verify that during the "Transaction Sent" or "Synchronizing" steps, actions are still correctly disabled.

3. Edge Cases

  • Failed Sync: Verify ETA disappears and status turns red if a sync is marked as Skipped.
  • Paused Contract: Verify ETA remains visible even if the "Finalize" button is disabled due to a contract pause.
  • Persistence: Refresh the page mid-countdown and ensure the timer resumes correctly.

- Updated useETA hook to support step-specific fallback durations
- Modified stakingEvents service to unblock withdrawals once synced to sequencer
- Enhanced TransactionHistoryItemStatus and StatusItem to show granular ETAs
- Updated WithdrawStatusDialog with dynamic step-based timing
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 9, 2026

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

Project Deployment Actions Updated (UTC)
fuel-explorer-v2-vite Ready Ready Preview Mar 5, 2026 5:28pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 9, 2026

PR Summary

Medium Risk
Changes withdrawal timing/ETA computation and the logic that blocks new staking actions based on pending L1 events, which can affect user ability to transact and UI correctness if the new status timing mapping is wrong.

Overview
Refactors withdrawal ETA/progress handling to use a centralized getWithdrawStepTiming helper plus an enhanced useETA hook that supports dynamic startDate types and per-step fallback durations when backend timestamps are missing.

Updates the withdraw status dialog, per-step status items, and transaction history status to consume this shared timing logic (removing direct formatETA usage), and adjusts L1 staking event “pending” detection so withdrawals only block during early phases (TransactionSent/WaitingSync). Also tweaks the ecosystem Playwright test’s domain assertion logic (but it now references openedPageDomain, which is undefined in the file).

Written by Cursor Bugbot for commit d01591b. This will update automatically on new commits. Configure here.

Comment thread packages/app-staking/src/systems/Staking/components/StatusItem/StatusItem.tsx Outdated
Comment thread packages/app-staking/src/systems/Staking/hooks/useETA.ts Outdated
Comment thread packages/app-staking/src/systems/Staking/components/StatusItem/StatusItem.tsx Outdated
- Created getWithdrawStepTiming utility to deduplicate logic
- Fixed dateExpectedToComplete bug (using it as endDate)
- Fixed useETA stale state bug by resetting state on invalid inputs
- Updated StatusItem, TransactionHistoryItemStatus, and WithdrawStatusDialog
Comment thread packages/app-staking/src/systems/Staking/utils/withdrawTiming.ts
@nelitow nelitow self-assigned this Feb 9, 2026
@nelitow nelitow marked this pull request as draft February 9, 2026 19:57
Wrap approveNewNetwork and approveSwitchNetwork in try/catch to handle
cases where MetaMask combines both prompts into a single popup. Add
stabilization delays for CI reliability.
Remove verbose console.log calls from Metamask wallet helpers to reduce test noise and replace unused catch error vars with ignored (_) handlers. Update ecosystem domain assertion to allow subdomain redirects by matching the opened domain against an escaped href domain via a regex (e.g. o2.app -> trade.o2.app). These changes make tests quieter and more robust to network prompt absence and benign subdomain redirects.
Update the domain verification logic in the Ecosystem test to simplify the check for subdomain redirects. The new implementation directly compares the opened page domain with the href domain and allows for subdomain matches, enhancing test robustness.
@nelitow nelitow marked this pull request as ready for review March 5, 2026 17:27
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

? undefined
: 600, // ~10 mins for committing
};
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallback countdown for committing phase starts too early

Medium Severity

When dateExpectedToComplete is unavailable for WaitingCommittingToL1, the fallback timer uses sentDate (the original transaction-sent timestamp) as startDate with a 600-second duration. In useETA, dateFinish becomes sentDate + 10 minutes. Since the sync phase (~2 min) already elapsed before reaching this status, the user sees ~8 minutes remaining instead of the intended ~10 minutes. The startDate for the fallback case needs to reflect when the committing phase actually began, not when the transaction was originally sent.

Fix in Cursor Fix in Web

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.

1 participant