Expand description
Per-(wallet, subaccount) nonce manager for Derive self-custodial requests.
Nonce format (matching derive_action_signing/utils.py::get_action_nonce):
int(str(utc_ms) || str(suffix)). The suffix is a non-negative integer
whose decimal representation is concatenated to the millisecond timestamp.
Manager guarantees:
- Monotonically increasing per
(wallet, subaccount). The venue rejects a nonce equal to or below the last accepted nonce for the signer, so the manager always issuesmax(now_ms_with_suffix0, last_issued + 1). - Lock-free per key under contention. A
DashMapshards the per-key state and acompare_exchangeloop on a singleAtomicU64serialises concurrent allocators.
Cross-instance ordering (multiple processes signing for the same key) is
the caller’s responsibility; the venue’s nextNonce-style endpoint should
seed the manager via NonceManager::refresh at startup.
Structs§
- Nonce
Manager - Thread-safe sequential nonce allocator keyed by
(wallet, subaccount_id).
Enums§
- Nonce
Error - Errors raised by
NonceManager.