-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(staking): remove unused of validator store when migrate (#733)
Co-authored-by: fx0x55 <80245546+fx0x55@users.noreply.github.com>
- Loading branch information
1 parent
7fd9cc7
commit 8c2c51a
Showing
9 changed files
with
107 additions
and
28 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
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,33 @@ | ||
package v8 | ||
|
||
import ( | ||
storetypes "cosmossdk.io/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
var ( | ||
// Deprecated: do not use, remove in v8 | ||
ValidatorOperatorKey = []byte{0x91} | ||
// Deprecated: do not use, remove in v8 | ||
ConsensusPubKey = []byte{0x92} | ||
// Deprecated: do not use, remove in v8 | ||
ConsensusProcessKey = []byte{0x93} | ||
) | ||
|
||
func GetRemovedValidatorStoreKeys() [][]byte { | ||
return [][]byte{ValidatorOperatorKey, ConsensusPubKey, ConsensusProcessKey} | ||
} | ||
|
||
func DeleteMigrationValidatorStore( | ||
ctx sdk.Context, | ||
storeKey storetypes.StoreKey, | ||
) { | ||
store := ctx.KVStore(storeKey) | ||
removeKeys := GetRemovedValidatorStoreKeys() | ||
for _, key := range removeKeys { | ||
iterator := storetypes.KVStorePrefixIterator(store, key) | ||
for ; iterator.Valid(); iterator.Next() { | ||
store.Delete(iterator.Key()) | ||
} | ||
} | ||
} |
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