cosmos-sdk/types/staking.go
sashass1315 7032eadf9b
docs: fix broken links across various documentation files (#25057)
Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
2025-08-11 20:21:03 +00:00

36 lines
1.5 KiB
Go

package types
import (
sdkmath "cosmossdk.io/math"
)
// ValidatorUpdateDelay is the delay, in blocks, between when validator updates are returned to the
// consensus-engine and when they are applied. For example, if
// ValidatorUpdateDelay is set to X, and if a validator set update is
// returned with new validators at the end of block 10, then the new
// validators are expected to sign blocks beginning at block 11+X.
//
// This value is constant as this should not change without a hard fork.
// For CometBFT this should be set to 1 block, for more details see:
// https://docs.cometbft.com/v0.38/spec/abci/abci++_basic_concepts#consensusblock-execution-methods
const ValidatorUpdateDelay int64 = 1
var (
// DefaultBondDenom is the default bondable coin denomination (defaults to stake)
// Overwriting this value has the side effect of changing the default denomination in genesis
DefaultBondDenom = "stake"
// DefaultPowerReduction is the default amount of staking tokens required for 1 unit of consensus-engine power
DefaultPowerReduction = sdkmath.NewIntFromUint64(1000000)
)
// TokensToConsensusPower - convert input tokens to potential consensus-engine power
func TokensToConsensusPower(tokens, powerReduction sdkmath.Int) int64 {
return (tokens.Quo(powerReduction)).Int64()
}
// TokensFromConsensusPower - convert input power to tokens
func TokensFromConsensusPower(power int64, powerReduction sdkmath.Int) sdkmath.Int {
return sdkmath.NewInt(power).Mul(powerReduction)
}