Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/CRISP/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"deploy": "gh-pages -d dist"
},
"dependencies": {
"@crisp-e3/sdk": "0.5.4",
"@crisp-e3/sdk": "0.5.6",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/react": "^11.11.4",
"@phosphor-icons/react": "^2.1.4",
Expand Down
2 changes: 1 addition & 1 deletion examples/CRISP/packages/crisp-contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@crisp-e3/contracts",
"version": "0.5.4",
"version": "0.5.6",
"type": "module",
"files": [
"contracts",
Expand Down
2 changes: 1 addition & 1 deletion examples/CRISP/packages/crisp-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@crisp-e3/sdk",
"version": "0.5.4",
"version": "0.5.6",
"type": "module",
"author": {
"name": "gnosisguild",
Expand Down
23 changes: 13 additions & 10 deletions examples/CRISP/packages/crisp-sdk/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,30 @@ export const getAddressFromSignature = async (signature: `0x${string}`, messageH
}

/**
* Get optimal number of threads for proof generation
* Leaves at least 1 core free for other operations
* Works in both Node.js and browser environments
* Get optimal number of threads for proof generation.
* Leaves at least 1 core free for other operations.
* Works in both Node.js and browser environments.
*/
export async function getOptimalThreadCount(): Promise<number> {
// Browser environment - check first to avoid Node.js imports in browser builds
if (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) {
return Math.max(1, navigator.hardwareConcurrency - 1)
}

// Node.js environment - use os module if available
if (typeof process !== 'undefined' && process.versions?.node) {
// Check for Node.js without directly accessing process to avoid polyfill detection
if (typeof window === 'undefined' && typeof globalThis !== 'undefined' && typeof globalThis.process !== 'undefined') {
try {
const os = await import('os')

const cpuCount = typeof os.availableParallelism === 'function' ? os.availableParallelism() : os.cpus().length

return Math.max(1, cpuCount - 1)
} catch {
// Fall through to browser check or fallback
// Fall through to fallback
}
}

// Browser environment
if (typeof navigator !== 'undefined' && navigator.hardwareConcurrency) {
return Math.max(1, navigator.hardwareConcurrency - 1)
}

// Fallback
return 5
}
2 changes: 1 addition & 1 deletion examples/CRISP/packages/crisp-zk-inputs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@crisp-e3/zk-inputs",
"type": "module",
"description": "Core logic to pre-compute CRISP ZK inputs (WASM/JavaScript bindings).",
"version": "0.5.4",
"version": "0.5.6",
"license": "LGPL-3.0-only",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading