From ec39bb3b4274eca381cca7eefce0b45e90d84500 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Tue, 25 Feb 2020 15:22:28 -0500 Subject: [PATCH 1/8] Merge PR #5696: Fix x/auth proto json tags --- server/export.go | 10 ++--- x/auth/types/account.go | 46 ++++++++++++++++++++ x/auth/types/types.pb.go | 83 +++++++++++++++++++------------------ x/auth/types/types.proto | 4 +- x/upgrade/types/types.pb.go | 65 ++++++++++++++--------------- 5 files changed, 125 insertions(+), 83 deletions(-) diff --git a/server/export.go b/server/export.go index b4f52f639..81f43571b 100644 --- a/server/export.go +++ b/server/export.go @@ -10,7 +10,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tm-db" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/codec" @@ -39,8 +38,8 @@ func ExportCmd(ctx *Context, cdc codec.JSONMarshaler, appExporter AppExporter) * return err } - if isEmptyState(db) || appExporter == nil { - if _, err := fmt.Fprintln(os.Stderr, "WARNING: State is not initialized. Returning genesis file."); err != nil { + if appExporter == nil { + if _, err := fmt.Fprintln(os.Stderr, "WARNING: App exporter not defined. Returning genesis file."); err != nil { return err } @@ -88,9 +87,6 @@ func ExportCmd(ctx *Context, cdc codec.JSONMarshaler, appExporter AppExporter) * cmd.Flags().Int64(flagHeight, -1, "Export state from a particular height (-1 means latest height)") cmd.Flags().Bool(flagForZeroHeight, false, "Export state to start at height zero (perform preproccessing)") cmd.Flags().StringSlice(flagJailWhitelist, []string{}, "List of validators to not jail state export") + return cmd } - -func isEmptyState(db dbm.DB) bool { - return db.Stats()["leveldb.sstables"] == "" -} diff --git a/x/auth/types/account.go b/x/auth/types/account.go index 08b67facc..bae7d8f3b 100644 --- a/x/auth/types/account.go +++ b/x/auth/types/account.go @@ -2,6 +2,7 @@ package types import ( "bytes" + "encoding/json" "errors" "github.com/tendermint/tendermint/crypto" @@ -143,3 +144,48 @@ func (acc BaseAccount) MarshalYAML() (interface{}, error) { return string(bz), err } + +// MarshalJSON returns the JSON representation of a BaseAccount. +func (acc BaseAccount) MarshalJSON() ([]byte, error) { + alias := baseAccountPretty{ + Address: acc.Address, + AccountNumber: acc.AccountNumber, + Sequence: acc.Sequence, + } + + if acc.PubKey != nil { + pks, err := sdk.Bech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, acc.GetPubKey()) + if err != nil { + return nil, err + } + + alias.PubKey = pks + } + + return json.Marshal(alias) +} + +// UnmarshalJSON unmarshals raw JSON bytes into a BaseAccount. +func (acc *BaseAccount) UnmarshalJSON(bz []byte) error { + var alias baseAccountPretty + if err := json.Unmarshal(bz, &alias); err != nil { + return err + } + + // NOTE: This will not work for multisig-based accounts as their Bech32 + // encoding is too long. + if alias.PubKey != "" { + pk, err := sdk.GetPubKeyFromBech32(sdk.Bech32PubKeyTypeAccPub, alias.PubKey) + if err != nil { + return err + } + + acc.PubKey = pk.Bytes() + } + + acc.Address = alias.Address + acc.AccountNumber = alias.AccountNumber + acc.Sequence = alias.Sequence + + return nil +} diff --git a/x/auth/types/types.pb.go b/x/auth/types/types.pb.go index d4aaf520d..f5fa313fb 100644 --- a/x/auth/types/types.pb.go +++ b/x/auth/types/types.pb.go @@ -30,7 +30,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // type for additional functionality (e.g. vesting). type BaseAccount struct { Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty"` - PubKey []byte `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty" yaml:"public_key"` + PubKey []byte `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"public_key,omitempty" yaml:"public_key"` AccountNumber uint64 `protobuf:"varint,3,opt,name=account_number,json=accountNumber,proto3" json:"account_number,omitempty" yaml:"account_number"` Sequence uint64 `protobuf:"varint,4,opt,name=sequence,proto3" json:"sequence,omitempty"` } @@ -207,46 +207,47 @@ func init() { func init() { proto.RegisterFile("x/auth/types/types.proto", fileDescriptor_2d526fa662daab74) } var fileDescriptor_2d526fa662daab74 = []byte{ - // 613 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbf, 0x6f, 0xd3, 0x4e, - 0x14, 0x8f, 0xbf, 0xc9, 0x37, 0xad, 0xae, 0x05, 0x11, 0xf7, 0x97, 0x1b, 0x21, 0x5f, 0xe4, 0x01, - 0x85, 0xa1, 0x0e, 0x29, 0x2a, 0x52, 0x33, 0x20, 0xea, 0x00, 0x4b, 0xa1, 0xaa, 0x1c, 0x89, 0x01, - 0x09, 0x59, 0x67, 0xfb, 0x70, 0xac, 0xf4, 0x72, 0xae, 0xef, 0x5c, 0xd9, 0x5d, 0x58, 0x19, 0x19, - 0x19, 0x3b, 0xf3, 0x97, 0x74, 0xec, 0xc8, 0xe4, 0xa2, 0x74, 0x61, 0xf6, 0xc8, 0x84, 0xce, 0x97, - 0x96, 0xb4, 0x14, 0xc4, 0x62, 0xdf, 0x7b, 0xef, 0xf3, 0xe3, 0xee, 0xbd, 0x3b, 0xa0, 0xa5, 0x1d, - 0x94, 0xf0, 0x61, 0x87, 0x67, 0x11, 0x66, 0xf2, 0x6b, 0x46, 0x31, 0xe5, 0x54, 0x5d, 0xf6, 0x28, - 0x23, 0x94, 0x39, 0xcc, 0x1f, 0x99, 0xa9, 0x29, 0x40, 0xe6, 0x51, 0xb7, 0xf9, 0x80, 0x0f, 0xc3, - 0xd8, 0x77, 0x22, 0x14, 0xf3, 0xac, 0x53, 0x02, 0x3b, 0x01, 0x0d, 0xe8, 0xaf, 0x95, 0x64, 0x37, - 0x1b, 0xbf, 0x09, 0x1a, 0x85, 0x02, 0x16, 0x2c, 0xc4, 0xf0, 0x8e, 0xe7, 0xd1, 0x64,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19, 0x0c, 0x7b, 0xd1, 0xe6, - 0xd6, 0x93, 0x51, 0x57, 0xfb, 0xbf, 0x34, 0x7d, 0x3a, 0xc9, 0xe1, 0xea, 0x35, 0xd3, 0xc1, 0x25, - 0xa2, 0xc8, 0x61, 0xeb, 0x76, 0xdb, 0x2b, 0x11, 0xc3, 0x5e, 0x65, 0xb7, 0x72, 0x7b, 0xf3, 0xe2, - 0x7a, 0x89, 0x09, 0x5b, 0xfd, 0xd3, 0x89, 0xae, 0x9c, 0x4d, 0x74, 0xe5, 0xdb, 0x44, 0x57, 0x3e, - 0x5d, 0xe8, 0x95, 0xb3, 0x0b, 0xbd, 0xf2, 0xf5, 0x42, 0xaf, 0xbc, 0x7d, 0xf8, 0xd7, 0x5b, 0x34, - 0xfb, 0xf2, 0xdd, 0x7a, 0xf9, 0x46, 0x1f, 0xff, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xcb, 0x64, - 0x0b, 0x10, 0x04, 0x00, 0x00, + // 630 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xbf, 0x6f, 0xd3, 0x4e, + 0x14, 0x8f, 0x9b, 0x7c, 0xd3, 0xea, 0xda, 0x2f, 0x22, 0x6e, 0xda, 0xba, 0x11, 0xf2, 0x45, 0x1e, + 0x50, 0x90, 0xa8, 0x43, 0x8a, 0x8a, 0xd4, 0x0c, 0x88, 0x3a, 0xd0, 0xa5, 0x50, 0x55, 0x8e, 0xc4, + 0x80, 0x84, 0xac, 0xb3, 0x7d, 0x38, 0x56, 0x7a, 0x39, 0xd7, 0x77, 0xae, 0xec, 0x2e, 0xac, 0x88, + 0x89, 0x91, 0xb1, 0x33, 0x7f, 0x49, 0xc7, 0x8e, 0x4c, 0x2e, 0x4a, 0x17, 0xc4, 0xe8, 0x91, 0x09, + 0xd9, 0x97, 0xb6, 0x69, 0x29, 0x88, 0xc5, 0xbe, 0x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, 0xe5, 0x50, 0xc6, 0xad, 0x00, 0x87, 0x96, 0x9d, 0x70, 0x3c, 0x99, + 0x42, 0x33, 0x4b, 0xe1, 0xbd, 0x29, 0x8d, 0x9b, 0x30, 0xcd, 0xac, 0xe5, 0x62, 0x47, 0xb8, 0x47, + 0x19, 0xdf, 0xc3, 0xa1, 0x91, 0x70, 0x2c, 0x1f, 0x80, 0x95, 0xdc, 0xed, 0x10, 0x87, 0xfe, 0xbb, + 0x44, 0xe0, 0xb1, 0xbb, 0xbe, 0xb1, 0xd1, 0xd9, 0x14, 0xf3, 0x31, 0xba, 0xe3, 0x14, 0xd6, 0xfb, + 0xbe, 0xf7, 0xba, 0x40, 0xe4, 0xd4, 0x17, 0xcf, 0x8b, 0x7a, 0x96, 0x42, 0x55, 0xb8, 0xfd, 0x41, + 0x40, 0x33, 0xeb, 0xec, 0x1a, 0x4f, 0xa4, 0xe5, 0x04, 0xac, 0xde, 0x64, 0x30, 0xec, 0x04, 0xeb, + 0x1b, 0x4f, 0x86, 0x1d, 0xe5, 0xbf, 0xc2, 0xf4, 0xe9, 0x38, 0x85, 0xcb, 0xd7, 0x4c, 0xfb, 0x17, + 0x88, 0x2c, 0x85, 0xcd, 0xdb, 0x6d, 0x2f, 0x45, 0x34, 0x73, 0x99, 0xdd, 0xca, 0xed, 0xce, 0xe5, + 0xc7, 0x2b, 0x9f, 0xb0, 0xd1, 0x3b, 0x19, 0xab, 0xd2, 0xe9, 0x58, 0x95, 0xbe, 0x8d, 0x55, 0xe9, + 0xd3, 0xb9, 0x5a, 0x3a, 0x3d, 0x57, 0x4b, 0x5f, 0xcf, 0xd5, 0xd2, 0x9b, 0x07, 0x7f, 0x3d, 0x45, + 0xd3, 0x37, 0x82, 0x5d, 0x2d, 0xfe, 0xdd, 0xc7, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xce, 0x6d, + 0xf3, 0x2e, 0x28, 0x04, 0x00, 0x00, } func (this *StdFee) Equal(that interface{}) bool { diff --git a/x/auth/types/types.proto b/x/auth/types/types.proto index 99bf50bc8..60e7a8d8b 100644 --- a/x/auth/types/types.proto +++ b/x/auth/types/types.proto @@ -13,8 +13,8 @@ message BaseAccount { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; - bytes pub_key = 2 [(gogoproto.moretags) = "yaml:\"public_key\""]; + bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; + bytes pub_key = 2 [(gogoproto.jsontag) = "public_key,omitempty", (gogoproto.moretags) = "yaml:\"public_key\""]; uint64 account_number = 3 [(gogoproto.moretags) = "yaml:\"account_number\""]; uint64 sequence = 4; } diff --git a/x/upgrade/types/types.pb.go b/x/upgrade/types/types.pb.go index 4e8f7cbb9..8cc9e383b 100644 --- a/x/upgrade/types/types.pb.go +++ b/x/upgrade/types/types.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: x/upgrade/internal/types/types.proto +// source: x/upgrade/types/types.proto package types @@ -49,7 +49,7 @@ type Plan struct { func (m *Plan) Reset() { *m = Plan{} } func (*Plan) ProtoMessage() {} func (*Plan) Descriptor() ([]byte, []int) { - return fileDescriptor_6199ecc2c05edfcb, []int{0} + return fileDescriptor_2a308fd9dd71aff8, []int{0} } func (m *Plan) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -78,6 +78,7 @@ func (m *Plan) XXX_DiscardUnknown() { var xxx_messageInfo_Plan proto.InternalMessageInfo +// SoftwareUpgradeProposal is a gov Content type for initiating a software upgrade type SoftwareUpgradeProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -87,7 +88,7 @@ type SoftwareUpgradeProposal struct { func (m *SoftwareUpgradeProposal) Reset() { *m = SoftwareUpgradeProposal{} } func (*SoftwareUpgradeProposal) ProtoMessage() {} func (*SoftwareUpgradeProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_6199ecc2c05edfcb, []int{1} + return fileDescriptor_2a308fd9dd71aff8, []int{1} } func (m *SoftwareUpgradeProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -116,6 +117,7 @@ func (m *SoftwareUpgradeProposal) XXX_DiscardUnknown() { var xxx_messageInfo_SoftwareUpgradeProposal proto.InternalMessageInfo +// SoftwareUpgradeProposal is a gov Content type for cancelling a software upgrade type CancelSoftwareUpgradeProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` @@ -124,7 +126,7 @@ type CancelSoftwareUpgradeProposal struct { func (m *CancelSoftwareUpgradeProposal) Reset() { *m = CancelSoftwareUpgradeProposal{} } func (*CancelSoftwareUpgradeProposal) ProtoMessage() {} func (*CancelSoftwareUpgradeProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_6199ecc2c05edfcb, []int{2} + return fileDescriptor_2a308fd9dd71aff8, []int{2} } func (m *CancelSoftwareUpgradeProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -159,36 +161,33 @@ func init() { proto.RegisterType((*CancelSoftwareUpgradeProposal)(nil), "cosmos_sdk.x.upgrade.v1.CancelSoftwareUpgradeProposal") } -func init() { - proto.RegisterFile("x/upgrade/internal/types/types.proto", fileDescriptor_6199ecc2c05edfcb) -} +func init() { proto.RegisterFile("x/upgrade/types/types.proto", fileDescriptor_2a308fd9dd71aff8) } -var fileDescriptor_6199ecc2c05edfcb = []byte{ - // 371 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x3f, 0x0f, 0x12, 0x31, - 0x14, 0xbf, 0xca, 0x49, 0xa4, 0x6c, 0x8d, 0x91, 0x0b, 0x09, 0xe5,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 0xc4, 0x60, 0xda, 0x49, 0xda, 0xae, 0x76, 0x11, 0x72, 0xad, 0xa2, 0xd0, 0xbb, 0xd4, 0xf5, - 0xe4, 0x3b, 0x80, 0x83, 0xf7, 0x6a, 0xed, 0xbe, 0x32, 0xc3, 0x3f, 0xfa, 0x11, 0x17, 0x46, 0x69, - 0x65, 0x59, 0x89, 0x1e, 0xc3, 0x87, 0x4e, 0xb8, 0xf2, 0x1e, 0xcb, 0x37, 0x28, 0x86, 0xfd, 0x8c, - 0xdb, 0xd4, 0x08, 0xed, 0x84, 0x92, 0x4d, 0xbc, 0x5e, 0xf2, 0xf7, 0x11, 0x7a, 0x0d, 0x43, 0x5d, - 0x32, 0xd9, 0xb8, 0xf7, 0x67, 0x23, 0xf2, 0x8f, 0x7b, 0x24, 0xf5, 0xe8, 0xf3, 0xb0, 0x0e, 0x9f, - 0x34, 0x84, 0xc9, 0x27, 0x38, 0x7a, 0xcb, 0x64, 0xca, 0xcb, 0xff, 0x9c, 0x68, 0xfe, 0xee, 0x78, - 0xc1, 0xc1, 0xf9, 0x82, 0x83, 0xe3, 0x15, 0x83, 0xd3, 0x15, 0x83, 0x5f, 0x57, 0x0c, 0x0e, 0x37, - 0x1c, 0x9c, 0x6e, 0x38, 0x38, 0xdf, 0x70, 0xf0, 0xf9, 0x79, 0x2e, 0x5c, 0xb1, 0x5d, 0x91, 0x54, - 0x55, 0xd4, 0xe7, 0x6d, 0xb7, 0x17, 0x36, 0xdb, 0xd0, 0x1d, 0xd5, 0xcc, 0xb0, 0xaa, 0xfd, 0x1f, - 0xab, 0x6e, 0xf3, 0x08, 0xaf, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xad, 0x67, 0xed, 0x35, 0x48, - 0x02, 0x00, 0x00, +var fileDescriptor_2a308fd9dd71aff8 = []byte{ + // 364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0x31, 0x6f, 0xe2, 0x30, + 0x18, 0x8d, 0x8f, 0x1c, 0x3a, 0xcc, 0x66, 0x9d, 0x8e, 0x88, 0x13, 0x26, 0x62, 0xa8, 0x18, 0x5a, + 0x47, 0xa5, 0x43, 0x3b, 0xd3, 0xbd, 0x42, 0x69, 0xab, 0x4a, 0x5d, 0x90, 0x49, 0x4c, 0x62, 0x91, + 0xc4, 0x56, 0x6c, 0x5a, 0xd8, 0x3a, 0x77, 0xe2, 0x67, 0x31, 0x32, 0x32, 0xb5, 0x05, 0xfe, 0x48, + 0x95, 0x18, 0xd4, 0xaa, 0x52, 0xb7, 0x2e, 0xf6, 0xfb, 0xac, 0xf7, 0xbd, 0xf7, 0x3e, 0xdb, 0xf0, + 0xff, 0xcc, 0x9b, 0xca, 0x28, 0xa7, 0x21, 0xf3, 0xf4, 0x5c, 0x32, 0x65, 0x56, 0x22, 0x73, 0xa1, + 0x05, 0x6a, 0x04, 0x42, 0xa5, 0x42, 0x0d, 0x55, 0x38, 0x21, 0x33, 0xb2, 0xe7, 0x91, 0x87, 0xd3, + 0xe6, 0x91, 0x8e, 0x79, 0x1e, 0x0e, 0x25, 0xcd, 0xf5, 0xdc, 0x2b, 0xb9, 0x5e, 0x24, 0x22, 0xf1, + 0x81, 0x8c, 0x40, 0xb3, 0x1d, 0x09, 0x11, 0x25, 0xcc, 0x50, 0x46, 0xd3, 0xb1, 0xa7, 0x79, 0xca, + 0x94, 0xa6, 0xa9, 0x34, 0x84, 0xce, 0x13, 0x80, 0xf6, 0x20, 0xa1, 0x19, 0x42, 0xd0, 0xce, 0x68, + 0xca, 0x1c, 0xe0, 0x82, 0x6e, 0xcd, 0x2f, 0x31, 0xba, 0x80, 0x76, 0xc1, 0x77, 0x7e, 0xb9, 0xa0, + 0x5b, 0xef, 0x35, 0x89, 0x11, 0x23, 0x07, 0x31, 0x72, 0x73, 0x10, 0xeb, 0xff, 0x59, 0xbe, 0xb4, + 0xad, 0xc5, 0x6b, 0x1b, 0xf8, 0x65, 0x07, 0xfa, 0x07, 0xab, 0x31, 0xe3, 0x51, 0xac, 0x9d, 0x8a, + 0x0b, 0xba, 0x15, 0x7f, 0x5f, 0x15, 0x2e, 0x3c, 0x1b, 0x0b, 0xc7, 0x36, 0x2e, 0x05, 0xee, 0x3c, + 0x03, 0xd8, 0xb8, 0x16, 0x63, 0xfd, 0x48, 0x73, 0x76, 0x6b, 0x46, 0x1c, 0xe4, 0x42, 0x0a, 0x45, + 0x13, 0xf4, 0x17, 0xfe, 0xd6, 0x5c, 0x27, 0x87, 0x58, 0xa6, 0x40, 0x2e, 0xac, 0x87, 0x4c, 0x05, + 0x39, 0x97, 0x9a, 0x8b, 0xac, 0x8c, 0x57, 0xf3, 0x3f, 0x1f, 0xa1, 0x73, 0x68, 0xcb, 0x84, 0x66, + 0xa5, 0x7b, 0xbd, 0xd7, 0x22, 0xdf, 0xdc, 0x23, 0x29, 0x46, 0xef, 0xdb, 0x45, 0x78, 0xbf, 0x6c, + 0xe8, 0xdc, 0xc1, 0xd6, 0x25, 0xcd, 0x02, 0x96, 0xfc, 0x70, 0xa2, 0xfe, 0xd5, 0x72, 0x83, 0xad, + 0xf5, 0x06, 0x5b, 0xcb, 0x2d, 0x06, 0xab, 0x2d, 0x06, 0x6f, 0x5b, 0x0c, 0x16, 0x3b, 0x6c, 0xad, + 0x76, 0xd8, 0x5a, 0xef, 0xb0, 0x75, 0x7f, 0x1c, 0x71, 0x1d, 0x4f, 0x47, 0x24, 0x10, 0xa9, 0x67, + 0xf2, 0xee, 0xb7, 0x13, 0x15, 0x4e, 0xbc, 0x2f, 0xdf, 0x64, 0x54, 0x2d, 0x5f, 0xe1, 0xec, 0x3d, + 0x00, 0x00, 0xff, 0xff, 0x0f, 0x77, 0x53, 0x0a, 0x40, 0x02, 0x00, 0x00, } func (m *Plan) Marshal() (dAtA []byte, err error) { From b01185d34cfdec4d09386792434778b5f650613e Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 08:39:02 -0500 Subject: [PATCH 2/8] Merge PR #5699: Bump github.com/rakyll/statik from 0.1.6 to 0.1.7 Bumps [github.com/rakyll/statik](https://github.com/rakyll/statik) from 0.1.6 to 0.1.7. - [Release notes](https://github.com/rakyll/statik/releases) - [Commits](https://github.com/rakyll/statik/compare/v0.1.6...v0.1.7) Signed-off-by: dependabot-preview[bot] --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index ad82af5e2..fab30fd4e 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/mattn/go-isatty v0.0.12 github.com/pelletier/go-toml v1.6.0 github.com/pkg/errors v0.9.1 - github.com/rakyll/statik v0.1.6 + github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.1.1-0.20200213154359-02baa11ea7c2 github.com/spf13/afero v1.2.1 // indirect github.com/spf13/cobra v0.0.6 diff --git a/go.sum b/go.sum index 55185f3f0..1a2e981e9 100644 --- a/go.sum +++ b/go.sum @@ -196,6 +196,8 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs= github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= +github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= +github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/regen-network/cosmos-proto v0.1.1-0.20200213154359-02baa11ea7c2 h1:jQK1YoH972Aptd22YKgtNu5jM2X2xMGkyIENOAc71to= From 201d1cdc34aa655003404ff55d13a570e8a502a8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 08:56:17 -0500 Subject: [PATCH 3/8] Merge PR #5701: Bump github.com/tendermint/tm-db from 0.4.0 to 0.4.1 Bumps [github.com/tendermint/tm-db](https://github.com/tendermint/tm-db) from 0.4.0 to 0.4.1. - [Release notes](https://github.com/tendermint/tm-db/releases) - [Changelog](https://github.com/tendermint/tm-db/blob/master/CHANGELOG.md) - [Commits](https://github.com/tendermint/tm-db/compare/v0.4.0...v0.4.1) Signed-off-by: dependabot-preview[bot] Co-authored-by: Alexander Bezobchuk --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fab30fd4e..1ebba790a 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/tendermint/go-amino v0.15.1 github.com/tendermint/iavl v0.13.0 github.com/tendermint/tendermint v0.33.1 - github.com/tendermint/tm-db v0.4.0 + github.com/tendermint/tm-db v0.4.1 gopkg.in/yaml.v2 v2.2.8 ) diff --git a/go.sum b/go.sum index 1a2e981e9..c4f48196d 100644 --- a/go.sum +++ b/go.sum @@ -257,6 +257,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d h1:gZZadD8H+fF+ github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= github.com/tecbot/gorocksdb v0.0.0-20191017175515-d217d93fd4c5 h1:gVwAW5OwaZlDB5/CfqcGFM9p9C+KxvQKyNOltQ8orj0= github.com/tecbot/gorocksdb v0.0.0-20191017175515-d217d93fd4c5/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= @@ -271,6 +273,8 @@ github.com/tendermint/tendermint v0.33.1 h1:8f68LUBz8yhISZvaLFP4siXXrLWsWeoYfelb github.com/tendermint/tendermint v0.33.1/go.mod h1:fBOKyrlXOETqQ+heL8x/TZgSdmItON54csyabvktBp0= github.com/tendermint/tm-db v0.4.0 h1:iPbCcLbf4nwDFhS39Zo1lpdS1X/cT9CkTlUx17FHQgA= github.com/tendermint/tm-db v0.4.0/go.mod h1:+Cwhgowrf7NBGXmsqFMbwEtbo80XmyrlY5Jsk95JubQ= +github.com/tendermint/tm-db v0.4.1 h1:TvX7JWjJOVZ+N3y+I86wddrGttOdMmmBxXcu0/Y7ZJ0= +github.com/tendermint/tm-db v0.4.1/go.mod h1:JsJ6qzYkCGiGwm5GHl/H5GLI9XLb6qZX7PRe425dHAY= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= From 8cab43c8120fec5200c3459cbf4a92017bb6f287 Mon Sep 17 00:00:00 2001 From: Alexander Bezobchuk Date: Wed, 26 Feb 2020 10:33:56 -0500 Subject: [PATCH 4/8] Merge PR #5702: Add Param Querying to x/auth --- CHANGELOG.md | 5 ++-- simapp/codec/msgs.go | 8 +++--- x/auth/alias.go | 1 + x/auth/client/cli/query.go | 36 +++++++++++++++++++++++++- x/auth/client/rest/query.go | 19 ++++++++++++++ x/auth/client/rest/rest.go | 12 ++++++++- x/auth/keeper/querier.go | 27 ++++++++++++++----- x/auth/types/account_retriever_test.go | 9 ++++--- x/auth/types/keys.go | 4 +-- x/auth/types/querier.go | 1 + x/evidence/handler_test.go | 13 ++++++++-- x/evidence/types/msgs_test.go | 11 ++++++-- 12 files changed, 124 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e9979d32..1c3a38ae1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,8 +41,8 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (modules) [\#5572](https://github.com/cosmos/cosmos-sdk/pull/5572) The `/bank/balances/{address}` endpoint now returns all account balances or a single balance by denom when the `denom` query parameter is present. -* (client) [\#5640](https://github.com/cosmos/cosmos-sdk/pull/5640) The rest server endpoint `/swagger-ui/` is replaced by -´/´. +* (client) [\#5640](https://github.com/cosmos/cosmos-sdk/pull/5640) The rest server endpoint `/swagger-ui/` is replaced by ´/´. +* (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) The `x/auth` querier route has changed from `"acc"` to `"auth"`. ### API Breaking Changes @@ -133,6 +133,7 @@ Buffers for state serialization instead of Amino. ### Improvements +* (x/auth) [\#5702](https://github.com/cosmos/cosmos-sdk/pull/5702) Add parameter querying support for `x/auth`. * (types) [\#5581](https://github.com/cosmos/cosmos-sdk/pull/5581) Add convenience functions {,Must}Bech32ifyAddressBytes. * (staking) [\#5584](https://github.com/cosmos/cosmos-sdk/pull/5584) Add util function `ToTmValidator` that converts a `staking.Validator` type to `*tmtypes.Validator`. * (client) [\#5585](https://github.com/cosmos/cosmos-sdk/pull/5585) IBC additions: diff --git a/simapp/codec/msgs.go b/simapp/codec/msgs.go index d6390261b..2ea6c3a3a 100644 --- a/simapp/codec/msgs.go +++ b/simapp/codec/msgs.go @@ -10,11 +10,13 @@ import ( var _ eviexported.MsgSubmitEvidence = MsgSubmitEvidence{} // NewMsgSubmitEvidence returns a new MsgSubmitEvidence. -func NewMsgSubmitEvidence(evidenceI eviexported.Evidence, s sdk.AccAddress) MsgSubmitEvidence { +func NewMsgSubmitEvidence(evidenceI eviexported.Evidence, s sdk.AccAddress) (MsgSubmitEvidence, error) { e := &Evidence{} - e.SetEvidence(evidenceI) + if err := e.SetEvidence(evidenceI); err != nil { + return MsgSubmitEvidence{}, err + } - return MsgSubmitEvidence{Evidence: e, MsgSubmitEvidenceBase: evidence.NewMsgSubmitEvidenceBase(s)} + return MsgSubmitEvidence{Evidence: e, MsgSubmitEvidenceBase: evidence.NewMsgSubmitEvidenceBase(s)}, nil } // ValidateBasic performs basic (non-state-dependant) validation on a diff --git a/x/auth/alias.go b/x/auth/alias.go index b5d551635..6c242caf5 100644 --- a/x/auth/alias.go +++ b/x/auth/alias.go @@ -21,6 +21,7 @@ const ( DefaultSigVerifyCostED25519 = types.DefaultSigVerifyCostED25519 DefaultSigVerifyCostSecp256k1 = types.DefaultSigVerifyCostSecp256k1 QueryAccount = types.QueryAccount + QueryParams = types.QueryParams ) var ( diff --git a/x/auth/client/cli/query.go b/x/auth/client/cli/query.go index ebb5f3f50..0ef0a46e9 100644 --- a/x/auth/client/cli/query.go +++ b/x/auth/client/cli/query.go @@ -36,11 +36,45 @@ func GetQueryCmd(cdc *codec.Codec) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(GetAccountCmd(cdc)) + cmd.AddCommand( + flags.GetCommands( + GetAccountCmd(cdc), + QueryParamsCmd(cdc), + )..., + ) return cmd } +// QueryParamsCmd returns the command handler for evidence parameter querying. +func QueryParamsCmd(cdc *codec.Codec) *cobra.Command { + return &cobra.Command{ + Use: "params", + Short: "Query the current auth parameters", + Args: cobra.NoArgs, + Long: strings.TrimSpace(`Query the current auth parameters: + +$ query auth params +`), + RunE: func(cmd *cobra.Command, args []string) error { + cliCtx := context.NewCLIContext().WithCodec(cdc) + + route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParams) + res, _, err := cliCtx.QueryWithData(route, nil) + if err != nil { + return err + } + + var params types.Params + if err := cdc.UnmarshalJSON(res, ¶ms); err != nil { + return fmt.Errorf("failed to unmarshal params: %w", err) + } + + return cliCtx.PrintOutput(params) + }, + } +} + // GetAccountCmd returns a query account that will display the state of the // account at a given address. func GetAccountCmd(cdc *codec.Codec) *cobra.Command { diff --git a/x/auth/client/rest/query.go b/x/auth/client/rest/query.go index 6f245e40a..8ff7f567d 100644 --- a/x/auth/client/rest/query.go +++ b/x/auth/client/rest/query.go @@ -138,3 +138,22 @@ func QueryTxRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc { rest.PostProcessResponseBare(w, cliCtx, output) } } + +func queryParamsHandler(cliCtx context.CLIContext) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r) + if !ok { + return + } + + route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryParams) + res, height, err := cliCtx.QueryWithData(route, nil) + if err != nil { + rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error()) + return + } + + cliCtx = cliCtx.WithHeight(height) + rest.PostProcessResponse(w, cliCtx, res) + } +} diff --git a/x/auth/client/rest/rest.go b/x/auth/client/rest/rest.go index 98dc81341..e69388dc4 100644 --- a/x/auth/client/rest/rest.go +++ b/x/auth/client/rest/rest.go @@ -6,11 +6,21 @@ import ( "github.com/cosmos/cosmos-sdk/client/context" ) +// REST query and parameter values +const ( + MethodGet = "GET" +) + // RegisterRoutes registers the auth module REST routes. func RegisterRoutes(cliCtx context.CLIContext, r *mux.Router, storeName string) { r.HandleFunc( "/auth/accounts/{address}", QueryAccountRequestHandlerFn(storeName, cliCtx), - ).Methods("GET") + ).Methods(MethodGet) + + r.HandleFunc( + "/auth/params", + queryParamsHandler(cliCtx), + ).Methods(MethodGet) } // RegisterTxRoutes registers all transaction routes on the provided router. diff --git a/x/auth/keeper/querier.go b/x/auth/keeper/querier.go index 28e505970..eab5d3afc 100644 --- a/x/auth/keeper/querier.go +++ b/x/auth/keeper/querier.go @@ -10,32 +10,47 @@ import ( ) // NewQuerier creates a querier for auth REST endpoints -func NewQuerier(keeper AccountKeeper) sdk.Querier { +func NewQuerier(k AccountKeeper) sdk.Querier { return func(ctx sdk.Context, path []string, req abci.RequestQuery) ([]byte, error) { switch path[0] { case types.QueryAccount: - return queryAccount(ctx, req, keeper) + return queryAccount(ctx, req, k) + + case types.QueryParams: + return queryParams(ctx, k) + default: return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown query path: %s", path[0]) } } } -func queryAccount(ctx sdk.Context, req abci.RequestQuery, keeper AccountKeeper) ([]byte, error) { +func queryAccount(ctx sdk.Context, req abci.RequestQuery, k AccountKeeper) ([]byte, error) { var params types.QueryAccountParams - if err := keeper.cdc.UnmarshalJSON(req.Data, ¶ms); err != nil { + if err := k.cdc.UnmarshalJSON(req.Data, ¶ms); err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - account := keeper.GetAccount(ctx, params.Address) + account := k.GetAccount(ctx, params.Address) if account == nil { return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "account %s does not exist", params.Address) } - bz, err := codec.MarshalJSONIndent(keeper.cdc, account) + bz, err := codec.MarshalJSONIndent(k.cdc, account) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) } return bz, nil } + +func queryParams(ctx sdk.Context, k AccountKeeper) ([]byte, error) { + params := k.GetParams(ctx) + + res, err := codec.MarshalJSONIndent(k.cdc, params) + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrJSONMarshal, err.Error()) + } + + return res, nil +} diff --git a/x/auth/types/account_retriever_test.go b/x/auth/types/account_retriever_test.go index 0481e00b2..99310d117 100644 --- a/x/auth/types/account_retriever_test.go +++ b/x/auth/types/account_retriever_test.go @@ -2,6 +2,7 @@ package types_test import ( "errors" + "fmt" "testing" "github.com/golang/mock/gomock" @@ -23,19 +24,21 @@ func TestAccountRetriever(t *testing.T) { bs, err := appCodec.MarshalJSON(types.NewQueryAccountParams(addr)) require.NoError(t, err) - mockNodeQuerier.EXPECT().QueryWithData(gomock.Eq("custom/acc/account"), + route := fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryAccount) + + mockNodeQuerier.EXPECT().QueryWithData(gomock.Eq(route), gomock.Eq(bs)).Return(nil, int64(0), errFoo).Times(1) _, err = accRetr.GetAccount(addr) require.Error(t, err) - mockNodeQuerier.EXPECT().QueryWithData(gomock.Eq("custom/acc/account"), + mockNodeQuerier.EXPECT().QueryWithData(gomock.Eq(route), gomock.Eq(bs)).Return(nil, int64(0), errFoo).Times(1) n, s, err := accRetr.GetAccountNumberSequence(addr) require.Error(t, err) require.Equal(t, uint64(0), n) require.Equal(t, uint64(0), s) - mockNodeQuerier.EXPECT().QueryWithData(gomock.Eq("custom/acc/account"), + mockNodeQuerier.EXPECT().QueryWithData(gomock.Eq(route), gomock.Eq(bs)).Return(nil, int64(0), errFoo).Times(1) require.Error(t, accRetr.EnsureExists(addr)) } diff --git a/x/auth/types/keys.go b/x/auth/types/keys.go index 149fe2ba5..4cb2538f2 100644 --- a/x/auth/types/keys.go +++ b/x/auth/types/keys.go @@ -14,8 +14,8 @@ const ( // FeeCollectorName the root string for the fee collector account address FeeCollectorName = "fee_collector" - // QuerierRoute is the querier route for acc - QuerierRoute = StoreKey + // QuerierRoute is the querier route for auth + QuerierRoute = ModuleName ) var ( diff --git a/x/auth/types/querier.go b/x/auth/types/querier.go index 84a80b141..35a7e0ccf 100644 --- a/x/auth/types/querier.go +++ b/x/auth/types/querier.go @@ -7,6 +7,7 @@ import ( // query endpoints supported by the auth Querier const ( QueryAccount = "account" + QueryParams = "params" ) // QueryAccountParams defines the params for querying accounts. diff --git a/x/evidence/handler_test.go b/x/evidence/handler_test.go index 2d766e9d8..60e883364 100644 --- a/x/evidence/handler_test.go +++ b/x/evidence/handler_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/ed25519" @@ -24,6 +25,12 @@ type HandlerTestSuite struct { app *simapp.SimApp } +func testMsgSubmitEvidence(r *require.Assertions, e exported.Evidence, s sdk.AccAddress) simappcodec.MsgSubmitEvidence { + msg, err := simappcodec.NewMsgSubmitEvidence(e, s) + r.NoError(err) + return msg +} + func testEquivocationHandler(k interface{}) types.Handler { return func(ctx sdk.Context, e exported.Evidence) error { if err := e.ValidateBasic(); err != nil { @@ -70,7 +77,8 @@ func (suite *HandlerTestSuite) TestMsgSubmitEvidence() { expectErr bool }{ { - simappcodec.NewMsgSubmitEvidence( + testMsgSubmitEvidence( + suite.Require(), &types.Equivocation{ Height: 11, Time: time.Now().UTC(), @@ -82,7 +90,8 @@ func (suite *HandlerTestSuite) TestMsgSubmitEvidence() { false, }, { - simappcodec.NewMsgSubmitEvidence( + testMsgSubmitEvidence( + suite.Require(), &types.Equivocation{ Height: 10, Time: time.Now().UTC(), diff --git a/x/evidence/types/msgs_test.go b/x/evidence/types/msgs_test.go index 304f49efb..127df2535 100644 --- a/x/evidence/types/msgs_test.go +++ b/x/evidence/types/msgs_test.go @@ -6,12 +6,19 @@ import ( simappcodec "github.com/cosmos/cosmos-sdk/simapp/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/evidence/exported" "github.com/cosmos/cosmos-sdk/x/evidence/types" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/ed25519" ) +func testMsgSubmitEvidence(t *testing.T, e exported.Evidence, s sdk.AccAddress) simappcodec.MsgSubmitEvidence { + msg, err := simappcodec.NewMsgSubmitEvidence(e, s) + require.NoError(t, err) + return msg +} + func TestMsgSubmitEvidence(t *testing.T) { pk := ed25519.GenPrivKey() submitter := sdk.AccAddress("test") @@ -27,7 +34,7 @@ func TestMsgSubmitEvidence(t *testing.T) { false, }, { - simappcodec.NewMsgSubmitEvidence(&types.Equivocation{ + testMsgSubmitEvidence(t, &types.Equivocation{ Height: 0, Power: 100, Time: time.Now().UTC(), @@ -37,7 +44,7 @@ func TestMsgSubmitEvidence(t *testing.T) { true, }, { - simappcodec.NewMsgSubmitEvidence(&types.Equivocation{ + testMsgSubmitEvidence(t, &types.Equivocation{ Height: 10, Power: 100, Time: time.Now().UTC(), From 56104c2961766b1d908e82ef7f42ebd041583a8c Mon Sep 17 00:00:00 2001 From: Aaron Craelius Date: Wed, 26 Feb 2020 10:58:27 -0500 Subject: [PATCH 5/8] Merge PR #5703: Fix typo in distribution proto package name --- x/distribution/types/types.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/distribution/types/types.proto b/x/distribution/types/types.proto index a783be13f..aade33d9d 100644 --- a/x/distribution/types/types.proto +++ b/x/distribution/types/types.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package cosmos_sdk.x.ditribution.v1; +package cosmos_sdk.x.distribution.v1; option go_package = "types"; option (gogoproto.equal_all) = true; From 2b75f506044665e682dbec9138bfac88e51f4079 Mon Sep 17 00:00:00 2001 From: Anthony Date: Thu, 27 Feb 2020 14:37:16 +0700 Subject: [PATCH 6/8] Merge PR #5708: fix type for the event documentation --- docs/core/events.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/events.md b/docs/core/events.md index 359e2b94a..d5ac5893f 100644 --- a/docs/core/events.md +++ b/docs/core/events.md @@ -16,7 +16,7 @@ various messages and index transactions." Events are implemented in the Cosmos SDK as an alias of the ABCI `Event` type and take the form of: `{eventType}.{eventAttribute}={value}`. -+++ https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/abci/types/types.pb.go#L2661-L2667 ++++ https://github.com/tendermint/tendermint/blob/bc572217c07b90ad9cee851f193aaa8e9557cbc7/abci/types/types.pb.go#L2187-L2193 Events contain: From 8227d9e376e0bbedb2a3d3f3933e012cbe3cf709 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2020 23:47:05 -0800 Subject: [PATCH 7/8] Bump github.com/golang/protobuf from 1.3.3 to 1.3.4 (#5707) Bumps [github.com/golang/protobuf](https://github.com/golang/protobuf) from 1.3.3 to 1.3.4. - [Release notes](https://github.com/golang/protobuf/releases) - [Commits](https://github.com/golang/protobuf/compare/v1.3.3...v1.3.4) Signed-off-by: dependabot-preview[bot] Co-authored-by: Alexander Bezobchuk --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 1ebba790a..d9debb5a7 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/cosmos/ledger-cosmos-go v0.11.1 github.com/gogo/protobuf v1.3.1 github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 - github.com/golang/protobuf v1.3.3 + github.com/golang/protobuf v1.3.4 github.com/gorilla/handlers v1.4.2 github.com/gorilla/mux v1.7.4 github.com/hashicorp/golang-lru v0.5.4 diff --git a/go.sum b/go.sum index c4f48196d..7eeaf9655 100644 --- a/go.sum +++ b/go.sum @@ -95,6 +95,8 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= From 5a2e59ebb23d1d23546f1145d8814a457655935a Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Thu, 27 Feb 2020 10:53:22 +0000 Subject: [PATCH 8/8] Exclude proto files from format (#5706) * Don't change proto files on make format The format target does not need to depend on tools. Thus remove dependency. * Run make format Co-authored-by: Alexander Bezobchuk --- Makefile | 8 ++++---- client/cmd_test.go | 6 +++--- codec/amino_codec_test.go | 5 +++-- codec/hybrid_codec_test.go | 3 ++- codec/proto_codec_test.go | 3 ++- types/address_bench_test.go | 3 ++- types/decimal_test.go | 3 ++- x/bank/client/rest/rest.go | 3 ++- x/bank/types/key_test.go | 3 ++- x/params/keeper/common_test.go | 7 ++++--- x/params/keeper/keeper_test.go | 3 ++- x/params/types/table_test.go | 3 ++- x/staking/types/commission.go | 3 ++- x/staking/types/delegation.go | 3 ++- x/staking/types/params.go | 3 ++- x/upgrade/client/cli/query.go | 1 + x/upgrade/keeper/keeper.go | 1 + x/upgrade/keeper/querier.go | 1 + 18 files changed, 39 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 96f04d16a..68d7a359a 100644 --- a/Makefile +++ b/Makefile @@ -191,10 +191,10 @@ lint: go mod verify .PHONY: lint -format: tools - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w - find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/cosmos/cosmos-sdk +format: + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -name '*.pb.go' | xargs gofmt -w -s + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -name '*.pb.go' | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk .PHONY: format ############################################################################### diff --git a/client/cmd_test.go b/client/cmd_test.go index 675cc296a..554d39953 100644 --- a/client/cmd_test.go +++ b/client/cmd_test.go @@ -37,10 +37,10 @@ func TestValidateCmd(t *testing.T) { args []string wantErr bool }{ - {"misspelled command", []string{"comission"}, true}, // nolint: misspell + {"misspelled command", []string{"commission"}, true}, // nolint: misspell {"no command provided", []string{}, false}, - {"help flag", []string{"comission", "--help"}, false}, // nolint: misspell - {"shorthand help flag", []string{"comission", "-h"}, false}, // nolint: misspell + {"help flag", []string{"commission", "--help"}, false}, // nolint: misspell + {"shorthand help flag", []string{"commission", "-h"}, false}, // nolint: misspell } for _, tt := range tests { diff --git a/codec/amino_codec_test.go b/codec/amino_codec_test.go index 31eeb413e..3836b22d3 100644 --- a/codec/amino_codec_test.go +++ b/codec/amino_codec_test.go @@ -3,10 +3,11 @@ package codec_test import ( "testing" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/testdata" "github.com/stretchr/testify/require" amino "github.com/tendermint/go-amino" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/testdata" ) func createTestCodec() *amino.Codec { diff --git a/codec/hybrid_codec_test.go b/codec/hybrid_codec_test.go index 353f0c389..911ae8c9d 100644 --- a/codec/hybrid_codec_test.go +++ b/codec/hybrid_codec_test.go @@ -3,9 +3,10 @@ package codec_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testdata" - "github.com/stretchr/testify/require" ) func TestHybridCodec(t *testing.T) { diff --git a/codec/proto_codec_test.go b/codec/proto_codec_test.go index c49544e06..aae71b4df 100644 --- a/codec/proto_codec_test.go +++ b/codec/proto_codec_test.go @@ -3,9 +3,10 @@ package codec_test import ( "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec/testdata" - "github.com/stretchr/testify/require" ) func TestProtoCodec(t *testing.T) { diff --git a/types/address_bench_test.go b/types/address_bench_test.go index 8e438a81d..1bb0d15f6 100644 --- a/types/address_bench_test.go +++ b/types/address_bench_test.go @@ -5,9 +5,10 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/types" + "github.com/tendermint/tendermint/crypto/ed25519" ) diff --git a/types/decimal_test.go b/types/decimal_test.go index c56d303ee..33ca99d49 100644 --- a/types/decimal_test.go +++ b/types/decimal_test.go @@ -6,10 +6,11 @@ import ( "math/big" "testing" - "github.com/cosmos/cosmos-sdk/codec" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" + + "github.com/cosmos/cosmos-sdk/codec" ) // create a decimal from a decimal string (ex. "1234.5678") diff --git a/x/bank/client/rest/rest.go b/x/bank/client/rest/rest.go index b2b1ff84c..578e41c06 100644 --- a/x/bank/client/rest/rest.go +++ b/x/bank/client/rest/rest.go @@ -1,8 +1,9 @@ package rest import ( - "github.com/cosmos/cosmos-sdk/client/context" "github.com/gorilla/mux" + + "github.com/cosmos/cosmos-sdk/client/context" ) // RegisterRoutes - Central function to define routes that get registered by the main application diff --git a/x/bank/types/key_test.go b/x/bank/types/key_test.go index b1e5a7614..f3b5717fb 100644 --- a/x/bank/types/key_test.go +++ b/x/bank/types/key_test.go @@ -3,9 +3,10 @@ package types_test import ( "testing" + "github.com/stretchr/testify/require" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/stretchr/testify/require" ) func cloneAppend(bz []byte, tail []byte) (res []byte) { diff --git a/x/params/keeper/common_test.go b/x/params/keeper/common_test.go index 92d9f1ee5..c6c151809 100644 --- a/x/params/keeper/common_test.go +++ b/x/params/keeper/common_test.go @@ -1,14 +1,15 @@ package keeper_test import ( + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + dbm "github.com/tendermint/tm-db" + "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" ) func testComponents() (codec.Marshaler, sdk.Context, sdk.StoreKey, sdk.StoreKey, paramskeeper.Keeper) { diff --git a/x/params/keeper/keeper_test.go b/x/params/keeper/keeper_test.go index 0c34558e9..de83f1f34 100644 --- a/x/params/keeper/keeper_test.go +++ b/x/params/keeper/keeper_test.go @@ -4,10 +4,11 @@ import ( "reflect" "testing" + "github.com/stretchr/testify/require" + "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/require" ) func validateNoOp(_ interface{}) error { return nil } diff --git a/x/params/types/table_test.go b/x/params/types/table_test.go index db2c9d321..0baff40f8 100644 --- a/x/params/types/table_test.go +++ b/x/params/types/table_test.go @@ -4,8 +4,9 @@ import ( "testing" "time" - "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/x/params/types" ) func TestKeyTable(t *testing.T) { diff --git a/x/staking/types/commission.go b/x/staking/types/commission.go index 9a58210f6..54891b5dc 100644 --- a/x/staking/types/commission.go +++ b/x/staking/types/commission.go @@ -3,8 +3,9 @@ package types import ( "time" - sdk "github.com/cosmos/cosmos-sdk/types" yaml "gopkg.in/yaml.v2" + + sdk "github.com/cosmos/cosmos-sdk/types" ) // NewCommissionRates returns an initialized validator commission rates. diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index f25aaac7b..51fca1d38 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -6,10 +6,11 @@ import ( "strings" "time" + yaml "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/exported" - yaml "gopkg.in/yaml.v2" ) // Implements Delegation interface diff --git a/x/staking/types/params.go b/x/staking/types/params.go index b738f1b06..8d2b14ec6 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -6,10 +6,11 @@ import ( "strings" "time" + yaml "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - yaml "gopkg.in/yaml.v2" ) // Staking params default values diff --git a/x/upgrade/client/cli/query.go b/x/upgrade/client/cli/query.go index c9022a482..390ed9e5d 100644 --- a/x/upgrade/client/cli/query.go +++ b/x/upgrade/client/cli/query.go @@ -3,6 +3,7 @@ package cli import ( "encoding/binary" "fmt" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/spf13/cobra" diff --git a/x/upgrade/keeper/keeper.go b/x/upgrade/keeper/keeper.go index 03802b335..ba789aeb7 100644 --- a/x/upgrade/keeper/keeper.go +++ b/x/upgrade/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/binary" "fmt" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" "github.com/tendermint/tendermint/libs/log" diff --git a/x/upgrade/keeper/querier.go b/x/upgrade/keeper/querier.go index 2a3ff8bf6..2aebceeac 100644 --- a/x/upgrade/keeper/querier.go +++ b/x/upgrade/keeper/querier.go @@ -2,6 +2,7 @@ package keeper import ( "encoding/binary" + "github.com/cosmos/cosmos-sdk/x/upgrade/types" abci "github.com/tendermint/tendermint/abci/types"