-
Notifications
You must be signed in to change notification settings - Fork 586
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sentinel localhost connection end to genesis state (#3040)
- Loading branch information
Showing
8 changed files
with
96 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
connectionv7 "github.com/cosmos/ibc-go/v7/modules/core/03-connection/migrations/v7" | ||
) | ||
|
||
// Migrator is a struct for handling in-place store migrations. | ||
type Migrator struct { | ||
keeper Keeper | ||
} | ||
|
||
// NewMigrator returns a new Migrator. | ||
func NewMigrator(keeper Keeper) Migrator { | ||
return Migrator{keeper: keeper} | ||
} | ||
|
||
// Migrate3to4 migrates from version 3 to 4. | ||
// This migration writes the sentinel localhost connection end to state. | ||
func (m Migrator) Migrate3to4(ctx sdk.Context) error { | ||
connectionv7.MigrateLocalhostConnection(ctx, m.keeper) | ||
return nil | ||
} |
13 changes: 13 additions & 0 deletions
13
modules/core/03-connection/migrations/v7/expected_keepers.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package v7 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" | ||
) | ||
|
||
// ConnectionKeeper expected IBC connection keeper | ||
type ConnectionKeeper interface { | ||
CreateSentinelLocalhostConnection() types.ConnectionEnd | ||
SetConnection(ctx sdk.Context, connectionID string, connection types.ConnectionEnd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package v7 | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" | ||
) | ||
|
||
// MigrateLocalhostConnection creates the sentinel localhost connection end to enable | ||
// localhost ibc functionality. | ||
func MigrateLocalhostConnection(ctx sdk.Context, connectionKeeper ConnectionKeeper) { | ||
localhostConnection := connectionKeeper.CreateSentinelLocalhostConnection() | ||
connectionKeeper.SetConnection(ctx, connectiontypes.LocalhostID, localhostConnection) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters