Commit Graph

908 Commits

Author SHA1 Message Date
Alexander Bezobchuk 8670a10564
Merge PR #6595: Single Binary & Command Refactor 2020-07-07 11:40:46 -04:00
Alexander Bezobchuk de7885a594
keys: CLI Remove Viper (#6613)
* init commit

* Update ListKeysCmd

* updates

* updates

* test updates

* fix tests

* keys: Fix Test_runAddCmdLedgerWithCustomCoinType

* keys: Fix Test_runAddCmdLedger

* keys: Fix Test_runAddCmdBasic

* keys: Fix root tests

* keys: Fix Test_runMigrateCmd

* keys: Fix Test_runListCmd

* keys: Fix remaining tests
2020-07-06 19:50:09 +00:00
Aaron Craelius 2f44fbf2ab
Add support for protobuf TxGenerator and SIGN_MODE_DIRECT (#6385)
* Add TxWrapper, encoder, decoder and DirectModeHandler

* fix pkg name

* Update API and leave test TODO's

* Update TxWrapper API

* tests for tx wrapper (#6410)

* WIP: added test for direct mode handler

* updated code

* Add msg

* Update TxWrapper API

* Fix pubkey declaration

* Add pubkey for tests

* Fix SetFee

* Remove logs

* Avoid global var declaration for tests

* Add test for GetPubKeys

* Fix direct signing tests

* Add more test cases for GetSignBytes

* Revert SetFee API

* Remove logs

* Refactor tests

Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>

* Refactoring

* Refactoring

* Integrate SignatureV2 API

* Fix wrapper tests

* Fix tests

* Linting and API tweaks

* Update API

* WIP on updating API

* Fix tests

* Update to new SigVerifiableTx

* Rename

* Update docs to reflect ADR 020

* proto-gen

* proto docs

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* cleanup

* Add tests

* Refactor and improving test coverage

* WIP on test coverage

* WIP on test coverage

* proto-gen

* Fix CompactBitArray.Size() bug

* Rename

* Remove Builder interface

* Address review comments

* Update x/auth/tx/sigs.go

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

* Update x/auth/tx/encoder.go

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

* Update x/auth/tx/encoder.go

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

* Address review feedback

* Fix build issues

* Resolve conflicts

* Fix ValidateBasic test coverage

* Add test for malicious multisig

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-06 17:03:45 +00:00
Alessio Treglia b832e103b1
client/keys: make add command's output parseable (#6603)
client/input/input.go: GetConfirmation() should communicate
with the user via the io.Writer instance passed in as
argument.

client/keys/add.go: replace cmd.PrintErrln() calls with
fmt.Fprintln(cmd.ErrOrStderr(), ...) because of cobra's
PrintErr* functions broken behaviour. For more information
please see https://github.com/spf13/cobra/pull/894

Closes: #6601
Thanks: @noandrea for pointing this out.
2020-07-05 13:22:49 +02:00
Aaron Craelius 849429ecda
Add proper support for Any in gRPC queries (#6594)
* Add proper gRPC Any support via AnyUnpacker

* Wire up grpc query router AnyUnpacker
2020-07-03 16:42:12 +00:00
Alexander Bezobchuk 14d1ee5437
Use Context in Command instead of Argument + Util (#6572)
* Use context

* use PersistentPreRunE

* undo

* use init context

* Update types

* update tests

* implement tests

* Update simapp/cmd/simcli/main.go

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

* Update simapp/cmd/simcli/main.go

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

* Update x/bank/client/cli/tx.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* fix build

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-07-02 13:02:28 +00:00
Jonathan Gimeno 8f96ec0585
REST bank transfers fail due to encoding. (#6536)
Bank module REST endpoint bank/accounts/{addr}/transfers
was returning invalid StdTx format.
2020-07-02 05:16:39 +02:00
Alexander Bezobchuk 37cc04081e
Fix Current Integration Tests (#6570)
* fix attempt

* fix test
2020-07-01 18:37:59 +00:00
Aaron Craelius 99ea4b759a
Fix testdata proto-gen (#6568) 2020-07-01 15:26:29 +00:00
Alexander Bezobchuk d5049413ef
Merge PR #6525: x/bank: Refactor CLI & Tests 2020-06-30 16:59:21 -04:00
Anil Kumar Kammari 74eb56dd2a
Add test suite for client TxBuilder (#6460)
* Add tests

* Fix gofmt

* typecast tests

* Fix review comments

* typecast SigVerificableTx

* cleanup

* Refactor

* Linting and move encode/decode tests to suite

* Fix lint

* Move test suite

* godoc

* Refactor

* Refactor

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
2020-06-29 14:05:30 +00:00
Aaron Craelius 712d23740f
Migrate x/auth cmd's to TxGenerator marshaling (#6391)
* Migrate encode, decode, and broadcast cmd's to use TxGenerator marshal methods

* Fix tests, add EncodingConfig

* Add simapp/encoding.go and wire up with simcli

* add godocs

* fix tests

* Debugging CLI Tests

* Fix integration test

* 6391 - lint issues and code coverage (#6414)

* fixed lint issue of "txEncodeRespStr"

* added tests for encode.go

* WIP: added tests for decode.go

* added txEncoder at bytes

* updated decode test

* updated txBytes to use TxEncoder in decoder test

* added a require after TxEncoder

* removed file save

* debug decode command

* fixed decode tests

* added decode cli

* updated encode and decode in a single file

* separated decode test from encode test

* review changes

* removed register interface

* review change

* Fix tests

* WIP add test for tx sign

* removed commented code

* Fix flags

* WIP add test for sign

* Address review suggestions

* fixed command issue

* Add tests for TxEncoder

* Revert sign changes

* Fix TxEncoder tests

* Fix GetSign Cmd

* Add tx test

* Remove duplicate validation

* Add tests for TxDecoder

* Fix tests

* Fix tests

* Output to clientCtx.Output

* Fix cli_tests

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Co-authored-by: atheesh <atheesh@vitwit.com>
Co-authored-by: anilCSE <anil@vitwit.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-06-18 20:29:41 +00:00
Aaron Craelius 257354dbff
x/bank: convert query CLI commands to use gRPC query client (#6367)
* Convert x/bank query cli methods to use gRPC query client

* WIP on x/bank cli query migration

* lint

* Fix integration tests

* Remove Println in favor of updated PrintOutput

* Add PrintOutput tests

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-18 03:36:25 -04:00
Aaron Craelius c13809062a
Update TxBuilder to use SignatureV2 (#6443)
* Update TxBuilder to use SignatureV2

* Fix unit tests

* Lint

* lint

* Cleanup

* Address review feedback

* Add Sign tests

* Add more cases for sign tests

* Fix lint

* Fix gofmt

* Deprecate StdTx

* Undeprecate StdTx, but leave a comment to use the protobuf Tx

* Address review comment

Co-authored-by: anilCSE <anil@vitwit.com>
2020-06-16 19:57:37 +00:00
Alexander Bezobchuk 8ee7d1f403
Merge PR #6399: SDK Telemetry 2020-06-16 11:11:02 -04:00
Alexander Bezobchuk 35312d098e
JSON Codec Updates (#6444)
* Initial commit

* More updates

* Fix tests

* CLI test updates

* Updates

* Updates
2020-06-16 00:20:50 +00:00
Alexander Bezobchuk 6a05b83069
Merge PR #6426: Migrate API Server 2020-06-15 13:39:09 -04:00
dauTT 24b9be0ef8
x/bank: remove alias.go usage (#6439)
* x/bank: remove alias.go usage

* Fix simd_test.go
2020-06-14 23:06:16 +00:00
Federico Kunze 0215b5c6cd
client: fix signing algorithm (#6405)
* crypto/keyring: fix signing algorithm

* client: tests

* minor fixes

* changelog

* address @alexanderbez comments

* Update crypto/keyring/keyring.go

* Update crypto/keyring/signing_algorithms.go

* Update crypto/keyring/keyring.go

* Update crypto/keyring/signing_algorithms.go

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* fix test

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-06-11 14:30:42 +00:00
Aaron Craelius 4e0a475751
Make client.Context implement gRPC ClientConn (#6342)
* Add QueryConn to client.Context

* Add integration test

* imports

* spelling

* Make client.Context implement grpc ClientConn

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-08 13:41:30 +00:00
Aaron Craelius 81d647e505
Move codec.RegisterCrypto and codec.Cdc to new packages (#6330)
* Move codec.Cdc to legacy_global.Cdc

* Update CHANGELOG.md

* Updates

* nit

* Fix imports

* Updates

* Use cosmos multisig instead of tendermint multisig everywhere

* Fix tests

* Rename legacy_global -> legacy

* Add doc.go

* Linting, move all RegisterCrypto calls to crypto/codec

* Update crypto/codec/amino.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-04 10:38:24 +00:00
SaReN 39f53ac22f
client: rename CliContext to Context (#6290)
* Refactor CliContext as Context

* Fix lint issues

* Fix goimports

* Fix gov tests

* Resolved ci-lint issues

* Add changelog

* Rename cliCtx to clientCtx

* Fix mocks and routes

* Add changelog

* Update changelog

* Apply suggestions from code review

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* merge client/rpc/ro{ot,utes}.go

* Update docs

* client/rpc: remove redundant client/rpc.RegisterRPCRoutes

* regenerate mocks

* Update ADRs

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-06-01 12:46:03 +00:00
Alexander Bezobchuk f8bad078b7
Bump Tendermint version (#6300) 2020-05-28 14:46:28 +00:00
Aaron Craelius 850419fffd
Tx CLI proto module interface (#5989)
* WIP

* WIP

* WIP on removing x/auth dependency from client/tx

* Revert unneeded changes

* Simplify cli tx UX

* Wire up bank tx REST routes

* Fix assignment issue

* Wire up bank NewSendTxCmd

* fix lint

* revert file

* revert file

* fix simcli

* Refactor AccountRetriever

* Fix build

* Fix build

* Fix build

* Fix integration tests

* Fix tests

* Docs, linting

* Linting

* WIP on all modules

* Implement other module new tx cmd's

* Fix cmd's

* Refactor existing GetTxCmd

* Fix cmd

* Removing deprecated code

* Update ADR 020 & CHANGELOG

* Lint

* Lint

* Lint

* Lint

* Lint

* Lint

* Lint

* Fix client/tx tests

* Fix mocks

* Fix tests

* Lint fixes

* REST tx migration

* Wire up REST

* Linting

* Update CHANGELOG, docs

* Fix tests

* lint

* Address review feedback

* Update CHANGELOG.md

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>

* group vars

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-05-21 21:29:34 +00:00
SaReN bf8809ef98
Update x/auth to use Any (#6165)
* Migrate keeper codec to use marshaler

* Migrate AccountI to types

* Did go imports

* Fix tests for x/auth

* Cleanup std/codec

* Sort imports

* Fix legacy codec

* Add godoc for RegisterInterfaces

* Add RegisterInterfaces to std

* Fix typo

* Fixed merge changes

* Eliminate vesting import in auth

* Fix lint issues

* Fix tests

* Addressed comments

* Rename interfaces in RegisterInterfaces

* Removed codec.proto from std

* Minor code cleanup

Co-authored-by: Aaron Craelius <aaron@regen.network>
2020-05-20 19:21:00 +00:00
Aaron Craelius 9a38883e9c
Merge PR #6258: Fix test breakage and run proto-gen 2020-05-20 13:23:38 -04:00
Alessio Treglia 9b6e694a00
client: fix Paginate's arguments validation (#6205)
Check both page and defLimit against negative values.

Follow up of #6205

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-05-13 13:14:43 +00:00
Marko 4173ea5eba
types: add bech32 (#6200)
* bring over bech32 from tendermint

* fix spacing

* address comment

* change to fmt.Errorf

* space dem comments

* remove err cheks
2020-05-12 16:53:30 +00:00
Yongwoo Lee d4882606d5
Merge PR #6195: Add codespace to broadcast(sync/async) response 2020-05-12 11:26:54 -04:00
dependabot-preview[bot] f37308778a
build(deps): bump github.com/spf13/viper from 1.6.3 to 1.7.0 (#6183)
* build(deps): bump github.com/spf13/viper from 1.6.3 to 1.7.0

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.6.3 to 1.7.0.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.6.3...v1.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* refresh go.sum

* run make format

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-05-11 10:22:36 +02:00
Alexander Bezobchuk 8bd8d107a3
flags: fix "max-body-bytes" flag description (#6180) 2020-05-10 15:21:24 -04:00
Marko bef3689245
linter: enable nolintlint (#6162)
* nolintlint enable

* remove space

* fix tests

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-05-08 08:46:12 +00:00
Adam Bozanich 4e328d75db
client/keys/parse: honor config changes (#6172)
`keys parse` uses the global configuration before
before client applications have had a chance to
apply their settings.

This change adds a `GetSealedConfig()` helper
that waits for the config to be sealed before
returning it.

fixes #5091
addresses #5283
2020-05-08 10:30:55 +02:00
Alexander Bezobchuk fe9fe87693
REST: Add 'max-body-bytes' Flag (#6167)
* Add max-body-bytes flag for REST service

* Add changelog entries

* Change types
2020-05-07 17:49:08 +00:00
Federico Kunze ff24a24ae6
x/ibc: query all client connection paths (#6155)
* x/ibc: query all client connections

* add queries to CLI and REST

* add missing height

* update swagger
2020-05-06 15:56:49 +00:00
Kimura Yu 9ec46de285
Update swagger.yaml (#6133)
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-05-04 14:15:42 +00:00
Alessio Treglia 2414e5bdd4
x/auth: turn sign --validate-sigantures into a standalone command (#6108)
--validate-signatures should not be a flag of the sign command
as the operation performed (transaction signatures verification)
is logically distinct.

cli_test is and has always been an horrible name for package
directory as it's very much Go anti-idiomatic - _test is the
suffix used by test packages, not directories. Plus, CLI test
cases can and should live alongside other testcases that don't
require binaries to be built beforehand. Thus:

x/module/client/cli_test/*.go -> x/module/client/cli/

Test files that require sim{cli,d} shall be tagged with // +build cli_test

With regard to cli test auxiliary functions, they should live in:

x/module/client/testutil/

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-05-04 13:55:16 +00:00
Marko 218ec99508
various linter fixes (#6106)
x/staking: Fix all linter warnings.

Fixed warnings across base packages.

New linters:
- unparam
- nolintlint

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
2020-05-02 21:26:59 +02:00
Alessio Treglia 2879c0702c
x/ibc: fix missing return statement (#6099)
* enable the wsl linter

Fix various wsl-related warnings.

x/ibc/04-channel/keeper/handshake.go: fix missing return statement in ChanOpenTry().

* goimports -w files

* remove unknown linter references

* run make format

* Revert "run make format"

This reverts commit f810b62b9e4993f08506663d4e5f2ec2228a9863.

* run make format
2020-04-29 22:36:34 -04:00
Aaron Craelius cc90f2e002
Merge pull request #6085: Move codec/std to std 2020-04-27 15:40:50 -04:00
Alessio Treglia ccfa9c0484
client/rpc: fix panic on status command 2020-04-23 21:01:47 +02:00
Alexander Bezobchuk 72a2dae3db
Bump Tendermint v0.33.4 (#6055)
* Bump go.{mod,sum}

* Update APIs from Tendermint

* Add max clock drift to client state

* Test updates

* Update APIs from Tendermint

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-04-22 19:21:48 +00:00
Jonathan Gimeno 550c3e9ef0
Jonathan/5988 sim params consensus 2 (#6051)
* temporal commit

* add random consensus params

* make format

* make random pass

* remove comment

* revert change

* update ub key types

* extract Evidence params from state

* extract the random parameters from state

* clean the code

* update imports!

* mispelled back

* mispelled back

* add misspelled command

* update changelog

* remove useless linter to avoid misspell

* remove function

* use tendermint constants

* update import test

* remove debug comment

* Update baseapp/baseapp.go

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

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-04-22 18:24:13 +00:00
Alexander Bezobchuk 37c92c5f39
Revert "Add consensus params into Simulation (#6002)" (#6046)
This reverts commit 65048683b5.
2020-04-21 21:46:34 +00:00
Jonathan Gimeno 65048683b5
Add consensus params into Simulation (#6002)
* temporal commit

* add random consensus params

* make format

* make random pass

* remove comment

* revert change

* update ub key types

* extract Evidence params from state

* extract the random parameters from state

* clean the code

* update imports!

* mispelled back

* mispelled back

* add misspelled command

* update changelog

* remove useless linter to avoid misspell

* remove function

* use tendermint constants

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-04-21 18:28:43 +00:00
Sorawit Suriyakarn 80247dd86f
Merge PR #6038: Use CoinType from config as the default coin type 2020-04-21 11:22:44 -04:00
Aaron Craelius bb4642ad0d
Decouple client/tx from x/auth (#5992)
As part of #5864 part 2), this PR decouples the new client/tx
package from x/auth (as an incremental step to deprecating
all the tx logic in x/auth) and adds StdFee, StdSignature,
StdSignMsgBase and StdTxBase to codec/std, while
deprecating the corresponding types in x/auth.
2020-04-15 23:55:02 +02:00
Alessio Treglia aeee097b2f
spring cleanup (#5991)
* Make format

* Fix golangci-lint warnings

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-04-14 19:13:15 +00:00
Alessio Treglia e8cedf243f
fix all bits broken by viper API changes (#5982)
github.com/spf13/viper's recent releases introduced a semantic
change in some public API such as viper.IsSet(), which have
broken some of our flags checks. Instead of checking whether
users have changed a flag's default value we should rely on such
defaults and adjust runtime behaviour accordingly. In order to do
so, it's important that we pick sane defaults for all our flags.

The --pruning flag and configuration option now allow for a
fake custom strategy. When users elect custom, then the
pruning-{keep,snapshot}-every options are interpreted and
parsed; else they're ignored.
Zero is pruning-{keep,snapshot}-every default value. When
users choose to set a custom pruning strategy they are
signalling that they want more fine-grainted control, therefore
it's legitimate to expect them to know what they are doing and
enter valid values for both options.

Ref #5964
2020-04-14 17:24:27 +02:00
Alessio Treglia b75406534d
add missing keyring-backend flag (#5985)
Query commands that don't append all `get` flags would
panic otherwise.
2020-04-11 18:52:36 +02:00