More scalable data storage

This commit is contained in:
2026-10-19 20:17:10 -04:00
parent 0b9061372b
commit baad477ca5
16 changed files with 346 additions and 168 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { merkleRoot, sha256, expectedKey, INITIAL_KEY, expectedTarget, MAX_TARGET, CHAIN_ID } from '../server/testnet/consensus.ts';
import { NETWORK, type TestnetBlock } from '../shared/testnet.ts';
import { CONSENSUS, NETWORK, type TestnetBlock } from '../shared/testnet.ts';
test('Merkle commitments distinguish padded leaves, ordering, and node/leaf domains',()=>{
const a=sha256('a'),b=sha256('b'),c=sha256('c');
@@ -20,7 +20,7 @@ test('RandomX keys rotate only after the protocol delay using an ancestor, never
});
test('difficulty retargets deterministically at exact windows and is bounded',()=>{
assert.equal(expectedTarget([]),MAX_TARGET);
const blocks=Array.from({length:10},(_,i)=>({target:MAX_TARGET,createdAt:1000+i*30}as TestnetBlock));
const blocks=Array.from({length:10},(_,i)=>({target:MAX_TARGET,createdAt:1000+i*CONSENSUS.targetSeconds}as TestnetBlock));
assert.equal(expectedTarget(blocks.slice(0,9)),MAX_TARGET);
assert.equal(expectedTarget(blocks),MAX_TARGET);
const fast=blocks.map((b,i)=>({...b,createdAt:1000+i}));