From 61c33c8fec6112a7dba073311dcd4ac6835409708e065af8e5bb2ec90839bdb8 Mon Sep 17 00:00:00 2001 From: AidarKC Date: Wed, 2 Dec 2026 17:26:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D1=8C=20use?= =?UTF-8?q?r=20PDA=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B0=201.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shine-UI/js/services/shine-user-pda-service.js | 6 +++--- shine-solana/shine/tests/pda-v1-2-codec.mjs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/shine-UI/js/services/shine-user-pda-service.js b/shine-UI/js/services/shine-user-pda-service.js index cc7cab3f..671a7980 100644 --- a/shine-UI/js/services/shine-user-pda-service.js +++ b/shine-UI/js/services/shine-user-pda-service.js @@ -314,8 +314,8 @@ function writeVariableBlock(out, blockType, writer) { */ export function canonicalPdaSigningBytes(unsignedBytes) { const bytes = toUint8Array(unsignedBytes); - if (bytes.length < 64 || new TextDecoder().decode(bytes.slice(0, 5)) !== MAGIC || bytes[5] !== 1 || bytes[6] !== 3) { - throw new Error('Ожидается unsigned PDA v1.3'); + if (bytes.length < 64 || new TextDecoder().decode(bytes.slice(0, 5)) !== MAGIC || bytes[5] !== FORMAT_MAJOR || bytes[6] !== FORMAT_MINOR_CURRENT) { + throw new Error('Ожидается unsigned PDA v1.0'); } const rd16 = (i) => bytes[i] | (bytes[i + 1] << 8); if (rd16(7) !== bytes.length + 64) throw new Error('Неверный record_len'); @@ -730,7 +730,7 @@ export async function updateShineUserPdaOnSolana({ if ((rootChanged || clientChanged) && !fullKeyRotation) { throw new Error('Root/client keys меняются только как полная ротация: новый root + новый client + новый blockchain fork'); } - const authMode = AUTH_MODE_ROOT; // Root is the sole user PDA authority in v1.3. + const authMode = AUTH_MODE_ROOT; // Root is the sole user PDA authority in v1.0. if (authorityMode != null && authorityMode !== 'root' && authorityMode !== 'blockchain' && authorityMode !== AUTH_MODE_ROOT && authorityMode !== AUTH_MODE_BLOCKCHAIN) { throw new Error('Неподдерживаемый режим authority'); } diff --git a/shine-solana/shine/tests/pda-v1-2-codec.mjs b/shine-solana/shine/tests/pda-v1-2-codec.mjs index 5c98f509..c5524dd1 100644 --- a/shine-solana/shine/tests/pda-v1-2-codec.mjs +++ b/shine-solana/shine/tests/pda-v1-2-codec.mjs @@ -31,7 +31,7 @@ full.set(bytes(64, 200), unsigned.length); const parsed = parseShineUserPda(full); assert.equal(parsed.formatMajor, 1); -assert.equal(parsed.formatMinor, 3); +assert.equal(parsed.formatMinor, 0); assert.equal(parsed.isLegacy, false); assert.equal(parsed.recordNumber, 4); assert.equal(parsed.forks.length, 2); @@ -48,4 +48,4 @@ assert.notDeepEqual(unsigned, alternate, 'stored bytes must preserve actual quot assert.deepEqual(canonicalPdaSigningBytes(unsigned), canonicalPdaSigningBytes(alternate), 'changing only a system-owned limit must not affect root signature hash'); assert.equal(canonicalPdaSigningBytes(unsigned).length, unsigned.length - state.forks.length * 4); -console.log(`PDA 1.3 codec/canonical hash smoke test OK (${full.length} bytes)`); +console.log(`PDA 1.0 codec/canonical hash smoke test OK (${full.length} bytes)`);