From fd06bf50f90853ca65afe211377b037df7e5bcd0 Mon Sep 17 00:00:00 2001 From: Thomas van Dam Date: Sat, 17 Aug 2024 21:58:44 +0200 Subject: [PATCH] chore(data-proxy): add genesis import and export Part-of: #316 --- proto/sedachain/data_proxy/v1/genesis.proto | 8 +- x/data-proxy/keeper/genesis.go | 88 +++++++++++- x/data-proxy/keeper/genesis_test.go | 49 ++++++- x/data-proxy/types/genesis.go | 43 +++++- x/data-proxy/types/genesis.pb.go | 142 ++++++++++---------- 5 files changed, 245 insertions(+), 85 deletions(-) diff --git a/proto/sedachain/data_proxy/v1/genesis.proto b/proto/sedachain/data_proxy/v1/genesis.proto index d8324384..434d0890 100644 --- a/proto/sedachain/data_proxy/v1/genesis.proto +++ b/proto/sedachain/data_proxy/v1/genesis.proto @@ -10,7 +10,7 @@ option go_package = "github.com/sedaprotocol/seda-chain/x/data-proxy/types"; message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; - repeated DataProxyConfigs data_proxy_configs = 2 + repeated DataProxyConfig data_proxy_configs = 2 [ (gogoproto.nullable) = false ]; repeated FeeUpdateQueueRecord fee_update_queue = 3 @@ -18,15 +18,15 @@ message GenesisState { } // DataProxyConfigs define the data proxy entries in the registry. -message DataProxyConfigs { - string data_proxy_pubkey = 1; +message DataProxyConfig { + bytes data_proxy_pubkey = 1; ProxyConfig config = 2; } // FeeUpdateQueueRecord defines an entry in the data proxy update queue. message FeeUpdateQueueRecord { - string data_proxy_pubkey = 1; + bytes data_proxy_pubkey = 1; int64 update_height = 2; } \ No newline at end of file diff --git a/x/data-proxy/keeper/genesis.go b/x/data-proxy/keeper/genesis.go index cee05d34..7343bb82 100644 --- a/x/data-proxy/keeper/genesis.go +++ b/x/data-proxy/keeper/genesis.go @@ -1,21 +1,101 @@ package keeper import ( + "cosmossdk.io/collections" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sedaprotocol/seda-chain/x/data-proxy/types" ) // InitGenesis initializes the store based on the given genesis state. -func (k Keeper) InitGenesis(_ sdk.Context, _ types.GenesisState) { - // TODO +func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { + if err := k.Params.Set(ctx, data.Params); err != nil { + panic(err) + } + + for _, dataProxyConfig := range data.DataProxyConfigs { + if err := k.DataProxyConfigs.Set(ctx, dataProxyConfig.DataProxyPubkey, *dataProxyConfig.Config); err != nil { + panic(err) + } + } + + for _, feeUpdate := range data.FeeUpdateQueue { + if err := k.FeeUpdateQueue.Set(ctx, collections.Join(feeUpdate.UpdateHeight, feeUpdate.DataProxyPubkey)); err != nil { + panic(err) + } + } } // ExportGenesis extracts all data from store to genesis state. -func (k Keeper) ExportGenesis(_ sdk.Context) types.GenesisState { +func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState { var gs types.GenesisState - // TODO + params, err := k.Params.Get(ctx) + if err != nil { + panic(err) + } + gs.Params = params + + configs, err := k.getAllDataProxyConfigs(ctx) + if err != nil { + panic(err) + } + gs.DataProxyConfigs = configs + + feeUpdates, err := k.getAllFeeUpdateRecords(ctx) + if err != nil { + panic(err) + } + gs.FeeUpdateQueue = feeUpdates return gs } + +func (k Keeper) getAllDataProxyConfigs(ctx sdk.Context) ([]types.DataProxyConfig, error) { + configs := make([]types.DataProxyConfig, 0) + + itr, err := k.DataProxyConfigs.Iterate(ctx, nil) + if err != nil { + return nil, err + } + defer itr.Close() + + for ; itr.Valid(); itr.Next() { + kv, err := itr.KeyValue() + if err != nil { + return nil, err + } + + configs = append(configs, types.DataProxyConfig{ + DataProxyPubkey: kv.Key, + Config: &kv.Value, + }) + } + + return configs, nil +} + +func (k Keeper) getAllFeeUpdateRecords(ctx sdk.Context) ([]types.FeeUpdateQueueRecord, error) { + feeUpdates := make([]types.FeeUpdateQueueRecord, 0) + + itr, err := k.FeeUpdateQueue.Iterate(ctx, nil) + if err != nil { + return nil, err + } + defer itr.Close() + + for ; itr.Valid(); itr.Next() { + key, err := itr.Key() + if err != nil { + return nil, err + } + + feeUpdates = append(feeUpdates, types.FeeUpdateQueueRecord{ + UpdateHeight: key.K1(), + DataProxyPubkey: key.K2(), + }) + } + + return feeUpdates, nil +} diff --git a/x/data-proxy/keeper/genesis_test.go b/x/data-proxy/keeper/genesis_test.go index c4c36a99..c349cd1c 100644 --- a/x/data-proxy/keeper/genesis_test.go +++ b/x/data-proxy/keeper/genesis_test.go @@ -1,13 +1,56 @@ package keeper_test import ( + "encoding/hex" + "github.com/sedaprotocol/seda-chain/x/data-proxy/types" ) func (s *KeeperTestSuite) TestImportExportGenesis() { - genState := types.GenesisState{} + pubkeyOne, err := hex.DecodeString("034c0f86f0cb61f9ddb47c4ba0b2ca0470962b5a1c50bee3a563184979672195f4") + s.Require().NoError(err) + + pubkeyTwo, err := hex.DecodeString("02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3") + s.Require().NoError(err) + + genState := types.GenesisState{ + Params: types.DefaultParams(), + DataProxyConfigs: []types.DataProxyConfig{ + { + DataProxyPubkey: pubkeyOne, + Config: &types.ProxyConfig{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: s.NewFeeFromString("5"), + Memo: "", + FeeUpdate: nil, + }, + }, + { + DataProxyPubkey: pubkeyTwo, + Config: &types.ProxyConfig{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1wyzxdtpl0c99c92n397r3drlhj09qfjvf6teyh", + Fee: s.NewFeeFromString("5000"), + Memo: "not my proxy friend", + FeeUpdate: &types.FeeUpdate{ + NewFee: *s.NewFeeFromString("10000"), + UpdateHeight: 500, + }, + }, + }, + }, + FeeUpdateQueue: []types.FeeUpdateQueueRecord{ + { + DataProxyPubkey: pubkeyTwo, + UpdateHeight: 500, + }, + }, + } s.keeper.InitGenesis(s.ctx, genState) - // exportedGenState := s.keeper.ExportGenesis(s.ctx) - // TODO + exportedGenState := s.keeper.ExportGenesis(s.ctx) + s.Require().Equal(genState.Params, exportedGenState.Params) + s.Require().ElementsMatch(genState.DataProxyConfigs, exportedGenState.DataProxyConfigs) + s.Require().ElementsMatch(genState.FeeUpdateQueue, exportedGenState.FeeUpdateQueue) } diff --git a/x/data-proxy/types/genesis.go b/x/data-proxy/types/genesis.go index a63b6eca..b74f6bb5 100644 --- a/x/data-proxy/types/genesis.go +++ b/x/data-proxy/types/genesis.go @@ -1,14 +1,47 @@ package types -func NewGenesisState() GenesisState { - return GenesisState{} +import "fmt" + +func NewGenesisState(params Params, proxyConfigs []DataProxyConfig, feeUpdates []FeeUpdateQueueRecord) GenesisState { + return GenesisState{ + Params: params, + DataProxyConfigs: proxyConfigs, + FeeUpdateQueue: feeUpdates, + } } func DefaultGenesisState() *GenesisState { - state := NewGenesisState() + state := NewGenesisState(DefaultParams(), []DataProxyConfig{}, []FeeUpdateQueueRecord{}) return &state } -func ValidateGenesis(_ GenesisState) error { - return nil +func ValidateGenesis(data GenesisState) error { + for _, proxyConfig := range data.DataProxyConfigs { + if len(proxyConfig.DataProxyPubkey) == 0 { + return fmt.Errorf("empty public key in proxy configs") + } + + if err := proxyConfig.Config.Validate(); err != nil { + return err + } + + if err := proxyConfig.Config.Fee.Validate(); err != nil { + return err + } + + if proxyConfig.Config.AdminAddress == "" { + return fmt.Errorf("empty admin address") + } + if proxyConfig.Config.PayoutAddress == "" { + return fmt.Errorf("empty payout address") + } + } + + for _, feeUpdate := range data.FeeUpdateQueue { + if len(feeUpdate.DataProxyPubkey) == 0 { + return fmt.Errorf("empty public key in fee updates") + } + } + + return data.Params.Validate() } diff --git a/x/data-proxy/types/genesis.pb.go b/x/data-proxy/types/genesis.pb.go index 9730156d..e95021fa 100644 --- a/x/data-proxy/types/genesis.pb.go +++ b/x/data-proxy/types/genesis.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines data_proxy module's genesis state. type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - DataProxyConfigs []DataProxyConfigs `protobuf:"bytes,2,rep,name=data_proxy_configs,json=dataProxyConfigs,proto3" json:"data_proxy_configs"` + DataProxyConfigs []DataProxyConfig `protobuf:"bytes,2,rep,name=data_proxy_configs,json=dataProxyConfigs,proto3" json:"data_proxy_configs"` FeeUpdateQueue []FeeUpdateQueueRecord `protobuf:"bytes,3,rep,name=fee_update_queue,json=feeUpdateQueue,proto3" json:"fee_update_queue"` } @@ -70,7 +70,7 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetDataProxyConfigs() []DataProxyConfigs { +func (m *GenesisState) GetDataProxyConfigs() []DataProxyConfig { if m != nil { return m.DataProxyConfigs } @@ -85,23 +85,23 @@ func (m *GenesisState) GetFeeUpdateQueue() []FeeUpdateQueueRecord { } // DataProxyConfigs define the data proxy entries in the registry. -type DataProxyConfigs struct { - DataProxyPubkey string `protobuf:"bytes,1,opt,name=data_proxy_pubkey,json=dataProxyPubkey,proto3" json:"data_proxy_pubkey,omitempty"` +type DataProxyConfig struct { + DataProxyPubkey []byte `protobuf:"bytes,1,opt,name=data_proxy_pubkey,json=dataProxyPubkey,proto3" json:"data_proxy_pubkey,omitempty"` Config *ProxyConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` } -func (m *DataProxyConfigs) Reset() { *m = DataProxyConfigs{} } -func (m *DataProxyConfigs) String() string { return proto.CompactTextString(m) } -func (*DataProxyConfigs) ProtoMessage() {} -func (*DataProxyConfigs) Descriptor() ([]byte, []int) { +func (m *DataProxyConfig) Reset() { *m = DataProxyConfig{} } +func (m *DataProxyConfig) String() string { return proto.CompactTextString(m) } +func (*DataProxyConfig) ProtoMessage() {} +func (*DataProxyConfig) Descriptor() ([]byte, []int) { return fileDescriptor_614b9aebcf526c4f, []int{1} } -func (m *DataProxyConfigs) XXX_Unmarshal(b []byte) error { +func (m *DataProxyConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DataProxyConfigs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DataProxyConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DataProxyConfigs.Marshal(b, m, deterministic) + return xxx_messageInfo_DataProxyConfig.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -111,26 +111,26 @@ func (m *DataProxyConfigs) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *DataProxyConfigs) XXX_Merge(src proto.Message) { - xxx_messageInfo_DataProxyConfigs.Merge(m, src) +func (m *DataProxyConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_DataProxyConfig.Merge(m, src) } -func (m *DataProxyConfigs) XXX_Size() int { +func (m *DataProxyConfig) XXX_Size() int { return m.Size() } -func (m *DataProxyConfigs) XXX_DiscardUnknown() { - xxx_messageInfo_DataProxyConfigs.DiscardUnknown(m) +func (m *DataProxyConfig) XXX_DiscardUnknown() { + xxx_messageInfo_DataProxyConfig.DiscardUnknown(m) } -var xxx_messageInfo_DataProxyConfigs proto.InternalMessageInfo +var xxx_messageInfo_DataProxyConfig proto.InternalMessageInfo -func (m *DataProxyConfigs) GetDataProxyPubkey() string { +func (m *DataProxyConfig) GetDataProxyPubkey() []byte { if m != nil { return m.DataProxyPubkey } - return "" + return nil } -func (m *DataProxyConfigs) GetConfig() *ProxyConfig { +func (m *DataProxyConfig) GetConfig() *ProxyConfig { if m != nil { return m.Config } @@ -139,7 +139,7 @@ func (m *DataProxyConfigs) GetConfig() *ProxyConfig { // FeeUpdateQueueRecord defines an entry in the data proxy update queue. type FeeUpdateQueueRecord struct { - DataProxyPubkey string `protobuf:"bytes,1,opt,name=data_proxy_pubkey,json=dataProxyPubkey,proto3" json:"data_proxy_pubkey,omitempty"` + DataProxyPubkey []byte `protobuf:"bytes,1,opt,name=data_proxy_pubkey,json=dataProxyPubkey,proto3" json:"data_proxy_pubkey,omitempty"` UpdateHeight int64 `protobuf:"varint,2,opt,name=update_height,json=updateHeight,proto3" json:"update_height,omitempty"` } @@ -176,11 +176,11 @@ func (m *FeeUpdateQueueRecord) XXX_DiscardUnknown() { var xxx_messageInfo_FeeUpdateQueueRecord proto.InternalMessageInfo -func (m *FeeUpdateQueueRecord) GetDataProxyPubkey() string { +func (m *FeeUpdateQueueRecord) GetDataProxyPubkey() []byte { if m != nil { return m.DataProxyPubkey } - return "" + return nil } func (m *FeeUpdateQueueRecord) GetUpdateHeight() int64 { @@ -192,7 +192,7 @@ func (m *FeeUpdateQueueRecord) GetUpdateHeight() int64 { func init() { proto.RegisterType((*GenesisState)(nil), "sedachain.data_proxy.v1.GenesisState") - proto.RegisterType((*DataProxyConfigs)(nil), "sedachain.data_proxy.v1.DataProxyConfigs") + proto.RegisterType((*DataProxyConfig)(nil), "sedachain.data_proxy.v1.DataProxyConfig") proto.RegisterType((*FeeUpdateQueueRecord)(nil), "sedachain.data_proxy.v1.FeeUpdateQueueRecord") } @@ -201,31 +201,31 @@ func init() { } var fileDescriptor_614b9aebcf526c4f = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xc1, 0x4e, 0xf2, 0x50, - 0x10, 0x85, 0x5b, 0xf8, 0x43, 0xf2, 0x5f, 0x50, 0xb1, 0x21, 0xb1, 0x61, 0x51, 0x08, 0x6a, 0x82, - 0x26, 0xb4, 0x01, 0xe3, 0x4e, 0x37, 0x68, 0xd4, 0x9d, 0x58, 0xe3, 0xc6, 0x84, 0x34, 0x97, 0x76, - 0x68, 0x1b, 0x85, 0x5b, 0xdb, 0x5b, 0x02, 0x89, 0x6f, 0xe0, 0xc6, 0xc7, 0x62, 0xc9, 0xd2, 0x95, - 0x31, 0xf0, 0x22, 0xa6, 0xd3, 0x06, 0x90, 0xd8, 0x85, 0xbb, 0xde, 0xe9,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30, 0xc1, 0xdb, 0xfc, 0xd7, 0x77, 0x96, 0xfe, 0x3a, 0x58, 0x96, 0xce, 0x48, 0x2e, 0x5e, - 0x59, 0xce, 0xe0, 0xf1, 0x0e, 0xd2, 0x8f, 0xb7, 0x1a, 0xa1, 0x27, 0x3d, 0x35, 0x9b, 0x94, 0x7e, - 0xf3, 0xfa, 0x27, 0x07, 0xfb, 0x64, 0x2b, 0x39, 0x8e, 0x03, 0xae, 0xed, 0x70, 0x34, 0x92, 0xd5, - 0x0b, 0x71, 0xf1, 0x06, 0x6b, 0xed, 0xdb, 0xe9, 0x5c, 0x11, 0x67, 0x73, 0x45, 0xfc, 0x9a, 0x2b, - 0xe2, 0xfb, 0x42, 0x11, 0x66, 0x0b, 0x45, 0xf8, 0x58, 0x28, 0xc2, 0xe3, 0xa9, 0xed, 0x72, 0x27, - 0xec, 0xa9, 0x26, 0x1b, 0x68, 0x91, 0x75, 0x0c, 0x89, 0xc9, 0x9e, 0xf1, 0xd1, 0x88, 0x13, 0x35, - 0xc6, 0x14, 0x35, 0xe2, 0x4c, 0xf1, 0x89, 0x07, 0x41, 0x2f, 0x87, 0xdc, 0xc9, 0x77, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x94, 0x5c, 0x28, 0x76, 0xce, 0x02, 0x00, 0x00, + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0xcf, 0x4e, 0xea, 0x50, + 0x10, 0xc6, 0x5b, 0xb8, 0x61, 0x71, 0xe0, 0x5e, 0xb8, 0x0d, 0x89, 0x0d, 0x8b, 0x42, 0x50, 0x93, + 0xc6, 0x84, 0x36, 0x60, 0xdc, 0xe9, 0x06, 0x8d, 0xba, 0x13, 0x6b, 0xdc, 0x18, 0x4d, 0x73, 0x68, + 0x87, 0xb6, 0x51, 0x38, 0xb5, 0x3d, 0x25, 0x10, 0xdf, 0xc0, 0x95, 0x8f, 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xb0, 0xf5, 0xaf, 0xf9, 0x42, 0xca, 0xdf, 0x9c, 0x48, 0x07, 0xe4, 0xff, 0xc6, 0x3e, 0x7e, + 0xd4, 0x7f, 0x84, 0x29, 0x5e, 0xa6, 0x64, 0x94, 0x57, 0xf6, 0x7a, 0x58, 0x96, 0x8e, 0x49, 0x21, + 0x59, 0x58, 0xce, 0xe1, 0xe9, 0xf6, 0xb2, 0x4f, 0xb7, 0x9e, 0x60, 0xa4, 0x3d, 0x4d, 0x87, 0x54, + 0x7f, 0xb2, 0xfa, 0x2b, 0x07, 0xbb, 0xe4, 0x6f, 0x7a, 0x1b, 0x17, 0x3c, 0xc7, 0xe5, 0x68, 0x24, + 0x6f, 0x94, 0x92, 0xe2, 0x25, 0xd6, 0xba, 0x57, 0xb3, 0x85, 0x22, 0xce, 0x17, 0x8a, 0xf8, 0xb9, + 0x50, 0xc4, 0xb7, 0xa5, 0x22, 0xcc, 0x97, 0x8a, 0xf0, 0xbe, 0x54, 0x84, 0xbb, 0x23, 0xc7, 0xe3, + 0x6e, 0xd4, 0xd7, 0x2c, 0x36, 0xd4, 0x63, 0xeb, 0x18, 0x11, 0x8b, 0x3d, 0xe1, 0xa3, 0x95, 0xe4, + 0x69, 0x82, 0x19, 0x6a, 0x25, 0x89, 0xe2, 0x53, 0x1f, 0xc2, 0x7e, 0x01, 0xb9, 0xc3, 0xaf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x05, 0x85, 0x87, 0x38, 0xcc, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -289,7 +289,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DataProxyConfigs) Marshal() (dAtA []byte, err error) { +func (m *DataProxyConfig) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -299,12 +299,12 @@ func (m *DataProxyConfigs) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DataProxyConfigs) MarshalTo(dAtA []byte) (int, error) { +func (m *DataProxyConfig) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *DataProxyConfigs) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DataProxyConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -400,7 +400,7 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *DataProxyConfigs) Size() (n int) { +func (m *DataProxyConfig) Size() (n int) { if m == nil { return 0 } @@ -530,7 +530,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DataProxyConfigs = append(m.DataProxyConfigs, DataProxyConfigs{}) + m.DataProxyConfigs = append(m.DataProxyConfigs, DataProxyConfig{}) if err := m.DataProxyConfigs[len(m.DataProxyConfigs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -590,7 +590,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *DataProxyConfigs) Unmarshal(dAtA []byte) error { +func (m *DataProxyConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -613,17 +613,17 @@ func (m *DataProxyConfigs) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DataProxyConfigs: wiretype end group for non-group") + return fmt.Errorf("proto: DataProxyConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DataProxyConfigs: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DataProxyConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DataProxyPubkey", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -633,23 +633,25 @@ func (m *DataProxyConfigs) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthGenesis } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthGenesis } if postIndex > l { return io.ErrUnexpectedEOF } - m.DataProxyPubkey = string(dAtA[iNdEx:postIndex]) + m.DataProxyPubkey = append(m.DataProxyPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.DataProxyPubkey == nil { + m.DataProxyPubkey = []byte{} + } iNdEx = postIndex case 2: if wireType != 2 { @@ -741,7 +743,7 @@ func (m *FeeUpdateQueueRecord) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DataProxyPubkey", wireType) } - var stringLen uint64 + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -751,23 +753,25 @@ func (m *FeeUpdateQueueRecord) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if byteLen < 0 { return ErrInvalidLengthGenesis } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthGenesis } if postIndex > l { return io.ErrUnexpectedEOF } - m.DataProxyPubkey = string(dAtA[iNdEx:postIndex]) + m.DataProxyPubkey = append(m.DataProxyPubkey[:0], dAtA[iNdEx:postIndex]...) + if m.DataProxyPubkey == nil { + m.DataProxyPubkey = []byte{} + } iNdEx = postIndex case 2: if wireType != 0 {