Skip to content

Add nonce leak recovery for failed or timed-out submissions #4

Description

@N-thnI

Description

Release reserved sequences that were never actually consumed on-chain.

Problem Statement

A reserved sequence whose transaction fails to submit — network error, timeout, rejection — is currently never returned to the pool. vero-core-engine#181 describes exactly this: TxAggregator.execute() leaks reserved nonces on failure, permanently desyncing the account sequence cache and forcing a manual refresh.

Proposed Changes

  • Add release(account, sequence) to return an unused reservation
  • Provide a withReservation(account, fn) helper that reserves, runs fn, and releases automatically if fn throws
  • Document that release is only valid for a sequence that never reached the network

Technical Implementation Scaffolding

  • Target Repository: vero-sdk
  • Target Path: src/nonce/index.ts
  • Branch Naming: feat/issue--nonce-leak-recovery
  • Authority Context: Security-sensitive — transaction sequencing

Acceptance Criteria

  • A throwing withReservation callback leaves the sequence available for reuse
  • A successful callback does not release the sequence
  • Test covers both paths
  • npm test, npm run typecheck, npm run lint, and npm run build all pass

Definition of Done

  • Reviewed by lead maintainer
  • Pull request merged via verified status check

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions