From b0c1bb3e880f7fc6871687c9497e7eafe79c8ba7 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 9 Aug 2023 18:00:48 +0300 Subject: [PATCH 1/2] updated app.go to use RDK staking keeper --- app/app.go | 6 ++---- app/export.go | 2 +- scripts/init.sh | 11 +++++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index b46beef..404f8dc 100644 --- a/app/app.go +++ b/app/app.go @@ -64,7 +64,6 @@ import ( paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/cosmos-sdk/x/upgrade" upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" @@ -97,6 +96,7 @@ import ( _ "github.com/cosmos/cosmos-sdk/client/docs/statik" staking "github.com/dymensionxyz/dymension-rdk/x/staking" + stakingkeeper "github.com/dymensionxyz/dymension-rdk/x/staking/keeper" "github.com/dymensionxyz/dymension-rdk/x/sequencers" seqkeeper "github.com/dymensionxyz/dymension-rdk/x/sequencers/keeper" @@ -351,9 +351,7 @@ func NewRollapp( // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.StakingKeeper = *stakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks()), - ) + app.StakingKeeper = *stakingKeeper.SetHooks(app.DistrKeeper.Hooks()) app.EpochsKeeper.SetHooks( epochstypes.NewMultiEpochHooks( diff --git a/app/export.go b/app/export.go index 3cce957..f0fd297 100644 --- a/app/export.go +++ b/app/export.go @@ -33,7 +33,7 @@ func (app *App) ExportAppStateAndValidators( return servertypes.ExportedApp{}, err } - validators, err := staking.WriteValidators(ctx, app.StakingKeeper) + validators, err := staking.WriteValidators(ctx, app.StakingKeeper.Keeper) if err != nil { return servertypes.ExportedApp{}, err } diff --git a/scripts/init.sh b/scripts/init.sh index a2e38da..5b627d7 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -20,6 +20,8 @@ set_denom() { # Assuming 1,000,000 tokens #half is staked TOKEN_AMOUNT="1000000000000$DENOM" +STAKING_AMOUNT="500000000000$DENOM" + CONFIG_DIRECTORY="$ROLLAPP_CHAIN_DIR/config" GENESIS_FILE="$CONFIG_DIRECTORY/genesis.json" @@ -62,4 +64,13 @@ set_denom "$DENOM" $EXECUTABLE keys add "$KEY_NAME_ROLLAPP" --keyring-backend test $EXECUTABLE add-genesis-account "$KEY_NAME_ROLLAPP" "$TOKEN_AMOUNT" --keyring-backend test $EXECUTABLE gentx_seq --pubkey "$($EXECUTABLE dymint show-sequencer)" --from "$KEY_NAME_ROLLAPP" + +echo "Do you want to include staker on genesis? (Y/n) " +read -r answer +if [ ! "$answer" != "${answer#[Nn]}" ] ;then + $EXECUTABLE gentx "$KEY_NAME_ROLLAPP" "$STAKING_AMOUNT" --chain-id "$ROLLAPP_CHAIN_ID" --keyring-backend test --home "$ROLLAPP_CHAIN_DIR" + $EXECUTABLE collect-gentxs --home "$ROLLAPP_CHAIN_DIR" +fi + + $EXECUTABLE validate-genesis From 859764ededc2c5ba67d8003e7cd9bd62e5b60749 Mon Sep 17 00:00:00 2001 From: Michael Tsitrin Date: Wed, 9 Aug 2023 18:13:47 +0300 Subject: [PATCH 2/2] updated reference to the RDK --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c48c359..a301240 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/cosmos/cosmos-sdk v0.46.13 github.com/cosmos/ibc-go/v6 v6.1.1 - github.com/dymensionxyz/dymension-rdk v0.4.0-rc4 + github.com/dymensionxyz/dymension-rdk v0.4.0-rc1.0.20230809150756-11f18b635f36 github.com/dymensionxyz/dymint v0.5.0-rc4 github.com/gorilla/mux v1.8.0 github.com/rakyll/statik v0.1.7 diff --git a/go.sum b/go.sum index ac15e7b..2bdcbb8 100644 --- a/go.sum +++ b/go.sum @@ -480,8 +480,8 @@ github.com/dymensionxyz/cosmosclient v0.4.0-beta h1:IWyEEdvJ60n/v/DGNelD0n23lS6E github.com/dymensionxyz/cosmosclient v0.4.0-beta/go.mod h1:3y64ecWDzhnd0sSYZfaL4QpwgK0b0j6LFLVRGdygg+o= github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6 h1:dnriGXmMdYEiF/8lMrj+PDlN1vyQc6zgs/ZHL67eoyI= github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6/go.mod h1:rDkVuF+DxBDi5tTgVHFk1D2xpqf8bOccs6aB1wTOvP0= -github.com/dymensionxyz/dymension-rdk v0.4.0-rc4 h1:EiJqXDJzFURJJ4sBQQznUTa7FWg8jqZchHjcM/i4brU= -github.com/dymensionxyz/dymension-rdk v0.4.0-rc4/go.mod h1:WnVuK8nbDkuHFfTZfboIEZBu49h2c/3chJC7TKSJc5c= +github.com/dymensionxyz/dymension-rdk v0.4.0-rc1.0.20230809150756-11f18b635f36 h1:OWhEoH+2SI+1e5+XGlWUWjxh9Sw8s6fQm76vJTKcnJs= +github.com/dymensionxyz/dymension-rdk v0.4.0-rc1.0.20230809150756-11f18b635f36/go.mod h1:7jBUHXPco3E2GT6oAkzARnLfqg6a6IjmoUSFPOArrTg= github.com/dymensionxyz/dymint v0.5.0-rc4 h1:wx6Be6O8rtOf+klDAMwv+tbfiJiyKEqiK69f9114KoE= github.com/dymensionxyz/dymint v0.5.0-rc4/go.mod h1:wwYbbeqhzANMDbpAaZLTTpypDvfQmt0+WuIiaT3xWQk= github.com/dymensionxyz/ibc-go/v6 v6.0.0-rc0.0.20230619115257-1a1038e16d71 h1:T04fab8CTYu+FR6mAC/nYB78WtHM4YsI99ikrYydncM=