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

fix(jolt-core): Fixes DIVU and REMU sequence_output #506

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

mw2000
Copy link
Contributor

@mw2000 mw2000 commented Nov 17, 2024

We return the correct output from sequence output when the divisor is zero, for divu and remu.

Should fix #499

We return the correct output from sequence output when the divisor is zero, for divu and remu.
@mw2000
Copy link
Contributor Author

mw2000 commented Nov 17, 2024

From #498 I believe we just need to fix the sequence output (which is used in the jolt virtual sequence test macro) to be output uint::max when the divisor is zero.

Comment on lines 209 to 217
let quotient = if y == 0 {
match WORD_SIZE {
32 => u32::MAX as u64,
64 => u64::MAX,
_ => panic!("Unsupported WORD_SIZE: {}", WORD_SIZE),
}
} else {
x / y
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's get rid of this and just move the existing match into the else block below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix up

Copy link
Collaborator

@moodlezoup moodlezoup left a comment

Choose a reason for hiding this comment

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

thanks Mihir!

@moodlezoup moodlezoup merged commit c90d6f9 into a16z:main Nov 20, 2024
6 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.

DIVU and REMU sequence_output incorrectly handle 0 divisor
2 participants