This commit is contained in:
2026-10-19 21:47:38 -04:00
parent f8eeae826f
commit b1d2b5c10e
17 changed files with 549 additions and 92 deletions
+9
View File
@@ -208,6 +208,8 @@ test('native RandomX HTTP: three blocks, mined transfer, peer gossip/sync and du
await (await request(first.base, '/api/mining/template', 400, {})).text();
await (await request(first.base, '/api/blocks', 400, {})).text();
await (await request(first.base, '/api/transfer', 400, {})).text();
await (await request(first.base, '/api/trades', 400, {})).text();
await (await request(first.base, `/api/decks/${'x'.repeat(64)}`, 400)).text();
await (await request(first.base, '/api/mining/template', 403, {}, { Origin: 'https://evil.example' })).text();
await (await request(first.base, '/api/mining/template', 415, {}, { 'Content-Type': 'text/plain' })).text();
const malformed = await fetch(`${first.base}/api/blocks`, { method: 'POST',
@@ -240,6 +242,13 @@ test('native RandomX HTTP: three blocks, mined transfer, peer gossip/sync and du
const block2 = await mine(first.base, alice);
assert.equal(block2.height, 2);
await submit(first.base, block2);
const aliceDeck = await json<{ address: string; tip: string; total: number; nfts: { block: TestnetBlock }[] }>(
first.base, `/api/decks/${alice.owner}`);
assert.equal(aliceDeck.address, alice.owner);
assert.equal(aliceDeck.tip, block2.hash);
assert.equal(aliceDeck.total, 2);
assert.deepEqual(aliceDeck.nfts.map(item => item.block.tokenId), [block1.tokenId, block2.tokenId]);
await (await request(first.base, `/api/decks/${'z'.repeat(64)}`, 400)).text();
// A truly independent process reconstructs the canonical chain over HTTP and checks real work.
const second = await start(secondDir, first.base);