Skip to content

Commit

Permalink
changes default power reduction to 10^18 (#99)
Browse files Browse the repository at this point in the history
Issue with validator power reduction causing an over flow, with 10^18,
we halted.

After researching, looks like it is an issue with the validator power
reduction calculations, causing an overflow in CometBFT.


Discussion
cosmos/cosmos-sdk#8357


Sifchain, BNB Greenfield, Ethermint all 10^18


https://github.com/search?q=NewIntFromBigInt%28new%28big.Int%29.Exp%28big.NewInt%2810%29%2C+big.NewInt%2818%29%2C+nil%29%29&type=code

Signed-off-by: Derek Anderson <derek@upshot.xyz>
  • Loading branch information
dmikey authored Apr 1, 2024
1 parent 8db5e72 commit abc68a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ package app

import (
_ "embed"
"io"
"math/big"
"os"
"path/filepath"

"github.com/allora-network/allora-chain/x/emissions"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
"io"
"os"
"path/filepath"

dbm "github.com/cosmos/cosmos-db"

"cosmossdk.io/core/appconfig"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/math"

storetypes "cosmossdk.io/store/types"
upgradekeeper "cosmossdk.io/x/upgrade/keeper"
Expand All @@ -24,6 +27,8 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/runtime"
"github.com/cosmos/cosmos-sdk/server"
Expand Down Expand Up @@ -120,6 +125,7 @@ type AlloraApp struct {
}

func init() {
sdk.DefaultPowerReduction = math.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
userHomeDir, err := os.UserHomeDir()
if err != nil {
panic(err)
Expand Down

0 comments on commit abc68a1

Please sign in to comment.