Skip to content

Conversation

@mj850
Copy link
Contributor

@mj850 mj850 commented Dec 4, 2024

Range proof Verification takes a long time.
30% of the time spent is initializing this RangeProofVerifier. In order to save some time, we should cache these verifiers and reuse them during verification.

Creates a struct that automatically caches verifiers for each upperbound, then reworks the Verify method to use this

}

// Caches the verifiers created for each upper bound
type CachedRangeVerifier struct {
Copy link
Collaborator

@dssei dssei Dec 4, 2024

Choose a reason for hiding this comment

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

Curious if caching belongs to cryptography/zk layer? I thought we will do the actual caching in sei-chain layer, but here just add ability to plug the verifier e.g.

type RangeProofVerifier struct {
	verifier *bulletproof.RangeVerifier
}

and then in method we just do

verified, err := r.verifier.Verify(proof.Proof, ciphertext.C, proofGenerators, upperBound, getTranscript())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented this way initially but this seems like a strictly better implementation (ie I can't see why the old method would be useful to keep around )

This is simar to what we do with the teg decryptor object

@mj850 mj850 merged commit 4debb1a into main Dec 6, 2024
11 checks passed
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.

3 participants