Skip to content

🥅 server: resolve orphaned proposals on nonce-too-low revert#765

Merged
cruzdanilo merged 1 commit intomainfrom
proposals
Feb 12, 2026
Merged

🥅 server: resolve orphaned proposals on nonce-too-low revert#765
cruzdanilo merged 1 commit intomainfrom
proposals

Conversation

@cruzdanilo
Copy link
Member

@cruzdanilo cruzdanilo commented Feb 12, 2026


Open with Devin

Summary by CodeRabbit

  • Bug Fixes
    • Proposals no longer remain pending after nonce-too-low transaction reverts; orphaned proposals are now resolved and removed from processing.
  • Tests
    • Test suite updated to assert cleanup behavior (treating nonce-too-low as a handled condition) and verify side-effect removal of pending proposals.
  • Chores
    • Added changeset entry for the patch release.

@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 0728413

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 12, 2026

Warning

Rate limit exceeded

@cruzdanilo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

Walkthrough

Adds NonceTooLow handling in the block hook: keeper exaSend is called with an ignore for NonceTooLow, and when NonceTooLow occurs during proposal execution the proposal is removed from the Redis "proposals" sorted set to prevent orphaned retries.

Changes

Cohort / File(s) Summary
Changeset metadata
.changeset/brave-foxes-camp.md
New changeset for a patch release of @exactly/server documenting the NonceTooLow resolution.
Block hook error handling
server/hooks/block.ts
Adds { ignore: ["NonceTooLow()"] } to keeper.exaSend calls and handles NonceTooLow in catch paths by removing orphaned proposals from Redis (zrem on proposals).
Block hook tests
server/test/hooks/block.test.ts
Replaces fingerprint-based assertions with spies/awaits on Redis zrem calls; updates test waits and expectations to verify proposal removal when NonceTooLow occurs.

Sequence Diagram(s)

sequenceDiagram
  participant BlockHook as BlockHook (server/hooks/block.ts)
  participant Keeper as Keeper/exaSend
  participant Redis as Redis (proposals zset)
  participant Sentry as Sentry/error capture

  BlockHook->>Keeper: exaSend(tx, { ignore: ["NonceTooLow()"] })
  alt Keeper returns NonceTooLow revert
    Keeper-->>BlockHook: NonceTooLow error
    BlockHook->>Redis: ZREM proposals <proposalId>
    BlockHook->>Sentry: capture (non-fatal / optional)
  else Keeper succeeds
    Keeper-->>BlockHook: success
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 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 accurately describes the main change: resolving orphaned proposals when nonce-too-low reverts occur, which aligns with the modifications in block.ts and test updates.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch proposals

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.

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 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

@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 addresses a bug in the server where proposals would remain pending after a 'NonceTooLow' error, leading to orphaned proposals. The changes include adding specific error handling for 'NonceTooLow' errors and updating tests to ensure the correct behavior. This ensures that proposals are properly removed from the processing queue when such errors occur.

Highlights

  • Bug Fix: This PR resolves an issue where proposals were not being properly removed from the processing queue after a 'NonceTooLow' error occurred during transaction execution.
  • Error Handling: The code now specifically catches 'NonceTooLow' errors and removes the corresponding proposal from the Redis queue, preventing orphaned proposals.
  • Testing: Updated tests to ensure that 'NonceTooLow' errors are handled correctly and that proposals are removed from the queue in such cases.
Changelog
  • server/hooks/block.ts
    • Added error handling for 'NonceTooLow' errors to remove proposals from the Redis queue.
    • Modified the proposal execution logic to ignore 'NonceTooLow()' errors during simulation.
    • Updated the skipNonce function to handle 'NonceTooLow' errors.
  • server/test/hooks/block.test.ts
    • Updated tests to verify that 'NonceTooLow' errors are correctly handled and proposals are removed from the queue.
    • Modified tests to use zrem spy to check for proposal removal from redis.
Activity
  • cruzdanilo authored the pull request.
  • The pull request includes changes to 'server/hooks/block.ts' and 'server/test/hooks/block.test.ts' to address the orphaned proposals issue.
  • A new changeset file '.changeset/brave-foxes-camp.md' was added.
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.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to resolve orphaned proposals that occur due to NonceTooLow transaction reverts. The approach is to catch these specific errors and remove the corresponding proposal from the processing queue, which is a sound strategy. The implementation in server/hooks/block.ts correctly handles this for the main proposal execution flow. The identified comment regarding redundant error handling for nonce skipping is valid and has been retained, as it points out unreachable code that complicates error handling. The accompanying test updates in server/test/hooks/block.test.ts are well-written and correctly validate the intended new behavior.

@sentry
Copy link

sentry bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.66%. Comparing base (622e970) to head (0728413).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #765      +/-   ##
==========================================
- Coverage   67.71%   67.66%   -0.06%     
==========================================
  Files         207      207              
  Lines        6945     7026      +81     
  Branches     2165     2207      +42     
==========================================
+ Hits         4703     4754      +51     
- Misses       2053     2071      +18     
- Partials      189      201      +12     
Flag Coverage Δ
e2e 67.66% <100.00%> (+15.87%) ⬆️

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.

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

🤖 Fix all issues with AI agents
In `@server/hooks/block.ts`:
- Around line 359-367: The span is being marked as error unconditionally in the
catch block via parent.setStatus({ code: SPAN_STATUS_ERROR, ... }) before
handling the intentional NonceTooLow cleanup; move or adjust the status handling
so NonceTooLow is treated as a non-error: either relocate the parent.setStatus
call to after the NonceTooLow guard or, inside the NonceTooLow branch (where you
call redis.zrem("proposals", message)), set the span to a success/aborted status
(e.g., SPAN_STATUS_OK or similar with a message like "nonce_too_low"/"aborted")
instead of SPAN_STATUS_ERROR; update only the catch block around the error
instanceof BaseError && error.cause instanceof ContractFunctionRevertedError &&
error.cause.data?.errorName === "NonceTooLow" check so other errors still call
parent.setStatus({ code: SPAN_STATUS_ERROR, message: "proposal_failed" }).

@sentry
Copy link

sentry bot commented Feb 12, 2026

Sentry Issue: SERVER-HZ

@sentry
Copy link

sentry bot commented Feb 15, 2026

Sentry Issue: SERVER-HG

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