Skip to content
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

R4R: Load Ledger Device at Runtime #2167

Merged
merged 5 commits into from
Aug 28, 2018
Merged

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Aug 27, 2018

closes: #2064


  • Targeted PR against correct branch (see CONTRIBUTING.md)

  • Linked to github-issue with discussion and accepted design OR link to spec that describes this work.

  • Wrote tests

  • Updated relevant documentation (docs/)

  • Added entries in PENDING.md with issue #

  • rereviewed Files changed in the github PR explorer


For Admin Use:

  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)
  • Reviewers Assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alexanderbez alexanderbez added T:Bug ready-for-review C:Keys Keybase, KMS and HSMs C:Ledger Issues and features related Ledger integration and functionality labels Aug 27, 2018
@alexanderbez alexanderbez changed the title Load Ledger Device at Runtime R4R: Load Ledger Device at Runtime Aug 27, 2018
@codecov
Copy link

codecov bot commented Aug 27, 2018

Codecov Report

Merging #2167 into develop will decrease coverage by 0.01%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           develop   #2167      +/-   ##
==========================================
- Coverage    63.91%   63.9%   -0.02%     
==========================================
  Files          134     134              
  Lines         8194    8194              
==========================================
- Hits          5237    5236       -1     
- Misses        2604    2606       +2     
+ Partials       353     352       -1

Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

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

utACK

err = ledgerDeviceErr
var ledgerDevice LedgerSECP256K1

if discoverLedger != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit why not do

discoverLedger == nil{
 return error
}
proceed with normal case

just to avoid the extra indent there.

)

type (
// discoverLedgerFn defines a Ledger discovery function that returns a
// connected device or an error upon failure.
Copy link
Contributor

@ValarDragon ValarDragon Aug 28, 2018

Choose a reason for hiding this comment

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

Can you comment that the reason its written as a separate type is to avoid the CGO dependency when the build flag isn't present? (As opposed to having a static function with a boolean for "isPresent")

This was referenced Aug 28, 2018
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

I think we can cache the result of ledger.FindLedger() - unless that caused problems in your testing?

@alexanderbez
Copy link
Contributor Author

@ValarDragon -- address your comments. Thanks!

@cwgoes -- yes, I intentionally avoided the cache for UX reasons, so when using the LCD, you can exit the app or even disconnect and still have it work upon re-opening/connecting. I can add the cache if you think this should be addressed in another PR or avoided all together.

@cwgoes
Copy link
Contributor

cwgoes commented Aug 28, 2018

@cwgoes -- yes, I intentionally avoided the cache for UX reasons, so when using the LCD, you can exit the app or even disconnect and still have it work upon re-opening/connecting. I can add the cache if you think this should be addressed in another PR or avoided all together.

I don't think the two are mutually exclusive - just try to refresh the cache if the device isn't valid?

This isn't a big deal though.

@alexanderbez
Copy link
Contributor Author

Agreed @cwgoes -- for another PR then.

@cwgoes cwgoes merged commit 6a7d700 into develop Aug 28, 2018
@cwgoes cwgoes deleted the bez/2064-ledger-signing-bugfix branch August 28, 2018 12:55
@faboweb
Copy link
Contributor

faboweb commented Aug 28, 2018

Great! Will test tomorrow. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs C:Ledger Issues and features related Ledger integration and functionality T:Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signing with ledger
5 participants