Commit Graph

177 Commits

Author SHA1 Message Date
Alessio Treglia b9cb3e105d Merge PR #5345: Add dev docs for COSMOS_SDK_TEST_KEYRING 2019-11-30 09:32:08 -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
Marko b9490f2d93 Merge PR #5203: Add more linters 2019-10-17 09:47:35 -04:00
Marko 9f3789157e Merge PR #5192: golangcI-lint updates & set static version to 1.19 2019-10-14 11:43:19 -04:00
Alessio Treglia ee404e96ab Merge PR #5164: Handle New{,Test}Keyring errors 2019-10-09 14:53:54 -04:00
Alessio Treglia 46cd6112e1 Merge PR #5104: Remove keyring lazy implementation 2019-09-30 12:16:53 -04:00
Alessio Treglia 3e6562ce45 Merge PR #5097: Add keys migrate command
Add new command to assist users migrate their keys from the legacy
on-disk keybase to the new OS keyring-based implementation.

Ref #4754
2019-09-30 11:49:12 -04:00
Alessio Treglia 2c96bbbaa8
Add support for github.com/99designs/keyring-backed keybases (#5029)
Introduce new Keybase implementation that can leverage
operating systems' built-in functionalities to securely store
secrets.

This chunk is extracted from @poldsam's original PR:
- #4754

Thanks: @alexanderbez
2019-09-21 09:54:14 -07:00
Federico Kunze eeb847c845 Merge #4209: NFT Module
* in sync with @okwme/cosmos-nft

* remove tmp tx

* structuring and minor changes

* supply and client files

* adding cli client

* complete cli/tx and rest.go

* cleanup and restructuring

* restructure rest folder

* minor updates on clients

* update querier

* encoding for clients and other changes

* genesis, invariants, and keeper updates

* update types

* make golangcibot happy

* renamed and removed bank keeper

* remove handlers for editmetadata, mint, burn, buy

* nft interface

* minor cleanup

* sort collections and nfts

* balance and find

* nft query and tx

* touch ups

* uint in place of int

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* little fixes:
- fix error to err to avoid collision
- error handling

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* module generalization changes

* fixes

* query with data

* minor updates and TODOs

* fix CLI tx

* golang bot fixes

* handlers and txs done

* update module generalization

* Added very basic tests which for some reason do not work

* fix test

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* fixed test, now we should fix implementation, seems to fail

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* fix test, create new struct instead of changing the old one

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* fix handler with new logic

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* let's make it compile

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* single failing test example, need to be fixed and extended

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* single failing test example, need to be fixed and extended

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* reverting work, still problems unmarshalling inside iterator from test

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* Setter in nft.go should return NFT instead of BaseNFT

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* remove TODOS

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* comment out broken tests, we want at least a green mark here

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* little fixes

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* hopefully no conflict

* minor changes for tests

* change nft id to string, refactors

* messy pause

* Changes Balances to OWners add all necessary functions, updated Keeper with UpdateNFT as as well as MintNFT and made sure they all update Owners

* pause dev to merge sdk master

* go.mod changes

* getting closer still need module.go

* builds!!!

* fix lint begin handler tests

* stableish

* re-order nft attributes, add back mint and burn msgs and handlers

* add errors to minting the same NFT and burning an NFT that doesnt exist

* first querier test

* add simulations for nft msgs

* handler tests check tags now (fixed a bug!)

* update simulation

* generic handler

* need to check if it compiles on another machine

* fix weird interface error

* add back cli

* wtfff

* codec error fixed, logs removed. still returning empty arrays of IDs

* Take empty input as yes answer

Closes: #4564

* Add pending log entry

* merged in master

* marshall errors

* build commands

* working!!!

* linting errors

* remove unused func

* pause

* fix burn error

* fix burn error

* tests for querier

* typo

* tests for NFT types

* module spec standard

* tests for Collection and Collections types

* merge w Fede

* tests for Owner Type

* added genesis tests and beefed up keeper, querier, handler & types tests

* linting errors deadcode

* DONT COVER test_common.go

* add msg type tests

* Update x/nft/internal/keeper/key.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/nft/genesis.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Update x/nft/client/cli/query.go

Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* Apply suggestions from code review

* typo

* cleanup events

* split events

* more cleanup

* remove restrictions from default handlers

* not sure where these go mod changes came from

* sim generated changes

* make format

* add mint and burn sims

* move NFT interface to nft/exported

* make format

* NFT spec

* Updates

* more updates

* update specs readme

* fix sims

* rest additions

* rest additions

* fix invariant

* minimal nft without name, description or image

* sim

* fix sim

* fix sim

* fix Update methods

* nothing

* simplify update and remove

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* remove test on memory location

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* TEST to get logs, need to be removed

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* fix simulator editMetadata Msg type

* owner not found start with empty collection

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* artifacts on errors in case of failure, else, no artifacts

Signed-off-by: Karoly Albert Szabo <szabo.karoly.a@gmail.com>

* add more invariant checks to handler_tests

* never forget to overwrite

* merge and update spec

* colins feedback

* code coverage test

* code coverage test

* code coverage test

* spelling

* clean up client

* testing code coverage

* testing code coverage

* testing code coverage

* testing code coverage

* testing code coverage

* Update docs/spec/nft/README.md

Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>

* Apply suggestions from code review

Co-Authored-By: frog power 4000 <rigel.rozanski@gmail.com>

* minor changes

* integration tests and fixes

* minor golangCI fixes

* Update simapp/app.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
2019-08-26 12:54:45 -04:00
Marko 3a4f1fc4d4 Merge PR #4881: Linting Galore 2019-08-19 12:06:27 -04:00
Alexander Bezobchuk 861e4798ad
Merge PR #4836: Upgrade Tendermint and IAVL 2019-08-02 09:20:39 -04:00
Federico Kunze 7c70912263 Merge PR #4790: Fix multisig output 2019-07-31 11:47:18 -04:00
yys adf6ddd4a8 Merge PR #4716: Fix ledger custom coin type support bug 2019-07-29 11:01:53 -07:00
Austin Abell 3f519832a7 Merge PR #4687: Changed replace directive to specific revision of tendermint crypto 2019-07-09 15:04:30 -07:00
frog power 4000 5f9c3fdf88 Merge PR #4451: Client and Module Modularization 2019-06-05 19:26:16 -04:00
Alessio Treglia 85ebf5f72e
Implement private keys export/import symmetric functionalities (#4436)
Add Keybase's ExportPrivKey()/ImportPrivKey() API calls to export/import
ASCII-armored private keys. Relevant keys subcommands are provided as well.

Closes: #2020
2019-05-30 16:44:28 +01:00
Frank Yang 1db10b0033 Configurable Bip44 CoinType & HdPath for SDK users (#4300)
Closes: #4144
2019-05-30 13:46:38 +01:00
Alessio Treglia 71d71f2206
Remove gaia (#4347)
Gaia is removed from cosmos-sdk repository.

Few changes were required to make sure no packages depend on gaia subpackages.

CI config is amended accordingly.

Unnecessary targets are removed from Makefile.

Simulations run through a lightweight version of gaia renamed to simapp.

Closes: #4104
2019-05-18 10:42:24 +02:00
frog power 4000 5b7690e5e9
Merge PR #4346: report card minor fixes
* report card minor fixes

* fix
2019-05-16 21:32:20 -04:00
Alessio Treglia 06f7b2198a
Replace vet with golangci lint govet (#4277)
Drop go vet in favor of golangci-lint govet check.

Fix golangci-lint warnings.

Upgrade golangci-lint.
2019-05-06 17:50:05 +01:00
Juan Leni 1306a25e42 Adding support for Ledger Cosmos App v1.5 (#4227)
This PR adds support for the latest version of the Cosmos App (v.1.5).
The app is not been released yet by Ledger but the PR is backwards compatible.
We can later remove backwards compatibility and enforce v1.5 only.

When creating a new account, `gaiacli` now shows the account/index and address in the device and requires user confirmation.

Related PRs:
https://github.com/cosmos/ledger-cosmos-go/pull/3
https://github.com/cosmos/ledger-cosmos-go/pull/4
https://github.com/cosmos/ledger-cosmos-go/pull/5
https://github.com/cosmos/ledger-cosmos-go/pull/6

Changes in the app can be found here:
https://github.com/LedgerHQ/ledger-app-cosmos/pull/5
2019-04-30 09:58:21 +01:00
Alessio Treglia 3c88ddc2f5 Merge PR #4083: Replace gaiad --assert-invariants-blockly with --inv-check-period
* Remove old broken flag
* Support --inv-check-period which asserts invariants every nth period
2019-04-10 19:33:50 -04:00
Alessio Treglia 85021d4ca9
No packages must depend on cmd/gaia/ (#4048)
Preparation work for moving gaia out of the SDK.
2019-04-04 15:36:39 +01:00
Alessio Treglia 9556393aaf Merge PR #4005: Increase crypto coverage
Test LazyLeybase and crypto/keys/mintkey extensively
2019-03-29 09:49:00 -04:00
Juan Leni dcc3357ea3 Merge PR #3811: Migrate repo to organization 2019-03-06 12:37:27 +01:00
Alessio Treglia 3e82a8bbb8 Merge PR #3792: Use DBBackend set at compile time
* use DBBackend set at compile time

Closes: #3719

* Refresh changelog

* Tweak Makefile
2019-03-04 21:31:55 +01:00
Alexander Bezobchuk 47a44fb580 Merge PR #3748: Multisig Display UX Improvements 2019-03-01 13:29:33 -08:00
Alexander Bezobchuk d1573a17e2 Merge PR #3733: Update Client Keys Permissions to 0700 2019-02-26 11:36:25 -08:00
Juan Leni 3eb0acda88 Merge PR #3670: CLI support for showing bech32 addresses in Ledger devices 2019-02-25 12:34:39 +01:00
Christopher Goes bb1fd58b1e Address @alexanderbez comments 2019-02-13 17:26:14 +01:00
Christopher Goes d21ab4efc5 Add justification on security parameter choice 2019-02-13 15:36:03 +01:00
Christopher Goes abafd8bf9d Add Bcrypt benchmarks 2019-02-13 15:26:43 +01:00
Alessio Treglia fa2e9b8518 Merge PR #3619: Fix CI test failure 2019-02-12 13:45:44 +01:00
Alessio Treglia fe548c0829 Merge PR #3593: hide dbKeybase's constructor 2019-02-11 17:18:58 -08:00
Juan Leni 94dccf3842 Merge PR #3586: Fix keybase storage of ledger accounts 2019-02-11 09:02:47 -08: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
Juan Leni b5fdb83830 Merge PR #3517: Increasing test coverage in keys/client package 2019-02-08 12:45:23 -08:00
Juan Leni ba63eb1801 Merge PR #3557: Removing pkg/errors when not necessary 2019-02-08 11:37:46 -08:00
Alessio Treglia dff6d0e462 Merge PR #3551: Code cleanup, small coverage boost 2019-02-07 14:38:45 -08:00
Alessio Treglia 9a57ce0214 Merge PR #3514: don't lock keybase on lcd startup 2019-02-06 11:23:49 -08:00
Juan Leni 174ec0c809 Merge PR #3431: PrivKeyLedgerSecp256k1: lost connection 2019-02-05 10:21:04 -08:00
Juan Leni f5ada58780 Merge PR #3461: GaiaCLI - refactor/fix --account and --index 2019-02-05 08:22:56 -08:00
Alessio Treglia 24a1670cf0 Run make format 2018-12-10 14:27:25 +00:00
Alessio Treglia 079b1f0ffa Merge PR #2994: Change wrong password message
* change wrong password message

Closes: #2993

* Update PENDING.md
2018-12-04 17:23:10 +01:00
Alessio Treglia 956c2229bf Merge PR #2965: add --force to keys delete for unattended execution
* add --force to keys delete for unattended execution

Skip password check when --force is on and delete
keys unconditionally.

Closes: #2961

* Forcibly cleanup keys on fixtures initialization
2018-11-30 21:36:55 +01:00
Juan Leni 0473621570 Merge PR #2870: Upgrading ledger-cosmos-go dependency
* Upgrading dependencies
* Update dependency
2018-11-30 15:23:55 +01:00
Alessio Treglia a6bc60e4c6 Merge PR #2923: Prompt user for confirmation when deleting ledger and offline keys
* Force password to 'yes' when deleting ledger-offline keys
* Improve UX, better docs on removing offline/ledger keys
* Ask for confirmation on offline/ledger keys deletion
2018-11-29 21:55:23 +01:00
Alexander Bezobchuk 50926fffff Update to TM v0.26.0 - Part I (#2679)
* Update to TM v0.26.0
2018-11-04 18:28:38 -08:00
Christopher Goes 234262160e 'make format' 2018-10-24 15:37:06 +02:00
HaoyangLiu 9ee9e28439 Merge PR #2462: Add swagger-ui for gov, stake and slashing 2018-10-24 15:19:48 +02:00
Alessio Treglia add15b5b28
Merge review comments/changes 2018-10-22 14:29:27 -07:00
Ethan Buchman 1ee8deed2b Merge PR #2090: Improve crypto/keys and add `keys mnemonic` and `keys new` commands
* crypto/keys/hd: use btcec to remove dep on tendermint

* crypto/keys/bcrypt: improve comment about fork

* crypto/keys/bip39 -> crypto/keys/bip39/fundraiser

* crypto/keys/bip39: bring in fork of tyler-smith

* crypto/keys/hd: update dep

* crypto/keys: update deps

* crypto/keys: move mintkey.go into new crypto/keys/mintkey

* crypto/keys/hd: NewParamsFromPath

* crypto/keys: keybase.Derive takes a bip39 passphrase too

* crypto/keys/hd: BIP44Params.DerivationPath

* gaiacli keys: add commands new and mnemonic

* fix lints

* minor fixes from review

* update Gopkg.toml

* add tendermint fork of golang.org/x/crypto
* pin some transitive deps

* crypto/keys/bcrypt: remove

* remove in favour of fork of golang.org/x/crypto/bcrypt at github.com/tendermint/crypto/bcrypt

* crypto/keys/bip39: remove completely

* use fork cosmos/go-bip39 instead

* Gopkg.toml: dont use master

* Pull in changes from my PR

* fixes from review

* enforce min len for --unsafe-entropy

* lint fix

* feedback from review

* fix dep
2018-10-17 13:37:58 -04:00
Christopher Goes 17983460b8
Merge PR #2219: Update to Tendermint 0.24 (except NextValSet offsets) 2018-10-03 17:48:23 +02:00
Matthew Slipper 24413a395d Merge PR #2073: Allow --from to be a name or an address
* Allow --from to be a name or an address

Closes #1735.

* Post-rebase fixes

* Updates from code review

* Updates from code review

* Updates from code review

* Fix merge artifacts

* Fix merge conflicts

* Fix integration tests

* Add back GetFromName() check broken during merge

* Code review updates

* Fix failing test

* Updates from code review
2018-09-25 16:48:38 -04: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
Sunny Aggarwal 74d8999b99 checked error on Fprintf 2018-09-07 14:22:32 +08:00
Alessio Treglia 86395809cb
Implement generate-only option for commands that create txs
The new CLI flag builds an unsigned transaction and writes it to STDOUT.
Likewise, REST clients can now append generate_only=true to a request's
query arguments list and expect a JSON response carrying the unsigned
transaction.

Closes: #966
2018-09-04 02:32:05 +02:00
Aleksandr Bezobchuk bdbdd1a832 Further godoc updates 2018-08-28 08:24:19 -04:00
Aleksandr Bezobchuk 1a6c4785e9 Cleanup ledger godocs and reduce complexity 2018-08-28 08:16:50 -04:00
Aleksandr Bezobchuk de061fa8e1 Do not export ledger discovery types 2018-08-27 18:57:06 -04:00
Aleksandr Bezobchuk 0245a4b5ee Update pending log 2018-08-27 18:45:34 -04:00
Aleksandr Bezobchuk fc20f757ec Load ledger device at runtime 2018-08-27 18:42:03 -04:00
Dev Ojha b2a4aecc44 Upgrade to tm version 23.0. (#1927)
* Start upgrade. Currently go test ./... hangs.

* (squash this) Fix staking tests

* wip

* note what changes need to be made to make this work on tm v0.23.0

* Fix addr -> pubkey map

* cleanup code

* Fix slashing test failures except for begin blocker

* fix all slashing tests

* fix lcd tests

* Address PR comments

* add link to changelog.

* (wip) start making addrToPubkey map persisted. Since amino can't handle maps,
we have to change from what this commit is doing.

* Use the correct method of storing a map

* (squash this) address PR comments

* Did you run 'make'?

* remove gaiadebug binary
2018-08-12 03:33:48 -04:00
Dev Ojha 45a010bb2f Merge PR #1937: crypto/keys: Reduce bcrypt parameter in tests
Currently the crypto/keys tests take 2 minutes in circle CI.
A significant portion of this time is due to the bcrypt security
parameter. Changing it for these tests should reduce the time significantly.
2018-08-08 12:06:18 +02:00
Alexander Bezobchuk 12c2c236c2 Merge PR #1741: CoreContext Refactor 2018-08-06 20:11:30 +02:00
Dev Ojha 5d02a743fb Update to tendermint v0.22.6-rc0 (#1798)
* Update to tendermint v0.22.6-rc0

This is comprised of updating the crypto imports / API

* (squash this) switch to v0.22.6

If this passes tests, I'll squash this commit and update the PR.
2018-07-25 16:43:37 -04:00
Dev Ojha a2047c5c81 Merge PR #1687: tools: Ensure Gopkg.lock is correct in linting
* tools: Ensure Gopkg.lock is correct in linting

This adds dep status to the lint process. Also fixes linting errors
that existed earlier. (not sure why they didn't show up on CI)

Closes #1574

* Update dep, use the lock file new dep version creates
2018-07-14 23:48:41 +02:00
Alexander Bezobchuk bb1f1a21bf Fix Cross Compile Build/Ledger Build Tag (#1674)
* Merge pull request #1674: Fix Cross Compile Build/Ledger Build Tag
* Merge pull request #1674: Fix Cross Compile Build/Ledger Build Tag
* Remove incorrect Ledger test
2018-07-14 04:17:53 +02:00
Dev Ojha 98bc419d5e Merge PR #1659: crypto/keys: Allow one to export their private key
* crypto/keys: Allow one to export their private key
* Update changelog
2018-07-13 00:12:20 +02:00
ValarDragon fc4c563e29 keys: Keybase.Update no longer asks for newpass if oldpass is incorrect
Achieved by refactoring the parameter newpass as follows:

* (newpass string) -> (getNewpass func() (string, error))

Closes #1629
2018-07-10 20:00:22 -07:00
ValarDragon 0b10430d65 gaiacli, keys: Improve error message when deleting non-existant key 2018-07-05 18:03:41 -07:00
Ethan Buchman f78f30c67a update for tm v0.22.0. tmlibs->tendermint/libs 2018-07-02 16:34:06 -04:00
Dev Ojha 955a0c9af7 Switch asserts to require (#1483)
* meta: Switch the majority of asserts to require

Switch most assert statements to require, to ease debugging.
Closes #1418

* Fix imports
2018-06-30 03:10:15 +02:00
Dev Ojha fc3dd56281 Merge PR #1477: gaiacli: Make recovery allow new keys
* gaiacli: Make recovery allow new keys
* Move create key to a temporary method, restore create fundraiser key
2018-06-30 00:47:09 +02:00
Dev Ojha 24a68d3bdf Merge PR #1451: crypto/keys: move checksum size into constants
Closes #1410
2018-06-29 09:52:32 +02:00
Dev Ojha 337e87b228 Merge PR #1449: crypto/keys: make bcrypt security param a var
This is done so that the time spent on bcrypt during test cases
can be reduced. This change reduces the amount of time lcd tests
spend on bcrypt from 76% to 40%. (We need to reduce the number of
calls to bcrypt in a seperate PR, along with fixing other sources
of slowness)

Making the bcrypt security parameter a var shouldn't be a security issue:
One can't verify an invalid key by maliciously changing the bcrypt
parameter during a runtime vulnerability. The main security
threat this then exposes would be something that changes this during
runtime before the user creates their key. This vulnerability must
succeed to update this to that same value before every subsequent call
to gaiacli keys in future startups / or the attacker must get access
to the filesystem. However, with this same threat model (changing
variables in runtime), one can cause the user to sign a different tx
than what they see, which is a significantly cheaper attack then breaking
a bcrypt hash. (Recall that the nonce still exists to break rainbow
tables)
2018-06-29 09:22:06 +02:00
Christopher Goes 59aadf42aa
Ledger integration (#931)
Merges the keybase and Ledger code from go-crypto (which is no more) into the SDK
Adds support for Ledger into gaiacli
Cherry-picks updated error handling from #1158
2018-06-29 02:54:47 +02:00