github.com/cosmos/cosmos-sdk@v0.50.10/types/staking.go (about) 1 package types 2 3 import ( 4 sdkmath "cosmossdk.io/math" 5 ) 6 7 // Delay, in blocks, between when validator updates are returned to the 8 // consensus-engine and when they are applied. For example, if 9 // ValidatorUpdateDelay is set to X, and if a validator set update is 10 // returned with new validators at the end of block 10, then the new 11 // validators are expected to sign blocks beginning at block 11+X. 12 // 13 // This value is constant as this should not change without a hard fork. 14 // For CometBFT this should be set to 1 block, for more details see: 15 // https://github.com/cometbft/cometbft/blob/main/spec/abci/abci%2B%2B_basic_concepts.md#consensusblock-execution-methods 16 const ValidatorUpdateDelay int64 = 1 17 18 var ( 19 // DefaultBondDenom is the default bondable coin denomination (defaults to stake) 20 // Overwriting this value has the side effect of changing the default denomination in genesis 21 DefaultBondDenom = "stake" 22 23 // DefaultPowerReduction is the default amount of staking tokens required for 1 unit of consensus-engine power 24 DefaultPowerReduction = sdkmath.NewIntFromUint64(1000000) 25 ) 26 27 // TokensToConsensusPower - convert input tokens to potential consensus-engine power 28 func TokensToConsensusPower(tokens, powerReduction sdkmath.Int) int64 { 29 return (tokens.Quo(powerReduction)).Int64() 30 } 31 32 // TokensFromConsensusPower - convert input power to tokens 33 func TokensFromConsensusPower(power int64, powerReduction sdkmath.Int) sdkmath.Int { 34 return sdkmath.NewInt(power).Mul(powerReduction) 35 }