Перевести протокол на App test5599 и PDA 1.0

This commit is contained in:
AidarKC
2026-12-02 17:36:25 +03:00
parent 61c33c8fec
commit 34a9c88d91
18 changed files with 46 additions and 48 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ export const SHINE_CHANNEL_TAG_NAME = 'c';
export const SHINE_TYPE_TAG_NAME = 't';
// Активная эпоха CORE/CONTENT.
export const SHINE_CORE_NAMESPACE = 'test5595';
export const SHINE_CORE_NAMESPACE = 'test5599';
export const SHINE_CORE_NUMBER_TAG_NAME = 'n';
export const SHINE_CORE_LINE_TAG_NAME = 'l';
export const SHINE_CORE_LINE_PROFILE = 2147483645;
@@ -1099,7 +1099,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
const BLOCK_TYPE_ARCHIVE_HEAD = 80;
const CORE_MAX_NUMBER = 2147482623;
// Transport namespace актуального standalone Viewer.
const SHINE_PROTOCOL_NAMESPACE = 'test5595';
const SHINE_PROTOCOL_NAMESPACE = 'test5599';
const SHINE_ARWEAVE_APP_TAG = SHINE_PROTOCOL_NAMESPACE;
const SHINE_ARWEAVE_CHANNEL_TAG = 'c';
const BCH_TYPE_TECH = 0;
@@ -3364,7 +3364,7 @@ var solanaWeb3=function(exports){"use strict";function getDefaultExportFromCjs(x
function v3RenderBlocks(){ const host=document.getElementById('v3-block-view'); if(!host)return; host.innerHTML=''; const wrap=document.createElement('div'); wrap.className='v3-blocks'; const blocks=(currentBlockchainView?.rawBlocks||V3.blocks||[]).slice().sort((a,b)=>b.blockNumber-a.blockNumber); blocks.forEach(b=>{ const d=document.createElement('details'); d.className='v3-block'; const sm=document.createElement('summary'); sm.textContent=`#${b.blockNumber} · type ${b.type}/${b.subType} · ${formatTimestamp(Number(b.timestampSec)*1000)}`; const pre=document.createElement('pre'); pre.textContent=JSON.stringify({blockNumber:b.blockNumber,type:b.type,subType:b.subType,version:b.version,hash:b.hashHex,prevHash:b.prevHashHex,contentHash:b.contentHashHex,contentDataItemId:b.contentDataItemId,line:b.line,arweaveId:b.arweaveId,body:b.body},(k,v)=>typeof v==='bigint'?String(v):v,2); d.append(sm,pre); wrap.appendChild(d); }); if(!blocks.length)wrap.textContent='Блоки ещё не загружены.'; host.appendChild(wrap); }
function v3SetView(mode){ const bv=document.getElementById('v3-block-view'), cb=document.getElementById('content-browser'); document.getElementById('v3-channel-tab').classList.toggle('is-active',mode==='channel'); document.getElementById('v3-blocks-tab').classList.toggle('is-active',mode==='blocks'); if(bv)bv.hidden=mode!=='blocks'; if(cb)cb.hidden=mode==='blocks'; if(mode==='blocks')v3RenderBlocks(); }
async function v3ClearCache(){ try{ const keys=Object.keys(localStorage).filter(k=>k.startsWith('shine.viewer.data.')||k.startsWith('shine.viewer.author-chain.')); keys.forEach(k=>localStorage.removeItem(k)); if('caches' in window){ for(const k of await caches.keys()) if(k.startsWith('shine-viewer-')) await caches.delete(k); } v3Log('Кэш данных очищен'); }catch(e){v3Log('Ошибка очистки кэша: '+e.message);} }
function v3CacheKey(key,channel){return 'shine.viewer.author-chain.test5595.'+String(key);}
function v3CacheKey(key,channel){return 'shine.viewer.author-chain.test5599.'+String(key);}
function v3SaveCache(key,channel,blocks){ if(!V3.cacheEnabled)return; try{ localStorage.setItem(v3CacheKey(key,channel),JSON.stringify(blocks,(k,v)=>typeof v==='bigint'?{__bigint:String(v)}:v)); }catch(e){v3Log('Кэш переполнен: '+e.message);} }
function v3LoadCache(key,channel){ if(!V3.cacheEnabled)return null; try{return JSON.parse(localStorage.getItem(v3CacheKey(key,channel))||'null',(k,v)=>v&&typeof v==='object'&&v.__bigint!==undefined?BigInt(v.__bigint):v);}catch{return null;} }
async function v3RestoreCached(key, channel) {
@@ -12,10 +12,10 @@ test('CORE эпоха одинакова в UI, Server, discovery и серти
const viewer = read('shine-UI/static-sites/arweave-viewer/index.html');
const reg = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java');
const archive = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlocksConfig.java');
assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'test5595'/);
assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'test5599'/);
assert.match(archive, /TEST_TAG_VALUE\s*=\s*ShineProtocolTags\.CORE_NAMESPACE/);
assert.match(server, /CORE_NAMESPACE\s*=\s*"test5595"/);
assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'test5595'/);
assert.match(server, /CORE_NAMESPACE\s*=\s*"test5599"/);
assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'test5599'/);
assert.match(reg, /ShineProtocolTags\.CORE_REGISTRATION_TAGS/);
for (const txt of [ui, server, viewer, reg]) assert.doesNotMatch(txt, /test5591/);
});
+2 -2
View File
@@ -15,8 +15,8 @@ const special = new Map([[SHINE_CORE_LINE_PROFILE,'P'],[SHINE_CORE_LINE_CONNECTI
test('CORE v2 namespace и числовые линии согласованы в Java и UI', () => {
const server=fs.readFileSync(new URL('../../SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java',import.meta.url),'utf8');
assert.equal(SHINE_CORE_NAMESPACE,'test5595');
assert.match(server,/CORE_NAMESPACE\s*=\s*"test5595"/);
assert.equal(SHINE_CORE_NAMESPACE,'test5599');
assert.match(server,/CORE_NAMESPACE\s*=\s*"test5599"/);
assert.equal(SHINE_CORE_MAX_BLOCK_NUMBER,2147482623);
assert.deepEqual([...special.keys()],[2147483645,2147483646,2147483647]);
});
+2 -2
View File
@@ -29,11 +29,11 @@ test('viewer: rejects tampered CONTENT, invalid CORE and wrong indexed tags',asy
test('viewer: requests CORE then CONTENT by ID and never claims signature verification',async()=>{
const f=find('post'),id=itemid(f.coreItemId),cid=itemid(f.contentItemId),calls=[];
ctx.fetch=async url=>{calls.push(url);const raw=url.endsWith(cid)?f.content:f.core;return {ok:true,arrayBuffer:async()=>bytes(raw).buffer};};
const r=await v.loadArweavePairs('https://mock.invalid',[{id,owner:{address:'indexed'},tags:[{name:'App',value:'test5595'},{name:'n',value:'2'},{name:'l',value:'1'}]}]);
const r=await v.loadArweavePairs('https://mock.invalid',[{id,owner:{address:'indexed'},tags:[{name:'App',value:'test5599'},{name:'n',value:'2'},{name:'l',value:'1'}]}]);
assert.deepEqual(calls,[`https://mock.invalid/${id}`,`https://mock.invalid/${cid}`]);assert.equal(r.blocks[0].hashHex,f.coreHash);
const checks=v.v3Verification(r.blocks);assert.equal(checks.signature.ok,0);assert.equal(checks.signature.na,1);assert.equal(checks.global.na,1);
ctx.fetch=async url=>url.endsWith(cid)?{ok:false,status:404}:{ok:true,arrayBuffer:async()=>bytes(f.core).buffer};
await assert.rejects(v.loadArweavePairs('https://mock.invalid',[{id,tags:[{name:'App',value:'test5595'},{name:'n',value:'2'},{name:'l',value:'1'}]}]),/CONTENT.*404/);
await assert.rejects(v.loadArweavePairs('https://mock.invalid',[{id,tags:[{name:'App',value:'test5599'},{name:'n',value:'2'},{name:'l',value:'1'}]}]),/CONTENT.*404/);
});
test('viewer: parses historical v2 and v3 primary declaration',async()=>{
const f=find('header'), old=bytes(f.content), key=old.slice(-32), prefix=old.slice(7,-32);