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

crypto: cleanup, more testing #5735

Merged
merged 1 commit into from
Mar 2, 2020
Merged

Conversation

alessio
Copy link
Contributor

@alessio alessio commented Mar 2, 2020

crypto.LedgerShowAddress() is a ledger specific function
and should takes acc address prefix instead of depending
on a sdk.Config singleton.

crypto/keys/mintkey:

  • decryptPrivKey() return error instead of os.Exit()ing.
  • encryptPrivKey() should panic instead of os.Exit() when
    bcrypt.GenerateFromPassword() call fails so that the
    caller is given a chance to recover().

crypto/keys:

  • SignWithLedger() does not need to be method of
    baseKeybase. Method receiver is unused.
  • ledgerInfo objecta may be pointers, type switch
    should handle both to avoid panics.
  • keyringKeybase should not provide Update() at all.

More test cases are added to increase package crypto
and subpackages overall coverage.


For contributor use:

  • 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.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

crypto.LedgerShowAddress() is a ledger specific function
and should takes acc address prefix instead of depending
on a sdk.Config singleton.

crypto/keys/mintkey:
- decryptPrivKey() return error instead of os.Exit()ing.
- encryptPrivKey() should panic instead of os.Exit() when
  bcrypt.GenerateFromPassword() call fails so that the
  caller is given a chance to recover().

crypto/keys:
- SignWithLedger() does not need to be method of
  baseKeybase. Method receiver is unused.
- ledgerInfo objecta may be pointers, type switch
  should handle both to avoid panics.
- keyringKeybase should not provide Update() at all.

More test cases are added to increase package crypto
and subpackages overall coverage.
@alessio alessio force-pushed the alessio/crypto-keys-testcases branch from 99abdf2 to 9bd603a Compare March 2, 2020 11:09
@alessio alessio marked this pull request as ready for review March 2, 2020 11:19
@alessio alessio added R4R A:automerge Automatically merge PR once all prerequisites pass. labels Mar 2, 2020
@alessio alessio requested review from jgimeno and tac0turtle March 2, 2020 11:20
@codecov
Copy link

codecov bot commented Mar 2, 2020

Codecov Report

Merging #5735 into master will increase coverage by 0.28%.
The diff coverage is 58.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5735      +/-   ##
==========================================
+ Coverage   36.22%   36.51%   +0.28%     
==========================================
  Files         335      336       +1     
  Lines       32722    32742      +20     
==========================================
+ Hits        11855    11956     +101     
+ Misses      19641    19557      -84     
- Partials     1226     1229       +3
Impacted Files Coverage Δ
client/keys/show.go 83.9% <0%> (ø) ⬆️
crypto/keys/keybase.go 65.26% <0%> (ø) ⬆️
crypto/ledger_secp256k1.go 59.43% <100%> (+6.16%) ⬆️
crypto/keys/keyring.go 52.26% <100%> (+12.39%) ⬆️
crypto/keys/mintkey/mintkey.go 83.33% <33.33%> (+32.14%) ⬆️
crypto/keys/keybase_base.go 72.51% <60%> (+3.71%) ⬆️
crypto/keys/keyerror/errors.go 100% <0%> (ø)

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK

@alexanderbez alexanderbez merged commit 214cd2e into master Mar 2, 2020
@alexanderbez alexanderbez deleted the alessio/crypto-keys-testcases branch March 2, 2020 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Crypto T: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants