-
Notifications
You must be signed in to change notification settings - Fork 228
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
deps: Use ed25519-consensus instead of ed25519-dalek (#1067) #1245
deps: Use ed25519-consensus instead of ed25519-dalek (#1067) #1245
Conversation
e20f513
to
b2e822a
Compare
Codecov Report
@@ Coverage Diff @@
## main #1245 +/- ##
=======================================
- Coverage 64.4% 64.4% -0.1%
=======================================
Files 245 245
Lines 21581 21547 -34
=======================================
- Hits 13917 13889 -28
+ Misses 7664 7658 -6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good.
One thing which I find potentially problematic (though not a change I'm requesting now) is that ed25519-consensus does not integrate into the signature
framework. Why is that?
@@ -40,7 +39,6 @@ define_error! { | |||
| _ | { "public key missing" }, | |||
|
|||
Signature | |||
[ DisplayOnly<SignatureError> ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error is deliberately opaque, but we can't make the Display
impl transparent in flex-error, so we have our own message. OK.
// Tendermint uses a serialization format inherited from Go that includes a | ||
// cached copy of the public key as the second half. This is somewhat | ||
// dangerous, since there's no validation that the two parts are consistent | ||
// with each other, so we ignore the second half and just check consistency | ||
// with the re-derived data. | ||
let signing_key = Ed25519::try_from(&keypair_bytes[0..32]) | ||
.map_err(|_| D::Error::custom("invalid signing key"))?; | ||
let verification_key = VerificationKey::from(&signing_key); | ||
if &keypair_bytes[32..64] != verification_key.as_bytes() { | ||
return Err(D::Error::custom("keypair mismatch")); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
flex-error = { version = "0.4.4", default-features = false } | ||
flume = { version = "0.10", default-features = false } | ||
rand_core = { version = "0.5", default-features = false, features = ["std"] } | ||
rand_core = { version = "0.6", default-features = false, features = ["std"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, isis still has not updated their rand version? Another reason to switch.
There's no particular reason; there wasn't a need to do it when the crate was written, and it wasn't possible to implement for trivial reasons -- AFAIR, it was because the We could probably add it if it's important. To be honest, the main reason we're interested in this is that the |
@hdevalence I think it's OK to not conform to the So, I think this just needs a change to do the exhaustive match for proto's key type enum, and we can merge it. |
@hdevalence that bound is removed in a forthcoming |
Cool, I updated the exhaustive match. I'd be happy to try to support the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs merging from main, but is otherwise good to go.
f5c8938
to
726c637
Compare
Rebased. |
Was the failing check here due to clippy errors from Rust v1.66? If so, #1253's been merged and that should fix things. |
@hdevalence please resolve the conflicts here and then we'll merge and cut a new release. |
…#1067) * Use ed25519-consensus instead of ed25519-dalek Closes informalsystems#355 (see that issue for more context; `ed25519-consensus` is a fork of `ed25519-zebra` that's Zcash-independent). This change ensures that `tendermint-rs` has the same signature verification as `tendermint`, which uses the validation criteria provided by the Go `ed25519consensus` library. * clippy fixes Co-authored-by: Thane Thomson <[email protected]> * Remove redundant dependency Signed-off-by: Thane Thomson <[email protected]> * cargo fmt Signed-off-by: Thane Thomson <[email protected]> * Add changelog entries Signed-off-by: Thane Thomson <[email protected]> Co-authored-by: Henry de Valence <[email protected]>
726c637
to
e39ee1c
Compare
Rebased and did another round of clippy fixes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(͠≖ ͜ʖ͠≖)👌
Thank you @hdevalence and @xla! |
Thanks for merging this! Are there other changes in flight at the moment, or would it be possible to get it into a release soon? (We'll have to wait for it to propagate through our dep tree before we can pick it up). |
Backports this change to the new
main
(was #1067).Closes #355 (see that issue for more context;
ed25519-consensus
is a fork ofed25519-zebra
that's Zcash-independent).This change ensures that
tendermint-rs
has the same signature verification astendermint
, which uses the validation criteria provided by the Goed25519consensus
library.Co-authored-by: Thane Thomson [email protected]
Signed-off-by: Thane Thomson [email protected]
Signed-off-by: Thane Thomson [email protected]
Signed-off-by: Thane Thomson [email protected]
Co-authored-by: Henry de Valence [email protected]