Skip to content

Commit

Permalink
Merge pull request #12 from realiotech/feature/realio-cosmos-sdk
Browse files Browse the repository at this point in the history
modify power reduction base unit to 10^18
  • Loading branch information
jiujiteiro authored Sep 1, 2022
2 parents fcfa916 + b0be272 commit e4ed85f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func Setup(isCheckTx bool) *SimApp {

// SetupWithGenesisValSet initializes a new SimApp with a validator set and genesis accounts
// that also act as delegators. For simplicity, each validator is bonded with a delegation
// of one consensus engine unit (10^6) in the default token of the simapp from first genesis
// of one consensus engine unit (10^18) in the default token of the simapp from first genesis
// account. A Nop logger is set in SimApp.
func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *SimApp {
app, genesisState := setup(true, 5)
Expand All @@ -97,7 +97,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs
validators := make([]stakingtypes.Validator, 0, len(valSet.Validators))
delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators))

bondAmt := sdk.NewInt(1000000)
bondAmt := sdk.NewInt(1000000000000000000)

for _, val := range valSet.Validators {
pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
Expand Down
2 changes: 1 addition & 1 deletion types/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (
)

// DefaultPowerReduction is the default amount of staking tokens required for 1 unit of consensus-engine power
var DefaultPowerReduction = NewIntFromUint64(1000000)
var DefaultPowerReduction = NewIntFromUint64(1000000000000000000)

// TokensToConsensusPower - convert input tokens to potential consensus-engine power
func TokensToConsensusPower(tokens Int, powerReduction Int) int64 {
Expand Down
2 changes: 1 addition & 1 deletion x/staking/types/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func (v Validator) BondedTokens() sdk.Int {
return sdk.ZeroInt()
}

// ConsensusPower gets the consensus-engine power. Aa reduction of 10^6 from
// ConsensusPower gets the consensus-engine power. Aa reduction of 10^18 from
// validator tokens is applied
func (v Validator) ConsensusPower(r sdk.Int) int64 {
if v.IsBonded() {
Expand Down

0 comments on commit e4ed85f

Please sign in to comment.