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

FailedAssertion error code should be displaying as integer #1147

Closed
frisitano opened this issue Nov 14, 2023 · 4 comments
Closed

FailedAssertion error code should be displaying as integer #1147

frisitano opened this issue Nov 14, 2023 · 4 comments

Comments

@frisitano
Copy link
Contributor

When displaying the error code associated with a failed assertion we should display it as an integer instead of a field element.

FailedAssertion(clk, err_code) => {
write!(f, "Assertion failed at clock cycle {clk} with error code {err_code}")
}

@bobbinth
Copy link
Contributor

The above code should print out Felt as an integer (Display implementation on Felt calls as_int() method). Are there some other places where it is being printed out differently?

@frisitano
Copy link
Contributor Author

frisitano commented Nov 15, 2023

The above code should print out Felt as an integer (Display implementation on Felt calls as_int() method). Are there some other places where it is being printed out differently?

Yes, when a program panics due to a failed .unwrap() the Felt appears to be displayed in Montgomery form. It's possible this is because it's being displayed using the Debug derivation. Maybe we should implement Debug using .as_int() on Felt instead of #1148?

@bobbinth
Copy link
Contributor

Yes, when a program panics due to a failed .unwrap() the Felt appears to be displayed in Montgomery form.

Ah! Makes sense.

It's possible this is because it's being displayed using the Debug derivation. Maybe we should implement Debug using .as_int() on Felt instead of #1148?

Yes, I think that's what's probably is going on. And yes, I think it would probably be better to print out the actual integer value for Debug as well (and if someone needs to print out the internal value, they can use inner() method).

@bobbinth
Copy link
Contributor

@frisitano - since facebook/winterfell#228 has been merged, we can probably close this issue?

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

No branches or pull requests

2 participants