diff --git a/app/app.go b/app/app.go index 0c374fb..4ba9f42 100644 --- a/app/app.go +++ b/app/app.go @@ -185,14 +185,15 @@ var ( // module account permissions maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - icatypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + icatypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + cosmwasmlifecyclemoduletypes.ModuleName: {authtypes.Burner}, // this line is used by starport scaffolding # stargate/app/maccPerms } ) @@ -557,8 +558,8 @@ func New( app.CosmwasmlifecycleKeeper = *cosmwasmlifecyclemodulekeeper.NewKeeper( appCodec, keys[cosmwasmlifecyclemoduletypes.StoreKey], - keys[cosmwasmlifecyclemoduletypes.MemStoreKey], - app.GetSubspace(cosmwasmlifecyclemoduletypes.ModuleName), + app.WasmKeeper, + app.BankKeeper, ) cosmwasmlifecycleModule := cosmwasmlifecyclemodule.NewAppModule(appCodec, app.CosmwasmlifecycleKeeper, app.WasmKeeper) diff --git a/docs/logo.jpg b/docs/logo.jpg new file mode 100644 index 0000000..371420b Binary files /dev/null and b/docs/logo.jpg differ diff --git a/go.mod b/go.mod index 4e1f6c9..f9d73c6 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,11 @@ go 1.19 require ( cosmossdk.io/api v0.3.1 + cosmossdk.io/errors v1.0.0 github.com/CosmWasm/wasmd v0.42.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.3.0 @@ -32,7 +34,6 @@ require ( cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.5.1 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/errors v1.0.0 // indirect cosmossdk.io/log v1.2.1 // indirect cosmossdk.io/math v1.1.2 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect @@ -58,7 +59,6 @@ require ( github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.1 // indirect diff --git a/proto/cosmwasmlifecycle/contract.proto b/proto/cosmwasmlifecycle/contract.proto new file mode 100644 index 0000000..02731e6 --- /dev/null +++ b/proto/cosmwasmlifecycle/contract.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +package cosmwasmlifecycle; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmwasmlifecycle/execution_type.proto"; + +option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; + +// Contract defines the parameters for the module. +message Contract { + // Amount of strikes that the contract has at the moment. + int64 strikes = 1; + + // Contract's execution type + ExecutionType execution_type = 2; + + // Collateral deposited to the contract. + cosmos.base.v1beta1.Coin deposit = 3 [ + (gogoproto.nullable) = false, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; +} diff --git a/proto/cosmwasmlifecycle/cosmwasmlifecycle/genesis.proto b/proto/cosmwasmlifecycle/cosmwasmlifecycle/genesis.proto deleted file mode 100644 index f92d6e8..0000000 --- a/proto/cosmwasmlifecycle/cosmwasmlifecycle/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package cosmwasmlifecycle.cosmwasmlifecycle; - -import "gogoproto/gogo.proto"; -import "cosmwasmlifecycle/cosmwasmlifecycle/params.proto"; - -option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; - -// GenesisState defines the cosmwasmlifecycle module's genesis state. -message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; -} diff --git a/proto/cosmwasmlifecycle/cosmwasmlifecycle/params.proto b/proto/cosmwasmlifecycle/cosmwasmlifecycle/params.proto deleted file mode 100644 index 2bf6e2b..0000000 --- a/proto/cosmwasmlifecycle/cosmwasmlifecycle/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package cosmwasmlifecycle.cosmwasmlifecycle; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/cosmwasmlifecycle/cosmwasmlifecycle/tx.proto b/proto/cosmwasmlifecycle/cosmwasmlifecycle/tx.proto deleted file mode 100644 index 3300dc2..0000000 --- a/proto/cosmwasmlifecycle/cosmwasmlifecycle/tx.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; -package cosmwasmlifecycle.cosmwasmlifecycle; - -option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; - -// Msg defines the Msg service. -service Msg {} \ No newline at end of file diff --git a/proto/cosmwasmlifecycle/events.proto b/proto/cosmwasmlifecycle/events.proto new file mode 100644 index 0000000..611fa97 --- /dev/null +++ b/proto/cosmwasmlifecycle/events.proto @@ -0,0 +1,17 @@ +syntax = "proto3"; +package cosmwasmlifecycle; + +import "cosmos_proto/cosmos.proto"; +option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; + +message ContractDeleteEvent { + string module_name = 1; + string contract_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +message ContractStrikeEvent { + string module_name = 1; + string contract_address = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + int64 current_strike = 3; + string strike_reason = 4; +} \ No newline at end of file diff --git a/proto/cosmwasmlifecycle/execution_type.proto b/proto/cosmwasmlifecycle/execution_type.proto new file mode 100644 index 0000000..5f65535 --- /dev/null +++ b/proto/cosmwasmlifecycle/execution_type.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +package cosmwasmlifecycle; + +option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; + +enum ExecutionType { + BEGIN_AND_END_BLOCK = 0; + BEGIN_BLOCK = 1; + END_BLOCK = 2; +} \ No newline at end of file diff --git a/proto/cosmwasmlifecycle/genesis.proto b/proto/cosmwasmlifecycle/genesis.proto new file mode 100644 index 0000000..401d4c4 --- /dev/null +++ b/proto/cosmwasmlifecycle/genesis.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package cosmwasmlifecycle; + +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmwasmlifecycle/params.proto"; +import "cosmwasmlifecycle/contract.proto"; + +option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; + +// GenesisState defines the cosmwasmlifecycle module's genesis state. +message GenesisState { + Params params = 1 [(gogoproto.nullable) = false]; + + // Contracts with their current information + // about the execution state. + repeated Contract contracts = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} diff --git a/proto/cosmwasmlifecycle/params.proto b/proto/cosmwasmlifecycle/params.proto new file mode 100644 index 0000000..65711a6 --- /dev/null +++ b/proto/cosmwasmlifecycle/params.proto @@ -0,0 +1,27 @@ +syntax = "proto3"; +package cosmwasmlifecycle; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.goproto_stringer) = false; + // Enable or disable executions + // at the begin and end of the block + bool is_enabled = 1; + + // Minimum deposit to enable contract execution at begin block and/or end block + // This deposit will be burned if the contract execution reaches the max strikes. + cosmos.base.v1beta1.Coin min_deposit = 2 [ + (gogoproto.nullable) = false, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin" + ]; + + // Amount of strikes that the contract can hold before being + // disabled from end and beging block executions. + // When this happens the min_desposit will also be burned. + int64 strikes_to_disable_execution = 3; +} diff --git a/proto/cosmwasmlifecycle/cosmwasmlifecycle/query.proto b/proto/cosmwasmlifecycle/query.proto similarity index 78% rename from proto/cosmwasmlifecycle/cosmwasmlifecycle/query.proto rename to proto/cosmwasmlifecycle/query.proto index 705afa0..283e315 100644 --- a/proto/cosmwasmlifecycle/cosmwasmlifecycle/query.proto +++ b/proto/cosmwasmlifecycle/query.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package cosmwasmlifecycle.cosmwasmlifecycle; +package cosmwasmlifecycle; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "cosmwasmlifecycle/cosmwasmlifecycle/params.proto"; +import "cosmwasmlifecycle/params.proto"; option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; @@ -12,7 +12,7 @@ option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/ service Query { // Parameters queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/emidev98/cosmwasm-lifecycle/cosmwasmlifecycle/params"; + option (google.api.http).get = "/cosmwasmlifecycle/params"; } } diff --git a/proto/cosmwasmlifecycle/tx.proto b/proto/cosmwasmlifecycle/tx.proto new file mode 100644 index 0000000..2efa81e --- /dev/null +++ b/proto/cosmwasmlifecycle/tx.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package cosmwasmlifecycle; +import "gogoproto/gogo.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmwasmlifecycle/execution_type.proto"; + +option go_package = "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types"; + +// Msg defines the Msg service. +service Msg { + rpc EnableContractBlockExecution(MsgEnableContractBlockExecution) returns (MsgEnableContractBlockExecutionResponse); + rpc DisableContractBlockExecution(MsgDisableContractBlockExecution) returns (MsgDisableContractBlockExecutionResponse); +} + +message MsgEnableContractBlockExecution { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = true; + + string contract_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + ExecutionType execution = 2; +} +message MsgEnableContractBlockExecutionResponse {} + +message MsgDisableContractBlockExecution { + option (gogoproto.equal) = true; + option (gogoproto.goproto_getters) = true; + + string contract_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + ExecutionType execution = 2; +} +message MsgDisableContractBlockExecutionResponse {} diff --git a/readme.md b/readme.md index 1af20b8..382492e 100644 --- a/readme.md +++ b/readme.md @@ -1 +1,13 @@ -# CosmWasm Lifecycle \ No newline at end of file +
+

CosmWasm Lifecycle Module

+
+ +![IMG](./docs/logo.jpg) + +CosmWasm Lifecycle blockchain module leverages [CosmoSDK's lifecycle](https://docs.cosmos.network/main/build/building-modules/beginblock-endblock) to facilitate the execution of smart contracts at the initiation and conclusion of each block. Given the necessity for swift and resource-light execution in both stages, this module mandates [Gov](https://docs.cosmos.network/main/build/modules/gov) voting and demands a collateral deposit for each smart contract on an individual basis. This collateral deposit will be burned if the smart contract fails to execute multiple times. + + + + + + diff --git a/testutil/keeper/cosmwasmlifecycle.go b/testutil/keeper/cosmwasmlifecycle.go index d673373..c2c084e 100644 --- a/testutil/keeper/cosmwasmlifecycle.go +++ b/testutil/keeper/cosmwasmlifecycle.go @@ -11,7 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/keeper" "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" "github.com/stretchr/testify/require" @@ -30,17 +29,11 @@ func CosmwasmlifecycleKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "CosmwasmlifecycleParams", - ) k := keeper.NewKeeper( cdc, storeKey, - memStoreKey, - paramsSubspace, + wasmKeeper, + bankKeeper, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/x/cosmwasmlifecycle/genesis.go b/x/cosmwasmlifecycle/genesis.go deleted file mode 100644 index 78f2474..0000000 --- a/x/cosmwasmlifecycle/genesis.go +++ /dev/null @@ -1,23 +0,0 @@ -package cosmwasmlifecycle - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/keeper" - "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" -) - -// InitGenesis initializes the module's state from a provided genesis state. -func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - // this line is used by starport scaffolding # genesis/module/init - k.SetParams(ctx, genState.Params) -} - -// ExportGenesis returns the module's exported genesis -func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - - // this line is used by starport scaffolding # genesis/module/export - - return genesis -} diff --git a/x/cosmwasmlifecycle/genesis_test.go b/x/cosmwasmlifecycle/genesis_test.go deleted file mode 100644 index 8081fdd..0000000 --- a/x/cosmwasmlifecycle/genesis_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package cosmwasmlifecycle_test - -import ( - "testing" - - keepertest "github.com/emidev98/cosmwasm-lifecycle/testutil/keeper" - "github.com/emidev98/cosmwasm-lifecycle/testutil/nullify" - "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle" - "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" - "github.com/stretchr/testify/require" -) - -func TestGenesis(t *testing.T) { - genesisState := types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - k, ctx := keepertest.CosmwasmlifecycleKeeper(t) - cosmwasmlifecycle.InitGenesis(ctx, *k, genesisState) - got := cosmwasmlifecycle.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - nullify.Fill(&genesisState) - nullify.Fill(got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/cosmwasmlifecycle/keeper/contract.go b/x/cosmwasmlifecycle/keeper/contract.go new file mode 100644 index 0000000..09d55bd --- /dev/null +++ b/x/cosmwasmlifecycle/keeper/contract.go @@ -0,0 +1,45 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" +) + +func (k Keeper) GetContract(ctx sdk.Context, contractAddr sdk.AccAddress) (d types.Contract, found bool) { + key := types.GetContractKeyByAddress(contractAddr) + b := ctx.KVStore(k.storeKey).Get(key) + if b == nil { + return d, false + } + k.cdc.MustUnmarshal(b, &d) + return d, true +} + +func (k Keeper) SetContract(ctx sdk.Context, contractAddr sdk.AccAddress, contract types.Contract) { + key := types.GetContractKeyByAddress(contractAddr) + b := k.cdc.MustMarshal(&contract) + ctx.KVStore(k.storeKey).Set(key, b) +} + +func (k Keeper) DeleteContract(ctx sdk.Context, contractAddr sdk.AccAddress) { + key := types.GetContractKeyByAddress(contractAddr) + store := ctx.KVStore(k.storeKey) + store.Delete(key) +} + +func (k Keeper) IterateContracts(ctx sdk.Context, cb func(contractAddr sdk.AccAddress, contract types.Contract) error) (err error) { + store := ctx.KVStore(k.storeKey) + iter := sdk.KVStorePrefixIterator(store, types.ContractKey) + defer iter.Close() + for ; iter.Valid(); iter.Next() { + var contract types.Contract + b := iter.Value() + k.cdc.MustUnmarshal(b, &contract) + err = cb(iter.Key(), contract) + if err != nil { + return err + } + } + + return nil +} diff --git a/x/cosmwasmlifecycle/keeper/events.go b/x/cosmwasmlifecycle/keeper/events.go new file mode 100644 index 0000000..1d43c71 --- /dev/null +++ b/x/cosmwasmlifecycle/keeper/events.go @@ -0,0 +1,34 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" +) + +// Emits an event to notify that the contract has been striked +// including the address, current strike and the reason +func EmitContractStrikeEvent( + ctx sdk.Context, + contractAddress sdk.AccAddress, + currentStrike int64, + strikeReason error, +) error { + return ctx.EventManager().EmitTypedEvent(&types.ContractStrikeEvent{ + ModuleName: types.ModuleName, + ContractAddress: contractAddress.String(), + CurrentStrike: currentStrike, + StrikeReason: strikeReason.Error(), + }) +} + +// Emits an event to notify that the contract has been striked +// including the address, current strike and the reason +func EmitContractDeleteEvent( + ctx sdk.Context, + contractAddress sdk.AccAddress, +) error { + return ctx.EventManager().EmitTypedEvent(&types.ContractDeleteEvent{ + ModuleName: types.ModuleName, + ContractAddress: contractAddress.String(), + }) +} diff --git a/x/cosmwasmlifecycle/keeper/genesis.go b/x/cosmwasmlifecycle/keeper/genesis.go new file mode 100644 index 0000000..b492329 --- /dev/null +++ b/x/cosmwasmlifecycle/keeper/genesis.go @@ -0,0 +1,20 @@ +package keeper + +import ( + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" +) + +func (k Keeper) InitGenesis(ctx sdk.Context, g types.GenesisState) []abci.ValidatorUpdate { + k.SetParams(ctx, g.Params) + // TODO: add contract to stores from genesis + return []abci.ValidatorUpdate{} +} + +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + genesis := types.DefaultGenesis() + genesis.Params = k.GetParams(ctx) + // TODO: export contracts from stores to genesis + return genesis +} diff --git a/x/cosmwasmlifecycle/keeper/keeper.go b/x/cosmwasmlifecycle/keeper/keeper.go index afc4c5b..baf42e7 100644 --- a/x/cosmwasmlifecycle/keeper/keeper.go +++ b/x/cosmwasmlifecycle/keeper/keeper.go @@ -7,38 +7,123 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" ) -type ( - Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - } -) +type Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + wasmKeeper types.WasmKeeper + bankKeeper types.BankKeeper +} func NewKeeper( cdc codec.BinaryCodec, - storeKey, - memKey storetypes.StoreKey, - ps paramtypes.Subspace, - + storeKey storetypes.StoreKey, + wasmKeeper types.WasmKeeper, + bankKeeper types.BankKeeper, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return &Keeper{ cdc: cdc, storeKey: storeKey, - memKey: memKey, - paramstore: ps, + wasmKeeper: wasmKeeper, + bankKeeper: bankKeeper, + } +} + +// Function used to execute the begin_block as sudo of a contract +func (k Keeper) BeginBlock(ctx sdk.Context) (err error) { + // First gets the module params and check if the module is enabled + params := k.GetParams(ctx) + if params.IsEnabled { + // Iterate over all contracts and check if the contract can be executed in the current context + err = k.IterateContracts(ctx, func(contractAddr sdk.AccAddress, contract types.Contract) error { + return k.executeContract(ctx, contractAddr, contract, params, types.ExecutionType_BEGIN_BLOCK) + }) + + if err != nil { + return err + } + } + + return nil +} + +func (k Keeper) EndBlock(ctx sdk.Context) (err error) { + // First gets the module params and check if the module is enabled + params := k.GetParams(ctx) + if params.IsEnabled { + // Iterate over all contracts and check if the contract can be executed in the current context + err = k.IterateContracts(ctx, func(contractAddr sdk.AccAddress, contract types.Contract) error { + return k.executeContract(ctx, contractAddr, contract, params, types.ExecutionType_END_BLOCK) + }) + + if err != nil { + return err + } } + + return nil +} + +// Function used to execute the contract as sudo +func (k Keeper) executeContract( + ctx sdk.Context, + contractAddr sdk.AccAddress, + contract types.Contract, + params types.Params, + executionType types.ExecutionType, +) error { + if contract.CanExecute(params, executionType) { + // Execute the begin_block as sudo and if this execution fails, + // increment the strikes of the contract and emit the ContractStrikeEvent + _, err := k.wasmKeeper.Sudo(ctx, contractAddr, []byte("{\"begin_block\": {}}")) + if err != nil { + contract.Strikes++ + err := EmitContractStrikeEvent(ctx, contractAddr, contract.Strikes, err) + if err != nil { + panic(err) + } + + // If the contract has enough strikes to be disabled, + // it will be deleted form the store and the deposit + // will be burned + if contract.HasEnoughStrikesToDisableExecution(params.StrikesToDisableExecution) { + err := k.deleteContractAndBurnDeposit(ctx, contractAddr, contract.Deposit) + if err != nil { + return err + } + } else { + k.SetContract(ctx, contractAddr, contract) + } + } + } else { + err := k.deleteContractAndBurnDeposit(ctx, contractAddr, contract.Deposit) + if err != nil { + return err + } + } + + return nil +} + +// Receives the contractAddr and the respective contract deposit +// to delete the contract from the store and burn the deposit +func (k Keeper) deleteContractAndBurnDeposit(ctx sdk.Context, contractAddr sdk.AccAddress, deposit sdk.Coin) (err error) { + k.DeleteContract(ctx, contractAddr) + err = k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(deposit)) + if err != nil { + return err + } + + err = EmitContractDeleteEvent(ctx, contractAddr) + if err != nil { + return err + } + + return err } func (k Keeper) Logger(ctx sdk.Context) log.Logger { diff --git a/x/cosmwasmlifecycle/keeper/msg_server.go b/x/cosmwasmlifecycle/keeper/msg_server.go index 2275a41..c17a523 100644 --- a/x/cosmwasmlifecycle/keeper/msg_server.go +++ b/x/cosmwasmlifecycle/keeper/msg_server.go @@ -1,6 +1,8 @@ package keeper import ( + "context" + "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" ) @@ -11,7 +13,21 @@ type msgServer struct { // NewMsgServerImpl returns an implementation of the MsgServer interface // for the provided Keeper. func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} + return &msgServer{ + Keeper: keeper, + } } var _ types.MsgServer = msgServer{} + +// Enable a contract execution. +func (msgServer msgServer) EnableContractBlockExecution(ctx context.Context, msg *types.MsgEnableContractBlockExecution) (res *types.MsgEnableContractBlockExecutionResponse, err error) { + + return res, err +} + +// Disable a contract execution and return the funds to the external account. +func (msgServer msgServer) DisableContractBlockExecution(ctx context.Context, msg *types.MsgDisableContractBlockExecution) (res *types.MsgDisableContractBlockExecutionResponse, err error) { + + return res, err +} diff --git a/x/cosmwasmlifecycle/keeper/params.go b/x/cosmwasmlifecycle/keeper/params.go index 9c7022d..dee0006 100644 --- a/x/cosmwasmlifecycle/keeper/params.go +++ b/x/cosmwasmlifecycle/keeper/params.go @@ -5,12 +5,18 @@ import ( "github.com/emidev98/cosmwasm-lifecycle/x/cosmwasmlifecycle/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamKey) + if bz == nil { + return + } + k.cdc.MustUnmarshal(bz, ¶ms) + return } -// SetParams set the params func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamKey, bz) } diff --git a/x/cosmwasmlifecycle/module.go b/x/cosmwasmlifecycle/module.go index 3e37e0e..2bc050c 100644 --- a/x/cosmwasmlifecycle/module.go +++ b/x/cosmwasmlifecycle/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -91,22 +92,19 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper + wasmKeeper types.WasmKeeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, + wasmKeeper types.WasmKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, + wasmKeeper: wasmKeeper, } } @@ -124,15 +122,12 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra var genState types.GenesisState // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - - InitGenesis(ctx, am.keeper, genState) - - return []abci.ValidatorUpdate{} + return am.keeper.InitGenesis(ctx, genState) } // ExportGenesis returns the module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, am.keeper) + genState := am.keeper.ExportGenesis(ctx) return cdc.MustMarshalJSON(genState) } @@ -140,9 +135,19 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { + err := am.keeper.BeginBlock(ctx) + if err != nil { + panic(err) + } +} // EndBlock contains the logic that is automatically triggered at the end of each block -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + err := am.keeper.EndBlock(ctx) + if err != nil { + panic(err) + } + return []abci.ValidatorUpdate{} } diff --git a/x/cosmwasmlifecycle/types/contract.go b/x/cosmwasmlifecycle/types/contract.go new file mode 100644 index 0000000..997e084 --- /dev/null +++ b/x/cosmwasmlifecycle/types/contract.go @@ -0,0 +1,17 @@ +package types + +// Can Execute returns true if the contract can be executed +// based on the module parameters, strikes and available deposits +func (c *Contract) CanExecute(p Params, executionType ExecutionType) bool { + hasTooManyStrikes := c.Strikes >= p.StrikesToDisableExecution + hasEnoughDeposits := c.Deposit.IsGTE(p.MinDeposit) + hasExecutionType := c.ExecutionType == ExecutionType_BEGIN_AND_END_BLOCK || c.ExecutionType == executionType + + return hasTooManyStrikes && hasEnoughDeposits && hasExecutionType +} + +// Check if the contract has enough strikes to disable execution +// based on the params of the module +func (c *Contract) HasEnoughStrikesToDisableExecution(strikesToDisabeExecution int64) bool { + return c.Strikes >= strikesToDisabeExecution +} diff --git a/x/cosmwasmlifecycle/types/contract.pb.go b/x/cosmwasmlifecycle/types/contract.pb.go new file mode 100644 index 0000000..be48e65 --- /dev/null +++ b/x/cosmwasmlifecycle/types/contract.pb.go @@ -0,0 +1,397 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmwasmlifecycle/contract.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Contract defines the parameters for the module. +type Contract struct { + // Amount of strikes that the contract has at the moment. + Strikes int64 `protobuf:"varint,1,opt,name=strikes,proto3" json:"strikes,omitempty"` + // Contract's execution type + ExecutionType ExecutionType `protobuf:"varint,2,opt,name=execution_type,json=executionType,proto3,enum=cosmwasmlifecycle.ExecutionType" json:"execution_type,omitempty"` + // Collateral deposited to the contract. + Deposit github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,3,opt,name=deposit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"deposit"` +} + +func (m *Contract) Reset() { *m = Contract{} } +func (m *Contract) String() string { return proto.CompactTextString(m) } +func (*Contract) ProtoMessage() {} +func (*Contract) Descriptor() ([]byte, []int) { + return fileDescriptor_59daeaab22a14127, []int{0} +} +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) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + 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) +} + +var xxx_messageInfo_Contract proto.InternalMessageInfo + +func (m *Contract) GetStrikes() int64 { + if m != nil { + return m.Strikes + } + return 0 +} + +func (m *Contract) GetExecutionType() ExecutionType { + if m != nil { + return m.ExecutionType + } + return ExecutionType_BEGIN_AND_END_BLOCK +} + +func init() { + proto.RegisterType((*Contract)(nil), "cosmwasmlifecycle.Contract") +} + +func init() { proto.RegisterFile("cosmwasmlifecycle/contract.proto", fileDescriptor_59daeaab22a14127) } + +var fileDescriptor_59daeaab22a14127 = []byte{ + // 311 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x50, 0xc1, 0x4e, 0xc2, 0x40, + 0x14, 0xec, 0x4a, 0x22, 0xa6, 0x46, 0x12, 0x1b, 0x0f, 0x85, 0xc3, 0xd2, 0x78, 0x50, 0x2e, 0xec, + 0x06, 0xbc, 0xe8, 0xcd, 0x40, 0x8c, 0x77, 0xe2, 0x89, 0x0b, 0x69, 0xb7, 0x4f, 0xdc, 0x40, 0xfb, + 0x1a, 0x76, 0x41, 0xf8, 0x0b, 0x3f, 0x8b, 0x23, 0x89, 0x17, 0xe3, 0x81, 0x18, 0xfa, 0x23, 0xa6, + 0xed, 0x36, 0x62, 0x7a, 0xda, 0x9d, 0xcc, 0xbc, 0xf7, 0x66, 0xc6, 0xf6, 0x04, 0xaa, 0xe8, 0xdd, + 0x57, 0xd1, 0x5c, 0xbe, 0x82, 0xd8, 0x88, 0x39, 0x70, 0x81, 0xb1, 0x5e, 0xf8, 0x42, 0xb3, 0x64, + 0x81, 0x1a, 0x9d, 0xcb, 0x8a, 0xa2, 0x75, 0x35, 0xc5, 0x29, 0xe6, 0x2c, 0xcf, 0x7e, 0x85, 0xb0, + 0xd5, 0xcc, 0x84, 0xa8, 0x26, 0x05, 0x51, 0x00, 0x43, 0xd1, 0x02, 0xf1, 0xc0, 0x57, 0xc0, 0x57, + 0xbd, 0x00, 0xb4, 0xdf, 0xe3, 0x02, 0x65, 0x6c, 0xf8, 0x9b, 0xaa, 0x0b, 0x58, 0x83, 0x58, 0x6a, + 0x89, 0xf1, 0x44, 0x6f, 0x12, 0x28, 0x74, 0xd7, 0x9f, 0xc4, 0x3e, 0x1b, 0x1a, 0x7b, 0x8e, 0x6b, + 0xd7, 0x95, 0x5e, 0xc8, 0x19, 0x28, 0x97, 0x78, 0xa4, 0x53, 0x1b, 0x95, 0xd0, 0x79, 0xb6, 0x1b, + 0xff, 0xc7, 0xdd, 0x13, 0x8f, 0x74, 0x1a, 0x7d, 0x8f, 0x55, 0xee, 0xb0, 0xa7, 0x52, 0xf8, 0xb2, + 0x49, 0x60, 0x74, 0x01, 0xc7, 0xd0, 0x09, 0xed, 0x7a, 0x08, 0x09, 0x2a, 0xa9, 0xdd, 0x9a, 0x47, + 0x3a, 0xe7, 0xfd, 0x26, 0x33, 0xb9, 0xb2, 0x24, 0xcc, 0x24, 0x61, 0x43, 0x94, 0xf1, 0x80, 0x6f, + 0xf7, 0x6d, 0xeb, 0x7b, 0xdf, 0xbe, 0x9d, 0x4a, 0xfd, 0xb6, 0x0c, 0x98, 0xc0, 0xc8, 0x94, 0x60, + 0x9e, 0xae, 0x0a, 0x67, 0x3c, 0x73, 0xa3, 0xf2, 0x81, 0x51, 0xb9, 0x7a, 0x30, 0xde, 0x1e, 0x28, + 0xd9, 0x1d, 0x28, 0xf9, 0x39, 0x50, 0xf2, 0x91, 0x52, 0x6b, 0x97, 0x52, 0xeb, 0x2b, 0xa5, 0xd6, + 0xf8, 0xf1, 0x68, 0x17, 0x44, 0x32, 0x84, 0xd5, 0xc3, 0x3d, 0x2f, 0x33, 0x74, 0xff, 0xca, 0x5a, + 0xf3, 0x6a, 0x81, 0xf9, 0xa5, 0xe0, 0x34, 0x2f, 0xee, 0xee, 0x37, 0x00, 0x00, 0xff, 0xff, 0xba, + 0xec, 0x75, 0x06, 0xe8, 0x01, 0x00, 0x00, +} + +func (m *Contract) 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 *Contract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Contract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Deposit.Size() + i -= size + if _, err := m.Deposit.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintContract(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.ExecutionType != 0 { + i = encodeVarintContract(dAtA, i, uint64(m.ExecutionType)) + i-- + dAtA[i] = 0x10 + } + if m.Strikes != 0 { + i = encodeVarintContract(dAtA, i, uint64(m.Strikes)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintContract(dAtA []byte, offset int, v uint64) int { + offset -= sovContract(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Contract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Strikes != 0 { + n += 1 + sovContract(uint64(m.Strikes)) + } + if m.ExecutionType != 0 { + n += 1 + sovContract(uint64(m.ExecutionType)) + } + l = m.Deposit.Size() + n += 1 + l + sovContract(uint64(l)) + return n +} + +func sovContract(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozContract(x uint64) (n int) { + return sovContract(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Contract) 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 ErrIntOverflowContract + } + 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: Contract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Contract: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Strikes", wireType) + } + m.Strikes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContract + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Strikes |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExecutionType", wireType) + } + m.ExecutionType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContract + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExecutionType |= ExecutionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContract + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContract + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthContract + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContract(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthContract + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipContract(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContract + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContract + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContract + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthContract + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupContract + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthContract + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthContract = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowContract = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupContract = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmwasmlifecycle/types/errors.go b/x/cosmwasmlifecycle/types/errors.go index 64c99dd..7b57a18 100644 --- a/x/cosmwasmlifecycle/types/errors.go +++ b/x/cosmwasmlifecycle/types/errors.go @@ -3,7 +3,7 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "cosmossdk.io/errors" ) // x/cosmwasmlifecycle module sentinel errors diff --git a/x/cosmwasmlifecycle/types/events.pb.go b/x/cosmwasmlifecycle/types/events.pb.go new file mode 100644 index 0000000..72a9a2f --- /dev/null +++ b/x/cosmwasmlifecycle/types/events.pb.go @@ -0,0 +1,682 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmwasmlifecycle/events.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ContractDeleteEvent struct { + ModuleName string `protobuf:"bytes,1,opt,name=module_name,json=moduleName,proto3" json:"module_name,omitempty"` + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` +} + +func (m *ContractDeleteEvent) Reset() { *m = ContractDeleteEvent{} } +func (m *ContractDeleteEvent) String() string { return proto.CompactTextString(m) } +func (*ContractDeleteEvent) ProtoMessage() {} +func (*ContractDeleteEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_3208364976a7e08c, []int{0} +} +func (m *ContractDeleteEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContractDeleteEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ContractDeleteEvent.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 *ContractDeleteEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContractDeleteEvent.Merge(m, src) +} +func (m *ContractDeleteEvent) XXX_Size() int { + return m.Size() +} +func (m *ContractDeleteEvent) XXX_DiscardUnknown() { + xxx_messageInfo_ContractDeleteEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_ContractDeleteEvent proto.InternalMessageInfo + +func (m *ContractDeleteEvent) GetModuleName() string { + if m != nil { + return m.ModuleName + } + return "" +} + +func (m *ContractDeleteEvent) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +type ContractStrikeEvent struct { + ModuleName string `protobuf:"bytes,1,opt,name=module_name,json=moduleName,proto3" json:"module_name,omitempty"` + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + CurrentStrike int64 `protobuf:"varint,3,opt,name=current_strike,json=currentStrike,proto3" json:"current_strike,omitempty"` + StrikeReason string `protobuf:"bytes,4,opt,name=strike_reason,json=strikeReason,proto3" json:"strike_reason,omitempty"` +} + +func (m *ContractStrikeEvent) Reset() { *m = ContractStrikeEvent{} } +func (m *ContractStrikeEvent) String() string { return proto.CompactTextString(m) } +func (*ContractStrikeEvent) ProtoMessage() {} +func (*ContractStrikeEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_3208364976a7e08c, []int{1} +} +func (m *ContractStrikeEvent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ContractStrikeEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ContractStrikeEvent.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 *ContractStrikeEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_ContractStrikeEvent.Merge(m, src) +} +func (m *ContractStrikeEvent) XXX_Size() int { + return m.Size() +} +func (m *ContractStrikeEvent) XXX_DiscardUnknown() { + xxx_messageInfo_ContractStrikeEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_ContractStrikeEvent proto.InternalMessageInfo + +func (m *ContractStrikeEvent) GetModuleName() string { + if m != nil { + return m.ModuleName + } + return "" +} + +func (m *ContractStrikeEvent) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *ContractStrikeEvent) GetCurrentStrike() int64 { + if m != nil { + return m.CurrentStrike + } + return 0 +} + +func (m *ContractStrikeEvent) GetStrikeReason() string { + if m != nil { + return m.StrikeReason + } + return "" +} + +func init() { + proto.RegisterType((*ContractDeleteEvent)(nil), "cosmwasmlifecycle.ContractDeleteEvent") + proto.RegisterType((*ContractStrikeEvent)(nil), "cosmwasmlifecycle.ContractStrikeEvent") +} + +func init() { proto.RegisterFile("cosmwasmlifecycle/events.proto", fileDescriptor_3208364976a7e08c) } + +var fileDescriptor_3208364976a7e08c = []byte{ + // 296 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x91, 0xbf, 0x4e, 0xc3, 0x30, + 0x18, 0xc4, 0x63, 0x8a, 0x90, 0x30, 0x94, 0x3f, 0x81, 0x21, 0x30, 0x98, 0xaa, 0x08, 0xa9, 0x4b, + 0x9b, 0x81, 0x05, 0x36, 0x68, 0x61, 0x65, 0x08, 0x5b, 0x97, 0xc8, 0x75, 0x3e, 0x4a, 0x44, 0x6c, + 0x57, 0xb6, 0x53, 0xa8, 0x78, 0x09, 0x1e, 0x86, 0x77, 0x80, 0xb1, 0x62, 0x62, 0x44, 0xc9, 0x8b, + 0xa0, 0xd8, 0xa9, 0x3a, 0x74, 0xef, 0xe8, 0xdf, 0xdd, 0xe7, 0x3b, 0xe9, 0x30, 0x61, 0x52, 0xf3, + 0x57, 0xaa, 0x79, 0x96, 0x3e, 0x01, 0x9b, 0xb1, 0x0c, 0x42, 0x98, 0x82, 0x30, 0xba, 0x37, 0x51, + 0xd2, 0x48, 0xff, 0x70, 0x45, 0x3f, 0x3d, 0xa9, 0x90, 0xd4, 0xb1, 0x35, 0x84, 0xee, 0xe1, 0xdc, + 0xed, 0x77, 0x7c, 0x34, 0x90, 0xc2, 0x28, 0xca, 0xcc, 0x1d, 0x64, 0x60, 0xe0, 0xbe, 0xfa, 0xcb, + 0x3f, 0xc3, 0x3b, 0x5c, 0x26, 0x79, 0x06, 0xb1, 0xa0, 0x1c, 0x02, 0xd4, 0x42, 0x9d, 0xed, 0x08, + 0x3b, 0xf4, 0x40, 0x39, 0xf8, 0x03, 0x7c, 0xc0, 0xea, 0xbb, 0x98, 0x26, 0x89, 0x02, 0xad, 0x83, + 0x8d, 0xca, 0xd5, 0x0f, 0x7e, 0x3e, 0xbb, 0xc7, 0x75, 0xc6, 0xad, 0x53, 0x1e, 0x8d, 0x4a, 0xc5, + 0x38, 0xda, 0x5f, 0x5c, 0xd4, 0xb8, 0xfd, 0x85, 0x96, 0xe9, 0x95, 0xe7, 0x65, 0x9d, 0xe9, 0xfe, + 0x05, 0xde, 0x63, 0xb9, 0x52, 0x20, 0x4c, 0xac, 0x6d, 0x78, 0xd0, 0x68, 0xa1, 0x4e, 0x23, 0x6a, + 0xd6, 0xd4, 0x35, 0xf2, 0xcf, 0x71, 0xd3, 0xc9, 0xb1, 0x02, 0xaa, 0xa5, 0x08, 0x36, 0x6d, 0x9d, + 0x5d, 0x07, 0x23, 0xcb, 0xfa, 0xc3, 0xef, 0x82, 0xa0, 0x79, 0x41, 0xd0, 0x5f, 0x41, 0xd0, 0x47, + 0x49, 0xbc, 0x79, 0x49, 0xbc, 0xdf, 0x92, 0x78, 0xc3, 0x9b, 0x71, 0x6a, 0x9e, 0xf3, 0x51, 0x8f, + 0x49, 0x1e, 0x02, 0x4f, 0x13, 0x98, 0x5e, 0x5f, 0x85, 0x8b, 0x89, 0xba, 0xcb, 0x0d, 0xdf, 0xc2, + 0xd5, 0x5d, 0xcd, 0x6c, 0x02, 0x7a, 0xb4, 0x65, 0x97, 0xba, 0xfc, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0x08, 0xb1, 0xb8, 0x52, 0xf9, 0x01, 0x00, 0x00, +} + +func (m *ContractDeleteEvent) 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 *ContractDeleteEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractDeleteEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.ModuleName) > 0 { + i -= len(m.ModuleName) + copy(dAtA[i:], m.ModuleName) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ModuleName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ContractStrikeEvent) 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 *ContractStrikeEvent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ContractStrikeEvent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.StrikeReason) > 0 { + i -= len(m.StrikeReason) + copy(dAtA[i:], m.StrikeReason) + i = encodeVarintEvents(dAtA, i, uint64(len(m.StrikeReason))) + i-- + dAtA[i] = 0x22 + } + if m.CurrentStrike != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.CurrentStrike)) + i-- + dAtA[i] = 0x18 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.ModuleName) > 0 { + i -= len(m.ModuleName) + copy(dAtA[i:], m.ModuleName) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ModuleName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ContractDeleteEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ModuleName) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *ContractStrikeEvent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ModuleName) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.CurrentStrike != 0 { + n += 1 + sovEvents(uint64(m.CurrentStrike)) + } + l = len(m.StrikeReason) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ContractDeleteEvent) 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 ErrIntOverflowEvents + } + 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: ContractDeleteEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContractDeleteEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModuleName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContractStrikeEvent) 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 ErrIntOverflowEvents + } + 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: ContractStrikeEvent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContractStrikeEvent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModuleName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurrentStrike", wireType) + } + m.CurrentStrike = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurrentStrike |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StrikeReason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + 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 ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StrikeReason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmwasmlifecycle/types/execution_type.pb.go b/x/cosmwasmlifecycle/types/execution_type.pb.go new file mode 100644 index 0000000..9039804 --- /dev/null +++ b/x/cosmwasmlifecycle/types/execution_type.pb.go @@ -0,0 +1,73 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: cosmwasmlifecycle/execution_type.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ExecutionType int32 + +const ( + ExecutionType_BEGIN_AND_END_BLOCK ExecutionType = 0 + ExecutionType_BEGIN_BLOCK ExecutionType = 1 + ExecutionType_END_BLOCK ExecutionType = 2 +) + +var ExecutionType_name = map[int32]string{ + 0: "BEGIN_AND_END_BLOCK", + 1: "BEGIN_BLOCK", + 2: "END_BLOCK", +} + +var ExecutionType_value = map[string]int32{ + "BEGIN_AND_END_BLOCK": 0, + "BEGIN_BLOCK": 1, + "END_BLOCK": 2, +} + +func (x ExecutionType) String() string { + return proto.EnumName(ExecutionType_name, int32(x)) +} + +func (ExecutionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_3845c7938ab27315, []int{0} +} + +func init() { + proto.RegisterEnum("cosmwasmlifecycle.ExecutionType", ExecutionType_name, ExecutionType_value) +} + +func init() { + proto.RegisterFile("cosmwasmlifecycle/execution_type.proto", fileDescriptor_3845c7938ab27315) +} + +var fileDescriptor_3845c7938ab27315 = []byte{ + // 188 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0xce, 0x2f, 0xce, + 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0xad, + 0x48, 0x4d, 0x2e, 0x2d, 0xc9, 0xcc, 0xcf, 0x8b, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x12, 0xc4, 0x50, 0xa7, 0xe5, 0xc1, 0xc5, 0xeb, 0x0a, 0x53, 0x1a, 0x52, 0x59, + 0x90, 0x2a, 0x24, 0xce, 0x25, 0xec, 0xe4, 0xea, 0xee, 0xe9, 0x17, 0xef, 0xe8, 0xe7, 0x12, 0xef, + 0xea, 0xe7, 0x12, 0xef, 0xe4, 0xe3, 0xef, 0xec, 0x2d, 0xc0, 0x20, 0xc4, 0xcf, 0xc5, 0x0d, 0x91, + 0x80, 0x08, 0x30, 0x0a, 0xf1, 0x72, 0x71, 0x22, 0xe4, 0x99, 0x9c, 0xa2, 0x4e, 0x3c, 0x92, 0x63, + 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, + 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x21, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, + 0x3f, 0x57, 0x3f, 0x35, 0x37, 0x33, 0x25, 0xb5, 0xcc, 0xd2, 0x42, 0x1f, 0xe6, 0x14, 0x5d, 0x84, + 0x9b, 0x2b, 0xf4, 0x31, 0xfd, 0x01, 0x72, 0x7d, 0x71, 0x12, 0x1b, 0xd8, 0xfd, 0xc6, 0x80, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x12, 0xe9, 0xcb, 0x19, 0xe9, 0x00, 0x00, 0x00, +} diff --git a/x/cosmwasmlifecycle/types/expected_keepers.go b/x/cosmwasmlifecycle/types/expected_keepers.go index 6aa6e97..693d624 100644 --- a/x/cosmwasmlifecycle/types/expected_keepers.go +++ b/x/cosmwasmlifecycle/types/expected_keepers.go @@ -2,17 +2,22 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) -// AccountKeeper defines the expected account keeper used for simulations (noalias) -type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI - // Methods imported from account should be defined here +type WasmKeeper interface { + // Sudo allows privileged access to a contract. This can never be called by an external tx, but only by + // another native Go module directly, or on-chain governance (if sudo proposals are enabled). Thus, the keeper doesn't + // place any access controls on it, that is the responsibility or the app developer (who passes the wasm.Keeper in app.go) + // + // Sub-messages returned from the sudo call to the contract are executed with the default authorization policy. This can be + // customized though by passing a new policy with the context. See types.WithSubMsgAuthzPolicy. + // The policy will be read in msgServer.selectAuthorizationPolicy and used for sub-message executions. + // This is an extension point for some very advanced scenarios only. Use with care! + Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) } -// BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - // Methods imported from bank should be defined here + // BurnCoins burns coins deletes coins from the balance of the module account. + // It will panic if the module account does not exist or is unauthorized. + BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) error } diff --git a/x/cosmwasmlifecycle/types/genesis.pb.go b/x/cosmwasmlifecycle/types/genesis.pb.go index b102c43..41c2258 100644 --- a/x/cosmwasmlifecycle/types/genesis.pb.go +++ b/x/cosmwasmlifecycle/types/genesis.pb.go @@ -1,10 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmwasmlifecycle/cosmwasmlifecycle/genesis.proto +// source: cosmwasmlifecycle/genesis.proto package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -26,13 +27,16 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the cosmwasmlifecycle module's genesis state. type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + // Contracts with their current information + // about the execution state. + Contracts []*Contract `protobuf:"bytes,2,rep,name=contracts,proto3" json:"contracts,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_288528e115c59bfa, []int{0} + return fileDescriptor_b4e03ab585a90b99, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -68,29 +72,38 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func init() { - proto.RegisterType((*GenesisState)(nil), "cosmwasmlifecycle.cosmwasmlifecycle.GenesisState") +func (m *GenesisState) GetContracts() []*Contract { + if m != nil { + return m.Contracts + } + return nil } func init() { - proto.RegisterFile("cosmwasmlifecycle/cosmwasmlifecycle/genesis.proto", fileDescriptor_288528e115c59bfa) + proto.RegisterType((*GenesisState)(nil), "cosmwasmlifecycle.GenesisState") } -var fileDescriptor_288528e115c59bfa = []byte{ - // 201 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x4c, 0xce, 0x2f, 0xce, - 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0xc7, 0x14, - 0x49, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0xc6, - 0x50, 0xa0, 0x87, 0x21, 0x22, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xaf, 0x0f, 0x62, 0x41, - 0xb4, 0x4a, 0x19, 0x10, 0x63, 0x5b, 0x41, 0x62, 0x51, 0x62, 0x2e, 0xd4, 0x32, 0xa5, 0x48, 0x2e, - 0x1e, 0x77, 0x88, 0xed, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0x9e, 0x5c, 0x6c, 0x10, 0x79, 0x09, - 0x46, 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x6d, 0x3d, 0x22, 0x5c, 0xa3, 0x17, 0x00, 0xd6, 0xe2, 0xc4, - 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0xd4, 0x00, 0xa7, 0xa8, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, - 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, - 0x3c, 0x96, 0x63, 0x88, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0x4f, 0xcd, 0xcd, 0x4c, 0x49, 0x2d, 0xb3, 0xb4, 0x80, 0x3b, 0x54, 0x17, 0xe1, 0xd2, 0x0a, 0x2c, - 0xae, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xde, 0x18, 0x10, 0x00, 0x00, 0xff, - 0xff, 0x59, 0xb7, 0x87, 0xd7, 0x5f, 0x01, 0x00, 0x00, +func init() { proto.RegisterFile("cosmwasmlifecycle/genesis.proto", fileDescriptor_b4e03ab585a90b99) } + +var fileDescriptor_b4e03ab585a90b99 = []byte{ + // 268 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0x2f, 0xce, + 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0x4f, 0x4f, + 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc4, 0x50, 0x20, + 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x96, 0xd5, 0x07, 0xb1, 0x20, 0x0a, 0xa5, 0x24, 0x41, 0x0a, + 0xf3, 0x8b, 0xe3, 0x21, 0x12, 0x10, 0x0e, 0x54, 0x4a, 0x0e, 0xd3, 0x92, 0x82, 0xc4, 0xa2, 0xc4, + 0x5c, 0x98, 0xbc, 0x02, 0xa6, 0x7c, 0x72, 0x7e, 0x5e, 0x49, 0x51, 0x62, 0x72, 0x09, 0x44, 0x85, + 0xd2, 0x1c, 0x46, 0x2e, 0x1e, 0x77, 0x88, 0xbb, 0x82, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0xcc, 0xb9, + 0xd8, 0x20, 0x46, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xea, 0x61, 0x98, 0xa1, 0x17, + 0x00, 0x56, 0xe0, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x54, 0xb9, 0x50, 0x30, 0x17, 0x27, + 0xcc, 0xec, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x69, 0x2c, 0x7a, 0x9d, 0xa1, 0x6a, + 0x9c, 0x24, 0x2e, 0x6d, 0xd1, 0x15, 0x81, 0xfa, 0xc6, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x38, + 0xb8, 0xa4, 0x28, 0x33, 0x2f, 0x3d, 0x08, 0x61, 0x8e, 0x53, 0xd4, 0x89, 0x47, 0x72, 0x8c, 0x17, + 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, + 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x39, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, + 0xea, 0xa7, 0xe6, 0x66, 0xa6, 0xa4, 0x96, 0x59, 0x5a, 0xe8, 0xc3, 0xac, 0xd3, 0x45, 0xf8, 0xb7, + 0x42, 0x1f, 0x33, 0x0c, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x21, 0x60, 0x0c, 0x08, + 0x00, 0x00, 0xff, 0xff, 0x87, 0xd0, 0xbc, 0xe4, 0xaa, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -113,6 +126,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Contracts) > 0 { + for iNdEx := len(m.Contracts) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Contracts[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } { size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -145,6 +172,12 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) + if len(m.Contracts) > 0 { + for _, e := range m.Contracts { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -216,6 +249,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contracts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contracts = append(m.Contracts, &Contract{}) + if err := m.Contracts[len(m.Contracts)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/cosmwasmlifecycle/types/keys.go b/x/cosmwasmlifecycle/types/keys.go index d628739..bd6bc50 100644 --- a/x/cosmwasmlifecycle/types/keys.go +++ b/x/cosmwasmlifecycle/types/keys.go @@ -1,5 +1,10 @@ package types +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" +) + const ( // ModuleName defines the module name ModuleName = "cosmwasmlifecycle" @@ -14,6 +19,16 @@ const ( MemStoreKey = "mem_cosmwasmlifecycle" ) +var ( + ParamKey = []byte{0x01} + ContractKey = []byte{0x02} +) + func KeyPrefix(p string) []byte { return []byte(p) } + +// GetContractKeyByAddress returns the key for the contract +func GetContractKeyByAddress(contractAddr sdk.AccAddress) []byte { + return append(ContractKey, address.MustLengthPrefix(contractAddr)...) +} diff --git a/x/cosmwasmlifecycle/types/params.pb.go b/x/cosmwasmlifecycle/types/params.pb.go index 40fda08..f718f28 100644 --- a/x/cosmwasmlifecycle/types/params.pb.go +++ b/x/cosmwasmlifecycle/types/params.pb.go @@ -1,10 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmwasmlifecycle/cosmwasmlifecycle/params.proto +// source: cosmwasmlifecycle/params.proto package types import ( fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -25,12 +27,22 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. type Params struct { + // Enable or disable executions + // at the begin and end of the block + IsEnabled bool `protobuf:"varint,1,opt,name=is_enabled,json=isEnabled,proto3" json:"is_enabled,omitempty"` + // Minimum deposit to enable contract execution at begin block and/or end block + // This deposit will be burned if the contract execution reaches the max strikes. + MinDeposit github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,2,opt,name=min_deposit,json=minDeposit,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"min_deposit"` + // Amount of strikes that the contract can hold before being + // disabled from end and beging block executions. + // When this happens the min_desposit will also be burned. + StrikesToDisableExecution int64 `protobuf:"varint,3,opt,name=strikes_to_disable_execution,json=strikesToDisableExecution,proto3" json:"strikes_to_disable_execution,omitempty"` } func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_2d7bfad4338a9a5f, []int{0} + return fileDescriptor_d96aa1bf4f8b3eba, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -59,26 +71,49 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func init() { - proto.RegisterType((*Params)(nil), "cosmwasmlifecycle.cosmwasmlifecycle.Params") +func (m *Params) GetIsEnabled() bool { + if m != nil { + return m.IsEnabled + } + return false +} + +func (m *Params) GetStrikesToDisableExecution() int64 { + if m != nil { + return m.StrikesToDisableExecution + } + return 0 } func init() { - proto.RegisterFile("cosmwasmlifecycle/cosmwasmlifecycle/params.proto", fileDescriptor_2d7bfad4338a9a5f) + proto.RegisterType((*Params)(nil), "cosmwasmlifecycle.Params") } -var fileDescriptor_2d7bfad4338a9a5f = []byte{ - // 159 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xce, 0x2f, 0xce, - 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0xc7, 0x14, - 0x29, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0xc6, 0x90, - 0xd7, 0xc3, 0x10, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd7, 0x07, 0xb1, 0x20, 0x5a, - 0x95, 0xf8, 0xb8, 0xd8, 0x02, 0xc0, 0x46, 0x59, 0xb1, 0xcc, 0x58, 0x20, 0xcf, 0xe0, 0x14, 0x75, - 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, - 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x0e, 0xe9, 0x99, 0x25, 0x19, 0xa5, - 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xa9, 0xb9, 0x99, 0x29, 0xa9, 0x65, 0x96, 0x16, 0x70, 0x87, - 0xe9, 0x22, 0x5c, 0x56, 0x81, 0xc5, 0xb5, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x2b, - 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x3d, 0x4c, 0xdd, 0xe1, 0x00, 0x00, 0x00, +func init() { proto.RegisterFile("cosmwasmlifecycle/params.proto", fileDescriptor_d96aa1bf4f8b3eba) } + +var fileDescriptor_d96aa1bf4f8b3eba = []byte{ + // 321 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xbf, 0x4e, 0x32, 0x41, + 0x14, 0xc5, 0x77, 0x3e, 0xbe, 0x10, 0x1d, 0x2a, 0x37, 0x16, 0x40, 0x74, 0x20, 0x36, 0xd2, 0xb0, + 0x13, 0xb4, 0x51, 0x1b, 0x0d, 0x42, 0x6f, 0x88, 0x15, 0xcd, 0x66, 0xff, 0x8c, 0x78, 0x03, 0xb3, + 0x77, 0xc3, 0x1d, 0x10, 0xde, 0xc2, 0xd2, 0xd2, 0xc7, 0xa1, 0xa4, 0x34, 0x9a, 0x10, 0x03, 0x2f, + 0x62, 0xd8, 0x59, 0xa2, 0x09, 0xd5, 0x4c, 0xee, 0x39, 0xf7, 0x97, 0x93, 0x73, 0xb9, 0x88, 0x90, + 0xf4, 0x4b, 0x40, 0x7a, 0x04, 0x4f, 0x2a, 0x9a, 0x47, 0x23, 0x25, 0xd3, 0x60, 0x1c, 0x68, 0xf2, + 0xd2, 0x31, 0x1a, 0x74, 0x8f, 0xf6, 0xf4, 0xea, 0xf1, 0x00, 0x07, 0x98, 0xa9, 0x72, 0xfb, 0xb3, + 0xc6, 0x6a, 0x06, 0x42, 0x92, 0x61, 0x40, 0x4a, 0x4e, 0x5b, 0xa1, 0x32, 0x41, 0x4b, 0x46, 0x08, + 0x89, 0xd5, 0xcf, 0xbe, 0x18, 0x2f, 0x3e, 0x64, 0x64, 0xf7, 0x94, 0x73, 0x20, 0x5f, 0x25, 0x41, + 0x38, 0x52, 0x71, 0x99, 0xd5, 0x59, 0xe3, 0xa0, 0x77, 0x08, 0xd4, 0xb5, 0x03, 0x77, 0xc8, 0x4b, + 0x1a, 0x12, 0x3f, 0x56, 0x29, 0x12, 0x98, 0xf2, 0xbf, 0x3a, 0x6b, 0x94, 0x2e, 0x2a, 0x9e, 0xe5, + 0x7b, 0x5b, 0xbe, 0x97, 0xf3, 0xbd, 0x7b, 0x84, 0xa4, 0x2d, 0x17, 0xab, 0x9a, 0xf3, 0xb9, 0xaa, + 0x9d, 0x0f, 0xc0, 0x3c, 0x4f, 0x42, 0x2f, 0x42, 0x2d, 0xf3, 0x30, 0xf6, 0x69, 0x52, 0x3c, 0x94, + 0x66, 0x9e, 0x2a, 0xca, 0x16, 0x7a, 0x5c, 0x43, 0xd2, 0xb1, 0x74, 0xf7, 0x96, 0x9f, 0x90, 0x19, + 0xc3, 0x50, 0x91, 0x6f, 0xd0, 0x8f, 0x81, 0xb6, 0x19, 0x7c, 0x35, 0x53, 0xd1, 0xc4, 0x00, 0x26, + 0xe5, 0x42, 0x9d, 0x35, 0x0a, 0xbd, 0x4a, 0xee, 0x79, 0xc4, 0x8e, 0x75, 0x74, 0x77, 0x86, 0x9b, + 0xff, 0x6f, 0xef, 0x35, 0xa7, 0xdd, 0x5f, 0xac, 0x05, 0x5b, 0xae, 0x05, 0xfb, 0x5e, 0x0b, 0xf6, + 0xba, 0x11, 0xce, 0x72, 0x23, 0x9c, 0x8f, 0x8d, 0x70, 0xfa, 0x77, 0x7f, 0x52, 0x29, 0x0d, 0xb1, + 0x9a, 0x5e, 0x5f, 0xc9, 0x5d, 0xa9, 0xcd, 0xdf, 0xd6, 0x67, 0x72, 0xff, 0x12, 0x59, 0xe6, 0xb0, + 0x98, 0x15, 0x78, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff, 0x77, 0x33, 0x57, 0x6e, 0xab, 0x01, 0x00, + 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -101,6 +136,31 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.StrikesToDisableExecution != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.StrikesToDisableExecution)) + i-- + dAtA[i] = 0x18 + } + { + size := m.MinDeposit.Size() + i -= size + if _, err := m.MinDeposit.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.IsEnabled { + i-- + if m.IsEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } return len(dAtA) - i, nil } @@ -121,6 +181,14 @@ func (m *Params) Size() (n int) { } var l int _ = l + if m.IsEnabled { + n += 2 + } + l = m.MinDeposit.Size() + n += 1 + l + sovParams(uint64(l)) + if m.StrikesToDisableExecution != 0 { + n += 1 + sovParams(uint64(m.StrikesToDisableExecution)) + } return n } @@ -159,6 +227,78 @@ func (m *Params) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsEnabled = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StrikesToDisableExecution", wireType) + } + m.StrikesToDisableExecution = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StrikesToDisableExecution |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/cosmwasmlifecycle/types/query.pb.go b/x/cosmwasmlifecycle/types/query.pb.go index ae857b5..370b0d6 100644 --- a/x/cosmwasmlifecycle/types/query.pb.go +++ b/x/cosmwasmlifecycle/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmwasmlifecycle/cosmwasmlifecycle/query.proto +// source: cosmwasmlifecycle/query.proto package types @@ -38,7 +38,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_91327fb6dc4b6ffb, []int{0} + return fileDescriptor_cd5a0233d17791d5, []int{0} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -77,7 +77,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_91327fb6dc4b6ffb, []int{1} + return fileDescriptor_cd5a0233d17791d5, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -114,36 +114,33 @@ func (m *QueryParamsResponse) GetParams() Params { } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "cosmwasmlifecycle.cosmwasmlifecycle.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "cosmwasmlifecycle.cosmwasmlifecycle.QueryParamsResponse") -} - -func init() { - proto.RegisterFile("cosmwasmlifecycle/cosmwasmlifecycle/query.proto", fileDescriptor_91327fb6dc4b6ffb) -} - -var fileDescriptor_91327fb6dc4b6ffb = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4f, 0xce, 0x2f, 0xce, - 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xc5, 0x22, 0x52, - 0x58, 0x9a, 0x5a, 0x54, 0xa9, 0x57, 0x50, 0x94, 0x5f, 0x92, 0x2f, 0xa4, 0x8c, 0x21, 0xad, 0x87, - 0x21, 0x22, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xaf, 0x0f, 0x62, 0x41, 0xb4, 0x4a, 0xc9, - 0xa4, 0xe7, 0xe7, 0xa7, 0xe7, 0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, - 0x24, 0x96, 0x64, 0xe6, 0xe7, 0x15, 0x43, 0x65, 0xb5, 0x40, 0xc6, 0xe4, 0x17, 0xeb, 0x27, 0x25, - 0x16, 0x43, 0x6d, 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x4c, 0xcf, - 0xcc, 0x03, 0x2b, 0x86, 0xaa, 0x35, 0x20, 0xc6, 0xd5, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0xd3, - 0x95, 0x44, 0xb8, 0x84, 0x02, 0x41, 0x66, 0x06, 0x80, 0x05, 0x83, 0x52, 0x0b, 0x4b, 0x53, 0x8b, - 0x4b, 0x94, 0x12, 0xb8, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0x3c, 0xb9, - 0xd8, 0x20, 0x9a, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xb4, 0xf5, 0x88, 0xf0, 0xb4, 0x1e, - 0xc4, 0x10, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x06, 0x18, 0x1d, 0x61, 0xe4, 0x62, - 0x05, 0x5b, 0x21, 0xb4, 0x8b, 0x91, 0x8b, 0x0d, 0xa2, 0x44, 0xc8, 0x9c, 0x28, 0xf3, 0x30, 0xdd, - 0x2b, 0x65, 0x41, 0xba, 0x46, 0x88, 0x97, 0x94, 0x6c, 0x9b, 0x2e, 0x3f, 0x99, 0xcc, 0x64, 0x2e, - 0x64, 0xaa, 0x9f, 0x9a, 0x9b, 0x99, 0x92, 0x5a, 0x66, 0x69, 0x01, 0x0f, 0x31, 0x5d, 0xc2, 0x81, - 0xe8, 0x14, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x0e, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0x78, 0x8d, 0xae, 0xc0, 0x62, 0x78, 0x49, 0x65, - 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x86, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x37, - 0xb9, 0xbc, 0x8b, 0x02, 0x00, 0x00, + proto.RegisterType((*QueryParamsRequest)(nil), "cosmwasmlifecycle.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "cosmwasmlifecycle.QueryParamsResponse") +} + +func init() { proto.RegisterFile("cosmwasmlifecycle/query.proto", fileDescriptor_cd5a0233d17791d5) } + +var fileDescriptor_cd5a0233d17791d5 = []byte{ + // 303 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0xce, 0x2f, 0xce, + 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0x2c, + 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc4, 0x90, 0x96, 0x12, 0x49, + 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xea, 0x83, 0x58, 0x10, 0x85, 0x52, 0x32, 0xe9, 0xf9, 0xf9, 0xe9, + 0x39, 0xa9, 0xfa, 0x89, 0x05, 0x99, 0xfa, 0x89, 0x79, 0x79, 0xf9, 0x25, 0x89, 0x25, 0x99, 0xf9, + 0x79, 0xc5, 0x50, 0x59, 0x2d, 0x90, 0x31, 0xf9, 0xc5, 0xfa, 0x49, 0x89, 0xc5, 0x50, 0xf3, 0xf5, + 0xcb, 0x0c, 0x93, 0x52, 0x4b, 0x12, 0x0d, 0xf5, 0x0b, 0x12, 0xd3, 0x33, 0xf3, 0xc0, 0x8a, 0xa1, + 0x6a, 0xe5, 0x30, 0x5d, 0x54, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x35, 0x4b, 0x49, 0x84, 0x4b, 0x28, + 0x10, 0x64, 0x42, 0x00, 0x58, 0x30, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0xc9, 0x8f, 0x4b, + 0x18, 0x45, 0xb4, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0xc8, 0x9c, 0x8b, 0x0d, 0xa2, 0x59, 0x82, + 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x52, 0x0f, 0xc3, 0x74, 0x3d, 0x88, 0x16, 0x27, 0x96, 0x13, + 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0xca, 0x8d, 0x9a, 0x19, 0xb9, 0x58, 0xc1, 0x06, 0x0a, 0x55, 0x71, + 0xb1, 0x41, 0x54, 0x08, 0xa9, 0x62, 0xd1, 0x8c, 0xe9, 0x14, 0x29, 0x35, 0x42, 0xca, 0x20, 0x6e, + 0x53, 0x52, 0x6c, 0xba, 0xfc, 0x64, 0x32, 0x93, 0xb4, 0x90, 0xa4, 0x3e, 0x2e, 0x1f, 0x3b, 0x45, + 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, + 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x43, 0x7a, 0x66, 0x49, 0x46, + 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x6a, 0x6e, 0x66, 0x4a, 0x6a, 0x99, 0xa5, 0x05, 0xdc, + 0x1c, 0x5d, 0x84, 0x41, 0x15, 0x58, 0x0c, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x07, + 0xa7, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xee, 0x04, 0x5f, 0x34, 0x02, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -172,7 +169,7 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/cosmwasmlifecycle.cosmwasmlifecycle.Query/Params", in, out, opts...) + err := c.cc.Invoke(ctx, "/cosmwasmlifecycle.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -207,7 +204,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/cosmwasmlifecycle.cosmwasmlifecycle.Query/Params", + FullMethod: "/cosmwasmlifecycle.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) @@ -216,7 +213,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmwasmlifecycle.cosmwasmlifecycle.Query", + ServiceName: "cosmwasmlifecycle.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -225,7 +222,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "cosmwasmlifecycle/cosmwasmlifecycle/query.proto", + Metadata: "cosmwasmlifecycle/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { diff --git a/x/cosmwasmlifecycle/types/query.pb.gw.go b/x/cosmwasmlifecycle/types/query.pb.gw.go index eaaf34c..5ee574a 100644 --- a/x/cosmwasmlifecycle/types/query.pb.gw.go +++ b/x/cosmwasmlifecycle/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: cosmwasmlifecycle/cosmwasmlifecycle/query.proto +// source: cosmwasmlifecycle/query.proto /* Package types is a reverse proxy. @@ -145,7 +145,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"emidev98", "cosmwasm-lifecycle", "cosmwasmlifecycle", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"cosmwasmlifecycle", "params"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/x/cosmwasmlifecycle/types/tx.pb.go b/x/cosmwasmlifecycle/types/tx.pb.go index 87af36d..11b7a20 100644 --- a/x/cosmwasmlifecycle/types/tx.pb.go +++ b/x/cosmwasmlifecycle/types/tx.pb.go @@ -1,15 +1,21 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: cosmwasmlifecycle/cosmwasmlifecycle/tx.proto +// source: cosmwasmlifecycle/tx.proto package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" 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. @@ -23,21 +29,275 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgEnableContractBlockExecution struct { + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + Execution ExecutionType `protobuf:"varint,2,opt,name=execution,proto3,enum=cosmwasmlifecycle.ExecutionType" json:"execution,omitempty"` +} + +func (m *MsgEnableContractBlockExecution) Reset() { *m = MsgEnableContractBlockExecution{} } +func (m *MsgEnableContractBlockExecution) String() string { return proto.CompactTextString(m) } +func (*MsgEnableContractBlockExecution) ProtoMessage() {} +func (*MsgEnableContractBlockExecution) Descriptor() ([]byte, []int) { + return fileDescriptor_5a8c9d0c2a02a50a, []int{0} +} +func (m *MsgEnableContractBlockExecution) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableContractBlockExecution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableContractBlockExecution.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 *MsgEnableContractBlockExecution) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableContractBlockExecution.Merge(m, src) +} +func (m *MsgEnableContractBlockExecution) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableContractBlockExecution) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableContractBlockExecution.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableContractBlockExecution proto.InternalMessageInfo + +func (m *MsgEnableContractBlockExecution) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *MsgEnableContractBlockExecution) GetExecution() ExecutionType { + if m != nil { + return m.Execution + } + return ExecutionType_BEGIN_AND_END_BLOCK +} + +type MsgEnableContractBlockExecutionResponse struct { +} + +func (m *MsgEnableContractBlockExecutionResponse) Reset() { + *m = MsgEnableContractBlockExecutionResponse{} +} +func (m *MsgEnableContractBlockExecutionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgEnableContractBlockExecutionResponse) ProtoMessage() {} +func (*MsgEnableContractBlockExecutionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5a8c9d0c2a02a50a, []int{1} +} +func (m *MsgEnableContractBlockExecutionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgEnableContractBlockExecutionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgEnableContractBlockExecutionResponse.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 *MsgEnableContractBlockExecutionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgEnableContractBlockExecutionResponse.Merge(m, src) +} +func (m *MsgEnableContractBlockExecutionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgEnableContractBlockExecutionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgEnableContractBlockExecutionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgEnableContractBlockExecutionResponse proto.InternalMessageInfo + +type MsgDisableContractBlockExecution struct { + ContractAddress string `protobuf:"bytes,1,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"` + Execution ExecutionType `protobuf:"varint,2,opt,name=execution,proto3,enum=cosmwasmlifecycle.ExecutionType" json:"execution,omitempty"` +} + +func (m *MsgDisableContractBlockExecution) Reset() { *m = MsgDisableContractBlockExecution{} } +func (m *MsgDisableContractBlockExecution) String() string { return proto.CompactTextString(m) } +func (*MsgDisableContractBlockExecution) ProtoMessage() {} +func (*MsgDisableContractBlockExecution) Descriptor() ([]byte, []int) { + return fileDescriptor_5a8c9d0c2a02a50a, []int{2} +} +func (m *MsgDisableContractBlockExecution) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableContractBlockExecution) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableContractBlockExecution.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 *MsgDisableContractBlockExecution) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableContractBlockExecution.Merge(m, src) +} +func (m *MsgDisableContractBlockExecution) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableContractBlockExecution) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableContractBlockExecution.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableContractBlockExecution proto.InternalMessageInfo + +func (m *MsgDisableContractBlockExecution) GetContractAddress() string { + if m != nil { + return m.ContractAddress + } + return "" +} + +func (m *MsgDisableContractBlockExecution) GetExecution() ExecutionType { + if m != nil { + return m.Execution + } + return ExecutionType_BEGIN_AND_END_BLOCK +} + +type MsgDisableContractBlockExecutionResponse struct { +} + +func (m *MsgDisableContractBlockExecutionResponse) Reset() { + *m = MsgDisableContractBlockExecutionResponse{} +} +func (m *MsgDisableContractBlockExecutionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDisableContractBlockExecutionResponse) ProtoMessage() {} +func (*MsgDisableContractBlockExecutionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5a8c9d0c2a02a50a, []int{3} +} +func (m *MsgDisableContractBlockExecutionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDisableContractBlockExecutionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDisableContractBlockExecutionResponse.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 *MsgDisableContractBlockExecutionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDisableContractBlockExecutionResponse.Merge(m, src) +} +func (m *MsgDisableContractBlockExecutionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDisableContractBlockExecutionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDisableContractBlockExecutionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDisableContractBlockExecutionResponse proto.InternalMessageInfo + func init() { - proto.RegisterFile("cosmwasmlifecycle/cosmwasmlifecycle/tx.proto", fileDescriptor_a5d49c94eb14ea68) + proto.RegisterType((*MsgEnableContractBlockExecution)(nil), "cosmwasmlifecycle.MsgEnableContractBlockExecution") + proto.RegisterType((*MsgEnableContractBlockExecutionResponse)(nil), "cosmwasmlifecycle.MsgEnableContractBlockExecutionResponse") + proto.RegisterType((*MsgDisableContractBlockExecution)(nil), "cosmwasmlifecycle.MsgDisableContractBlockExecution") + proto.RegisterType((*MsgDisableContractBlockExecutionResponse)(nil), "cosmwasmlifecycle.MsgDisableContractBlockExecutionResponse") } -var fileDescriptor_a5d49c94eb14ea68 = []byte{ - // 135 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x49, 0xce, 0x2f, 0xce, - 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0xc7, 0x14, - 0x29, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0xc6, 0x90, 0xd3, 0xc3, 0x10, 0x31, - 0x62, 0xe5, 0x62, 0xf6, 0x2d, 0x4e, 0x77, 0x8a, 0x3a, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, - 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, - 0x39, 0x86, 0x28, 0x87, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xd4, - 0xdc, 0xcc, 0x94, 0xd4, 0x32, 0x4b, 0x0b, 0xb8, 0xad, 0xba, 0x08, 0x6b, 0x2b, 0xb0, 0x39, 0xa5, - 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x1c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3d, - 0x5b, 0x0f, 0x4c, 0xbe, 0x00, 0x00, 0x00, +func init() { proto.RegisterFile("cosmwasmlifecycle/tx.proto", fileDescriptor_5a8c9d0c2a02a50a) } + +var fileDescriptor_5a8c9d0c2a02a50a = []byte{ + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xce, 0x2f, 0xce, + 0x2d, 0x4f, 0x2c, 0xce, 0xcd, 0xc9, 0x4c, 0x4b, 0x4d, 0xae, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0xa9, + 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc4, 0x90, 0x93, 0x12, 0x49, 0xcf, 0x4f, 0xcf, + 0x07, 0xcb, 0xea, 0x83, 0x58, 0x10, 0x85, 0x52, 0x92, 0x20, 0x85, 0xf9, 0xc5, 0xf1, 0x10, 0x09, + 0x08, 0x07, 0x2a, 0xa5, 0x86, 0x69, 0x7e, 0x6a, 0x45, 0x6a, 0x72, 0x69, 0x49, 0x66, 0x7e, 0x5e, + 0x7c, 0x49, 0x65, 0x41, 0x2a, 0x44, 0x9d, 0xd2, 0x06, 0x46, 0x2e, 0x79, 0xdf, 0xe2, 0x74, 0xd7, + 0xbc, 0xc4, 0xa4, 0x9c, 0x54, 0xe7, 0xfc, 0xbc, 0x92, 0xa2, 0xc4, 0xe4, 0x12, 0xa7, 0x9c, 0xfc, + 0xe4, 0x6c, 0x57, 0x98, 0x72, 0x21, 0x67, 0x2e, 0x81, 0x64, 0xa8, 0x4c, 0x7c, 0x62, 0x4a, 0x4a, + 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, + 0x50, 0x7b, 0x1d, 0x21, 0x32, 0xc1, 0x25, 0x45, 0x99, 0x79, 0xe9, 0x41, 0xfc, 0x30, 0x1d, 0x50, + 0x61, 0x21, 0x3b, 0x2e, 0x4e, 0xb8, 0x03, 0x24, 0x98, 0x14, 0x18, 0x35, 0xf8, 0x8c, 0x14, 0xf4, + 0x30, 0x1c, 0xa9, 0x07, 0xb7, 0x35, 0xa4, 0xb2, 0x20, 0x35, 0x08, 0xa1, 0xc5, 0x8a, 0xa3, 0x63, + 0x81, 0x3c, 0xe3, 0x8b, 0x05, 0xf2, 0x8c, 0x4a, 0x9a, 0x5c, 0xea, 0x04, 0x5c, 0x1c, 0x94, 0x5a, + 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0xaa, 0xb4, 0x91, 0x91, 0x4b, 0xc1, 0xb7, 0x38, 0xdd, 0x25, 0xb3, + 0x78, 0xe8, 0x78, 0x4f, 0x8b, 0x4b, 0x83, 0x90, 0x93, 0x61, 0xfe, 0x33, 0x5a, 0xc5, 0xc4, 0xc5, + 0xec, 0x5b, 0x9c, 0x2e, 0xd4, 0xc7, 0xc8, 0x25, 0x83, 0x37, 0x0a, 0x8d, 0xb0, 0xb8, 0x85, 0x40, + 0x20, 0x4a, 0x59, 0x91, 0xae, 0x07, 0xe6, 0x30, 0xa1, 0x89, 0x8c, 0x5c, 0xb2, 0xf8, 0x43, 0xdd, + 0x18, 0xbb, 0xe9, 0x78, 0x35, 0x49, 0x59, 0x93, 0xa1, 0x09, 0xe6, 0x26, 0xa7, 0xa8, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, + 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcd, 0xcd, 0x4c, 0x49, 0x2d, 0xb3, 0xb4, 0xd0, 0x87, 0xd9, 0xa4, + 0x8b, 0xc8, 0x41, 0x15, 0xfa, 0x58, 0x72, 0x6d, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x37, + 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x98, 0x98, 0x96, 0xd8, 0xd7, 0x03, 0x00, 0x00, +} + +func (this *MsgEnableContractBlockExecution) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgEnableContractBlockExecution) + if !ok { + that2, ok := that.(MsgEnableContractBlockExecution) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ContractAddress != that1.ContractAddress { + return false + } + if this.Execution != that1.Execution { + return false + } + return true +} +func (this *MsgDisableContractBlockExecution) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*MsgDisableContractBlockExecution) + if !ok { + that2, ok := that.(MsgDisableContractBlockExecution) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ContractAddress != that1.ContractAddress { + return false + } + if this.Execution != that1.Execution { + return false + } + return true } // Reference imports to suppress errors if they are not otherwise used. @@ -52,6 +312,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + EnableContractBlockExecution(ctx context.Context, in *MsgEnableContractBlockExecution, opts ...grpc.CallOption) (*MsgEnableContractBlockExecutionResponse, error) + DisableContractBlockExecution(ctx context.Context, in *MsgDisableContractBlockExecution, opts ...grpc.CallOption) (*MsgDisableContractBlockExecutionResponse, error) } type msgClient struct { @@ -62,22 +324,664 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) EnableContractBlockExecution(ctx context.Context, in *MsgEnableContractBlockExecution, opts ...grpc.CallOption) (*MsgEnableContractBlockExecutionResponse, error) { + out := new(MsgEnableContractBlockExecutionResponse) + err := c.cc.Invoke(ctx, "/cosmwasmlifecycle.Msg/EnableContractBlockExecution", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DisableContractBlockExecution(ctx context.Context, in *MsgDisableContractBlockExecution, opts ...grpc.CallOption) (*MsgDisableContractBlockExecutionResponse, error) { + out := new(MsgDisableContractBlockExecutionResponse) + err := c.cc.Invoke(ctx, "/cosmwasmlifecycle.Msg/DisableContractBlockExecution", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + EnableContractBlockExecution(context.Context, *MsgEnableContractBlockExecution) (*MsgEnableContractBlockExecutionResponse, error) + DisableContractBlockExecution(context.Context, *MsgDisableContractBlockExecution) (*MsgDisableContractBlockExecutionResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) EnableContractBlockExecution(ctx context.Context, req *MsgEnableContractBlockExecution) (*MsgEnableContractBlockExecutionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EnableContractBlockExecution not implemented") +} +func (*UnimplementedMsgServer) DisableContractBlockExecution(ctx context.Context, req *MsgDisableContractBlockExecution) (*MsgDisableContractBlockExecutionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DisableContractBlockExecution not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_EnableContractBlockExecution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgEnableContractBlockExecution) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).EnableContractBlockExecution(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasmlifecycle.Msg/EnableContractBlockExecution", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).EnableContractBlockExecution(ctx, req.(*MsgEnableContractBlockExecution)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DisableContractBlockExecution_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDisableContractBlockExecution) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DisableContractBlockExecution(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasmlifecycle.Msg/DisableContractBlockExecution", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DisableContractBlockExecution(ctx, req.(*MsgDisableContractBlockExecution)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "cosmwasmlifecycle.cosmwasmlifecycle.Msg", + ServiceName: "cosmwasmlifecycle.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "cosmwasmlifecycle/cosmwasmlifecycle/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "EnableContractBlockExecution", + Handler: _Msg_EnableContractBlockExecution_Handler, + }, + { + MethodName: "DisableContractBlockExecution", + Handler: _Msg_DisableContractBlockExecution_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "cosmwasmlifecycle/tx.proto", +} + +func (m *MsgEnableContractBlockExecution) 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 *MsgEnableContractBlockExecution) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableContractBlockExecution) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Execution != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Execution)) + i-- + dAtA[i] = 0x10 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgEnableContractBlockExecutionResponse) 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 *MsgEnableContractBlockExecutionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgEnableContractBlockExecutionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDisableContractBlockExecution) 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 *MsgDisableContractBlockExecution) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableContractBlockExecution) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Execution != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Execution)) + i-- + dAtA[i] = 0x10 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgDisableContractBlockExecutionResponse) 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 *MsgDisableContractBlockExecutionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDisableContractBlockExecutionResponse) 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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgEnableContractBlockExecution) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Execution != 0 { + n += 1 + sovTx(uint64(m.Execution)) + } + return n +} + +func (m *MsgEnableContractBlockExecutionResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDisableContractBlockExecution) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Execution != 0 { + n += 1 + sovTx(uint64(m.Execution)) + } + return n +} + +func (m *MsgDisableContractBlockExecutionResponse) 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 *MsgEnableContractBlockExecution) 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: MsgEnableContractBlockExecution: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnableContractBlockExecution: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Execution", wireType) + } + m.Execution = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Execution |= ExecutionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgEnableContractBlockExecutionResponse) 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: MsgEnableContractBlockExecutionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgEnableContractBlockExecutionResponse: 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 (m *MsgDisableContractBlockExecution) 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: MsgDisableContractBlockExecution: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDisableContractBlockExecution: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 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.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Execution", wireType) + } + m.Execution = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Execution |= ExecutionType(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgDisableContractBlockExecutionResponse) 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: MsgDisableContractBlockExecutionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDisableContractBlockExecutionResponse: 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)