SPEC.md writes lineage/v0 down as an ordinals metaprotocol: the envelope fields, chain order, authority by verified parents, every rule, ownership by sat. bin/lineage-index.mjs reads lineage events from a real ord server and folds them with the same reducer the lab uses. tools/regtest rehearses the sample on Bitcoin Core regtest with standardness on: the lab's own action code signs on a chain funded only by coins imported from regtest (LocalChain.importCoin), each beat's transactions are broadcast byte for byte and mined, ord indexes them, and --compare checks the same events in the same beats, the same metadata and parents, every inscription in the same output and the same trees. tests/indexer.test.js replays a recorded run. The first rehearsal found that reveals committed to tapscript's re-encoded tapleaf, which real Bitcoin rejects. They now commit to the exact script bytes, and the local chain checks script paths per BIP-341/342, still loading reveals made before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H4upF5LVwmPDDqrhdUfnXh
17 lines
1.1 KiB
JavaScript
17 lines
1.1 KiB
JavaScript
// Record what ord answered about a rehearsal, with the lab's public chain (no keys), as a fixture the unit tests replay
|
|
// without bitcoind or ord: tests/fixtures/regtest-rehearsal.json. Usage: node tools/regtest/record.mjs [lab.json] [from]
|
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
import { decodeLab } from '../../src/orgchain/store.js';
|
|
import { ordClient, ordEvents } from '../../src/indexer/ord.js';
|
|
|
|
const base = 'http://127.0.0.1:8088', from = Number(process.argv[3] ?? 120), ord = {};
|
|
const lab = decodeLab(readFileSync(process.argv[2] ?? 'tools/regtest/out/lab.json', 'utf8'));
|
|
const record = async (url, options) => {
|
|
const res = await fetch(url, options), body = await res.text();
|
|
ord[new URL(url).pathname] = { status: res.status, body };
|
|
return new Response(body, { status: res.status });
|
|
};
|
|
const events = await ordEvents(ordClient(base, record), { from });
|
|
writeFileSync('tests/fixtures/regtest-rehearsal.json', `${JSON.stringify({ from, ord, chain: lab.chain.snapshot() })}\n`);
|
|
console.log(`recorded ${Object.keys(ord).length} ord answers for ${events.length} events, and ${lab.chain.blocks.length} local blocks`);
|