Skip to content

Commit f7aad31

Browse files
committed
format
1 parent 7a345f6 commit f7aad31

5 files changed

Lines changed: 13 additions & 9 deletions

File tree

tests/integration/warp_util.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package integration
22

33
import (
4+
"fmt"
5+
46
"cosmossdk.io/math"
57

68
"github.com/bcp-innovations/hyperlane-cosmos/tests/simapp"
@@ -49,7 +51,7 @@ func (suite *KeeperTestSuite) setupWarpApps() simapp.PostBuildOpt {
4951
// Wrap app with custom middleware if hooks are provided.
5052
for tokenType, hook := range suite.HandleHooks {
5153
app, ok := warpAppsMap[tokenType]
52-
Expect(ok).To(BeTrue())
54+
Expect(ok).To(BeTrue(), fmt.Sprintf("expected warp app for token type %s to be found", tokenType))
5355

5456
appMiddleware, err := middleware.NewMiddleware(app, hook)
5557
Expect(err).To(BeNil())
@@ -67,7 +69,6 @@ func (suite *KeeperTestSuite) setupWarpApps() simapp.PostBuildOpt {
6769

6870
app.RegisterWarpApps(warpApps...)
6971
}
70-
7172
}
7273

7374
func createIgp(s *KeeperTestSuite, creator string) util.HexAddress {

tests/simapp/app.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,10 @@ func AppConfig(hyperlaneModuleConfigs []*appv1alpha1.ModuleConfig) depinject.Con
144144
)
145145
}
146146

147-
type PostBuildOpt func(*App)
148-
type PostBuildOpts = []PostBuildOpt
147+
type (
148+
PostBuildOpt func(*App)
149+
PostBuildOpts = []PostBuildOpt
150+
)
149151

150152
func DefaultPostBuildOpts() PostBuildOpts {
151153
return []PostBuildOpt{

x/middleware/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ before and after the execution of the application's `Handle` method.
66

77
## Usage
88

9-
To wrap an Hyperlane application with a middleware, two components are required:
9+
To wrap n Hyperlane application with a middleware, two components are required:
1010

1111
- The Hyperlane core keeper.
12-
- An Hyperlane application, like Warp.
12+
- A Hyperlane application, like Warp.
1313

1414
Once the Cosmos SDK application has been built,
1515
it is possible to build and register the middleware.
@@ -56,7 +56,6 @@ At this point, it is possible to create the middleware. In the example below,
5656
we are going to create two wrapped middlewares around the warp application:
5757

5858
```go
59-
6059
warpKeeper := &warpkeeper.Keeper{}
6160
coreKeeper := &corekeeper.Keeper{}
6261

x/middleware/hook.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ type HandleHook interface {
1414
PostHandleHook(ctx context.Context, mailboxID util.HexAddress, message util.HyperlaneMessage) error
1515
}
1616

17+
var _ HandleHook = &HookHandle{}
18+
1719
type HookHandle struct {
1820
// preHandleHook is the behavior expected from a type that hook BEFORE executing
1921
// the Hyperlane application Handle method.

x/middleware/middleware.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ func NewMiddleware(inner util.HyperlaneApp, hook HandleHook) (*Middleware, error
3535
}, nil
3636
}
3737

38-
// Exists dispatch the request to the underlying wrapped Hyperlane application.
38+
// Exists dispatches the request to the underlying wrapped Hyperlane application.
3939
func (m *Middleware) Exists(ctx context.Context, recipient util.HexAddress) (bool, error) {
4040
return m.HyperlaneApp.Exists(ctx, recipient)
4141
}
4242

43-
// ReceiverIsmId dispatch the request to the underlying wrapped Hyperlane application.
43+
// ReceiverIsmId dispatches the request to the underlying wrapped Hyperlane application.
4444
func (m *Middleware) ReceiverIsmId(ctx context.Context, recipient util.HexAddress) (*util.HexAddress, error) {
4545
return m.HyperlaneApp.ReceiverIsmId(ctx, recipient)
4646
}

0 commit comments

Comments
 (0)