Skip to content

Prevent Index DTF auctions from crossing fee handouts - #1090

Open
reserve-hermes wants to merge 4 commits into
masterfrom
feature/prevent-auction-fee-handout-overlap
Open

Prevent Index DTF auctions from crossing fee handouts#1090
reserve-hermes wants to merge 4 commits into
masterfrom
feature/prevent-auction-fee-handout-overlap

Conversation

@reserve-hermes

@reserve-hermes reserve-hermes commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • block launcher and permissionless Index DTF auction launches when the 30-second warmup plus configured auction duration reaches the next UTC-day TVL fee handout
  • use indexed dtf.auctionLength for the render-time disabled state, while re-reading auctionLength() from live Folio RPC immediately before submission
  • recheck wall-clock time in both click handlers so stale indexed state or a click between render ticks fails closed
  • show translated overlap feedback for both render-time and click-time blocks
  • cover timing boundaries, stale subgraph/RPC disagreement, post-render RPC changes, and both launch paths

Test plan

  • pnpm lint
  • pnpm typecheck
  • pnpm test:run (891 passed)
  • pnpm exec tsc -p e2e/tsconfig.json --noEmit
  • pnpm exec vitest run e2e/helpers/tests (72 passed)
  • pnpm e2e:smoke (64 passed, 1 existing skip)
  • focused launch-write.spec.ts (8 passed)
  • Lingui catalogs compile with pnpm exec lingui compile

Review notes

  • All six review threads are addressed and resolved: removed duplicate render-time RPC plumbing, added click-time feedback, consolidated the community countdown onto the shared clock, and made fake-timer cleanup exception-safe.
  • Engineer review required: the UTC fee-handout boundary and any safety buffer for wallet-signing/mining delay remain protocol-sensitive; no arbitrary buffer was introduced without confirmation.
  • wiki-lint remains blocked by the pre-existing stale docs/wiki/domains/design-system.md page; this change does not touch that domain.

Summary by CodeRabbit

  • New Features

    • Auction launches are now blocked when their warmup or duration would overlap the next daily TVL fee handout.
    • Clear validation warnings are shown on both standard and community auction launch controls.
    • Added localized messages in English, Spanish, Korean, and Chinese.
  • Bug Fixes

    • Prevented transaction submission for auctions that would cross the daily fee handout boundary.
  • Tests

    • Added coverage for boundary timing scenarios and both auction launch paths.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a67fcaad-c1e2-4763-9771-67687e9daf33

📥 Commits

Reviewing files that changed from the base of the PR and between a6f20e3 and c3726d2.

📒 Files selected for processing (11)
  • docs/wiki/progress.md
  • e2e/tests/index-dtf/auctions/launch-write.spec.ts
  • src/locales/en.po
  • src/locales/es.po
  • src/locales/ko.po
  • src/locales/zh.po
  • src/views/index-dtf/auctions/CLAUDE.md
  • src/views/index-dtf/auctions/views/rebalance/components/community-launch-auctions-button.tsx
  • src/views/index-dtf/auctions/views/rebalance/components/launch-auctions-button.tsx
  • src/views/index-dtf/auctions/views/rebalance/tests/auction-fee-handout-overlap.test.ts
  • src/views/index-dtf/auctions/views/rebalance/utils/auction-fee-handout-overlap.ts

📝 Walkthrough

Walkthrough

The change prevents launcher and community auctions from crossing the next daily TVL fee handout. It adds shared UTC-boundary detection, localized warnings, disabled controls, unit tests, end-to-end tests, and coverage documentation.

Changes

Auction overlap prevention

Layer / File(s) Summary
Overlap rule and boundary tests
src/views/index-dtf/auctions/views/rebalance/utils/auction-fee-handout-overlap.ts, src/views/index-dtf/auctions/views/rebalance/tests/auction-fee-handout-overlap.test.ts
Adds wouldAuctionOverlapFeeHandout and tests warmup, duration, inclusive boundaries, and UTC day transitions.
Launch validation and warning states
src/views/index-dtf/auctions/views/rebalance/components/launch-auctions-button.tsx, src/views/index-dtf/auctions/views/rebalance/components/community-launch-auctions-button.tsx, src/locales/*.po
Both launch paths use current time and overlap detection. They disable launch controls and display localized warnings when overlap occurs.
End-to-end verification and coverage records
e2e/tests/index-dtf/auctions/launch-write.spec.ts, src/views/index-dtf/auctions/CLAUDE.md, docs/wiki/progress.md
End-to-end tests confirm both launch paths submit no transaction during overlap. Coverage and review records document the UTC boundary behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to c3726

The PR prevents auctions from starting when their warmup and duration would cross the next UTC-day fee handout. Merge readiness is low-risk but requires owner confirmation that both launch paths enforce this boundary with authoritative transaction timing, since a stale browser clock or submission delay could otherwise permit an overlap.

Sequence Diagram(s)

sequenceDiagram
  participant LaunchAuctionsButton
  participant CurrentTime
  participant OverlapHelper
  participant LaunchControl
  LaunchAuctionsButton->>CurrentTime: Read current timestamp
  LaunchAuctionsButton->>OverlapHelper: Check auction length against next fee handout
  OverlapHelper-->>LaunchAuctionsButton: Return overlap status
  LaunchAuctionsButton->>LaunchControl: Disable control and show warning
Loading

Suggested reviewers: lcamargof

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing Index DTF auctions from crossing fee handouts.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/prevent-auction-fee-handout-overlap

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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploying register-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6fb824
Status: ✅  Deploy successful!
Preview URL: https://1ee209d8.register-app.pages.dev
Branch Preview URL: https://feature-prevent-auction-fee.register-app.pages.dev

View logs

@lcamargof lcamargof left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good direction overall — the click-time recheck failing closed is the right guard and the e2e coverage of the stale/race scenarios is solid. Requesting a few changes before merge:

  1. Drop the RPC plumbing for the render-time check — we already have auctionLength on the DTF entity (indexDTFAtom). Governance changing it is highly unlikely, and the click handler re-reads it from RPC anyway. Details inline.
  2. The click-time guard is a silent no-op — needs user feedback in both buttons. This becomes mandatory once the render check uses the entity value, since it's the only signal in the stale window.
  3. Dedupe the two 1s intervals in the community button.

Hardening steps to keep quality while addressing these:

  • RED→GREEN the click-feedback change: extend the two "rechecks at click time" e2e specs to assert the overlap message/toast appears after the blocked click, not just tx.log empty.
  • Keep all 7 launch-write specs green after removing the plumbing — the stale-subgraph spec should still pass since the handler still reads RPC (that's the guard it's actually proving).
  • Don't touch the fail-closed behavior in the handlers: block → feedback → return, never fall through to writeContract.
  • Update src/views/index-dtf/auctions/CLAUDE.md to match the final data flow (entity value for render, RPC at click) and re-run the full closeout gate (lint, typecheck, unit, e2e smoke).
  • The >= boundary semantics and the wallet signing/inclusion delay stay flagged for engineer review — don't self-resolve those.

Comment thread src/views/index-dtf/auctions/views/rebalance/hooks/use-rebalance-current-data.ts Outdated
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.

2 participants