-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration script to prune wasm codes
- Loading branch information
Showing
6 changed files
with
136 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package v4 | ||
|
||
import ( | ||
"math" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// Keeper abstract keeper | ||
type wasmKeeper interface { | ||
PruneWasmCodes(ctx sdk.Context, maxCodeID uint64) error | ||
} | ||
|
||
// Migrator is a struct for handling in-place store migrations. | ||
type Migrator struct { | ||
keeper wasmKeeper | ||
} | ||
|
||
// NewMigrator returns a new Migrator. | ||
func NewMigrator(k wasmKeeper) Migrator { | ||
return Migrator{keeper: k} | ||
} | ||
|
||
// Migrate4to5 migrates from version 4 to 5. | ||
func (m Migrator) Migrate4to5(ctx sdk.Context) error { | ||
return m.keeper.PruneWasmCodes(ctx, math.MaxUint64) | ||
} |
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,9 @@ | ||
package v4_test | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestMigrate4To5(t *testing.T) { | ||
t.Skip("TODO") | ||
} |
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