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

Deprecated divn and implemented core::ops::Shr #736

Merged
merged 15 commits into from
Dec 20, 2023

Conversation

hdvanegasm
Copy link
Contributor

@hdvanegasm hdvanegasm commented Dec 19, 2023

Description

This PR closes #714. I choose to add #deprecate annotation to divn() instead of removing it to keep the backward compatibility. Let me know if it's best to remove such old function.

@hdvanegasm hdvanegasm requested review from a team as code owners December 19, 2023 22:54
@hdvanegasm hdvanegasm requested review from z-tech, Pratyush and weikengchen and removed request for a team December 19, 2023 22:54
@hdvanegasm
Copy link
Contributor Author

Can someone help me with the "CI / Test against curves (bls12_377)" test? AFAIK, I modified the files that the check is complaining about as you can see in the "Files Changed" tab. Why is it failing?

@mmaker
Copy link
Member

mmaker commented Dec 20, 2023

can you please make two separate pull requests for Shr and Shl?

@hdvanegasm hdvanegasm changed the title Deprecated divn and muln and implemented core::ops::Shr and core::ops::Shl respectively Deprecated divn implemented core::ops::Shr Dec 20, 2023
@hdvanegasm hdvanegasm changed the title Deprecated divn implemented core::ops::Shr Deprecated divn and implemented core::ops::Shr Dec 20, 2023
@hdvanegasm
Copy link
Contributor Author

Done! you can consider this as the PR for core::ops::Shr in place of divn(). Unfortunatelly, the check that was failing before still fails. Do you know why is this?

@z-tech
Copy link
Contributor

z-tech commented Dec 20, 2023

Done! you can consider this as the PR for core::ops::Shr in place of divn(). Unfortunatelly, the check that was failing before still fails. Do you know why is this?

Hi @hdvanegasm, we saw that this check fails because you've deprecated the functions described by the error message. You must change these to the new replacements and the check will pass

@hdvanegasm
Copy link
Contributor Author

Hi @z-tech. Thanks for your reply. Notice that the check is complaining about lines that where changed in this PR. An example of this is presented here: https://github.com/arkworks-rs/algebra/pull/736/files#diff-7bfbb2ccb1c569a529a64dfba848ae83498a02f8f3012fbd7b2c87f0c11c904eR830. You may take a look at the changed files and you will find that all the lines that the check is showing are changed already for the operator >>. Let me know if I'm wrong in this 😄

@hdvanegasm
Copy link
Contributor Author

Is it possible that this check is failling because the CI file is pointing to an old version of the repo? Take a look at this:

repository: arkworks-rs/curves

@z-tech
Copy link
Contributor

z-tech commented Dec 20, 2023

Is it possible that this check is failling because the CI file is pointing to an old version of the repo? Take a look at this:

repository: arkworks-rs/curves

I see. If you remove this does it work? If yes, it is safe to remove we have archived this repo.

CHANGELOG.md Outdated Show resolved Hide resolved
impl<const N: usize> Shr<u32> for BigInt<N> {
type Output = Self;

fn shr(self, mut rhs: u32) -> Self::Output {
Copy link
Member

Choose a reason for hiding this comment

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

can you please document here (and in the trait definition) that, differently from the implementation of u8, u32, u64, etc shift right will NOT return an underflow error if the value being shifted is larger than N * sizeof(usize)?

Copy link
Contributor Author

@hdvanegasm hdvanegasm Dec 20, 2023

Choose a reason for hiding this comment

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

I think that it should be "(...) will NOT return an underflow error if the value being shifted is larger than N * 64", given that the limb size 64 for the case of BigInt.

I didn't document the trait definition because we are forcing the implementor to specify the shr() function. So, I didn't find an appropriate place to put this message. Let me know if it's fine like it is or if you have a proper place to put this message in the trait definition.

I removed the test against the old `algebra` repository to avoid conflicts in the CI.
@hdvanegasm
Copy link
Contributor Author

Is it possible that this check is failling because the CI file is pointing to an old version of the repo? Take a look at this:

repository: arkworks-rs/curves

I see. If you remove this does it work? If yes, it is safe to remove we have archived this repo.

I removed the check completely. Let me know if this is what you were looking for.

ff/src/biginteger/mod.rs Outdated Show resolved Hide resolved
Copy link
Member

@Pratyush Pratyush left a comment

Choose a reason for hiding this comment

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

Small fixes

curves/bls12_381/src/fields/tests.rs Outdated Show resolved Hide resolved
curves/bls12_381/src/fields/tests.rs Outdated Show resolved Hide resolved
curves/bls12_381/src/fields/tests.rs Outdated Show resolved Hide resolved
curves/bls12_381/src/fields/tests.rs Outdated Show resolved Hide resolved
ec/src/scalar_mul/variable_base/mod.rs Outdated Show resolved Hide resolved
ff/src/biginteger/mod.rs Outdated Show resolved Hide resolved
ff/src/biginteger/mod.rs Outdated Show resolved Hide resolved
@Pratyush Pratyush enabled auto-merge December 20, 2023 18:11
@Pratyush Pratyush disabled auto-merge December 20, 2023 18:14
@Pratyush Pratyush enabled auto-merge December 20, 2023 18:15
@Pratyush Pratyush disabled auto-merge December 20, 2023 18:17
@Pratyush Pratyush enabled auto-merge December 20, 2023 18:17
@Pratyush Pratyush disabled auto-merge December 20, 2023 18:19
@Pratyush Pratyush enabled auto-merge December 20, 2023 18:19
@Pratyush Pratyush added this pull request to the merge queue Dec 20, 2023
Merged via the queue into arkworks-rs:master with commit ce509bc Dec 20, 2023
37 checks passed
@hdvanegasm hdvanegasm deleted the shl-and-shr branch December 20, 2023 19:11
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.

Implement core::ops::Shr for BigInt in place of BigInt::divn()
4 participants