Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Refactor SignerSource to expose DerivationPath to other kinds of signers #16933

Merged
merged 9 commits into from
Apr 29, 2021

Conversation

CriesofCarrots
Copy link
Contributor

@CriesofCarrots CriesofCarrots commented Apr 29, 2021

Problem

DerivationPath parsing doesn't lend itself to code sharing (only available for SignerSource::Usb-type signers, within remote-wallet).

Summary of Changes

Refactor it:

  • Add DerivationPath::from_uri() method that implements the DerivationPath parsing previously in Locator::new_from_uri(); move test cases to target derivation-path specifically
  • Convert SignerSource to a struct that wraps the old kind and includes and optional derivation_path

Toward #5246

@CriesofCarrots CriesofCarrots requested a review from t-nelson April 29, 2021 01:22
@CriesofCarrots CriesofCarrots force-pushed the client-url branch 3 times, most recently from 4b70ac0 to 2561420 Compare April 29, 2021 01:37
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

Looking great! Much cleaner. Just a few suggestsions

t-nelson
t-nelson previously approved these changes Apr 29, 2021
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM

} if j == junk));
assert!(matches!(
parse_signer_source(&junk),
Err(SignerSourceError::IoError(_))
Copy link
Contributor

Choose a reason for hiding this comment

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

🥳

@mergify mergify bot dismissed t-nelson’s stale review April 29, 2021 05:05

Pull request has been modified.

@codecov
Copy link

codecov bot commented Apr 29, 2021

Codecov Report

Merging #16933 (838b33d) into master (d640ac1) will increase coverage by 0.0%.
The diff coverage is 93.0%.

@@           Coverage Diff            @@
##           master   #16933    +/-   ##
========================================
  Coverage    82.7%    82.8%            
========================================
  Files         416      416            
  Lines      116629   116479   -150     
========================================
- Hits        96532    96480    -52     
+ Misses      20097    19999    -98     

@CriesofCarrots CriesofCarrots merged commit d6f30b7 into solana-labs:master Apr 29, 2021
mergify bot pushed a commit that referenced this pull request Apr 29, 2021
…ers (#16933)

* One use statement

* Add stdin uri scheme

* Convert parse_signer_source to return Result

* A-Z deps

* Convert Usb data to Locator

* Pull DerivationPath out of Locator

* Wrap SignerSource to share derivation_path

* Review comments

* Check Filepath existence, readability in parse_signer_source

(cherry picked from commit d6f30b7)

# Conflicts:
#	Cargo.lock
#	clap-utils/src/memo.rs
#	remote-wallet/src/locator.rs
#	sdk/Cargo.toml
mergify bot pushed a commit that referenced this pull request Apr 29, 2021
…ers (#16933)

* One use statement

* Add stdin uri scheme

* Convert parse_signer_source to return Result

* A-Z deps

* Convert Usb data to Locator

* Pull DerivationPath out of Locator

* Wrap SignerSource to share derivation_path

* Review comments

* Check Filepath existence, readability in parse_signer_source

(cherry picked from commit d6f30b7)

# Conflicts:
#	sdk/Cargo.toml
mergify bot added a commit that referenced this pull request Apr 29, 2021
…ers (backport #16933) (#16941)

* Refactor SignerSource to expose DerivationPath to other kinds of signers (#16933)

* One use statement

* Add stdin uri scheme

* Convert parse_signer_source to return Result

* A-Z deps

* Convert Usb data to Locator

* Pull DerivationPath out of Locator

* Wrap SignerSource to share derivation_path

* Review comments

* Check Filepath existence, readability in parse_signer_source

(cherry picked from commit d6f30b7)

# Conflicts:
#	sdk/Cargo.toml

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
mergify bot added a commit that referenced this pull request Apr 29, 2021
…ers (backport #16933) (#16940)

* Refactor SignerSource to expose DerivationPath to other kinds of signers (#16933)

* One use statement

* Add stdin uri scheme

* Convert parse_signer_source to return Result

* A-Z deps

* Convert Usb data to Locator

* Pull DerivationPath out of Locator

* Wrap SignerSource to share derivation_path

* Review comments

* Check Filepath existence, readability in parse_signer_source

(cherry picked from commit d6f30b7)

# Conflicts:
#	Cargo.lock
#	clap-utils/src/memo.rs
#	remote-wallet/src/locator.rs
#	sdk/Cargo.toml

* Fix conflicts

* Fix legacy compile test

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
jeffwashington pushed a commit to jeffwashington/solana that referenced this pull request Apr 30, 2021
…ers (solana-labs#16933)

* One use statement

* Add stdin uri scheme

* Convert parse_signer_source to return Result

* A-Z deps

* Convert Usb data to Locator

* Pull DerivationPath out of Locator

* Wrap SignerSource to share derivation_path

* Review comments

* Check Filepath existence, readability in parse_signer_source
@CriesofCarrots CriesofCarrots deleted the client-url branch May 10, 2021 20:09
@brooksprumo brooksprumo mentioned this pull request Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants