Skip to content

Implement NonceManager.refresh() that respects the account lock #3

Description

@N-thnI

Description

Add sequence resynchronisation that cannot race an in-flight reservation.

Problem Statement

After a failed submission or a fee bump, the cached sequence must be resynced from the network. In vero-core-engine this is vero-core-engine#183: refresh() reads and writes sequence state without taking the per-account lock, so it can clobber a reservation another caller is mid-way through using.

Proposed Changes

  • Add refresh(account) to NonceManager, acquiring the same per-account lock as reserve()
  • Fetch the authoritative sequence from the network inside the critical section
  • Discard reservations invalidated by the refresh, and document that behaviour on the method

Technical Implementation Scaffolding

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

Acceptance Criteria

  • A refresh() running concurrently with reserve() never produces a duplicate sequence
  • Test covers refresh-during-reserve
  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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