Skip to content

🥅 server: handle timelocked proposal reverts#805

Merged
cruzdanilo merged 1 commit intomainfrom
flake
Feb 19, 2026
Merged

🥅 server: handle timelocked proposal reverts#805
cruzdanilo merged 1 commit intomainfrom
flake

Conversation

@cruzdanilo
Copy link
Member

@cruzdanilo cruzdanilo commented Feb 18, 2026


Open with Devin

Summary by CodeRabbit

  • Bug Fixes
    • Consolidated revert handling: errors are now categorized (aborted, rescheduled, retrying, failed), timelocked proposals are requeued with updated unlock/retry info, out-of-order proposals are rescheduled, and aborted proposals are cleanly removed.
  • Tests
    • Added/updated tests for timelocked requeueing, rescheduling behavior, and adjusted warning vs. error expectations for out-of-order proposals.
  • Chores
    • Added a changeset documenting the patch release.

@changeset-bot
Copy link

changeset-bot bot commented Feb 18, 2026

🦋 Changeset detected

Latest commit: 6b15e0a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

Walkthrough

Centralizes proposal error handling in the block hook using a revertReason switch. Adds Timelocked handling that reschedules proposals with updated unlock and retryCount, adjusts NotNext rescheduling behavior, treats NoProposal/NonceTooLow as aborted, and updates tests to cover Timelocked requeue and adjusted warnings.

Changes

Cohort / File(s) Summary
Changeset
\.changeset/brave-falcon-retry.md
Adds a new changeset entry documenting a patch release for @exactly/server with note "🥅 handle timelocked proposal reverts".
Core Error Handling
server/hooks/block.ts
Replaces ad-hoc error branches with a centralized revertReason(error) switch. Adds Timelocked case to compute nextUnlock, increment retryCount, and enqueue rescheduled proposal; updates NotNext path to fetch pending proposals and build idle/rescheduled proposals; treats NonceTooLow and NoProposal as aborted; consolidates default error handling.
Tests
server/test/hooks/block.test.ts
Adds test for Timelocked requeue (validates increased unlock and retryCount, ensures setProposalNonce not called). Adjusts idle/NotNext tests to expect warning fingerprints, adds proposal-matching helpers, and updates block/timing setup for unlock checks.

Sequence Diagram

sequenceDiagram
    participant Executor as Proposal Executor
    participant Contract as Smart Contract
    participant ErrorHandler as Block Hook Error Handler
    participant Previewer as exaPreviewer
    participant Queue as Redis Queue
    participant Blockchain as Blockchain State

    Executor->>Contract: executeProposal()
    Contract-->>Executor: revert (Timelocked / NotNext / NonceTooLow / NoProposal / other)
    Executor->>ErrorHandler: throw/catch error
    ErrorHandler->>ErrorHandler: classify using revertReason(error)
    alt Timelocked
        ErrorHandler->>Blockchain: getCurrentBlock()
        ErrorHandler->>ErrorHandler: compute nextUnlock, retryCount++
        ErrorHandler->>Queue: enqueue rescheduled proposal (nextUnlock, retryCount)
    else NotNext
        ErrorHandler->>Previewer: read pendingProposals()
        ErrorHandler->>ErrorHandler: build idle/rescheduled proposals (retryCount++)
        ErrorHandler->>Queue: enqueue idle/rescheduled proposals
    else NonceTooLow / NoProposal
        ErrorHandler->>Queue: remove proposal from Redis (abort)
    else Default
        ErrorHandler->>ErrorHandler: mark error / captureException (with optional skipNonce handling)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • nfmelendez
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding handling for timelocked proposal reverts in the server, which is the primary focus of the PR's changes to block.ts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch flake

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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 and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @cruzdanilo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the server's robustness by introducing a dedicated mechanism to manage proposals that encounter a 'Timelocked' revert error. Instead of failing, these proposals are now intelligently re-scheduled for a later attempt, improving the system's ability to process transactions under specific on-chain conditions. The changes also refine existing error handling and testing practices.

Highlights

  • Timelocked Proposal Handling: Implemented specific handling for 'Timelocked' contract revert errors, allowing proposals to be re-scheduled for later execution instead of failing.
  • Error Handling Refactor: Refactored the core proposal error handling logic in server/hooks/block.ts from an if/else if structure to a switch statement for improved readability and extensibility.
  • Logging Level Adjustment: Adjusted the logging level for 'NotNext' contract revert errors from 'error' to 'warning' to better reflect their nature as re-schedulable events.
  • New Test Coverage: Added comprehensive unit tests to verify the correct behavior of the new 'Timelocked' proposal re-scheduling mechanism.
Changelog
  • .changeset/brave-falcon-retry.md
    • Added a new changeset file documenting the patch for handling timelocked proposal reverts.
  • server/hooks/block.ts
    • Removed the direct import of ContractFunctionRevertedError.
    • Refactored error handling for contract function reverts into a switch statement.
    • Introduced a new case to handle 'Timelocked' errors by rescheduling the proposal with an updated unlock time.
    • Changed the captureException level for 'NotNext' errors from 'error' to 'warning'.
  • server/test/hooks/block.test.ts
    • Added a new test case to verify the re-queueing of 'Timelocked' proposals.
    • Updated the test setup to ensure proposals are unlocked before testing.
    • Adjusted assertions for captureException calls to reflect the change in logging level for 'NotNext' errors.
Activity
  • No human activity (comments, reviews) has been recorded for this pull request.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@sentry
Copy link

sentry bot commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 84.61538% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.11%. Comparing base (386ed09) to head (6b15e0a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
server/hooks/block.ts 84.61% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #805      +/-   ##
==========================================
- Coverage   69.33%   69.11%   -0.22%     
==========================================
  Files         208      208              
  Lines        7092     7155      +63     
  Branches     2251     2269      +18     
==========================================
+ Hits         4917     4945      +28     
- Misses       1992     2020      +28     
- Partials      183      190       +7     
Flag Coverage Δ
e2e 68.72% <66.66%> (+15.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

coderabbitai[bot]

This comment was marked as resolved.

@cruzdanilo cruzdanilo force-pushed the flake branch 2 times, most recently from e99ab21 to 3239d15 Compare February 19, 2026 00:32
chatgpt-codex-connector[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b15e0a40b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

@cruzdanilo cruzdanilo merged commit 6b15e0a into main Feb 19, 2026
14 of 15 checks passed
@cruzdanilo cruzdanilo deleted the flake branch February 19, 2026 11:35
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

Comments