Skip to content

fix: Fix barrett reduction bug#51

Merged
TomAFrench merged 6 commits intomainfrom
mc/fix-barrett-bug
Nov 6, 2024
Merged

fix: Fix barrett reduction bug#51
TomAFrench merged 6 commits intomainfrom
mc/fix-barrett-bug

Conversation

@iAmMichaelConnor
Copy link
Copy Markdown
Collaborator

Resolves the test failing in noir_rsa. Thanks to Zac for spotting the bug.

cc @kashbrti

@TomAFrench
Copy link
Copy Markdown
Member

Can you add a test to this repository which checks the behaviour of this?

@iAmMichaelConnor
Copy link
Copy Markdown
Collaborator Author

Oh good point. I'll use the RSA one.

@iAmMichaelConnor
Copy link
Copy Markdown
Collaborator Author

iAmMichaelConnor commented Nov 6, 2024

Hmmm... actually, using the RSA one would just bring most of the RSA lib into bignum. I don't know how to distill a test so complex into a smaller test with no dependencies.

@kashbrti
Copy link
Copy Markdown
Contributor

kashbrti commented Nov 6, 2024

I'm writing a test now that only passes the output that was making the bug happen to a test directly

Copy link
Copy Markdown
Collaborator Author

@iAmMichaelConnor iAmMichaelConnor left a comment

Choose a reason for hiding this comment

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

Thanks for this! Just a couple of nits.
Eventually we'll need detailed tests of each function, if we want this thing to pass an audit.

Comment thread src/tests/runtime_bignum_test.nr Outdated
Comment thread src/tests/runtime_bignum_test.nr Outdated
Comment thread src/tests/runtime_bignum_test.nr
@kashbrti
Copy link
Copy Markdown
Contributor

kashbrti commented Nov 6, 2024

formatter check is ok on my box but fails on te CI

@iAmMichaelConnor
Copy link
Copy Markdown
Collaborator Author

Are you using nargo v0.36.0 to format? I think that's the version you need to use, to match the CI tests.

Comment thread src/tests/runtime_bignum_test.nr
Comment thread src/fns/unconstrained_helpers.nr
@TomAFrench TomAFrench merged commit c61a621 into main Nov 6, 2024
@github-actions github-actions bot mentioned this pull request Nov 6, 2024
TomAFrench added a commit that referenced this pull request Nov 8, 2024
* main:
  feat: remove generic parameter from the `BigNum` trait (#44)
  fix: fix broken tests in `runtime_bignum_test.nr` (#39)
  feat: remove a bunch of unnecessary bytecode from unconstrained ops (#50)
  fix: Fix barrett reduction bug (#51)
  feat: optimize brillig execution of `split_X_bits` functions (#47)
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