Skip to content

Conversation

@hawkadrian
Copy link

What

Optimizes digest constraint generation in compress.rs from O(n²) to O(n) by computing a single non-zero flag instead of checking each element against all elements.

Why

The previous implementation created 1088 constraints (32×32 + 8×8) for digest validation, significantly increasing proof size and verification time. The optimized version reduces this to 40 constraints (32 + 8) while maintaining the same correctness guarantees. Also fixes compilation errors where arrays were moved and then accessed again.

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.

1 participant