From 4134eca66603b157a5932910f3f0b505e88d188a Mon Sep 17 00:00:00 2001 From: ThanhNhann Date: Tue, 1 Oct 2024 01:31:53 +0700 Subject: [PATCH] fix capability --- app/app.go | 2 -- x/oracle/module/genesis.go | 2 +- x/oracle/proposal_handler.go | 2 +- x/oracle/proposal_handler_test.go | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/app.go b/app/app.go index c11e1a4..3133612 100644 --- a/app/app.go +++ b/app/app.go @@ -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 } diff --git a/x/oracle/module/genesis.go b/x/oracle/module/genesis.go index 53c02fb..5421070 100644 --- a/x/oracle/module/genesis.go +++ b/x/oracle/module/genesis.go @@ -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) diff --git a/x/oracle/proposal_handler.go b/x/oracle/proposal_handler.go index a21daa5..7f9b582 100644 --- a/x/oracle/proposal_handler.go +++ b/x/oracle/proposal_handler.go @@ -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) diff --git a/x/oracle/proposal_handler_test.go b/x/oracle/proposal_handler_test.go index 312452b..adddc82 100644 --- a/x/oracle/proposal_handler_test.go +++ b/x/oracle/proposal_handler_test.go @@ -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)