Skip to content

Commit

Permalink
fix strange address name conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Nov 29, 2023
1 parent fe1fe03 commit c3ef701
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions x/common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const (
// TO_MICRO: multiplier for converting between units and micro-units.
TO_MICRO = int64(1_000_000)

NibiruTeam = "nibi1l8dxzwz9d4peazcqjclnkj2mhvtj7mpnkqx85mg0ndrlhwrnh7gskkzg0v"
NIBIRU_TEAM = "nibi1l8dxzwz9d4peazcqjclnkj2mhvtj7mpnkqx85mg0ndrlhwrnh7gskkzg0v"
)

func NibiruTeamAddr() sdk.AccAddress {
return sdk.MustAccAddressFromBech32(NibiruTeam)
return sdk.MustAccAddressFromBech32(NIBIRU_TEAM)
}
6 changes: 6 additions & 0 deletions x/common/testutil/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package testutil

const (
ADDR_GUARD_CREAM = "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl"
ADDR_SUDO_ROOT = "nibi1qqx5reauy4glpskmppy88pz25qp2py5yxvpxdt"
)
4 changes: 2 additions & 2 deletions x/common/testutil/testapp/testapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/NibiruChain/nibiru/app"
"github.com/NibiruChain/nibiru/x/common/asset"
"github.com/NibiruChain/nibiru/x/common/denoms"
"github.com/NibiruChain/nibiru/x/common/testutil"
epochstypes "github.com/NibiruChain/nibiru/x/epochs/types"
inflationtypes "github.com/NibiruChain/nibiru/x/inflation/types"
"github.com/NibiruChain/nibiru/x/perp/v2/types"
Expand Down Expand Up @@ -52,7 +53,6 @@ func NewContext(nibiru *app.NibiruApp) sdk.Context {

// DefaultSudoers: State for the x/sudo module for the default test app.
func DefaultSudoers() sudotypes.Sudoers {
EnsureNibiruPrefix()
addr := DefaultSudoRoot().String()
return sudotypes.Sudoers{
Root: addr,
Expand All @@ -61,7 +61,7 @@ func DefaultSudoers() sudotypes.Sudoers {
}

func DefaultSudoRoot() sdk.AccAddress {
return sdk.MustAccAddressFromBech32("nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl")
return sdk.MustAccAddressFromBech32(testutil.ADDR_SUDO_ROOT)
}

// NewNibiruTestAppAndZeroTimeCtx: Runs NewNibiruTestAppAndZeroTimeCtx with the
Expand Down
4 changes: 2 additions & 2 deletions x/perp/v2/integration/action/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (c setCollateral) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, err
if err != nil {
return ctx, err, true
}
sudoers.Root = common.NibiruTeam
sudoers.Root = common.NIBIRU_TEAM
app.SudoKeeper.Sudoers.Set(ctx, sudoers)

senderAddr, err := sdk.AccAddressFromBech32(c.Sender)
Expand All @@ -221,6 +221,6 @@ func (c setCollateral) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, err
func SetCollateral(denom string) action.Action {
return setCollateral{
Denom: denom,
Sender: common.NibiruTeam,
Sender: common.NIBIRU_TEAM,
}
}
2 changes: 1 addition & 1 deletion x/perp/v2/module/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func RunTestGenesis(t *testing.T, tc TestCase) {
pair := asset.Registry.Pair(denoms.BTC, denoms.NUSD)

// Initialize sudo state
nibiruTeam := common.NibiruTeam
nibiruTeam := common.NIBIRU_TEAM
sudoers := PerpSudoers()
sudoersRoot := sdk.MustAccAddressFromBech32(nibiruTeam)
sudoers.Root = sudoersRoot.String()
Expand Down
1 change: 1 addition & 0 deletions x/spot/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
)

func TestGenesis(t *testing.T) {
testapp.EnsureNibiruPrefix()
genesisState := types.GenesisState{
Params: types.DefaultParams(),
Pools: []types.Pool{
Expand Down
1 change: 1 addition & 0 deletions x/spot/keeper/balances_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func TestCheckBalances(t *testing.T) {
for _, tc := range tests {
tc := tc
t.Run(tc.name, func(t *testing.T) {
testapp.EnsureNibiruPrefix()
app, ctx := testapp.NewNibiruTestAppAndContext()

// fund user account
Expand Down

0 comments on commit c3ef701

Please sign in to comment.