-
Notifications
You must be signed in to change notification settings - Fork 73
Bump ed25519-dalek to 2.1.1, ed25519-dalek-bip32 to 0.3.0 #26
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
base: master
Are you sure you want to change the base?
Conversation
30b1850
to
4dce186
Compare
How does this affect performance (the bench should tell us that, I think). |
Looks like the new version is faster. Found this in the CI bench output https://github.com/anza-xyz/solana-sdk/actions/runs/13304474459/job/37152326064?pr=26:
Meanwhile in another unrelated PR: https://github.com/anza-xyz/solana-sdk/actions/runs/13344518453/job/37273344074?pr=40
|
@@ -76,12 +71,12 @@ impl Keypair { | |||
|
|||
/// Returns this `Keypair` as a base58-encoded string | |||
pub fn to_base58_string(&self) -> String { | |||
bs58::encode(&self.0.to_bytes()).into_string() | |||
bs58::encode(&self.to_bytes()).into_string() | |||
} | |||
|
|||
/// Gets this `Keypair`'s SecretKey | |||
pub fn secret(&self) -> &ed25519_dalek::SecretKey { |
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.
I think this should just return [u8; 32]
directly, skip the type alias of ed25519-dalek.
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.
That would have security implications but I'm not the right person to comment on it
keypair/src/lib.rs
Outdated
@@ -271,11 +262,9 @@ pub fn keypair_from_seed(seed: &[u8]) -> Result<Keypair, Box<dyn error::Error>> | |||
if seed.len() < ed25519_dalek::SECRET_KEY_LENGTH { | |||
return Err("Seed is too short".into()); | |||
} | |||
let secret = ed25519_dalek::SecretKey::from_bytes(&seed[..ed25519_dalek::SECRET_KEY_LENGTH]) | |||
let secret_key = ed25519_dalek::SecretKey::try_from(&seed[..ed25519_dalek::SECRET_KEY_LENGTH]) |
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 function never fail, should call unwrap here
24cb6ce
to
c15a222
Compare
Ported from anza-xyz/agave#3088
Summary of Changes
Keypair::generate
now relies on traits from a newer version of the rand crate - it no longer works with rand 0.7.