Skip to content

Conversation

@Pratyush
Copy link
Member

Description

Reduces the size of SynthesisError to reduce overhead. Generally, we expect the happy case (no error), so it makes sense to optimize for that.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@Pratyush Pratyush requested review from alireza-shirzad and Copilot and removed request for alireza-shirzad May 31, 2025 10:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR cleans up and simplifies the SynthesisError implementation and related API methods throughout the codebase to reduce overhead and improve clarity.

  • Removed several rarely used variants from the SynthesisError enum and streamlined error messages.
  • Updated the get_lc function in both the constraint system reference and the constraint system to return an Option instead of a Result.
  • Simplified helper functions such as get_all_predicate_arities by replacing custom hasher instantiation with the default.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
relations/src/utils/error.rs Removed error variants and simplified error message formatting.
relations/src/gr1cs/constraint_system_ref.rs Modified get_all_predicate_arities and updated get_lc to return Option.
relations/src/gr1cs/constraint_system.rs Refactored get_lc to return Option and adjusted constraint trace logic.
Comments suppressed due to low confidence (2)

relations/src/gr1cs/constraint_system_ref.rs:422

  • Changing the function signature from Result to Option removes explicit error context; ensure that all call sites are updated accordingly to handle the absence of a constraint system.
pub fn get_lc(&self, lc_index: LcIndex) -> Option<LinearCombination<F>> {

relations/src/gr1cs/constraint_system.rs:599

  • Updating the return type from Result to Option hides error details; verify that the calling code properly handles the None case to avoid unintended silent failures.
pub fn get_lc(&self, lc_index: LcIndex) -> Option<&LinearCombination<F>> {

@Pratyush Pratyush merged commit 4445b8f into master May 31, 2025
4 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