Skip to content

Commit

Permalink
Modify ICS Params in v20 Migration (#1157)
Browse files Browse the repository at this point in the history
Co-authored-by: sampocs <[email protected]>
Co-authored-by: sampocs <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent 5fc2bda commit 35ab2fb
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 10 deletions.
39 changes: 38 additions & 1 deletion app/upgrades/v20/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package v20

import (
"time"

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -83,8 +85,43 @@ func MigrateICSOutstandingDowntime(ctx sdk.Context, ck ccvconsumerkeeper.Keeper)
}

// Migrates ICS Params to add the new RetryDelayParam
// Because RetryDelayPeriod isn't in the store yet, we can't call
// ck.GetConsumerParams(ctx) and modify the RetryDelayPeriod,
// as calling ck.GetConsumerParams(ctx) will panic if the param isn't in the store.
// Instead, we get the DefaultParams and modify each value to
// their value directly before the v20 upgrade
func MigrateICSParams(ctx sdk.Context, ck ccvconsumerkeeper.Keeper) {
params := ck.GetConsumerParams(ctx)
// Get default consumer params and set the new RetryDelayPeriod
params := ccvtypes.DefaultParams()
params.RetryDelayPeriod = ccvtypes.DefaultRetryDelayPeriod
// Modify to the correct params values
params.Enabled = true
params.BlocksPerDistributionTransmission = 1000
params.DistributionTransmissionChannel = "channel-0"
params.ProviderFeePoolAddrStr = "cosmos1ap0mh6xzfn8943urr84q6ae7zfnar48am2erhd"
params.CcvTimeoutPeriod = time.Second * 2419200
params.TransferTimeoutPeriod = time.Second * 3600
params.ConsumerRedistributionFraction = "0.85"
params.HistoricalEntries = 10000
params.UnbondingPeriod = time.Second * 1209600
params.SoftOptOutThreshold = "0.05"
params.RewardDenoms = []string{
"stucmdx",
"stuatom",
"staevmos",
"stinj",
"stujuno",
"stuosmo",
"stuluna",
"stusomm",
"stustars",
"stuumee",
"ustrd",
"stadydx",
"stutia",
"stadym",
}
params.ProviderRewardDenoms = []string{}
// Set the new params
ck.SetParams(ctx, params)
}
2 changes: 1 addition & 1 deletion dockernet/src/register_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi
echo "$CHAIN - Registering host zone..."
$STRIDE_MAIN_CMD tx stakeibc register-host-zone \
$CONNECTION $HOST_DENOM $ADDRESS_PREFIX $IBC_DENOM $CHANNEL 1 $LSM_ENABLED $COMMUNITY_POOL_TREASURY_ADDRESS \
--gas 1000000 --from $STRIDE_ADMIN_ACCT --home $DOCKERNET_HOME/state/stride1 -y | TRIM_TX
--gas 2000000 --from $STRIDE_ADMIN_ACCT --home $DOCKERNET_HOME/state/stride1 -y | TRIM_TX
sleep 10

# Build array of validators of the form:
Expand Down
2 changes: 0 additions & 2 deletions dockernet/start_network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ done


# Start each chain, create the transfer channels and start the relayers
# For dydx, sleep before and after the relayers are setup to get it some time to startup
# since it's a computationally expensive chain
bash $SRC/start_chain.sh
bash $SRC/start_relayers.sh

Expand Down
6 changes: 0 additions & 6 deletions x/stakeibc/keeper/reward_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ type ForwardMetadata struct {
Retries int64 `json:"retries"`
}

type FeeInfo struct {
RebateAmount sdkmath.Int
StrideFeeAmount sdkmath.Int
ReinvestAmount sdkmath.Int
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The goal of this code is to allow certain reward token types to be automatically traded into other types
// This happens before the rest of the staking, allocation, distribution etc. would continue as normal
Expand Down

0 comments on commit 35ab2fb

Please sign in to comment.