From 227ffa2c42944652554d5b89eece16158cf86030 Mon Sep 17 00:00:00 2001 From: Thomas van Dam Date: Fri, 16 Aug 2024 16:47:03 +0200 Subject: [PATCH] chore(data-proxy): add registration message handling Also introduces an admin address to make updates to the proxy config easier for operators. An alternative would be to use a sequence number, but that makes the whole managamenet process more cumbersome for the operator. Part-of: #316 --- .../sedachain/data_proxy/v1/data_proxy.proto | 5 +- proto/sedachain/data_proxy/v1/tx.proto | 27 +- x/data-proxy/client/cli/tx.go | 30 +- x/data-proxy/keeper/common_test.go | 55 +++- x/data-proxy/keeper/msg_server.go | 59 +++- x/data-proxy/keeper/msg_server_test.go | 181 +++++++++++- x/data-proxy/types/data_proxy.pb.go | 107 +++++-- x/data-proxy/types/errors.go | 8 +- x/data-proxy/types/tx.go | 2 +- x/data-proxy/types/tx.pb.go | 271 +++++++----------- 10 files changed, 523 insertions(+), 222 deletions(-) diff --git a/proto/sedachain/data_proxy/v1/data_proxy.proto b/proto/sedachain/data_proxy/v1/data_proxy.proto index 6f83f28b..5a1e7994 100644 --- a/proto/sedachain/data_proxy/v1/data_proxy.proto +++ b/proto/sedachain/data_proxy/v1/data_proxy.proto @@ -28,9 +28,12 @@ message ProxyConfig { // memo defines an optional string which is not used by the protocol. string memo = 3; + // only the admin address of a data proxy can submit config updates. + string admin_address = 4; + // fee_update defines an upcoming fee change which will take effect at a // future height. - FeeUpdate fee_update = 4 [ (gogoproto.nullable) = true ]; + FeeUpdate fee_update = 5 [ (gogoproto.nullable) = true ]; } // FeeUpdate defines a new fee amount and the height at which it will take diff --git a/proto/sedachain/data_proxy/v1/tx.proto b/proto/sedachain/data_proxy/v1/tx.proto index f2cfccfe..cfc37c6e 100644 --- a/proto/sedachain/data_proxy/v1/tx.proto +++ b/proto/sedachain/data_proxy/v1/tx.proto @@ -24,19 +24,28 @@ service Msg { // All data required for a new data proxy. message MsgRegisterDataProxy { - string payout_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + option (cosmos.msg.v1.signer) = "admin_address"; - cosmos.base.v1beta1.Coin fee = 2; + // admin_address is the address that can update the proxy config. + string admin_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - string memo = 3; + // payout_address defines the address to which the data proxy fees should be + // transferred. + string payout_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // fee defines the amount in aseda this data-proxy charges when utilised. + cosmos.base.v1beta1.Coin fee = 3; + + // memo defines an optional string which is not used by the protocol. + string memo = 4; // hex encoded bytes as the expected flow already uses hex encoded bytes to go // from the CLI to the browser where the transaction is signed. - string pub_key = 4; + string pub_key = 5; // hex encoded bytes as the expected flow already uses hex encoded bytes to go // from the CLI to the browser where the transaction is signed. - string signature = 5; + string signature = 6; } // No response required. @@ -53,14 +62,6 @@ message MsgEditDataProxy { cosmos.base.v1beta1.Coin new_fee = 3 [ (gogoproto.nullable) = true ]; uint32 fee_update_delay = 4 [ (gogoproto.nullable) = true ]; - - // hex encoded bytes as the expected flow already uses hex encoded bytes to go - // from the CLI to the browser where the transaction is signed. - string pub_key = 5; - - // hex encoded bytes as the expected flow already uses hex encoded bytes to go - // from the CLI to the browser where the transaction is signed. - string signature = 6; } // Returns the height at which the fee update will go into effect. diff --git a/x/data-proxy/client/cli/tx.go b/x/data-proxy/client/cli/tx.go index 83f8e90f..f3639a95 100644 --- a/x/data-proxy/client/cli/tx.go +++ b/x/data-proxy/client/cli/tx.go @@ -8,10 +8,16 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sedaprotocol/seda-chain/x/data-proxy/types" ) +const ( + // FlagKeyFile defines a flag to add arbitrary data to a data proxy. + FlagMemo = "memo" +) + // GetTxCmd returns the CLI transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ @@ -29,24 +35,38 @@ func GetTxCmd() *cobra.Command { // AddKey returns the command for adding a new key and uploading its // public key on chain at a given index. func RegisterDataProxy() *cobra.Command { - // TODO cmd := &cobra.Command{ - Use: "register [thing]", + Use: "register [payout_address] [fee] [public_key_hex] [signature_hex] --from [admin_address]", Short: "Register a data proxy using a signed message generated with the data-proxy cli", - Args: cobra.ExactArgs(1), + Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err } - // TODO - msg := &types.MsgRegisterDataProxy{} + fee, err := sdk.ParseCoinNormalized(args[1]) + if err != nil { + return err + } + + memo, _ := cmd.Flags().GetString(FlagMemo) + + msg := &types.MsgRegisterDataProxy{ + AdminAddress: clientCtx.GetFromAddress().String(), + PayoutAddress: args[0], + Fee: &fee, + PubKey: args[2], + Signature: args[3], + Memo: memo, + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } flags.AddTxFlagsToCmd(cmd) + cmd.Flags().String(FlagMemo, "", "Optionally add a description to the data proxy config") return cmd } diff --git a/x/data-proxy/keeper/common_test.go b/x/data-proxy/keeper/common_test.go index 614ce257..a1e98cc3 100644 --- a/x/data-proxy/keeper/common_test.go +++ b/x/data-proxy/keeper/common_test.go @@ -3,24 +3,71 @@ package keeper_test import ( "testing" - "github.com/stretchr/testify/suite" - + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/server" + sdktestutil "github.com/cosmos/cosmos-sdk/testutil" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/suite" + "github.com/sedaprotocol/seda-chain/app/params" + dataproxy "github.com/sedaprotocol/seda-chain/x/data-proxy" "github.com/sedaprotocol/seda-chain/x/data-proxy/keeper" + "github.com/sedaprotocol/seda-chain/x/data-proxy/types" ) type KeeperTestSuite struct { suite.Suite - ctx sdk.Context - keeper *keeper.Keeper + ctx sdk.Context + keeper *keeper.Keeper + cdc codec.Codec + msgSrvr types.MsgServer + queryClient types.QueryClient + serverCtx *server.Context + authority string } func TestKeeperTestSuite(t *testing.T) { suite.Run(t, new(KeeperTestSuite)) } +func (s *KeeperTestSuite) SetupSuite() { + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(params.Bech32PrefixAccAddr, params.Bech32PrefixAccPub) + config.SetBech32PrefixForValidator(params.Bech32PrefixValAddr, params.Bech32PrefixValPub) + config.SetBech32PrefixForConsensusNode(params.Bech32PrefixConsAddr, params.Bech32PrefixConsPub) + config.Seal() +} + func (s *KeeperTestSuite) SetupTest() { t := s.T() t.Helper() + + s.authority = authtypes.NewModuleAddress("gov").String() + + key := storetypes.NewKVStoreKey(types.StoreKey) + testCtx := sdktestutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) + encCfg := moduletestutil.MakeTestEncodingConfig(dataproxy.AppModuleBasic{}) + types.RegisterInterfaces(encCfg.InterfaceRegistry) + + s.keeper = keeper.NewKeeper( + encCfg.Codec, + runtime.NewKVStoreService(key), + s.authority, + ) + s.ctx = testCtx.Ctx + s.cdc = encCfg.Codec + s.serverCtx = server.NewDefaultContext() + + msr := keeper.NewMsgServerImpl(*s.keeper) + s.msgSrvr = msr + + queryHelper := baseapp.NewQueryServerTestHelper(s.ctx, encCfg.InterfaceRegistry) + querier := keeper.Querier{Keeper: *s.keeper} + types.RegisterQueryServer(queryHelper, querier) + s.queryClient = types.NewQueryClient(queryHelper) } diff --git a/x/data-proxy/keeper/msg_server.go b/x/data-proxy/keeper/msg_server.go index dd2ed56c..e115d3df 100644 --- a/x/data-proxy/keeper/msg_server.go +++ b/x/data-proxy/keeper/msg_server.go @@ -2,8 +2,12 @@ package keeper import ( "context" + "encoding/hex" "fmt" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/crypto/secp256k1" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/sedaprotocol/seda-chain/x/data-proxy/types" @@ -21,8 +25,59 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} } -func (m msgServer) RegisterDataProxy(_ context.Context, _ *types.MsgRegisterDataProxy) (*types.MsgRegisterDataProxyResponse, error) { - // TODO +func (m msgServer) RegisterDataProxy(goCtx context.Context, msg *types.MsgRegisterDataProxy) (*types.MsgRegisterDataProxyResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if err := msg.Validate(); err != nil { + return nil, err + } + + if _, err := sdk.AccAddressFromBech32(msg.AdminAddress); err != nil { + return nil, types.ErrInvalidAddress.Wrapf("invalid admin address %s", err) + } + + pubKeyBytes, err := hex.DecodeString(msg.PubKey) + if err != nil { + return nil, types.ErrInvalidHex.Wrap(err.Error()) + } + + signatureBytes, err := hex.DecodeString(msg.Signature) + if err != nil { + return nil, types.ErrInvalidHex.Wrap(err.Error()) + } + + found, err := m.DataProxyConfigs.Has(ctx, pubKeyBytes) + if err != nil { + return nil, err + } + if found { + return nil, types.ErrAlreadyExists + } + + feeBytes := []byte(msg.Fee.String()) + payoutAddressBytes := []byte(msg.PayoutAddress) + memoBytes := []byte(msg.Memo) + + payload := make([]byte, 0, len(feeBytes)+len(payoutAddressBytes)+len(memoBytes)) + payload = append(payload, feeBytes...) + payload = append(payload, payoutAddressBytes...) + payload = append(payload, memoBytes...) + + if valid := secp256k1.VerifySignature(pubKeyBytes, crypto.Keccak256(payload), signatureBytes); !valid { + return nil, types.ErrInvalidSignature + } + + err = m.DataProxyConfigs.Set(ctx, pubKeyBytes, types.ProxyConfig{ + PayoutAddress: msg.PayoutAddress, + Fee: msg.Fee, + Memo: msg.Memo, + FeeUpdate: nil, + AdminAddress: msg.AdminAddress, + }) + if err != nil { + return nil, err + } + return &types.MsgRegisterDataProxyResponse{}, nil } diff --git a/x/data-proxy/keeper/msg_server_test.go b/x/data-proxy/keeper/msg_server_test.go index ca91bdff..7bb50bf1 100644 --- a/x/data-proxy/keeper/msg_server_test.go +++ b/x/data-proxy/keeper/msg_server_test.go @@ -1,25 +1,192 @@ package keeper_test import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sedaprotocol/seda-chain/x/data-proxy/types" ) +func (s *KeeperTestSuite) NewIntFromString(val string) math.Int { + amount, success := math.NewIntFromString(val) + s.Require().True(success) + return amount +} + func (s *KeeperTestSuite) TestMsgServer_RegisterDataProxy() { tests := []struct { - name string - msg *types.MsgRegisterDataProxy - valAddrBytes []byte - wantErr error + name string + msg *types.MsgRegisterDataProxy + expected *types.ProxyConfig + wantErr error }{ { - name: "Happy path", - msg: &types.MsgRegisterDataProxy{}, + name: "Happy path", + msg: &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3", + Signature: "5076d9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + }, + expected: &types.ProxyConfig{ + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + FeeUpdate: nil, + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + }, + wantErr: nil, + }, + { + name: "Happy path with memo", + msg: &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "This is a sweet proxy", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3", + Signature: "5076d9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + }, + expected: &types.ProxyConfig{ + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "This is a sweet proxy", + FeeUpdate: nil, + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + }, wantErr: nil, }, + { + name: "Invalid address", + msg: &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3", + Signature: "5076d9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + }, + expected: nil, + wantErr: types.ErrInvalidAddress, + }, + { + name: "Invalid signature", + msg: &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("9000000000000000000"), + }, + Memo: "", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3", + Signature: "5076d9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + }, + expected: nil, + wantErr: types.ErrInvalidSignature, + }, + { + name: "Invalid pubkey hex", + msg: &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4g3", + Signature: "5076d9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + }, + expected: nil, + wantErr: types.ErrInvalidHex, + }, + { + name: "Invalid signature hex", + msg: &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4f3", + Signature: "5076g9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + }, + expected: nil, + wantErr: types.ErrInvalidHex, + }, } for _, tt := range tests { s.Run(tt.name, func() { - // TODO + s.SetupTest() + + res, err := s.msgSrvr.RegisterDataProxy(s.ctx, tt.msg) + if tt.wantErr != nil { + s.Require().ErrorIs(err, tt.wantErr) + s.Require().Nil(res) + return + } + + s.Require().NoError(err) + + proxyConfig, err := s.keeper.GetDataProxyConfig(s.ctx, tt.msg.PubKey) + s.Require().NoError(err) + s.Require().Equal(tt.expected, &proxyConfig) }) } } + +func (s *KeeperTestSuite) TestMsgServer_RegisterDataProxyDuplicate() { + s.Run("Registering an already existing data proxy should fail", func() { + msg := &types.MsgRegisterDataProxy{ + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + PubKey: "02100efce2a783cc7a3fbf9c5d15d4cc6e263337651312f21a35d30c16cb38f4c3", + Signature: "5076d9d98754505d2f6f94f5a44062b9e95c2c5cfe7f21c69270814dc947bd285f5ed64e595aa956004687a225263f2831252cb41379cab2e3505b90f3da2701", + } + + _, err := s.msgSrvr.RegisterDataProxy(s.ctx, msg) + s.Require().NoError(err) + + proxyConfig, err := s.keeper.GetDataProxyConfig(s.ctx, msg.PubKey) + s.Require().NoError(err) + s.Require().Equal(&types.ProxyConfig{ + PayoutAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + Fee: &sdk.Coin{ + Denom: "aseda", + Amount: s.NewIntFromString("10000000000000000000"), + }, + Memo: "", + FeeUpdate: nil, + AdminAddress: "seda1uea9km4nup9q7qu96ak683kc67x9jf7ste45z5", + }, &proxyConfig) + + res, err := s.msgSrvr.RegisterDataProxy(s.ctx, msg) + s.Require().ErrorIs(err, types.ErrAlreadyExists) + s.Require().Nil(res) + }) +} diff --git a/x/data-proxy/types/data_proxy.pb.go b/x/data-proxy/types/data_proxy.pb.go index 6c7dbb31..7fa6b03f 100644 --- a/x/data-proxy/types/data_proxy.pb.go +++ b/x/data-proxy/types/data_proxy.pb.go @@ -81,9 +81,11 @@ type ProxyConfig struct { Fee *types.Coin `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` // memo defines an optional string which is not used by the protocol. Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` + // only the admin address of a data proxy can submit config updates. + AdminAddress string `protobuf:"bytes,4,opt,name=admin_address,json=adminAddress,proto3" json:"admin_address,omitempty"` // fee_update defines an upcoming fee change which will take effect at a // future height. - FeeUpdate *FeeUpdate `protobuf:"bytes,4,opt,name=fee_update,json=feeUpdate,proto3" json:"fee_update,omitempty"` + FeeUpdate *FeeUpdate `protobuf:"bytes,5,opt,name=fee_update,json=feeUpdate,proto3" json:"fee_update,omitempty"` } func (m *ProxyConfig) Reset() { *m = ProxyConfig{} } @@ -140,6 +142,13 @@ func (m *ProxyConfig) GetMemo() string { return "" } +func (m *ProxyConfig) GetAdminAddress() string { + if m != nil { + return m.AdminAddress + } + return "" +} + func (m *ProxyConfig) GetFeeUpdate() *FeeUpdate { if m != nil { return m.FeeUpdate @@ -214,34 +223,35 @@ func init() { } var fileDescriptor_ce367ef351b38f5e = []byte{ - // 421 bytes of a gzipped FileDescriptorProto + // 436 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0xcd, 0x92, 0x28, 0x28, 0x5b, 0x82, 0xc4, 0x2a, 0x12, 0x6e, 0x0f, 0x6e, 0x15, 0x2e, 0x91, + 0x10, 0xcd, 0x92, 0x10, 0x94, 0x6d, 0x83, 0xc4, 0x2a, 0x12, 0x6e, 0x0f, 0x6e, 0x15, 0x2e, 0x91, 0x50, 0x76, 0x15, 0x10, 0x12, 0xe2, 0x52, 0x91, 0xa2, 0xc2, 0x8d, 0xca, 0x88, 0x0b, 0x17, 0x6b, - 0x6d, 0x8f, 0xed, 0x45, 0xf5, 0xae, 0xe5, 0xdd, 0xa4, 0xf5, 0x5f, 0xf0, 0x09, 0x7c, 0x04, 0x1f, - 0xd1, 0x63, 0xc5, 0xa9, 0x27, 0x84, 0x92, 0x0b, 0x9f, 0x81, 0x76, 0xd7, 0x84, 0x5c, 0xe0, 0x36, - 0xf3, 0xde, 0xf3, 0xf8, 0xbd, 0xd9, 0xc1, 0x33, 0x0d, 0x19, 0x4f, 0x4b, 0x2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e, 0x69, 0xeb, 0x9f, 0x9e, 0x2a, 0x21, 0x23, 0xab, + 0x22, 0x04, 0xf7, 0x4a, 0x28, 0x55, 0xd0, 0xb5, 0x33, 0x22, 0xf7, 0x26, 0x4f, 0xf0, 0x90, 0xa7, + 0x36, 0xca, 0xd6, 0x40, 0xcf, 0x91, 0xfb, 0x0e, 0xdc, 0x4e, 0x79, 0x8b, 0xf1, 0xbf, 0xa4, 0xc1, + 0x7d, 0x37, 0x6c, 0x4c, 0xff, 0xb3, 0x76, 0xba, 0x4b, 0x3e, 0xef, 0x5d, 0xff, 0x3c, 0x42, 0xd1, + 0x20, 0xdb, 0x02, 0xe3, 0xcf, 0x78, 0xb0, 0x63, 0xc9, 0x4b, 0xfc, 0x40, 0xc2, 0xa5, 0xdd, 0xa1, + 0x4b, 0x7d, 0x97, 0x7f, 0xd7, 0xa9, 0x13, 0xf5, 0x25, 0x5c, 0x9e, 0x01, 0x58, 0xd3, 0xed, 0xd6, + 0x0b, 0x10, 0x79, 0x61, 0x5c, 0xfe, 0x6e, 0xb4, 0xef, 0xc1, 0x77, 0x0e, 0x9b, 0xbf, 0xbf, 0x5e, + 0x87, 0xe8, 0x66, 0x1d, 0xa2, 0x5f, 0xeb, 0x10, 0x7d, 0xd9, 0x84, 0x9d, 0x9b, 0x4d, 0xd8, 0xf9, + 0xb1, 0x09, 0x3b, 0x9f, 0x5e, 0xe4, 0xc2, 0x14, 0xcb, 0x05, 0x4d, 0x54, 0xc9, 0x6c, 0x08, 0xf7, + 0x73, 0x13, 0x75, 0xe1, 0x8a, 0xa9, 0xbf, 0xb9, 0x2b, 0x77, 0x67, 0x53, 0x7f, 0x75, 0xa6, 0xa9, + 0x40, 0x2f, 0xfa, 0x4e, 0xf7, 0xfc, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7e, 0xe3, 0x70, 0x28, + 0x9a, 0x02, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -326,6 +336,13 @@ func (m *ProxyConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintDataProxy(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x2a + } + if len(m.AdminAddress) > 0 { + i -= len(m.AdminAddress) + copy(dAtA[i:], m.AdminAddress) + i = encodeVarintDataProxy(dAtA, i, uint64(len(m.AdminAddress))) + i-- dAtA[i] = 0x22 } if len(m.Memo) > 0 { @@ -436,6 +453,10 @@ func (m *ProxyConfig) Size() (n int) { if l > 0 { n += 1 + l + sovDataProxy(uint64(l)) } + l = len(m.AdminAddress) + if l > 0 { + n += 1 + l + sovDataProxy(uint64(l)) + } if m.FeeUpdate != nil { l = m.FeeUpdate.Size() n += 1 + l + sovDataProxy(uint64(l)) @@ -662,6 +683,38 @@ func (m *ProxyConfig) Unmarshal(dAtA []byte) error { m.Memo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdminAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDataProxy + } + 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 ErrInvalidLengthDataProxy + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDataProxy + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AdminAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FeeUpdate", wireType) } diff --git a/x/data-proxy/types/errors.go b/x/data-proxy/types/errors.go index b340aba3..5b4444c9 100644 --- a/x/data-proxy/types/errors.go +++ b/x/data-proxy/types/errors.go @@ -3,6 +3,10 @@ package types import "cosmossdk.io/errors" var ( - ErrEmptyValue = errors.Register(ModuleName, 1, "empty value") - ErrInvalidParam = errors.Register(ModuleName, 2, "invalid parameter") + ErrEmptyValue = errors.Register(ModuleName, 1, "empty value") + ErrInvalidParam = errors.Register(ModuleName, 2, "invalid parameter") + ErrAlreadyExists = errors.Register(ModuleName, 3, "already exists") + ErrInvalidSignature = errors.Register(ModuleName, 4, "invalid signature") + ErrInvalidAddress = errors.Register(ModuleName, 5, "invalid address") + ErrInvalidHex = errors.Register(ModuleName, 6, "invalid hex string") ) diff --git a/x/data-proxy/types/tx.go b/x/data-proxy/types/tx.go index e5f2f55e..8b092fa1 100644 --- a/x/data-proxy/types/tx.go +++ b/x/data-proxy/types/tx.go @@ -9,7 +9,7 @@ func (m *MsgRegisterDataProxy) Validate() error { return ErrEmptyValue.Wrap("empty payout address") } if _, err := sdk.AccAddressFromBech32(m.PayoutAddress); err != nil { - return err + return ErrInvalidAddress.Wrap(err.Error()) } if m.Fee == nil { return ErrEmptyValue.Wrap("empty fee") diff --git a/x/data-proxy/types/tx.pb.go b/x/data-proxy/types/tx.pb.go index 08a93765..a0b5a40a 100644 --- a/x/data-proxy/types/tx.pb.go +++ b/x/data-proxy/types/tx.pb.go @@ -33,15 +33,21 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // All data required for a new data proxy. type MsgRegisterDataProxy struct { - PayoutAddress string `protobuf:"bytes,1,opt,name=payout_address,json=payoutAddress,proto3" json:"payout_address,omitempty"` - Fee *types.Coin `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` - Memo string `protobuf:"bytes,3,opt,name=memo,proto3" json:"memo,omitempty"` + // admin_address is the address that can update the proxy config. + AdminAddress string `protobuf:"bytes,1,opt,name=admin_address,json=adminAddress,proto3" json:"admin_address,omitempty"` + // payout_address defines the address to which the data proxy fees should be + // transferred. + PayoutAddress string `protobuf:"bytes,2,opt,name=payout_address,json=payoutAddress,proto3" json:"payout_address,omitempty"` + // fee defines the amount in aseda this data-proxy charges when utilised. + Fee *types.Coin `protobuf:"bytes,3,opt,name=fee,proto3" json:"fee,omitempty"` + // memo defines an optional string which is not used by the protocol. + Memo string `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"` // hex encoded bytes as the expected flow already uses hex encoded bytes to go // from the CLI to the browser where the transaction is signed. - PubKey string `protobuf:"bytes,4,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + PubKey string `protobuf:"bytes,5,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` // hex encoded bytes as the expected flow already uses hex encoded bytes to go // from the CLI to the browser where the transaction is signed. - Signature string `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` + Signature string `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` } func (m *MsgRegisterDataProxy) Reset() { *m = MsgRegisterDataProxy{} } @@ -77,6 +83,13 @@ func (m *MsgRegisterDataProxy) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRegisterDataProxy proto.InternalMessageInfo +func (m *MsgRegisterDataProxy) GetAdminAddress() string { + if m != nil { + return m.AdminAddress + } + return "" +} + func (m *MsgRegisterDataProxy) GetPayoutAddress() string { if m != nil { return m.PayoutAddress @@ -156,12 +169,6 @@ type MsgEditDataProxy struct { NewMemo string `protobuf:"bytes,2,opt,name=new_memo,json=newMemo,proto3" json:"new_memo,omitempty"` NewFee *types.Coin `protobuf:"bytes,3,opt,name=new_fee,json=newFee,proto3" json:"new_fee,omitempty"` FeeUpdateDelay uint32 `protobuf:"varint,4,opt,name=fee_update_delay,json=feeUpdateDelay,proto3" json:"fee_update_delay,omitempty"` - // hex encoded bytes as the expected flow already uses hex encoded bytes to go - // from the CLI to the browser where the transaction is signed. - PubKey string `protobuf:"bytes,5,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` - // hex encoded bytes as the expected flow already uses hex encoded bytes to go - // from the CLI to the browser where the transaction is signed. - Signature string `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` } func (m *MsgEditDataProxy) Reset() { *m = MsgEditDataProxy{} } @@ -225,20 +232,6 @@ func (m *MsgEditDataProxy) GetFeeUpdateDelay() uint32 { return 0 } -func (m *MsgEditDataProxy) GetPubKey() string { - if m != nil { - return m.PubKey - } - return "" -} - -func (m *MsgEditDataProxy) GetSignature() string { - if m != nil { - return m.Signature - } - return "" -} - // Returns the height at which the fee update will go into effect. type MsgEditDataProxyResponse struct { UpdateHeight int64 `protobuf:"varint,1,opt,name=update_height,json=updateHeight,proto3" json:"update_height,omitempty"` @@ -388,47 +381,48 @@ func init() { func init() { proto.RegisterFile("sedachain/data_proxy/v1/tx.proto", fileDescriptor_40160e30cd70b841) } var fileDescriptor_40160e30cd70b841 = []byte{ - // 632 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0x4d, 0x4f, 0xd4, 0x40, - 0x18, 0xde, 0xee, 0xc2, 0x22, 0x23, 0x8b, 0x38, 0x21, 0xd9, 0xb2, 0x21, 0x85, 0xac, 0x97, 0x55, - 0xb3, 0xad, 0x8b, 0xc1, 0x18, 0x13, 0x43, 0x44, 0x24, 0x26, 0x66, 0x23, 0xa9, 0xf1, 0xe2, 0xa5, - 0x99, 0x6e, 0x5f, 0x66, 0xab, 0xb4, 0xd3, 0x74, 0xa6, 0x2c, 0xbd, 0xfa, 0x0b, 0x3c, 0x7a, 0xf0, - 0x47, 0x78, 0xf0, 0x47, 0x70, 0x93, 0x78, 0x32, 0x31, 0x31, 0x06, 0x0e, 0xfe, 0x0d, 0xd3, 0x99, - 0x81, 0x65, 0x91, 0xe5, 0xe3, 0x36, 0xf3, 0x3e, 0xcf, 0xfb, 0xf1, 0x3c, 0x9d, 0xbe, 0x68, 0x99, - 0x43, 0x40, 0x7a, 0x7d, 0x12, 0xc6, 0x4e, 0x40, 0x04, 0xf1, 0x92, 0x94, 0xed, 0xe5, 0xce, 0x6e, - 0xc7, 0x11, 0x7b, 0x76, 0x92, 0x32, 0xc1, 0x70, 0xfd, 0x84, 0x61, 0x0f, 0x19, 0xf6, 0x6e, 0xa7, - 0x31, 0x4f, 0x19, 0x65, 0x92, 0xe3, 0x14, 0x27, 0x45, 0x6f, 0x2c, 0xf4, 0x18, 0x8f, 0x18, 0xf7, - 0x14, 0xa0, 0x2e, 0x1a, 0xb2, 0xd4, 0xcd, 0xf1, 0x09, 0x07, 0x67, 0xb7, 0xe3, 0x83, 0x20, 0x1d, - 0xa7, 0xc7, 0xc2, 0x58, 0xe3, 0x75, 0x8d, 0x47, 0x9c, 0x16, 0x13, 0x44, 0x9c, 0x6a, 0xa0, 0x35, - 0x6e, 0xc8, 0x53, 0x03, 0x49, 0x66, 0xf3, 0xbb, 0x81, 0xe6, 0xbb, 0x9c, 0xba, 0x40, 0x43, 0x2e, - 0x20, 0xdd, 0x20, 0x82, 0x6c, 0x15, 0x30, 0x5e, 0x43, 0xb3, 0x09, 0xc9, 0x59, 0x26, 0x3c, 0x12, - 0x04, 0x29, 0x70, 0x6e, 0x1a, 0xcb, 0x46, 0x6b, 0x7a, 0xdd, 0xfc, 0xf1, 0xad, 0x3d, 0xaf, 0xa7, - 0x7c, 0xa6, 0x90, 0x37, 0x22, 0x0d, 0x63, 0xea, 0xd6, 0x14, 0x5f, 0x07, 0xf1, 0x7d, 0x54, 0xd9, - 0x06, 0x30, 0xcb, 0xcb, 0x46, 0xeb, 0xe6, 0xca, 0x82, 0xad, 0x53, 0x0a, 0x29, 0xb6, 0x96, 0x62, - 0x3f, 0x67, 0x61, 0xec, 0x16, 0x2c, 0x8c, 0xd1, 0x44, 0x04, 0x11, 0x33, 0x2b, 0x45, 0x0f, 0x57, - 0x9e, 0x71, 0x1d, 0x4d, 0x25, 0x99, 0xef, 0x7d, 0x80, 0xdc, 0x9c, 0x90, 0xe1, 0x6a, 0x92, 0xf9, - 0xaf, 0x20, 0xc7, 0x8b, 0x68, 0x9a, 0x87, 0x34, 0x26, 0x22, 0x4b, 0xc1, 0x9c, 0x94, 0xd0, 0x30, -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 0xfb, 0xf5, 0xde, 0xb0, 0x5c, 0x73, 0x01, 0xd5, - 0xcf, 0x4c, 0x76, 0x2c, 0x6d, 0xe5, 0x57, 0x19, 0x55, 0xba, 0x9c, 0xe2, 0x1c, 0xdd, 0xfe, 0xff, - 0x5f, 0x68, 0x8f, 0x6d, 0x7b, 0xde, 0x4b, 0x6b, 0xac, 0x5e, 0x8b, 0x7e, 0xe2, 0x6e, 0x84, 0x6a, - 0xa3, 0x8f, 0xf2, 0xee, 0x45, 0x75, 0x46, 0xa8, 0x8d, 0xce, 0x95, 0xa9, 0x27, 0xed, 0xde, 0xa3, - 0x99, 0x91, 0x6f, 0xd4, 0xba, 0xa8, 0xc4, 0x69, 0x66, 0xe3, 0xc1, 0x55, 0x99, 0xc7, 0xbd, 0xd6, - 0x5f, 0xef, 0x1f, 0x5a, 0xc6, 0xc1, 0xa1, 0x65, 0xfc, 0x39, 0xb4, 0x8c, 0x4f, 0x47, 0x56, 0xe9, - 0xe0, 0xc8, 0x2a, 0xfd, 0x3c, 0xb2, 0x4a, 0xef, 0x56, 0x69, 0x28, 0xfa, 0x99, 0x6f, 0xf7, 0x58, - 0xe4, 0x14, 0x55, 0xe5, 0x56, 0xea, 0xb1, 0x1d, 0x79, 0x69, 0xab, 0x15, 0xb6, 0x27, 0xd7, 0x56, - 0x5b, 0x2d, 0x31, 0x91, 0x27, 0xc0, 0xfd, 0xaa, 0xe4, 0x3d, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, - 0x89, 0xd6, 0xc5, 0x82, 0x8e, 0x05, 0x00, 0x00, + // 649 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcf, 0x6e, 0xd3, 0x4e, + 0x10, 0x8e, 0x9b, 0xfe, 0xd2, 0x5f, 0xa7, 0x4d, 0x29, 0xab, 0x4a, 0x71, 0xa3, 0xca, 0xad, 0xc2, + 0x25, 0x80, 0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d, 0x9f, 0x18, 0xda, 0xcf, 0x13, 0x43, 0xfb, 0x70, 0x6a, 0x94, + 0x8e, 0x4f, 0x8d, 0xd2, 0xb7, 0x53, 0xa3, 0xf4, 0x66, 0x8d, 0xf9, 0xb2, 0x97, 0xb8, 0x66, 0x97, + 0x07, 0x56, 0xa6, 0xaa, 0x36, 0x56, 0x97, 0xef, 0xab, 0x4b, 0x2b, 0x5f, 0x6f, 0x87, 0x6a, 0xa5, + 0xb5, 0xf2, 0x05, 0x27, 0xd3, 0x08, 0x85, 0x5b, 0x51, 0xbc, 0x87, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x12, 0x2b, 0x00, 0x8f, 0xaa, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -615,21 +609,21 @@ func (m *MsgRegisterDataProxy) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Signature) i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0x32 } if len(m.PubKey) > 0 { i -= len(m.PubKey) copy(dAtA[i:], m.PubKey) i = encodeVarintTx(dAtA, i, uint64(len(m.PubKey))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } if len(m.Memo) > 0 { i -= len(m.Memo) copy(dAtA[i:], m.Memo) i = encodeVarintTx(dAtA, i, uint64(len(m.Memo))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if m.Fee != nil { { @@ -641,13 +635,20 @@ func (m *MsgRegisterDataProxy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } if len(m.PayoutAddress) > 0 { i -= len(m.PayoutAddress) copy(dAtA[i:], m.PayoutAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.PayoutAddress))) i-- + dAtA[i] = 0x12 + } + if len(m.AdminAddress) > 0 { + i -= len(m.AdminAddress) + copy(dAtA[i:], m.AdminAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.AdminAddress))) + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -696,20 +697,6 @@ func (m *MsgEditDataProxy) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x32 - } - if len(m.PubKey) > 0 { - i -= len(m.PubKey) - copy(dAtA[i:], m.PubKey) - i = encodeVarintTx(dAtA, i, uint64(len(m.PubKey))) - i-- - dAtA[i] = 0x2a - } if m.FeeUpdateDelay != 0 { i = encodeVarintTx(dAtA, i, uint64(m.FeeUpdateDelay)) i-- @@ -852,6 +839,10 @@ func (m *MsgRegisterDataProxy) Size() (n int) { } var l int _ = l + l = len(m.AdminAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } l = len(m.PayoutAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -905,14 +896,6 @@ func (m *MsgEditDataProxy) Size() (n int) { if m.FeeUpdateDelay != 0 { n += 1 + sovTx(uint64(m.FeeUpdateDelay)) } - l = len(m.PubKey) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } return n } @@ -988,6 +971,38 @@ func (m *MsgRegisterDataProxy) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdminAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AdminAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PayoutAddress", wireType) } @@ -1019,7 +1034,7 @@ func (m *MsgRegisterDataProxy) Unmarshal(dAtA []byte) error { } m.PayoutAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) } @@ -1055,7 +1070,7 @@ func (m *MsgRegisterDataProxy) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType) } @@ -1087,7 +1102,7 @@ func (m *MsgRegisterDataProxy) Unmarshal(dAtA []byte) error { } m.Memo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) } @@ -1119,7 +1134,7 @@ func (m *MsgRegisterDataProxy) Unmarshal(dAtA []byte) error { } m.PubKey = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) } @@ -1370,70 +1385,6 @@ func (m *MsgEditDataProxy) Unmarshal(dAtA []byte) error { break } } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - 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 ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])