From ff4a34b5cd16fc7a5509850976487bb33aa8fff1 Mon Sep 17 00:00:00 2001 From: zale144 Date: Wed, 21 Aug 2024 14:11:53 +0200 Subject: [PATCH] fix(rollapp): add `token_symbol` to rollapp metadata (#1118) --- app/upgrades/v4/upgrade.go | 4 + go.mod | 2 +- go.sum | 4 +- .../dymension/rollapp/metadata.proto | 2 + x/rollapp/types/metadata.pb.go | 95 +++++++++++++++---- x/sequencer/types/query.pb.go | 7 +- x/sequencer/types/sequencer.pb.go | 3 +- 7 files changed, 89 insertions(+), 28 deletions(-) diff --git a/app/upgrades/v4/upgrade.go b/app/upgrades/v4/upgrade.go index b95166b22..bb9d5597c 100644 --- a/app/upgrades/v4/upgrade.go +++ b/app/upgrades/v4/upgrade.go @@ -155,6 +155,10 @@ func ConvertOldRollappToNew(oldRollapp rollapptypes.Rollapp) rollapptypes.Rollap TokenLogoDataUri: "", Telegram: "", X: "", + GenesisUrl: "", + DisplayName: "", + Tagline: "", + TokenSymbol: "", }, InitialSequencer: "*", Sealed: true, diff --git a/go.mod b/go.mod index 846b61f7f..33ec916eb 100644 --- a/go.mod +++ b/go.mod @@ -240,7 +240,7 @@ replace ( // use dymension forks github.com/evmos/ethermint => github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20240625101522-b1506ae83050 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - github.com/osmosis-labs/osmosis/osmomath => github.com/dymensionxyz/osmosis/osmomath v0.0.6-dym-v0.0.1 + github.com/osmosis-labs/osmosis/osmomath => github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43 github.com/osmosis-labs/osmosis/v15 => github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20240627111157-f2243f47cdb3 // broken goleveldb diff --git a/go.sum b/go.sum index 8d2390e9e..7e00c383d 100644 --- a/go.sum +++ b/go.sum @@ -504,8 +504,8 @@ github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20240625101522-b150 github.com/dymensionxyz/ethermint v0.22.0-dymension-v0.4.1.0.20240625101522-b1506ae83050/go.mod h1:aokD0im7cUMMtR/khzNsmcGtINtxCpBfcgRvJdmLymA= github.com/dymensionxyz/gerr-cosmos v1.0.0 h1:oi91rgOkpJWr41oX9JOyjvvBnhGY54tj513x8VlDAEc= github.com/dymensionxyz/gerr-cosmos v1.0.0/go.mod h1:n+0olxPogzWqFKba45mCpvrHLGmeS8W9UZjggHnWk6c= -github.com/dymensionxyz/osmosis/osmomath v0.0.6-dym-v0.0.1 h1:59ZE3Ocrn04MUpb5VJgfi24eDcnQ9VBfCSw0Mx1n7OI= -github.com/dymensionxyz/osmosis/osmomath v0.0.6-dym-v0.0.1/go.mod h1:2idySYJxP5YfMAEeSeqD8e7fSchfsI4jn7XFHJgNUsM= +github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43 h1:EskhZ6ILN3vwJ6l8gPWPZ49RFSB52WghT5v+pmzrNCI= +github.com/dymensionxyz/osmosis/osmomath v0.0.6-dymension-v0.1.0.20240820121212-c0e21fa21e43/go.mod h1:SdGCL9CZb14twRAJUSzb7bRE0OoopRpF2Hnd1UhJpFU= github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20240627111157-f2243f47cdb3 h1:4VD23Jv5d8hqXEhLNNcLXlpSDJCWAGYJLF0kisJtkIk= github.com/dymensionxyz/osmosis/v15 v15.2.1-0.20240627111157-f2243f47cdb3/go.mod h1:2rsnXAdjYfXtyEw0mNwAdOiAccALYjAPvINGUf9Qg7Y= github.com/dymensionxyz/sdk-utils v0.2.7 h1:9Hy56ivv81ISIG7x9AMaNo6GABRuEgZQ+MmS2PdfuW0= diff --git a/proto/dymensionxyz/dymension/rollapp/metadata.proto b/proto/dymensionxyz/dymension/rollapp/metadata.proto index f433d4742..fc4619889 100644 --- a/proto/dymensionxyz/dymension/rollapp/metadata.proto +++ b/proto/dymensionxyz/dymension/rollapp/metadata.proto @@ -22,4 +22,6 @@ message RollappMetadata { string display_name = 8; // tagline is a non semantic tagline/catch-phrase. Size limited. string tagline = 9; + // token_symbol is the native token symbol + string token_symbol = 10; } diff --git a/x/rollapp/types/metadata.pb.go b/x/rollapp/types/metadata.pb.go index 5b2e4abe7..7fdf438f5 100644 --- a/x/rollapp/types/metadata.pb.go +++ b/x/rollapp/types/metadata.pb.go @@ -41,6 +41,8 @@ type RollappMetadata struct { DisplayName string `protobuf:"bytes,8,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // tagline is a non semantic tagline/catch-phrase. Size limited. Tagline string `protobuf:"bytes,9,opt,name=tagline,proto3" json:"tagline,omitempty"` + // token_symbol is the native token symbol + TokenSymbol string `protobuf:"bytes,10,opt,name=token_symbol,json=tokenSymbol,proto3" json:"token_symbol,omitempty"` } func (m *RollappMetadata) Reset() { *m = RollappMetadata{} } @@ -139,6 +141,13 @@ func (m *RollappMetadata) GetTagline() string { return "" } +func (m *RollappMetadata) GetTokenSymbol() string { + if m != nil { + return m.TokenSymbol + } + return "" +} + func init() { proto.RegisterType((*RollappMetadata)(nil), "dymensionxyz.dymension.rollapp.RollappMetadata") } @@ -148,27 +157,28 @@ func init() { } var fileDescriptor_481e8ecd49e74695 = []byte{ - // 314 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xbd, 0x4e, 0xf3, 0x30, - 0x18, 0x85, 0xeb, 0x7e, 0x1f, 0xfd, 0x71, 0x8b, 0x40, 0x66, 0xb1, 0x18, 0x4c, 0xe9, 0xc4, 0xd2, - 0x64, 0x28, 0x57, 0x80, 0x18, 0xa1, 0x43, 0xa5, 0x2e, 0x2c, 0x91, 0xdb, 0xbc, 0x0a, 0x16, 0x8e, - 0x6d, 0xd9, 0x2e, 0x24, 0x5c, 0x05, 0x97, 0xc1, 0xa5, 0x30, 0x76, 0x64, 0x44, 0xed, 0x8d, 0xa0, - 0x3a, 0x21, 0x2a, 0x03, 0x5b, 0xce, 0xf3, 0x3e, 0xb1, 0x74, 0x74, 0xf0, 0x24, 0x2d, 0x73, 0x50, - 0x4e, 0x68, 0x55, 0x94, 0xaf, 0x71, 0x13, 0x62, 0xab, 0xa5, 0xe4, 0xc6, 0xc4, 0x39, 0x78, 0x9e, - 0x72, 0xcf, 0x23, 0x63, 0xb5, 0xd7, 0x84, 0x1d, 0xea, 0x51, 0x13, 0xa2, 0x5a, 0x1f, 0xbf, 0xb7, - 0xf1, 0xc9, 0xbc, 0xfa, 0xbe, 0xaf, 0xff, 0x24, 0x14, 0x77, 0x5f, 0x60, 0xe9, 0x84, 0x07, 0x8a, - 0x46, 0xe8, 0xaa, 0x3f, 0xff, 0x89, 0x64, 0x84, 0x07, 0x29, 0xb8, 0x95, 0x15, 0xc6, 0x0b, 0xad, - 0x68, 0x3b, 0x5c, 0x0f, 0x11, 0x19, 0xe3, 0x63, 0xa9, 0x33, 0x9d, 0xec, 0x1f, 0x4a, 0xd6, 0x56, - 0xd0, 0x7f, 0x95, 0xb3, 0x87, 0xb7, 0xdc, 0xf3, 0x85, 0x15, 0x64, 0x82, 0xcf, 0xbc, 0x7e, 0x02, - 0x95, 0xfc, 0x36, 0xff, 0x07, 0xf3, 0x34, 0x9c, 0xee, 0x0e, 0xf4, 0x73, 0xdc, 0xf3, 0x20, 0x21, - 0xb3, 0x3c, 0xa7, 0x47, 0xc1, 0x69, 0x32, 0x19, 0x62, 0x54, 0xd0, 0x4e, 0x80, 0xa8, 0x20, 0x17, - 0x78, 0x90, 0x81, 0x02, 0x27, 0x5c, 0xb2, 0xb6, 0x92, 0x76, 0x03, 0xc7, 0x35, 0x5a, 0x58, 0x49, - 0x2e, 0xf1, 0x30, 0x15, 0xce, 0x48, 0x5e, 0x26, 0x8a, 0xe7, 0x40, 0x7b, 0x75, 0x81, 0x8a, 0xcd, - 0x78, 0x0e, 0xfb, 0xf2, 0x9e, 0x67, 0x52, 0x28, 0xa0, 0xfd, 0xaa, 0x7c, 0x1d, 0x6f, 0x66, 0x1f, - 0x5b, 0x86, 0x36, 0x5b, 0x86, 0xbe, 0xb6, 0x0c, 0xbd, 0xed, 0x58, 0x6b, 0xb3, 0x63, 0xad, 0xcf, - 0x1d, 0x6b, 0x3d, 0x5c, 0x67, 0xc2, 0x3f, 0xae, 0x97, 0xd1, 0x4a, 0xe7, 0xf1, 0x1f, 0xf3, 0x3c, - 0x4f, 0xe3, 0xa2, 0xd9, 0xc8, 0x97, 0x06, 0xdc, 0xb2, 0x13, 0x16, 0x9a, 0x7e, 0x07, 0x00, 0x00, - 0xff, 0xff, 0x57, 0xc6, 0x9c, 0x00, 0xd2, 0x01, 0x00, 0x00, + // 329 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xbd, 0x4e, 0xeb, 0x30, + 0x14, 0xc7, 0x9b, 0xde, 0x7b, 0xfb, 0xe1, 0xf6, 0x0a, 0x64, 0x16, 0x8b, 0xc1, 0x94, 0x4e, 0x2c, + 0x4d, 0x86, 0xf2, 0x04, 0x88, 0x11, 0x3a, 0x14, 0x75, 0x61, 0x89, 0x9c, 0xe6, 0x28, 0x58, 0xf8, + 0x23, 0xb2, 0x5d, 0x48, 0x78, 0x0a, 0x1e, 0x0b, 0x89, 0xa5, 0x23, 0x23, 0x6a, 0x5f, 0x04, 0xc5, + 0x09, 0x51, 0x19, 0xd8, 0xf2, 0xff, 0x9d, 0xdf, 0x89, 0x7c, 0xf4, 0x47, 0xb3, 0xb4, 0x94, 0xa0, + 0x2c, 0xd7, 0xaa, 0x28, 0x5f, 0xa2, 0x36, 0x44, 0x46, 0x0b, 0xc1, 0xf2, 0x3c, 0x92, 0xe0, 0x58, + 0xca, 0x1c, 0x0b, 0x73, 0xa3, 0x9d, 0xc6, 0xf4, 0x50, 0x0f, 0xdb, 0x10, 0x36, 0xfa, 0xf4, 0x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 0xdd, 0xc3, 0x26, 0x09, 0xd7, 0x5a, 0x46, 0xbf, 0x34, 0xf8, 0x34, + 0x8f, 0x8a, 0xb6, 0x46, 0x57, 0xe6, 0x60, 0x93, 0x9e, 0x2f, 0x71, 0xfe, 0x15, 0x00, 0x00, 0xff, + 0xff, 0x6b, 0x38, 0x45, 0x1a, 0xf5, 0x01, 0x00, 0x00, } func (m *RollappMetadata) Marshal() (dAtA []byte, err error) { @@ -191,6 +201,13 @@ func (m *RollappMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.TokenSymbol) > 0 { + i -= len(m.TokenSymbol) + copy(dAtA[i:], m.TokenSymbol) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.TokenSymbol))) + i-- + dAtA[i] = 0x52 + } if len(m.Tagline) > 0 { i -= len(m.Tagline) copy(dAtA[i:], m.Tagline) @@ -310,6 +327,10 @@ func (m *RollappMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovMetadata(uint64(l)) } + l = len(m.TokenSymbol) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } return n } @@ -636,6 +657,38 @@ func (m *RollappMetadata) Unmarshal(dAtA []byte) error { } m.Tagline = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TokenSymbol", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + 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 ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TokenSymbol = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMetadata(dAtA[iNdEx:]) diff --git a/x/sequencer/types/query.pb.go b/x/sequencer/types/query.pb.go index f40a83e85..0a814bfc4 100644 --- a/x/sequencer/types/query.pb.go +++ b/x/sequencer/types/query.pb.go @@ -626,8 +626,11 @@ func (m *QueryGetNextProposerByRollappRequest) GetRollappId() string { // Response type for the GetNextProposerByRollapp RPC method. type QueryGetNextProposerByRollappResponse struct { - NextProposerAddr string `protobuf:"bytes,1,opt,name=nextProposerAddr,proto3" json:"nextProposerAddr,omitempty"` - RotationInProgress bool `protobuf:"varint,2,opt,name=rotationInProgress,proto3" json:"rotationInProgress,omitempty"` + // nextProposerAddr is the address of the next proposer. + // can be empty if no sequencer is available to be the next proposer. + NextProposerAddr string `protobuf:"bytes,1,opt,name=nextProposerAddr,proto3" json:"nextProposerAddr,omitempty"` + // rotationInProgress is true if the proposer rotation is in progress. + RotationInProgress bool `protobuf:"varint,2,opt,name=rotationInProgress,proto3" json:"rotationInProgress,omitempty"` } func (m *QueryGetNextProposerByRollappResponse) Reset() { *m = QueryGetNextProposerByRollappResponse{} } diff --git a/x/sequencer/types/sequencer.pb.go b/x/sequencer/types/sequencer.pb.go index b2f4cb8fb..7ef7aecf6 100644 --- a/x/sequencer/types/sequencer.pb.go +++ b/x/sequencer/types/sequencer.pb.go @@ -53,8 +53,7 @@ type Sequencer struct { // unbond_request_height stores the height at which this sequencer has // requested to unbond. UnbondRequestHeight int64 `protobuf:"varint,9,opt,name=unbond_request_height,json=unbondRequestHeight,proto3" json:"unbond_request_height,omitempty"` - // unbond_time defines, if unbonding, the min time for the sequencer to - // complete unbonding. + // unbond_time defines the time when the sequencer will complete unbonding. UnbondTime time.Time `protobuf:"bytes,10,opt,name=unbond_time,json=unbondTime,proto3,stdtime" json:"unbond_time"` // notice_period_time defines the time when the sequencer will finish it's notice period if started NoticePeriodTime time.Time `protobuf:"bytes,11,opt,name=notice_period_time,json=noticePeriodTime,proto3,stdtime" json:"notice_period_time"`