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

Exception raised in ecdsa gem, not on jruby-head nor ruby-head #3653

Open
rickhull opened this issue Aug 30, 2024 · 2 comments
Open

Exception raised in ecdsa gem, not on jruby-head nor ruby-head #3653

rickhull opened this issue Aug 30, 2024 · 2 comments

Comments

@rickhull
Copy link

rickhull commented Aug 30, 2024

I noticed a discrepancy in behavior between ruby-head and jruby-head on the one hand, and truffleruby-head on the other, via Github Actions.

Here is the GHA that fails only on truffleruby-head: https://github.com/rickhull/nostrb/actions/runs/10637157995/job/29490471421 The outermost test that fails is rake test, which succeeds entirely on ruby-head and jruby-head.

relevant stack trace:

 /home/runner/.rubies/truffleruby-head/lib/gems/gems/ecdsa-1.2.0/lib/ecdsa/prime_field.rb:62:in `inverse': Inversion bug: remainder is not 1. (RuntimeError)
	from /home/runner/.rubies/truffleruby-head/lib/gems/gems/ecdsa-1.2.0/lib/ecdsa/point.rb:74:in `add_to_point'
	from /home/runner/.rubies/truffleruby-head/lib/gems/gems/ecdsa-1.2.0/lib/ecdsa/point.rb:122:in `multiply_by_scalar'
	from /home/runner/.rubies/truffleruby-head/lib/gems/gems/schnorr_sig-0.2.1.1/lib/schnorr_sig/pure.rb:149:in `verify?'
	from /home/runner/.rubies/truffleruby-head/lib/gems/gems/schnorr_sig-0.2.1.1/lib/schnorr_sig/pure.rb:97:in `sign'
	from /home/runner/work/nostrb/nostrb/lib/nostrb/event.rb:155:in `sign'

The failure is in the ecdsa gem, here: https://github.com/DavidEGrayson/ruby_ecdsa/blob/master/lib/ecdsa/prime_field.rb#L62

@rickhull
Copy link
Author

rickhull commented Aug 30, 2024

Here is a more specific failure, this time from schnorr_sig gem directly, rather than nostrb via transitive dependency: https://github.com/rickhull/schnorr_sig/actions/runs/10640243873/job/29499643425

/home/runner/.rubies/truffleruby-head/lib/gems/gems/ecdsa-1.2.0/lib/ecdsa/prime_field.rb:62:in `inverse': Inversion bug: remainder is not 1. (RuntimeError)
	from /home/runner/.rubies/truffleruby-head/lib/gems/gems/ecdsa-1.2.0/lib/ecdsa/point.rb:74:in `add_to_point'
	from /home/runner/.rubies/truffleruby-head/lib/gems/gems/ecdsa-1.2.0/lib/ecdsa/point.rb:122:in `multiply_by_scalar'
	from /home/runner/work/schnorr_sig/schnorr_sig/lib/schnorr_sig/pure.rb:147:in `verify?'
	from /home/runner/work/schnorr_sig/schnorr_sig/test/vectors.rb:17:in `block in <top (required)>'

@andrykonchin
Copy link
Member

Thank you for the report, we'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants