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

Stack trace in Error::Synthesize #294

Open
ed255 opened this issue Mar 6, 2024 · 1 comment
Open

Stack trace in Error::Synthesize #294

ed255 opened this issue Mar 6, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ed255
Copy link
Member

ed255 commented Mar 6, 2024

In #290 I plan to split the Error type into one for the frontend and one for the backend. In a weekly call Adria proposed that we incorporate stack traces on synthesize errors in order to make it easier to debug synthesize errors (which currently don't contain any information context).

One possible crate we can explore is https://github.com/eyre-rs/eyre

@ed255 ed255 added the enhancement New feature or request label Mar 6, 2024
@adria0 adria0 self-assigned this Mar 20, 2024
@adria0
Copy link
Member

adria0 commented Mar 21, 2024

Usually:

  • panic! when

    • application enters into an state that will generate an undesired non deterministic output (corruption&co),
    • we need a way to debug complex back traces
    • use operators (like impl<F: Field> Mul for Expression<F>)
  • Error when

    • you can do something with the result

But it's everything somehow mixed, or I do not see the logic of generating panics or returns errors in the current library. Anyway, let's say that in the case of Halo2, probably, the only error that really matters is in the proof verification, panic'ing or returning error in proof generation is just ok.

What is not implemented is something like SynthesisWithBackTrace(std::backtrace::Backtrace), and really does not seem to have any sense at all. So I'm now in the side of, if developer wants a stack trace for Error::Synthesis, just generating an Error::Other

    pub fn synthesis_with_backtrace() -> Self {
        let backtrace = std::backtrace::Backtrace::force_capture();
        Error::Other(backtrace.to_string())
    }

because Synthesis error is very localized in the Halo2 library (in only 2 places) and you can add panic! there in the case that you need it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants