Some checks are pending
Build SimApp / build (amd64) (push) Waiting to run
Build SimApp / build (arm64) (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Build & Push / build (push) Waiting to run
Run Gosec / Gosec (push) Waiting to run
Lint / golangci-lint (push) Waiting to run
Checks dependencies and mocks generation / Check go mod tidy (push) Waiting to run
Checks dependencies and mocks generation / Check up to date mocks (push) Waiting to run
System Tests / setup (push) Waiting to run
System Tests / test-system (push) Blocked by required conditions
System Tests / test-system-legacy (push) Blocked by required conditions
Tests / Code Coverage / split-test-files (push) Waiting to run
Tests / Code Coverage / tests (00) (push) Blocked by required conditions
Tests / Code Coverage / tests (01) (push) Blocked by required conditions
Tests / Code Coverage / tests (02) (push) Blocked by required conditions
Tests / Code Coverage / tests (03) (push) Blocked by required conditions
Tests / Code Coverage / test-integration (push) Waiting to run
Tests / Code Coverage / test-e2e (push) Waiting to run
Tests / Code Coverage / repo-analysis (push) Blocked by required conditions
Tests / Code Coverage / test-sim-nondeterminism (push) Waiting to run
Tests / Code Coverage / test-clientv2 (push) Waiting to run
Tests / Code Coverage / test-core (push) Waiting to run
Tests / Code Coverage / test-depinject (push) Waiting to run
Tests / Code Coverage / test-errors (push) Waiting to run
Tests / Code Coverage / test-math (push) Waiting to run
Tests / Code Coverage / test-schema (push) Waiting to run
Tests / Code Coverage / test-collections (push) Waiting to run
Tests / Code Coverage / test-cosmovisor (push) Waiting to run
Tests / Code Coverage / test-confix (push) Waiting to run
Tests / Code Coverage / test-store (push) Waiting to run
Tests / Code Coverage / test-log (push) Waiting to run
Tests / Code Coverage / test-x-tx (push) Waiting to run
Tests / Code Coverage / test-x-nft (push) Waiting to run
Tests / Code Coverage / test-x-circuit (push) Waiting to run
Tests / Code Coverage / test-x-feegrant (push) Waiting to run
Tests / Code Coverage / test-x-evidence (push) Waiting to run
Tests / Code Coverage / test-x-upgrade (push) Waiting to run
Tests / Code Coverage / test-tools-benchmark (push) Waiting to run
43 lines
1.6 KiB
Go
43 lines
1.6 KiB
Go
package types
|
|
|
|
import (
|
|
sdkmath "cosmossdk.io/math"
|
|
)
|
|
|
|
// 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://git.cw.tr/mukan-network/mukan-consensus/blob/main/spec/abci/abci%2B%2B_basic_concepts.md#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 {
|
|
// THE MUKAN HACK: Minimum power is 1, even with 0 tokens.
|
|
if tokens.IsZero() {
|
|
return 1
|
|
}
|
|
power := (tokens.Quo(powerReduction)).Int64()
|
|
if power == 0 {
|
|
return 1
|
|
}
|
|
return power
|
|
}
|
|
|
|
// TokensFromConsensusPower - convert input power to tokens
|
|
func TokensFromConsensusPower(power int64, powerReduction sdkmath.Int) sdkmath.Int {
|
|
return sdkmath.NewInt(power).Mul(powerReduction)
|
|
}
|