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 deprecation warning for use Bitwise in Elixir 1.14+ #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

darraghenright
Copy link

Hi there 👋 Nice library!

I noticed a couple of deprecation warnings when running tests in a recent version:

mix test
Compiling 2 files (.ex)
warning: use Bitwise is deprecated. import Bitwise instead
  lib/utils/der.ex:4: EllipticCurve.Utils.Der (module)

warning: use Bitwise is deprecated. import Bitwise instead
  lib/utils/integer.ex:4: EllipticCurve.Utils.Integer (module)

.............
Finished in 0.06 seconds (0.00s async, 0.06s sync)
13 tests, 0 failures

I looked through the Elixir changelog and discovered that use Bitwise is hard deprecated since 1.14.

This PR makes the recommended changes and imports the module instead.


On another topic — I wanted to check the backwards compatibility of this change. I started by running the tests against version 1.9, which is the minimum stated compatible version in mix.exs but I encountered a compilation error:

== Compilation error in file lib/math.ex ==
** (CompileError) lib/math.ex:245: cannot invoke remote function p.y/0 inside guards
    (stdlib) lists.erl:1354: :lists.mapfoldl/3

Which refers to the following line:

defp jacobianMultiply(p, _n, _cN, _cA, _cP) when p.y == 0 do

I decided to run tests against the master branch in a number of hexpm/elixir containers and the earliest tag that did not raise this compilation error is 1.11.0-erlang-21.0.1-debian-bullseye-20210902.

I can confirm the Bitwise changes in this PR also result in a successful test run:

root@94fa891ce1c3:/srv# elixir -v
Erlang/OTP 21 [erts-10.0.1] [source] [64-bit] [smp:6:6] [ds:6:6:10] [async-threads:1]

Elixir 1.11.0 (compiled with Erlang/OTP 21)
root@94fa891ce1c3:/srv# mix test
.............

Finished in 0.1 seconds
13 tests, 0 failures

Randomized with seed 438621

So in addition to that change, I think it might be necessary to bump the minimum stated compatible version to 1.11. In any case, this is the minimum supported version of Elixir (security patches only).

@darraghenright
Copy link
Author

Gently bumping this 👋

@darraghenright
Copy link
Author

Is this project abandoned?

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.

1 participant