-
Notifications
You must be signed in to change notification settings - Fork 16
chore!: refactor ToRadix to ToRadixLe and ToRadixBe #58
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR! Left one minor style comment to try out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did not mean to approve yet I hope this dismisses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am thinking it would be nicer to actually not have two separate enums for ToRadix
.
Let's switch to something like this:
Directive::ToRadix { a, b, radix, is_little_endian } => {
let val_a = get_value(a, initial_witness)?;
let a_big = BigUint::from_bytes_be(&val_a.to_be_bytes());
let a_dec = if is_little_endian {
a_big.to_radix_le(*radix)
} else {
a_big.to_radix_be(*radix)
}
match to_radix_outcome(b, &a_dec, initial_witness) {
Ok(()) => Ok(()),
Err(e) => Err(e),
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit pick comment. Once the minor merge conflicts are fixed this looks good to me :)
I have a few nits, but I appreciate how long this PR has been up so will address these in a separate PR. Btw Thank you for fixing this issue Ethan, your efforts are really appreciated :) |
Thank you guys for reviewing it 🙂!! Suggestions on details are very much welcome cus sometimes I wasn't paying attention and it helps me write better code. I didn't really notice |
* chore: bump bberg commit to match `noir-lang/noir` * fix: support usage of pedersen with non-zero `domain_separator` * chore: fix minimum amount of memory for bberg wasm
Related issue(s)
(If it does not already exist, first create a GitHub issue that describes the problem this Pull Request (PR) solves before creating the PR and link it here.)
Resolves #57
Description
refactor ToRadix to ToRadixLe and ToRadixBe
Summary of changes
The only key change is here https://github.com/Ethan-000/acvm/blob/2d1fdf892114e571a39713be172977dfadbeca22/acvm/src/pwg/directives.rs#L99
(Describe the changes in this PR. Point out breaking changes if any.)
Dependency additions / changes
(If applicable.)
Test additions / changes
add test to ToRadixRe similar to the others
(If applicable.)
Checklist
cargo fmt
with default settings.Additional context
(If applicable.)