From e26db4730e9f998e20315958867befe9d708eced Mon Sep 17 00:00:00 2001 From: nhannamsiu Date: Tue, 31 May 2022 15:56:24 +0700 Subject: [PATCH] Add new wasmx module, update proto --- Makefile | 3 + chain/exchange/types/wasm_trade_summary.go | 103 ++ chain/wasmx/types/codec.go | 45 + chain/wasmx/types/custom_execution.go | 36 + chain/wasmx/types/errors.go | 10 + chain/wasmx/types/exec_msgs.go | 165 +++ chain/wasmx/types/expected_keepers.go | 23 + chain/wasmx/types/genesis.go | 18 + chain/wasmx/types/genesis.pb.go | 323 +++++ chain/wasmx/types/key.go | 27 + chain/wasmx/types/msgs.go | 3 + chain/wasmx/types/params.go | 159 +++ chain/wasmx/types/paramset.go | 26 + chain/wasmx/types/proposal.go | 92 ++ chain/wasmx/types/query.pb.go | 878 +++++++++++++ chain/wasmx/types/tx.pb.go | 82 ++ chain/wasmx/types/wasmx.pb.go | 1354 ++++++++++++++++++++ 17 files changed, 3347 insertions(+) create mode 100644 chain/exchange/types/wasm_trade_summary.go create mode 100644 chain/wasmx/types/codec.go create mode 100644 chain/wasmx/types/custom_execution.go create mode 100644 chain/wasmx/types/errors.go create mode 100644 chain/wasmx/types/exec_msgs.go create mode 100644 chain/wasmx/types/expected_keepers.go create mode 100644 chain/wasmx/types/genesis.go create mode 100644 chain/wasmx/types/genesis.pb.go create mode 100644 chain/wasmx/types/key.go create mode 100644 chain/wasmx/types/msgs.go create mode 100644 chain/wasmx/types/params.go create mode 100644 chain/wasmx/types/paramset.go create mode 100644 chain/wasmx/types/proposal.go create mode 100644 chain/wasmx/types/query.pb.go create mode 100644 chain/wasmx/types/tx.pb.go create mode 100644 chain/wasmx/types/wasmx.pb.go diff --git a/Makefile b/Makefile index 4f4033cb..cd650683 100644 --- a/Makefile +++ b/Makefile @@ -37,5 +37,8 @@ copy-chain-types: rm -rf chain/oracle/types/*test.go rm -rf chain/oracle/types/*gw.go cp ../injective-core/injective-chain/modules/peggy/types/*.go chain/peggy/types rm -rf chain/peggy/types/*test.go rm -rf chain/peggy/types/*gw.go + cp ../injective-core/injective-chain/modules/wasmx/types/*.go chain/wasmx/types + rm -rf chain/wasmx/types/*test.go rm -rf chain/wasmx/types/*gw.go + echo "👉 Replace injective-core/injective-chain/modules with sdk-go/chain" echo "👉 Replace injective-core/injective-chain/types with sdk-go/chain/types" diff --git a/chain/exchange/types/wasm_trade_summary.go b/chain/exchange/types/wasm_trade_summary.go new file mode 100644 index 00000000..4c3a0a28 --- /dev/null +++ b/chain/exchange/types/wasm_trade_summary.go @@ -0,0 +1,103 @@ +package types + +import ( + "bytes" + "sort" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" +) + +type MarketSummary struct { + TotalUserQuantity sdk.Dec + TotalContractQuantity sdk.Dec + TotalUserMargin sdk.Dec + TotalContractMargin sdk.Dec + netQuantity sdk.Dec +} + +func NewMarketSummary() *MarketSummary { + return &MarketSummary{ + TotalUserQuantity: sdk.ZeroDec(), + TotalContractQuantity: sdk.ZeroDec(), + TotalUserMargin: sdk.ZeroDec(), + TotalContractMargin: sdk.ZeroDec(), + netQuantity: sdk.ZeroDec(), + } +} + +func NewSyntheticTradeActionSummary() *SyntheticTradeActionSummary { + return &SyntheticTradeActionSummary{ + MarketSummary: make(map[common.Hash]*MarketSummary), + MarketIDs: make([]common.Hash, 0), + } +} + +type SyntheticTradeActionSummary struct { + MarketSummary map[common.Hash]*MarketSummary + MarketIDs []common.Hash +} + +func (s *SyntheticTradeActionSummary) GetMarketIDs() []common.Hash { + var marketIDs []common.Hash + for marketID := range s.MarketSummary { + marketIDs = append(marketIDs, marketID) + } + + sort.SliceStable(marketIDs, func(i, j int) bool { + return bytes.Compare(marketIDs[i].Bytes(), marketIDs[j].Bytes()) < 0 + }) + s.MarketIDs = marketIDs + return marketIDs +} + +func (s SyntheticTradeActionSummary) Update(t *SyntheticTrade, isForUser bool) { + if _, ok := s.MarketSummary[t.MarketID]; !ok { + s.MarketSummary[t.MarketID] = NewMarketSummary() + } + summary := s.MarketSummary[t.MarketID] + + if t.IsBuy { + summary.netQuantity = summary.netQuantity.Add(t.Quantity) + } else { + summary.netQuantity = summary.netQuantity.Sub(t.Quantity) + } + + if isForUser { + summary.TotalUserQuantity = summary.TotalUserQuantity.Add(t.Quantity) + summary.TotalUserMargin = summary.TotalUserMargin.Add(t.Margin) + } else { + summary.TotalContractQuantity = summary.TotalContractQuantity.Add(t.Quantity) + summary.TotalContractMargin = summary.TotalContractMargin.Add(t.Margin) + } +} + +// IsValid checks that all the net quantities are zero +func (s SyntheticTradeActionSummary) IsValid() bool { + for _, v := range s.MarketSummary { + if !v.netQuantity.IsZero() { + return false + } + } + return true +} + +func (a *SyntheticTradeAction) Summarize() (*SyntheticTradeActionSummary, error) { + summary := NewSyntheticTradeActionSummary() + + for _, t := range a.UserTrades { + summary.Update(t, true) + } + + for _, t := range a.ContractTrades { + summary.Update(t, false) + } + + // ensure that sum(buy quantity) == sum(sell quantity) for all markets + if !summary.IsValid() { + return nil, ErrInvalidQuantity + } + + summary.GetMarketIDs() + return summary, nil +} diff --git a/chain/wasmx/types/codec.go b/chain/wasmx/types/codec.go new file mode 100644 index 00000000..5aafa120 --- /dev/null +++ b/chain/wasmx/types/codec.go @@ -0,0 +1,45 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/types/msgservice" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// RegisterLegacyAminoCodec registers the necessary x/wasmx interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&ContractRegistrationRequestProposal{}, "wasmx/ContractRegistrationRequestProposal", nil) + cdc.RegisterConcrete(&BatchContractRegistrationRequestProposal{}, "wasmx/BatchContractRegistrationRequestProposal", nil) + +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + registry.RegisterImplementations( + (*govtypes.Content)(nil), + &ContractRegistrationRequestProposal{}, + &BatchContractRegistrationRequestProposal{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + + // ModuleCdc references the global x/wasmx module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/wasmx and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} diff --git a/chain/wasmx/types/custom_execution.go b/chain/wasmx/types/custom_execution.go new file mode 100644 index 00000000..45934a07 --- /dev/null +++ b/chain/wasmx/types/custom_execution.go @@ -0,0 +1,36 @@ +package types + +import ( + "encoding/json" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +type InjectiveExecMsg struct { + ExecutionData ExecutionData `json:"injective_exec"` +} + +type ExecutionData struct { + Origin string `json:"origin"` + Name string `json:"name"` + Args interface{} `json:"args"` +} + +func NewInjectiveExecMsg(origin sdk.AccAddress, data string) (*InjectiveExecMsg, error) { + var e ExecutionData + if err := json.Unmarshal([]byte(data), &e); err != nil { + return nil, sdkerrors.Wrap(err, data) + } + + if e.Origin == "" && origin.Empty() { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "origin address is empty") + } + + // override e.Origin for safety + e.Origin = origin.String() + + return &InjectiveExecMsg{ + ExecutionData: e, + }, nil +} diff --git a/chain/wasmx/types/errors.go b/chain/wasmx/types/errors.go new file mode 100644 index 00000000..6f65fe70 --- /dev/null +++ b/chain/wasmx/types/errors.go @@ -0,0 +1,10 @@ +package types + +import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + +var ( + ErrInvalidGasLimit = sdkerrors.Register(ModuleName, 1, "invalid gas limit") + ErrInvalidGasPrice = sdkerrors.Register(ModuleName, 2, "invalid gas price") + ErrInvalidContractAddress = sdkerrors.Register(ModuleName, 3, "invalid contract address") + ErrAlreadyRegistered = sdkerrors.Register(ModuleName, 4, "contract already registered") +) diff --git a/chain/wasmx/types/exec_msgs.go b/chain/wasmx/types/exec_msgs.go new file mode 100644 index 00000000..e962d24d --- /dev/null +++ b/chain/wasmx/types/exec_msgs.go @@ -0,0 +1,165 @@ +package types + +import ( + "encoding/json" + "fmt" + "sort" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func NewRegistryRegisterMsg(req *ContractRegistrationRequest) RegistryRegisterMsg { + return RegistryRegisterMsg{ + Register: &RegisterMsg{ + GasLimit: req.GasLimit, + ContractAddress: req.ContractAddress, + GasPrice: req.GasPrice.String(), + IsExecutable: true, + }, + } +} + +type RegistryRegisterMsg struct { + Register *RegisterMsg `json:"register,omitempty"` +} + +type RegisterMsg struct { + GasLimit uint64 `json:"gas_limit"` + ContractAddress string `json:"contract_address"` + GasPrice string `json:"gas_price"` + IsExecutable bool `json:"is_executable"` +} + +func NewBeginBlockerExecMsg() ([]byte, error) { + // Construct Exec message + beginBlocker := CWBeginBlockerExecMsg{BeginBlockerMsg: &BeginBlockerMsg{}} + + //execMsg := []byte(`{"begin_blocker":{}}`) + execMsg, err := json.Marshal(beginBlocker) + if err != nil { + fmt.Println("Register marshal failed") + return nil, err + } + + return execMsg, nil +} + +type CWBeginBlockerExecMsg struct { + BeginBlockerMsg *BeginBlockerMsg `json:"begin_blocker,omitempty"` +} + +type BeginBlockerMsg struct { +} + +func NewRegistryDeactivateMsg(contractAddress string) ([]byte, error) { + // Construct Exec message + deActivateMsg := RegistryDeActivateMsg{RegistryDeActivate: &RegistryDeActivate{ContractAddress: contractAddress}} + + //execMsg := []byte('{"de_activate":{"contract_address":"inj1nc5tatafv6eyq7llkr2gv50ff9e22mnfhg8yh3"}}') + execMsg, err := json.Marshal(deActivateMsg) + if err != nil { + fmt.Println("Register marshal failed") + return nil, err + } + + return execMsg, nil +} + +type RegistryDeActivateMsg struct { + RegistryDeActivate *RegistryDeActivate `json:"de_activate,omitempty"` +} + +type RegistryDeActivate struct { + ContractAddress string `json:"contract_address"` +} + +// NewRegistryContractQuery constructs the registyr Exec message +func NewRegistryContractQuery() ([]byte, error) { + contractQuery := RegistryContractQueryMsg{QueryContractsMsg: &QueryContractsMsg{}} + + queryMsg, err := json.Marshal(contractQuery) + if err != nil { + fmt.Println("Register marshal failed") + return nil, err + } + + return queryMsg, nil +} + +type RegistryContractQueryMsg struct { + QueryContractsMsg *QueryContractsMsg `json:"get_contracts,omitempty"` +} + +type QueryContractsMsg struct { +} + +// NewRegistryActiveContractQuery constructs the registry active contracts query message +func NewRegistryActiveContractQuery() ([]byte, error) { + contractQuery := RegistryActiveContractQueryMsg{QueryActiveContractsMsg: &QueryActiveContractsMsg{}} + + // queryData := []byte("{\"get_active_contracts\": {}}") + queryMsg, err := json.Marshal(contractQuery) + if err != nil { + fmt.Println("Register marshal failed") + return nil, err + } + + return queryMsg, nil +} + +type RegistryActiveContractQueryMsg struct { + QueryActiveContractsMsg *QueryActiveContractsMsg `json:"get_active_contracts,omitempty"` +} + +type QueryActiveContractsMsg struct { +} + +type RawContractExecutionParams struct { + Address string `json:"address"` + GasLimit uint64 `json:"gas_limit"` + GasPrice string `json:"gas_price"` + IsExecutable bool `json:"is_executable"` +} + +func (r *RawContractExecutionParams) ToContractExecutionParams() (p *ContractExecutionParams, err error) { + addr, err := sdk.AccAddressFromBech32(r.Address) + if err != nil { + return nil, err + } + + gasPrice, ok := sdk.NewIntFromString(r.GasPrice) + if !ok { + return nil, ErrInvalidGasPrice + } + + return &ContractExecutionParams{ + Address: addr, + GasLimit: r.GasLimit, + GasPrice: gasPrice, + }, nil +} + +type ContractExecutionParams struct { + Address sdk.AccAddress + GasLimit uint64 + GasPrice sdk.Int + IsExecutable bool +} + +// GetSortedContractExecutionParams returns the ContractExecutionParams sorted by descending order of gas price +func GetSortedContractExecutionParams(contractExecutionList []RawContractExecutionParams) ([]*ContractExecutionParams, error) { + paramList := make([]*ContractExecutionParams, len(contractExecutionList)) + for idx, elem := range contractExecutionList { + if v, err := elem.ToContractExecutionParams(); err != nil { + return nil, err + } else { + paramList[idx] = v + } + } + + sort.SliceStable(paramList, func(i, j int) bool { + return paramList[i].GasPrice.GT(paramList[j].GasPrice) + }) + + return paramList, nil +} diff --git a/chain/wasmx/types/expected_keepers.go b/chain/wasmx/types/expected_keepers.go new file mode 100644 index 00000000..14069dd0 --- /dev/null +++ b/chain/wasmx/types/expected_keepers.go @@ -0,0 +1,23 @@ +package types + +import ( + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper defines the expected bank keeper methods +type BankKeeper interface { + GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error +} + +type WasmViewKeeper interface { + wasmtypes.ViewKeeper +} + +type WasmContractOpsKeeper interface { + wasmtypes.ContractOpsKeeper +} diff --git a/chain/wasmx/types/genesis.go b/chain/wasmx/types/genesis.go new file mode 100644 index 00000000..3739aca4 --- /dev/null +++ b/chain/wasmx/types/genesis.go @@ -0,0 +1,18 @@ +package types + +func NewGenesisState() GenesisState { + return GenesisState{} +} + +func (gs GenesisState) Validate() error { + if err := gs.Params.Validate(); err != nil { + return err + } + return nil +} + +func DefaultGenesisState() *GenesisState { + return &GenesisState{ + Params: DefaultParams(), + } +} diff --git a/chain/wasmx/types/genesis.pb.go b/chain/wasmx/types/genesis.pb.go new file mode 100644 index 00000000..57ebc6af --- /dev/null +++ b/chain/wasmx/types/genesis.pb.go @@ -0,0 +1,323 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: injective/wasmx/v1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the wasmx module's genesis state. +type GenesisState struct { + // params defines all the parameters of related to wasmx. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_8642938473ffc6e5, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "injective.wasmx.v1.GenesisState") +} + +func init() { proto.RegisterFile("injective/wasmx/v1/genesis.proto", fileDescriptor_8642938473ffc6e5) } + +var fileDescriptor_8642938473ffc6e5 = []byte{ + // 217 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0xcc, 0xcb, 0x4a, + 0x4d, 0x2e, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0x4f, 0x2c, 0xce, 0xad, 0xd0, 0x2f, 0x33, 0xd4, 0x4f, + 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xab, + 0xd0, 0x03, 0xab, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0xc3, 0xa2, 0x0b, 0x22, 0x09, 0xd6, 0x23, 0x25, + 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x66, 0xea, 0x83, 0x58, 0x10, 0x51, 0x25, 0x0f, 0x2e, 0x1e, 0x77, + 0x88, 0xd1, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x16, 0x5c, 0x6c, 0x05, 0x89, 0x45, 0x89, 0xb9, + 0xc5, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x52, 0x7a, 0x98, 0x56, 0xe9, 0x05, 0x80, 0x55, + 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0xef, 0x94, 0x7a, 0xe2, 0x91, 0x1c, 0xe3, + 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, + 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xde, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0xb9, 0xfa, 0x9e, 0x30, 0xd3, 0x7c, 0x12, 0x93, 0x8a, 0xf5, 0xe1, 0x66, 0xeb, 0x26, 0xe7, 0x17, + 0xa5, 0x22, 0x73, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0x73, 0xf3, 0x53, 0x4a, 0x73, 0x52, 0x8b, 0xa1, + 0xfe, 0x29, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xdb, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0xb2, 0xaf, 0xea, 0xd7, 0x25, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/chain/wasmx/types/key.go b/chain/wasmx/types/key.go new file mode 100644 index 00000000..dbe2f5d5 --- /dev/null +++ b/chain/wasmx/types/key.go @@ -0,0 +1,27 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + // ModuleName is set to xwasm and not wasmx to avoid Potential key collision between KVStores + // (see assertNoPrefix in cosmos-sdk/types/store.go) + ModuleName = "xwasm" + StoreKey = ModuleName + TStoreKey = "transient_xwasm" +) + +var ( + // Keys for store prefixes + BidsKey = []byte{0x01} + + // Keys for Smart contract execution + ContractExecutionRequestIDKey = []byte{0x02} // key to the smart contract execution request ID + LatestSmartContractRequestIDKey = []byte{0x03} // key to the latest smart contract request ID + +) + +func GetContractExecutionRequestIDKey(requestID uint64) []byte { + return append(ContractExecutionRequestIDKey, sdk.Uint64ToBigEndian(requestID)...) +} diff --git a/chain/wasmx/types/msgs.go b/chain/wasmx/types/msgs.go new file mode 100644 index 00000000..bd6a9389 --- /dev/null +++ b/chain/wasmx/types/msgs.go @@ -0,0 +1,3 @@ +package types + +const RouterKey = ModuleName diff --git a/chain/wasmx/types/params.go b/chain/wasmx/types/params.go new file mode 100644 index 00000000..284a3e24 --- /dev/null +++ b/chain/wasmx/types/params.go @@ -0,0 +1,159 @@ +package types + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var _ paramtypes.ParamSet = &Params{} + +// Wasmx params default values +var ( + DefaultIsExecutionEnabled = false + DefaultMaxBeginBlockTotalGas uint64 = 42_000_000 // 42M + DefaultMaxContractGasLimit uint64 = DefaultMaxBeginBlockTotalGas / 12 // 3.5M + DefaultMinGasPrice sdk.Int = sdk.NewInt(1_000_000_000) // 1B +) + +// Parameter keys +var ( + KeyIsExecutionEnabled = []byte("IsExecutionEnabled") + KeyRegistryContract = []byte("RegistryContract") + KeyMaxBeginBlockTotalGas = []byte("MaxBeginBlockTotalGas") + KeyMaxContractGasLimit = []byte("MaxContractGasLimit") + KeyMinGasPrice = []byte("MinGasPrice") +) + +// ParamKeyTable returns the parameter key table. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// NewParams creates a new Params instance +func NewParams( + isExecutionEnabled bool, + registryContract string, + maxBeginBlockTotalGas uint64, + maxContractGasLimit uint64, + minGasPrice sdk.Int, +) Params { + return Params{ + IsExecutionEnabled: isExecutionEnabled, + RegistryContract: registryContract, + MaxBeginBlockTotalGas: maxBeginBlockTotalGas, + MaxContractGasLimit: maxContractGasLimit, + MinGasPrice: minGasPrice, + } +} + +// ParamSetPairs returns the parameter set pairs. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyRegistryContract, &p.RegistryContract, validateRegistryContract), + paramtypes.NewParamSetPair(KeyMinGasPrice, &p.MinGasPrice, validateMinGasPrice), + paramtypes.NewParamSetPair(KeyIsExecutionEnabled, &p.IsExecutionEnabled, validateIsExecutionEnabled), + paramtypes.NewParamSetPair(KeyMaxBeginBlockTotalGas, &p.MaxBeginBlockTotalGas, validateMaxBeginBlockTotalGas), + paramtypes.NewParamSetPair(KeyMaxContractGasLimit, &p.MaxContractGasLimit, validateMaxContractGasLimit), + } +} + +// DefaultParams returns a default set of parameters. +func DefaultParams() Params { + return Params{ + IsExecutionEnabled: DefaultIsExecutionEnabled, + RegistryContract: "", + MaxBeginBlockTotalGas: DefaultMaxBeginBlockTotalGas, + MaxContractGasLimit: DefaultMaxContractGasLimit, + MinGasPrice: DefaultMinGasPrice, + } +} + +// Validate performs basic validation on wasmx parameters. +func (p Params) Validate() error { + if err := validateIsExecutionEnabled(p.IsExecutionEnabled); err != nil { + return err + } + + if err := validateRegistryContract(p.RegistryContract); err != nil { + return err + } + + if err := validateMaxBeginBlockTotalGas(p.MaxBeginBlockTotalGas); err != nil { + return err + } + + if err := validateMaxContractGasLimit(p.MaxContractGasLimit); err != nil { + return err + } + + if err := validateMinGasPrice(p.MinGasPrice); err != nil { + return err + } + + return nil +} + +func validateMaxBeginBlockTotalGas(i interface{}) error { + v, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == 0 { + return fmt.Errorf("MaxBeginBlockTotalGas must be positive: %d", v) + } + + return nil +} + +func validateMaxContractGasLimit(i interface{}) error { + v, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == 0 { + return fmt.Errorf("MaxContractGasLimit must be positive: %d", v) + } + return nil +} + +func validateIsExecutionEnabled(i interface{}) error { + _, ok := i.(bool) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} + +func validateMinGasPrice(i interface{}) error { + v, ok := i.(sdk.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNil() || !v.IsPositive() { + return fmt.Errorf("MinGasPrice must be positive: %s", v.String()) + } + return nil +} + +func validateRegistryContract(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v == "" { + return nil + } + + if _, err := sdk.AccAddressFromBech32(v); err != nil { + return err + } + + return nil +} diff --git a/chain/wasmx/types/paramset.go b/chain/wasmx/types/paramset.go new file mode 100644 index 00000000..80d0852b --- /dev/null +++ b/chain/wasmx/types/paramset.go @@ -0,0 +1,26 @@ +package types + +type ( + ValueValidatorFn func(value interface{}) error + + // ParamSetPair is used for associating paramsubspace key and field of param + // structs. + ParamSetPair struct { + Key []byte + Value interface{} + ValidatorFn ValueValidatorFn + } +) + +// NewParamSetPair creates a new ParamSetPair instance. +func NewParamSetPair(key []byte, value interface{}, vfn ValueValidatorFn) ParamSetPair { + return ParamSetPair{key, value, vfn} +} + +// ParamSetPairs Slice of KeyFieldPair +type ParamSetPairs []ParamSetPair + +// ParamSet defines an interface for structs containing parameters for a module +type ParamSet interface { + ParamSetPairs() ParamSetPairs +} diff --git a/chain/wasmx/types/proposal.go b/chain/wasmx/types/proposal.go new file mode 100644 index 00000000..8d750981 --- /dev/null +++ b/chain/wasmx/types/proposal.go @@ -0,0 +1,92 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + gov "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// constants +const ( + ProposalContractRegistrationRequest string = "ProposalContractRegistrationRequest" + ProposalBatchContractRegistrationRequest string = "ProposalBatchContractRegistrationRequest" +) + +func init() { + gov.RegisterProposalType(ProposalContractRegistrationRequest) + gov.RegisterProposalTypeCodec(&ContractRegistrationRequestProposal{}, "injective/ContractRegistrationRequestProposal") + gov.RegisterProposalType(ProposalBatchContractRegistrationRequest) + gov.RegisterProposalTypeCodec(&BatchContractRegistrationRequestProposal{}, "injective/BatchContractRegistrationRequestProposal") + +} + +// NewContractRegistrationRequestProposal returns new instance of ContractRegistrationRequestProposal +func NewContractRegistrationRequestProposal(title, description string, ContractRegistrationRequest ContractRegistrationRequest) *ContractRegistrationRequestProposal { + return &ContractRegistrationRequestProposal{ + Title: title, + Description: description, + ContractRegistrationRequest: ContractRegistrationRequest, + } +} + +// Implements Proposal Interface +var _ gov.Content = &ContractRegistrationRequestProposal{} +var _ gov.Content = &BatchContractRegistrationRequestProposal{} + +// GetTitle returns the title of this proposal. +func (p *ContractRegistrationRequestProposal) GetTitle() string { + return p.Title +} + +// GetDescription returns the description of this proposal. +func (p *ContractRegistrationRequestProposal) GetDescription() string { + return p.Description +} + +// ProposalRoute returns router key of this proposal. +func (p *ContractRegistrationRequestProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type of this proposal. +func (p *ContractRegistrationRequestProposal) ProposalType() string { + return ProposalContractRegistrationRequest +} + +// ValidateBasic returns ValidateBasic result of this proposal. +func (p *ContractRegistrationRequestProposal) ValidateBasic() error { + // Check if contract address is valid + if _, err := sdk.AccAddressFromBech32(p.ContractRegistrationRequest.ContractAddress); err != nil { + return sdkerrors.Wrapf(ErrInvalidContractAddress, "ContractRegistrationRequestProposal: Error parsing registry contract address %s", err.Error()) + } + + return gov.ValidateAbstract(p) +} + +// GetTitle returns the title of this proposal. +func (p *BatchContractRegistrationRequestProposal) GetTitle() string { + return p.Title +} + +// GetDescription returns the description of this proposal. +func (p *BatchContractRegistrationRequestProposal) GetDescription() string { + return p.Description +} + +// ProposalRoute returns router key of this proposal. +func (p *BatchContractRegistrationRequestProposal) ProposalRoute() string { return RouterKey } + +// ProposalType returns proposal type of this proposal. +func (p *BatchContractRegistrationRequestProposal) ProposalType() string { + return ProposalBatchContractRegistrationRequest +} + +// ValidateBasic returns ValidateBasic result of this proposal. +func (p *BatchContractRegistrationRequestProposal) ValidateBasic() error { + for _, req := range p.ContractRegistrationRequests { + // Check if contract address is valid + if _, err := sdk.AccAddressFromBech32(req.ContractAddress); err != nil { + return sdkerrors.Wrapf(ErrInvalidContractAddress, "BatchContractRegistrationRequestProposal: Error parsing registry contract address %s", err.Error()) + } + } + + return gov.ValidateAbstract(p) +} diff --git a/chain/wasmx/types/query.pb.go b/chain/wasmx/types/query.pb.go new file mode 100644 index 00000000..fe4ed00f --- /dev/null +++ b/chain/wasmx/types/query.pb.go @@ -0,0 +1,878 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: injective/wasmx/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryWasmxParamsRequest is the request type for the Query/WasmxParams RPC method. +type QueryWasmxParamsRequest struct { +} + +func (m *QueryWasmxParamsRequest) Reset() { *m = QueryWasmxParamsRequest{} } +func (m *QueryWasmxParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryWasmxParamsRequest) ProtoMessage() {} +func (*QueryWasmxParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_660c5209971a3cd4, []int{0} +} +func (m *QueryWasmxParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryWasmxParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWasmxParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryWasmxParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWasmxParamsRequest.Merge(m, src) +} +func (m *QueryWasmxParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryWasmxParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWasmxParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWasmxParamsRequest proto.InternalMessageInfo + +// QueryWasmxParamsRequest is the response type for the Query/WasmxParams RPC method. +type QueryWasmxParamsResponse struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryWasmxParamsResponse) Reset() { *m = QueryWasmxParamsResponse{} } +func (m *QueryWasmxParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryWasmxParamsResponse) ProtoMessage() {} +func (*QueryWasmxParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_660c5209971a3cd4, []int{1} +} +func (m *QueryWasmxParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryWasmxParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryWasmxParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryWasmxParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryWasmxParamsResponse.Merge(m, src) +} +func (m *QueryWasmxParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryWasmxParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryWasmxParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryWasmxParamsResponse proto.InternalMessageInfo + +func (m *QueryWasmxParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// QueryModuleStateRequest is the request type for the Query/WasmxModuleState RPC method. +type QueryModuleStateRequest struct { +} + +func (m *QueryModuleStateRequest) Reset() { *m = QueryModuleStateRequest{} } +func (m *QueryModuleStateRequest) String() string { return proto.CompactTextString(m) } +func (*QueryModuleStateRequest) ProtoMessage() {} +func (*QueryModuleStateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_660c5209971a3cd4, []int{2} +} +func (m *QueryModuleStateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryModuleStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryModuleStateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryModuleStateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryModuleStateRequest.Merge(m, src) +} +func (m *QueryModuleStateRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryModuleStateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryModuleStateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryModuleStateRequest proto.InternalMessageInfo + +// QueryModuleStateResponse is the response type for the Query/WasmxModuleState RPC method. +type QueryModuleStateResponse struct { + State *GenesisState `protobuf:"bytes,1,opt,name=state,proto3" json:"state,omitempty"` +} + +func (m *QueryModuleStateResponse) Reset() { *m = QueryModuleStateResponse{} } +func (m *QueryModuleStateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryModuleStateResponse) ProtoMessage() {} +func (*QueryModuleStateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_660c5209971a3cd4, []int{3} +} +func (m *QueryModuleStateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryModuleStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryModuleStateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryModuleStateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryModuleStateResponse.Merge(m, src) +} +func (m *QueryModuleStateResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryModuleStateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryModuleStateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryModuleStateResponse proto.InternalMessageInfo + +func (m *QueryModuleStateResponse) GetState() *GenesisState { + if m != nil { + return m.State + } + return nil +} + +func init() { + proto.RegisterType((*QueryWasmxParamsRequest)(nil), "injective.wasmx.v1.QueryWasmxParamsRequest") + proto.RegisterType((*QueryWasmxParamsResponse)(nil), "injective.wasmx.v1.QueryWasmxParamsResponse") + proto.RegisterType((*QueryModuleStateRequest)(nil), "injective.wasmx.v1.QueryModuleStateRequest") + proto.RegisterType((*QueryModuleStateResponse)(nil), "injective.wasmx.v1.QueryModuleStateResponse") +} + +func init() { proto.RegisterFile("injective/wasmx/v1/query.proto", fileDescriptor_660c5209971a3cd4) } + +var fileDescriptor_660c5209971a3cd4 = []byte{ + // 383 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xcd, 0x4a, 0xeb, 0x40, + 0x14, 0x4e, 0xca, 0x6d, 0x17, 0xd3, 0xcd, 0x65, 0xb8, 0x70, 0x6b, 0x28, 0x31, 0x64, 0x55, 0x50, + 0x33, 0xb4, 0x82, 0xb8, 0xee, 0x46, 0x44, 0x05, 0xad, 0x82, 0xe0, 0x46, 0xa6, 0xf5, 0x90, 0x46, + 0x9a, 0x4c, 0x9a, 0x99, 0x54, 0xbb, 0x75, 0xed, 0x42, 0x70, 0xe1, 0x6b, 0xf8, 0x18, 0x5d, 0x16, + 0xdc, 0xb8, 0x12, 0x69, 0x7d, 0x10, 0xc9, 0x4c, 0x5a, 0x2b, 0x1d, 0x8b, 0xbb, 0xe9, 0xf9, 0xce, + 0xf7, 0x73, 0xbe, 0x06, 0xd9, 0x41, 0x74, 0x0d, 0x1d, 0x11, 0x0c, 0x80, 0xdc, 0x50, 0x1e, 0xde, + 0x92, 0x41, 0x9d, 0xf4, 0x53, 0x48, 0x86, 0x5e, 0x9c, 0x30, 0xc1, 0x30, 0x9e, 0xe3, 0x9e, 0xc4, + 0xbd, 0x41, 0xdd, 0xaa, 0xfa, 0x8c, 0xf9, 0x3d, 0x20, 0x34, 0x0e, 0x08, 0x8d, 0x22, 0x26, 0xa8, + 0x08, 0x58, 0xc4, 0x15, 0xc3, 0xd2, 0x29, 0x2a, 0xaa, 0xc2, 0x1d, 0x0d, 0xee, 0x43, 0x04, 0x3c, + 0x98, 0x29, 0xfc, 0xf3, 0x99, 0xcf, 0xe4, 0x93, 0x64, 0x2f, 0x35, 0x75, 0xd7, 0xd0, 0xff, 0x93, + 0x2c, 0xd8, 0x79, 0x46, 0x3a, 0xa6, 0x09, 0x0d, 0x79, 0x0b, 0xfa, 0x29, 0x70, 0xe1, 0x9e, 0xa1, + 0xca, 0x32, 0xc4, 0x63, 0x16, 0x71, 0xc0, 0xbb, 0xa8, 0x14, 0xcb, 0x49, 0xc5, 0x74, 0xcc, 0x5a, + 0xb9, 0x61, 0x79, 0xcb, 0x17, 0x79, 0x8a, 0xd3, 0xfc, 0x33, 0x7a, 0x5b, 0x37, 0x5a, 0xf9, 0xfe, + 0xdc, 0xf0, 0x88, 0x5d, 0xa5, 0x3d, 0x38, 0x15, 0x54, 0xc0, 0xcc, 0xb0, 0x95, 0x1b, 0x7e, 0x83, + 0x72, 0xc3, 0x1d, 0x54, 0xe4, 0xd9, 0x20, 0xf7, 0x73, 0x74, 0x7e, 0x7b, 0xea, 0x5e, 0x45, 0x54, + 0xeb, 0x8d, 0xe7, 0x02, 0x2a, 0x4a, 0x51, 0x7c, 0x6f, 0xa2, 0xf2, 0xc2, 0x29, 0x78, 0x43, 0x27, + 0xf1, 0x43, 0x17, 0xd6, 0xe6, 0xef, 0x96, 0x55, 0x58, 0xd7, 0xbd, 0x7b, 0xf9, 0x78, 0x2c, 0x54, + 0xb1, 0x45, 0x34, 0xff, 0x8a, 0xea, 0x01, 0x3f, 0x99, 0xe8, 0xaf, 0xe4, 0x2e, 0x5c, 0xbb, 0x22, + 0xd3, 0x72, 0x5d, 0x2b, 0x32, 0x69, 0x0a, 0x74, 0x6b, 0x32, 0x93, 0x8b, 0x1d, 0x5d, 0xa6, 0x50, + 0x12, 0x2e, 0x65, 0x65, 0x4d, 0x18, 0x4d, 0x6c, 0x73, 0x3c, 0xb1, 0xcd, 0xf7, 0x89, 0x6d, 0x3e, + 0x4c, 0x6d, 0x63, 0x3c, 0xb5, 0x8d, 0xd7, 0xa9, 0x6d, 0x5c, 0x1c, 0xf8, 0x81, 0xe8, 0xa6, 0x6d, + 0xaf, 0xc3, 0x42, 0xb2, 0x3f, 0x53, 0x39, 0xa4, 0x6d, 0xfe, 0xa5, 0xb9, 0xd5, 0x61, 0x09, 0x2c, + 0xfe, 0xec, 0xd2, 0x20, 0xca, 0xf5, 0x79, 0x6e, 0x28, 0x86, 0x31, 0xf0, 0x76, 0x49, 0x7e, 0x80, + 0xdb, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x29, 0x97, 0x21, 0x60, 0x2c, 0x03, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Retrieves wasmx params + WasmxParams(ctx context.Context, in *QueryWasmxParamsRequest, opts ...grpc.CallOption) (*QueryWasmxParamsResponse, error) + // Retrieves the entire wasmx module's state + WasmxModuleState(ctx context.Context, in *QueryModuleStateRequest, opts ...grpc.CallOption) (*QueryModuleStateResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) WasmxParams(ctx context.Context, in *QueryWasmxParamsRequest, opts ...grpc.CallOption) (*QueryWasmxParamsResponse, error) { + out := new(QueryWasmxParamsResponse) + err := c.cc.Invoke(ctx, "/injective.wasmx.v1.Query/WasmxParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) WasmxModuleState(ctx context.Context, in *QueryModuleStateRequest, opts ...grpc.CallOption) (*QueryModuleStateResponse, error) { + out := new(QueryModuleStateResponse) + err := c.cc.Invoke(ctx, "/injective.wasmx.v1.Query/WasmxModuleState", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Retrieves wasmx params + WasmxParams(context.Context, *QueryWasmxParamsRequest) (*QueryWasmxParamsResponse, error) + // Retrieves the entire wasmx module's state + WasmxModuleState(context.Context, *QueryModuleStateRequest) (*QueryModuleStateResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) WasmxParams(ctx context.Context, req *QueryWasmxParamsRequest) (*QueryWasmxParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WasmxParams not implemented") +} +func (*UnimplementedQueryServer) WasmxModuleState(ctx context.Context, req *QueryModuleStateRequest) (*QueryModuleStateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WasmxModuleState not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_WasmxParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryWasmxParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).WasmxParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/injective.wasmx.v1.Query/WasmxParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).WasmxParams(ctx, req.(*QueryWasmxParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_WasmxModuleState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryModuleStateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).WasmxModuleState(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/injective.wasmx.v1.Query/WasmxModuleState", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).WasmxModuleState(ctx, req.(*QueryModuleStateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "injective.wasmx.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "WasmxParams", + Handler: _Query_WasmxParams_Handler, + }, + { + MethodName: "WasmxModuleState", + Handler: _Query_WasmxModuleState_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "injective/wasmx/v1/query.proto", +} + +func (m *QueryWasmxParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryWasmxParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWasmxParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryWasmxParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryWasmxParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryWasmxParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryModuleStateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryModuleStateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryModuleStateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryModuleStateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryModuleStateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryModuleStateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.State != nil { + { + size, err := m.State.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryWasmxParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryWasmxParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryModuleStateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryModuleStateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.State != nil { + l = m.State.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryWasmxParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryWasmxParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWasmxParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryWasmxParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryWasmxParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryWasmxParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryModuleStateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryModuleStateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryModuleStateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryModuleStateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryModuleStateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryModuleStateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.State == nil { + m.State = &GenesisState{} + } + if err := m.State.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/chain/wasmx/types/tx.pb.go b/chain/wasmx/types/tx.pb.go new file mode 100644 index 00000000..0a40c907 --- /dev/null +++ b/chain/wasmx/types/tx.pb.go @@ -0,0 +1,82 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: injective/wasmx/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("injective/wasmx/v1/tx.proto", fileDescriptor_f7afe23baa925f70) } + +var fileDescriptor_f7afe23baa925f70 = []byte{ + // 152 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xce, 0xcc, 0xcb, 0x4a, + 0x4d, 0x2e, 0xc9, 0x2c, 0x4b, 0xd5, 0x2f, 0x4f, 0x2c, 0xce, 0xad, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, + 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x4b, 0xea, 0x81, 0x25, 0xf5, 0xca, + 0x0c, 0x8d, 0x58, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x9d, 0x52, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, + 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, + 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x3b, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, + 0xdf, 0x13, 0xa6, 0xdf, 0x27, 0x31, 0xa9, 0x58, 0x1f, 0x6e, 0x9a, 0x6e, 0x72, 0x7e, 0x51, 0x2a, + 0x32, 0x37, 0x23, 0x31, 0x33, 0x4f, 0x3f, 0x37, 0x3f, 0xa5, 0x34, 0x27, 0xb5, 0x18, 0xea, 0x8e, + 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x43, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x76, 0x83, 0xd0, 0x89, 0xa7, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "injective.wasmx.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "injective/wasmx/v1/tx.proto", +} diff --git a/chain/wasmx/types/wasmx.pb.go b/chain/wasmx/types/wasmx.pb.go new file mode 100644 index 00000000..4f1b9701 --- /dev/null +++ b/chain/wasmx/types/wasmx.pb.go @@ -0,0 +1,1354 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: injective/wasmx/v1/wasmx.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Params struct { + // Set the status to active to indicate that the contract is to be executed in begin blocker. + IsExecutionEnabled bool `protobuf:"varint,1,opt,name=is_execution_enabled,json=isExecutionEnabled,proto3" json:"is_execution_enabled,omitempty"` + // registry_contract is the address of the registry contract that will be used to register contract executions in begin blocker. + RegistryContract string `protobuf:"bytes,2,opt,name=registry_contract,json=registryContract,proto3" json:"registry_contract,omitempty"` + // Maximum aggregate total gas to be used for the contract executions in the BeginBlocker. + MaxBeginBlockTotalGas uint64 `protobuf:"varint,3,opt,name=max_begin_block_total_gas,json=maxBeginBlockTotalGas,proto3" json:"max_begin_block_total_gas,omitempty"` + // the maximum gas limit each individual contract can consume in the BeginBlocker. + MaxContractGasLimit uint64 `protobuf:"varint,4,opt,name=max_contract_gas_limit,json=maxContractGasLimit,proto3" json:"max_contract_gas_limit,omitempty"` + // min_gas_price defines the minimum gas price the contracts must pay to be executed in the BeginBlocker. + MinGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=min_gas_price,json=minGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_gas_price"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_6818ff331f2cddc4, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetIsExecutionEnabled() bool { + if m != nil { + return m.IsExecutionEnabled + } + return false +} + +func (m *Params) GetRegistryContract() string { + if m != nil { + return m.RegistryContract + } + return "" +} + +func (m *Params) GetMaxBeginBlockTotalGas() uint64 { + if m != nil { + return m.MaxBeginBlockTotalGas + } + return 0 +} + +func (m *Params) GetMaxContractGasLimit() uint64 { + if m != nil { + return m.MaxContractGasLimit + } + return 0 +} + +type ContractRegistrationRequestProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ContractRegistrationRequest ContractRegistrationRequest `protobuf:"bytes,3,opt,name=contract_registration_request,json=contractRegistrationRequest,proto3" json:"contract_registration_request"` +} + +func (m *ContractRegistrationRequestProposal) Reset() { *m = ContractRegistrationRequestProposal{} } +func (m *ContractRegistrationRequestProposal) String() string { return proto.CompactTextString(m) } +func (*ContractRegistrationRequestProposal) ProtoMessage() {} +func (*ContractRegistrationRequestProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_6818ff331f2cddc4, []int{1} +} +func (m *ContractRegistrationRequestProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContractRegistrationRequestProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ContractRegistrationRequestProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ContractRegistrationRequestProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContractRegistrationRequestProposal.Merge(m, src) +} +func (m *ContractRegistrationRequestProposal) XXX_Size() int { + return m.Size() +} +func (m *ContractRegistrationRequestProposal) XXX_DiscardUnknown() { + xxx_messageInfo_ContractRegistrationRequestProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_ContractRegistrationRequestProposal proto.InternalMessageInfo + +type BatchContractRegistrationRequestProposal struct { + Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + ContractRegistrationRequests []ContractRegistrationRequest `protobuf:"bytes,3,rep,name=contract_registration_requests,json=contractRegistrationRequests,proto3" json:"contract_registration_requests"` +} + +func (m *BatchContractRegistrationRequestProposal) Reset() { + *m = BatchContractRegistrationRequestProposal{} +} +func (m *BatchContractRegistrationRequestProposal) String() string { return proto.CompactTextString(m) } +func (*BatchContractRegistrationRequestProposal) ProtoMessage() {} +func (*BatchContractRegistrationRequestProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_6818ff331f2cddc4, []int{2} +} +func (m *BatchContractRegistrationRequestProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BatchContractRegistrationRequestProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BatchContractRegistrationRequestProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BatchContractRegistrationRequestProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_BatchContractRegistrationRequestProposal.Merge(m, src) +} +func (m *BatchContractRegistrationRequestProposal) XXX_Size() int { + return m.Size() +} +func (m *BatchContractRegistrationRequestProposal) XXX_DiscardUnknown() { + xxx_messageInfo_BatchContractRegistrationRequestProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_BatchContractRegistrationRequestProposal proto.InternalMessageInfo + +type ContractRegistrationRequest struct { + // Unique Identifier for contract instance to be registered. + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + // Maximum gas to be used for the smart contract execution. + GasLimit uint64 `protobuf:"varint,2,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + // gas price to be used for the smart contract execution. + GasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"gas_price"` + PinContract bool `protobuf:"varint,4,opt,name=pin_contract,json=pinContract,proto3" json:"pin_contract,omitempty"` +} + +func (m *ContractRegistrationRequest) Reset() { *m = ContractRegistrationRequest{} } +func (m *ContractRegistrationRequest) String() string { return proto.CompactTextString(m) } +func (*ContractRegistrationRequest) ProtoMessage() {} +func (*ContractRegistrationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6818ff331f2cddc4, []int{3} +} +func (m *ContractRegistrationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContractRegistrationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ContractRegistrationRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ContractRegistrationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContractRegistrationRequest.Merge(m, src) +} +func (m *ContractRegistrationRequest) XXX_Size() int { + return m.Size() +} +func (m *ContractRegistrationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ContractRegistrationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ContractRegistrationRequest proto.InternalMessageInfo + +func (m *ContractRegistrationRequest) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *ContractRegistrationRequest) GetGasLimit() uint64 { + if m != nil { + return m.GasLimit + } + return 0 +} + +func (m *ContractRegistrationRequest) GetPinContract() bool { + if m != nil { + return m.PinContract + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "injective.wasmx.v1.Params") + proto.RegisterType((*ContractRegistrationRequestProposal)(nil), "injective.wasmx.v1.ContractRegistrationRequestProposal") + proto.RegisterType((*BatchContractRegistrationRequestProposal)(nil), "injective.wasmx.v1.BatchContractRegistrationRequestProposal") + proto.RegisterType((*ContractRegistrationRequest)(nil), "injective.wasmx.v1.ContractRegistrationRequest") +} + +func init() { proto.RegisterFile("injective/wasmx/v1/wasmx.proto", fileDescriptor_6818ff331f2cddc4) } + +var fileDescriptor_6818ff331f2cddc4 = []byte{ + // 571 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0xcf, 0x6e, 0xd3, 0x30, + 0x1c, 0x4e, 0xda, 0x6e, 0x6a, 0x5d, 0x10, 0xc3, 0x14, 0x54, 0x28, 0xa4, 0xa5, 0x48, 0xa8, 0x08, + 0x2d, 0x61, 0xec, 0x82, 0x76, 0x23, 0x68, 0xaa, 0xa6, 0xed, 0x50, 0x45, 0x9c, 0xb8, 0x44, 0x8e, + 0x63, 0xa5, 0x66, 0x89, 0x1d, 0x6c, 0xb7, 0xb4, 0xe2, 0x05, 0x38, 0xf2, 0x08, 0x7d, 0x04, 0x1e, + 0x63, 0xc7, 0x5d, 0x90, 0x10, 0x87, 0x09, 0xb5, 0x97, 0xf1, 0x16, 0xc8, 0x49, 0xd3, 0x55, 0x42, + 0xf4, 0x30, 0x69, 0xa7, 0xd8, 0xbf, 0xcf, 0xbf, 0x3f, 0xdf, 0x97, 0xcf, 0x06, 0x16, 0x65, 0x1f, + 0x09, 0x56, 0x74, 0x4c, 0x9c, 0xcf, 0x48, 0x26, 0x13, 0x67, 0xbc, 0x97, 0x2f, 0xec, 0x54, 0x70, + 0xc5, 0x21, 0x5c, 0xe1, 0x76, 0x1e, 0x1e, 0xef, 0x3d, 0x6a, 0x44, 0x3c, 0xe2, 0x19, 0xec, 0xe8, + 0x55, 0x7e, 0xb2, 0xfb, 0xbd, 0x04, 0xb6, 0x07, 0x48, 0xa0, 0x44, 0xc2, 0x57, 0xa0, 0x41, 0xa5, + 0x4f, 0x26, 0x04, 0x8f, 0x14, 0xe5, 0xcc, 0x27, 0x0c, 0x05, 0x31, 0x09, 0x9b, 0x66, 0xc7, 0xec, + 0x55, 0x3d, 0x48, 0xe5, 0x61, 0x01, 0x1d, 0xe6, 0x08, 0x7c, 0x09, 0xee, 0x0a, 0x12, 0x51, 0xa9, + 0xc4, 0xd4, 0xc7, 0x9c, 0x29, 0x81, 0xb0, 0x6a, 0x96, 0x3a, 0x66, 0xaf, 0xe6, 0xed, 0x14, 0xc0, + 0xbb, 0x65, 0x1c, 0xbe, 0x01, 0x0f, 0x13, 0x34, 0xf1, 0x03, 0x12, 0x51, 0xe6, 0x07, 0x31, 0xc7, + 0xa7, 0xbe, 0xe2, 0x0a, 0xc5, 0x7e, 0x84, 0x64, 0xb3, 0xdc, 0x31, 0x7b, 0x15, 0xef, 0x7e, 0x82, + 0x26, 0xae, 0xc6, 0x5d, 0x0d, 0xbf, 0xd7, 0x68, 0x1f, 0x49, 0xb8, 0x0f, 0x1e, 0xe8, 0xcc, 0xa2, + 0x83, 0x4e, 0xf0, 0x63, 0x9a, 0x50, 0xd5, 0xac, 0x64, 0x69, 0xf7, 0x12, 0x34, 0x29, 0xda, 0xf4, + 0x91, 0x3c, 0xd1, 0x10, 0xf4, 0xc0, 0xed, 0x84, 0xb2, 0xec, 0x6c, 0x2a, 0x28, 0x26, 0xcd, 0x2d, + 0x3d, 0x97, 0x6b, 0x9f, 0x5d, 0xb4, 0x8d, 0x5f, 0x17, 0xed, 0xe7, 0x11, 0x55, 0xc3, 0x51, 0x60, + 0x63, 0x9e, 0x38, 0x98, 0xcb, 0x84, 0xcb, 0xe5, 0x67, 0x57, 0x86, 0xa7, 0x8e, 0x9a, 0xa6, 0x44, + 0xda, 0x47, 0x4c, 0x79, 0xf5, 0x84, 0xb2, 0x3e, 0x92, 0x03, 0x5d, 0xe2, 0xa0, 0x72, 0x39, 0x6b, + 0x9b, 0xdd, 0xb9, 0x09, 0x9e, 0x15, 0xed, 0xbc, 0x9c, 0x25, 0xd2, 0xaa, 0x78, 0xe4, 0xd3, 0x88, + 0x48, 0x35, 0x10, 0x3c, 0xe5, 0x12, 0xc5, 0xb0, 0x01, 0xb6, 0x14, 0x55, 0x31, 0xc9, 0x04, 0xac, + 0x79, 0xf9, 0x06, 0x76, 0x40, 0x3d, 0x24, 0x12, 0x0b, 0x9a, 0xea, 0x9c, 0xa5, 0x5a, 0xeb, 0x21, + 0x38, 0x05, 0x4f, 0x56, 0x54, 0xc5, 0x5a, 0x7d, 0x5f, 0xe4, 0x0d, 0x32, 0xb1, 0xea, 0xaf, 0x1d, + 0xfb, 0xdf, 0x9f, 0x6c, 0x6f, 0x98, 0xcb, 0xad, 0x68, 0xea, 0x5e, 0x0b, 0xff, 0xff, 0xc8, 0x41, + 0xf5, 0xeb, 0xac, 0x6d, 0x5c, 0xce, 0xda, 0x46, 0xf7, 0x8f, 0x09, 0x7a, 0x2e, 0x52, 0x78, 0x78, + 0x93, 0x4c, 0xbf, 0x00, 0x6b, 0x23, 0x53, 0xed, 0x8b, 0xf2, 0xf5, 0xa9, 0x3e, 0xde, 0x40, 0x55, + 0xae, 0x71, 0xfd, 0x61, 0x82, 0xd6, 0x86, 0x6a, 0xf0, 0x05, 0xd8, 0x59, 0x8d, 0x89, 0xc2, 0x50, + 0x10, 0x29, 0x97, 0x4c, 0xef, 0x14, 0xf1, 0xb7, 0x79, 0x18, 0xb6, 0x40, 0xed, 0xca, 0x9d, 0xa5, + 0xcc, 0x9d, 0xd5, 0xa8, 0xb0, 0xe4, 0x71, 0x0e, 0xe6, 0x76, 0x2c, 0x5f, 0xcb, 0x8e, 0xba, 0x58, + 0xe6, 0x45, 0xf8, 0x14, 0xdc, 0x4a, 0x29, 0xbb, 0xba, 0x76, 0x95, 0xec, 0x96, 0xd6, 0x53, 0xca, + 0x0a, 0x2a, 0x2e, 0x39, 0x9b, 0x5b, 0xe6, 0xf9, 0xdc, 0x32, 0x7f, 0xcf, 0x2d, 0xf3, 0xdb, 0xc2, + 0x32, 0xce, 0x17, 0x96, 0xf1, 0x73, 0x61, 0x19, 0x1f, 0x8e, 0xd7, 0xda, 0x1d, 0x15, 0xd2, 0x9e, + 0xa0, 0x40, 0x3a, 0x2b, 0xa1, 0x77, 0x31, 0x17, 0x64, 0x7d, 0x3b, 0x44, 0x94, 0x39, 0x09, 0x0f, + 0x47, 0x31, 0x91, 0xcb, 0x57, 0x27, 0x9b, 0x2b, 0xd8, 0xce, 0x5e, 0x92, 0xfd, 0xbf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x59, 0x1c, 0x63, 0x2d, 0x95, 0x04, 0x00, 0x00, +} + +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.IsExecutionEnabled != that1.IsExecutionEnabled { + return false + } + if this.RegistryContract != that1.RegistryContract { + return false + } + if this.MaxBeginBlockTotalGas != that1.MaxBeginBlockTotalGas { + return false + } + if this.MaxContractGasLimit != that1.MaxContractGasLimit { + return false + } + if !this.MinGasPrice.Equal(that1.MinGasPrice) { + return false + } + return true +} +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.MinGasPrice.Size() + i -= size + if _, err := m.MinGasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWasmx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if m.MaxContractGasLimit != 0 { + i = encodeVarintWasmx(dAtA, i, uint64(m.MaxContractGasLimit)) + i-- + dAtA[i] = 0x20 + } + if m.MaxBeginBlockTotalGas != 0 { + i = encodeVarintWasmx(dAtA, i, uint64(m.MaxBeginBlockTotalGas)) + i-- + dAtA[i] = 0x18 + } + if len(m.RegistryContract) > 0 { + i -= len(m.RegistryContract) + copy(dAtA[i:], m.RegistryContract) + i = encodeVarintWasmx(dAtA, i, uint64(len(m.RegistryContract))) + i-- + dAtA[i] = 0x12 + } + if m.IsExecutionEnabled { + i-- + if m.IsExecutionEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ContractRegistrationRequestProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContractRegistrationRequestProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractRegistrationRequestProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ContractRegistrationRequest.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWasmx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintWasmx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintWasmx(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *BatchContractRegistrationRequestProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BatchContractRegistrationRequestProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BatchContractRegistrationRequestProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractRegistrationRequests) > 0 { + for iNdEx := len(m.ContractRegistrationRequests) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ContractRegistrationRequests[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintWasmx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintWasmx(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintWasmx(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ContractRegistrationRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContractRegistrationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractRegistrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PinContract { + i-- + if m.PinContract { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + { + size := m.GasPrice.Size() + i -= size + if _, err := m.GasPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintWasmx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.GasLimit != 0 { + i = encodeVarintWasmx(dAtA, i, uint64(m.GasLimit)) + i-- + dAtA[i] = 0x10 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintWasmx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintWasmx(dAtA []byte, offset int, v uint64) int { + offset -= sovWasmx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IsExecutionEnabled { + n += 2 + } + l = len(m.RegistryContract) + if l > 0 { + n += 1 + l + sovWasmx(uint64(l)) + } + if m.MaxBeginBlockTotalGas != 0 { + n += 1 + sovWasmx(uint64(m.MaxBeginBlockTotalGas)) + } + if m.MaxContractGasLimit != 0 { + n += 1 + sovWasmx(uint64(m.MaxContractGasLimit)) + } + l = m.MinGasPrice.Size() + n += 1 + l + sovWasmx(uint64(l)) + return n +} + +func (m *ContractRegistrationRequestProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovWasmx(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovWasmx(uint64(l)) + } + l = m.ContractRegistrationRequest.Size() + n += 1 + l + sovWasmx(uint64(l)) + return n +} + +func (m *BatchContractRegistrationRequestProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Title) + if l > 0 { + n += 1 + l + sovWasmx(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovWasmx(uint64(l)) + } + if len(m.ContractRegistrationRequests) > 0 { + for _, e := range m.ContractRegistrationRequests { + l = e.Size() + n += 1 + l + sovWasmx(uint64(l)) + } + } + return n +} + +func (m *ContractRegistrationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovWasmx(uint64(l)) + } + if m.GasLimit != 0 { + n += 1 + sovWasmx(uint64(m.GasLimit)) + } + l = m.GasPrice.Size() + n += 1 + l + sovWasmx(uint64(l)) + if m.PinContract { + n += 2 + } + return n +} + +func sovWasmx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozWasmx(x uint64) (n int) { + return sovWasmx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsExecutionEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsExecutionEnabled = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegistryContract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RegistryContract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxBeginBlockTotalGas", wireType) + } + m.MaxBeginBlockTotalGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxBeginBlockTotalGas |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxContractGasLimit", wireType) + } + m.MaxContractGasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxContractGasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinGasPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinGasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWasmx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWasmx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContractRegistrationRequestProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContractRegistrationRequestProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContractRegistrationRequestProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractRegistrationRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWasmx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ContractRegistrationRequest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWasmx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWasmx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BatchContractRegistrationRequestProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BatchContractRegistrationRequestProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BatchContractRegistrationRequestProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractRegistrationRequests", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthWasmx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractRegistrationRequests = append(m.ContractRegistrationRequests, ContractRegistrationRequest{}) + if err := m.ContractRegistrationRequests[len(m.ContractRegistrationRequests)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipWasmx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWasmx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContractRegistrationRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContractRegistrationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContractRegistrationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GasLimit", wireType) + } + m.GasLimit = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GasLimit |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + 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 ErrInvalidLengthWasmx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthWasmx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.GasPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PinContract", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowWasmx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.PinContract = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipWasmx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthWasmx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipWasmx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWasmx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWasmx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowWasmx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthWasmx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupWasmx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthWasmx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthWasmx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowWasmx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupWasmx = fmt.Errorf("proto: unexpected end of group") +)