From 5525bf2dc121523f0006a903d7edac7806833151 Mon Sep 17 00:00:00 2001 From: architect-dev Date: Wed, 10 Sep 2025 13:06:06 +0200 Subject: [PATCH 1/3] Mark u256 and encryptable u256 as deprecated --- src/types/base.ts | 3 +++ src/types/encryptable.ts | 6 ++++++ src/types/encrypted.ts | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/types/base.ts b/src/types/base.ts index 5cb2fd9..f0946b5 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -7,6 +7,9 @@ export enum FheTypes { Uint64 = 5, Uint128 = 6, Uint160 = 7, + /** + * @deprecated High precision uints will not supported in the future, max size is u128. + */ Uint256 = 8, Uint512 = 9, Uint1024 = 10, diff --git a/src/types/encryptable.ts b/src/types/encryptable.ts index a802468..e3856b9 100644 --- a/src/types/encryptable.ts +++ b/src/types/encryptable.ts @@ -35,6 +35,9 @@ export type EncryptableUint128 = { data: string | bigint; utype: FheTypes.Uint128; }; +/** + * @deprecated High precision uints will not supported in the future, max size is u128. + */ export type EncryptableUint256 = { data: string | bigint; utype: FheTypes.Uint256; @@ -59,6 +62,9 @@ export const Encryptable = { ({ data, securityZone, utype: FheTypes.Uint64 }) as EncryptableUint64, uint128: (data: EncryptableUint128["data"], securityZone = 0) => ({ data, securityZone, utype: FheTypes.Uint128 }) as EncryptableUint128, + /** + * @deprecated High precision uints will not supported in the future, max size is u128. + */ uint256: (data: EncryptableUint256["data"], securityZone = 0) => ({ data, securityZone, utype: FheTypes.Uint256 }) as EncryptableUint256, } as const; diff --git a/src/types/encrypted.ts b/src/types/encrypted.ts index 6e159e3..aef9ae5 100644 --- a/src/types/encrypted.ts +++ b/src/types/encrypted.ts @@ -29,6 +29,9 @@ export type CoFheInUint64 = CoFheInItem & { export type CoFheInUint128 = CoFheInItem & { utype: FheTypes.Uint128; }; +/** + * @deprecated High precision uints will not supported in the future, max size is u128. + */ export type CoFheInUint256 = CoFheInItem & { utype: FheTypes.Uint256; }; From 468b0b24b5538f163a0fdae33c9f9c0ffac36d85 Mon Sep 17 00:00:00 2001 From: architect-dev Date: Wed, 10 Sep 2025 13:15:18 +0200 Subject: [PATCH 2/3] Disable u256 --- src/node/zkPoK.ts | 14 +++++----- src/types/base.ts | 55 ++++++++++++++++++++-------------------- src/types/encryptable.ts | 35 ++++++++++++------------- src/types/encrypted.ts | 10 +++----- src/web/zkPoK.ts | 32 ++++++++++++----------- 5 files changed, 72 insertions(+), 74 deletions(-) diff --git a/src/node/zkPoK.ts b/src/node/zkPoK.ts index 6671da2..50ab0bf 100644 --- a/src/node/zkPoK.ts +++ b/src/node/zkPoK.ts @@ -11,7 +11,6 @@ import { MAX_UINT32, MAX_UINT64, MAX_UINT128, - MAX_UINT256, } from "../core/utils/consts"; import { toBigIntOrThrow, @@ -72,12 +71,13 @@ export const zkPack = ( builder.push_u128(bint); break; } - case FheTypes.Uint256: { - const bint = toBigIntOrThrow(item.data); - validateBigIntInRange(bint, MAX_UINT256); - builder.push_u256(bint); - break; - } + // [U256-DISABLED] + // case FheTypes.Uint256: { + // const bint = toBigIntOrThrow(item.data); + // validateBigIntInRange(bint, MAX_UINT256); + // builder.push_u256(bint); + // break; + // } case FheTypes.Uint160: { const bint = typeof item.data === "string" diff --git a/src/types/base.ts b/src/types/base.ts index f0946b5..5f8f27d 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -7,31 +7,32 @@ export enum FheTypes { Uint64 = 5, Uint128 = 6, Uint160 = 7, - /** - * @deprecated High precision uints will not supported in the future, max size is u128. - */ - Uint256 = 8, - Uint512 = 9, - Uint1024 = 10, - Uint2048 = 11, - Uint2 = 12, - Uint6 = 13, - Uint10 = 14, - Uint12 = 15, - Uint14 = 16, - Int2 = 17, - Int4 = 18, - Int6 = 19, - Int8 = 20, - Int10 = 21, - Int12 = 22, - Int14 = 23, - Int16 = 24, - Int32 = 25, - Int64 = 26, - Int128 = 27, - Int160 = 28, - Int256 = 29, + + // [U256-DISABLED] + // Uint256 = 8, + + // Remaining FHE types are too high precision and not supported. + // Uint512 = 9, + // Uint1024 = 10, + // Uint2048 = 11, + // Uint2 = 12, + // Uint6 = 13, + // Uint10 = 14, + // Uint12 = 15, + // Uint14 = 16, + // Int2 = 17, + // Int4 = 18, + // Int6 = 19, + // Int8 = 20, + // Int10 = 21, + // Int12 = 22, + // Int14 = 23, + // Int16 = 24, + // Int32 = 25, + // Int64 = 26, + // Int128 = 27, + // Int160 = 28, + // Int256 = 29, } /** @@ -43,7 +44,7 @@ export const FheUintUTypes = [ FheTypes.Uint32, FheTypes.Uint64, FheTypes.Uint128, - FheTypes.Uint256, + // FheTypes.Uint256, ] as const; /** @@ -56,6 +57,6 @@ export const FheAllUTypes = [ FheTypes.Uint32, FheTypes.Uint64, FheTypes.Uint128, - FheTypes.Uint256, + // FheTypes.Uint256, FheTypes.Uint160, ] as const; diff --git a/src/types/encryptable.ts b/src/types/encryptable.ts index e3856b9..5adcc40 100644 --- a/src/types/encryptable.ts +++ b/src/types/encryptable.ts @@ -7,7 +7,6 @@ import { CoFheInUint32, CoFheInUint64, CoFheInUint128, - CoFheInUint256, CoFheInAddress, } from "./encrypted"; @@ -35,13 +34,11 @@ export type EncryptableUint128 = { data: string | bigint; utype: FheTypes.Uint128; }; -/** - * @deprecated High precision uints will not supported in the future, max size is u128. - */ -export type EncryptableUint256 = { - data: string | bigint; - utype: FheTypes.Uint256; -}; +// [U256-DISABLED] +// export type EncryptableUint256 = { +// data: string | bigint; +// utype: FheTypes.Uint256; +// }; export type EncryptableAddress = { data: string | bigint; utype: FheTypes.Uint160; @@ -62,11 +59,9 @@ export const Encryptable = { ({ data, securityZone, utype: FheTypes.Uint64 }) as EncryptableUint64, uint128: (data: EncryptableUint128["data"], securityZone = 0) => ({ data, securityZone, utype: FheTypes.Uint128 }) as EncryptableUint128, - /** - * @deprecated High precision uints will not supported in the future, max size is u128. - */ - uint256: (data: EncryptableUint256["data"], securityZone = 0) => - ({ data, securityZone, utype: FheTypes.Uint256 }) as EncryptableUint256, + // [U256-DISABLED] + // uint256: (data: EncryptableUint256["data"], securityZone = 0) => + // ({ data, securityZone, utype: FheTypes.Uint256 }) as EncryptableUint256, } as const; export type EncryptableItem = @@ -76,7 +71,8 @@ export type EncryptableItem = | EncryptableUint32 | EncryptableUint64 | EncryptableUint128 - | EncryptableUint256 + // [U256-DISABLED] + // | EncryptableUint256 | EncryptableAddress; // COFHE Encrypt @@ -93,11 +89,12 @@ export type Encryptable_CoFheInItem_Map = ? CoFheInUint64 : E extends EncryptableUint128 ? CoFheInUint128 - : E extends EncryptableUint256 - ? CoFheInUint256 - : E extends EncryptableAddress - ? CoFheInAddress - : never; + : // [U256-DISABLED] + // : E extends EncryptableUint256 + // ? CoFheInUint256 + E extends EncryptableAddress + ? CoFheInAddress + : never; export type Encrypted_Inputs = T extends Primitive ? LiteralToPrimitive diff --git a/src/types/encrypted.ts b/src/types/encrypted.ts index aef9ae5..ad1d27b 100644 --- a/src/types/encrypted.ts +++ b/src/types/encrypted.ts @@ -29,12 +29,10 @@ export type CoFheInUint64 = CoFheInItem & { export type CoFheInUint128 = CoFheInItem & { utype: FheTypes.Uint128; }; -/** - * @deprecated High precision uints will not supported in the future, max size is u128. - */ -export type CoFheInUint256 = CoFheInItem & { - utype: FheTypes.Uint256; -}; +// [U256-DISABLED] +// export type CoFheInUint256 = CoFheInItem & { +// utype: FheTypes.Uint256; +// }; export type CoFheInAddress = CoFheInItem & { utype: FheTypes.Uint160; }; diff --git a/src/web/zkPoK.ts b/src/web/zkPoK.ts index 1b90ae8..198b796 100644 --- a/src/web/zkPoK.ts +++ b/src/web/zkPoK.ts @@ -11,7 +11,6 @@ import { MAX_UINT32, MAX_UINT64, MAX_UINT128, - MAX_UINT256, } from "../core/utils/consts"; import { toBigIntOrThrow, @@ -72,12 +71,13 @@ export const zkPack = ( builder.push_u128(bint); break; } - case FheTypes.Uint256: { - const bint = toBigIntOrThrow(item.data); - validateBigIntInRange(bint, MAX_UINT256); - builder.push_u256(bint); - break; - } + // [U256-DISABLED] + // case FheTypes.Uint256: { + // const bint = toBigIntOrThrow(item.data); + // validateBigIntInRange(bint, MAX_UINT256); + // builder.push_u256(bint); + // break; + // } case FheTypes.Uint160: { const bint = typeof item.data === "string" @@ -95,8 +95,8 @@ export const zkPack = ( // Force multiple event loop cycles to ensure UI updates const forceUIUpdate = async (cycles: number = 3): Promise => { for (let i = 0; i < cycles; i++) { - await new Promise(resolve => { - if (typeof requestAnimationFrame !== 'undefined') { + await new Promise((resolve) => { + if (typeof requestAnimationFrame !== "undefined") { requestAnimationFrame(() => setTimeout(resolve, 0)); } else { setTimeout(resolve, 16); // ~60fps @@ -119,23 +119,25 @@ export const zkProve = async ( ); console.log("Starting zkProve - forcing UI updates..."); - + // Force multiple UI update cycles before the blocking operation await forceUIUpdate(5); console.log("About to start heavy WASM computation (this will block)..."); - + // Give one final chance for UI to update - return new Promise(resolve => { + return new Promise((resolve) => { requestAnimationFrame(() => { setTimeout(() => { - console.log("🔥 Executing build_with_proof_packed (blocking operation)..."); - + console.log( + "🔥 Executing build_with_proof_packed (blocking operation)...", + ); + const compactList = builder.build_with_proof_packed( crs, metadata, ZkComputeLoad.Verify, ); - + console.log("✅ build_with_proof_packed completed"); resolve(compactList); }, 50); // Give 50ms for final UI updates From 9e94d1cba43137c57a68690764b73e2a7e14b09c Mon Sep 17 00:00:00 2001 From: architect-dev Date: Wed, 10 Sep 2025 13:18:31 +0200 Subject: [PATCH 3/3] Add missed tags --- src/types/base.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/types/base.ts b/src/types/base.ts index 5f8f27d..18ccbaa 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -44,6 +44,7 @@ export const FheUintUTypes = [ FheTypes.Uint32, FheTypes.Uint64, FheTypes.Uint128, + // [U256-DISABLED] // FheTypes.Uint256, ] as const; @@ -57,6 +58,7 @@ export const FheAllUTypes = [ FheTypes.Uint32, FheTypes.Uint64, FheTypes.Uint128, + // [U256-DISABLED] // FheTypes.Uint256, FheTypes.Uint160, ] as const;