Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
danwt committed Jan 8, 2025
1 parent 0708a48 commit ee8a539
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions x/hub-genesis/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) {
}

// if there is no native denom, we're done
if k.GetBaseDenom(ctx) == "" {
if k.GetGenesisInfoBaseDenom(ctx) == "" {
return
}

Expand All @@ -29,7 +29,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState) {
expectedTotal = expectedTotal.Add(acc.Amount)
}

balance := k.bk.GetBalance(ctx, k.ak.GetModuleAccount(ctx, types.ModuleName).GetAddress(), k.GetBaseDenom(ctx))
balance := k.bk.GetBalance(ctx, k.ak.GetModuleAccount(ctx, types.ModuleName).GetAddress(), k.GetGenesisInfoBaseDenom(ctx))
if !balance.Amount.Equal(expectedTotal) {
panic("module account balance does not match the sum of genesis accounts")
}
Expand Down
3 changes: 2 additions & 1 deletion x/hub-genesis/keeper/genesis_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
)

// GetNativeDenom returns the native denomination.
func (k Keeper) GetBaseDenom(ctx sdk.Context) string {
// warning: returns empty from 2d->3d migrated rollapp
func (k Keeper) GetGenesisInfoBaseDenom(ctx sdk.Context) string {
return k.GetGenesisInfo(ctx).BaseDenom()
}

Expand Down
3 changes: 2 additions & 1 deletion x/hub-genesis/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func (k Keeper) GetGenesisInfo(ctx sdk.Context) types.GenesisInfo {
return gInfo
}

func (k Keeper) Tokenless(ctx sdk.Context) bool {
// can be true for tokenless rollapps or rollapps migrated from 2d to 3d
func (k Keeper) EmptyGenesisBaseDenom(ctx sdk.Context) bool {
return k.GetGenesisInfo(ctx).BaseDenom() == ""
}
2 changes: 1 addition & 1 deletion x/hub-genesis/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (m msgServer) SendTransfer(goCtx context.Context, msg *types.MsgSendTransfe
const expectedChan = "channel-0" // tokenless only

func (k Keeper) SendGenesisTransfer(ctx sdk.Context, channelID string) error {
if k.Tokenless(ctx) && channelID != expectedChan {
if k.EmptyGenesisBaseDenom(ctx) && channelID != expectedChan {
return gerrc.ErrInvalidArgument.Wrapf("tokenless chain: wrong channel id, expect: %s", expectedChan)
}
state := k.GetState(ctx)
Expand Down

0 comments on commit ee8a539

Please sign in to comment.