From 3d998da19d154aa05e42b22bd21426f92365d8f1 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Tue, 3 Oct 2023 10:34:43 -0500 Subject: [PATCH] move to v18 namespace + upgrade --- app/upgrades/v18/constants.go | 5 ++++- app/upgrades/v18/upgrades.go | 9 ++++++++- x/cw-hooks/client/cli/query.go | 2 +- x/cw-hooks/client/cli/tx.go | 2 +- x/cw-hooks/genesis.go | 4 ++-- x/cw-hooks/keeper/gov_hooks.go | 2 +- x/cw-hooks/keeper/keeper_test.go | 6 +++--- x/cw-hooks/keeper/msg_server.go | 2 +- x/cw-hooks/keeper/msg_server_test.go | 2 +- x/cw-hooks/keeper/params.go | 2 +- x/cw-hooks/keeper/querier.go | 2 +- x/cw-hooks/keeper/querier_test.go | 2 +- x/cw-hooks/keeper/staking_hooks.go | 2 +- x/cw-hooks/module.go | 6 +++--- x/cw-hooks/script.sh | 4 +++- 15 files changed, 32 insertions(+), 20 deletions(-) diff --git a/app/upgrades/v18/constants.go b/app/upgrades/v18/constants.go index f8924b264..9f38f6b5c 100644 --- a/app/upgrades/v18/constants.go +++ b/app/upgrades/v18/constants.go @@ -4,6 +4,7 @@ import ( store "github.com/cosmos/cosmos-sdk/store/types" "github.com/CosmosContracts/juno/v18/app/upgrades" + cwhooks "github.com/CosmosContracts/juno/v18/x/cw-hooks" ) // UpgradeName defines the on-chain upgrade name for the upgrade. @@ -13,6 +14,8 @@ var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, CreateUpgradeHandler: CreateV18UpgradeHandler, StoreUpgrades: store.StoreUpgrades{ - Added: []string{}, + Added: []string{ + cwhooks.ModuleName, + }, }, } diff --git a/app/upgrades/v18/upgrades.go b/app/upgrades/v18/upgrades.go index 2a2b868a1..52e5946d6 100644 --- a/app/upgrades/v18/upgrades.go +++ b/app/upgrades/v18/upgrades.go @@ -9,12 +9,13 @@ import ( "github.com/CosmosContracts/juno/v18/app/keepers" "github.com/CosmosContracts/juno/v18/app/upgrades" + cwhookstypes "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) func CreateV18UpgradeHandler( mm *module.Manager, cfg module.Configurator, - _ *keepers.AppKeepers, + k *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { logger := ctx.Logger().With("upgrade", UpgradeName) @@ -30,6 +31,12 @@ func CreateV18UpgradeHandler( } logger.Info(fmt.Sprintf("post migrate version map: %v", versionMap)) + // x/cw-hooks + gas_limit := uint64(250_000) + if err := k.CWHooksKeeper.SetParams(ctx, cwhookstypes.NewParams(gas_limit)); err != nil { + return nil, err + } + return versionMap, err } } diff --git a/x/cw-hooks/client/cli/query.go b/x/cw-hooks/client/cli/query.go index 2ef89f7dd..3212bdc2d 100644 --- a/x/cw-hooks/client/cli/query.go +++ b/x/cw-hooks/client/cli/query.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) func GetQueryCmd() *cobra.Command { diff --git a/x/cw-hooks/client/cli/tx.go b/x/cw-hooks/client/cli/tx.go index 6e0d8e004..ace538674 100644 --- a/x/cw-hooks/client/cli/tx.go +++ b/x/cw-hooks/client/cli/tx.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) // NewTxCmd returns a root CLI command handler for modules diff --git a/x/cw-hooks/genesis.go b/x/cw-hooks/genesis.go index 7209558c1..90e5b13ff 100644 --- a/x/cw-hooks/genesis.go +++ b/x/cw-hooks/genesis.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/keeper" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/keeper" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) // NewGenesisState - Create a new genesis state diff --git a/x/cw-hooks/keeper/gov_hooks.go b/x/cw-hooks/keeper/gov_hooks.go index b3973899b..4ec043a95 100644 --- a/x/cw-hooks/keeper/gov_hooks.go +++ b/x/cw-hooks/keeper/gov_hooks.go @@ -9,7 +9,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) type GovHooks struct { diff --git a/x/cw-hooks/keeper/keeper_test.go b/x/cw-hooks/keeper/keeper_test.go index fe87b13a5..716baa165 100644 --- a/x/cw-hooks/keeper/keeper_test.go +++ b/x/cw-hooks/keeper/keeper_test.go @@ -18,9 +18,9 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - "github.com/CosmosContracts/juno/v17/app" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/keeper" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/app" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/keeper" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) var _ = embed.FS{} diff --git a/x/cw-hooks/keeper/msg_server.go b/x/cw-hooks/keeper/msg_server.go index 2d03fd8ab..356d18933 100644 --- a/x/cw-hooks/keeper/msg_server.go +++ b/x/cw-hooks/keeper/msg_server.go @@ -9,7 +9,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) var _ types.MsgServer = &msgServer{} diff --git a/x/cw-hooks/keeper/msg_server_test.go b/x/cw-hooks/keeper/msg_server_test.go index a63610999..fa5858e61 100644 --- a/x/cw-hooks/keeper/msg_server_test.go +++ b/x/cw-hooks/keeper/msg_server_test.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) func (s *IntegrationTestSuite) TestRegisterContracts() { diff --git a/x/cw-hooks/keeper/params.go b/x/cw-hooks/keeper/params.go index 70824a906..83759fc38 100644 --- a/x/cw-hooks/keeper/params.go +++ b/x/cw-hooks/keeper/params.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) // SetParams sets the x/cw-hooks module parameters. diff --git a/x/cw-hooks/keeper/querier.go b/x/cw-hooks/keeper/querier.go index e5ac8e0e9..03512e036 100644 --- a/x/cw-hooks/keeper/querier.go +++ b/x/cw-hooks/keeper/querier.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) var _ types.QueryServer = &Querier{} diff --git a/x/cw-hooks/keeper/querier_test.go b/x/cw-hooks/keeper/querier_test.go index c5d774061..8f8a4b9fd 100644 --- a/x/cw-hooks/keeper/querier_test.go +++ b/x/cw-hooks/keeper/querier_test.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) func (s *IntegrationTestSuite) TestContracts() { diff --git a/x/cw-hooks/keeper/staking_hooks.go b/x/cw-hooks/keeper/staking_hooks.go index 974c242d5..b85bb3e10 100644 --- a/x/cw-hooks/keeper/staking_hooks.go +++ b/x/cw-hooks/keeper/staking_hooks.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) // TODO: return nil on unmarshal or err? diff --git a/x/cw-hooks/module.go b/x/cw-hooks/module.go index c5f9d75b7..79cedf960 100644 --- a/x/cw-hooks/module.go +++ b/x/cw-hooks/module.go @@ -18,9 +18,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/client/cli" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/keeper" - "github.com/CosmosContracts/juno/v17/x/cw-hooks/types" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/client/cli" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/keeper" + "github.com/CosmosContracts/juno/v18/x/cw-hooks/types" ) const ( diff --git a/x/cw-hooks/script.sh b/x/cw-hooks/script.sh index 0940c13b0..881a50ac0 100644 --- a/x/cw-hooks/script.sh +++ b/x/cw-hooks/script.sh @@ -1,7 +1,7 @@ -export JUNOD_NODE="tcp://localhost:26657" # upload the smart contract, then create a validator. Confirm it works +export JUNOD_NODE="tcp://localhost:26657" FLAGS="--from=juno1 --gas=2500000 --fees=50000ujuno --node=http://localhost:26657 --yes --keyring-backend=test --home $HOME/.juno1 --chain-id=local-1 --output=json" junod tx wasm store ./keeper/contract/juno_staking_hooks_example.wasm $FLAGS @@ -28,3 +28,5 @@ junod q wasm contract-state smart $addr '{"last_delegation_change":{}}' --node=h # create validator junod tx staking create-validator --amount 1ujuno --commission-rate="0.05" --commission-max-rate="1.0" --commission-max-change-rate="1.0" --moniker="test123" --from=juno2 --pubkey=$(junod tendermint show-validator --home $HOME/.juno) --min-self-delegation="1" --gas=1000000 --fees=50000ujuno --node=http://localhost:26657 --yes --keyring-backend=test --home $HOME/.juno1 --chain-id=local-1 --output=json + +# junod export --output-document=$HOME/Desktop/export.json --home=$HOME/.juno1 \ No newline at end of file