From 760cbde06acdb676e0be0fea56fb6968c3e2bb08 Mon Sep 17 00:00:00 2001 From: yuandu Date: Mon, 24 Jul 2023 17:18:16 +0800 Subject: [PATCH] proto: rename field --- modules/side-chain/keeper/genesis.go | 2 +- modules/side-chain/keeper/space.go | 4 +- modules/side-chain/types/genesis.go | 6 +-- modules/side-chain/types/side-chain.pb.go | 64 +++++++++++------------ proto/side-chain/v1/side-chain.proto | 2 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/modules/side-chain/keeper/genesis.go b/modules/side-chain/keeper/genesis.go index f8cf4724..569ec92b 100644 --- a/modules/side-chain/keeper/genesis.go +++ b/modules/side-chain/keeper/genesis.go @@ -23,7 +23,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { } for _, spaceLatestHeight := range data.SpaceLatestHeights { - k.setSpaceLatestHeight(ctx, spaceLatestHeight.Id, spaceLatestHeight.Height) + k.setSpaceLatestHeight(ctx, spaceLatestHeight.SpaceId, spaceLatestHeight.Height) } } diff --git a/modules/side-chain/keeper/space.go b/modules/side-chain/keeper/space.go index d9e01914..f95e2acf 100644 --- a/modules/side-chain/keeper/space.go +++ b/modules/side-chain/keeper/space.go @@ -243,8 +243,8 @@ func (k Keeper) GetSpaceLatestHeights(ctx sdk.Context) []types.SpaceLatestHeight } latestHeight := sdk.BigEndianToUint64(iterator.Value()) latestHeights = append(latestHeights, types.SpaceLatestHeight{ - Id: spaceId, - Height: latestHeight, + SpaceId: spaceId, + Height: latestHeight, }) } return latestHeights diff --git a/modules/side-chain/types/genesis.go b/modules/side-chain/types/genesis.go index 1025b979..d019d3e0 100644 --- a/modules/side-chain/types/genesis.go +++ b/modules/side-chain/types/genesis.go @@ -67,11 +67,11 @@ func ValidateGenesis(data GenesisState) error { // validate SpaceLatestHeight for _, latestHeight := range data.SpaceLatestHeights { - if !seenSpaceIds[latestHeight.Id] { - return sdkerrors.Wrapf(ErrInvalidSpaceId, "unknown space (%d) during validation", latestHeight.Id) + if !seenSpaceIds[latestHeight.SpaceId] { + return sdkerrors.Wrapf(ErrInvalidSpaceId, "unknown space (%d) during validation", latestHeight.SpaceId) } - seenBlockHeader := fmt.Sprintf("%d-%d", latestHeight.Id, latestHeight.Height) + seenBlockHeader := fmt.Sprintf("%d-%d", latestHeight.SpaceId, latestHeight.Height) if !seenBlockHeaderMap[seenBlockHeader] { return sdkerrors.Wrapf(ErrBlockHeader, "unknown block header (%s) during validation", seenBlockHeader) } diff --git a/modules/side-chain/types/side-chain.pb.go b/modules/side-chain/types/side-chain.pb.go index 5032cfc4..3ef9334c 100644 --- a/modules/side-chain/types/side-chain.pb.go +++ b/modules/side-chain/types/side-chain.pb.go @@ -94,8 +94,8 @@ func (m *Space) GetOwner() string { // SpaceLatestHeight defines the latest height of the side-chain. type SpaceLatestHeight struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + SpaceId uint64 `protobuf:"varint,1,opt,name=space_id,json=spaceId,proto3" json:"space_id,omitempty"` + Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` } func (m *SpaceLatestHeight) Reset() { *m = SpaceLatestHeight{} } @@ -131,9 +131,9 @@ func (m *SpaceLatestHeight) XXX_DiscardUnknown() { var xxx_messageInfo_SpaceLatestHeight proto.InternalMessageInfo -func (m *SpaceLatestHeight) GetId() uint64 { +func (m *SpaceLatestHeight) GetSpaceId() uint64 { if m != nil { - return m.Id + return m.SpaceId } return 0 } @@ -222,27 +222,27 @@ func init() { func init() { proto.RegisterFile("side-chain/v1/side-chain.proto", fileDescriptor_7c92cc5eb9507ffe) } var fileDescriptor_7c92cc5eb9507ffe = []byte{ - // 308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x51, 0x3d, 0x4f, 0xf3, 0x30, - 0x10, 0xae, 0xdb, 0xb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 0x53, 0xfc, 0xcf, 0x54, 0x59, - 0xeb, 0xaf, 0xe6, 0xbe, 0xe3, 0xd7, 0x7f, 0x26, 0xd4, 0x7a, 0xd5, 0xdc, 0x6c, 0xda, 0x30, 0x72, - 0x82, 0xfb, 0x76, 0xb7, 0x56, 0xdc, 0xa8, 0x66, 0xdd, 0x9e, 0xdd, 0x2d, 0xb8, 0x51, 0xf3, 0xdb, - 0xd7, 0x82, 0xa2, 0x7d, 0x41, 0xd1, 0x7b, 0x41, 0xd1, 0x4b, 0x49, 0x5b, 0xfb, 0x92, 0xb6, 0xde, - 0x4a, 0xda, 0xba, 0xbb, 0x8c, 0xc0, 0xaa, 0x3c, 0x98, 0x86, 0x3a, 0x66, 0x01, 0xf0, 0xe4, 0x1e, - 0x24, 0x07, 0xf6, 0x79, 0x61, 0x16, 0x6b, 0x91, 0x6f, 0xa4, 0xf9, 0xf1, 0x04, 0x66, 0x9f, 0x53, - 0x69, 0x82, 0x9e, 0xbb, 0xee, 0xc5, 0x47, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x1b, 0x59, 0x2c, - 0xad, 0x01, 0x00, 0x00, + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xbf, 0x4e, 0xc3, 0x30, + 0x10, 0xc6, 0xeb, 0x36, 0x6d, 0xc1, 0x48, 0x08, 0xac, 0xaa, 0x04, 0x06, 0xab, 0xea, 0xd4, 0x85, + 0x5a, 0x15, 0x12, 0x0f, 0xd0, 0x01, 0x15, 0x89, 0x01, 0xb5, 0x1b, 0x4b, 0xe5, 0xc4, 0x56, 0x7c, + 0xd0, 0xc4, 0x21, 0x76, 0x4a, 0x79, 0x0b, 0x1e, 0x8b, 0xb1, 0x23, 0x23, 0x4a, 0x5e, 0x04, 0xc5, + 0x09, 0x7f, 0x66, 0xb6, 0xef, 0xf7, 0xdd, 0xe7, 0xbb, 0xd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0x92, + 0xb6, 0x1e, 0xae, 0x23, 0xb0, 0x2a, 0x0f, 0xa6, 0xa1, 0x8e, 0x59, 0x00, 0x3c, 0x79, 0x04, 0xc9, + 0x81, 0x7d, 0x1f, 0x9b, 0xc5, 0x5a, 0xe4, 0x1b, 0x69, 0xfe, 0xfc, 0x07, 0xb3, 0xaf, 0xa9, 0x34, + 0x41, 0xcf, 0x1d, 0xfa, 0xea, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xed, 0x35, 0x64, 0x3e, 0xb8, 0x01, + 0x00, 0x00, } func (m *Space) Marshal() (dAtA []byte, err error) { @@ -319,8 +319,8 @@ func (m *SpaceLatestHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if m.Id != 0 { - i = encodeVarintSideChain(dAtA, i, uint64(m.Id)) + if m.SpaceId != 0 { + i = encodeVarintSideChain(dAtA, i, uint64(m.SpaceId)) i-- dAtA[i] = 0x8 } @@ -415,8 +415,8 @@ func (m *SpaceLatestHeight) Size() (n int) { } var l int _ = l - if m.Id != 0 { - n += 1 + sovSideChain(uint64(m.Id)) + if m.SpaceId != 0 { + n += 1 + sovSideChain(uint64(m.SpaceId)) } if m.Height != 0 { n += 1 + sovSideChain(uint64(m.Height)) @@ -649,9 +649,9 @@ func (m *SpaceLatestHeight) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType) } - m.Id = 0 + m.SpaceId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowSideChain @@ -661,7 +661,7 @@ func (m *SpaceLatestHeight) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Id |= uint64(b&0x7F) << shift + m.SpaceId |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/side-chain/v1/side-chain.proto b/proto/side-chain/v1/side-chain.proto index c1b10f3f..36f5299c 100644 --- a/proto/side-chain/v1/side-chain.proto +++ b/proto/side-chain/v1/side-chain.proto @@ -15,7 +15,7 @@ message Space { // SpaceLatestHeight defines the latest height of the side-chain. message SpaceLatestHeight { - uint64 id = 1; + uint64 space_id = 1; uint64 height = 2; }