-
Notifications
You must be signed in to change notification settings - Fork 259
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
Extract signer crates #3087
Extract signer crates #3087
Conversation
2d27cdb
to
d090fb0
Compare
fc2e791
to
eccfece
Compare
c1dd543
to
04c1682
Compare
647adc5
to
1e002af
Compare
52c3b5a
to
e616a0f
Compare
a96f16f
to
f531541
Compare
I took a look at the PR and managed to extract solana-keypair without any issues on the I'm still looking through the changes, but it all looks good so far |
Go for it! |
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.
Ok I've pushed my changes -- let me know what you think! Also tagging @febo for another set of eyes
sdk/seed-derivable/src/lib.rs
Outdated
impl SeedDerivable for Keypair { | ||
fn from_seed(seed: &[u8]) -> Result<Self, Box<dyn error::Error>> { | ||
keypair_from_seed(seed) | ||
} | ||
|
||
fn from_seed_and_derivation_path( | ||
seed: &[u8], | ||
derivation_path: Option<DerivationPath>, | ||
) -> Result<Self, Box<dyn error::Error>> { | ||
keypair_from_seed_and_derivation_path(seed, derivation_path) | ||
} | ||
|
||
fn from_seed_phrase_and_passphrase( | ||
seed_phrase: &str, | ||
passphrase: &str, | ||
) -> Result<Self, Box<dyn error::Error>> { | ||
keypair_from_seed_phrase_and_passphrase(seed_phrase, passphrase) | ||
} | ||
} |
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.
note: I typically prefer to have the trait implementation in the crate with the concrete type, but I think it makes sense here since there isn't too much else here, and it's the only crate with the ed25519-dalek-bip32
dependency
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.
Hmmm, I found this a bit unexpected to be here. Is there a scenario where you would want only the trait and using this crate will incur you getting a ed25519-dalek-bip32
dependency?
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.
If it does not make sense to move it to the keypair
crate, perhaps we can put this behind a feature flag?
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.
Hm, this is a good point. The only other impls of SeedDerivable
exist in the zk-sdk
and zk-token-sdk
crates, and they explicitly just return an error for from_seed_and_derivation_path
, which means they don't use the bip32 dependency at all.
We could implement the trait and extra functions under a feature flag like seed-derivable
in solana-keypair
. What do you think @kevinheavey ?
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.
yeah feature flag sounds good to me, you wanna take it?
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.
Yep! Done with 1720552 -- let me know how it looks
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.
lgtm!
lgtm |
@yihau I've sent anza-team invites for the following crates:
|
✅ |
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.
Just a couple of comments. Also, some of the crates have the "` ... `" formatting on the description field in the Cargo.toml
file – wodering whether that is going to render properly or should be removed.
Confirming that crates.io does not give them proper rendering in the description field https://crates.io/crates/backtick-description-example |
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.
Looks great!
Problem
solana_sdk::signer
needs to be made available outsidesolana_sdk
Summary of Changes
keypair
module optional in solana-signer. This didn't go in its own crate because it seems it's not possible to do so without breaking theSigners
traitkeypair.rs
with a simple inline parserunique_signers
functionThis branches off #2295 so that needs to be merged first