Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(tests): stop the ring nonce guard failing on the birthday bound it cannot beat

nirholas73c9a2c81572
diff --git a/docs/api-reference.md b/docs/api-reference.md
index 70b7ffa2c..f13a6bdf4 100644
--- a/docs/api-reference.md
+++ b/docs/api-reference.md
@@ -5571,8 +5571,8 @@ Clients should treat `404` as terminal and stop polling.
## Plugin Marketplace API
Tool plugins in the LobeHub / pai-chat `ToolManifest` format: the catalog behind
-the plugin grid on [/marketplace](/marketplace) and the picker on
-[/avatar](/avatar). A manifest declares an `identifier`, a `meta.title`, and a
+the plugin grid on [/marketplace](/marketplace) and the picker on an avatar's
+own page (`/avatars/<id>`). A manifest declares an `identifier`, a `meta.title`, and a
non-empty `api[]` of tool definitions; the platform stores it verbatim and
re-serves it, so a client that understands the format can install straight from
a listing.
diff --git a/tests/x402-ring-fee-floor.test.js b/tests/x402-ring-fee-floor.test.js
index 8696f148e..aff810b6c 100644
--- a/tests/x402-ring-fee-floor.test.js
+++ b/tests/x402-ring-fee-floor.test.js
@@ -109,9 +109,10 @@ describe('distinct-signature guard — same-amount payments must never collide',
// transactions — the mechanism behind the duplicate-settle defect. What must
// still hold is the pair of properties this test has always guarded: no
// repeats inside a window, and every drawn nonce maps to a fee-safe config.
+ const SAMPLE = 200;
const seen = new Set();
const ceiling = ringMaxFeePerTxLamports();
- for (let i = 0; i < 200; i++) {
+ for (let i = 0; i < SAMPLE; i++) {
const n = pay.nextAutoNonce();
expect(n).toBeGreaterThanOrEqual(0);
expect(n).toBeLessThan(pay.RING_NONCE_SPACE);
@@ -122,7 +123,14 @@ describe('distinct-signature guard — same-amount payments must never collide',
}
seen.add(n);
}
- expect(seen.size).toBe(200);
+ // Draws are independent, so demanding 200/200 distinct values asserts a
+ // property a CSPRNG cannot promise: with a 4.08M slot space the birthday
+ // bound puts one repeat in a 200-draw sample at ~0.5%, which made this
+ // test fail roughly once every two hundred suite runs on nothing but luck.
+ // Two repeats is ~1e-5, so that is the line: it still catches a genuinely
+ // narrowed space (a regression to the old 997-slot cycle collides ~87% of
+ // the time here) without failing on the sampling itself.
+ expect(SAMPLE - seen.size).toBeLessThanOrEqual(1);
});
});