More scalable data storage
This commit is contained in:
@@ -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}));
|
||||
|
||||
Reference in New Issue
Block a user