Motivation
Bots firing transactions from multiple threads race on eth_getTransactionCount. The standard fix -- a local atomic nonce cache with gap recovery -- is reimplemented by every consumer (perpcity-zig-sdk built exactly this on top of eth.zig; it belongs upstream).
Scope
New src/nonce_manager.zig:
NonceManager.init(provider, address) -- seeds from getTransactionCount(pending)
next() -- atomic fetch-and-increment, no RPC on the hot path
onFailure(nonce) -- return a nonce to the pool / trigger resync; resync() for explicit recovery after dropped txs
- Optional integration:
Wallet accepts a *NonceManager instead of per-send RPC lookup
Pointers
std.atomic.Value(u64); keep RPC out of next(); document the gap-on-failure semantics carefully (nonces are only reusable until a higher one confirms).
Motivation
Bots firing transactions from multiple threads race on
eth_getTransactionCount. The standard fix -- a local atomic nonce cache with gap recovery -- is reimplemented by every consumer (perpcity-zig-sdk built exactly this on top of eth.zig; it belongs upstream).Scope
New
src/nonce_manager.zig:NonceManager.init(provider, address)-- seeds fromgetTransactionCount(pending)next()-- atomic fetch-and-increment, no RPC on the hot pathonFailure(nonce)-- return a nonce to the pool / trigger resync;resync()for explicit recovery after dropped txsWalletaccepts a*NonceManagerinstead of per-send RPC lookupPointers
std.atomic.Value(u64); keep RPC out ofnext(); document the gap-on-failure semantics carefully (nonces are only reusable until a higher one confirms).