From b71a4e03fe5aeb837169bf56df467e566db9eb14 Mon Sep 17 00:00:00 2001 From: codchen Date: Mon, 26 Jun 2023 13:02:36 +0800 Subject: [PATCH 1/2] Implement contract state rent --- proto/cosmwasm/wasm/v1/query.proto | 25 + proto/cosmwasm/wasm/v1/tx.proto | 10 + proto/cosmwasm/wasm/v1/types.proto | 9 + store/sized/store.go | 93 ++ x/wasm/alias.go | 2 + x/wasm/client/cli/new_tx.go | 32 + x/wasm/client/cli/query.go | 74 ++ x/wasm/client/cli/tx.go | 1 + x/wasm/handler.go | 2 + x/wasm/keeper/contract_keeper.go | 5 + x/wasm/keeper/keeper.go | 152 ++- x/wasm/keeper/msg_server.go | 16 + x/wasm/keeper/querier.go | 37 + x/wasm/keeper/wasmtesting/coin_transferrer.go | 10 +- x/wasm/types/codec.go | 2 + x/wasm/types/errors.go | 3 + x/wasm/types/expected_keepers.go | 3 + x/wasm/types/exported_keepers.go | 3 + x/wasm/types/genesis.pb.go | 51 +- x/wasm/types/ibc.pb.go | 27 +- x/wasm/types/keys.go | 12 + x/wasm/types/params.go | 42 +- x/wasm/types/proposal.pb.go | 94 +- x/wasm/types/query.pb.go | 1041 +++++++++++++---- x/wasm/types/query.pb.gw.go | 304 ++++- x/wasm/types/rent.go | 28 + x/wasm/types/tx.go | 30 + x/wasm/types/tx.pb.go | 594 +++++++--- x/wasm/types/types.pb.go | 320 ++--- 29 files changed, 2339 insertions(+), 683 deletions(-) create mode 100644 store/sized/store.go create mode 100644 x/wasm/types/rent.go diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index b7f7a06..4b0507f 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -58,6 +58,14 @@ service Query { rpc PinnedCodes(QueryPinnedCodesRequest) returns (QueryPinnedCodesResponse) { option (google.api.http).get = "/cosmwasm/wasm/v1/codes/pinned"; } + + rpc RentInfo(QueryRentInfoRequest) returns (QueryRentInfoResponse) { + option (google.api.http).get = "/cosmwasm/wasm/v1/rent/{address}"; + } + + rpc StateSize(QueryStateSizeRequest) returns (QueryStateSizeResponse) { + option (google.api.http).get = "/cosmwasm/wasm/v1/size/{address}"; + } } // QueryContractInfoRequest is the request type for the Query/ContractInfo RPC @@ -222,3 +230,20 @@ message QueryPinnedCodesResponse { // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; } + +message QueryRentInfoRequest { + string address = 1; +} + +message QueryRentInfoResponse { + uint64 balance = 1; + uint64 last_charged_block = 2; +} + +message QueryStateSizeRequest { + string address = 1; +} + +message QueryStateSizeResponse { + uint64 state_size = 1; +} \ No newline at end of file diff --git a/proto/cosmwasm/wasm/v1/tx.proto b/proto/cosmwasm/wasm/v1/tx.proto index 8295907..aac54fc 100644 --- a/proto/cosmwasm/wasm/v1/tx.proto +++ b/proto/cosmwasm/wasm/v1/tx.proto @@ -23,6 +23,8 @@ service Msg { rpc UpdateAdmin(MsgUpdateAdmin) returns (MsgUpdateAdminResponse); // ClearAdmin removes any admin stored for a smart contract rpc ClearAdmin(MsgClearAdmin) returns (MsgClearAdminResponse); + // DepositRent adds to the rent balance for a smart contract + rpc DepositRent(MsgDepositRent) returns (MsgDepositRentResponse); } // MsgStoreCode submit Wasm code to the system @@ -133,3 +135,11 @@ message MsgClearAdmin { // MsgClearAdminResponse returns empty data message MsgClearAdminResponse {} + +message MsgDepositRent { + string contract = 1; + uint64 amount = 2; + string sender = 3; +} + +message MsgDepositRentResponse {} diff --git a/proto/cosmwasm/wasm/v1/types.proto b/proto/cosmwasm/wasm/v1/types.proto index 5bbdedb..17485df 100644 --- a/proto/cosmwasm/wasm/v1/types.proto +++ b/proto/cosmwasm/wasm/v1/types.proto @@ -49,6 +49,15 @@ message Params { ]; AccessType instantiate_default_permission = 2 [ (gogoproto.moretags) = "yaml:\"instantiate_default_permission\"" ]; + // rent price per byte per block + string unit_rent_price = 3 + [ + (gogoproto.moretags) = "yaml:\"unit_gas_price\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; + string rent_denom = 4 + [ (gogoproto.moretags) = "yaml:\"rent_denom\"" ]; } // CodeInfo is data for the uploaded contract WASM code diff --git a/store/sized/store.go b/store/sized/store.go new file mode 100644 index 0000000..8c062ff --- /dev/null +++ b/store/sized/store.go @@ -0,0 +1,93 @@ +package sized + +import ( + "io" + + "github.com/cosmos/cosmos-sdk/store/types" +) + +var _ types.KVStore = &Store{} + +type Store struct { + parent types.KVStore + sizeChange int64 +} + +func NewStore(parent types.KVStore) *Store { + return &Store{parent: parent} +} +func (store *Store) GetWorkingHash() ([]byte, error) { + return store.parent.GetWorkingHash() +} + +func (s *Store) GetSizeChanged() int64 { + return s.sizeChange +} + +func (s *Store) Get(key []byte) []byte { + value := s.parent.Get(key) + return value +} + +func (s *Store) Set(key []byte, value []byte) { + oldValue := s.Get(key) + if oldValue != nil { + // reduce size due to overwrite + s.sizeChange -= int64(len(key)) + s.sizeChange -= int64(len(oldValue)) + } + s.parent.Set(key, value) + if key != nil { + s.sizeChange += int64(len(key)) + } + if value != nil { + s.sizeChange += int64(len(value)) + } +} + +func (s *Store) Delete(key []byte) { + // has to perform a read here to know the size change + value := s.Get(key) + s.parent.Delete(key) + if value != nil { + // only reduce size if the key used to have a value + s.sizeChange -= int64(len(key)) + s.sizeChange -= int64(len(value)) + } +} + +func (s *Store) Has(key []byte) bool { + return s.parent.Has(key) +} + +func (s *Store) Iterator(start, end []byte) types.Iterator { + return s.parent.Iterator(start, end) +} + +func (s *Store) ReverseIterator(start, end []byte) types.Iterator { + return s.parent.ReverseIterator(start, end) +} + +// GetStoreType implements the KVStore interface. It returns the underlying +// KVStore type. +func (s *Store) GetStoreType() types.StoreType { + return s.parent.GetStoreType() +} + +// CacheWrap implements the KVStore interface. It panics as a Store +// cannot be cache wrapped. +func (s *Store) CacheWrap(_ types.StoreKey) types.CacheWrap { + panic("cannot CacheWrap a ListenKVStore") +} + +// CacheWrapWithTrace implements the KVStore interface. It panics as a +// Store cannot be cache wrapped. +func (s *Store) CacheWrapWithTrace(_ types.StoreKey, _ io.Writer, _ types.TraceContext) types.CacheWrap { + panic("cannot CacheWrapWithTrace a ListenKVStore") +} + +// CacheWrapWithListeners implements the KVStore interface. It panics as a +// Store cannot be cache wrapped. +func (s *Store) CacheWrapWithListeners(_ types.StoreKey, _ []types.WriteListener) types.CacheWrap { + panic("cannot CacheWrapWithListeners a ListenKVStore") +} diff --git a/x/wasm/alias.go b/x/wasm/alias.go index 67a79ac..57902e5 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -112,6 +112,8 @@ type ( MsgClearAdmin = types.MsgClearAdmin MsgWasmIBCCall = types.MsgIBCSend MsgClearAdminResponse = types.MsgClearAdminResponse + MsgDepositRent = types.MsgDepositRent + MsgDepositRentResponse = types.MsgDepositRentResponse MsgServer = types.MsgServer Model = types.Model CodeInfo = types.CodeInfo diff --git a/x/wasm/client/cli/new_tx.go b/x/wasm/client/cli/new_tx.go index e3b4779..67d8045 100644 --- a/x/wasm/client/cli/new_tx.go +++ b/x/wasm/client/cli/new_tx.go @@ -119,3 +119,35 @@ func ClearContractAdminCmd() *cobra.Command { flags.AddTxFlagsToCmd(cmd) return cmd } + +func DepositRentCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "deposit-rent [contract_addr_bech32] [amount]", + Short: "deposits rent for a contract", + Aliases: []string{"deposit"}, + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + amount, err := strconv.ParseUint(args[1], 10, 64) + if err != nil { + return err + } + + msg := types.MsgDepositRent{ + Sender: clientCtx.GetFromAddress().String(), + Contract: args[0], + Amount: amount, + } + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/wasm/client/cli/query.go b/x/wasm/client/cli/query.go index 49cea64..550ba4b 100644 --- a/x/wasm/client/cli/query.go +++ b/x/wasm/client/cli/query.go @@ -38,6 +38,8 @@ func GetQueryCmd() *cobra.Command { GetCmdGetContractState(), GetCmdListPinnedCode(), GetCmdLibVersion(), + GetCmdGetRentInfo(), + GetCmdGetStateSize(), ) return queryCmd } @@ -481,6 +483,78 @@ func GetCmdListPinnedCode() *cobra.Command { return cmd } +func GetCmdGetRentInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "rent-info [bech32_address]", + Short: "Gets the rent info for a contract given its address", + Long: "Gets the rent info for a contract given its address", + Aliases: []string{"rent"}, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + _, err = sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.RentInfo( + context.Background(), + &types.QueryRentInfoRequest{ + Address: args[0], + }, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func GetCmdGetStateSize() *cobra.Command { + cmd := &cobra.Command{ + Use: "state-size [bech32_address]", + Short: "Gets total number of bytes for a contract state given its address", + Long: "Gets total number of bytes for a contract state given its address", + Aliases: []string{"ss"}, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + _, err = sdk.AccAddressFromBech32(args[0]) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.StateSize( + context.Background(), + &types.QueryStateSizeRequest{ + Address: args[0], + }, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + type argumentDecoder struct { // dec is the default decoder dec func(string) ([]byte, error) diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go index 8f3203e..4c16ab3 100644 --- a/x/wasm/client/cli/tx.go +++ b/x/wasm/client/cli/tx.go @@ -46,6 +46,7 @@ func GetTxCmd() *cobra.Command { MigrateContractCmd(), UpdateContractAdminCmd(), ClearContractAdminCmd(), + DepositRentCmd(), ) return txCmd } diff --git a/x/wasm/handler.go b/x/wasm/handler.go index e6004cd..ce9d16b 100644 --- a/x/wasm/handler.go +++ b/x/wasm/handler.go @@ -37,6 +37,8 @@ func NewHandler(k types.ContractOpsKeeper) sdk.Handler { res, err = msgServer.UpdateAdmin(sdk.WrapSDKContext(ctx), msg) case *MsgClearAdmin: res, err = msgServer.ClearAdmin(sdk.WrapSDKContext(ctx), msg) + case *MsgDepositRent: + res, err = msgServer.DepositRent(sdk.WrapSDKContext(ctx), msg) default: errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg) return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) diff --git a/x/wasm/keeper/contract_keeper.go b/x/wasm/keeper/contract_keeper.go index 9dc0a4b..53bc5c8 100644 --- a/x/wasm/keeper/contract_keeper.go +++ b/x/wasm/keeper/contract_keeper.go @@ -20,6 +20,7 @@ type decoratedKeeper interface { Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) setContractInfoExtension(ctx sdk.Context, contract sdk.AccAddress, extra types.ContractInfoExtension) error setAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error + DepositRent(ctx sdk.Context, contractAddress sdk.AccAddress, senderAddress sdk.AccAddress, amount int64) error } type PermissionedKeeper struct { @@ -84,3 +85,7 @@ func (p PermissionedKeeper) SetContractInfoExtension(ctx sdk.Context, contract s func (p PermissionedKeeper) SetAccessConfig(ctx sdk.Context, codeID uint64, config types.AccessConfig) error { return p.nested.setAccessConfig(ctx, codeID, config) } + +func (p PermissionedKeeper) DepositRent(ctx sdk.Context, contractAddress sdk.AccAddress, senderAddress sdk.AccAddress, amount int64) error { + return p.nested.DepositRent(ctx, contractAddress, senderAddress, amount) +} diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index 20fcf78..bfdbc4d 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/binary" + "errors" "fmt" "math" "path/filepath" @@ -20,9 +21,11 @@ import ( "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/tendermint/tendermint/libs/log" + "github.com/CosmWasm/wasmd/store/sized" "github.com/CosmWasm/wasmd/x/wasm/ioutils" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -52,6 +55,7 @@ type WasmVMQueryHandler interface { type CoinTransferrer interface { // TransferCoins sends the coin amounts from the source to the destination with rules applied. TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + TransferCoinsToModule(ctx sdk.Context, fromAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // WasmVMResponseHandler is an extension point to handles the response data returned by a contract call. @@ -284,17 +288,21 @@ func (k Keeper) instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.A // 0x03 | BuildContractAddress (sdk.AccAddress) prefixStoreKey := types.GetContractStorePrefix(contractAddress) prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) + sizedPrefixStore := sized.NewStore(prefixStore) // prepare querier querier := k.newQueryHandler(ctx, contractAddress) // instantiate wasm contract gas := k.runtimeGasForContract(ctx) - res, gasUsed, err := k.wasmVM.Instantiate(codeInfo.CodeHash, env, info, initMsg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) + res, gasUsed, err := k.wasmVM.Instantiate(codeInfo.CodeHash, env, info, initMsg, sizedPrefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if err != nil { return nil, nil, sdkerrors.Wrap(types.ErrInstantiateFailed, err.Error()) } + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { + return nil, nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + } // persist instance first createdAt := types.NewAbsoluteTxPosition(ctx) @@ -337,10 +345,12 @@ func (k Keeper) instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.A // Execute executes the contract instance func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) { defer telemetry.MeasureSince(time.Now(), "wasm", "contract", "execute") + contractInfo, codeInfo, prefixStore, err := k.contractInstance(ctx, contractAddress) if err != nil { return nil, err } + sizedPrefixStore := sized.NewStore(prefixStore) executeCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, contractInfo.CodeID), len(msg)) ctx.GasMeter().ConsumeGas(executeCosts, "Loading CosmWasm module: execute") @@ -358,11 +368,14 @@ func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller // prepare querier querier := k.newQueryHandler(ctx, contractAddress) gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.Execute(codeInfo.CodeHash, env, info, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) + res, gasUsed, execErr := k.wasmVM.Execute(codeInfo.CodeHash, env, info, msg, sizedPrefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error()) } + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { + return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + } ctx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeExecute, @@ -418,12 +431,16 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller prefixStoreKey := types.GetContractStorePrefix(contractAddress) prefixStore := prefix.NewStore(ctx.KVStore(k.storeKey), prefixStoreKey) + sizedPrefixStore := sized.NewStore(prefixStore) gas := k.runtimeGasForContract(ctx) - res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, &prefixStore, cosmwasmAPI, &querier, k.gasMeter(ctx), gas, costJSONDeserialization) + res, gasUsed, err := k.wasmVM.Migrate(newCodeInfo.CodeHash, env, msg, sizedPrefixStore, cosmwasmAPI, &querier, k.gasMeter(ctx), gas, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if err != nil { return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) } + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { + return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + } // delete old secondary index entry k.removeFromContractCodeSecondaryIndex(ctx, contractAddress, k.getLastContractHistoryEntry(ctx, contractAddress)) @@ -456,6 +473,7 @@ func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte if err != nil { return nil, err } + sizedPrefixStore := sized.NewStore(prefixStore) sudoSetupCosts := k.gasRegister.InstantiateContractCosts(k.IsPinnedCode(ctx, contractInfo.CodeID), len(msg)) ctx.GasMeter().ConsumeGas(sudoSetupCosts, "Loading CosmWasm module: sudo") @@ -465,11 +483,14 @@ func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte // prepare querier querier := k.newQueryHandler(ctx, contractAddress) gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.Sudo(codeInfo.CodeHash, env, msg, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) + res, gasUsed, execErr := k.wasmVM.Sudo(codeInfo.CodeHash, env, msg, sizedPrefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error()) } + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { + return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + } ctx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeSudo, @@ -490,6 +511,7 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was if err != nil { return nil, err } + sizedPrefixStore := sized.NewStore(prefixStore) // always consider this pinned replyCosts := k.gasRegister.ReplyCosts(true, reply) @@ -500,11 +522,14 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was // prepare querier querier := k.newQueryHandler(ctx, contractAddress) gas := k.runtimeGasForContract(ctx) - res, gasUsed, execErr := k.wasmVM.Reply(codeInfo.CodeHash, env, reply, prefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) + res, gasUsed, execErr := k.wasmVM.Reply(codeInfo.CodeHash, env, reply, sizedPrefixStore, cosmwasmAPI, querier, k.gasMeter(ctx), gas, costJSONDeserialization) k.consumeRuntimeGas(ctx, gasUsed) if execErr != nil { return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error()) } + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { + return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + } ctx.EventManager().EmitEvent(sdk.NewEvent( types.EventTypeReply, @@ -1005,6 +1030,111 @@ func (k Keeper) newQueryHandler(ctx sdk.Context, contractAddress sdk.AccAddress) return NewQueryHandler(ctx, k.wasmVMQueryHandler, contractAddress, k.gasRegister) } +func (k Keeper) updateSizeForContract(ctx sdk.Context, contractAddress sdk.AccAddress, sizedStore *sized.Store) error { + // always charge rent first before updating size, as the charging logic assumes constant size since last + // charged block + if err := k.chargeRent(ctx, contractAddress); err != nil { + return err + } + sizeChange := sizedStore.GetSizeChanged() + sizeKey := types.GetContractStoreSizePrefix(contractAddress) + store := ctx.KVStore(k.storeKey) + currentSize, err := k.getCurrentSizeForContract(ctx, contractAddress) + if err != nil { + return err + } + currentSizeSigned := int64(currentSize) + sizeChange + if currentSizeSigned < 0 { + // this should not happen + panic("negative size for contract") + } + newBz := make([]byte, 8) + binary.BigEndian.PutUint64(newBz, uint64(currentSizeSigned)) + store.Set(sizeKey, newBz) + return nil +} + +func (k Keeper) getCurrentSizeForContract(ctx sdk.Context, contractAddress sdk.AccAddress) (uint64, error) { + return GetSize(ctx, contractAddress, k.storeKey) +} + +func (k Keeper) chargeRent(ctx sdk.Context, contractAddress sdk.AccAddress) error { + rentInfo, err := k.getRentInfo(ctx, contractAddress) + if err != nil { + return err + } + duration := uint64(ctx.BlockHeight()) - rentInfo.LastChargedBlock + if duration == 0 { + // shortcut in the case of same block changes + k.setRentInfo(ctx, contractAddress, rentInfo) + return nil + } + size, err := k.getCurrentSizeForContract(ctx, contractAddress) + if err != nil { + return err + } + if size == 0 { + k.setRentInfo(ctx, contractAddress, rentInfo) + return nil + } + rentPrice := k.GetParams(ctx).UnitRentPrice + rentToBeCharged := uint64(sdk.NewDec(int64(duration * size)).Mul(rentPrice).RoundInt().Int64()) + if rentToBeCharged > rentInfo.Balance { + return errors.New("insufficient rent balance") + } + rentInfo.Balance -= rentToBeCharged + k.setRentInfo(ctx, contractAddress, rentInfo) + return nil +} + +func (k Keeper) getRentInfo(ctx sdk.Context, contractAddress sdk.AccAddress) (*types.RentInfo, error) { + return GetRentInfo(ctx, contractAddress, k.storeKey) +} + +func (k Keeper) setRentInfo(ctx sdk.Context, contractAddress sdk.AccAddress, rentInfo *types.RentInfo) { + store := ctx.KVStore(k.storeKey) + rentInfo.LastChargedBlock = uint64(ctx.BlockHeight()) + store.Set(types.GetContractRentInfoPrefix(contractAddress), rentInfo.Marshal()) +} + +func (k Keeper) DepositRent(ctx sdk.Context, contractAddress sdk.AccAddress, senderAddress sdk.AccAddress, amount int64) error { + deposit := sdk.NewCoins(sdk.NewCoin(k.GetParams(ctx).RentDenom, sdk.NewInt(amount))) + if err := k.bank.TransferCoinsToModule(ctx, senderAddress, authtypes.FeeCollectorName, deposit); err != nil { + return err + } + rentInfo, err := k.getRentInfo(ctx, contractAddress) + if err != nil { + return err + } + rentInfo.Balance += uint64(amount) + k.setRentInfo(ctx, contractAddress, rentInfo) + return nil +} + +func GetRentInfo(ctx sdk.Context, contractAddress sdk.AccAddress, storeKey sdk.StoreKey) (*types.RentInfo, error) { + store := ctx.KVStore(storeKey) + rentInfo := &types.RentInfo{} + rentInfoBz := store.Get(types.GetContractRentInfoPrefix(contractAddress)) + if rentInfoBz == nil { + rentInfo.Balance = 0 + rentInfo.LastChargedBlock = uint64(ctx.BlockHeight()) + } else if err := rentInfo.Unmarshal(rentInfoBz); err != nil { + return rentInfo, err + } + return rentInfo, nil +} + +func GetSize(ctx sdk.Context, contractAddress sdk.AccAddress, storeKey sdk.StoreKey) (uint64, error) { + sizeKey := types.GetContractStoreSizePrefix(contractAddress) + store := ctx.KVStore(storeKey) + bz := store.Get(sizeKey) + currentSize := uint64(0) + if bz != nil { + currentSize = binary.BigEndian.Uint64(bz) + } + return currentSize, nil +} + // MultipliedGasMeter wraps the GasMeter from context and multiplies all reads by out defined multiplier type MultipliedGasMeter struct { originalMeter sdk.GasMeter @@ -1081,6 +1211,18 @@ func (c BankCoinTransferrer) TransferCoins(parentCtx sdk.Context, fromAddr sdk.A return nil } +func (c BankCoinTransferrer) TransferCoinsToModule(ctx sdk.Context, fromAddr sdk.AccAddress, recipientModule string, amount sdk.Coins) error { + if err := c.keeper.IsSendEnabledCoins(ctx, amount...); err != nil { + return err + } + + sdkerr := c.keeper.SendCoinsFromAccountToModule(ctx, fromAddr, recipientModule, amount) + if sdkerr != nil { + return sdkerr + } + return nil +} + type msgDispatcher interface { DispatchSubmessages(ctx sdk.Context, contractAddr sdk.AccAddress, ibcPort string, msgs []wasmvmtypes.SubMsg) ([]byte, error) } diff --git a/x/wasm/keeper/msg_server.go b/x/wasm/keeper/msg_server.go index a343504..da55a46 100644 --- a/x/wasm/keeper/msg_server.go +++ b/x/wasm/keeper/msg_server.go @@ -185,3 +185,19 @@ func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) ( return &types.MsgClearAdminResponse{}, nil } + +func (m msgServer) DepositRent(goCtx context.Context, msg *types.MsgDepositRent) (*types.MsgDepositRentResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) + if err != nil { + return nil, sdkerrors.Wrap(err, "contract") + } + if err := m.keeper.DepositRent(ctx, contractAddr, senderAddr, int64(msg.Amount)); err != nil { + return nil, sdkerrors.Wrap(err, "deposit") + } + return &types.MsgDepositRentResponse{}, nil +} diff --git a/x/wasm/keeper/querier.go b/x/wasm/keeper/querier.go index 6c4e454..29143f0 100644 --- a/x/wasm/keeper/querier.go +++ b/x/wasm/keeper/querier.go @@ -252,6 +252,43 @@ func (q grpcQuerier) Codes(c context.Context, req *types.QueryCodesRequest) (*ty return &types.QueryCodesResponse{CodeInfos: r, Pagination: pageRes}, nil } +func (q grpcQuerier) RentInfo(c context.Context, req *types.QueryRentInfoRequest) (*types.QueryRentInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + contractAddr, err := sdk.AccAddressFromBech32(req.Address) + if err != nil { + return nil, err + } + ctx := sdk.UnwrapSDKContext(c) + rentInfo, err := GetRentInfo(ctx, contractAddr, q.storeKey) + if err != nil { + return nil, err + } + return &types.QueryRentInfoResponse{ + Balance: rentInfo.Balance, + LastChargedBlock: rentInfo.LastChargedBlock, + }, nil +} + +func (q grpcQuerier) StateSize(c context.Context, req *types.QueryStateSizeRequest) (*types.QueryStateSizeResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + contractAddr, err := sdk.AccAddressFromBech32(req.Address) + if err != nil { + return nil, err + } + ctx := sdk.UnwrapSDKContext(c) + size, err := GetSize(ctx, contractAddr, q.storeKey) + if err != nil { + return nil, err + } + return &types.QueryStateSizeResponse{ + StateSize: size, + }, nil +} + func queryContractInfo(ctx sdk.Context, addr sdk.AccAddress, keeper types.ViewKeeper) (*types.QueryContractInfoResponse, error) { info := keeper.GetContractInfo(ctx, addr) if info == nil { diff --git a/x/wasm/keeper/wasmtesting/coin_transferrer.go b/x/wasm/keeper/wasmtesting/coin_transferrer.go index 497ecc7..12a776a 100644 --- a/x/wasm/keeper/wasmtesting/coin_transferrer.go +++ b/x/wasm/keeper/wasmtesting/coin_transferrer.go @@ -3,7 +3,8 @@ package wasmtesting import sdk "github.com/cosmos/cosmos-sdk/types" type MockCoinTransferrer struct { - TransferCoinsFn func(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + TransferCoinsFn func(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + TransferCoinsToModuleFn func(ctx sdk.Context, fromAddr sdk.AccAddress, m string, amt sdk.Coins) error } func (m *MockCoinTransferrer) TransferCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error { @@ -12,3 +13,10 @@ func (m *MockCoinTransferrer) TransferCoins(ctx sdk.Context, fromAddr sdk.AccAdd } return m.TransferCoinsFn(ctx, fromAddr, toAddr, amt) } + +func (m *MockCoinTransferrer) TransferCoinsToModule(ctx sdk.Context, fromAddr sdk.AccAddress, module string, amt sdk.Coins) error { + if m.TransferCoinsToModuleFn == nil { + panic("not expected to be called") + } + return m.TransferCoinsToModule(ctx, fromAddr, module, amt) +} diff --git a/x/wasm/types/codec.go b/x/wasm/types/codec.go index e7e578b..c1a4fb8 100644 --- a/x/wasm/types/codec.go +++ b/x/wasm/types/codec.go @@ -17,6 +17,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { //nolint:staticcheck cdc.RegisterConcrete(&MsgMigrateContract{}, "wasm/MsgMigrateContract", nil) cdc.RegisterConcrete(&MsgUpdateAdmin{}, "wasm/MsgUpdateAdmin", nil) cdc.RegisterConcrete(&MsgClearAdmin{}, "wasm/MsgClearAdmin", nil) + cdc.RegisterConcrete(&MsgDepositRent{}, "wasm/MsgDepositRent", nil) cdc.RegisterConcrete(&PinCodesProposal{}, "wasm/PinCodesProposal", nil) cdc.RegisterConcrete(&UnpinCodesProposal{}, "wasm/UnpinCodesProposal", nil) @@ -41,6 +42,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &MsgClearAdmin{}, &MsgIBCCloseChannel{}, &MsgIBCSend{}, + &MsgDepositRent{}, ) registry.RegisterImplementations( (*govtypes.Content)(nil), diff --git a/x/wasm/types/errors.go b/x/wasm/types/errors.go index 50814f8..3cde314 100644 --- a/x/wasm/types/errors.go +++ b/x/wasm/types/errors.go @@ -87,6 +87,9 @@ var ( // ErrExceedMaxQueryStackSize error if max query stack size is exceeded ErrExceedMaxQueryStackSize = sdkErrors.Register(DefaultCodespace, 27, "max query stack size exceeded") + + // ErrUpdateContractSize error + ErrUpdateContractSize = sdkErrors.Register(DefaultCodespace, 28, "failed to update contract size") ) type ErrNoSuchContract struct { diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index 0cdd4d8..11ae992 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -32,6 +32,7 @@ type BankKeeper interface { IsSendEnabledCoins(ctx sdk.Context, coins ...sdk.Coin) error BlockedAddr(addr sdk.AccAddress) bool SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error } // AccountKeeper defines a subset of methods implemented by the cosmos-sdk account keeper @@ -42,6 +43,8 @@ type AccountKeeper interface { GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // Set an account in the store. SetAccount(ctx sdk.Context, acc authtypes.AccountI) + // Get module address + GetModuleAddress(moduleName string) sdk.AccAddress } // DistributionKeeper defines a subset of methods implemented by the cosmos-sdk distribution keeper diff --git a/x/wasm/types/exported_keepers.go b/x/wasm/types/exported_keepers.go index bb919a3..3f8a238 100644 --- a/x/wasm/types/exported_keepers.go +++ b/x/wasm/types/exported_keepers.go @@ -56,6 +56,9 @@ type ContractOpsKeeper interface { // SetAccessConfig updates the access config of a code id. SetAccessConfig(ctx sdk.Context, codeID uint64, config AccessConfig) error + + // DepositRent deposits rent to a contract + DepositRent(ctx sdk.Context, contractAddress sdk.AccAddress, senderAddress sdk.AccAddress, amount int64) error } // IBCContractKeeper IBC lifecycle event handler diff --git a/x/wasm/types/genesis.pb.go b/x/wasm/types/genesis.pb.go index 17970ef..0c5096e 100644 --- a/x/wasm/types/genesis.pb.go +++ b/x/wasm/types/genesis.pb.go @@ -5,21 +5,17 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = math.Inf -) +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. @@ -42,11 +38,9 @@ func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []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) @@ -59,15 +53,12 @@ func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) 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) } @@ -127,11 +118,9 @@ func (*GenesisState_GenMsgs) ProtoMessage() {} func (*GenesisState_GenMsgs) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{0, 0} } - func (m *GenesisState_GenMsgs) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *GenesisState_GenMsgs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_GenesisState_GenMsgs.Marshal(b, m, deterministic) @@ -144,15 +133,12 @@ func (m *GenesisState_GenMsgs) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } - func (m *GenesisState_GenMsgs) XXX_Merge(src proto.Message) { xxx_messageInfo_GenesisState_GenMsgs.Merge(m, src) } - func (m *GenesisState_GenMsgs) XXX_Size() int { return m.Size() } - func (m *GenesisState_GenMsgs) XXX_DiscardUnknown() { xxx_messageInfo_GenesisState_GenMsgs.DiscardUnknown(m) } @@ -231,11 +217,9 @@ func (*Code) ProtoMessage() {} func (*Code) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{1} } - func (m *Code) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Code) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Code.Marshal(b, m, deterministic) @@ -248,15 +232,12 @@ func (m *Code) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Code) XXX_Merge(src proto.Message) { xxx_messageInfo_Code.Merge(m, src) } - func (m *Code) XXX_Size() int { return m.Size() } - func (m *Code) XXX_DiscardUnknown() { xxx_messageInfo_Code.DiscardUnknown(m) } @@ -304,11 +285,9 @@ func (*Contract) ProtoMessage() {} func (*Contract) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{2} } - func (m *Contract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Contract.Marshal(b, m, deterministic) @@ -321,15 +300,12 @@ func (m *Contract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Contract) XXX_Merge(src proto.Message) { xxx_messageInfo_Contract.Merge(m, src) } - func (m *Contract) XXX_Size() int { return m.Size() } - func (m *Contract) XXX_DiscardUnknown() { xxx_messageInfo_Contract.DiscardUnknown(m) } @@ -369,11 +345,9 @@ func (*Sequence) ProtoMessage() {} func (*Sequence) Descriptor() ([]byte, []int) { return fileDescriptor_2ab3f539b23472a6, []int{3} } - func (m *Sequence) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Sequence.Marshal(b, m, deterministic) @@ -386,15 +360,12 @@ func (m *Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Sequence) XXX_Merge(src proto.Message) { xxx_messageInfo_Sequence.Merge(m, src) } - func (m *Sequence) XXX_Size() int { return m.Size() } - func (m *Sequence) XXX_DiscardUnknown() { xxx_messageInfo_Sequence.DiscardUnknown(m) } @@ -612,7 +583,6 @@ func (m *GenesisState_GenMsgs_StoreCode) MarshalToSizedBuffer(dAtA []byte) (int, } return len(dAtA) - i, nil } - func (m *GenesisState_GenMsgs_InstantiateContract) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -634,7 +604,6 @@ func (m *GenesisState_GenMsgs_InstantiateContract) MarshalToSizedBuffer(dAtA []b } return len(dAtA) - i, nil } - func (m *GenesisState_GenMsgs_ExecuteContract) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) @@ -656,7 +625,6 @@ func (m *GenesisState_GenMsgs_ExecuteContract) MarshalToSizedBuffer(dAtA []byte) } return len(dAtA) - i, nil } - func (m *Code) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -812,7 +780,6 @@ func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *GenesisState) Size() (n int) { if m == nil { return 0 @@ -872,7 +839,6 @@ func (m *GenesisState_GenMsgs_StoreCode) Size() (n int) { } return n } - func (m *GenesisState_GenMsgs_InstantiateContract) Size() (n int) { if m == nil { return 0 @@ -885,7 +851,6 @@ func (m *GenesisState_GenMsgs_InstantiateContract) Size() (n int) { } return n } - func (m *GenesisState_GenMsgs_ExecuteContract) Size() (n int) { if m == nil { return 0 @@ -898,7 +863,6 @@ func (m *GenesisState_GenMsgs_ExecuteContract) Size() (n int) { } return n } - func (m *Code) Size() (n int) { if m == nil { return 0 @@ -960,11 +924,9 @@ func (m *Sequence) Size() (n int) { 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 @@ -1184,7 +1146,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } - func (m *GenesisState_GenMsgs) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1340,7 +1301,6 @@ func (m *GenesisState_GenMsgs) Unmarshal(dAtA []byte) error { } return nil } - func (m *Code) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1497,7 +1457,6 @@ func (m *Code) Unmarshal(dAtA []byte) error { } return nil } - func (m *Contract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1647,7 +1606,6 @@ func (m *Contract) Unmarshal(dAtA []byte) error { } return nil } - func (m *Sequence) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1751,7 +1709,6 @@ func (m *Sequence) Unmarshal(dAtA []byte) error { } return nil } - func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/ibc.pb.go b/x/wasm/types/ibc.pb.go index 64d22ee..ac6c9f0 100644 --- a/x/wasm/types/ibc.pb.go +++ b/x/wasm/types/ibc.pb.go @@ -5,21 +5,17 @@ package types import ( fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" - - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal - -var ( - _ = fmt.Errorf - _ = math.Inf -) +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. @@ -48,11 +44,9 @@ func (*MsgIBCSend) ProtoMessage() {} func (*MsgIBCSend) Descriptor() ([]byte, []int) { return fileDescriptor_af0d1c43ea53c4b9, []int{0} } - func (m *MsgIBCSend) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgIBCSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgIBCSend.Marshal(b, m, deterministic) @@ -65,15 +59,12 @@ func (m *MsgIBCSend) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *MsgIBCSend) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgIBCSend.Merge(m, src) } - func (m *MsgIBCSend) XXX_Size() int { return m.Size() } - func (m *MsgIBCSend) XXX_DiscardUnknown() { xxx_messageInfo_MsgIBCSend.DiscardUnknown(m) } @@ -91,11 +82,9 @@ func (*MsgIBCCloseChannel) ProtoMessage() {} func (*MsgIBCCloseChannel) Descriptor() ([]byte, []int) { return fileDescriptor_af0d1c43ea53c4b9, []int{1} } - func (m *MsgIBCCloseChannel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgIBCCloseChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgIBCCloseChannel.Marshal(b, m, deterministic) @@ -108,15 +97,12 @@ func (m *MsgIBCCloseChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgIBCCloseChannel) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgIBCCloseChannel.Merge(m, src) } - func (m *MsgIBCCloseChannel) XXX_Size() int { return m.Size() } - func (m *MsgIBCCloseChannel) XXX_DiscardUnknown() { xxx_messageInfo_MsgIBCCloseChannel.DiscardUnknown(m) } @@ -241,7 +227,6 @@ func encodeVarintIbc(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *MsgIBCSend) Size() (n int) { if m == nil { return 0 @@ -281,11 +266,9 @@ func (m *MsgIBCCloseChannel) Size() (n int) { func sovIbc(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozIbc(x uint64) (n int) { return sovIbc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *MsgIBCSend) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -440,7 +423,6 @@ func (m *MsgIBCSend) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgIBCCloseChannel) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -523,7 +505,6 @@ func (m *MsgIBCCloseChannel) Unmarshal(dAtA []byte) error { } return nil } - func skipIbc(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/keys.go b/x/wasm/types/keys.go index fb636ef..cbcb4a2 100644 --- a/x/wasm/types/keys.go +++ b/x/wasm/types/keys.go @@ -31,6 +31,8 @@ var ( ContractByCodeIDAndCreatedSecondaryIndexPrefix = []byte{0x06} PinnedCodeIndexPrefix = []byte{0x07} TXCounterPrefix = []byte{0x08} + ContractStoreSizePrefix = []byte{0x09} + ContractRentInfoPrefix = []byte{0x0A} KeyLastCodeID = append(SequenceKeyPrefix, []byte("lastCodeId")...) KeyLastInstanceID = append(SequenceKeyPrefix, []byte("lastContractId")...) @@ -52,6 +54,16 @@ func GetContractStorePrefix(addr sdk.AccAddress) []byte { return append(ContractStorePrefix, addr...) } +// GetContractStoreSizePrefix returns the store prefix for the total byte size of a contract instance +func GetContractStoreSizePrefix(addr sdk.AccAddress) []byte { + return append(ContractStoreSizePrefix, addr...) +} + +// GetContractRentInfoPrefix returns the store prefix for the remaining rents a contract instance +func GetContractRentInfoPrefix(addr sdk.AccAddress) []byte { + return append(ContractRentInfoPrefix, addr...) +} + // GetContractByCreatedSecondaryIndexKey returns the key for the secondary index: // `` func GetContractByCreatedSecondaryIndexKey(contractAddr sdk.AccAddress, c ContractCodeHistoryEntry) []byte { diff --git a/x/wasm/types/params.go b/x/wasm/types/params.go index ea8046c..f2c2889 100644 --- a/x/wasm/types/params.go +++ b/x/wasm/types/params.go @@ -15,6 +15,8 @@ import ( var ( ParamStoreKeyUploadAccess = []byte("uploadAccess") ParamStoreKeyInstantiateAccess = []byte("instantiateAccess") + ParamStoreKeyUnitRentPrice = []byte("unitrentprice") + ParamStoreKeyRentDenom = []byte("rentdenom") ) var AllAccessTypes = []AccessType{ @@ -78,9 +80,11 @@ func (a AccessConfig) Equals(o AccessConfig) bool { } var ( - DefaultUploadAccess = AllowEverybody - AllowEverybody = AccessConfig{Permission: AccessTypeEverybody} - AllowNobody = AccessConfig{Permission: AccessTypeNobody} + DefaultUploadAccess = AllowEverybody + AllowEverybody = AccessConfig{Permission: AccessTypeEverybody} + AllowNobody = AccessConfig{Permission: AccessTypeNobody} + DefaultUnitRentPrice = sdk.NewDecWithPrec(1, 2) // 0.01 + DefaultRentDenom = "usei" ) // ParamKeyTable returns the parameter key table. @@ -93,6 +97,8 @@ func DefaultParams() Params { return Params{ CodeUploadAccess: AllowEverybody, InstantiateDefaultPermission: AccessTypeEverybody, + UnitRentPrice: DefaultUnitRentPrice, + RentDenom: DefaultRentDenom, } } @@ -109,6 +115,8 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(ParamStoreKeyUploadAccess, &p.CodeUploadAccess, validateAccessConfig), paramtypes.NewParamSetPair(ParamStoreKeyInstantiateAccess, &p.InstantiateDefaultPermission, validateAccessType), + paramtypes.NewParamSetPair(ParamStoreKeyUnitRentPrice, &p.UnitRentPrice, validateUnitRentPrice), + paramtypes.NewParamSetPair(ParamStoreKeyRentDenom, &p.RentDenom, validateRentDenom), } } @@ -120,6 +128,12 @@ func (p Params) ValidateBasic() error { if err := validateAccessConfig(p.CodeUploadAccess); err != nil { return errors.Wrap(err, "upload access") } + if err := validateUnitRentPrice(p.UnitRentPrice); err != nil { + return errors.Wrap(err, "unit rent price") + } + if err := validateRentDenom(p.RentDenom); err != nil { + return errors.Wrap(err, "rent denom") + } return nil } @@ -147,6 +161,28 @@ func validateAccessType(i interface{}) error { return sdkerrors.Wrapf(ErrInvalid, "unknown type: %q", a) } +func validateUnitRentPrice(i interface{}) error { + p, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if !p.IsPositive() { + return fmt.Errorf("rent price must be positive but got %s", p.String()) + } + return nil +} + +func validateRentDenom(i interface{}) error { + d, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if d == "" { + return errors.New("rent denom cannot be empty") + } + return nil +} + func (a AccessConfig) ValidateBasic() error { switch a.Permission { case AccessTypeUnspecified: diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go index c4b1d97..b5d81d8 100644 --- a/x/wasm/types/proposal.pb.go +++ b/x/wasm/types/proposal.pb.go @@ -6,23 +6,19 @@ package types import ( bytes "bytes" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" 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 - _ = math.Inf -) +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. @@ -49,11 +45,9 @@ func (*StoreCodeProposal) ProtoMessage() {} func (*StoreCodeProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{0} } - func (m *StoreCodeProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *StoreCodeProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_StoreCodeProposal.Marshal(b, m, deterministic) @@ -66,15 +60,12 @@ func (m *StoreCodeProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *StoreCodeProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_StoreCodeProposal.Merge(m, src) } - func (m *StoreCodeProposal) XXX_Size() int { return m.Size() } - func (m *StoreCodeProposal) XXX_DiscardUnknown() { xxx_messageInfo_StoreCodeProposal.DiscardUnknown(m) } @@ -107,11 +98,9 @@ func (*InstantiateContractProposal) ProtoMessage() {} func (*InstantiateContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{1} } - func (m *InstantiateContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *InstantiateContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_InstantiateContractProposal.Marshal(b, m, deterministic) @@ -124,15 +113,12 @@ func (m *InstantiateContractProposal) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *InstantiateContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_InstantiateContractProposal.Merge(m, src) } - func (m *InstantiateContractProposal) XXX_Size() int { return m.Size() } - func (m *InstantiateContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_InstantiateContractProposal.DiscardUnknown(m) } @@ -158,11 +144,9 @@ func (*MigrateContractProposal) ProtoMessage() {} func (*MigrateContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{2} } - func (m *MigrateContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MigrateContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MigrateContractProposal.Marshal(b, m, deterministic) @@ -175,15 +159,12 @@ func (m *MigrateContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *MigrateContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_MigrateContractProposal.Merge(m, src) } - func (m *MigrateContractProposal) XXX_Size() int { return m.Size() } - func (m *MigrateContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_MigrateContractProposal.DiscardUnknown(m) } @@ -207,11 +188,9 @@ func (*SudoContractProposal) ProtoMessage() {} func (*SudoContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{3} } - func (m *SudoContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *SudoContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_SudoContractProposal.Marshal(b, m, deterministic) @@ -224,15 +203,12 @@ func (m *SudoContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } - func (m *SudoContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_SudoContractProposal.Merge(m, src) } - func (m *SudoContractProposal) XXX_Size() int { return m.Size() } - func (m *SudoContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_SudoContractProposal.DiscardUnknown(m) } @@ -261,11 +237,9 @@ func (*ExecuteContractProposal) ProtoMessage() {} func (*ExecuteContractProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{4} } - func (m *ExecuteContractProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *ExecuteContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ExecuteContractProposal.Marshal(b, m, deterministic) @@ -278,15 +252,12 @@ func (m *ExecuteContractProposal) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *ExecuteContractProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_ExecuteContractProposal.Merge(m, src) } - func (m *ExecuteContractProposal) XXX_Size() int { return m.Size() } - func (m *ExecuteContractProposal) XXX_DiscardUnknown() { xxx_messageInfo_ExecuteContractProposal.DiscardUnknown(m) } @@ -310,11 +281,9 @@ func (*UpdateAdminProposal) ProtoMessage() {} func (*UpdateAdminProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{5} } - func (m *UpdateAdminProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *UpdateAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UpdateAdminProposal.Marshal(b, m, deterministic) @@ -327,15 +296,12 @@ func (m *UpdateAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *UpdateAdminProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_UpdateAdminProposal.Merge(m, src) } - func (m *UpdateAdminProposal) XXX_Size() int { return m.Size() } - func (m *UpdateAdminProposal) XXX_DiscardUnknown() { xxx_messageInfo_UpdateAdminProposal.DiscardUnknown(m) } @@ -358,11 +324,9 @@ func (*ClearAdminProposal) ProtoMessage() {} func (*ClearAdminProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{6} } - func (m *ClearAdminProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *ClearAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ClearAdminProposal.Marshal(b, m, deterministic) @@ -375,15 +339,12 @@ func (m *ClearAdminProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *ClearAdminProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_ClearAdminProposal.Merge(m, src) } - func (m *ClearAdminProposal) XXX_Size() int { return m.Size() } - func (m *ClearAdminProposal) XXX_DiscardUnknown() { xxx_messageInfo_ClearAdminProposal.DiscardUnknown(m) } @@ -406,11 +367,9 @@ func (*PinCodesProposal) ProtoMessage() {} func (*PinCodesProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{7} } - func (m *PinCodesProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *PinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_PinCodesProposal.Marshal(b, m, deterministic) @@ -423,15 +382,12 @@ func (m *PinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *PinCodesProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_PinCodesProposal.Merge(m, src) } - func (m *PinCodesProposal) XXX_Size() int { return m.Size() } - func (m *PinCodesProposal) XXX_DiscardUnknown() { xxx_messageInfo_PinCodesProposal.DiscardUnknown(m) } @@ -454,11 +410,9 @@ func (*UnpinCodesProposal) ProtoMessage() {} func (*UnpinCodesProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{8} } - func (m *UnpinCodesProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *UnpinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UnpinCodesProposal.Marshal(b, m, deterministic) @@ -471,15 +425,12 @@ func (m *UnpinCodesProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *UnpinCodesProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_UnpinCodesProposal.Merge(m, src) } - func (m *UnpinCodesProposal) XXX_Size() int { return m.Size() } - func (m *UnpinCodesProposal) XXX_DiscardUnknown() { xxx_messageInfo_UnpinCodesProposal.DiscardUnknown(m) } @@ -500,11 +451,9 @@ func (*AccessConfigUpdate) ProtoMessage() {} func (*AccessConfigUpdate) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{9} } - func (m *AccessConfigUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *AccessConfigUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessConfigUpdate.Marshal(b, m, deterministic) @@ -517,15 +466,12 @@ func (m *AccessConfigUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *AccessConfigUpdate) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessConfigUpdate.Merge(m, src) } - func (m *AccessConfigUpdate) XXX_Size() int { return m.Size() } - func (m *AccessConfigUpdate) XXX_DiscardUnknown() { xxx_messageInfo_AccessConfigUpdate.DiscardUnknown(m) } @@ -549,11 +495,9 @@ func (*UpdateInstantiateConfigProposal) ProtoMessage() {} func (*UpdateInstantiateConfigProposal) Descriptor() ([]byte, []int) { return fileDescriptor_be6422d717c730cb, []int{10} } - func (m *UpdateInstantiateConfigProposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *UpdateInstantiateConfigProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_UpdateInstantiateConfigProposal.Marshal(b, m, deterministic) @@ -566,15 +510,12 @@ func (m *UpdateInstantiateConfigProposal) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } - func (m *UpdateInstantiateConfigProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_UpdateInstantiateConfigProposal.Merge(m, src) } - func (m *UpdateInstantiateConfigProposal) XXX_Size() int { return m.Size() } - func (m *UpdateInstantiateConfigProposal) XXX_DiscardUnknown() { xxx_messageInfo_UpdateInstantiateConfigProposal.DiscardUnknown(m) } @@ -689,7 +630,6 @@ func (this *StoreCodeProposal) Equal(that interface{}) bool { } return true } - func (this *InstantiateContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -740,7 +680,6 @@ func (this *InstantiateContractProposal) Equal(that interface{}) bool { } return true } - func (this *MigrateContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -777,7 +716,6 @@ func (this *MigrateContractProposal) Equal(that interface{}) bool { } return true } - func (this *SudoContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -811,7 +749,6 @@ func (this *SudoContractProposal) Equal(that interface{}) bool { } return true } - func (this *ExecuteContractProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -856,7 +793,6 @@ func (this *ExecuteContractProposal) Equal(that interface{}) bool { } return true } - func (this *UpdateAdminProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -890,7 +826,6 @@ func (this *UpdateAdminProposal) Equal(that interface{}) bool { } return true } - func (this *ClearAdminProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -921,7 +856,6 @@ func (this *ClearAdminProposal) Equal(that interface{}) bool { } return true } - func (this *PinCodesProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -957,7 +891,6 @@ func (this *PinCodesProposal) Equal(that interface{}) bool { } return true } - func (this *UnpinCodesProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -993,7 +926,6 @@ func (this *UnpinCodesProposal) Equal(that interface{}) bool { } return true } - func (this *AccessConfigUpdate) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1021,7 +953,6 @@ func (this *AccessConfigUpdate) Equal(that interface{}) bool { } return true } - func (this *UpdateInstantiateConfigProposal) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1057,7 +988,6 @@ func (this *UpdateInstantiateConfigProposal) Equal(that interface{}) bool { } return true } - func (m *StoreCodeProposal) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1689,7 +1619,6 @@ func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *StoreCodeProposal) Size() (n int) { if m == nil { return 0 @@ -1983,11 +1912,9 @@ func (m *UpdateInstantiateConfigProposal) Size() (n int) { func sovProposal(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozProposal(x uint64) (n int) { return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2204,7 +2131,6 @@ func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *InstantiateContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2502,7 +2428,6 @@ func (m *InstantiateContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2702,7 +2627,6 @@ func (m *MigrateContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *SudoContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2883,7 +2807,6 @@ func (m *SudoContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *ExecuteContractProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3130,7 +3053,6 @@ func (m *ExecuteContractProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *UpdateAdminProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3309,7 +3231,6 @@ func (m *UpdateAdminProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *ClearAdminProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3456,7 +3377,6 @@ func (m *ClearAdminProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *PinCodesProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3647,7 +3567,6 @@ func (m *PinCodesProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *UnpinCodesProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3838,7 +3757,6 @@ func (m *UnpinCodesProposal) Unmarshal(dAtA []byte) error { } return nil } - func (m *AccessConfigUpdate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3941,7 +3859,6 @@ func (m *AccessConfigUpdate) Unmarshal(dAtA []byte) error { } return nil } - func (m *UpdateInstantiateConfigProposal) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4090,7 +4007,6 @@ func (m *UpdateInstantiateConfigProposal) Unmarshal(dAtA []byte) error { } return nil } - func skipProposal(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index 51aead5..ca6a791 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -7,10 +7,6 @@ import ( bytes "bytes" context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - query "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" @@ -20,15 +16,15 @@ import ( 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 - _ = math.Inf -) +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. @@ -49,11 +45,9 @@ func (*QueryContractInfoRequest) ProtoMessage() {} func (*QueryContractInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{0} } - func (m *QueryContractInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoRequest.Marshal(b, m, deterministic) @@ -66,15 +60,12 @@ func (m *QueryContractInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } - func (m *QueryContractInfoRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoRequest.Merge(m, src) } - func (m *QueryContractInfoRequest) XXX_Size() int { return m.Size() } - func (m *QueryContractInfoRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoRequest.DiscardUnknown(m) } @@ -95,11 +86,9 @@ func (*QueryContractInfoResponse) ProtoMessage() {} func (*QueryContractInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{1} } - func (m *QueryContractInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractInfoResponse.Marshal(b, m, deterministic) @@ -112,15 +101,12 @@ func (m *QueryContractInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } - func (m *QueryContractInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractInfoResponse.Merge(m, src) } - func (m *QueryContractInfoResponse) XXX_Size() int { return m.Size() } - func (m *QueryContractInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractInfoResponse.DiscardUnknown(m) } @@ -142,11 +128,9 @@ func (*QueryContractHistoryRequest) ProtoMessage() {} func (*QueryContractHistoryRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{2} } - func (m *QueryContractHistoryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryRequest.Marshal(b, m, deterministic) @@ -159,15 +143,12 @@ func (m *QueryContractHistoryRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractHistoryRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryRequest.Merge(m, src) } - func (m *QueryContractHistoryRequest) XXX_Size() int { return m.Size() } - func (m *QueryContractHistoryRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryRequest.DiscardUnknown(m) } @@ -188,11 +169,9 @@ func (*QueryContractHistoryResponse) ProtoMessage() {} func (*QueryContractHistoryResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{3} } - func (m *QueryContractHistoryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractHistoryResponse.Marshal(b, m, deterministic) @@ -205,15 +184,12 @@ func (m *QueryContractHistoryResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractHistoryResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractHistoryResponse.Merge(m, src) } - func (m *QueryContractHistoryResponse) XXX_Size() int { return m.Size() } - func (m *QueryContractHistoryResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractHistoryResponse.DiscardUnknown(m) } @@ -234,11 +210,9 @@ func (*QueryContractsByCodeRequest) ProtoMessage() {} func (*QueryContractsByCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{4} } - func (m *QueryContractsByCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeRequest.Marshal(b, m, deterministic) @@ -251,15 +225,12 @@ func (m *QueryContractsByCodeRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractsByCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeRequest.Merge(m, src) } - func (m *QueryContractsByCodeRequest) XXX_Size() int { return m.Size() } - func (m *QueryContractsByCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeRequest.DiscardUnknown(m) } @@ -281,11 +252,9 @@ func (*QueryContractsByCodeResponse) ProtoMessage() {} func (*QueryContractsByCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{5} } - func (m *QueryContractsByCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryContractsByCodeResponse.Marshal(b, m, deterministic) @@ -298,15 +267,12 @@ func (m *QueryContractsByCodeResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryContractsByCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryContractsByCodeResponse.Merge(m, src) } - func (m *QueryContractsByCodeResponse) XXX_Size() int { return m.Size() } - func (m *QueryContractsByCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryContractsByCodeResponse.DiscardUnknown(m) } @@ -328,11 +294,9 @@ func (*QueryAllContractStateRequest) ProtoMessage() {} func (*QueryAllContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{6} } - func (m *QueryAllContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateRequest.Marshal(b, m, deterministic) @@ -345,15 +309,12 @@ func (m *QueryAllContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryAllContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateRequest.Merge(m, src) } - func (m *QueryAllContractStateRequest) XXX_Size() int { return m.Size() } - func (m *QueryAllContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateRequest.DiscardUnknown(m) } @@ -374,11 +335,9 @@ func (*QueryAllContractStateResponse) ProtoMessage() {} func (*QueryAllContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{7} } - func (m *QueryAllContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryAllContractStateResponse.Marshal(b, m, deterministic) @@ -391,15 +350,12 @@ func (m *QueryAllContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryAllContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryAllContractStateResponse.Merge(m, src) } - func (m *QueryAllContractStateResponse) XXX_Size() int { return m.Size() } - func (m *QueryAllContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryAllContractStateResponse.DiscardUnknown(m) } @@ -420,11 +376,9 @@ func (*QueryRawContractStateRequest) ProtoMessage() {} func (*QueryRawContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{8} } - func (m *QueryRawContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateRequest.Marshal(b, m, deterministic) @@ -437,15 +391,12 @@ func (m *QueryRawContractStateRequest) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } - func (m *QueryRawContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateRequest.Merge(m, src) } - func (m *QueryRawContractStateRequest) XXX_Size() int { return m.Size() } - func (m *QueryRawContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateRequest.DiscardUnknown(m) } @@ -465,11 +416,9 @@ func (*QueryRawContractStateResponse) ProtoMessage() {} func (*QueryRawContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{9} } - func (m *QueryRawContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryRawContractStateResponse.Marshal(b, m, deterministic) @@ -482,15 +431,12 @@ func (m *QueryRawContractStateResponse) XXX_Marshal(b []byte, deterministic bool return b[:n], nil } } - func (m *QueryRawContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryRawContractStateResponse.Merge(m, src) } - func (m *QueryRawContractStateResponse) XXX_Size() int { return m.Size() } - func (m *QueryRawContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryRawContractStateResponse.DiscardUnknown(m) } @@ -512,11 +458,9 @@ func (*QuerySmartContractStateRequest) ProtoMessage() {} func (*QuerySmartContractStateRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{10} } - func (m *QuerySmartContractStateRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateRequest.Marshal(b, m, deterministic) @@ -529,15 +473,12 @@ func (m *QuerySmartContractStateRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } - func (m *QuerySmartContractStateRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateRequest.Merge(m, src) } - func (m *QuerySmartContractStateRequest) XXX_Size() int { return m.Size() } - func (m *QuerySmartContractStateRequest) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateRequest.DiscardUnknown(m) } @@ -557,11 +498,9 @@ func (*QuerySmartContractStateResponse) ProtoMessage() {} func (*QuerySmartContractStateResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{11} } - func (m *QuerySmartContractStateResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QuerySmartContractStateResponse.Marshal(b, m, deterministic) @@ -574,15 +513,12 @@ func (m *QuerySmartContractStateResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } - func (m *QuerySmartContractStateResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QuerySmartContractStateResponse.Merge(m, src) } - func (m *QuerySmartContractStateResponse) XXX_Size() int { return m.Size() } - func (m *QuerySmartContractStateResponse) XXX_DiscardUnknown() { xxx_messageInfo_QuerySmartContractStateResponse.DiscardUnknown(m) } @@ -600,11 +536,9 @@ func (*QueryCodeRequest) ProtoMessage() {} func (*QueryCodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{12} } - func (m *QueryCodeRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeRequest.Marshal(b, m, deterministic) @@ -617,15 +551,12 @@ func (m *QueryCodeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *QueryCodeRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeRequest.Merge(m, src) } - func (m *QueryCodeRequest) XXX_Size() int { return m.Size() } - func (m *QueryCodeRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeRequest.DiscardUnknown(m) } @@ -646,11 +577,9 @@ func (*CodeInfoResponse) ProtoMessage() {} func (*CodeInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{13} } - func (m *CodeInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeInfoResponse.Marshal(b, m, deterministic) @@ -663,15 +592,12 @@ func (m *CodeInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } - func (m *CodeInfoResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeInfoResponse.Merge(m, src) } - func (m *CodeInfoResponse) XXX_Size() int { return m.Size() } - func (m *CodeInfoResponse) XXX_DiscardUnknown() { xxx_messageInfo_CodeInfoResponse.DiscardUnknown(m) } @@ -690,11 +616,9 @@ func (*QueryCodeResponse) ProtoMessage() {} func (*QueryCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{14} } - func (m *QueryCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodeResponse.Marshal(b, m, deterministic) @@ -707,15 +631,12 @@ func (m *QueryCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *QueryCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodeResponse.Merge(m, src) } - func (m *QueryCodeResponse) XXX_Size() int { return m.Size() } - func (m *QueryCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodeResponse.DiscardUnknown(m) } @@ -734,11 +655,9 @@ func (*QueryCodesRequest) ProtoMessage() {} func (*QueryCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{15} } - func (m *QueryCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesRequest.Marshal(b, m, deterministic) @@ -751,15 +670,12 @@ func (m *QueryCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } - func (m *QueryCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesRequest.Merge(m, src) } - func (m *QueryCodesRequest) XXX_Size() int { return m.Size() } - func (m *QueryCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesRequest.DiscardUnknown(m) } @@ -779,11 +695,9 @@ func (*QueryCodesResponse) ProtoMessage() {} func (*QueryCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{16} } - func (m *QueryCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryCodesResponse.Marshal(b, m, deterministic) @@ -796,15 +710,12 @@ func (m *QueryCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *QueryCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryCodesResponse.Merge(m, src) } - func (m *QueryCodesResponse) XXX_Size() int { return m.Size() } - func (m *QueryCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryCodesResponse.DiscardUnknown(m) } @@ -824,11 +735,9 @@ func (*QueryPinnedCodesRequest) ProtoMessage() {} func (*QueryPinnedCodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{17} } - func (m *QueryPinnedCodesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesRequest.Marshal(b, m, deterministic) @@ -841,15 +750,12 @@ func (m *QueryPinnedCodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } - func (m *QueryPinnedCodesRequest) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesRequest.Merge(m, src) } - func (m *QueryPinnedCodesRequest) XXX_Size() int { return m.Size() } - func (m *QueryPinnedCodesRequest) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesRequest.DiscardUnknown(m) } @@ -870,11 +776,9 @@ func (*QueryPinnedCodesResponse) ProtoMessage() {} func (*QueryPinnedCodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9677c207036b9f2b, []int{18} } - func (m *QueryPinnedCodesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_QueryPinnedCodesResponse.Marshal(b, m, deterministic) @@ -887,21 +791,167 @@ func (m *QueryPinnedCodesResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } - func (m *QueryPinnedCodesResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_QueryPinnedCodesResponse.Merge(m, src) } - func (m *QueryPinnedCodesResponse) XXX_Size() int { return m.Size() } - func (m *QueryPinnedCodesResponse) XXX_DiscardUnknown() { xxx_messageInfo_QueryPinnedCodesResponse.DiscardUnknown(m) } var xxx_messageInfo_QueryPinnedCodesResponse proto.InternalMessageInfo +type QueryRentInfoRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryRentInfoRequest) Reset() { *m = QueryRentInfoRequest{} } +func (m *QueryRentInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRentInfoRequest) ProtoMessage() {} +func (*QueryRentInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{19} +} +func (m *QueryRentInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRentInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRentInfoRequest.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 *QueryRentInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRentInfoRequest.Merge(m, src) +} +func (m *QueryRentInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRentInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRentInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRentInfoRequest proto.InternalMessageInfo + +type QueryRentInfoResponse struct { + Balance uint64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"` + LastChargedBlock uint64 `protobuf:"varint,2,opt,name=last_charged_block,json=lastChargedBlock,proto3" json:"last_charged_block,omitempty"` +} + +func (m *QueryRentInfoResponse) Reset() { *m = QueryRentInfoResponse{} } +func (m *QueryRentInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRentInfoResponse) ProtoMessage() {} +func (*QueryRentInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{20} +} +func (m *QueryRentInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRentInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRentInfoResponse.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 *QueryRentInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRentInfoResponse.Merge(m, src) +} +func (m *QueryRentInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRentInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRentInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRentInfoResponse proto.InternalMessageInfo + +type QueryStateSizeRequest struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *QueryStateSizeRequest) Reset() { *m = QueryStateSizeRequest{} } +func (m *QueryStateSizeRequest) String() string { return proto.CompactTextString(m) } +func (*QueryStateSizeRequest) ProtoMessage() {} +func (*QueryStateSizeRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{21} +} +func (m *QueryStateSizeRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStateSizeRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStateSizeRequest.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 *QueryStateSizeRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStateSizeRequest.Merge(m, src) +} +func (m *QueryStateSizeRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryStateSizeRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStateSizeRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStateSizeRequest proto.InternalMessageInfo + +type QueryStateSizeResponse struct { + StateSize uint64 `protobuf:"varint,1,opt,name=state_size,json=stateSize,proto3" json:"state_size,omitempty"` +} + +func (m *QueryStateSizeResponse) Reset() { *m = QueryStateSizeResponse{} } +func (m *QueryStateSizeResponse) String() string { return proto.CompactTextString(m) } +func (*QueryStateSizeResponse) ProtoMessage() {} +func (*QueryStateSizeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9677c207036b9f2b, []int{22} +} +func (m *QueryStateSizeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryStateSizeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryStateSizeResponse.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 *QueryStateSizeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryStateSizeResponse.Merge(m, src) +} +func (m *QueryStateSizeResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryStateSizeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryStateSizeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryStateSizeResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*QueryContractInfoRequest)(nil), "cosmwasm.wasm.v1.QueryContractInfoRequest") proto.RegisterType((*QueryContractInfoResponse)(nil), "cosmwasm.wasm.v1.QueryContractInfoResponse") @@ -922,87 +972,100 @@ func init() { proto.RegisterType((*QueryCodesResponse)(nil), "cosmwasm.wasm.v1.QueryCodesResponse") proto.RegisterType((*QueryPinnedCodesRequest)(nil), "cosmwasm.wasm.v1.QueryPinnedCodesRequest") proto.RegisterType((*QueryPinnedCodesResponse)(nil), "cosmwasm.wasm.v1.QueryPinnedCodesResponse") + proto.RegisterType((*QueryRentInfoRequest)(nil), "cosmwasm.wasm.v1.QueryRentInfoRequest") + proto.RegisterType((*QueryRentInfoResponse)(nil), "cosmwasm.wasm.v1.QueryRentInfoResponse") + proto.RegisterType((*QueryStateSizeRequest)(nil), "cosmwasm.wasm.v1.QueryStateSizeRequest") + proto.RegisterType((*QueryStateSizeResponse)(nil), "cosmwasm.wasm.v1.QueryStateSizeResponse") } func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1191 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x4f, 0x24, 0x45, - 0x14, 0xc7, 0xa7, 0xd8, 0x61, 0x7e, 0x14, 0x98, 0x1d, 0x2b, 0x0a, 0xe3, 0xc8, 0x76, 0x93, 0x76, - 0x83, 0x2c, 0x8b, 0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0xea, 0x42, 0x8f, - 0x22, 0x0c, 0x2c, 0xfc, 0xa4, 0xed, 0x05, 0x02, 0x3c, 0x77, 0x81, 0x78, 0x0a, 0x20, 0x8a, 0x7a, - 0x57, 0x21, 0xde, 0x83, 0xb0, 0x15, 0x62, 0x58, 0x19, 0x06, 0x89, 0x31, 0xd0, 0x37, 0x1b, 0xc6, - 0x77, 0x89, 0x75, 0x02, 0xc3, 0x71, 0xc9, 0xb9, 0xee, 0x7a, 0x1e, 0x71, 0xce, 0xd1, 0xe2, 0xf9, - 0x8b, 0xe5, 0x37, 0x40, 0x8d, 0x2d, 0x6d, 0x67, 0xb4, 0xee, 0x60, 0x46, 0xdd, 0x8a, 0x40, 0x8f, - 0x64, 0xf1, 0xaa, 0x88, 0xb5, 0xd9, 0xd0, 0xd3, 0xc1, 0xd5, 0x60, 0x76, 0x3a, 0xb8, 0x15, 0x97, - 0x17, 0xf4, 0xfc, 0x97, 0x23, 0x70, 0x58, 0x12, 0xa1, 0xef, 0x01, 0x1c, 0x8d, 0x4e, 0x2f, 0xa8, - 0x47, 0xa3, 0x8f, 0x1b, 0xb9, 0x0a, 0x37, 0x07, 0xb2, 0x0d, 0xce, 0x37, 0x66, 0x9f, 0xfc, 0xf9, - 0xef, 0x77, 0x43, 0x53, 0xe8, 0xba, 0xd5, 0x35, 0x2c, 0x86, 0x3d, 0xd2, 0x3a, 0x50, 0x35, 0xef, - 0x10, 0x3d, 0x05, 0xf0, 0x6a, 0xc7, 0x70, 0x82, 0xde, 0xea, 0x73, 0x5c, 0xfb, 0x18, 0x55, 0x30, - 0x07, 0x35, 0x57, 0x80, 0x0b, 0x12, 0xd0, 0x44, 0xb3, 0x83, 0x00, 0x5a, 0x5b, 0x0a, 0xea, 0xe7, - 0x08, 0xa8, 0x9a, 0x07, 0xfa, 0x82, 0xb6, 0x0f, 0x2e, 0x7d, 0x41, 0x3b, 0xc6, 0x0c, 0x63, 0x5e, - 0x82, 0xce, 0xa2, 0x99, 0x5e, 0x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 0xd4, 0xc0, 0x71, - 0x53, 0x03, 0x7f, 0x37, 0x35, 0xf0, 0xed, 0x89, 0x96, 0x38, 0x3e, 0xd1, 0x12, 0x7f, 0x9d, 0x68, - 0x89, 0x4f, 0xa6, 0x22, 0xc3, 0xcd, 0x12, 0x65, 0xd5, 0x87, 0xa1, 0x2f, 0xc7, 0x7a, 0x1c, 0xf8, - 0x94, 0xbf, 0xb6, 0x4b, 0x29, 0xf9, 0x23, 0xf9, 0xd6, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe8, - 0x7b, 0x25, 0x05, 0xd4, 0x0f, 0x00, 0x00, + // 1329 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0x4f, 0x6f, 0x1b, 0xc5, + 0x1b, 0xc7, 0x3d, 0xa9, 0xe3, 0x3f, 0xd3, 0x54, 0xf5, 0x6f, 0xd4, 0xa6, 0xfe, 0x99, 0x74, 0x1d, + 0x2d, 0x55, 0x9a, 0xa6, 0x61, 0xb7, 0x4e, 0x5b, 0x15, 0x90, 0x10, 0xaa, 0x53, 0x68, 0x5a, 0xa9, + 0x52, 0xbb, 0x15, 0xaa, 0x44, 0x0f, 0xd6, 0x78, 0x77, 0x6a, 0xaf, 0xb0, 0x77, 0xdd, 0x9d, 0x49, + 0x52, 0x37, 0x0a, 0xa0, 0x4a, 0x95, 0x38, 0x20, 0x40, 0x42, 0xdc, 0x40, 0x70, 0x40, 0x85, 0x33, + 0xdc, 0x78, 0x05, 0x39, 0x46, 0xe2, 0xc2, 0xc9, 0x02, 0x87, 0x03, 0xca, 0x4b, 0xe8, 0x09, 0xcd, + 0xec, 0xac, 0xbd, 0xfe, 0xb3, 0x59, 0xa7, 0x8a, 0xb8, 0x58, 0xbb, 0x3b, 0xcf, 0xf3, 0xcc, 0xe7, + 0xf9, 0xee, 0xb3, 0xcf, 0x3c, 0x32, 0x9c, 0x33, 0x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 0x80, 0x99, 0xe0, 0x50, 0x41, 0x0b, 0x51, 0x75, 0x3b, 0x78, 0x4e, 0x15, 0xce, 0xc7, 0xda, 0xc5, + 0xbf, 0x0a, 0x8f, 0x38, 0xe1, 0x8e, 0xfb, 0x19, 0x80, 0xd9, 0xde, 0x41, 0x82, 0xa2, 0x36, 0x18, + 0x3e, 0x9d, 0x0a, 0x8b, 0xf1, 0x86, 0xf1, 0x28, 0xfc, 0x94, 0xea, 0xa3, 0x94, 0xd7, 0x76, 0xfe, + 0x52, 0x12, 0x3f, 0x77, 0x95, 0xc4, 0x4e, 0x57, 0x01, 0xbb, 0x5d, 0x05, 0xfc, 0xd9, 0x55, 0xc0, + 0x57, 0x7b, 0x4a, 0x62, 0x77, 0x4f, 0x49, 0xfc, 0xb1, 0xa7, 0x24, 0x3e, 0x5c, 0x08, 0x8d, 0xbb, + 0xab, 0x2e, 0x6d, 0x3e, 0x08, 0xa2, 0x59, 0xfa, 0x13, 0x3f, 0xaa, 0xf8, 0xff, 0xa5, 0x9a, 0x12, + 0x7f, 0x9b, 0x5c, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0xae, 0x7b, 0xc8, 0xc5, 0xe6, 0x11, 0x00, + 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -1032,7 +1095,6 @@ func (this *QueryContractInfoResponse) Equal(that interface{}) bool { } return true } - func (this *CodeInfoResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1066,7 +1128,6 @@ func (this *CodeInfoResponse) Equal(that interface{}) bool { } return true } - func (this *QueryCodeResponse) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1125,6 +1186,8 @@ type QueryClient interface { Codes(ctx context.Context, in *QueryCodesRequest, opts ...grpc.CallOption) (*QueryCodesResponse, error) // PinnedCodes gets the pinned code ids PinnedCodes(ctx context.Context, in *QueryPinnedCodesRequest, opts ...grpc.CallOption) (*QueryPinnedCodesResponse, error) + RentInfo(ctx context.Context, in *QueryRentInfoRequest, opts ...grpc.CallOption) (*QueryRentInfoResponse, error) + StateSize(ctx context.Context, in *QueryStateSizeRequest, opts ...grpc.CallOption) (*QueryStateSizeResponse, error) } type queryClient struct { @@ -1216,6 +1279,24 @@ func (c *queryClient) PinnedCodes(ctx context.Context, in *QueryPinnedCodesReque return out, nil } +func (c *queryClient) RentInfo(ctx context.Context, in *QueryRentInfoRequest, opts ...grpc.CallOption) (*QueryRentInfoResponse, error) { + out := new(QueryRentInfoResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/RentInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) StateSize(ctx context.Context, in *QueryStateSizeRequest, opts ...grpc.CallOption) (*QueryStateSizeResponse, error) { + out := new(QueryStateSizeResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Query/StateSize", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ContractInfo gets the contract meta data @@ -1236,46 +1317,47 @@ type QueryServer interface { Codes(context.Context, *QueryCodesRequest) (*QueryCodesResponse, error) // PinnedCodes gets the pinned code ids PinnedCodes(context.Context, *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) + RentInfo(context.Context, *QueryRentInfoRequest) (*QueryRentInfoResponse, error) + StateSize(context.Context, *QueryStateSizeRequest) (*QueryStateSizeResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct{} +type UnimplementedQueryServer struct { +} func (*UnimplementedQueryServer) ContractInfo(ctx context.Context, req *QueryContractInfoRequest) (*QueryContractInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractInfo not implemented") } - func (*UnimplementedQueryServer) ContractHistory(ctx context.Context, req *QueryContractHistoryRequest) (*QueryContractHistoryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractHistory not implemented") } - func (*UnimplementedQueryServer) ContractsByCode(ctx context.Context, req *QueryContractsByCodeRequest) (*QueryContractsByCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ContractsByCode not implemented") } - func (*UnimplementedQueryServer) AllContractState(ctx context.Context, req *QueryAllContractStateRequest) (*QueryAllContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AllContractState not implemented") } - func (*UnimplementedQueryServer) RawContractState(ctx context.Context, req *QueryRawContractStateRequest) (*QueryRawContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawContractState not implemented") } - func (*UnimplementedQueryServer) SmartContractState(ctx context.Context, req *QuerySmartContractStateRequest) (*QuerySmartContractStateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SmartContractState not implemented") } - func (*UnimplementedQueryServer) Code(ctx context.Context, req *QueryCodeRequest) (*QueryCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Code not implemented") } - func (*UnimplementedQueryServer) Codes(ctx context.Context, req *QueryCodesRequest) (*QueryCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Codes not implemented") } - func (*UnimplementedQueryServer) PinnedCodes(ctx context.Context, req *QueryPinnedCodesRequest) (*QueryPinnedCodesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PinnedCodes not implemented") } +func (*UnimplementedQueryServer) RentInfo(ctx context.Context, req *QueryRentInfoRequest) (*QueryRentInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RentInfo not implemented") +} +func (*UnimplementedQueryServer) StateSize(ctx context.Context, req *QueryStateSizeRequest) (*QueryStateSizeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StateSize not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1443,6 +1525,42 @@ func _Query_PinnedCodes_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_RentInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRentInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RentInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Query/RentInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RentInfo(ctx, req.(*QueryRentInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_StateSize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryStateSizeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).StateSize(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Query/StateSize", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).StateSize(ctx, req.(*QueryStateSizeRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmwasm.wasm.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1483,6 +1601,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "PinnedCodes", Handler: _Query_PinnedCodes_Handler, }, + { + MethodName: "RentInfo", + Handler: _Query_RentInfo_Handler, + }, + { + MethodName: "StateSize", + Handler: _Query_StateSize_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmwasm/wasm/v1/query.proto", @@ -2252,18 +2378,138 @@ func (m *QueryPinnedCodesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error 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 *QueryRentInfoRequest) 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 *QueryRentInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRentInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRentInfoResponse) 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 *QueryRentInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRentInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.LastChargedBlock != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.LastChargedBlock)) + i-- + dAtA[i] = 0x10 + } + if m.Balance != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Balance)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } +func (m *QueryStateSizeRequest) 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 *QueryStateSizeRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStateSizeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryStateSizeResponse) 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 *QueryStateSizeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryStateSizeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.StateSize != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.StateSize)) + i-- + dAtA[i] = 0x8 + } + 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 *QueryContractInfoRequest) Size() (n int) { if m == nil { return 0 @@ -2575,14 +2821,65 @@ func (m *QueryPinnedCodesResponse) Size() (n int) { return n } +func (m *QueryRentInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRentInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Balance != 0 { + n += 1 + sovQuery(uint64(m.Balance)) + } + if m.LastChargedBlock != 0 { + n += 1 + sovQuery(uint64(m.LastChargedBlock)) + } + return n +} + +func (m *QueryStateSizeRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryStateSizeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StateSize != 0 { + n += 1 + sovQuery(uint64(m.StateSize)) + } + 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 *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2665,7 +2962,6 @@ func (m *QueryContractInfoRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2781,7 +3077,6 @@ func (m *QueryContractInfoResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2900,7 +3195,6 @@ func (m *QueryContractHistoryRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3021,7 +3315,6 @@ func (m *QueryContractHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3127,7 +3420,6 @@ func (m *QueryContractsByCodeRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3246,7 +3538,6 @@ func (m *QueryContractsByCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3365,7 +3656,6 @@ func (m *QueryAllContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3486,7 +3776,6 @@ func (m *QueryAllContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3603,7 +3892,6 @@ func (m *QueryRawContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3688,7 +3976,6 @@ func (m *QueryRawContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3805,7 +4092,6 @@ func (m *QuerySmartContractStateRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3890,7 +4176,6 @@ func (m *QuerySmartContractStateResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3960,7 +4245,6 @@ func (m *QueryCodeRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4129,7 +4413,6 @@ func (m *CodeInfoResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4250,7 +4533,6 @@ func (m *QueryCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4337,7 +4619,6 @@ func (m *QueryCodesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4458,7 +4739,6 @@ func (m *QueryCodesResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4545,7 +4825,6 @@ func (m *QueryPinnedCodesRequest) Unmarshal(dAtA []byte) error { } return nil } - func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4708,7 +4987,327 @@ func (m *QueryPinnedCodesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryRentInfoRequest) 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: QueryRentInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRentInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + 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 *QueryRentInfoResponse) 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: QueryRentInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRentInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Balance", wireType) + } + m.Balance = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Balance |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastChargedBlock", wireType) + } + m.LastChargedBlock = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastChargedBlock |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryStateSizeRequest) 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: QueryStateSizeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStateSizeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + 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 *QueryStateSizeResponse) 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: QueryStateSizeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryStateSizeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StateSize", wireType) + } + m.StateSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StateSize |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 diff --git a/x/wasm/types/query.pb.gw.go b/x/wasm/types/query.pb.gw.go index b382baf..0c11678 100644 --- a/x/wasm/types/query.pb.gw.go +++ b/x/wasm/types/query.pb.gw.go @@ -20,19 +20,18 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) // Suppress "imported and not used" errors var _ codes.Code - -var ( - _ io.Reader - _ status.Status - _ = runtime.String - _ = utilities.NewDoubleArray - _ = descriptor.ForMessage -) +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractInfoRequest @@ -58,6 +57,7 @@ func request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshal msg, err := client.ContractInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -84,9 +84,12 @@ func local_request_Query_ContractInfo_0(ctx context.Context, marshaler runtime.M msg, err := server.ContractInfo(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_ContractHistory_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractHistoryRequest @@ -119,6 +122,7 @@ func request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractHistory(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -152,9 +156,12 @@ func local_request_Query_ContractHistory_0(ctx context.Context, marshaler runtim msg, err := server.ContractHistory(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_ContractsByCode_0 = &utilities.DoubleArray{Encoding: map[string]int{"code_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryContractsByCodeRequest @@ -187,6 +194,7 @@ func request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Mars msg, err := client.ContractsByCode(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -220,9 +228,12 @@ func local_request_Query_ContractsByCode_0(ctx context.Context, marshaler runtim msg, err := server.ContractsByCode(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +var ( + filter_Query_AllContractState_0 = &utilities.DoubleArray{Encoding: map[string]int{"address": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryAllContractStateRequest @@ -255,6 +266,7 @@ func request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.AllContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_AllContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -288,6 +300,7 @@ func local_request_Query_AllContractState_0(ctx context.Context, marshaler runti msg, err := server.AllContractState(ctx, &protoReq) return msg, metadata, err + } func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -325,6 +338,7 @@ func request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Mar msg, err := client.RawContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_RawContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -362,6 +376,7 @@ func local_request_Query_RawContractState_0(ctx context.Context, marshaler runti msg, err := server.RawContractState(ctx, &protoReq) return msg, metadata, err + } func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -399,6 +414,7 @@ func request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.M msg, err := client.SmartContractState(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_SmartContractState_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -436,6 +452,7 @@ func local_request_Query_SmartContractState_0(ctx context.Context, marshaler run msg, err := server.SmartContractState(ctx, &protoReq) return msg, metadata, err + } func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -462,6 +479,7 @@ func request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, clie msg, err := client.Code(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -488,9 +506,12 @@ func local_request_Query_Code_0(ctx context.Context, marshaler runtime.Marshaler msg, err := server.Code(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var ( + filter_Query_Codes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryCodesRequest @@ -505,6 +526,7 @@ func request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, cli msg, err := client.Codes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -520,9 +542,12 @@ func local_request_Query_Codes_0(ctx context.Context, marshaler runtime.Marshale msg, err := server.Codes(ctx, &protoReq) return msg, metadata, err + } -var filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +var ( + filter_Query_PinnedCodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryPinnedCodesRequest @@ -537,6 +562,7 @@ func request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshale msg, err := client.PinnedCodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err + } func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -552,16 +578,128 @@ func local_request_Query_PinnedCodes_0(ctx context.Context, marshaler runtime.Ma msg, err := server.PinnedCodes(ctx, &protoReq) return msg, metadata, err + +} + +func request_Query_RentInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRentInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.RentInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RentInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRentInfoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.RentInfo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_StateSize_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStateSizeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := client.StateSize(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_StateSize_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryStateSizeRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "address") + } + + protoReq.Address, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "address", err) + } + + msg, err := server.StateSize(ctx, &protoReq) + return msg, metadata, err + } // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -569,6 +707,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -576,11 +715,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -588,6 +730,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractHistory_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -595,11 +738,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -607,6 +753,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ContractsByCode_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -614,11 +761,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -626,6 +776,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_AllContractState_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -633,11 +784,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -645,6 +799,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_RawContractState_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -652,11 +807,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -664,6 +822,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_SmartContractState_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -671,11 +830,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -683,6 +845,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Code_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -690,11 +853,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -702,6 +868,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Codes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -709,11 +876,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) if err != nil { @@ -721,6 +891,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_PinnedCodes_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) @@ -728,6 +899,53 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RentInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_RentInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RentInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateSize_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_StateSize_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StateSize_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -770,6 +988,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_ContractInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -787,6 +1006,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractHistory_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -806,6 +1026,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractHistory_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_ContractsByCode_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -825,6 +1046,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_ContractsByCode_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_AllContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -844,6 +1066,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_AllContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_RawContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -863,6 +1086,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_RawContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_SmartContractState_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -882,6 +1106,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_SmartContractState_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Code_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -901,6 +1126,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Code_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_Codes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -920,6 +1146,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_Codes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) mux.Handle("GET", pattern_Query_PinnedCodes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { @@ -939,6 +1166,47 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } forward_Query_PinnedCodes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_RentInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_RentInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_RentInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_StateSize_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_StateSize_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_StateSize_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil @@ -962,6 +1230,10 @@ var ( pattern_Query_Codes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmwasm", "wasm", "v1", "code"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_PinnedCodes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmwasm", "wasm", "v1", "codes", "pinned"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_RentInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmwasm", "wasm", "v1", "rent", "address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_StateSize_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"cosmwasm", "wasm", "v1", "size", "address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -982,4 +1254,8 @@ var ( forward_Query_Codes_0 = runtime.ForwardResponseMessage forward_Query_PinnedCodes_0 = runtime.ForwardResponseMessage + + forward_Query_RentInfo_0 = runtime.ForwardResponseMessage + + forward_Query_StateSize_0 = runtime.ForwardResponseMessage ) diff --git a/x/wasm/types/rent.go b/x/wasm/types/rent.go new file mode 100644 index 0000000..f93eff6 --- /dev/null +++ b/x/wasm/types/rent.go @@ -0,0 +1,28 @@ +package types + +import ( + "encoding/binary" + "errors" +) + +// custom struct instead of protobuf to minimize state needed +type RentInfo struct { + Balance uint64 + LastChargedBlock uint64 +} + +func (r *RentInfo) Marshal() []byte { + b, l := make([]byte, 8), make([]byte, 8) + binary.BigEndian.PutUint64(b, r.Balance) + binary.BigEndian.PutUint64(l, r.LastChargedBlock) + return append(b, l...) +} + +func (r *RentInfo) Unmarshal(bz []byte) error { + if len(bz) != 16 { + return errors.New("RentInfo must have exactly 16 bytes") + } + r.Balance = binary.BigEndian.Uint64(bz[:8]) + r.LastChargedBlock = binary.BigEndian.Uint64(bz[8:]) + return nil +} diff --git a/x/wasm/types/tx.go b/x/wasm/types/tx.go index 498dc28..feeac70 100644 --- a/x/wasm/types/tx.go +++ b/x/wasm/types/tx.go @@ -306,3 +306,33 @@ func (msg MsgIBCCloseChannel) GetSignBytes() []byte { func (msg MsgIBCCloseChannel) GetSigners() []sdk.AccAddress { return nil } + +func (msg MsgDepositRent) Route() string { + return RouterKey +} + +func (msg MsgDepositRent) Type() string { + return "deposit-rent" +} + +func (msg MsgDepositRent) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Sender); err != nil { + return sdkerrors.Wrap(err, "sender") + } + if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil { + return sdkerrors.Wrap(err, "contract") + } + return nil +} + +func (msg MsgDepositRent) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgDepositRent) GetSigners() []sdk.AccAddress { + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{senderAddr} +} diff --git a/x/wasm/types/tx.pb.go b/x/wasm/types/tx.pb.go index 7976d9e..a7b46b8 100644 --- a/x/wasm/types/tx.pb.go +++ b/x/wasm/types/tx.pb.go @@ -6,10 +6,6 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" @@ -18,15 +14,15 @@ import ( 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 - _ = math.Inf -) +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. @@ -51,11 +47,9 @@ func (*MsgStoreCode) ProtoMessage() {} func (*MsgStoreCode) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{0} } - func (m *MsgStoreCode) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgStoreCode.Marshal(b, m, deterministic) @@ -68,15 +62,12 @@ func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *MsgStoreCode) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgStoreCode.Merge(m, src) } - func (m *MsgStoreCode) XXX_Size() int { return m.Size() } - func (m *MsgStoreCode) XXX_DiscardUnknown() { xxx_messageInfo_MsgStoreCode.DiscardUnknown(m) } @@ -95,11 +86,9 @@ func (*MsgStoreCodeResponse) ProtoMessage() {} func (*MsgStoreCodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{1} } - func (m *MsgStoreCodeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgStoreCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgStoreCodeResponse.Marshal(b, m, deterministic) @@ -112,15 +101,12 @@ func (m *MsgStoreCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } - func (m *MsgStoreCodeResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgStoreCodeResponse.Merge(m, src) } - func (m *MsgStoreCodeResponse) XXX_Size() int { return m.Size() } - func (m *MsgStoreCodeResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgStoreCodeResponse.DiscardUnknown(m) } @@ -150,11 +136,9 @@ func (*MsgInstantiateContract) ProtoMessage() {} func (*MsgInstantiateContract) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{2} } - func (m *MsgInstantiateContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgInstantiateContract.Marshal(b, m, deterministic) @@ -167,15 +151,12 @@ func (m *MsgInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *MsgInstantiateContract) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgInstantiateContract.Merge(m, src) } - func (m *MsgInstantiateContract) XXX_Size() int { return m.Size() } - func (m *MsgInstantiateContract) XXX_DiscardUnknown() { xxx_messageInfo_MsgInstantiateContract.DiscardUnknown(m) } @@ -196,11 +177,9 @@ func (*MsgInstantiateContractResponse) ProtoMessage() {} func (*MsgInstantiateContractResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{3} } - func (m *MsgInstantiateContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgInstantiateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgInstantiateContractResponse.Marshal(b, m, deterministic) @@ -213,15 +192,12 @@ func (m *MsgInstantiateContractResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } - func (m *MsgInstantiateContractResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgInstantiateContractResponse.Merge(m, src) } - func (m *MsgInstantiateContractResponse) XXX_Size() int { return m.Size() } - func (m *MsgInstantiateContractResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgInstantiateContractResponse.DiscardUnknown(m) } @@ -246,11 +222,9 @@ func (*MsgExecuteContract) ProtoMessage() {} func (*MsgExecuteContract) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{4} } - func (m *MsgExecuteContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgExecuteContract.Marshal(b, m, deterministic) @@ -263,15 +237,12 @@ func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgExecuteContract) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgExecuteContract.Merge(m, src) } - func (m *MsgExecuteContract) XXX_Size() int { return m.Size() } - func (m *MsgExecuteContract) XXX_DiscardUnknown() { xxx_messageInfo_MsgExecuteContract.DiscardUnknown(m) } @@ -290,11 +261,9 @@ func (*MsgExecuteContractResponse) ProtoMessage() {} func (*MsgExecuteContractResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{5} } - func (m *MsgExecuteContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgExecuteContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgExecuteContractResponse.Marshal(b, m, deterministic) @@ -307,15 +276,12 @@ func (m *MsgExecuteContractResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } - func (m *MsgExecuteContractResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgExecuteContractResponse.Merge(m, src) } - func (m *MsgExecuteContractResponse) XXX_Size() int { return m.Size() } - func (m *MsgExecuteContractResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgExecuteContractResponse.DiscardUnknown(m) } @@ -340,11 +306,9 @@ func (*MsgMigrateContract) ProtoMessage() {} func (*MsgMigrateContract) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{6} } - func (m *MsgMigrateContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgMigrateContract.Marshal(b, m, deterministic) @@ -357,15 +321,12 @@ func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *MsgMigrateContract) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgMigrateContract.Merge(m, src) } - func (m *MsgMigrateContract) XXX_Size() int { return m.Size() } - func (m *MsgMigrateContract) XXX_DiscardUnknown() { xxx_messageInfo_MsgMigrateContract.DiscardUnknown(m) } @@ -385,11 +346,9 @@ func (*MsgMigrateContractResponse) ProtoMessage() {} func (*MsgMigrateContractResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{7} } - func (m *MsgMigrateContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgMigrateContractResponse.Marshal(b, m, deterministic) @@ -402,15 +361,12 @@ func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } - func (m *MsgMigrateContractResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgMigrateContractResponse.Merge(m, src) } - func (m *MsgMigrateContractResponse) XXX_Size() int { return m.Size() } - func (m *MsgMigrateContractResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgMigrateContractResponse.DiscardUnknown(m) } @@ -433,11 +389,9 @@ func (*MsgUpdateAdmin) ProtoMessage() {} func (*MsgUpdateAdmin) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{8} } - func (m *MsgUpdateAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateAdmin.Marshal(b, m, deterministic) @@ -450,15 +404,12 @@ func (m *MsgUpdateAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } - func (m *MsgUpdateAdmin) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateAdmin.Merge(m, src) } - func (m *MsgUpdateAdmin) XXX_Size() int { return m.Size() } - func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateAdmin.DiscardUnknown(m) } @@ -466,7 +417,8 @@ func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateAdmin proto.InternalMessageInfo // MsgUpdateAdminResponse returns empty data -type MsgUpdateAdminResponse struct{} +type MsgUpdateAdminResponse struct { +} func (m *MsgUpdateAdminResponse) Reset() { *m = MsgUpdateAdminResponse{} } func (m *MsgUpdateAdminResponse) String() string { return proto.CompactTextString(m) } @@ -474,11 +426,9 @@ func (*MsgUpdateAdminResponse) ProtoMessage() {} func (*MsgUpdateAdminResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{9} } - func (m *MsgUpdateAdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgUpdateAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgUpdateAdminResponse.Marshal(b, m, deterministic) @@ -491,15 +441,12 @@ func (m *MsgUpdateAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } - func (m *MsgUpdateAdminResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgUpdateAdminResponse.Merge(m, src) } - func (m *MsgUpdateAdminResponse) XXX_Size() int { return m.Size() } - func (m *MsgUpdateAdminResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgUpdateAdminResponse.DiscardUnknown(m) } @@ -520,11 +467,9 @@ func (*MsgClearAdmin) ProtoMessage() {} func (*MsgClearAdmin) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{10} } - func (m *MsgClearAdmin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgClearAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgClearAdmin.Marshal(b, m, deterministic) @@ -537,15 +482,12 @@ func (m *MsgClearAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } - func (m *MsgClearAdmin) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgClearAdmin.Merge(m, src) } - func (m *MsgClearAdmin) XXX_Size() int { return m.Size() } - func (m *MsgClearAdmin) XXX_DiscardUnknown() { xxx_messageInfo_MsgClearAdmin.DiscardUnknown(m) } @@ -553,7 +495,8 @@ func (m *MsgClearAdmin) XXX_DiscardUnknown() { var xxx_messageInfo_MsgClearAdmin proto.InternalMessageInfo // MsgClearAdminResponse returns empty data -type MsgClearAdminResponse struct{} +type MsgClearAdminResponse struct { +} func (m *MsgClearAdminResponse) Reset() { *m = MsgClearAdminResponse{} } func (m *MsgClearAdminResponse) String() string { return proto.CompactTextString(m) } @@ -561,11 +504,9 @@ func (*MsgClearAdminResponse) ProtoMessage() {} func (*MsgClearAdminResponse) Descriptor() ([]byte, []int) { return fileDescriptor_4f74d82755520264, []int{11} } - func (m *MsgClearAdminResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *MsgClearAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_MsgClearAdminResponse.Marshal(b, m, deterministic) @@ -578,21 +519,93 @@ func (m *MsgClearAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } - func (m *MsgClearAdminResponse) XXX_Merge(src proto.Message) { xxx_messageInfo_MsgClearAdminResponse.Merge(m, src) } - func (m *MsgClearAdminResponse) XXX_Size() int { return m.Size() } - func (m *MsgClearAdminResponse) XXX_DiscardUnknown() { xxx_messageInfo_MsgClearAdminResponse.DiscardUnknown(m) } var xxx_messageInfo_MsgClearAdminResponse proto.InternalMessageInfo +type MsgDepositRent struct { + Contract string `protobuf:"bytes,1,opt,name=contract,proto3" json:"contract,omitempty"` + Amount uint64 `protobuf:"varint,2,opt,name=amount,proto3" json:"amount,omitempty"` + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgDepositRent) Reset() { *m = MsgDepositRent{} } +func (m *MsgDepositRent) String() string { return proto.CompactTextString(m) } +func (*MsgDepositRent) ProtoMessage() {} +func (*MsgDepositRent) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{12} +} +func (m *MsgDepositRent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositRent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositRent.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 *MsgDepositRent) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositRent.Merge(m, src) +} +func (m *MsgDepositRent) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositRent) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositRent.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositRent proto.InternalMessageInfo + +type MsgDepositRentResponse struct { +} + +func (m *MsgDepositRentResponse) Reset() { *m = MsgDepositRentResponse{} } +func (m *MsgDepositRentResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDepositRentResponse) ProtoMessage() {} +func (*MsgDepositRentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4f74d82755520264, []int{13} +} +func (m *MsgDepositRentResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositRentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositRentResponse.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 *MsgDepositRentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositRentResponse.Merge(m, src) +} +func (m *MsgDepositRentResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositRentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositRentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositRentResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1.MsgStoreCode") proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1.MsgStoreCodeResponse") @@ -606,60 +619,65 @@ func init() { proto.RegisterType((*MsgUpdateAdminResponse)(nil), "cosmwasm.wasm.v1.MsgUpdateAdminResponse") proto.RegisterType((*MsgClearAdmin)(nil), "cosmwasm.wasm.v1.MsgClearAdmin") proto.RegisterType((*MsgClearAdminResponse)(nil), "cosmwasm.wasm.v1.MsgClearAdminResponse") + proto.RegisterType((*MsgDepositRent)(nil), "cosmwasm.wasm.v1.MsgDepositRent") + proto.RegisterType((*MsgDepositRentResponse)(nil), "cosmwasm.wasm.v1.MsgDepositRentResponse") } func init() { proto.RegisterFile("cosmwasm/wasm/v1/tx.proto", fileDescriptor_4f74d82755520264) } var fileDescriptor_4f74d82755520264 = []byte{ - // 759 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0x8e, 0x1b, 0x27, 0x4d, 0x4e, 0x73, 0x7b, 0x23, 0xdf, 0x36, 0x37, 0xf5, 0xbd, 0x72, 0xa2, - 0x80, 0x8a, 0x17, 0x60, 0x37, 0x45, 0x62, 0xc3, 0xaa, 0x49, 0x59, 0xb4, 0x92, 0x11, 0x72, 0x55, - 0x2a, 0xd8, 0x44, 0x13, 0x7b, 0x6a, 0x2c, 0x1a, 0x4f, 0xf0, 0x71, 0x9b, 0xf6, 0x25, 0x10, 0x3b, - 0xde, 0x81, 0xb7, 0x60, 0xd7, 0x15, 0xea, 0x06, 0x89, 0x55, 0x80, 0xf4, 0x2d, 0x58, 0x21, 0xff, - 0xa5, 0x6e, 0xea, 0xa4, 0x41, 0x88, 0x4d, 0x32, 0xc7, 0xf3, 0x7d, 0xe7, 0xcc, 0xf9, 0xf4, 0xcd, - 0x19, 0x58, 0x33, 0x18, 0xf6, 0x06, 0x04, 0x7b, 0x6a, 0xf0, 0x73, 0xd2, 0x54, 0xbd, 0x53, 0xa5, - 0xef, 0x32, 0x8f, 0x09, 0xe5, 0x78, 0x4b, 0x09,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, 0xc0, 0x52, 0xd2, 0x75, 0xf5, 0x54, 0x72, - 0x02, 0x21, 0xca, 0xb7, 0x21, 0xc6, 0xa9, 0x9f, 0x03, 0x24, 0x3c, 0x55, 0x4b, 0xe5, 0x5d, 0x01, - 0xc4, 0x7b, 0xb7, 0x00, 0xe2, 0xbc, 0xad, 0xed, 0xf3, 0xef, 0x52, 0xe6, 0x7c, 0x24, 0x71, 0x17, - 0x23, 0x89, 0xfb, 0x36, 0x92, 0xb8, 0x77, 0x97, 0x52, 0xe6, 0xe2, 0x52, 0xca, 0x7c, 0xb9, 0x94, - 0x32, 0x2f, 0xd7, 0x13, 0x83, 0xa7, 0xcd, 0xb0, 0x77, 0x10, 0x3f, 0xd5, 0xa6, 0x7a, 0x1a, 0x3e, - 0xd9, 0xc1, 0xf0, 0xe9, 0xe6, 0x83, 0x07, 0xfb, 0xe1, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x56, - 0xd2, 0x4b, 0x17, 0x33, 0x08, 0x00, 0x00, + // 808 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x6e, 0xd3, 0x4a, + 0x14, 0x8e, 0x6b, 0x27, 0x4d, 0xa6, 0xb9, 0xbd, 0x91, 0x6f, 0x9b, 0x9b, 0x1a, 0xe4, 0x44, 0x01, + 0x15, 0x2f, 0xc0, 0x6e, 0x8a, 0xc4, 0x86, 0x55, 0x93, 0xb2, 0x68, 0x25, 0x23, 0xe4, 0xaa, 0x54, + 0x20, 0xa4, 0x68, 0x62, 0x4f, 0x8d, 0x45, 0xed, 0x09, 0x9e, 0x49, 0xd3, 0xbe, 0x04, 0x62, 0xc7, + 0x33, 0xc0, 0x5b, 0xb0, 0xeb, 0xb2, 0x1b, 0x24, 0x56, 0x01, 0xd2, 0xb7, 0x60, 0x85, 0xfc, 0xdb, + 0x69, 0xea, 0xa4, 0x41, 0x88, 0x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, 0xde, 0x15, 0x8a, 0x7c, 0x45, + 0xd8, 0x15, 0x8a, 0x42, 0x25, 0xdf, 0x7c, 0x0c, 0x56, 0xd8, 0x16, 0x0c, 0x44, 0xfa, 0xd8, 0x23, + 0x48, 0xbc, 0x03, 0x16, 0x83, 0x42, 0xbb, 0x8e, 0x15, 0xf6, 0x22, 0xb4, 0xc1, 0x78, 0x54, 0x2f, + 0x04, 0x90, 0x9d, 0x6d, 0xa3, 0x10, 0x6c, 0xed, 0x58, 0xcd, 0x77, 0x0b, 0xa0, 0xaa, 0x13, 0x7b, + 0xe7, 0x32, 0x4b, 0x07, 0x7b, 0xd4, 0x87, 0x26, 0x9d, 0x4a, 0xc5, 0x0a, 0xc8, 0x43, 0xcb, 0x75, + 0xbc, 0x90, 0x81, 0x92, 0x11, 0x19, 0x6c, 0x36, 0x7e, 0x5a, 0xb6, 0xc0, 0xf5, 0x08, 0xf6, 0xd0, + 0x51, 0x4d, 0x88, 0x5c, 0x43, 0x43, 0x54, 0x00, 0xef, 0x12, 0x3b, 0x24, 0xa4, 0xdc, 0xae, 0xfe, + 0x1c, 0xd5, 0x45, 0x03, 0x0e, 0x93, 0x32, 0x74, 0x44, 0x08, 0xb4, 0x91, 0x11, 0x40, 0x44, 0x08, + 0xf2, 0x87, 0x03, 0xcf, 0x22, 0xb5, 0x42, 0x83, 0x57, 0x96, 0x36, 0xd7, 0xd4, 0x48, 0x12, 0x6a, + 0x20, 0x09, 0x35, 0x96, 0x84, 0xda, 0xc1, 0x8e, 0xd7, 0xde, 0x38, 0x1b, 0xd5, 0x73, 0x9f, 0xbe, + 0xd5, 0x15, 0xdb, 0xa1, 0xaf, 0x07, 0x3d, 0xd5, 0xc4, 0xae, 0x16, 0xeb, 0x27, 0xfa, 0x7b, 0x40, + 0xac, 0x37, 0xb1, 0x14, 0x02, 0x07, 0x62, 0x44, 0x91, 0x9b, 0x4f, 0x81, 0x9c, 0xcd, 0x47, 0xca, + 0x6b, 0x0d, 0x2c, 0x42, 0xcb, 0xf2, 0x11, 0x21, 0x31, 0x31, 0x89, 0x29, 0x8a, 0x40, 0xb0, 0x20, + 0x85, 0x91, 0x34, 0x8c, 0x70, 0xdd, 0xfc, 0xc2, 0x01, 0x51, 0x27, 0xf6, 0x93, 0x13, 0x64, 0x0e, + 0xe6, 0x20, 0x57, 0x02, 0x45, 0x33, 0xc6, 0xc4, 0xfc, 0xa6, 0x76, 0xc2, 0x13, 0xff, 0x1b, 0x3c, + 0xe5, 0xff, 0x1a, 0x4f, 0x1b, 0x40, 0xba, 0xde, 0x56, 0xca, 0x51, 0xc2, 0x04, 0xc7, 0x30, 0xf1, + 0x21, 0x62, 0x42, 0x77, 0x6c, 0x1f, 0xfe, 0x21, 0x13, 0x73, 0x89, 0x2d, 0xa6, 0x4b, 0xb8, 0x91, + 0xae, 0xb8, 0x97, 0x89, 0xc2, 0x66, 0xf6, 0x02, 0xc1, 0xb2, 0x4e, 0xec, 0xfd, 0xbe, 0x05, 0x29, + 0xda, 0x0a, 0xf5, 0x3f, 0xad, 0x8d, 0x5b, 0xa0, 0xe4, 0xa1, 0x61, 0x97, 0xbd, 0x31, 0x45, 0x0f, + 0x0d, 0x23, 0x27, 0xb6, 0x47, 0xfe, 0x6a, 0x8f, 0xcd, 0x5a, 0x78, 0x31, 0x99, 0x14, 0x49, 0x41, + 0xcd, 0x0e, 0xf8, 0x47, 0x27, 0x76, 0xe7, 0x08, 0x41, 0x7f, 0x76, 0xee, 0x59, 0xe1, 0xff, 0x07, + 0xab, 0x57, 0x82, 0xa4, 0xd1, 0x5f, 0x85, 0xad, 0x6d, 0xa3, 0x3e, 0x26, 0x0e, 0x35, 0x90, 0x47, + 0xaf, 0x84, 0xe1, 0x26, 0x4e, 0xa2, 0x0a, 0x0a, 0xd0, 0xc5, 0x03, 0x2f, 0x3a, 0x23, 0xc1, 0x88, + 0x2d, 0xa6, 0x24, 0x9e, 0x2d, 0x29, 0xee, 0x8a, 0x89, 0x9e, 0xe4, 0xdd, 0xfc, 0x98, 0x07, 0xbc, + 0x4e, 0x6c, 0x71, 0x0f, 0x94, 0x2e, 0xc7, 0x71, 0xc6, 0x78, 0x64, 0x67, 0x9d, 0xb4, 0x3e, 0x7b, + 0x3f, 0x3d, 0xc3, 0xb7, 0xe0, 0xbf, 0xac, 0x11, 0xa7, 0x64, 0xba, 0x67, 0x20, 0xa5, 0x8d, 0x79, + 0x91, 0x69, 0x4a, 0x04, 0xfe, 0x9d, 0xbc, 0xf4, 0x77, 0x33, 0x83, 0x4c, 0xa0, 0xa4, 0xfb, 0xf3, + 0xa0, 0xd8, 0x34, 0x93, 0x37, 0x2a, 0x3b, 0xcd, 0x04, 0x6a, 0x4a, 0x9a, 0x69, 0x97, 0xe0, 0x05, + 0x58, 0x62, 0xd5, 0xde, 0xc8, 0x74, 0x66, 0x10, 0x92, 0x72, 0x13, 0x22, 0x0d, 0xfd, 0x1c, 0x00, + 0x46, 0xcb, 0xf5, 0x4c, 0xbf, 0x4b, 0x80, 0x74, 0xef, 0x06, 0x00, 0x5b, 0x32, 0xab, 0xe2, 0xec, + 0x92, 0x19, 0xc4, 0x94, 0x92, 0x33, 0xb4, 0xda, 0xde, 0x3e, 0xfb, 0x21, 0xe7, 0xce, 0xc6, 0x32, + 0x77, 0x3e, 0x96, 0xb9, 0xef, 0x63, 0x99, 0x7b, 0x7f, 0x21, 0xe7, 0xce, 0x2f, 0xe4, 0xdc, 0xd7, + 0x0b, 0x39, 0xf7, 0x72, 0x9d, 0x99, 0xa5, 0x1d, 0x4c, 0xdc, 0x83, 0xe4, 0xf5, 0x61, 0x69, 0x27, + 0xd1, 0x2b, 0x24, 0x9c, 0xa7, 0xbd, 0x42, 0xf8, 0x06, 0x79, 0xf8, 0x2b, 0x00, 0x00, 0xff, 0xff, + 0x52, 0x40, 0x5f, 0xca, 0x06, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -686,6 +704,8 @@ type MsgClient interface { UpdateAdmin(ctx context.Context, in *MsgUpdateAdmin, opts ...grpc.CallOption) (*MsgUpdateAdminResponse, error) // ClearAdmin removes any admin stored for a smart contract ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...grpc.CallOption) (*MsgClearAdminResponse, error) + // DepositRent adds to the rent balance for a smart contract + DepositRent(ctx context.Context, in *MsgDepositRent, opts ...grpc.CallOption) (*MsgDepositRentResponse, error) } type msgClient struct { @@ -750,6 +770,15 @@ func (c *msgClient) ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...g return out, nil } +func (c *msgClient) DepositRent(ctx context.Context, in *MsgDepositRent, opts ...grpc.CallOption) (*MsgDepositRentResponse, error) { + out := new(MsgDepositRentResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1.Msg/DepositRent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // StoreCode to submit Wasm code to the system @@ -764,34 +793,35 @@ type MsgServer interface { UpdateAdmin(context.Context, *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) // ClearAdmin removes any admin stored for a smart contract ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error) + // DepositRent adds to the rent balance for a smart contract + DepositRent(context.Context, *MsgDepositRent) (*MsgDepositRentResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct{} +type UnimplementedMsgServer struct { +} func (*UnimplementedMsgServer) StoreCode(ctx context.Context, req *MsgStoreCode) (*MsgStoreCodeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method StoreCode not implemented") } - func (*UnimplementedMsgServer) InstantiateContract(ctx context.Context, req *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InstantiateContract not implemented") } - func (*UnimplementedMsgServer) ExecuteContract(ctx context.Context, req *MsgExecuteContract) (*MsgExecuteContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ExecuteContract not implemented") } - func (*UnimplementedMsgServer) MigrateContract(ctx context.Context, req *MsgMigrateContract) (*MsgMigrateContractResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MigrateContract not implemented") } - func (*UnimplementedMsgServer) UpdateAdmin(ctx context.Context, req *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateAdmin not implemented") } - func (*UnimplementedMsgServer) ClearAdmin(ctx context.Context, req *MsgClearAdmin) (*MsgClearAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClearAdmin not implemented") } +func (*UnimplementedMsgServer) DepositRent(ctx context.Context, req *MsgDepositRent) (*MsgDepositRentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DepositRent not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -905,6 +935,24 @@ func _Msg_ClearAdmin_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Msg_DepositRent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDepositRent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DepositRent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1.Msg/DepositRent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DepositRent(ctx, req.(*MsgDepositRent)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "cosmwasm.wasm.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -933,6 +981,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ClearAdmin", Handler: _Msg_ClearAdmin_Handler, }, + { + MethodName: "DepositRent", + Handler: _Msg_DepositRent_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "cosmwasm/wasm/v1/tx.proto", @@ -1416,6 +1468,71 @@ func (m *MsgClearAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgDepositRent) 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 *MsgDepositRent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositRent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x1a + } + if m.Amount != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Amount)) + i-- + dAtA[i] = 0x10 + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDepositRentResponse) 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 *MsgDepositRentResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositRentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1427,7 +1544,6 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *MsgStoreCode) Size() (n int) { if m == nil { return 0 @@ -1645,14 +1761,41 @@ func (m *MsgClearAdminResponse) Size() (n int) { return n } +func (m *MsgDepositRent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Amount != 0 { + n += 1 + sovTx(uint64(m.Amount)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDepositRentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1805,7 +1948,6 @@ func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1875,7 +2017,6 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2109,7 +2250,6 @@ func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2226,7 +2366,6 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2409,7 +2548,6 @@ func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2494,7 +2632,6 @@ func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2662,7 +2799,6 @@ func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2747,7 +2883,6 @@ func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2894,7 +3029,6 @@ func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2945,7 +3079,6 @@ func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3060,7 +3193,6 @@ func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { } return nil } - func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3111,7 +3243,189 @@ func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgDepositRent) 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 ErrIntOverflowTx + } + 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: MsgDepositRent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositRent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + m.Amount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Amount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositRentResponse) 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 ErrIntOverflowTx + } + 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: MsgDepositRentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositRentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/wasm/types/types.pb.go b/x/wasm/types/types.pb.go index 6dd14c2..f5ca00e 100644 --- a/x/wasm/types/types.pb.go +++ b/x/wasm/types/types.pb.go @@ -6,23 +6,20 @@ package types import ( bytes "bytes" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - types "github.com/cosmos/cosmos-sdk/codec/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" _ "github.com/regen-network/cosmos-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 - _ = math.Inf -) +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. @@ -109,11 +106,9 @@ func (*AccessTypeParam) ProtoMessage() {} func (*AccessTypeParam) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{0} } - func (m *AccessTypeParam) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *AccessTypeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessTypeParam.Marshal(b, m, deterministic) @@ -126,15 +121,12 @@ func (m *AccessTypeParam) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } - func (m *AccessTypeParam) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessTypeParam.Merge(m, src) } - func (m *AccessTypeParam) XXX_Size() int { return m.Size() } - func (m *AccessTypeParam) XXX_DiscardUnknown() { xxx_messageInfo_AccessTypeParam.DiscardUnknown(m) } @@ -153,11 +145,9 @@ func (*AccessConfig) ProtoMessage() {} func (*AccessConfig) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{1} } - func (m *AccessConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *AccessConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AccessConfig.Marshal(b, m, deterministic) @@ -170,15 +160,12 @@ func (m *AccessConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *AccessConfig) XXX_Merge(src proto.Message) { xxx_messageInfo_AccessConfig.Merge(m, src) } - func (m *AccessConfig) XXX_Size() int { return m.Size() } - func (m *AccessConfig) XXX_DiscardUnknown() { xxx_messageInfo_AccessConfig.DiscardUnknown(m) } @@ -189,6 +176,9 @@ var xxx_messageInfo_AccessConfig proto.InternalMessageInfo type Params struct { CodeUploadAccess AccessConfig `protobuf:"bytes,1,opt,name=code_upload_access,json=codeUploadAccess,proto3" json:"code_upload_access" yaml:"code_upload_access"` InstantiateDefaultPermission AccessType `protobuf:"varint,2,opt,name=instantiate_default_permission,json=instantiateDefaultPermission,proto3,enum=cosmwasm.wasm.v1.AccessType" json:"instantiate_default_permission,omitempty" yaml:"instantiate_default_permission"` + // rent price per byte per block + UnitRentPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=unit_rent_price,json=unitRentPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"unit_rent_price" yaml:"unit_gas_price"` + RentDenom string `protobuf:"bytes,4,opt,name=rent_denom,json=rentDenom,proto3" json:"rent_denom,omitempty" yaml:"rent_denom"` } func (m *Params) Reset() { *m = Params{} } @@ -196,11 +186,9 @@ func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{2} } - 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) @@ -213,15 +201,12 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 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) } @@ -244,11 +229,9 @@ func (*CodeInfo) ProtoMessage() {} func (*CodeInfo) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{3} } - func (m *CodeInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *CodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_CodeInfo.Marshal(b, m, deterministic) @@ -261,15 +244,12 @@ func (m *CodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *CodeInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_CodeInfo.Merge(m, src) } - func (m *CodeInfo) XXX_Size() int { return m.Size() } - func (m *CodeInfo) XXX_DiscardUnknown() { xxx_messageInfo_CodeInfo.DiscardUnknown(m) } @@ -302,11 +282,9 @@ func (*ContractInfo) ProtoMessage() {} func (*ContractInfo) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{4} } - func (m *ContractInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *ContractInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractInfo.Marshal(b, m, deterministic) @@ -319,15 +297,12 @@ func (m *ContractInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } - func (m *ContractInfo) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractInfo.Merge(m, src) } - func (m *ContractInfo) XXX_Size() int { return m.Size() } - func (m *ContractInfo) XXX_DiscardUnknown() { xxx_messageInfo_ContractInfo.DiscardUnknown(m) } @@ -350,11 +325,9 @@ func (*ContractCodeHistoryEntry) ProtoMessage() {} func (*ContractCodeHistoryEntry) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{5} } - func (m *ContractCodeHistoryEntry) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *ContractCodeHistoryEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_ContractCodeHistoryEntry.Marshal(b, m, deterministic) @@ -367,15 +340,12 @@ func (m *ContractCodeHistoryEntry) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } - func (m *ContractCodeHistoryEntry) XXX_Merge(src proto.Message) { xxx_messageInfo_ContractCodeHistoryEntry.Merge(m, src) } - func (m *ContractCodeHistoryEntry) XXX_Size() int { return m.Size() } - func (m *ContractCodeHistoryEntry) XXX_DiscardUnknown() { xxx_messageInfo_ContractCodeHistoryEntry.DiscardUnknown(m) } @@ -398,11 +368,9 @@ func (*AbsoluteTxPosition) ProtoMessage() {} func (*AbsoluteTxPosition) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{6} } - func (m *AbsoluteTxPosition) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *AbsoluteTxPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_AbsoluteTxPosition.Marshal(b, m, deterministic) @@ -415,15 +383,12 @@ func (m *AbsoluteTxPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } - func (m *AbsoluteTxPosition) XXX_Merge(src proto.Message) { xxx_messageInfo_AbsoluteTxPosition.Merge(m, src) } - func (m *AbsoluteTxPosition) XXX_Size() int { return m.Size() } - func (m *AbsoluteTxPosition) XXX_DiscardUnknown() { xxx_messageInfo_AbsoluteTxPosition.DiscardUnknown(m) } @@ -444,11 +409,9 @@ func (*Model) ProtoMessage() {} func (*Model) Descriptor() ([]byte, []int) { return fileDescriptor_e6155d98fa173e02, []int{7} } - func (m *Model) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } - func (m *Model) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { return xxx_messageInfo_Model.Marshal(b, m, deterministic) @@ -461,15 +424,12 @@ func (m *Model) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } - func (m *Model) XXX_Merge(src proto.Message) { xxx_messageInfo_Model.Merge(m, src) } - func (m *Model) XXX_Size() int { return m.Size() } - func (m *Model) XXX_DiscardUnknown() { xxx_messageInfo_Model.DiscardUnknown(m) } @@ -492,78 +452,82 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/types.proto", fileDescriptor_e6155d98fa173e02) } var fileDescriptor_e6155d98fa173e02 = []byte{ - // 1123 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcd, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x93, 0xec, 0xd7, 0x34, 0x14, 0x77, 0xd8, 0xa5, 0x49, 0xa8, 0x9c, 0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0xa0, 0x70, 0x10, - 0x09, 0x00, 0x00, + // 1186 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcb, 0x8f, 0xdb, 0x44, + 0x18, 0x8f, 0x93, 0xec, 0x6e, 0x32, 0x4d, 0x5b, 0x77, 0xd8, 0xa5, 0xd9, 0x50, 0xd9, 0xa9, 0x29, + 0xb0, 0x7d, 0x25, 0x74, 0x41, 0x20, 0x55, 0xa2, 0x52, 0x1e, 0x66, 0xd7, 0x15, 0x9b, 0x44, 0x93, + 0x94, 0x6a, 0x91, 0x2a, 0xcb, 0xb1, 0x67, 0xb3, 0x56, 0x13, 0x4f, 0xe4, 0x99, 0x6c, 0xe3, 0xff, + 0x00, 0xad, 0x84, 0xc4, 0x0d, 0x2e, 0x2b, 0x21, 0x40, 0xa8, 0x7f, 0x00, 0xe2, 0xc6, 0xbd, 0xe2, + 0xd4, 0x23, 0xe2, 0x60, 0xc1, 0xf6, 0x02, 0xd7, 0x1c, 0xcb, 0x05, 0x79, 0x26, 0x51, 0xac, 0x76, + 0xdb, 0x0d, 0x97, 0xc4, 0xdf, 0xe3, 0xf7, 0xfb, 0x5e, 0x33, 0x9f, 0x0d, 0x2e, 0xd9, 0x84, 0x0e, + 0x1e, 0x59, 0x74, 0x50, 0xe6, 0x3f, 0x07, 0xb7, 0xca, 0x2c, 0x18, 0x62, 0x5a, 0x1a, 0xfa, 0x84, + 0x11, 0x28, 0xcf, 0xac, 0x25, 0xfe, 0x73, 0x70, 0xab, 0xb0, 0x1e, 0x69, 0x08, 0x35, 0xb9, 0xbd, + 0x2c, 0x04, 0xe1, 0x5c, 0x58, 0xed, 0x91, 0x1e, 0x11, 0xfa, 0xe8, 0x69, 0xaa, 0x5d, 0xef, 0x11, + 0xd2, 0xeb, 0xe3, 0x32, 0x97, 0xba, 0xa3, 0xbd, 0xb2, 0xe5, 0x05, 0xc2, 0xa4, 0x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 0x2a, 0xbe, 0x77, + 0x1a, 0xf7, 0x8e, 0xdb, 0xf3, 0x2d, 0x86, 0x17, 0xa6, 0xdf, 0xd2, 0x1b, 0x7a, 0xdb, 0x68, 0xcb, + 0xa9, 0xc5, 0xe8, 0xb7, 0xb0, 0x87, 0xa9, 0x4b, 0x0b, 0xe9, 0x68, 0x58, 0xd5, 0xed, 0x27, 0x7f, + 0x29, 0x89, 0xc7, 0xc7, 0x8a, 0xf4, 0xe4, 0x58, 0x91, 0x9e, 0x1e, 0x2b, 0xd2, 0x9f, 0xc7, 0x8a, + 0xf4, 0xf5, 0x33, 0x25, 0xf1, 0xf4, 0x99, 0x92, 0xf8, 0xfd, 0x99, 0x92, 0xf8, 0x22, 0xfe, 0xe2, + 0xaa, 0x11, 0x3a, 0xb8, 0x3f, 0xfb, 0xca, 0x72, 0xca, 0x63, 0xf1, 0xb5, 0xc5, 0x5f, 0x5e, 0xdd, + 0x65, 0xbe, 0xa9, 0x3e, 0xf8, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x20, 0x62, 0xbc, 0xa4, 0x8b, 0x09, + 0x00, 0x00, } func (this *AccessTypeParam) Equal(that interface{}) bool { @@ -590,7 +554,6 @@ func (this *AccessTypeParam) Equal(that interface{}) bool { } return true } - func (this *AccessConfig) Equal(that interface{}) bool { if that == nil { return this == nil @@ -618,7 +581,6 @@ func (this *AccessConfig) Equal(that interface{}) bool { } return true } - func (this *Params) Equal(that interface{}) bool { if that == nil { return this == nil @@ -644,9 +606,14 @@ func (this *Params) Equal(that interface{}) bool { if this.InstantiateDefaultPermission != that1.InstantiateDefaultPermission { return false } + if !this.UnitRentPrice.Equal(that1.UnitRentPrice) { + return false + } + if this.RentDenom != that1.RentDenom { + return false + } return true } - func (this *CodeInfo) Equal(that interface{}) bool { if that == nil { return this == nil @@ -677,7 +644,6 @@ func (this *CodeInfo) Equal(that interface{}) bool { } return true } - func (this *ContractInfo) Equal(that interface{}) bool { if that == nil { return this == nil @@ -720,7 +686,6 @@ func (this *ContractInfo) Equal(that interface{}) bool { } return true } - func (this *ContractCodeHistoryEntry) Equal(that interface{}) bool { if that == nil { return this == nil @@ -754,7 +719,6 @@ func (this *ContractCodeHistoryEntry) Equal(that interface{}) bool { } return true } - func (this *AbsoluteTxPosition) Equal(that interface{}) bool { if that == nil { return this == nil @@ -782,7 +746,6 @@ func (this *AbsoluteTxPosition) Equal(that interface{}) bool { } return true } - func (this *Model) Equal(that interface{}) bool { if that == nil { return this == nil @@ -810,7 +773,6 @@ func (this *Model) Equal(that interface{}) bool { } return true } - func (m *AccessTypeParam) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -894,6 +856,23 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RentDenom) > 0 { + i -= len(m.RentDenom) + copy(dAtA[i:], m.RentDenom) + i = encodeVarintTypes(dAtA, i, uint64(len(m.RentDenom))) + i-- + dAtA[i] = 0x22 + } + { + size := m.UnitRentPrice.Size() + i -= size + if _, err := m.UnitRentPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if m.InstantiateDefaultPermission != 0 { i = encodeVarintTypes(dAtA, i, uint64(m.InstantiateDefaultPermission)) i-- @@ -1172,7 +1151,6 @@ func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } - func (m *AccessTypeParam) Size() (n int) { if m == nil { return 0 @@ -1212,6 +1190,12 @@ func (m *Params) Size() (n int) { if m.InstantiateDefaultPermission != 0 { n += 1 + sovTypes(uint64(m.InstantiateDefaultPermission)) } + l = m.UnitRentPrice.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.RentDenom) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } return n } @@ -1328,11 +1312,9 @@ func (m *Model) Size() (n int) { func sovTypes(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } - func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } - func (m *AccessTypeParam) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1402,7 +1384,6 @@ func (m *AccessTypeParam) Unmarshal(dAtA []byte) error { } return nil } - func (m *AccessConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1504,7 +1485,6 @@ func (m *AccessConfig) Unmarshal(dAtA []byte) error { } return nil } - func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1586,6 +1566,72 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnitRentPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.UnitRentPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentDenom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + 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 ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RentDenom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -1607,7 +1653,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } - func (m *CodeInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1757,7 +1802,6 @@ func (m *CodeInfo) Unmarshal(dAtA []byte) error { } return nil } - func (m *ContractInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2027,7 +2071,6 @@ func (m *ContractInfo) Unmarshal(dAtA []byte) error { } return nil } - func (m *ContractCodeHistoryEntry) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2186,7 +2229,6 @@ func (m *ContractCodeHistoryEntry) Unmarshal(dAtA []byte) error { } return nil } - func (m *AbsoluteTxPosition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2275,7 +2317,6 @@ func (m *AbsoluteTxPosition) Unmarshal(dAtA []byte) error { } return nil } - func (m *Model) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2394,7 +2435,6 @@ func (m *Model) Unmarshal(dAtA []byte) error { } return nil } - func skipTypes(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From cd21ee31d556742a53444e1db48ae7acb7af572a Mon Sep 17 00:00:00 2001 From: codchen Date: Tue, 27 Jun 2023 14:22:51 +0800 Subject: [PATCH 2/2] add test --- proto/cosmwasm/wasm/v1/query.proto | 2 +- x/wasm/keeper/keeper.go | 44 ++++++++-------- x/wasm/keeper/keeper_test.go | 82 +++++++++++++++++++++++++++--- x/wasm/keeper/test_common.go | 13 +++-- x/wasm/types/errors.go | 3 ++ x/wasm/types/query.pb.go | 66 ++++++++++++------------ x/wasm/types/rent.go | 6 +-- 7 files changed, 146 insertions(+), 70 deletions(-) diff --git a/proto/cosmwasm/wasm/v1/query.proto b/proto/cosmwasm/wasm/v1/query.proto index 4b0507f..5d1894c 100644 --- a/proto/cosmwasm/wasm/v1/query.proto +++ b/proto/cosmwasm/wasm/v1/query.proto @@ -236,7 +236,7 @@ message QueryRentInfoRequest { } message QueryRentInfoResponse { - uint64 balance = 1; + int64 balance = 1; uint64 last_charged_block = 2; } diff --git a/x/wasm/keeper/keeper.go b/x/wasm/keeper/keeper.go index bfdbc4d..de5b305 100644 --- a/x/wasm/keeper/keeper.go +++ b/x/wasm/keeper/keeper.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/binary" - "errors" "fmt" "math" "path/filepath" @@ -300,8 +299,8 @@ func (k Keeper) instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.A if err != nil { return nil, nil, sdkerrors.Wrap(types.ErrInstantiateFailed, err.Error()) } - if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { - return nil, nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore.GetSizeChanged()); err != nil { + return nil, nil, err } // persist instance first @@ -373,8 +372,8 @@ func (k Keeper) execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller if execErr != nil { return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error()) } - if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { - return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore.GetSizeChanged()); err != nil { + return nil, err } ctx.EventManager().EmitEvent(sdk.NewEvent( @@ -438,8 +437,8 @@ func (k Keeper) migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller if err != nil { return nil, sdkerrors.Wrap(types.ErrMigrationFailed, err.Error()) } - if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { - return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore.GetSizeChanged()); err != nil { + return nil, err } // delete old secondary index entry @@ -488,8 +487,8 @@ func (k Keeper) Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte if execErr != nil { return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error()) } - if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { - return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore.GetSizeChanged()); err != nil { + return nil, err } ctx.EventManager().EmitEvent(sdk.NewEvent( @@ -527,8 +526,8 @@ func (k Keeper) reply(ctx sdk.Context, contractAddress sdk.AccAddress, reply was if execErr != nil { return nil, sdkerrors.Wrap(types.ErrExecuteFailed, execErr.Error()) } - if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore); err != nil { - return nil, sdkerrors.Wrap(types.ErrUpdateContractSize, err.Error()) + if err := k.updateSizeForContract(ctx, contractAddress, sizedPrefixStore.GetSizeChanged()); err != nil { + return nil, err } ctx.EventManager().EmitEvent(sdk.NewEvent( @@ -1030,18 +1029,17 @@ func (k Keeper) newQueryHandler(ctx sdk.Context, contractAddress sdk.AccAddress) return NewQueryHandler(ctx, k.wasmVMQueryHandler, contractAddress, k.gasRegister) } -func (k Keeper) updateSizeForContract(ctx sdk.Context, contractAddress sdk.AccAddress, sizedStore *sized.Store) error { +func (k Keeper) updateSizeForContract(ctx sdk.Context, contractAddress sdk.AccAddress, sizeChange int64) error { // always charge rent first before updating size, as the charging logic assumes constant size since last // charged block if err := k.chargeRent(ctx, contractAddress); err != nil { return err } - sizeChange := sizedStore.GetSizeChanged() sizeKey := types.GetContractStoreSizePrefix(contractAddress) store := ctx.KVStore(k.storeKey) currentSize, err := k.getCurrentSizeForContract(ctx, contractAddress) if err != nil { - return err + return types.ErrUpdateContractSize.Wrap(err.Error()) } currentSizeSigned := int64(currentSize) + sizeChange if currentSizeSigned < 0 { @@ -1074,16 +1072,23 @@ func (k Keeper) chargeRent(ctx sdk.Context, contractAddress sdk.AccAddress) erro return err } if size == 0 { + rentInfo.LastChargedBlock = uint64(ctx.BlockHeight()) k.setRentInfo(ctx, contractAddress, rentInfo) return nil } rentPrice := k.GetParams(ctx).UnitRentPrice - rentToBeCharged := uint64(sdk.NewDec(int64(duration * size)).Mul(rentPrice).RoundInt().Int64()) - if rentToBeCharged > rentInfo.Balance { - return errors.New("insufficient rent balance") + rentToBeCharged := sdk.NewDec(int64(duration * size)).Mul(rentPrice).RoundInt().Int64() + // protect against overflow + if rentInfo.Balance < rentToBeCharged+math.MinInt64 { + rentInfo.Balance = math.MinInt64 + } else { + rentInfo.Balance -= rentToBeCharged } - rentInfo.Balance -= rentToBeCharged + rentInfo.LastChargedBlock = uint64(ctx.BlockHeight()) k.setRentInfo(ctx, contractAddress, rentInfo) + if rentInfo.Balance < 0 { + return types.ErrInsufficientRent + } return nil } @@ -1093,7 +1098,6 @@ func (k Keeper) getRentInfo(ctx sdk.Context, contractAddress sdk.AccAddress) (*t func (k Keeper) setRentInfo(ctx sdk.Context, contractAddress sdk.AccAddress, rentInfo *types.RentInfo) { store := ctx.KVStore(k.storeKey) - rentInfo.LastChargedBlock = uint64(ctx.BlockHeight()) store.Set(types.GetContractRentInfoPrefix(contractAddress), rentInfo.Marshal()) } @@ -1106,7 +1110,7 @@ func (k Keeper) DepositRent(ctx sdk.Context, contractAddress sdk.AccAddress, sen if err != nil { return err } - rentInfo.Balance += uint64(amount) + rentInfo.Balance += amount k.setRentInfo(ctx, contractAddress, rentInfo) return nil } diff --git a/x/wasm/keeper/keeper_test.go b/x/wasm/keeper/keeper_test.go index edbc127..f39192b 100644 --- a/x/wasm/keeper/keeper_test.go +++ b/x/wasm/keeper/keeper_test.go @@ -390,7 +390,7 @@ func TestInstantiate(t *testing.T) { gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x18db5), gasAfter-gasBefore) + require.Equal(t, uint64(0x1b4d4), gasAfter-gasBefore) } // ensure it is stored properly @@ -408,6 +408,15 @@ func TestInstantiate(t *testing.T) { }} assert.Equal(t, exp, keepers.WasmKeeper.GetContractHistory(ctx, gotContractAddr)) + size, err := GetSize(ctx, gotContractAddr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, uint64(185), size) + + rentInfo, err := GetRentInfo(ctx, gotContractAddr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, int64(0), rentInfo.Balance) + assert.Equal(t, uint64(ctx.BlockHeight()), rentInfo.LastChargedBlock) + // and events emitted expEvt := sdk.Events{ sdk.NewEvent("instantiate", @@ -470,6 +479,15 @@ func TestInstantiateWithDeposit(t *testing.T) { require.NoError(t, err) balances := bankKeeper.GetAllBalances(ctx, addr) assert.Equal(t, deposit, balances) + + size, err := GetSize(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, uint64(185), size) + + rentInfo, err := GetRentInfo(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, int64(0), rentInfo.Balance) + assert.Equal(t, uint64(ctx.BlockHeight()), rentInfo.LastChargedBlock) }) } } @@ -567,11 +585,14 @@ func TestInstantiateWithContractDataResponse(t *testing.T) { func TestExecute(t *testing.T) { ctx, keepers := CreateTestInput(t, false, SupportedFeatures) accKeeper, keeper, bankKeeper := keepers.AccountKeeper, keepers.ContractKeeper, keepers.BankKeeper + params := keepers.WasmKeeper.GetParams(ctx) + params.RentDenom = "denom" + keepers.WasmKeeper.SetParams(ctx, params) deposit := sdk.NewCoins(sdk.NewInt64Coin("denom", 100000)) topUp := sdk.NewCoins(sdk.NewInt64Coin("denom", 5000)) - creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...)...) - fred := keepers.Faucet.NewFundedAccount(ctx, topUp...) + creator := keepers.Faucet.NewFundedAccount(ctx, deposit.Add(deposit...).Add(deposit...)...) + fred := keepers.Faucet.NewFundedAccount(ctx, topUp.Add(topUp...)...) contractID, err := keeper.Create(ctx, creator, hackatomWasm, nil) require.NoError(t, err) @@ -588,6 +609,15 @@ func TestExecute(t *testing.T) { require.NoError(t, err) require.Equal(t, "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr", addr.String()) + size, err := GetSize(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, uint64(185), size) + + rentInfo, err := GetRentInfo(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, int64(0), rentInfo.Balance) + assert.Equal(t, uint64(ctx.BlockHeight()), rentInfo.LastChargedBlock) + // ensure bob doesn't exist bobAcct := accKeeper.GetAccount(ctx, bob) require.Nil(t, bobAcct) @@ -595,21 +625,48 @@ func TestExecute(t *testing.T) { // ensure funder has reduced balance creatorAcct := accKeeper.GetAccount(ctx, creator) require.NotNil(t, creatorAcct) - // we started at 2*deposit, should have spent one above - assert.Equal(t, deposit, bankKeeper.GetAllBalances(ctx, creatorAcct.GetAddress())) + // we started at 3*deposit, should have spent one above + assert.Equal(t, deposit.Add(deposit...), bankKeeper.GetAllBalances(ctx, creatorAcct.GetAddress())) // ensure contract has updated balance contractAcct := accKeeper.GetAccount(ctx, addr) require.NotNil(t, contractAcct) assert.Equal(t, deposit, bankKeeper.GetAllBalances(ctx, contractAcct.GetAddress())) + // bump block height + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 2) + + // insufficient rent + res, err := keepers.ContractKeeper.Execute(ctx.WithEventManager(sdk.NewEventManager()), addr, fred, []byte(`{"release":{}}`), topUp) + require.Error(t, err) + require.True(t, errors.Is(err, types.ErrInsufficientRent)) + + // deposit rent + err = keepers.WasmKeeper.DepositRent(ctx, addr, creator, 100000) + require.Nil(t, err) + rentInfo, err = GetRentInfo(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, int64(99996), rentInfo.Balance) + // unauthorized - trialCtx so we don't change state trialCtx := ctx.WithMultiStore(ctx.MultiStore().CacheWrap(keepers.WasmKeeper.storeKey).(sdk.MultiStore)) - res, err := keepers.ContractKeeper.Execute(trialCtx, addr, creator, []byte(`{"release":{}}`), nil) + res, err = keepers.ContractKeeper.Execute(trialCtx, addr, creator, []byte(`{"release":{}}`), nil) require.Error(t, err) require.True(t, errors.Is(err, types.ErrExecuteFailed)) require.Equal(t, "Unauthorized: execute wasm contract failed", err.Error()) + size, err = GetSize(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, uint64(185), size) + + rentInfo, err = GetRentInfo(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, int64(99996), rentInfo.Balance) + assert.Equal(t, uint64(ctx.BlockHeight()), rentInfo.LastChargedBlock) + + // bump block height + ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1) + // verifier can execute, and get proper gas amount start := time.Now() gasBefore := ctx.GasMeter().GasConsumed() @@ -623,13 +680,13 @@ func TestExecute(t *testing.T) { // make sure gas is properly deducted from ctx gasAfter := ctx.GasMeter().GasConsumed() if types.EnableGasVerification { - require.Equal(t, uint64(0x17cd2), gasAfter-gasBefore) + require.Equal(t, uint64(0x1b57a), gasAfter-gasBefore) } // ensure bob now exists and got both payments released bobAcct = accKeeper.GetAccount(ctx, bob) require.NotNil(t, bobAcct) balance := bankKeeper.GetAllBalances(ctx, bobAcct.GetAddress()) - assert.Equal(t, deposit.Add(topUp...), balance) + assert.Equal(t, deposit.Add(topUp...).Add(topUp...), balance) // ensure contract has updated balance contractAcct = accKeeper.GetAccount(ctx, addr) @@ -642,6 +699,15 @@ func TestExecute(t *testing.T) { sdk.NewAttribute("_contract_address", addr.String())) assert.Equal(t, expEvt, em.Events()[3], prettyEvents(t, em.Events())) + size, err = GetSize(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, uint64(185), size) + + rentInfo, err = GetRentInfo(ctx, addr, keepers.WasmKeeper.storeKey) + require.Nil(t, err) + assert.Equal(t, int64(99994), rentInfo.Balance) + assert.Equal(t, uint64(ctx.BlockHeight()), rentInfo.LastChargedBlock) + t.Logf("Duration: %v (%d gas)\n", diff, gasAfter-gasBefore) } diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index 29e47ab..7af616c 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -113,11 +113,14 @@ func MakeEncodingConfig(_ testing.TB) wasmappparams.EncodingConfig { } var TestingStakeParams = stakingtypes.Params{ - UnbondingTime: 100, - MaxValidators: 10, - MaxEntries: 10, - HistoricalEntries: 10, - BondDenom: "stake", + UnbondingTime: 100, + MaxValidators: 10, + MaxEntries: 10, + HistoricalEntries: 10, + BondDenom: "stake", + MaxVotingPowerRatio: sdk.OneDec(), + MaxVotingPowerEnforcementThreshold: sdk.ZeroInt(), + MinCommissionRate: sdk.ZeroDec(), } type TestFaucet struct { diff --git a/x/wasm/types/errors.go b/x/wasm/types/errors.go index 3cde314..8a4d9b9 100644 --- a/x/wasm/types/errors.go +++ b/x/wasm/types/errors.go @@ -90,6 +90,9 @@ var ( // ErrUpdateContractSize error ErrUpdateContractSize = sdkErrors.Register(DefaultCodespace, 28, "failed to update contract size") + + // ErrInsufficientRent error + ErrInsufficientRent = sdkErrors.Register(DefaultCodespace, 29, "not enough rent balance left") ) type ErrNoSuchContract struct { diff --git a/x/wasm/types/query.pb.go b/x/wasm/types/query.pb.go index ca6a791..b4042a3 100644 --- a/x/wasm/types/query.pb.go +++ b/x/wasm/types/query.pb.go @@ -841,7 +841,7 @@ func (m *QueryRentInfoRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryRentInfoRequest proto.InternalMessageInfo type QueryRentInfoResponse struct { - Balance uint64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"` + Balance int64 `protobuf:"varint,1,opt,name=balance,proto3" json:"balance,omitempty"` LastChargedBlock uint64 `protobuf:"varint,2,opt,name=last_charged_block,json=lastChargedBlock,proto3" json:"last_charged_block,omitempty"` } @@ -981,7 +981,7 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/query.proto", fileDescriptor_9677c207036b9f2b) } var fileDescriptor_9677c207036b9f2b = []byte{ - // 1329 bytes of a gzipped FileDescriptorProto + // 1332 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x98, 0x4f, 0x6f, 0x1b, 0xc5, 0x1b, 0xc7, 0x3d, 0xa9, 0xe3, 0x3f, 0xd3, 0x54, 0xf5, 0x6f, 0xd4, 0xa6, 0xfe, 0x99, 0x74, 0x1d, 0x2d, 0x55, 0x9a, 0xa6, 0x61, 0xb7, 0x4e, 0x5b, 0x15, 0x90, 0x10, 0xaa, 0x53, 0x68, 0x5a, 0xa9, @@ -1036,36 +1036,36 @@ var fileDescriptor_9677c207036b9f2b = []byte{ 0x58, 0x07, 0x68, 0xf1, 0xea, 0xcd, 0xf2, 0x4b, 0x20, 0xc7, 0x96, 0x81, 0x3d, 0x7a, 0xdf, 0x60, 0x46, 0x7e, 0x15, 0xbe, 0x1e, 0xc9, 0xf2, 0x49, 0x9e, 0x6b, 0xb7, 0x53, 0x4c, 0xfb, 0x9f, 0x06, 0x35, 0xd2, 0xfe, 0x57, 0x71, 0x84, 0x49, 0x5f, 0x82, 0xa7, 0xfc, 0x1e, 0x46, 0x9c, 0x09, 0x67, - 0xa8, 0x0a, 0x3c, 0x3d, 0xe4, 0xd1, 0x1f, 0x9f, 0xaa, 0xb8, 0x81, 0x1d, 0x93, 0xc8, 0x1e, 0x10, - 0xdc, 0xa2, 0x65, 0x88, 0x1a, 0x98, 0xb2, 0x8a, 0x59, 0xc7, 0x5e, 0x8d, 0x58, 0x95, 0x6a, 0xc3, - 0x35, 0x3f, 0x12, 0xd4, 0x49, 0x23, 0xc7, 0x57, 0x56, 0xfd, 0x85, 0x32, 0x7f, 0xae, 0x96, 0xe4, - 0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0xbb, 0xe7, 0xd1, 0xec, + 0xf8, 0xdd, 0xd1, 0xe7, 0x00, 0x1e, 0x0f, 0x1d, 0x44, 0xe8, 0x42, 0x44, 0xd4, 0xd1, 0x03, 0xb1, + 0xb0, 0x34, 0x89, 0xa9, 0xc4, 0x58, 0x10, 0x18, 0xf3, 0x48, 0x19, 0x8f, 0x41, 0xf5, 0x96, 0x70, + 0x42, 0xcf, 0x01, 0xcc, 0x04, 0x87, 0x0a, 0x5a, 0x88, 0xaa, 0xdb, 0xc1, 0x73, 0xaa, 0x70, 0x3e, + 0xd6, 0x2e, 0xfe, 0x55, 0x78, 0xc4, 0x09, 0x77, 0xdc, 0xcf, 0x00, 0xcc, 0xf6, 0x0e, 0x12, 0x14, + 0xb5, 0xc1, 0xf0, 0xe9, 0x54, 0x58, 0x8c, 0x37, 0x8c, 0x47, 0xe1, 0xa7, 0x54, 0x1f, 0xa5, 0xbc, + 0xb6, 0xf3, 0x97, 0x92, 0xf8, 0xb9, 0xab, 0x24, 0x76, 0xba, 0x0a, 0xd8, 0xed, 0x2a, 0xe0, 0xcf, + 0xae, 0x02, 0xbe, 0xda, 0x53, 0x12, 0xbb, 0x7b, 0x4a, 0xe2, 0x8f, 0x3d, 0x25, 0xf1, 0xe1, 0x42, + 0x68, 0xdc, 0x5d, 0x75, 0x69, 0xf3, 0x41, 0x10, 0xcd, 0xd2, 0x9f, 0xf8, 0x51, 0xc5, 0xff, 0x2f, + 0xd5, 0x94, 0xf8, 0xdb, 0xe4, 0xf2, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x76, 0xe5, 0x05, + 0xe6, 0x11, 0x00, 0x00, } func (this *QueryContractInfoResponse) Equal(that interface{}) bool { @@ -5112,7 +5112,7 @@ func (m *QueryRentInfoResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Balance |= uint64(b&0x7F) << shift + m.Balance |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/wasm/types/rent.go b/x/wasm/types/rent.go index f93eff6..6f9d9d6 100644 --- a/x/wasm/types/rent.go +++ b/x/wasm/types/rent.go @@ -7,13 +7,13 @@ import ( // custom struct instead of protobuf to minimize state needed type RentInfo struct { - Balance uint64 + Balance int64 LastChargedBlock uint64 } func (r *RentInfo) Marshal() []byte { b, l := make([]byte, 8), make([]byte, 8) - binary.BigEndian.PutUint64(b, r.Balance) + binary.BigEndian.PutUint64(b, uint64(r.Balance)) binary.BigEndian.PutUint64(l, r.LastChargedBlock) return append(b, l...) } @@ -22,7 +22,7 @@ func (r *RentInfo) Unmarshal(bz []byte) error { if len(bz) != 16 { return errors.New("RentInfo must have exactly 16 bytes") } - r.Balance = binary.BigEndian.Uint64(bz[:8]) + r.Balance = int64(binary.BigEndian.Uint64(bz[:8])) r.LastChargedBlock = binary.BigEndian.Uint64(bz[8:]) return nil }