From 1162655c89221588d4b440717b2ca1c65170aec2 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 12 Sep 2022 14:21:05 +0200 Subject: [PATCH] add consumer chain unbonding period tweak --- x/ccv/consumer/types/keys.go | 4 ++++ x/ccv/utils/utils.go | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/x/ccv/consumer/types/keys.go b/x/ccv/consumer/types/keys.go index 0a037f2e7f..390419e882 100644 --- a/x/ccv/consumer/types/keys.go +++ b/x/ccv/consumer/types/keys.go @@ -2,6 +2,7 @@ package types import ( "encoding/binary" + "time" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/address" @@ -28,6 +29,9 @@ const ( // ConsumerToSendToProviderName is a "buffer" address for outgoing fees to be transferred to the provider chain ConsumerToSendToProviderName = "cons_to_send_to_provider" + + // UnbondingPeriod is the time duration to mature the VSC packets + UnbondingPeriod time.Duration = 48 * time.Hour ) // Iota generated keys/key prefixes (as a byte), supports 256 possible values diff --git a/x/ccv/utils/utils.go b/x/ccv/utils/utils.go index 6caed432d6..b70eec611a 100644 --- a/x/ccv/utils/utils.go +++ b/x/ccv/utils/utils.go @@ -9,6 +9,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" ccv "github.com/cosmos/interchain-security/x/ccv/types" abci "github.com/tendermint/tendermint/abci/types" ) @@ -91,15 +92,19 @@ func ComputeConsumerUnbondingPeriod(providerUnbondingPeriod time.Duration) time. // In general, the unbonding period on the consumer // is one day less than the unbonding period on the provider return providerUnbondingPeriod - 24*time.Hour // one day less - } else if providerUnbondingPeriod >= 24*time.Hour { - // If the unbonding period on the provider is - // between one day and one week, then the unbonding period - // on the consumer is one hour less - return providerUnbondingPeriod - time.Hour // one hour less + // } else if providerUnbondingPeriod >= 24*time.Hour { + // // If the unbonding period on the provider is + // // between one day and one week, then the unbonding period + // // on the consumer is one hour less + // return providerUnbondingPeriod - time.Hour // one hour less } else { // If the unbonding period on the provider is // less than one day, then the unbonding period // on the consumer is the same as on the provider - return providerUnbondingPeriod + //return providerUnbondingPeriod + + // Use a hardcoded consumer unbonding period of 10mins in order + // to be bigger duration than on the provider + return consumertypes.UnbondingPeriod } }