Skip to content

Commit

Permalink
fix capability
Browse files Browse the repository at this point in the history
  • Loading branch information
ThanhNhann committed Sep 30, 2024
1 parent 555d1b8 commit 4134eca
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,7 @@ func (app *App) GetIBCKeeper() *ibckeeper.Keeper {
// GetCapabilityScopedKeeper returns the capability scoped keeper.
func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper {
sk, ok := app.ScopedKeepers[moduleName]
println("check module: ", moduleName)
if !ok {
println("go to module: ", moduleName)
sk = app.CapabilityKeeper.ScopeToModule(moduleName)
app.ScopedKeepers[moduleName] = sk
}
Expand Down
2 changes: 1 addition & 1 deletion x/oracle/module/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisSta
if genState.BandParams.IbcPortId != "" {
k.SetPort(ctx, genState.BandParams.IbcPortId)
// Only try to bind to port if it is not already bound, since we may already own port capability
if !k.ShouldBound(ctx, genState.BandParams.IbcPortId) {
if k.ShouldBound(ctx, genState.BandParams.IbcPortId) {
// module binds to the port on InitChain
// and claims the returned capability
err := k.BindPort(ctx, genState.BandParams.IbcPortId)
Expand Down
2 changes: 1 addition & 1 deletion x/oracle/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func handleUpdateBandParamsProposal(ctx sdk.Context, k keeper.Keeper, p *types.U

k.SetPort(ctx, p.BandParams.IbcPortId)
// Only try to bind to port if it is not already bound, since we may already own port capability
if !k.ShouldBound(ctx, p.BandParams.IbcPortId) {
if k.ShouldBound(ctx, p.BandParams.IbcPortId) {
// module binds to the port on InitChain
// and claims the returned capability
err := k.BindPort(ctx, p.BandParams.IbcPortId)
Expand Down
2 changes: 1 addition & 1 deletion x/oracle/proposal_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestUpdateBandParamsProposal(t *testing.T) {
require.Equal(t, new_BandParams.IbcPortId, portID)

isBound := app.OracleKeeper.ShouldBound(ctx, portID)
require.True(t, isBound)
require.False(t, isBound)

bandParams = app.OracleKeeper.GetBandParams(ctx)
require.Equal(t ,new_BandParams, bandParams)
Expand Down

0 comments on commit 4134eca

Please sign in to comment.