From e109d8afc2c91c5ee5c449452be391f17f6e06ca Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Thu, 1 Jul 2021 20:40:07 +0200 Subject: [PATCH] feat(bank): update bank.Metadata - add URI and URIHash (#9618) ## Description Closes: #9502 --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [x] added `!` to the type prefix if API or client breaking change - [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [x] provided a link to the relevant issue or specification - [x] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [x] included comments for [documenting Go code](https://blog.golang.org/godoc) - [x] updated the relevant documentation or specification - [x] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- CHANGELOG.md | 1 + docs/core/proto-docs.md | 10 +- proto/cosmos/bank/v1beta1/bank.proto | 5 + x/bank/types/bank.pb.go | 185 +++++++++++++++++++++------ 4 files changed, 162 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9611cd353110..33fd7a900901 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Features * [\#9533](https://github.com/cosmos/cosmos-sdk/pull/9533) Added a new gRPC method, `DenomOwners`, in `x/bank` to query for all account holders of a specific denomination. +* (bank) [\#9618](https://github.com/cosmos/cosmos-sdk/pull/9618) Update bank.Metadata: add URI and URIHash attributes. ### API Breaking Changes diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 87e6a2e623bd..0794c8c0f86e 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -1567,6 +1567,8 @@ a basic token. | `display` | [string](#string) | | display indicates the suggested denom that should be displayed in clients. | | `name` | [string](#string) | | name defines the name of the token (eg: Cosmos Atom) | | `symbol` | [string](#string) | | symbol is the token symbol usually shown on exchanges (eg: ATOM). This can be the same as the display. | +| `uri` | [string](#string) | | URI to a document (on or off-chain) that contains additional information. Optional. | +| `uri_hash` | [string](#string) | | URIHash is a sha256 hash of a document pointed by URI. It's used to verify that the document didn't change. Optional. | @@ -1709,16 +1711,21 @@ GenesisState defines the bank module's genesis state. ### DenomOwner - DenomOwner defines structure representing an account that owns or holds a particular denominated token. It contains the account address and account balance of the denominated token. + | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | address defines the address that owns a particular denomination. | | `balance` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | | balance is the balance of the denominated coin for an account. | + + + + + ### QueryAllBalancesRequest @@ -8310,3 +8317,4 @@ still be used for delegating and for governance votes even while locked. | bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | | string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | | bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | + diff --git a/proto/cosmos/bank/v1beta1/bank.proto b/proto/cosmos/bank/v1beta1/bank.proto index eb843b2cb642..ad55835f720f 100644 --- a/proto/cosmos/bank/v1beta1/bank.proto +++ b/proto/cosmos/bank/v1beta1/bank.proto @@ -89,4 +89,9 @@ message Metadata { // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can // be the same as the display. string symbol = 6; + // URI to a document (on or off-chain) that contains additional information. Optional. + string uri = 7 [(gogoproto.customname) = "URI"]; + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + // the document didn't change. Optional. + string uri_hash = 8 [(gogoproto.customname) = "URIHash"]; } diff --git a/x/bank/types/bank.pb.go b/x/bank/types/bank.pb.go index f190a457b28c..ff39b06c539b 100644 --- a/x/bank/types/bank.pb.go +++ b/x/bank/types/bank.pb.go @@ -336,6 +336,11 @@ type Metadata struct { // symbol is the token symbol usually shown on exchanges (eg: ATOM). This can // be the same as the display. Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` + // URI to a document (on or off-chain) that contains additional information. Optional. + URI string `protobuf:"bytes,7,opt,name=uri,proto3" json:"uri,omitempty"` + // URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + // the document didn't change. Optional. + URIHash string `protobuf:"bytes,8,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` } func (m *Metadata) Reset() { *m = Metadata{} } @@ -413,6 +418,20 @@ func (m *Metadata) GetSymbol() string { return "" } +func (m *Metadata) GetURI() string { + if m != nil { + return m.URI + } + return "" +} + +func (m *Metadata) GetURIHash() string { + if m != nil { + return m.URIHash + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "cosmos.bank.v1beta1.Params") proto.RegisterType((*SendEnabled)(nil), "cosmos.bank.v1beta1.SendEnabled") @@ -426,44 +445,48 @@ func init() { func init() { proto.RegisterFile("cosmos/bank/v1beta1/bank.proto", fileDescriptor_dd052eee12edf988) } var fileDescriptor_dd052eee12edf988 = []byte{ - // 592 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xf6, 0x35, 0x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x17, 0x9b, 0x7f, 0xe3, 0xbb, 0x7a, 0xbc, 0xd0, 0x54, 0x7f, - 0x33, 0xb7, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xcc, 0x03, 0xbf, 0xe9, 0xee, 0x04, 0x00, 0x00, + // 642 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x6e, 0x13, 0x4f, + 0x10, 0xf6, 0xc6, 0xb1, 0x7d, 0x59, 0xff, 0x7e, 0xcd, 0x12, 0xa1, 0x4b, 0x24, 0xee, 0xcc, 0x49, + 0x20, 0x07, 0x11, 0x3b, 0x01, 0x0a, 0xe4, 0x06, 0xc9, 0xe1, 0x9f, 0x0b, 0x04, 0xba, 0x28, 0x42, + 0x82, 0xc2, 0xda, 0xf3, 0x6d, 0xec, 0x55, 0xee, 0x76, 0x4f, 0xb7, 0x7b, 0x51, 0xee, 0x0d, 0x10, + 0x05, 0x50, 0x52, 0xa6, 0xa6, 0x85, 0x87, 0x48, 0x19, 0x41, 0x43, 0x65, 0x90, 0xd3, 0x50, 0xe7, + 0x09, 0xd0, 0xee, 0x9e, 0x1d, 0x47, 0x0a, 0x88, 0x82, 0x82, 0xea, 0xe6, 0x9b, 0xf9, 0xe6, 0x9b, + 0xd1, 0xcc, 0xec, 0x41, 0x67, 0xc0, 0x45, 0xcc, 0x45, 0x3b, 0xc0, 0x6c, 0xaf, 0xbd, 0xbf, 0x19, + 0x10, 0x89, 0x37, 0x35, 0x68, 0x25, 0x29, 0x97, 0x1c, 0x5d, 0x32, 0xf1, 0x96, 0x76, 0x15, 0xf1, + 0xd5, 0xe5, 0x21, 0x1f, 0x72, 0x1d, 0x6f, 0x2b, 0xcb, 0x50, 0x57, 0x57, 0x0c, 0xb5, 0x6f, 0x02, + 0x45, 0x9e, 0x09, 0x9d, 0x55, 0x11, 0x64, 0x56, 0x65, 0xc0, 0x29, 0x33,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0xdc, 0x5e, 0x34, 0x97, 0x51, 0x40, 0xc5, + 0x66, 0x38, 0x26, 0x76, 0xc5, 0xb0, 0x95, 0x8d, 0x2e, 0xc3, 0xaa, 0xc8, 0xe3, 0x80, 0x47, 0x76, + 0x55, 0x7b, 0x0b, 0x84, 0x56, 0x60, 0x39, 0x4b, 0xa9, 0x5d, 0x53, 0xce, 0x6e, 0x6d, 0x32, 0x76, + 0xcb, 0x3b, 0x7e, 0xcf, 0x57, 0x3e, 0x74, 0x1d, 0x5a, 0x59, 0x4a, 0xfb, 0x23, 0x2c, 0x46, 0xb6, + 0xa5, 0xe3, 0xf5, 0xc9, 0xd8, 0xad, 0xed, 0xf8, 0xbd, 0xc7, 0x58, 0x8c, 0xfc, 0x5a, 0x96, 0x52, + 0x65, 0x74, 0xb7, 0x8e, 0x26, 0x0e, 0x38, 0x9e, 0x38, 0xe0, 0xfb, 0xc4, 0x01, 0xef, 0x4e, 0x9c, + 0xd2, 0xf1, 0x89, 0x53, 0xfa, 0x7a, 0xe2, 0x94, 0x5e, 0xac, 0xfd, 0xc9, 0xea, 0xf4, 0xfe, 0x83, + 0xaa, 0xfe, 0x53, 0xdd, 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x64, 0xd4, 0xf7, 0x31, 0x05, + 0x00, 0x00, } func (this *SendEnabled) Equal(that interface{}) bool { @@ -798,6 +821,20 @@ func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.URIHash) > 0 { + i -= len(m.URIHash) + copy(dAtA[i:], m.URIHash) + i = encodeVarintBank(dAtA, i, uint64(len(m.URIHash))) + i-- + dAtA[i] = 0x42 + } + if len(m.URI) > 0 { + i -= len(m.URI) + copy(dAtA[i:], m.URI) + i = encodeVarintBank(dAtA, i, uint64(len(m.URI))) + i-- + dAtA[i] = 0x3a + } if len(m.Symbol) > 0 { i -= len(m.Symbol) copy(dAtA[i:], m.Symbol) @@ -1002,6 +1039,14 @@ func (m *Metadata) Size() (n int) { if l > 0 { n += 1 + l + sovBank(uint64(l)) } + l = len(m.URI) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } + l = len(m.URIHash) + if l > 0 { + n += 1 + l + sovBank(uint64(l)) + } return n } @@ -1889,6 +1934,70 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URI", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field URIHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBank + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBank + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBank + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.URIHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipBank(dAtA[iNdEx:])