Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding max prover config, and separate wasm instances #240

Merged
merged 4 commits into from
Sep 30, 2024

Conversation

Chengxuan
Copy link
Contributor

@Chengxuan Chengxuan commented Sep 30, 2024

Resolves #226

Update the golang client to follow the pattern used in this zeto test: hyperledger-labs/zeto#87 to ensure concurrent proof generation are performance on different wasm instances to avoid concurrent modification of shared memory in a single wasm instance.

Copy link
Contributor

@jimthematrix jimthematrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm @Chengxuan , except for a comment on cosmetics

sp.proverCacheRWLock.RLock()
circuit, _ := sp.circuitsCache.Get(workerID)
provingKey, _ := sp.provingKeysCache.Get(workerID)
sp.proverCacheRWLock.RUnlock() // release the lock, happy path, 1 lock is good enough
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is moved down to after the if block, it should be equivalent but without the re-locking right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code here is for upgrading the read lock to a write lock if the prover has not been cached.

there is no lock upgrading built-in, so there could always be a race condition between releasing the read lock and obtaining the write lock, which means another check is always required.

@peterbroadhurst peterbroadhurst merged commit ab6e602 into main Sep 30, 2024
3 checks passed
@peterbroadhurst peterbroadhurst deleted the add-max-prover-count branch September 30, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support parallel proof generations
3 participants