diff --git a/app/app.go b/app/app.go index 2163bff..aa5b30b 100644 --- a/app/app.go +++ b/app/app.go @@ -130,7 +130,6 @@ import ( "github.com/dymensionxyz/rollapp-wasm/x/cron" cronkeeper "github.com/dymensionxyz/rollapp-wasm/x/cron/keeper" crontypes "github.com/dymensionxyz/rollapp-wasm/x/cron/types" - // TODO: revisit // "github.com/dymensionxyz/rollapp-wasm/x/gasless" // gaslessclient "github.com/dymensionxyz/rollapp-wasm/x/gasless/client" @@ -601,7 +600,7 @@ func NewRollapp( upgrade.NewAppModule(app.UpgradeKeeper), hubgenesis.NewAppModule(appCodec, app.HubGenesisKeeper, app.AccountKeeper), denommetadata.NewAppModule(app.DenomMetadataKeeper, app.BankKeeper), - cron.NewAppModule(appCodec, app.CronKeeper, app.AccountKeeper, app.BankKeeper, app.WasmKeeper), + cron.NewAppModule(appCodec, app.CronKeeper, app.WasmKeeper), // TODO: revisit // gasless.NewAppModule(appCodec, app.GaslessKeeper, app.AccountKeeper, app.BankKeeper), } @@ -785,7 +784,7 @@ func (app *App) setAnteHandler(txConfig client.TxConfig, wasmConfig wasmtypes.Wa SignModeHandler: txConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - IBCKeeper: app.IBCKeeper, + IBCKeeper: app.IBCKeeper, // TODO: revisit // GaslessKeeper: app.GaslessKeeper, // BankKeeper: app.BankKeeper, diff --git a/app/test_suite.go b/app/test_suite.go new file mode 100644 index 0000000..d8aea4a --- /dev/null +++ b/app/test_suite.go @@ -0,0 +1,117 @@ +package app + +import ( + "encoding/json" + "testing" + "time" + + "github.com/CosmWasm/wasmd/x/wasm" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + sequencerstypes "github.com/dymensionxyz/dymension-rdk/x/sequencers/types" + cronTypes "github.com/dymensionxyz/rollapp-wasm/x/cron/types" + "github.com/stretchr/testify/require" + abci "github.com/tendermint/tendermint/abci/types" + "github.com/tendermint/tendermint/libs/log" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtypes "github.com/tendermint/tendermint/types" + dbm "github.com/tendermint/tm-db" +) + +// DefaultConsensusParams defines the default Tendermint consensus params used in +// App testing. +var DefaultConsensusParams = &abci.ConsensusParams{ + Block: &abci.BlockParams{ + MaxBytes: 200000, + MaxGas: -1, + }, + Evidence: &tmproto.EvidenceParams{ + MaxAgeNumBlocks: 302400, + MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration + MaxBytes: 10000, + }, + Validator: &tmproto.ValidatorParams{ + PubKeyTypes: []string{ + tmtypes.ABCIPubKeyTypeEd25519, + }, + }, +} + +var ( + ProposerPK = simapp.CreateTestPubKeys(1)[0] + ProposerConsAddr = sdk.ConsAddress(ProposerPK.Address()) + + OperatorPK = secp256k1.GenPrivKey().PubKey() +) + +var TestChainID = "rollappwasm_1234-1" + +func setup(withGenesis bool, invCheckPeriod uint) (*App, map[string]json.RawMessage) { + db := dbm.NewMemDB() + + encCdc := MakeEncodingConfig() + var emptyWasmOpts []wasm.Option + testApp := NewRollapp( + log.NewNopLogger(), db, nil, true, map[int64]bool{}, "/tmp", invCheckPeriod, encCdc, GetEnabledProposals(), EmptyAppOptions{}, emptyWasmOpts, + ) + if withGenesis { + return testApp, NewDefaultGenesisState(encCdc.Codec) + } + return testApp, map[string]json.RawMessage{} +} + +// Setup initializes a new Rollapp. A Nop logger is set in Rollapp. +func Setup(t *testing.T, isCheckTx bool) *App { + t.Helper() + + pk, err := cryptocodec.ToTmProtoPublicKey(ProposerPK) + require.NoError(t, err) + + app, genesisState := setup(true, 5) + + // setup for sequencer + seqGenesis := sequencerstypes.GenesisState{ + Params: sequencerstypes.DefaultParams(), + GenesisOperatorAddress: sdk.ValAddress(OperatorPK.Address()).String(), + } + genesisState[sequencerstypes.ModuleName] = app.AppCodec().MustMarshalJSON(&seqGenesis) + + // setup for cron + DefaultSecurityAddress := []string{"cosmos1xkxed7rdzvmyvgdshpe445ddqwn47fru24fnlp"} + params := cronTypes.Params{SecurityAddress: DefaultSecurityAddress} + cronGenesis := cronTypes.GenesisState{ + Params: params, + WhitelistedContracts: []cronTypes.WhitelistedContract{}, + } + genesisState[cronTypes.ModuleName] = app.AppCodec().MustMarshalJSON(&cronGenesis) + + // for now bank genesis won't be set here, funding accounts should be called with fund utils.FundModuleAccount + + stateBytes, err := json.MarshalIndent(genesisState, "", " ") + require.NoError(t, err) + // init chain will set the validator set and initialize the genesis accounts + app.InitChain( + abci.RequestInitChain{ + Time: time.Time{}, + ChainId: TestChainID, + ConsensusParams: DefaultConsensusParams, + Validators: []abci.ValidatorUpdate{ + {PubKey: pk, Power: 1}, + }, + AppStateBytes: stateBytes, + InitialHeight: 0, + }, + ) + + return app +} + +// EmptyAppOptions is a stub implementing AppOptions +type EmptyAppOptions struct{} + +// Get implements AppOptions +func (ao EmptyAppOptions) Get(o string) interface{} { + return nil +} diff --git a/go.mod b/go.mod index 653a7aa..3d0060f 100644 --- a/go.mod +++ b/go.mod @@ -26,8 +26,10 @@ require ( github.com/rakyll/statik v0.1.7 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.8.0 + github.com/stretchr/testify v1.8.4 github.com/tendermint/tendermint v0.34.29 github.com/tendermint/tm-db v0.6.8-0.20220506192307-f628bb5dc95b + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe google.golang.org/grpc v1.61.0 ) @@ -255,7 +257,6 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.15.0 // indirect - github.com/stretchr/testify v1.8.4 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -283,7 +284,6 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.22.0 // indirect - golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect golang.org/x/mod v0.15.0 // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect diff --git a/proto/aib/cron/v1beta1/cron.proto b/proto/wasmrollapp/cron/v1beta1/cron.proto similarity index 90% rename from proto/aib/cron/v1beta1/cron.proto rename to proto/wasmrollapp/cron/v1beta1/cron.proto index 783a0cb..9307987 100644 --- a/proto/aib/cron/v1beta1/cron.proto +++ b/proto/wasmrollapp/cron/v1beta1/cron.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package aib.cron.v1beta1; +package wasmrollapp.cron.v1beta1; import "gogoproto/gogo.proto"; diff --git a/proto/aib/cron/v1beta1/genesis.proto b/proto/wasmrollapp/cron/v1beta1/genesis.proto similarity index 78% rename from proto/aib/cron/v1beta1/genesis.proto rename to proto/wasmrollapp/cron/v1beta1/genesis.proto index af36d2b..d9a3b1a 100644 --- a/proto/aib/cron/v1beta1/genesis.proto +++ b/proto/wasmrollapp/cron/v1beta1/genesis.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package aib.cron.v1beta1; +package wasmrollapp.cron.v1beta1; import "gogoproto/gogo.proto"; -import "aib/cron/v1beta1/params.proto"; -import "aib/cron/v1beta1/cron.proto"; +import "wasmrollapp/cron/v1beta1/params.proto"; +import "wasmrollapp/cron/v1beta1/cron.proto"; option go_package = "github.com/dymensionxyz/rollapp-wasm/x/cron/types"; diff --git a/proto/aib/cron/v1beta1/params.proto b/proto/wasmrollapp/cron/v1beta1/params.proto similarity index 69% rename from proto/aib/cron/v1beta1/params.proto rename to proto/wasmrollapp/cron/v1beta1/params.proto index 264e2f8..9a14c75 100644 --- a/proto/aib/cron/v1beta1/params.proto +++ b/proto/wasmrollapp/cron/v1beta1/params.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package aib.cron.v1beta1; +package wasmrollapp.cron.v1beta1; import "gogoproto/gogo.proto"; @@ -12,9 +12,4 @@ message Params { (gogoproto.jsontag) = "security_address,omitempty", (gogoproto.moretags) = "yaml:\"security_address\"" ]; - - uint64 contract_gas_limit = 2 [ - (gogoproto.jsontag) = "contract_gas_limit,omitempty", - (gogoproto.moretags) = "yaml:\"contract_gas_limit\"" - ]; } diff --git a/proto/aib/cron/v1beta1/query.proto b/proto/wasmrollapp/cron/v1beta1/query.proto similarity index 81% rename from proto/aib/cron/v1beta1/query.proto rename to proto/wasmrollapp/cron/v1beta1/query.proto index 41ad10c..38ff317 100644 --- a/proto/aib/cron/v1beta1/query.proto +++ b/proto/wasmrollapp/cron/v1beta1/query.proto @@ -1,11 +1,11 @@ syntax = "proto3"; -package aib.cron.v1beta1; +package wasmrollapp.cron.v1beta1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "aib/cron/v1beta1/params.proto"; -import "aib/cron/v1beta1/cron.proto"; +import "wasmrollapp/cron/v1beta1/params.proto"; +import "wasmrollapp/cron/v1beta1/cron.proto"; option go_package = "github.com/dymensionxyz/rollapp-wasm/x/cron/types"; @@ -13,10 +13,10 @@ option go_package = "github.com/dymensionxyz/rollapp-wasm/x/cron/types"; service Query { // Parameters queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/aib/cron/v1beta1/params"; + option (google.api.http).get = "/wasmrollapp/cron/v1beta1/params"; } rpc QueryWhitelistedContracts(QueryWhitelistedContractsRequest) returns (QueryWhitelistedContractsResponse) { - option (google.api.http).get = "/aib/cron/v1beta1/whitelisted_contracts"; + option (google.api.http).get = "/wasmrollapp/cron/v1beta1/whitelisted_contracts"; } } diff --git a/proto/aib/cron/v1beta1/tx.proto b/proto/wasmrollapp/cron/v1beta1/tx.proto similarity index 90% rename from proto/aib/cron/v1beta1/tx.proto rename to proto/wasmrollapp/cron/v1beta1/tx.proto index 3cc56d7..e5046c2 100644 --- a/proto/aib/cron/v1beta1/tx.proto +++ b/proto/wasmrollapp/cron/v1beta1/tx.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package aib.cron.v1beta1; +package wasmrollapp.cron.v1beta1; import "gogoproto/gogo.proto"; import "cosmos/msg/v1/msg.proto"; import "cosmos_proto/cosmos.proto"; -import "aib/cron/v1beta1/params.proto"; +import "wasmrollapp/cron/v1beta1/params.proto"; option go_package = "github.com/dymensionxyz/rollapp-wasm/x/cron/types"; diff --git a/x/cron/abci.go b/x/cron/abci.go index 9f10e16..8fd321b 100644 --- a/x/cron/abci.go +++ b/x/cron/abci.go @@ -7,9 +7,9 @@ import ( ) func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { - allContracts := k.GetAllContract(ctx) + whitelistedContracts := k.GetWhitelistedContracts(ctx) - for _, data := range allContracts { + for _, data := range whitelistedContracts { if data.GameType == 1 { k.SinglePlayer(ctx, data.ContractAddress, cronTypes.ResolveSinglePlayer, data.GameName) } else if data.GameType == 2 { diff --git a/x/cron/client/cli/tx.go b/x/cron/client/cli/tx.go index b1ef101..1e09a64 100644 --- a/x/cron/client/cli/tx.go +++ b/x/cron/client/cli/tx.go @@ -3,23 +3,13 @@ package cli import ( "fmt" "strconv" - "time" "github.com/spf13/cobra" - "github.com/dymensionxyz/rollapp-wasm/x/cron/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" -) - -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," + "github.com/dymensionxyz/rollapp-wasm/x/cron/types" ) // GetTxCmd returns the transaction commands for this module diff --git a/x/cron/genesis_test.go b/x/cron/genesis_test.go new file mode 100644 index 0000000..e448ba9 --- /dev/null +++ b/x/cron/genesis_test.go @@ -0,0 +1,25 @@ +package cron_test + +import ( + "testing" + + "github.com/dymensionxyz/rollapp-wasm/app" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/dymensionxyz/rollapp-wasm/x/cron" + "github.com/dymensionxyz/rollapp-wasm/x/cron/types" + "github.com/stretchr/testify/require" +) + +func TestGenesis(t *testing.T) { + appd := app.Setup(t, false) + ctx := appd.BaseApp.NewContext(false, tmproto.Header{}) + + genesisState := types.GenesisState{ + Params: types.DefaultParams(), + } + + cron.InitGenesis(ctx, appd.CronKeeper, genesisState) + got := cron.ExportGenesis(ctx, appd.CronKeeper) + require.NotNil(t, got) +} diff --git a/x/cron/keeper/genesis.go b/x/cron/keeper/genesis.go index 60a02d2..099b77b 100644 --- a/x/cron/keeper/genesis.go +++ b/x/cron/keeper/genesis.go @@ -9,6 +9,9 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { + if err := genState.Validate(); err != nil { + panic(err) + } var ( GameID uint64 ) @@ -28,6 +31,6 @@ func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ Params: k.GetParams(ctx), - WhitelistedContracts: k.GetAllContract(ctx), + WhitelistedContracts: k.GetWhitelistedContracts(ctx), } } diff --git a/x/cron/keeper/grpc_query.go b/x/cron/keeper/grpc_query.go index 8bab6c5..642fb0f 100644 --- a/x/cron/keeper/grpc_query.go +++ b/x/cron/keeper/grpc_query.go @@ -3,10 +3,10 @@ package keeper import ( "context" - "github.com/dymensionxyz/rollapp-wasm/x/cron/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" + "github.com/dymensionxyz/rollapp-wasm/x/cron/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -58,3 +58,10 @@ func (q QueryServer) QueryWhitelistedContracts(c context.Context, req *types.Que Pagination: pagination, }, nil } + +func (q QueryServer) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + params := q.Keeper.GetParams(ctx) + + return &types.QueryParamsResponse{Params: params}, nil +} diff --git a/x/cron/keeper/grpc_query_params.go b/x/cron/keeper/grpc_query_params.go deleted file mode 100644 index 1e18881..0000000 --- a/x/cron/keeper/grpc_query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/dymensionxyz/rollapp-wasm/x/cron/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/cron/keeper/keeper.go b/x/cron/keeper/keeper.go index f4b2d20..ef5ce43 100644 --- a/x/cron/keeper/keeper.go +++ b/x/cron/keeper/keeper.go @@ -2,6 +2,7 @@ package keeper import ( "encoding/hex" + "golang.org/x/exp/slices" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -68,12 +69,7 @@ func (k Keeper) SudoContractCall(ctx sdk.Context, contractAddress string, p []by func (k Keeper) CheckSecurityAddress(ctx sdk.Context, from string) bool { params := k.GetParams(ctx) - for _, addr := range params.SecurityAddress { - if addr == from { - return true - } - } - return false + return slices.Contains(params.SecurityAddress, from) } func (k Keeper) Store(ctx sdk.Context) sdk.KVStore { diff --git a/x/cron/keeper/keeper_test.go b/x/cron/keeper/keeper_test.go new file mode 100644 index 0000000..3d8ab5d --- /dev/null +++ b/x/cron/keeper/keeper_test.go @@ -0,0 +1,44 @@ +package keeper_test + +import ( + "encoding/binary" + "testing" + + "github.com/stretchr/testify/suite" + + sdk "github.com/cosmos/cosmos-sdk/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + chain "github.com/dymensionxyz/rollapp-wasm/app" + "github.com/dymensionxyz/rollapp-wasm/x/cron/keeper" + "github.com/dymensionxyz/rollapp-wasm/x/cron/types" +) + +type KeeperTestSuite struct { + suite.Suite + + app *chain.App + ctx sdk.Context + keeper keeper.Keeper + querier keeper.QueryServer + msgServer types.MsgServer +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} + +func (s *KeeperTestSuite) SetupTest() { + s.app = chain.Setup(s.T(), false) + s.ctx = s.app.BaseApp.NewContext(false, tmproto.Header{}) + s.keeper = s.app.CronKeeper + s.querier = keeper.QueryServer{Keeper: s.keeper} + s.msgServer = keeper.NewMsgServerImpl(s.keeper) +} + +// Below are useful helpers to write test code easily. +func (s *KeeperTestSuite) addr(addrNum int) sdk.AccAddress { + addr := make(sdk.AccAddress, 20) + binary.PutVarint(addr, int64(addrNum)) + return addr +} \ No newline at end of file diff --git a/x/cron/keeper/msg_server.go b/x/cron/keeper/msg_server.go index 0ed8d65..a70f1f8 100644 --- a/x/cron/keeper/msg_server.go +++ b/x/cron/keeper/msg_server.go @@ -42,7 +42,7 @@ func (k msgServer) RegisterContract(goCtx context.Context, msg *types.MsgRegiste return &types.MsgRegisterContractResponse{}, sdkerrors.ErrUnauthorized } - allContracts := k.GetAllContract(ctx) + allContracts := k.GetWhitelistedContracts(ctx) for _, data := range allContracts { if data.ContractAddress == msg.ContractAddress { @@ -78,7 +78,7 @@ func (k msgServer) DeRegisterContract(goCtx context.Context, msg *types.MsgDeReg } // Get Game info from Game Id - gameInfo, found := k.GetContract(ctx, msg.GameId) + gameInfo, found := k.GetWhitelistedContract(ctx, msg.GameId) if !found { return &types.MsgDeRegisterContractResponse{}, sdkerrors.Wrapf(sdkerrors.ErrNotFound, "no contract found for this game ID") } diff --git a/x/cron/keeper/params_test.go b/x/cron/keeper/params_test.go new file mode 100644 index 0000000..0fb868d --- /dev/null +++ b/x/cron/keeper/params_test.go @@ -0,0 +1,23 @@ +package keeper_test + +import ( + "testing" + + "github.com/dymensionxyz/rollapp-wasm/app" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + cronTypes "github.com/dymensionxyz/rollapp-wasm/x/cron/types" + "github.com/stretchr/testify/require" +) + +func TestGetParams(t *testing.T) { + appd := app.Setup(t, false) + ctx := appd.BaseApp.NewContext(false, tmproto.Header{}) + + DefaultSecurityAddress := []string{"cosmos1xkxed7rdzvmyvgdshpe445ddqwn47fru24fnlp"} + params := cronTypes.Params{SecurityAddress: DefaultSecurityAddress} + + appd.CronKeeper.SetParams(ctx, params) + + require.EqualValues(t, params, appd.CronKeeper.GetParams(ctx)) +} diff --git a/x/cron/keeper/store.go b/x/cron/keeper/store.go index 6bd7bba..6f7b896 100644 --- a/x/cron/keeper/store.go +++ b/x/cron/keeper/store.go @@ -48,7 +48,7 @@ func (k Keeper) SetContract(ctx sdk.Context, msg types.WhitelistedContract) erro return nil } -func (k Keeper) GetContract(ctx sdk.Context, gameID uint64) (contract types.WhitelistedContract, found bool) { +func (k Keeper) GetWhitelistedContract(ctx sdk.Context, gameID uint64) (contract types.WhitelistedContract, found bool) { var ( store = k.Store(ctx) key = types.ContractKey(gameID) @@ -72,7 +72,7 @@ func (k Keeper) DeleteContract(ctx sdk.Context, gameID uint64) { store.Delete(key) } -func (k Keeper) GetAllContract(ctx sdk.Context) (contracts []types.WhitelistedContract) { +func (k Keeper) GetWhitelistedContracts(ctx sdk.Context) (contracts []types.WhitelistedContract) { var ( store = k.Store(ctx) iter = sdk.KVStorePrefixIterator(store, types.SetContractKeyPrefix) diff --git a/x/cron/keeper/store_test.go b/x/cron/keeper/store_test.go new file mode 100644 index 0000000..2894e29 --- /dev/null +++ b/x/cron/keeper/store_test.go @@ -0,0 +1,61 @@ +package keeper_test + +import ( + cronTypes "github.com/dymensionxyz/rollapp-wasm/x/cron/types" +) + +func (s *KeeperTestSuite) TestSetContract() { + + cronKeeper, ctx := &s.app.CronKeeper, &s.ctx + params := cronKeeper.GetParams(*ctx) + + for _, tc := range []struct { + name string + msg cronTypes.WhitelistedContract + ExpErr error + }{ + { + "Single Player Registered Contract successfully", + cronTypes.WhitelistedContract{ + GameId: 1, + SecurityAddress: params.GetSecurityAddress()[0], + ContractAdmin: s.addr(2).String(), + GameName: "coinflip", + ContractAddress: s.addr(3).String(), + GameType: 1, + }, + nil, + }, + { + "Multi Player Registered Contract successfully", + cronTypes.WhitelistedContract{ + GameId: 2, + SecurityAddress: params.GetSecurityAddress()[0], + ContractAdmin: s.addr(2).String(), + GameName: "roulette", + ContractAddress: s.addr(4).String(), + GameType: 2, + }, + nil, + }, + } { + s.Run(tc.name, func() { + err := cronKeeper.SetContract(*ctx, tc.msg) + if tc.ExpErr != nil { + s.Require().Error(err) + s.Require().EqualError(err, tc.ExpErr.Error()) + } else { + + s.Require().NoError(err) + res, found := cronKeeper.GetWhitelistedContract(*ctx, tc.msg.GameId) + s.Require().True(found) + s.Require().Equal(res.GameId, tc.msg.GameId) + s.Require().Equal(res.SecurityAddress, tc.msg.SecurityAddress) + s.Require().Equal(res.ContractAdmin, tc.msg.ContractAdmin) + s.Require().Equal(res.GameName, tc.msg.GameName) + s.Require().Equal(res.ContractAddress, tc.msg.ContractAddress) + s.Require().Equal(res.GameType, tc.msg.GameType) + } + }) + } +} diff --git a/x/cron/module.go b/x/cron/module.go index 9bfbd7f..44a0a3d 100644 --- a/x/cron/module.go +++ b/x/cron/module.go @@ -13,15 +13,15 @@ import ( abci "github.com/tendermint/tendermint/abci/types" - "github.com/dymensionxyz/rollapp-wasm/x/cron/client/cli" - "github.com/dymensionxyz/rollapp-wasm/x/cron/expected" - "github.com/dymensionxyz/rollapp-wasm/x/cron/keeper" - "github.com/dymensionxyz/rollapp-wasm/x/cron/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/dymensionxyz/rollapp-wasm/x/cron/client/cli" + "github.com/dymensionxyz/rollapp-wasm/x/cron/expected" + "github.com/dymensionxyz/rollapp-wasm/x/cron/keeper" + "github.com/dymensionxyz/rollapp-wasm/x/cron/types" ) var ( @@ -67,7 +67,7 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingCo if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) } - return genState.ValidateGenesis() + return genState.Validate() } // RegisterRESTRoutes registers the capability module's REST service handlers. @@ -98,24 +98,18 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper - conOps expected.ContractOpsKeeper + keeper keeper.Keeper + conOps expected.ContractOpsKeeper } func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, - accountKeeper types.AccountKeeper, - bankKeeper types.BankKeeper, conOps expected.ContractOpsKeeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, conOps: conOps, } } diff --git a/x/cron/spec/01_concepts.md b/x/cron/spec/01_concepts.md index 77b3e94..ca8e62f 100644 --- a/x/cron/spec/01_concepts.md +++ b/x/cron/spec/01_concepts.md @@ -12,13 +12,13 @@ Developers can register their contracts if the address is whitelisted in the mod ### Registering a contract ```console -foo@bar:~$ aibd tx cron register-contract [game name] [contract address] [game type] +foo@bar:~$ wasmrollappd tx cron register-contract [game name] [contract address] [game type] ``` e.g ```console -foo@bar:~$ aibd tx cron register-contract coin-flip rol14hj2tavq8f.... 1 100000000aaib --from cooluser --chain-id test-1 +foo@bar:~$ wasmrollappd tx cron register-contract coin-flip rol14hj2tavq8f.... 1 100000000awasm --from cooluser --chain-id test-1 ``` In the above tx - @@ -32,13 +32,13 @@ In the above tx - ### De-Registering a contract ```console -foo@bar:~$ aibd tx cron de-register-contract [game id] +foo@bar:~$ wasmrollappd tx cron de-register-contract [game id] ``` e.g ```console -foo@bar:~$ aibd tx cron de-register-contract 2 100000000aaib --from cooluser --chain-id test-1 +foo@bar:~$ wasmrollappd tx cron de-register-contract 2 100000000awasm --from cooluser --chain-id test-1 ``` In the above tx - diff --git a/x/cron/spec/03_clients.md b/x/cron/spec/03_clients.md index 4c86113..2e860ba 100644 --- a/x/cron/spec/03_clients.md +++ b/x/cron/spec/03_clients.md @@ -10,14 +10,14 @@ The CLI has been updated with new queries and transactions for the `x/cron` modu ### Queries -| Command | Subcommand | Arguments | Description | -| :---------------- | :---------------------- | :-------- | :------------------------------------------------ | -| `aibd query cron` | `params` | | Get Cron params | -| `aibd query cron` | `whitelisted-contracts` | | Get the list of Whitelisted Contracts for cronjob | +| Command | Subcommand | Arguments | Description | +| :------------------------ | :---------------------- | :-------- | :------------------------------------------------ | +| `wasmrollappd query cron` | `params` | | Get Cron params | +| `wasmrollappd query cron` | `whitelisted-contracts` | | Get the list of Whitelisted Contracts for cronjob | ### Transactions -| Command | Subcommand | Arguments | Description | -| :------------- | :--------------------- | :----------------------------------------- | :------------------------------------- | -| `aibd tx cron` | `register-contract` | [game-name] [contract-address] [game-type] | Register the contract for cron job | -| `aibd tx cron` | `de-register-contract` | [game-id] | De-Register the contract from cron job | +| Command | Subcommand | Arguments | Description | +| :--------------------- | :--------------------- | :----------------------------------------- | :------------------------------------- | +| `wasmrollappd tx cron` | `register-contract` | [game-name] [contract-address] [game-type] | Register the contract for cron job | +| `wasmrollappd tx cron` | `de-register-contract` | [game-id] | De-Register the contract from cron job | diff --git a/x/cron/types/codec.go b/x/cron/types/codec.go index 1ba3b14..58b97ca 100644 --- a/x/cron/types/codec.go +++ b/x/cron/types/codec.go @@ -13,8 +13,8 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // this line is used by starport scaffolding # 2 - cdc.RegisterConcrete(&MsgRegisterContract{}, "aib/cron/MsgRegisterContract", nil) - cdc.RegisterConcrete(&MsgDeRegisterContract{}, "aib/cron/MsgDeRegisterContract", nil) + cdc.RegisterConcrete(&MsgRegisterContract{}, "wasmrollapp/cron/MsgRegisterContract", nil) + cdc.RegisterConcrete(&MsgDeRegisterContract{}, "wasmrollapp/cron/MsgDeRegisterContract", nil) } @@ -30,14 +30,13 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { } var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(Amino) - // ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + amino = codec.NewLegacyAmino() + moduleCdc = codec.NewAminoCodec(amino) ) func init() { - RegisterLegacyAminoCodec(Amino) - cryptocodec.RegisterCrypto(Amino) + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) RegisterLegacyAminoCodec(authzcodec.Amino) - Amino.Seal() + amino.Seal() } diff --git a/x/cron/types/cron.pb.go b/x/cron/types/cron.pb.go index 3ecf98f..53aaeb2 100644 --- a/x/cron/types/cron.pb.go +++ b/x/cron/types/cron.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: aib/cron/v1beta1/cron.proto +// source: wasmrollapp/cron/v1beta1/cron.proto package types @@ -36,7 +36,7 @@ func (m *WhitelistedContract) Reset() { *m = WhitelistedContract{} } func (m *WhitelistedContract) String() string { return proto.CompactTextString(m) } func (*WhitelistedContract) ProtoMessage() {} func (*WhitelistedContract) Descriptor() ([]byte, []int) { - return fileDescriptor_6c83358d263c9e57, []int{0} + return fileDescriptor_ad6aacd87fd409ed, []int{0} } func (m *WhitelistedContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -108,32 +108,34 @@ func (m *WhitelistedContract) GetGameType() uint64 { } func init() { - proto.RegisterType((*WhitelistedContract)(nil), "aib.cron.v1beta1.WhitelistedContract") + proto.RegisterType((*WhitelistedContract)(nil), "wasmrollapp.cron.v1beta1.WhitelistedContract") } -func init() { proto.RegisterFile("aib/cron/v1beta1/cron.proto", fileDescriptor_6c83358d263c9e57) } +func init() { + proto.RegisterFile("wasmrollapp/cron/v1beta1/cron.proto", fileDescriptor_ad6aacd87fd409ed) +} -var fileDescriptor_6c83358d263c9e57 = []byte{ - // 296 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0xc1, 0x4a, 0xc3, 0x30, - 0x18, 0xc7, 0x17, 0x9d, 0xd3, 0x05, 0xd4, 0x51, 0x05, 0x8b, 0x83, 0x30, 0x04, 0x61, 0x1e, 0x5c, - 0x28, 0x3e, 0xc1, 0xf4, 0x24, 0x82, 0x87, 0x21, 0x08, 0x5e, 0x4a, 0xda, 0x84, 0x2e, 0xd0, 0x24, - 0x25, 0xc9, 0x74, 0xf5, 0x29, 0x7c, 0x2c, 0x8f, 0x3b, 0x7a, 0x94, 0x16, 0xdf, 0x43, 0x92, 0xac, - 0xe8, 0x2d, 0xdf, 0xff, 0xfb, 0xf3, 0xfb, 0x85, 0x0f, 0x8e, 0x09, 0xcf, 0x70, 0xae, 0x95, 0xc4, - 0xaf, 0x49, 0xc6, 0x2c, 0x49, 0xfc, 0x30, 0xab, 0xb4, 0xb2, 0x2a, 0x1a, 0x11, 0x9e, 0xcd, 0xfc, - 0xbc, 0x5d, 0x9e, 0x9f, 0x16, 0xaa, 0x50, 0x7e, 0x89, 0xdd, 0x2b, 0xf4, 0x2e, 0x7e, 0x00, 0x3c, - 0x79, 0x5e, 0x72, 0xcb, 0x4a, 0x6e, 0x2c, 0xa3, 0x77, 0x4a, 0x5a, 0x4d, 0x72, 0x1b, 0x9d, 0xc1, - 0xfd, 0x82, 0x08, 0x96, 0x72, 0x1a, 0x83, 0x09, 0x98, 0xf6, 0x17, 0x03, 0x37, 0xde, 0xd3, 0xe8, - 0x0a, 0x8e, 0x0c, 0xcb, 0x57, 0x9a, 0xdb, 0x3a, 0x25, 0x94, 0x6a, 0x66, 0x4c, 0xbc, 0x33, 0x01, - 0xd3, 0xe1, 0xe2, 0xb8, 0xcb, 0xe7, 0x21, 0x8e, 0x2e, 0xe1, 0x51, 0xbe, 0xe5, 0xa5, 0x84, 0x0a, - 0x2e, 0xe3, 0x5d, 0x5f, 0x3c, 0xec, 0xd2, 0xb9, 0x0b, 0xa3, 0x31, 0x1c, 0x7a, 0x95, 0x24, 0x82, - 0xc5, 0x7d, 0xdf, 0x38, 0x70, 0xc1, 0x23, 0x11, 0xcc, 0xe9, 0xfe, 0x31, 0x82, 0x6e, 0x2f, 0xe8, - 0xfe, 0x28, 0x41, 0xd7, 0x71, 0x6c, 0x5d, 0xb1, 0x78, 0xe0, 0x3f, 0xed, 0x39, 0x4f, 0x75, 0xc5, - 0x6e, 0x1f, 0x3e, 0x1b, 0x04, 0x36, 0x0d, 0x02, 0xdf, 0x0d, 0x02, 0x1f, 0x2d, 0xea, 0x6d, 0x5a, - 0xd4, 0xfb, 0x6a, 0x51, 0xef, 0x25, 0x29, 0xb8, 0x5d, 0xae, 0xb2, 0x59, 0xae, 0x04, 0xa6, 0xb5, - 0x60, 0xd2, 0x70, 0x25, 0xd7, 0xf5, 0x3b, 0xd6, 0xaa, 0x2c, 0x49, 0x55, 0x5d, 0xbf, 0x11, 0x23, - 0xf0, 0x3a, 0x5c, 0xda, 0xb1, 0x4d, 0x36, 0xf0, 0xb7, 0xbb, 0xf9, 0x0d, 0x00, 0x00, 0xff, 0xff, - 0x06, 0x2e, 0x2a, 0x89, 0x82, 0x01, 0x00, 0x00, +var fileDescriptor_ad6aacd87fd409ed = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x4f, 0x4a, 0x03, 0x31, + 0x1c, 0x85, 0x1b, 0xad, 0xd5, 0x06, 0xfc, 0xc3, 0x28, 0x18, 0x14, 0x42, 0x51, 0x84, 0xba, 0xb0, + 0xa1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62, 0x5d, 0xeb, 0x71, 0x65, 0xc1, 0x51, 0x2f, 0x7c, + 0x3a, 0x78, 0x9e, 0xcb, 0x82, 0xdf, 0x3d, 0x7e, 0x55, 0x18, 0xac, 0x2b, 0x0c, 0x7e, 0x2a, 0x0c, + 0x3e, 0x6b, 0xdc, 0x59, 0xd7, 0xb8, 0xf3, 0x5d, 0xe3, 0xce, 0xeb, 0x38, 0x13, 0x6e, 0xb1, 0x9c, + 0x8f, 0x52, 0x2d, 0x09, 0x2b, 0x25, 0x57, 0x56, 0x68, 0xb5, 0x2a, 0x3f, 0x48, 0xb3, 0xe2, 0x8d, + 0x5f, 0x94, 0xac, 0xe2, 0xe2, 0xde, 0x6d, 0xe7, 0xbd, 0xb0, 0xdd, 0xed, 0x5f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xaf, 0x32, 0x5d, 0x0b, 0x92, 0x01, 0x00, 0x00, } func (m *WhitelistedContract) Marshal() (dAtA []byte, err error) { diff --git a/x/cron/types/errors.go b/x/cron/types/errors.go deleted file mode 100644 index 35382cb..0000000 --- a/x/cron/types/errors.go +++ /dev/null @@ -1,12 +0,0 @@ -package types - -// DONTCOVER - -import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// x/cron module sentinel errors -var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") -) diff --git a/x/cron/types/expected_keepers.go b/x/cron/types/expected_keepers.go deleted file mode 100644 index 04a3b5a..0000000 --- a/x/cron/types/expected_keepers.go +++ /dev/null @@ -1,20 +0,0 @@ -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 -} - -// 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 -} \ No newline at end of file diff --git a/x/cron/types/genesis.go b/x/cron/types/genesis.go index c015664..94117c2 100644 --- a/x/cron/types/genesis.go +++ b/x/cron/types/genesis.go @@ -1,5 +1,7 @@ package types +import "fmt" + func NewGenesisState(whitelistedContracts []WhitelistedContract, params Params) *GenesisState { return &GenesisState{ WhitelistedContracts: whitelistedContracts, @@ -14,6 +16,16 @@ func DefaultGenesisState() *GenesisState { ) } -func (m *GenesisState) ValidateGenesis() error { +func (genState *GenesisState) Validate() error { + if err := genState.Params.Validate(); err != nil { + return fmt.Errorf("invalid params: %w", err) + } + // validates all the whitelisted contracts + for i, contract := range genState.WhitelistedContracts { + if err := contract.Validate(); err != nil { + return fmt.Errorf("invalid whitelisted contract %d: %w", i, err) + } + } + return nil } diff --git a/x/cron/types/genesis.pb.go b/x/cron/types/genesis.pb.go index 2c8bb6d..208eb61 100644 --- a/x/cron/types/genesis.pb.go +++ b/x/cron/types/genesis.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: aib/cron/v1beta1/genesis.proto +// source: wasmrollapp/cron/v1beta1/genesis.proto package types @@ -33,7 +33,7 @@ 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_ab4f5eee2dbe1418, []int{0} + return fileDescriptor_63596159ab131d7b, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -77,32 +77,34 @@ func (m *GenesisState) GetWhitelistedContracts() []WhitelistedContract { } func init() { - proto.RegisterType((*GenesisState)(nil), "aib.cron.v1beta1.GenesisState") + proto.RegisterType((*GenesisState)(nil), "wasmrollapp.cron.v1beta1.GenesisState") } -func init() { proto.RegisterFile("aib/cron/v1beta1/genesis.proto", fileDescriptor_ab4f5eee2dbe1418) } +func init() { + proto.RegisterFile("wasmrollapp/cron/v1beta1/genesis.proto", fileDescriptor_63596159ab131d7b) +} -var fileDescriptor_ab4f5eee2dbe1418 = []byte{ - // 295 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcc, 0x4c, 0xd2, - 0x4f, 0x2e, 0xca, 0xcf, 0xd3, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, - 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x48, 0xcc, 0x4c, 0xd2, - 0x03, 0xc9, 0xeb, 0x41, 0xe5, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x92, 0xfa, 0x20, 0x16, - 0x44, 0x9d, 0x94, 0x2c, 0x86, 0x39, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x63, 0xa4, 0xa4, 0x31, - 0xa4, 0xc1, 0x66, 0x82, 0x25, 0x95, 0x6e, 0x31, 0x72, 0xf1, 0xb8, 0x43, 0x6c, 0x0d, 0x2e, 0x49, - 0x2c, 0x49, 0x15, 0x72, 0xe7, 0x62, 0x83, 0xe8, 0x96, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, - 0xd0, 0x43, 0x77, 0x85, 0x5e, 0x00, 0x58, 0xde, 0x49, 0xf4, 0xc4, 0x3d, 0x79, 0x86, 0x4f, 0xf7, - 0xe4, 0x79, 0x2b, 0x13, 0x73, 0x73, 0xac, 0x94, 0x20, 0xba, 0x94, 0x82, 0xa0, 0xda, 0x85, 0x1a, - 0x18, 0xb9, 0x44, 0xcb, 0x33, 0x32, 0x4b, 0x52, 0x73, 0x32, 0x8b, 0x4b, 0x52, 0x53, 0xe2, 0x93, - 0xf3, 0xf3, 0x4a, 0x8a, 0x12, 0x93, 0x4b, 0x8a, 0x25, 0x98, 0x14, 0x98, 0x35, 0xb8, 0x8d, 0x54, - 0x31, 0x0d, 0x0e, 0x47, 0x28, 0x77, 0x86, 0xaa, 0x76, 0x52, 0x81, 0xda, 0x22, 0x03, 0xb1, 0x05, - 0xab, 0x89, 0x4a, 0x41, 0x22, 0xe5, 0x98, 0x5a, 0x8b, 0x9d, 0xbc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, - 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, - 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x30, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, - 0x57, 0x3f, 0xa5, 0x32, 0x37, 0x35, 0xaf, 0x38, 0x33, 0x3f, 0xaf, 0xa2, 0xb2, 0x4a, 0xbf, 0x28, - 0x3f, 0x27, 0x27, 0xb1, 0xa0, 0x40, 0xb7, 0x3c, 0xb1, 0x38, 0x57, 0xbf, 0x02, 0x12, 0x6c, 0x25, - 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x00, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x57, - 0xbc, 0x07, 0x53, 0xb6, 0x01, 0x00, 0x00, +var fileDescriptor_63596159ab131d7b = []byte{ + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2b, 0x4f, 0x2c, 0xce, + 0x2d, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0x2e, 0xca, 0xcf, 0xd3, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x92, 0x40, 0x52, 0xa7, 0x07, 0x52, 0xa7, 0x07, 0x55, 0x27, 0x25, 0x92, 0x9e, + 0x9f, 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x4b, 0xa9, 0xe2, 0x34, 0xb7, 0x20, 0xb1, + 0x28, 0x31, 0x17, 0x6a, 0xac, 0x94, 0x32, 0x4e, 0x65, 0x60, 0x3b, 0xc0, 0x8a, 0x94, 0x5e, 0x31, + 0x72, 0xf1, 0xb8, 0x43, 0x5c, 0x13, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xcf, 0xc5, 0x06, 0x31, + 0x45, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x41, 0x0f, 0x97, 0xeb, 0xf4, 0x02, 0xc0, 0xea, + 0x9c, 0x44, 0x4f, 0xdc, 0x93, 0x67, 0xf8, 0x74, 0x4f, 0x9e, 0xb7, 0x32, 0x31, 0x37, 0xc7, 0x4a, + 0x09, 0xa2, 0x5b, 0x29, 0x08, 0x6a, 0x8c, 0x50, 0x07, 0x23, 0x97, 0x68, 0x79, 0x46, 0x66, 0x49, + 0x6a, 0x4e, 0x66, 0x71, 0x49, 0x6a, 0x4a, 0x7c, 0x72, 0x7e, 0x5e, 0x49, 0x51, 0x62, 0x72, 0x49, + 0xb1, 0x04, 0x93, 0x02, 0xb3, 0x06, 0xb7, 0x91, 0x2e, 0x6e, 0x0b, 0xc2, 0x11, 0xda, 0x9c, 0xa1, + 0xba, 0x9c, 0x54, 0xa0, 0xb6, 0xc9, 0x40, 0x6c, 0xc3, 0x6a, 0xb2, 0x52, 0x90, 0x48, 0x39, 0xa6, + 0xd6, 0x62, 0x27, 0xef, 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, 0x32, 0x4c, + 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xa9, 0xcc, 0x4d, 0xcd, 0x2b, + 0xce, 0xcc, 0xcf, 0xab, 0xa8, 0xac, 0xd2, 0x87, 0xba, 0x4b, 0x17, 0xe4, 0x46, 0xfd, 0x0a, 0x48, + 0x30, 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x03, 0xd0, 0x18, 0x10, 0x00, 0x00, 0xff, + 0xff, 0xd5, 0x84, 0x01, 0x09, 0xe6, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/cron/types/genesis_test.go b/x/cron/types/genesis_test.go deleted file mode 100644 index 380d4b1..0000000 --- a/x/cron/types/genesis_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package types_test - -// import ( -// "testing" - -// "github.com/stretchr/testify/require" -// "github.com/dymensionxyz/rollapp-wasm/x/cron/types" -// ) - -// func TestGenesisState_Validate(t *testing.T) { -// for _, tc := range []struct { -// desc string -// genState *types.GenesisState -// valid bool -// } { -// { -// desc: "default is valid", -// genState: types.DefaultGenesis(), -// valid: true, -// }, -// { -// desc: "valid genesis state", -// genState: &types.GenesisState{ - -// // this line is used by starport scaffolding # types/genesis/validField -// }, -// valid: true, -// }, -// // this line is used by starport scaffolding # types/genesis/testcase -// } { -// t.Run(tc.desc, func(t *testing.T) { -// err := tc.genState.Validate() -// if tc.valid { -// require.NoError(t, err) -// } else { -// require.Error(t, err) -// } -// }) -// } -// } diff --git a/x/cron/types/keys.go b/x/cron/types/keys.go index 9f11d25..9279e2d 100644 --- a/x/cron/types/keys.go +++ b/x/cron/types/keys.go @@ -26,10 +26,6 @@ var ( GameIDKey = []byte{0x12} ) -func KeyPrefix(p string) []byte { - return []byte(p) -} - func ContractKey(gameID uint64) []byte { return append(SetContractKeyPrefix, sdk.Uint64ToBigEndian(gameID)...) } diff --git a/x/cron/types/message_de_register_contract.go b/x/cron/types/message_de_register_contract.go index 43ff3f6..acb3055 100644 --- a/x/cron/types/message_de_register_contract.go +++ b/x/cron/types/message_de_register_contract.go @@ -36,7 +36,7 @@ func (msg *MsgDeRegisterContract) GetSigners() []sdk.AccAddress { } func (msg *MsgDeRegisterContract) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := moduleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } diff --git a/x/cron/types/message_register_contract.go b/x/cron/types/message_register_contract.go index 1910ccd..fe8aa22 100644 --- a/x/cron/types/message_register_contract.go +++ b/x/cron/types/message_register_contract.go @@ -41,7 +41,7 @@ func (msg *MsgRegisterContract) GetSigners() []sdk.AccAddress { } func (msg *MsgRegisterContract) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) + bz := moduleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } diff --git a/x/cron/types/params.go b/x/cron/types/params.go index 7e99b25..6f5e560 100644 --- a/x/cron/types/params.go +++ b/x/cron/types/params.go @@ -2,22 +2,16 @@ package types import ( "fmt" - // errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - // sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) var _ paramtypes.ParamSet = (*Params)(nil) var ( - DefaultSecurityAddress = []string{"aib1sdggcl7eanaanvcsmvars7l0unsge65wzjm3dc"} //assuming BECH32_PREFIX=aib, will need a Default admin to whitelist contract for cron operations - - DefaultContractGasLimit uint64 = 1000000000 + DefaultSecurityAddress = []string{} // KeySecurityAddress is store's key for SecurityAddress Params KeySecurityAddress = []byte("SecurityAddress") - // KeyContractGasLimit is store's key for ContractGasLimit Params - KeyContractGasLimit = []byte("ContractGasLimit") ) // ParamKeyTable the param key table for launch module @@ -25,28 +19,21 @@ func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } -func NewParams( - securityAddress []string, contractGasLimit uint64, -) Params { +func NewParams(securityAddress []string) Params { return Params{ - SecurityAddress: securityAddress, - ContractGasLimit: contractGasLimit, + SecurityAddress: securityAddress, } } // default minting module parameters func DefaultParams() Params { - return NewParams( - DefaultSecurityAddress, DefaultContractGasLimit, - ) + return NewParams(DefaultSecurityAddress) } // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeySecurityAddress, &p.SecurityAddress, validateSecurityAddress), - paramtypes.NewParamSetPair(KeyContractGasLimit, &p.ContractGasLimit, validateContractGasLimit), - } + paramtypes.NewParamSetPair(KeySecurityAddress, &p.SecurityAddress, validateSecurityAddress)} } // validateSecurityAddress validates that the security addressess are valid @@ -64,26 +51,12 @@ func validateSecurityAddress(i interface{}) error { return nil } -func validateContractGasLimit(i interface{}) error { - - v, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v < 100_000 { - return fmt.Errorf("invalid contract gas limit must be above 100_000: %d", v) - } - return nil -} - // Validate all params func (p Params) Validate() error { for _, field := range []struct { val interface{} validateFunc func(i interface{}) error }{ - {p.ContractGasLimit, validateContractGasLimit}, {p.SecurityAddress, validateSecurityAddress}, } { if err := field.validateFunc(field.val); err != nil { @@ -93,4 +66,3 @@ func (p Params) Validate() error { return nil } - diff --git a/x/cron/types/params.pb.go b/x/cron/types/params.pb.go index baf09c8..9900a71 100644 --- a/x/cron/types/params.pb.go +++ b/x/cron/types/params.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: aib/cron/v1beta1/params.proto +// source: wasmrollapp/cron/v1beta1/params.proto package types @@ -26,15 +26,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the set of module parameters. type Params struct { // Security address that can whitelist/delist contract - SecurityAddress []string `protobuf:"bytes,1,rep,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty" yaml:"security_address"` - ContractGasLimit uint64 `protobuf:"varint,2,opt,name=contract_gas_limit,json=contractGasLimit,proto3" json:"contract_gas_limit,omitempty" yaml:"contract_gas_limit"` + SecurityAddress []string `protobuf:"bytes,1,rep,name=security_address,json=securityAddress,proto3" json:"security_address,omitempty" yaml:"security_address"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_548e10d5905fde26, []int{0} + return fileDescriptor_491639397aa704f1, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -70,39 +69,31 @@ func (m *Params) GetSecurityAddress() []string { return nil } -func (m *Params) GetContractGasLimit() uint64 { - if m != nil { - return m.ContractGasLimit - } - return 0 +func init() { + proto.RegisterType((*Params)(nil), "wasmrollapp.cron.v1beta1.Params") } func init() { - proto.RegisterType((*Params)(nil), "aib.cron.v1beta1.Params") + proto.RegisterFile("wasmrollapp/cron/v1beta1/params.proto", fileDescriptor_491639397aa704f1) } -func init() { proto.RegisterFile("aib/cron/v1beta1/params.proto", fileDescriptor_548e10d5905fde26) } - -var fileDescriptor_548e10d5905fde26 = []byte{ - // 285 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x90, 0x31, 0x4b, 0xc3, 0x40, - 0x18, 0x86, 0x7b, 0x2a, 0x05, 0xb3, 0x58, 0x82, 0x60, 0x2d, 0x7a, 0x2d, 0x99, 0x3a, 0x68, 0x8e, - 0xe0, 0xa4, 0xe0, 0x60, 0x16, 0x07, 0x1d, 0xa4, 0xa3, 0x4b, 0xf8, 0x92, 0x1c, 0xf1, 0x30, 0x97, - 0x3b, 0xee, 0xae, 0xda, 0xf3, 0x57, 0xf8, 0xb3, 0x1c, 0x3b, 0x0a, 0x42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0xb5, 0x9c, 0x16, 0x9a, 0x89, 0x62, 0x61, 0xdf, 0x88, 0x12, 0x79, 0x0e, 0x52, - 0x9e, 0xbf, 0x82, 0xe6, 0x64, 0xd1, 0x2d, 0x6c, 0xac, 0xa4, 0x3a, 0xee, 0xb7, 0x8b, 0x5d, 0xfc, - 0x06, 0x00, 0x00, 0xff, 0xff, 0x57, 0x09, 0x0c, 0x1e, 0x7a, 0x01, 0x00, 0x00, +var fileDescriptor_491639397aa704f1 = []byte{ + // 231 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2d, 0x4f, 0x2c, 0xce, + 0x2d, 0xca, 0xcf, 0xc9, 0x49, 0x2c, 0x28, 0xd0, 0x4f, 0x2e, 0xca, 0xcf, 0xd3, 0x2f, 0x33, 0x4c, + 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x40, 0x52, 0xa6, 0x07, 0x52, 0xa6, 0x07, 0x55, 0x26, 0x25, 0x92, 0x9e, 0x9f, + 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xe5, 0x71, 0xb1, 0x05, 0x80, 0xf5, 0x0b, + 0xa5, 0x70, 0x09, 0x14, 0xa7, 0x26, 0x97, 0x16, 0x65, 0x96, 0x54, 0xc6, 0x27, 0xa6, 0xa4, 0x14, + 0xa5, 0x16, 0x17, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x3a, 0x59, 0xbe, 0xba, 0x27, 0x2f, 0x85, + 0x2e, 0xa7, 0x93, 0x9f, 0x9b, 0x59, 0x92, 0x9a, 0x5b, 0x50, 0x52, 0xf9, 0xe9, 0x9e, 0xbc, 0x78, + 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0xba, 0x1a, 0xa5, 0x20, 0x7e, 0x98, 0x90, 0x23, 0x44, 0xc4, + 0xc9, 0xfb, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, + 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd3, 0x33, 0x4b, + 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x53, 0x2a, 0x73, 0x53, 0xf3, 0x8a, 0x33, 0xf3, + 0xf3, 0x2a, 0x2a, 0xab, 0xf4, 0xa1, 0xbe, 0xd1, 0x05, 0xf9, 0x4c, 0xbf, 0x02, 0xe2, 0xf7, 0x92, + 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x1f, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x87, + 0x0f, 0x25, 0xe5, 0x1c, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -125,11 +116,6 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ContractGasLimit != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.ContractGasLimit)) - i-- - dAtA[i] = 0x10 - } if len(m.SecurityAddress) > 0 { for iNdEx := len(m.SecurityAddress) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.SecurityAddress[iNdEx]) @@ -165,9 +151,6 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } - if m.ContractGasLimit != 0 { - n += 1 + sovParams(uint64(m.ContractGasLimit)) - } return n } @@ -238,25 +221,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.SecurityAddress = append(m.SecurityAddress, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ContractGasLimit", wireType) - } - m.ContractGasLimit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ContractGasLimit |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/cron/types/query.pb.go b/x/cron/types/query.pb.go index 3db66d9..0990ae7 100644 --- a/x/cron/types/query.pb.go +++ b/x/cron/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: aib/cron/v1beta1/query.proto +// source: wasmrollapp/cron/v1beta1/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_2cac7f98e937b79a, []int{0} + return fileDescriptor_e02468b100a941b9, []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_2cac7f98e937b79a, []int{1} + return fileDescriptor_e02468b100a941b9, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -121,7 +121,7 @@ func (m *QueryWhitelistedContractsRequest) Reset() { *m = QueryWhitelist func (m *QueryWhitelistedContractsRequest) String() string { return proto.CompactTextString(m) } func (*QueryWhitelistedContractsRequest) ProtoMessage() {} func (*QueryWhitelistedContractsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2cac7f98e937b79a, []int{2} + return fileDescriptor_e02468b100a941b9, []int{2} } func (m *QueryWhitelistedContractsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -166,7 +166,7 @@ func (m *QueryWhitelistedContractsResponse) Reset() { *m = QueryWhitelis func (m *QueryWhitelistedContractsResponse) String() string { return proto.CompactTextString(m) } func (*QueryWhitelistedContractsResponse) ProtoMessage() {} func (*QueryWhitelistedContractsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2cac7f98e937b79a, []int{3} + return fileDescriptor_e02468b100a941b9, []int{3} } func (m *QueryWhitelistedContractsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -210,46 +210,48 @@ func (m *QueryWhitelistedContractsResponse) GetPagination() *query.PageResponse } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "aib.cron.v1beta1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "aib.cron.v1beta1.QueryParamsResponse") - proto.RegisterType((*QueryWhitelistedContractsRequest)(nil), "aib.cron.v1beta1.QueryWhitelistedContractsRequest") - proto.RegisterType((*QueryWhitelistedContractsResponse)(nil), "aib.cron.v1beta1.QueryWhitelistedContractsResponse") -} - -func init() { proto.RegisterFile("aib/cron/v1beta1/query.proto", fileDescriptor_2cac7f98e937b79a) } - -var fileDescriptor_2cac7f98e937b79a = []byte{ - // 477 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcf, 0x6e, 0xd3, 0x30, - 0x18, 0xaf, 0x0b, 0xf4, 0xe0, 0x5d, 0xc0, 0x1b, 0x52, 0x09, 0x23, 0x2b, 0x11, 0x63, 0x03, 0x09, - 0x5b, 0xed, 0x24, 0x0e, 0x1c, 0xcb, 0x11, 0x21, 0x41, 0x2f, 0x48, 0x88, 0x3f, 0x72, 0x32, 0x2b, - 0xb5, 0x94, 0xd8, 0x5e, 0xec, 0xd2, 0x85, 0x1b, 0x3c, 0x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, 0xf3, 0xb0, 0xf5, 0xbc, 0x9f, 0x72, 0x33, 0x9e, 0xc4, 0x38, 0x91, - 0x39, 0xd9, 0x2f, 0x73, 0x26, 0x34, 0x97, 0xe2, 0xb0, 0x7c, 0x4b, 0x0a, 0x99, 0x65, 0x54, 0xa9, - 0x7b, 0x53, 0xaa, 0x73, 0x72, 0xe8, 0x4c, 0x4c, 0xa9, 0x98, 0x8e, 0x3b, 0xf6, 0xdb, 0xda, 0xfb, - 0x15, 0x00, 0x00, 0xff, 0xff, 0x88, 0xed, 0x9a, 0xac, 0x29, 0x04, 0x00, 0x00, + proto.RegisterType((*QueryParamsRequest)(nil), "wasmrollapp.cron.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "wasmrollapp.cron.v1beta1.QueryParamsResponse") + proto.RegisterType((*QueryWhitelistedContractsRequest)(nil), "wasmrollapp.cron.v1beta1.QueryWhitelistedContractsRequest") + proto.RegisterType((*QueryWhitelistedContractsResponse)(nil), "wasmrollapp.cron.v1beta1.QueryWhitelistedContractsResponse") +} + +func init() { + proto.RegisterFile("wasmrollapp/cron/v1beta1/query.proto", fileDescriptor_e02468b100a941b9) +} + +var fileDescriptor_e02468b100a941b9 = []byte{ + // 480 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x53, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0xcf, 0x44, 0xcd, 0x61, 0x7a, 0x72, 0x5a, 0x21, 0x06, 0xd9, 0xae, 0xeb, 0xbf, 0x20, 0x66, + 0x86, 0xc4, 0x83, 0x50, 0xc1, 0x43, 0x3c, 0x7a, 0xd1, 0x80, 0x08, 0x82, 0xca, 0x64, 0x33, 0x6c, + 0x16, 0x76, 0xe7, 0x6d, 0x77, 0x26, 0xa6, 0xeb, 0x4d, 0xbf, 0x80, 0x82, 0x5f, 0xaa, 0x17, 0xa1, + 0xe0, 0xc5, 0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4, 0x1a, 0xaf, 0xfb, + 0x51, 0xac, 0xa7, 0xb3, 0x31, 0x0d, 0x21, 0x65, 0x93, 0x22, 0x15, 0x52, 0xc5, 0x20, 0x0f, 0x8a, + 0x0f, 0xcc, 0xa9, 0xf7, 0x4a, 0x27, 0x76, 0x60, 0x4d, 0x74, 0x91, 0x09, 0x35, 0x6e, 0x99, 0x8f, + 0xf3, 0xe1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xd0, 0xea, 0xbc, 0x8a, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -279,7 +281,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, "/aib.cron.v1beta1.Query/Params", in, out, opts...) + err := c.cc.Invoke(ctx, "/wasmrollapp.cron.v1beta1.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -288,7 +290,7 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . func (c *queryClient) QueryWhitelistedContracts(ctx context.Context, in *QueryWhitelistedContractsRequest, opts ...grpc.CallOption) (*QueryWhitelistedContractsResponse, error) { out := new(QueryWhitelistedContractsResponse) - err := c.cc.Invoke(ctx, "/aib.cron.v1beta1.Query/QueryWhitelistedContracts", in, out, opts...) + err := c.cc.Invoke(ctx, "/wasmrollapp.cron.v1beta1.Query/QueryWhitelistedContracts", in, out, opts...) if err != nil { return nil, err } @@ -327,7 +329,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/aib.cron.v1beta1.Query/Params", + FullMethod: "/wasmrollapp.cron.v1beta1.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) @@ -345,7 +347,7 @@ func _Query_QueryWhitelistedContracts_Handler(srv interface{}, ctx context.Conte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/aib.cron.v1beta1.Query/QueryWhitelistedContracts", + FullMethod: "/wasmrollapp.cron.v1beta1.Query/QueryWhitelistedContracts", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).QueryWhitelistedContracts(ctx, req.(*QueryWhitelistedContractsRequest)) @@ -354,7 +356,7 @@ func _Query_QueryWhitelistedContracts_Handler(srv interface{}, ctx context.Conte } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "aib.cron.v1beta1.Query", + ServiceName: "wasmrollapp.cron.v1beta1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -367,7 +369,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "aib/cron/v1beta1/query.proto", + Metadata: "wasmrollapp/cron/v1beta1/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { diff --git a/x/cron/types/query.pb.gw.go b/x/cron/types/query.pb.gw.go index a39033f..aafa23e 100644 --- a/x/cron/types/query.pb.gw.go +++ b/x/cron/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: aib/cron/v1beta1/query.proto +// source: wasmrollapp/cron/v1beta1/query.proto /* Package types is a reverse proxy. @@ -224,9 +224,9 @@ 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{"aib", "cron", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"wasmrollapp", "cron", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueryWhitelistedContracts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"aib", "cron", "v1beta1", "whitelisted_contracts"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueryWhitelistedContracts_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"wasmrollapp", "cron", "v1beta1", "whitelisted_contracts"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/cron/types/tx.pb.go b/x/cron/types/tx.pb.go index dfe06f3..4eac9e1 100644 --- a/x/cron/types/tx.pb.go +++ b/x/cron/types/tx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: aib/cron/v1beta1/tx.proto +// source: wasmrollapp/cron/v1beta1/tx.proto package types @@ -41,7 +41,7 @@ func (m *MsgRegisterContract) Reset() { *m = MsgRegisterContract{} } func (m *MsgRegisterContract) String() string { return proto.CompactTextString(m) } func (*MsgRegisterContract) ProtoMessage() {} func (*MsgRegisterContract) Descriptor() ([]byte, []int) { - return fileDescriptor_788f49e6e4335c77, []int{0} + return fileDescriptor_7921049427efd58c, []int{0} } func (m *MsgRegisterContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -105,7 +105,7 @@ func (m *MsgRegisterContractResponse) Reset() { *m = MsgRegisterContract func (m *MsgRegisterContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgRegisterContractResponse) ProtoMessage() {} func (*MsgRegisterContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_788f49e6e4335c77, []int{1} + return fileDescriptor_7921049427efd58c, []int{1} } func (m *MsgRegisterContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -143,7 +143,7 @@ func (m *MsgDeRegisterContract) Reset() { *m = MsgDeRegisterContract{} } func (m *MsgDeRegisterContract) String() string { return proto.CompactTextString(m) } func (*MsgDeRegisterContract) ProtoMessage() {} func (*MsgDeRegisterContract) Descriptor() ([]byte, []int) { - return fileDescriptor_788f49e6e4335c77, []int{2} + return fileDescriptor_7921049427efd58c, []int{2} } func (m *MsgDeRegisterContract) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -193,7 +193,7 @@ func (m *MsgDeRegisterContractResponse) Reset() { *m = MsgDeRegisterCont func (m *MsgDeRegisterContractResponse) String() string { return proto.CompactTextString(m) } func (*MsgDeRegisterContractResponse) ProtoMessage() {} func (*MsgDeRegisterContractResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_788f49e6e4335c77, []int{3} + return fileDescriptor_7921049427efd58c, []int{3} } func (m *MsgDeRegisterContractResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -223,41 +223,41 @@ func (m *MsgDeRegisterContractResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDeRegisterContractResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgRegisterContract)(nil), "aib.cron.v1beta1.MsgRegisterContract") - proto.RegisterType((*MsgRegisterContractResponse)(nil), "aib.cron.v1beta1.MsgRegisterContractResponse") - proto.RegisterType((*MsgDeRegisterContract)(nil), "aib.cron.v1beta1.MsgDeRegisterContract") - proto.RegisterType((*MsgDeRegisterContractResponse)(nil), "aib.cron.v1beta1.MsgDeRegisterContractResponse") + proto.RegisterType((*MsgRegisterContract)(nil), "wasmrollapp.cron.v1beta1.MsgRegisterContract") + proto.RegisterType((*MsgRegisterContractResponse)(nil), "wasmrollapp.cron.v1beta1.MsgRegisterContractResponse") + proto.RegisterType((*MsgDeRegisterContract)(nil), "wasmrollapp.cron.v1beta1.MsgDeRegisterContract") + proto.RegisterType((*MsgDeRegisterContractResponse)(nil), "wasmrollapp.cron.v1beta1.MsgDeRegisterContractResponse") } -func init() { proto.RegisterFile("aib/cron/v1beta1/tx.proto", fileDescriptor_788f49e6e4335c77) } +func init() { proto.RegisterFile("wasmrollapp/cron/v1beta1/tx.proto", fileDescriptor_7921049427efd58c) } -var fileDescriptor_788f49e6e4335c77 = []byte{ - // 389 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x4d, 0x6e, 0xe2, 0x30, - 0x1c, 0xc5, 0xf1, 0x80, 0x98, 0xc1, 0x9b, 0x41, 0x99, 0x19, 0x01, 0x41, 0x64, 0x50, 0xa4, 0xaa, - 0x74, 0x41, 0xac, 0xb4, 0x27, 0xe8, 0xc7, 0xa6, 0xaa, 0xe8, 0x22, 0xea, 0xaa, 0x5d, 0x20, 0x27, - 0xb1, 0x4c, 0x24, 0x1c, 0x47, 0xb6, 0xa1, 0xa4, 0xa7, 0xe8, 0x25, 0x7a, 0x97, 0x2e, 0x59, 0x76, - 0xd7, 0x0a, 0x2e, 0x52, 0x25, 0x4e, 0xba, 0x80, 0x2c, 0x90, 0xba, 0x4a, 0xfc, 0x7f, 0xcf, 0xbf, - 0xe7, 0x27, 0x1b, 0xf6, 0x70, 0xe4, 0xa3, 0x40, 0xf0, 0x18, 0x2d, 0x5d, 0x9f, 0x28, 0xec, 0x22, - 0xb5, 0x72, 0x12, 0xc1, 0x15, 0x37, 0xda, 0x38, 0xf2, 0x9d, 0x4c, 0x72, 0x0a, 0xc9, 0xfc, 0x4b, - 0x39, 0xe5, 0xb9, 0x88, 0xb2, 0x3f, 0xed, 0x33, 0x3b, 0x01, 0x97, 0x8c, 0x4b, 0xc4, 0x24, 0x45, - 0x4b, 0x37, 0xfb, 0x14, 0x42, 0x4f, 0x0b, 0x53, 0xbd, 0x43, 0x2f, 0x0a, 0x69, 0xb0, 0x17, 0x9b, - 0x60, 0x81, 0x59, 0x21, 0xdb, 0x2f, 0x00, 0xfe, 0x99, 0x48, 0xea, 0x11, 0x1a, 0x49, 0x45, 0xc4, - 0x25, 0x8f, 0x95, 0xc0, 0x81, 0x32, 0x4e, 0x60, 0x5b, 0x92, 0x60, 0x21, 0x22, 0x95, 0x4e, 0x71, - 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4e, 0x92, 0xf1, 0x23, 0x96, 0x0c, 0xad, 0xf4, 0x13, 0xcc, - 0xae, 0x56, 0xfa, 0xcd, 0xfc, 0xe9, 0x9d, 0x7d, 0x06, 0x00, 0x00, 0xff, 0xff, 0xbb, 0xa3, 0x08, - 0x50, 0x12, 0x03, 0x00, 0x00, +var fileDescriptor_7921049427efd58c = []byte{ + // 398 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x4f, 0x6b, 0xdb, 0x30, + 0x18, 0xc6, 0xa3, 0x25, 0x64, 0x8b, 0x2e, 0x0b, 0xde, 0x46, 0x3c, 0x87, 0x78, 0x99, 0x61, 0x90, + 0x1d, 0x62, 0xe1, 0x8d, 0xb1, 0xf3, 0xfe, 0x5c, 0xc6, 0xc8, 0x0e, 0x66, 0xa7, 0xed, 0x10, 0x14, + 0x5b, 0x68, 0x86, 0xc8, 0x32, 0x92, 0x92, 0xd9, 0x3d, 0xf4, 0x33, 0xf4, 0x4b, 0xf4, 0xbb, 0xf4, + 0x98, 0x63, 0x8f, 0x25, 0xf9, 0x20, 0x2d, 0xb2, 0xec, 0x52, 0x1a, 0xa7, 0x10, 0x7a, 0xb2, 0xf5, + 0xbe, 0xcf, 0xfb, 0x7b, 0xde, 0x07, 0x09, 0xbe, 0xfd, 0x8f, 0x25, 0x13, 0x7c, 0xb9, 0xc4, 0x59, + 0x86, 0x22, 0xc1, 0x53, 0xb4, 0x0e, 0x16, 0x44, 0xe1, 0x00, 0xa9, 0xdc, 0xcf, 0x04, 0x57, 0xdc, + 0xb2, 0xef, 0x48, 0x7c, 0x2d, 0xf1, 0x2b, 0x89, 0xf3, 0x92, 0x72, 0xca, 0x4b, 0x11, 0xd2, 0x7f, + 0x46, 0xef, 0x0c, 0x22, 0x2e, 0x19, 0x97, 0x88, 0x49, 0x8a, 0xd6, 0x81, 0xfe, 0x54, 0x8d, 0xd7, + 0xa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fa, 0xf3, 0x62, 0xeb, 0x82, 0xcd, 0xd6, 0x05, 0x57, + 0x5b, 0x17, 0x9c, 0xed, 0xdc, 0xd6, 0x66, 0xe7, 0xb6, 0x2e, 0x77, 0x6e, 0xeb, 0x4f, 0x40, 0x13, + 0xf5, 0x6f, 0xb5, 0xf0, 0x23, 0xce, 0x50, 0x5c, 0x30, 0x92, 0xca, 0x84, 0xa7, 0x79, 0x71, 0x82, + 0x2a, 0x97, 0xa9, 0x76, 0x44, 0xb9, 0x79, 0xa2, 0xfa, 0xea, 0xe5, 0xa2, 0x5b, 0x3e, 0xcd, 0x8f, + 0x37, 0x01, 0x00, 0x00, 0xff, 0xff, 0x67, 0x13, 0xe3, 0x2d, 0x4a, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -286,7 +286,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) RegisterContract(ctx context.Context, in *MsgRegisterContract, opts ...grpc.CallOption) (*MsgRegisterContractResponse, error) { out := new(MsgRegisterContractResponse) - err := c.cc.Invoke(ctx, "/aib.cron.v1beta1.Msg/RegisterContract", in, out, opts...) + err := c.cc.Invoke(ctx, "/wasmrollapp.cron.v1beta1.Msg/RegisterContract", in, out, opts...) if err != nil { return nil, err } @@ -295,7 +295,7 @@ func (c *msgClient) RegisterContract(ctx context.Context, in *MsgRegisterContrac func (c *msgClient) DeRegisterContract(ctx context.Context, in *MsgDeRegisterContract, opts ...grpc.CallOption) (*MsgDeRegisterContractResponse, error) { out := new(MsgDeRegisterContractResponse) - err := c.cc.Invoke(ctx, "/aib.cron.v1beta1.Msg/DeRegisterContract", in, out, opts...) + err := c.cc.Invoke(ctx, "/wasmrollapp.cron.v1beta1.Msg/DeRegisterContract", in, out, opts...) if err != nil { return nil, err } @@ -333,7 +333,7 @@ func _Msg_RegisterContract_Handler(srv interface{}, ctx context.Context, dec fun } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/aib.cron.v1beta1.Msg/RegisterContract", + FullMethod: "/wasmrollapp.cron.v1beta1.Msg/RegisterContract", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).RegisterContract(ctx, req.(*MsgRegisterContract)) @@ -351,7 +351,7 @@ func _Msg_DeRegisterContract_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/aib.cron.v1beta1.Msg/DeRegisterContract", + FullMethod: "/wasmrollapp.cron.v1beta1.Msg/DeRegisterContract", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).DeRegisterContract(ctx, req.(*MsgDeRegisterContract)) @@ -360,7 +360,7 @@ func _Msg_DeRegisterContract_Handler(srv interface{}, ctx context.Context, dec f } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "aib.cron.v1beta1.Msg", + ServiceName: "wasmrollapp.cron.v1beta1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { @@ -373,7 +373,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "aib/cron/v1beta1/tx.proto", + Metadata: "wasmrollapp/cron/v1beta1/tx.proto", } func (m *MsgRegisterContract) Marshal() (dAtA []byte, err error) { diff --git a/x/cron/types/types.go b/x/cron/types/types.go index f5f4387..9777d3a 100644 --- a/x/cron/types/types.go +++ b/x/cron/types/types.go @@ -1,7 +1,51 @@ package types +import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "golang.org/x/exp/slices" +) + var ( ResolveSinglePlayer = []byte(`{"resolve_bet":{}}`) - SetupMultiPlayer = []byte(`{"setup_multiplayer":{}}`) - ResolveMultiPlayer = []byte(`{"resolve_multiplayer":{}}`) + SetupMultiPlayer = []byte(`{"setup_multiplayer":{}}`) + ResolveMultiPlayer = []byte(`{"resolve_multiplayer":{}}`) ) + +func NewWhitelistContract(gameId uint64, securityAddress, contractAdmin sdk.AccAddress, gameName string, contractAddress sdk.AccAddress, gameType uint64) WhitelistedContract { + return WhitelistedContract{ + GameId: gameId, + SecurityAddress: securityAddress.String(), + ContractAdmin: contractAdmin.String(), + GameName: gameName, + ContractAddress: contractAddress.String(), + GameType: gameType, + } +} + +func (m WhitelistedContract) Validate() error { + if m.GameId == 0 { + return fmt.Errorf("invalid GameId: %d", m.GameId) + } + // check if the security address is valid + if _, err := sdk.AccAddressFromBech32(m.SecurityAddress); err != nil { + return fmt.Errorf("invalid SecurityAddress: %s", m.SecurityAddress) + } + // check if the contract admin is valid + if _, err := sdk.AccAddressFromBech32(m.ContractAdmin); err != nil { + return fmt.Errorf("invalid ContractAdmin: %s", m.ContractAdmin) + } + if m.GameName == "" { + return fmt.Errorf("invalid GameName: %s", m.GameName) + } + // check if the contract address is valid + if _, err := sdk.AccAddressFromBech32(m.ContractAddress); err != nil { + return fmt.Errorf("invalid ContractAddress: %s", m.ContractAddress) + } + // check if game type does not contain 1,2,3 + if !slices.Contains([]uint64{1, 2, 3}, m.GameType) { + return fmt.Errorf("invalid GameType: %d", m.GameType) + } + + return nil +}