adamant-api v3.2.0: Resilient HTTP 429 Failover, Recipient Public-Key Verification, Strict Chat/KVS Filters, and Usable-Node Readiness #85
dev-adamant-im
started this conversation in
Developers & API
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
With ADAMANT Node v0.11.0 introducing default REST/WebSocket anti-abuse rate limits, strict AND-only query validation on chat and KVS endpoints, and consolidated OpenAPI sources under
Adamant-im/adamant,adamant-apihas been updated to harden node failover, readiness, and query serialization across both v0.11.0+ and earlier nodes.1. Resilient HTTP
429 Too Many RequestsFailover and CooldownsADAMANT Node v0.11.0 enforces per-IP aggregate (
all) and route-class (status,read,publish) HTTP budgets and responds with429,Retry-After/RateLimit-Reset, andRateLimit-Scope.In
AdamantApiandNodeManager:targetNode = this.nodebefore sending so late concurrent errors never rotatethis.nodeback onto a node that another request already failed over from.updateNodes()calls share a single in-flightupdateNodesPromiseinstead of returning early, and a forced failover joining a planned sweep upgrades it to forced rotation withfailedNode./api/node/statusis billed to the higher-capstatusbucket (12,000/min vs 3,000/min forread), a rate-limited node still answers health checks.NodeManagernow tracks per-node 429 cooldowns (rateLimitedUntil, capped at 60s) so both forced and planned sweeps prefer non-rate-limited synced nodes across 2-node and 3+-node pools.Retry-After/RateLimit-Resetwith jitter up to 10s; if the node's reset window exceeds that cap (or retries are exhausted), the SDK returns promptly with optional metadata onAdamantApiResult:POSTrequests (transaction submissions) are never replayed on HTTP responses, including429.2. Plain Filter Names, Strict Endpoint Types, and
POST /api/states/get/api/states/get,/api/chats/get, and/api/chatrooms/*now receive plain filter names (and: { ... }wrappers are flattened, while unsupportedorwrappers are rejected client-side withsuccess: false). This fixes #97 on pre-v0.11.0 nodes and matches v0.11.0 strict validation.ChatroomsOptions,ChatTransactionsOptions, andKVSOptionsnow mirror the exact fields accepted by ADAMANT Node v0.11.0 (includingtoHeighton/api/chats/getand/api/states/get, while excluding height/range fields rejected on/api/chatrooms/*). DeprecateduserIdon/api/chatrooms/*is stripped at runtime with a dedicated deprecation warning.POST /api/states/get:getKVS(..., {method: 'POST'})uses the SDK's idempotent read retry policy, preserving full 429 and 5xx failover.3. Usable-Node Readiness (
onReady) and Loader State FilteringNodeManagernow inspects/api/node/statusloader.loadedandloader.syncingfields:loaded: false) or syncing (syncing: true) are excluded from active API selection and WebSocket connection lists (nodes without aloaderobject remain eligible).checkHealthAtStartup: true,onReadywaits until a usable node is actually selected rather than firing after a failed initial health sweep.4. Local Recipient & Delegate Public-Key Verification (#109, #110)
encodeMessage()anddecodeMessage()now reject non-canonical, off-curve, and small-order (orders 1, 2, 4, and 8) Ed25519 keys withinvalid key.getPublicKey()validates ADM addresses locally before making a network request and verifies that node-returned keys locally derive the requested address before caching or returning them.sendMessage()locally re-verifies resolved keys before encrypting and returns{success: false, errorMessage}on mismatch;voteForDelegate()enforces address binding and uses per-client delegate caches.5. OpenAPI Source Consolidation and Supply-Chain Hardening
scripts/sync-api-types.mjsnow pulls the OpenAPI 3.2 spec directly fromAdamant-im/adamant(openapi/specification/openapi.yaml), generatingRateLimitErrorResponseDtoandGetKVSRequestBody.pnpm-workspace.yamlenforces a 7-day dependency release-age quarantine (minimumReleaseAge: 10080) with explicitallowBuildsand 0 production audit vulnerabilities.References
onReadyfix: Fix: Hold onReady until a usable node is selected adamant-api-jsclient#102All reactions