Skip to content

Commit

Permalink
Remove 042 keys files
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Feb 23, 2021
1 parent 828a41b commit f3ca3e5
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 875 deletions.
52 changes: 0 additions & 52 deletions x/bank/legacy/v042/keys.go

This file was deleted.

3 changes: 2 additions & 1 deletion x/bank/legacy/v042/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
v040auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v040"
v040bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040"
"github.com/cosmos/cosmos-sdk/x/bank/types"
)

// MigrateStore performs in-place store migrations from v0.40 to v0.42. The
Expand All @@ -27,7 +28,7 @@ func MigrateStore(ctx sdk.Context, storeKey sdk.StoreKey) error {
for ; oldStoreIter.Valid(); oldStoreIter.Next() {
addr := v040bank.AddressFromBalancesStore(oldStoreIter.Key())
denom := oldStoreIter.Key()[v040auth.AddrLen:]
newStoreKey := append(CreateAccountBalancesPrefix(addr), denom...)
newStoreKey := append(types.CreateAccountBalancesPrefix(addr), denom...)

// Set new key on store. Values don't change.
store.Set(newStoreKey, oldStoreIter.Value())
Expand Down
3 changes: 2 additions & 1 deletion x/bank/legacy/v042/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
v040bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v040"
v042bank "github.com/cosmos/cosmos-sdk/x/bank/legacy/v042"
"github.com/cosmos/cosmos-sdk/x/bank/types"
)

func TestStoreMigration(t *testing.T) {
Expand All @@ -27,7 +28,7 @@ func TestStoreMigration(t *testing.T) {
err := v042bank.MigrateStore(ctx, bankKey)
require.NoError(t, err)

newKey := append(v042bank.CreateAccountBalancesPrefix(addr), denom...)
newKey := append(types.CreateAccountBalancesPrefix(addr), denom...)
// -7 because we replaced "balances" with 0x02,
// +1 because we added length-prefix to address.
require.Equal(t, len(oldKey)-7+1, len(newKey))
Expand Down
216 changes: 0 additions & 216 deletions x/distribution/legacy/v042/keys.go

This file was deleted.

19 changes: 10 additions & 9 deletions x/distribution/legacy/v042/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
v040distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v040"
v042distribution "github.com/cosmos/cosmos-sdk/x/distribution/legacy/v042"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)

func TestStoreMigration(t *testing.T) {
Expand All @@ -32,47 +33,47 @@ func TestStoreMigration(t *testing.T) {
{
"FeePoolKey",
v040distribution.FeePoolKey,
v042distribution.FeePoolKey,
types.FeePoolKey,
},
{
"ProposerKey",
v040distribution.ProposerKey,
v042distribution.ProposerKey,
types.ProposerKey,
},
{
"ValidatorOutstandingRewards",
v040distribution.GetValidatorOutstandingRewardsKey(valAddr),
v042distribution.GetValidatorOutstandingRewardsKey(valAddr),
types.GetValidatorOutstandingRewardsKey(valAddr),
},
{
"DelegatorWithdrawAddr",
v040distribution.GetDelegatorWithdrawAddrKey(addr2),
v042distribution.GetDelegatorWithdrawAddrKey(addr2),
types.GetDelegatorWithdrawAddrKey(addr2),
},
{
"DelegatorStartingInfo",
v040distribution.GetDelegatorStartingInfoKey(valAddr, addr2),
v042distribution.GetDelegatorStartingInfoKey(valAddr, addr2),
types.GetDelegatorStartingInfoKey(valAddr, addr2),
},
{
"ValidatorHistoricalRewards",
v040distribution.GetValidatorHistoricalRewardsKey(valAddr, 6),
v042distribution.GetValidatorHistoricalRewardsKey(valAddr, 6),
types.GetValidatorHistoricalRewardsKey(valAddr, 6),
},
{
"ValidatorCurrentRewards",
v040distribution.GetValidatorCurrentRewardsKey(valAddr),
v042distribution.GetValidatorCurrentRewardsKey(valAddr),
types.GetValidatorCurrentRewardsKey(valAddr),
},
{
"ValidatorAccumulatedCommission",
v040distribution.GetValidatorAccumulatedCommissionKey(valAddr),
v042distribution.GetValidatorAccumulatedCommissionKey(valAddr),
types.GetValidatorAccumulatedCommissionKey(valAddr),
},
{
"ValidatorSlashEvent",
v040distribution.GetValidatorSlashEventKey(valAddr, 6, 8),
v042distribution.GetValidatorSlashEventKey(valAddr, 6, 8),
types.GetValidatorSlashEventKey(valAddr, 6, 8),
},
}

Expand Down
Loading

0 comments on commit f3ca3e5

Please sign in to comment.