From 99f8b54cfd6a92d9fb6f63a3efff255b376b454b Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Tue, 11 Aug 2020 10:51:47 +0100 Subject: [PATCH] fix 0.3{8,9} migrations and migration test case (#7002) These fixes were applied to Launchopad 0.39.1 RC and never ported to master. --- x/auth/legacy/v0_38/types.go | 2 +- x/auth/legacy/v0_39/types.go | 2 +- x/auth/legacy/v0_40/migrate_test.go | 2 +- x/genutil/legacy/v0_39/migrate_test.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/auth/legacy/v0_38/types.go b/x/auth/legacy/v0_38/types.go index 077fd1cc0..6d5708c11 100644 --- a/x/auth/legacy/v0_38/types.go +++ b/x/auth/legacy/v0_38/types.go @@ -524,7 +524,7 @@ func ValidateGenAccounts(genAccounts GenesisAccounts) error { func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*GenesisAccount)(nil), nil) cdc.RegisterInterface((*Account)(nil), nil) - cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil) + cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/Account", nil) cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount", nil) cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil) cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil) diff --git a/x/auth/legacy/v0_39/types.go b/x/auth/legacy/v0_39/types.go index 3cb695600..32b527cce 100644 --- a/x/auth/legacy/v0_39/types.go +++ b/x/auth/legacy/v0_39/types.go @@ -422,7 +422,7 @@ func (ma *ModuleAccount) UnmarshalJSON(bz []byte) error { func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterInterface((*v038auth.GenesisAccount)(nil), nil) cdc.RegisterInterface((*v038auth.Account)(nil), nil) - cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/BaseAccount", nil) + cdc.RegisterConcrete(&BaseAccount{}, "cosmos-sdk/Account", nil) cdc.RegisterConcrete(&BaseVestingAccount{}, "cosmos-sdk/BaseVestingAccount", nil) cdc.RegisterConcrete(&ContinuousVestingAccount{}, "cosmos-sdk/ContinuousVestingAccount", nil) cdc.RegisterConcrete(&DelayedVestingAccount{}, "cosmos-sdk/DelayedVestingAccount", nil) diff --git a/x/auth/legacy/v0_40/migrate_test.go b/x/auth/legacy/v0_40/migrate_test.go index f60f3507a..108273b6e 100644 --- a/x/auth/legacy/v0_40/migrate_test.go +++ b/x/auth/legacy/v0_40/migrate_test.go @@ -51,7 +51,7 @@ func TestMigrate(t *testing.T) { }, "accounts": [ { - "type": "cosmos-sdk/BaseAccount", + "type": "cosmos-sdk/Account", "value": { "address": "cosmos1xxkueklal9vejv9unqu80w9vptyepfa95pd53u", "public_key": null, diff --git a/x/genutil/legacy/v0_39/migrate_test.go b/x/genutil/legacy/v0_39/migrate_test.go index d6f68a000..c50434aea 100644 --- a/x/genutil/legacy/v0_39/migrate_test.go +++ b/x/genutil/legacy/v0_39/migrate_test.go @@ -21,7 +21,7 @@ var genAuthState = []byte(`{ }, "accounts": [ { - "type": "cosmos-sdk/BaseAccount", + "type": "cosmos-sdk/Account", "value": { "address": "cosmos19hz3ee9e3lj9mne4jggj3v8hxjrpre22jukj9y", "coins": [ @@ -107,7 +107,7 @@ var genAuthState = []byte(`{ ] }`) -var expectedGenAuthState = []byte(`{"params":{"max_memo_characters":"10","tx_sig_limit":"10","tx_size_cost_per_byte":"10","sig_verify_cost_ed25519":"10","sig_verify_cost_secp256k1":"10"},"accounts":[{"type":"cosmos-sdk/BaseAccount","value":{"address":"cosmos19hz3ee9e3lj9mne4jggj3v8hxjrpre22jukj9y","coins":[{"denom":"stake","amount":"400000"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"AvIgV7K2WX8qv4VoIPlG88cj7vAQE0CbHe36LZ1jZUr4"},"account_number":"1","sequence":"1"}},{"type":"cosmos-sdk/ModuleAccount","value":{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"denom":"stake","amount":"400000000"}],"public_key":"","account_number":"2","sequence":"4","name":"bonded_tokens_pool","permissions":["burner","staking"]}},{"type":"cosmos-sdk/ContinuousVestingAccount","value":{"address":"cosmos1vtzxzyjv506dvhl9pa527xsugf5gez4fnqxq0n","coins":[{"denom":"stake","amount":"10000205"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"A0w7VOA5Tf3MQx0naEP5fRdg+jy08sF3rN0jh6mK0z5B"},"account_number":"3","sequence":"5","original_vesting":[{"denom":"stake","amount":"10000205"}],"delegated_free":[],"delegated_vesting":[],"end_time":"1596125048","start_time":"1595952248"}},{"type":"cosmos-sdk/DelayedVestingAccount","value":{"address":"cosmos1prxkcqclweqa0g28p7vmf6z78ghyeckm4qak30","coins":[{"denom":"stake","amount":"10000205"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"A7LsdbGpcqI6Ls9Wk/xJIymG67ssrWr2XcXimmj20hFf"},"account_number":"4","sequence":"15","original_vesting":[{"denom":"stake","amount":"10000205"}],"delegated_free":[],"delegated_vesting":[],"end_time":"1596125048"}}]}`) +var expectedGenAuthState = []byte(`{"params":{"max_memo_characters":"10","tx_sig_limit":"10","tx_size_cost_per_byte":"10","sig_verify_cost_ed25519":"10","sig_verify_cost_secp256k1":"10"},"accounts":[{"type":"cosmos-sdk/Account","value":{"address":"cosmos19hz3ee9e3lj9mne4jggj3v8hxjrpre22jukj9y","coins":[{"denom":"stake","amount":"400000"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"AvIgV7K2WX8qv4VoIPlG88cj7vAQE0CbHe36LZ1jZUr4"},"account_number":"1","sequence":"1"}},{"type":"cosmos-sdk/ModuleAccount","value":{"address":"cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh","coins":[{"denom":"stake","amount":"400000000"}],"public_key":"","account_number":"2","sequence":"4","name":"bonded_tokens_pool","permissions":["burner","staking"]}},{"type":"cosmos-sdk/ContinuousVestingAccount","value":{"address":"cosmos1vtzxzyjv506dvhl9pa527xsugf5gez4fnqxq0n","coins":[{"denom":"stake","amount":"10000205"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"A0w7VOA5Tf3MQx0naEP5fRdg+jy08sF3rN0jh6mK0z5B"},"account_number":"3","sequence":"5","original_vesting":[{"denom":"stake","amount":"10000205"}],"delegated_free":[],"delegated_vesting":[],"end_time":"1596125048","start_time":"1595952248"}},{"type":"cosmos-sdk/DelayedVestingAccount","value":{"address":"cosmos1prxkcqclweqa0g28p7vmf6z78ghyeckm4qak30","coins":[{"denom":"stake","amount":"10000205"}],"public_key":{"type":"tendermint/PubKeySecp256k1","value":"A7LsdbGpcqI6Ls9Wk/xJIymG67ssrWr2XcXimmj20hFf"},"account_number":"4","sequence":"15","original_vesting":[{"denom":"stake","amount":"10000205"}],"delegated_free":[],"delegated_vesting":[],"end_time":"1596125048"}}]}`) func TestMigrate(t *testing.T) { genesis := types.AppMap{