Description
Add the core nonce/sequence manager that replaces three diverging implementations.
Problem Statement
Sequence management is currently implemented three times: vero-core-engine/engine-bridge/src/nonce-manager.ts, vero-relayer-service/src/relayer/nonceManager.js, and ad-hoc handling in the dashboard. That divergence has already produced separately-filed bugs — vero-core-engine#164 (check-then-act race in reserve()), #183 (refresh() bypasses the per-account lock), and vero-relayer-service#198 (a cached sequence served from inside the lock, causing tx_bad_seq at default concurrency). Consolidating means this class of bug gets fixed once instead of three times.
Proposed Changes
Technical Implementation Scaffolding
- Target Repository: vero-sdk
- Target Path: src/nonce/index.ts
- Branch Naming: feat/issue--nonce-manager-core
- Authority Context: Security-sensitive — transaction sequencing
Acceptance Criteria
Definition of Done
Description
Add the core nonce/sequence manager that replaces three diverging implementations.
Problem Statement
Sequence management is currently implemented three times:
vero-core-engine/engine-bridge/src/nonce-manager.ts,vero-relayer-service/src/relayer/nonceManager.js, and ad-hoc handling in the dashboard. That divergence has already produced separately-filed bugs — vero-core-engine#164 (check-then-act race inreserve()), #183 (refresh()bypasses the per-account lock), and vero-relayer-service#198 (a cached sequence served from inside the lock, causingtx_bad_seqat default concurrency). Consolidating means this class of bug gets fixed once instead of three times.Proposed Changes
src/nonce/index.tsexporting aNonceManagerclassreserve(account)returns the next sequence and marks it consumed in a single atomic step — no observable window between read and writesrc/index.tsTechnical Implementation Scaffolding
Acceptance Criteria
reserve()calls for the same account never return the same sequencenpm test,npm run typecheck,npm run lint, andnpm run buildall passDefinition of Done