Skip to content

Commit

Permalink
add consumer chain unbonding period tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
sainoe committed Sep 12, 2022
1 parent 0aae6f1 commit 1162655
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 4 additions & 0 deletions x/ccv/consumer/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types

import (
"encoding/binary"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
Expand All @@ -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
Expand Down
17 changes: 11 additions & 6 deletions x/ccv/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
}
}

0 comments on commit 1162655

Please sign in to comment.