Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ibchooks tests #1980

Merged
merged 14 commits into from
May 17, 2024
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,11 @@ jobs:
# TODO[1760]: Re-analyze how long tests tests take and change the splitting back to be based on speed.
run: |
grep -vF \
-e 'github.com/provenance-io/provenance/x/ibchooks' \
-e 'github.com/provenance-io/provenance/x/ibcratelimit/module' \
-e 'github.com/provenance-io/provenance/x/ibcratelimit/simulation' \
-e 'github.com/provenance-io/provenance/x/oracle/simulation' \
pkgs.txt > pkgs.txt.tmp
split -d -n l/3 pkgs.txt.tmp pkgs.txt.part.
printf '%s\n' \
'github.com/provenance-io/provenance/x/ibchooks' \
'github.com/provenance-io/provenance/x/ibcratelimit/module' \
'github.com/provenance-io/provenance/x/ibcratelimit/simulation' \
'github.com/provenance-io/provenance/x/oracle/simulation' \
> pkgs.txt.part.03
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* Switch to auto-generated `String` and `Equal` methods for most proto messages [#1957](https://github.com/provenance-io/provenance/pull/1957).
* Clean up the marker module's expected BankKeeper interface [#1954](https://github.com/provenance-io/provenance/pull/1954).
* Add the auto-cli commands and a few others newly added by the SDK [#1971](https://github.com/provenance-io/provenance/pull/1971).
* Fix unit tests for ibcratelimit [#1977](https://github.com/provenance-io/provenance/pull/1977).
* * Fix unit tests for ibchooks [#1980](https://github.com/provenance-io/provenance/pull/1980).
Taztingo marked this conversation as resolved.
Show resolved Hide resolved

### Client Breaking

Expand Down
18 changes: 11 additions & 7 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ import (
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types"

simappparams "github.com/provenance-io/provenance/app/params"
Expand Down Expand Up @@ -287,11 +288,12 @@ type App struct {
ScopedICQKeeper capabilitykeeper.ScopedKeeper
ScopedOracleKeeper capabilitykeeper.ScopedKeeper

TransferStack *ibchooks.IBCMiddleware
Ics20WasmHooks *ibchooks.WasmHooks
Ics20MarkerHooks *ibchooks.MarkerHooks
IbcHooks *ibchooks.IbcHooks
HooksICS4Wrapper ibchooks.ICS4Middleware
TransferStack *ibchooks.IBCMiddleware
Ics20WasmHooks *ibchooks.WasmHooks
Ics20MarkerHooks *ibchooks.MarkerHooks
IbcHooks *ibchooks.IbcHooks
HooksICS4Wrapper ibchooks.ICS4Middleware
RateLimitMiddleware porttypes.Middleware

// the module manager
mm *module.Manager
Expand Down Expand Up @@ -542,8 +544,8 @@ func New(
)
app.TransferKeeper = &transferKeeper
transferModule := ibctransfer.NewIBCModule(*app.TransferKeeper)
rateLimitingTransferModule = *rateLimitingTransferModule.WithIBCModule(transferModule)
hooksTransferModule := ibchooks.NewIBCMiddleware(&rateLimitingTransferModule, &app.HooksICS4Wrapper)
app.RateLimitMiddleware = rateLimitingTransferModule.WithIBCModule(transferModule)
hooksTransferModule := ibchooks.NewIBCMiddleware(app.RateLimitMiddleware, &app.HooksICS4Wrapper)
app.TransferStack = &hooksTransferModule

app.NameKeeper = namekeeper.NewKeeper(appCodec, keys[nametypes.StoreKey])
Expand Down Expand Up @@ -775,6 +777,7 @@ func New(
ibctransfer.NewAppModule(*app.TransferKeeper),
icqModule,
icaModule,
ibctm.AppModule{},
)

// BasicModuleManager defines the module BasicManager is in charge of setting up basic,
Expand Down Expand Up @@ -950,6 +953,7 @@ func New(
paramstypes.ModuleName,
slashingtypes.ModuleName,
stakingtypes.ModuleName,
ibctm.ModuleName,
ibctransfertypes.ModuleName,
upgradetypes.ModuleName,
vestingtypes.ModuleName,
Expand Down
6 changes: 4 additions & 2 deletions internal/antewrapper/msg_fees_decorator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package antewrapper

import (
"strings"

sdkmath "cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -77,9 +79,9 @@ func (mfd MsgFeesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool

// This check for chain-id is exclusively for not breaking all existing sim tests which freak out when denom is anything other than stake.
// and some network tests won't work without a chain id being set(but they also setup everything with stake denom) so `simapp-unit-testing` chain id is skipped also.
// This only needs to work to pio-testnet and pio-mainnet, so this is safe.
// This only needs to work to pio-testnet, pio-mainnet, and ibc tests, so this is safe.
func isTestContext(ctx sdk.Context) bool {
return len(ctx.ChainID()) == 0 || ctx.ChainID() == SimAppChainID || ctx.ChainID() == pioconfig.SimAppChainID
return len(ctx.ChainID()) == 0 || ctx.ChainID() == SimAppChainID || ctx.ChainID() == pioconfig.SimAppChainID || strings.HasPrefix(ctx.ChainID(), "testchain")
}

// EnsureSufficientFloorAndMsgFees verifies that the given transaction has supplied
Expand Down
Loading
Loading