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 the impl for Displaying zero element in Fp #806

Merged
merged 5 commits into from
Apr 6, 2024

Conversation

winderica
Copy link
Contributor

@winderica winderica commented Mar 12, 2024

Description

The current implementation of Display for Fp introduces a bug where formatting Fp::<P, N>::zero() produces an empty string. This is because the leading zeros of a field element will always be removed even when it is zero.

This PR fixes this bug by simply removing the trim_start_matches('0') call, which is in fact unnecessary because self.into_bigint().to_string() (which in turn calls the formatter of num::BigUint) already produces a string without leading zeros.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests (N/A)
  • Updated relevant documentation in the code (N/A)
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

@winderica winderica requested review from a team as code owners March 12, 2024 18:00
@winderica winderica requested review from z-tech, Pratyush and weikengchen and removed request for a team March 12, 2024 18:00
@mmagician mmagician added this pull request to the merge queue Mar 25, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Mar 25, 2024
@mmagician mmagician enabled auto-merge April 6, 2024 09:42
@mmagician mmagician added this pull request to the merge queue Apr 6, 2024
Merged via the queue into arkworks-rs:master with commit 97c7a4f Apr 6, 2024
37 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.

3 participants