Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions clap-v3-utils/src/keypair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,8 @@ pub fn keypair_from_path(
keypair_name: &str,
confirm_pubkey: bool,
) -> Result<Keypair, Box<dyn error::Error>> {
let keypair = encodable_key_from_path(matches, path, keypair_name)?;
let skip_validation = matches.is_present(SKIP_SEED_PHRASE_VALIDATION_ARG.name);
let keypair = encodable_key_from_path(path, keypair_name, skip_validation)?;
if confirm_pubkey {
confirm_encodable_keypair_pubkey(&keypair, "pubkey");
}
Expand Down Expand Up @@ -1050,7 +1051,8 @@ pub fn elgamal_keypair_from_path(
elgamal_keypair_name: &str,
confirm_pubkey: bool,
) -> Result<ElGamalKeypair, Box<dyn error::Error>> {
let elgamal_keypair = encodable_key_from_path(matches, path, elgamal_keypair_name)?;
let skip_validation = matches.is_present(SKIP_SEED_PHRASE_VALIDATION_ARG.name);
let elgamal_keypair = encodable_key_from_path(path, elgamal_keypair_name, skip_validation)?;
if confirm_pubkey {
confirm_encodable_keypair_pubkey(&elgamal_keypair, "ElGamal pubkey");
}
Expand Down Expand Up @@ -1104,29 +1106,27 @@ pub fn ae_key_from_path(
path: &str,
key_name: &str,
) -> Result<AeKey, Box<dyn error::Error>> {
encodable_key_from_path(matches, path, key_name)
let skip_validation = matches.is_present(SKIP_SEED_PHRASE_VALIDATION_ARG.name);
encodable_key_from_path(path, key_name, skip_validation)
}

fn encodable_key_from_path<K: EncodableKey + SeedDerivable>(
matches: &ArgMatches,
path: &str,
keypair_name: &str,
skip_validation: bool,
) -> Result<K, Box<dyn error::Error>> {
let SignerSource {
kind,
derivation_path,
legacy,
} = parse_signer_source(path)?;
match kind {
SignerSourceKind::Prompt => {
let skip_validation = matches.is_present(SKIP_SEED_PHRASE_VALIDATION_ARG.name);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so there's some bug with const refs in generic contexts that triggers ICE in the targeted toolchain. took a day to isolate and stumble into this "fix" via introducing replicode.

didn't see any related issues on github and haven't had time to try to minimize repro yet

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you reported this already? Even without minimal reproduction it might be worth giving them a heads up on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet. if we can put this commit in, i'll have something to permalink. don't think the pr links persist after i delete the branch. otherwise hoping to have time to attempt a minimization tonight.

Ok(encodable_key_from_seed_phrase(
keypair_name,
skip_validation,
derivation_path,
legacy,
)?)
}
SignerSourceKind::Prompt => Ok(encodable_key_from_seed_phrase(
keypair_name,
skip_validation,
derivation_path,
legacy,
)?),
SignerSourceKind::Filepath(path) => match K::read_from_file(&path) {
Err(e) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
Expand Down