Commit Graph

24 Commits

Author SHA1 Message Date
Alessio Treglia a1feca39c2
Enter the new keyring interface (#5904)
crypto/keyring:

`Keybase` interface gives way to its successor: `Keyring`. `LegacyKeybase`
interface is added in order to guarantee limited backward compatibility with
the old `Keybase` interface for the sole purpose of migrating keys across
the new keyring backends.

The package no longer depends on the `github.com/types.Config`
singleton.

`SupportedAlgos` and `SupportedLedgerAlgos` methods have been removed.
The keyring just fails when trying to perform an action with an unsupported
algorithm.

crypto/ subdirs reorganization:

`crypto/keys/hd` was moved to `crypto/hd`, which now groups together
all HD wallets related types and utilities.

client/input:

* Removal of unnecessary `GetCheckPassword`, `PrintPrefixed` functions.
* `GetConfirmation`'s signature changed to take in a io.Writer for better integration
  with `cobra.Command` types.

client/context:

* In-memory keyring is allocated in the context when `--gen-only` flag is passed
  in. `GetFromFields` does no longer silently allocate a keyring, it takes one as
  argument.

Co-authored with @jgimeno

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2020-04-08 11:38:28 +02:00
Alessio Treglia 2a7a408d35
crypto/keyring: deprecate old keybase (#5889)
Remove the Update method from the Keybase interface.

Remove redundant lazy keybase implementation altogether.

Created LegacyKeybase interface to restrict capabilities to
only those required by keys commands that deal with
legacy keybase such as update and migrate.

Rename keyring.New() -> keyring.NewLegacy().

Rename client/keys.NewKeyBaseFromDir -> NewLegacyKeyBaseFromDir.

crypto/keyiring.NewInMemory() now returns a in-memory keyring.
BackendMemory is added yet not exposed via command line
--keyring-backend flag. keys add uses it when --dry-run flag
is on.
2020-03-30 20:30:50 +02:00
Federico Kunze 9cce836c08
crypto/keys: move keybase and keyring to crypto/keyring/ dir (#5866)
* crypto/keys: move keybase and keyring to crypto/keyring/ dir

* Update client/keys/root.go

* Update crypto/keyring/errors.go

* Update crypto/keyring/keybase.go

* Update crypto/keyring/options.go

* format

* changelog

* fix build

* format

* lint
2020-03-25 15:20:36 +00:00
Alessio Treglia d7fd5b6a42
Replace defer with testing.T.Cleanup() (#5732) 2020-03-02 00:16:23 +00:00
Alessio Treglia 415eab7a56
Create new generic keyring constructor: NewKeyring (#5547)
Remove other convenience constructors:
 * Remove NewKeyBaseFromHomeFlag
 * Remove NewKeyringFromDir
 * Remove NewKeyringFromHomeFlag
2020-01-22 17:54:56 +00:00
Sunny Aggarwal f367087731 Merge PR #5439: Keybase: Multiple Signature Algorithms 2020-01-14 10:40:10 -05:00
Alessio Treglia d4c831e63a Drop on-disk keybase in favor of keyring (#5180)
* Switch keys commands to keyring

* Replace NewKeybase with NewKeyring

* Fix delete test

* Purge dead code

* Override COSMOS_SDK_TEST_KEYRING envvar to switch to a test keyring

* s/unningOnServer/unningUnattended/

C'ing @tnachen

* Add deprecated warning, output looks like the following:

```
$ gaiacli keys update --help
Command "update" is deprecated, it takes no effect with the new keyring
based backend and is provided only for backward compatibility with the
legacy LevelDB based backend.
Refer to your operating system's manual to learn how to change your
keyring's password.

Change the password used to protect private key

Usage:
  gaiacli keys update <name> [flags]

Flags:
  -h, --help   help for update

Global Flags:
      --chain-id string   Chain ID of tendermint node
  -e, --encoding string   Binary encoding (hex|b64|btc) (default "hex")
      --home string       directory for config and data (default "/home/alessio/.gaiacli")
  -o, --output string     Output format (text|json) (default "text")
      --trace             print out full stack trace on errors
```

* Update multisign command

* Modify server.GenerateSaveCoinKey()

* GenerateSaveCoinKey more modifications

* Update docs

* Update upgrade module
2019-11-14 15:17:21 +01:00
Alessio Treglia e7e3c32204 Merge PR #3553: Code cleanup, take #1
* add a bunch of tests, add DONTCOVER text tag

- Also fix flaky test (closes: #3559). Don't test values
  returned by queries since there's no way to query a
  specific height via REST.

* GetTempDir -> NewTestCaseDir
2019-02-08 22:45:41 +01:00
Alessio Treglia dff6d0e462 Merge PR #3551: Code cleanup, small coverage boost 2019-02-07 14:38:45 -08:00
Alessio Treglia 0f4a03b44e Alessio/server refactor (#2472)
* Add arg to PrintUnsignedStdTx() to actually operate in offline mode
* WIP simplifying server module
* Expose ExternalIP()
* Move {GenTx,Init}Cmd into gaia's new init package
2018-10-10 15:45:41 -07:00
Dev Ojha 6b55093c75 Merge PR #2324: rename wire to codec
* rename wire to codec

* fix formatting and cli

* fix the docs
2018-09-13 14:17:32 -04:00
Ethan Buchman f78f30c67a update for tm v0.22.0. tmlibs->tendermint/libs 2018-07-02 16:34:06 -04:00
Greg Szabo 4c5e536b31 Added testnet command and localnet targets
Finished testnet command and introduced localnet targets in Makefile, together with gaiadnode Docker image

Fixed function parameter list - now starts with ctx

Separated GenTxConfig into a server/config package so both the server package and the mock package can use it

Adding server/config to app package

gaiadnode Docker image

Separated GenTxConfig into a server/config package so both the server package and the mock package can use it

Adding server/config to app package

Fixes requested by Rigel

Removed commented code

Global flag fixes
2018-06-12 11:25:03 -07:00
rigelrozanski b5d847288d move original mock into server 2018-06-07 21:33:06 -07:00
rigelrozanski ade42e74b7 better init test 2018-04-26 14:26:39 -04:00
rigelrozanski b9477ecbbe init refactor uses genesis transaction now 2018-04-26 14:26:39 -04:00
rigelrozanski 201908949a stake init overhaul 2018-04-26 14:26:39 -04:00
rigelrozanski c8f5fcb27b init append functionality complete 2018-04-26 14:26:39 -04:00
rigelrozanski 246e4bdac3 renames 2018-04-26 14:26:39 -04:00
rigelrozanski 55c1e1dcfc init refactor 2018-04-26 14:26:39 -04:00
Christopher Goes 74a2246b3e
Pass logger and config through CLI context (closes #725) 2018-04-05 11:20:05 +02:00
rigelrozanski 11fdd831ee refactoring server new non-deterministic error :( 2018-03-17 22:14:19 +01:00
Ethan Frey d694dbe7c1 Add first server command tests 2018-03-01 02:36:08 +00:00
Ethan Frey 1f31fbeea8 Start writing test scaffold to test server 2018-03-01 02:34:05 +00:00