Commit Graph

24 Commits

Author SHA1 Message Date
Robert Zaremba 7568b6680a
Remove bech32 PubKey support (#7477)
* Move PubKey bech32 to legacy package and migrate the usage where possible

* update /server

* wip

* move proto json encoding helper functions to internal

* update internal/marshal

* wip

* update sections which needs legacybech32

* update validators output

* fix conflicts

* slashing update

* add more tests and helper function for ANY JSON serialization

* update slashing

* Update function documentation

* Rename code any-marshal helper functions

* Update pubkey unpacking test

* Update test comments

* solve TestDecodeStore

* solve legacytx issues

* all code compiles

* keyring tests

* keyring cleanup

* remove AssertMsg

* fix some tests

* fix add_ledger_test.go

* update cli tests

* debug cli test

* rename clashed bech32 names

* linter fixes

* update tmservice tests

* linter: update legacy deprecated checks

* fix names

* linting

* legacybech32 pubkey type rename

* fix staking client

* fix test compilation

* fix TestGetCmdQuerySigningInfo

* rename NewIfcJSONAnyMarshaler

* keyring: remove duplicated information from multinfo structure

* todo cleanups

* Update Changelog

* remove some legacybech32 from tests

* remove todos

* remove printlnJSON from /server CLI and amino encoding

* remove protocdc.MarshalJSON

* client/show remove duplicated function

* remove protocdc package

* comment update

* remove legacybech32.MustMarshalPubKey from a test

* add todo

* fix TestPublicKeyUnsafe test

* review update

* fix bech32 UnmarshalPubKey

* Use codec.MarshalIfcJSON

* fix linter issues

* merging conflict: fix codec.Unmarshal calls

* cleanups

* Update CHANGELOG.md

Co-authored-by: Aaron Craelius <aaron@regen.network>

* Reword changelog updates

* use pubkey.String for comparison in Test_runAddCmdLedgerWithCustomCoinType

* Update GetCmdQuerySigningInfo example

* cli: update keys add docs

* Add errors AsOf and errors.ErrIO type

* restore multisigPubKeyInfo structure bring it back to multiInfo struct

* Update codec/proto_codec.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* Update crypto/keys/ed25519/ed25519_test.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* Update codec/proto_codec.go

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* move pubkey any marshaling tests

* Apply suggestions from code review

Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>

* review updates

* adding missing return

* errors: use IsOf instead of AsOf

* keyring: add a correct check for key not found in keyring.Get

* add checkKeyNotFound

* fix linter issues

* fix: keyring key not found check

* fix keyring tests

* fix linting issues

* cli tests

* fix: 'simd keys show <key> -p'

* fix: TestVerifyMultisignature

* rename keyring Bech32... functions to Mk...

* fix RunAddCmd

* Update pubkey display

* wip

* add more tests

* udate keyring output tests

* remove todo from ledger tests

* rename MkKeyOutput

* Changelog update

* solve liner issues

* add link to github issue

Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2021-03-25 14:53:22 +00:00
MD Aleem 81cc5c1194
gRPC gateway issue with colons in the account url path (#8649)
* add allow_colon_final_segments flag

* add test

* Update x/auth/client/rest/rest_test.go

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-22 11:30:45 +00:00
MD Aleem d162b29cf4
Add pagination to GetValidatorSetByHeight response (#8567)
* fix pagination

* add test

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-02-15 10:41:39 +00:00
Andrei Ivasko d37c590e90
Limit context background (#8093)
* limit context background

* update

* fixed minor issues

* fixed TestStatusCommand

* Fix keyring import from older versions. (#8436)

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>

* Add changelog (#8490)

* fix: tendermint subcommands should not create missing files (#8481)

If the user specifies an incorrect `--home`, then the old behaviour
would automatically populate it with fresh values, but we should
fail instead.

* limit context background

* update

* fixed minor issues

* fixed TestStatusCommand

* statik.go

* replaced static.go

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: sahith-narahari <sahithnarahari@gmail.com>
Co-authored-by: Michael FIG <mfig@agoric.com>
2021-02-03 09:47:25 +00:00
Marko ce5db9e4bd
fix proto generation (#8361)
* fix proto generation

* merge grpc_gateway into gocosmos_out

* change env variable names
2021-01-18 12:41:34 -03:00
Aaron Craelius 2521964d50
Update gogo proto deps with v1.3.2 security fixes (#8350)
* Update gogo proto deps with v1.3.2 security fixes

* Regenerate proto files
2021-01-15 19:45:34 +00:00
Anil Kumar Kammari 6a9b0caa57
Add grpc gateway missing endpoints to swagger docs (#8232)
* Add missing endpoints

* Fix swagger gen

* update

* Update static.go

* Fix format

* Fix tests
2021-01-01 13:45:09 -03:00
MD Aleem d4a919b714
change TmService's validator pubkey type to any (#8060)
* change validator pubkey type to any

* add test for vslidator pubkey

* change address to string

Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
2020-12-07 13:51:38 +00:00
Amaury 7ad2aab2c4
Add panic handler on queries (#8039)
* Add test that panics

* Add panic in abci query

* Move proto gen files to correct place

* Add panic handler in grpc server

* Fix test

* Fix build

* Use %v

* Better panic message

* Fix tests

Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
2020-11-30 16:59:35 +00:00
MD Aleem c58a8923a0
gRPC-gateway routes as alternative to legacy tendermint REST endpoints (#7965)
* WIP

* WIP setup

* WIP setup testsuite

* add node_info

* add GetLatestBlock,GetBlockByHeight grpc endpoints

* add GetValidatorSetByHeight, GetLatestValidatorSet

* fix lint

* fix tests

* proto format

* Update Makefile

* review changes

* Makefile format

* handle nil pagination

* rename query.go to service.go

* format Makefile

* format Makefile

* review changes

* review changes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-11-25 15:58:11 +00:00
Amaury Martiny 1961935fc7
Add GetTx gRPC endpoint (#7688)
* Add empty TxByHash

* Fix search & replace

* Renname to GetTx

* Make getTx grpc work

* Hash as string

* Add todo comment

* /tx

* Make tests pass

* Put into function

* Add changelog

* Fix lint

* RegisterTxService in server

* Remove comment

* Update proto/cosmos/tx/v1beta1/service.proto

Co-authored-by: Cory <cjlevinson@gmail.com>

* Create new protoCdc

* Move tx service to x/auth

* Small tweaks

* Link gh issue

* Fix lint

* Update x/auth/tx/service.go

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

Co-authored-by: Cory <cjlevinson@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: SaReN <sahithnarahari@gmail.com>
2020-10-30 12:32:02 +00:00
Amaury Martiny 9087ffc774
Throw an error on duplicate registration (#7729)
* Panic on registering a service twice

* Panic if we register twice

* Fix test

* Fix test

* Add clearer panic message

* Add comment

* Fix test
2020-10-29 15:32:47 +00:00
Robert Zaremba 9bd42ace6b
simapp: rename MakeEncodingConfig to MakeTestEncodingConfig (#7681)
* simapp: rename MakeEncodingConfig to MakeTestEncodingConfig

* Updating the Changelog

+ Adding DEPRECATED attribute.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-27 11:33:48 +00:00
Marie Gauthier eba4c8a264
Handle nil *Any in UnpackAny and add panic handler for tx decoding (#7594)
* Handle nil any in UnpackAny

* Add test

* Add flag back

* Update runTx signature

* Update Simulate signature

* Update calls to Simulate

* Add txEncoder in baseapp

* Fix TestTxWithoutPublicKey

* Wrap errors

* Use amino in baseapp tests

* Add txEncoder arg to Check & Deliver

* Fix gas in test

* Fix remaining base app tests

* Rename to amionTxEncoder

* Update codec/types/interface_registry.go

Co-authored-by: Aaron Craelius <aaron@regen.network>

* golangci-lint fix

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Co-authored-by: Cory Levinson <cjlevinson@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-10-19 18:04:44 +00:00
Anil Kumar Kammari d55c1a2665
Change `address` from bytes to bech32 strings (#7242)
* init

* Fix bank proto messages

* missing conversions

* remove casttype for addresses

* Fix tests

* Fix consaddress

* more test fixes

* Fix tests

* fixed tests

* migrate missing proto declarations

* format

* Fix format

* Fix alignment

* Fix more tests

* Fix ibc merge issue

* Fix fmt

* Fix more tests

* Fix missing address declarations

* Fix staking tests

* Fix more tests

* Fix config

* fixed tests

* Fix more tests

* Update staking grpc tests

* Fix merge issue

* fixed failing tests in x/distr

* fixed sim tests

* fixed failing tests

* Fix bugs

* Add logs

* fixed slashing issue

* Fix staking grpc tests

* Fix all bank tests :)

* Fix tests in distribution

* Fix more tests in distr

* Fix slashing tests

* Fix statking tests

* Fix evidence tests

* Fix gov tests

* Fix bug in create vesting account

* Fix test

* remove fmt

* fixed gov tests

* fixed x/ibc tests

* fixed x/ibc-transfer tests

* fixed staking tests

* fixed staking tests

* fixed test

* fixed distribution issue

* fix pagination test

* fmt

* lint

* fix build

* fix format

* revert tally tests

* revert tally tests

* lint

* Fix sim test

* revert

* revert

* fixed tally issue

* fix tests

* revert

* fmt

* refactor

* remove `GetAddress()`

* remove fmt

* revert fmt.Striger usage

* Fix tests

* Fix rest test

* disable interfacer lint check

* make proto-format

* add nolint rule

* remove stray println

Co-authored-by: aleem1314 <aleem.md789@gmail.com>
Co-authored-by: atheesh <atheesh@vitwit.com>
2020-09-25 10:25:37 +00:00
Amaury Martiny 7cd25abb87
Proto Tx with Any (#7276)
* WIP on protobuf keys

* Use Type() and Bytes() in sr25519 pub key Equals

* Add tests

* Add few more tests

* Update other pub/priv key types Equals

* Fix PrivKey's Sign method

* Rename variables in tests

* Fix infinite recursive calls

* Use tm ed25519 keys

* Add Sign and VerifySignature tests

* Remove ed25519 and sr25519 references

* proto linting

* Add proto crypto file

* Implement some of the new multisig proto type methods

* Add tests for MultisigThresholdPubKey

* Add tests for pubkey pb/amino conversion functions

* Move crypto types.go and register new proto pubkeys

* Add missing pointer ref

* Address review comments

* panic in MultisigThresholdPubKey VerifySignature

* Use internal crypto.PubKey in multisig

* Add tests for MultisigThresholdPubKey VerifyMultisignature

* Only keep LegacyAminoMultisigThresholdPubKey and move to proto keys to v1

* Remove conversion functions and introduce internal PubKey type

* Override Amino marshaling for proto pubkeys

* Merge master

* Make proto-gen

* Start removal of old PubKeyMultisigThreshold references

* Fix tests

* Fix solomachine

* Fix ante handler tests

* Pull latest go-amino

* Remove ed25519

* Remove old secp256k1 PubKey and PrivKey

* Uncomment test case

* Fix linting issues

* More linting

* Revert tests keys values

* Add Amino overrides to proto keys

* Add pubkey test

* Fix tests

* Use threshold isntead of K

* Standardize Type

* Revert standardize types commit

* Fix build

* Fix lint

* Fix lint

* Add comment

* Register crypto.PubKey

* Add empty key in BuildSimTx

* Simplify proto names

* Unpack interfaces for signing desc

* Fix IBC tests?

* Format proto

* Use secp256k1 in ibc

* Fixed merge issues

* Uncomment tests

* Update x/ibc/testing/solomachine.go

* UnpackInterfaces for solomachine types

* Remove old multisig

* Add amino marshal for multisig

* Fix lint

* Correctly register amino

* One test left!

* Remove old struct

* Fix test

* Fix test

* Unpack into tmcrypto

* Remove old threshold pubkey tests

* Fix register amino

* Fix lint

* Use sdk crypto PubKey in multisig UnpackInterfaces

* Potential fix?

* Register LegacyAminoPubKey

* Register our own PubKey

* Register tmcrypto PubKey

* Register both PubKeys

* Register interfaces in test

* Refactor fiels

* Add comments

* Use anil's suggestion

* Add norace back

* Check nil

* Address comments

* FIx lint

* Add tests for solomachine unpack interfaces

* Fix query tx by hash

* Better name in amino register

* Display StdTx instead of proto Tx

* Remove useless check

Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com>
Co-authored-by: blushi <marie.gauthier63@gmail.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2020-09-21 16:48:28 +00:00
SaReN b2348180b8
Migrate {x/auth, x/gov, x/staking} missing CLI queries to proto (#6994)
* Fix error code

* Fix decoder

* Fix typo

* Fix decode

* refactor

* Migrate SearchTxsResult to proto

* fix MarkEventsToIndex

* lint++

* Fix output

* Add QueryTxCmd cli test

* Add fmt

* Put txBuilder in types/tx

* Add GetAnyTx in TxBuilder

* Add new IsAnyTx

* Rename to IntoAny

* Fix bug

* fmt

Co-authored-by: Marie <marie.gauthier63@gmail.com>

* Fix ibc CLI to use proto

* Fix any MarshalJSON

* Fix test

* Make tx.Tx implement sdk.Tx

* Register sdk.Tx

* Fix lint

* Allow DefaultJSONTxEncoder to take tx.Tx

* refactor

* Rename variable

* remove fmt

Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Marie <marie.gauthier63@gmail.com>
2020-09-10 18:26:47 +00:00
colin axnér ec74416276
x/ibc: move solo machine sequence to client state (#7271)
* update proto

* move solo machine sequence to client state

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>
2020-09-09 12:14:11 -03:00
Federico Kunze 2f25c9a0d8
x/ibc: solo machine signature format (#7237)
* x/ibc: solo machine signature format

* update tests and verification

* diversifier updates

* update tests

* fix lint

* Update x/ibc/light-clients/solomachine/types/header_test.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* update test

* misbehaviour sign bytes

* consensus state tests

* fix tests

* more fixes

Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
2020-09-07 12:46:48 +00:00
dauTT b52ffa08e1
Implement ADR 026 (#7029)
* Add allow_governance_override_after_expiry flag to tendermint NewCreateClientCmd

* 1) Add LatestTimestamp to ClientState struct by adding a new attribute latest_timestamp to the message ClientState in proto/ibc/tendermint/tendermint.proto
2) Autogenerate x/ibc/07-tendermint/types/tendermint.pb.go by running 'make proto-gen'. Strangely, as a side effect x/distribution/types/genesis.pb.go, x/evidence/types/genesis.pb.go were also modified by the command 'make proto-gen'
3) Add Expired() function

* Fix tests

* 1) Add allow_governance_override_after_expiry flag to tendemint clientStatus
2) Add allow_governance_override_after_misbehaviour flag to tendermint ClientStatus

* Cosmetic changes

* Fix tests

* Add Unfreeze function

* Add new ClientUpdateProposal type

* Add minor fixes

* Add NewClientUpdateProposalHandler unit tests

* Fix proto-lint-docker

* Delete x/ibc/07-tendermint/tendermint_test.go

* Follow convention to put signer last in msg function signature

* 1) Add GetLatestTimestamp function  to ClientStatus interface
2) Change Expired() signature to Expired(now time.Time)

* 1) Add override flag to UpdateClient function
2) Fix tests

* Refactor HandleClientUpdateProposal

* 1) Extend exported Header interface with MarshalBinaryBare and UnmarshalBinaryBare methods
2) Move ClientUpdateProposal message to from ibc.proto to client.proto
3) Refactoring code
4) Add override flag to UpdateClient method
5) Fix tests

* 1) Uncomment tests and clean up code
2) Add basic validation of the header (ValidateBasic) when the override flag is true

* Cosmetic changes

* Add TODO comments

* Fix header MarshalBinaryBare, UnmarshalBinaryBare by using protobuf encoding/decoding

* Fix proto comments

* Fix override logic

* undo gettimestamp for solo machine and localhost

* add update after proposal func, some major refactoring in progress, various issues addressed

* fix tendermint proposal update handling

* run make proto-gen

* remove timestamp from tendemint client

* fix build issue for tm types

* apply various review comments

* add tests for 02-client functionality

* self review fixes

* typo

* update tests slightly

* update tendermint proposal handling tests

* Update x/ibc/02-client/keeper/proposal.go

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

* Update x/ibc/07-tendermint/types/proposal_handle.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* Update x/ibc/07-tendermint/types/proposal_handle.go

Co-authored-by: Aditya <adityasripal@gmail.com>

* apply most of @fedekunze and some of @AdityaSripal suggestions

* convert test to bools

* update docs and increase code cov

* fix build

* fix typo, remove omitempty

* add switch

* apply @fedekunze latest suggestions

* fix lint

* Update x/ibc/02-client/keeper/proposal_test.go

Co-authored-by: Christopher Goes <cwgoes@pluranimity.org>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Colin Axner <colinaxner@berkeley.edu>
Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Aditya <adityasripal@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-09-04 20:59:22 +00:00
Jack Zampolin 7d64086d33
Ensure IBC Proto Registration (#7210)
* init commit

* Add simulation request

* Push progress

* ensure exported interfaces and their concrete implementations are registered in ibc modules

* revert CalculateGas changes

* Fix simulation response unmarshal

* ensure exported interfaces and their concrete implementations are registered in ibc modules

* Passing tests

* Fix lint issues

* Update client/tx/tx.go

Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-09-01 20:59:48 +00:00
Aditya 9fc0dbbe05
Rename Evidence to Misbehaviour in IBC (#7151)
* rename Evidence to Misbehaviour in IBC code

* tidy go.sum

* remove more references to evidence

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* Update x/ibc/07-tendermint/client/cli/tx.go

* nit and doc

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-08-26 17:51:13 +00:00
Amaury Martiny 3d969a1ffd
Implement gRPC Simulate endpoint (#7035)
* Implement simulate endpoint

* Add GetProtoTx()

* Add signing in test

* Add txBuilderFromProto

* Remove stray println

* Update to master

* Merge master

* Fix tests

* Make tests pass

* Integrate in router

* Make proto-gen

* Fix lint

* Really fix lint

* Refactor to fix import cycles

* Rename builder -> wrapper

* Update proto/cosmos/base/reflection/v1beta1/reflection.proto

* Fix after merge

* t->w

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-08-24 14:41:08 +00:00
Aaron Craelius 3f81c0a18d
gRPC interface reflection. (#6722)
* WIP on gRPC interface reflection.

* Update docs in proto

* Add tests

* Add test

* Add route inside router

* Address nits

* ListInterfaces -> ListAllInterfaces

* Fix proto lint

* Remove stray println

* Update proto/cosmos/base/reflection/v1beta1/reflection.proto

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

* Update codec/types/interface_registry.go

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

* Update codec/types/interface_registry.go

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

* Add godoc

Co-authored-by: Amaury Martiny <amaury.martiny@protonmail.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
2020-08-17 17:02:13 +00:00