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 5cb2fd9..18ccbaa 100644 --- a/src/types/base.ts +++ b/src/types/base.ts @@ -7,28 +7,32 @@ export enum FheTypes { Uint64 = 5, Uint128 = 6, Uint160 = 7, - 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, } /** @@ -40,7 +44,8 @@ export const FheUintUTypes = [ FheTypes.Uint32, FheTypes.Uint64, FheTypes.Uint128, - FheTypes.Uint256, + // [U256-DISABLED] + // FheTypes.Uint256, ] as const; /** @@ -53,6 +58,7 @@ export const FheAllUTypes = [ FheTypes.Uint32, FheTypes.Uint64, FheTypes.Uint128, - FheTypes.Uint256, + // [U256-DISABLED] + // FheTypes.Uint256, FheTypes.Uint160, ] as const; diff --git a/src/types/encryptable.ts b/src/types/encryptable.ts index a802468..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,10 +34,11 @@ export type EncryptableUint128 = { data: string | bigint; utype: FheTypes.Uint128; }; -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; @@ -59,8 +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, - 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 = @@ -70,7 +71,8 @@ export type EncryptableItem = | EncryptableUint32 | EncryptableUint64 | EncryptableUint128 - | EncryptableUint256 + // [U256-DISABLED] + // | EncryptableUint256 | EncryptableAddress; // COFHE Encrypt @@ -87,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 6e159e3..ad1d27b 100644 --- a/src/types/encrypted.ts +++ b/src/types/encrypted.ts @@ -29,9 +29,10 @@ export type CoFheInUint64 = CoFheInItem & { export type CoFheInUint128 = CoFheInItem & { utype: FheTypes.Uint128; }; -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