Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.39->0.40 CLI migrate command #6839

Merged
merged 234 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
9f216fd
WIP on BaseAccount protobuf pub_key
aaronc Jul 29, 2020
b8a0523
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Jul 29, 2020
8a086a1
WIP on BaseAccount.PubKey
aaronc Jul 29, 2020
09361c4
Migrate supply
amaury1093 Jul 30, 2020
09307ad
Change validator_slash_event
amaury1093 Jul 30, 2020
df33386
Add evidence
amaury1093 Jul 31, 2020
5d0aa26
Add evidence to genutil migrate
amaury1093 Jul 31, 2020
5de7d11
Fix lint
amaury1093 Jul 31, 2020
c91c836
Merge branch 'master' into am-6751-migrate
amaury1093 Jul 31, 2020
971e6f4
Merge branch 'master' into am-6751-migrate
amaury1093 Aug 3, 2020
ce0afd2
Add println
amaury1093 Aug 3, 2020
78f8d73
Merge branch 'master' into aaronc/revert-5682
aaronc Aug 3, 2020
aeb3a51
Merge branch 'master' into am-6751-migrate
amaury1093 Aug 4, 2020
754be4c
No _ in package name
amaury1093 Aug 4, 2020
9dc0198
Add slashing migrate
amaury1093 Aug 4, 2020
efadf72
Add tests for slashing
amaury1093 Aug 4, 2020
6027250
Add capacity to array
amaury1093 Aug 4, 2020
bb2097d
stray fmt.Prinlnt
amaury1093 Aug 4, 2020
671edfb
WIP on BaseAccount pub key
aaronc Aug 4, 2020
92d0cdf
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Aug 4, 2020
15b8799
Merge remote-tracking branch 'origin/aaronc/revert-5682' into aaronc/…
aaronc Aug 4, 2020
05211e8
Put current types in v0_40
amaury1093 Aug 4, 2020
c06e6c7
Add evidence old types
amaury1093 Aug 4, 2020
10e7fc3
Remove useless impl
amaury1093 Aug 4, 2020
b48160a
Add RegisterInterface
amaury1093 Aug 4, 2020
eec171f
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Aug 4, 2020
00b48a6
Add clientCtx to argument
amaury1093 Aug 5, 2020
766bb7e
Register evidence interfaces
amaury1093 Aug 5, 2020
405c669
Merge branch 'master' into am-6751-migrate
amaury1093 Aug 5, 2020
7d44cac
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Aug 5, 2020
5f6020e
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Aug 6, 2020
7f12c37
Update PubKey
aaronc Aug 17, 2020
5e9a549
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into aa…
aaronc Aug 17, 2020
d145ca1
Update Account
aaronc Aug 17, 2020
a6c6d5c
Docs
aaronc Aug 17, 2020
3a7dbd2
WIP on protobuf keys
aaronc Aug 19, 2020
67ea545
Use Type() and Bytes() in sr25519 pub key Equals
blushi Aug 21, 2020
8f3be04
Add tests
blushi Aug 21, 2020
7c2d693
Add few more tests
blushi Aug 21, 2020
7c53579
Update other pub/priv key types Equals
blushi Aug 21, 2020
92c73ec
Fix PrivKey's Sign method
blushi Aug 21, 2020
d81291e
Rename variables in tests
blushi Aug 24, 2020
03a086d
Fix infinite recursive calls
blushi Aug 24, 2020
ad81bd4
Use tm ed25519 keys
blushi Aug 27, 2020
9587c2b
Add Sign and VerifySignature tests
blushi Aug 27, 2020
a6c6610
Merge branch 'master' into marie/protobuf-pubkeys
blushi Aug 31, 2020
41261d1
Remove ed25519 and sr25519 references
blushi Aug 31, 2020
4c1358b
proto linting
blushi Aug 31, 2020
d6a2751
Add proto crypto file
blushi Aug 31, 2020
eb020c2
Implement some of the new multisig proto type methods
blushi Aug 31, 2020
a4f6dd6
Add tests for MultisigThresholdPubKey
blushi Sep 2, 2020
e1a20ce
Add tests for pubkey pb/amino conversion functions
blushi Sep 2, 2020
c17e7e4
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 2, 2020
0a77078
Merge branch 'aaronc/revert-5682' into marie/6928-baseacc-pk
blushi Sep 2, 2020
a5d2874
Merge branch 'marie/protobuf-pubkeys' into marie/6928-baseacc-pk
blushi Sep 2, 2020
bc5af8b
Move crypto types.go and register new proto pubkeys
blushi Sep 4, 2020
f4a1fd5
Add missing pointer ref
blushi Sep 4, 2020
a0753a0
Merge branch 'marie/protobuf-pubkeys' into marie/6928-baseacc-pk
blushi Sep 4, 2020
ca063bf
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 4, 2020
b9ab6c9
Address review comments
blushi Sep 7, 2020
6fc4073
panic in MultisigThresholdPubKey VerifySignature
blushi Sep 7, 2020
6609369
Merge branch 'marie/protobuf-pubkeys' of github.com:cosmos/cosmos-sdk…
blushi Sep 7, 2020
64d44cb
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 7, 2020
b210837
Merge branch 'marie/protobuf-pubkeys' into marie/6928-baseacc-pk
blushi Sep 7, 2020
09db3e9
Fix compile errors
blushi Sep 7, 2020
3103c29
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 7, 2020
e0fc222
Remove pk conversion in ante handler
blushi Sep 9, 2020
5c30dc6
Merge branch 'master' into marie/6928-baseacc-pk
blushi Sep 9, 2020
d9eee8d
Use internal crypto.PubKey in multisig
blushi Sep 9, 2020
a221994
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 9, 2020
339f460
Add tests for MultisigThresholdPubKey VerifyMultisignature
blushi Sep 9, 2020
9ee65fa
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 9, 2020
190bee2
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 10, 2020
af94272
Only keep LegacyAminoMultisigThresholdPubKey and move to proto keys t…
blushi Sep 10, 2020
b4393b4
Remove conversion functions and introduce internal PubKey type
blushi Sep 10, 2020
b67f9d4
Override Amino marshaling for proto pubkeys
amaury1093 Sep 10, 2020
08cd25a
Merge master
amaury1093 Sep 8, 2020
9a4dc25
Make proto-gen
amaury1093 Sep 10, 2020
fb8e7a9
Start removal of old PubKeyMultisigThreshold references
blushi Sep 10, 2020
4e4ce4e
Fix tests
amaury1093 Sep 10, 2020
d3c76f5
Fix solomachine
amaury1093 Sep 11, 2020
01175d3
Fix ante handler tests
amaury1093 Sep 4, 2020
3c4ddbb
Pull latest go-amino
amaury1093 Sep 11, 2020
cee8f30
Remove ed25519
amaury1093 Sep 11, 2020
ba95f50
Remove old secp256k1 PubKey and PrivKey
blushi Sep 11, 2020
330a0be
Uncomment test case
blushi Sep 11, 2020
e88c126
Fix linting issues
blushi Sep 11, 2020
54fb9a3
More linting
blushi Sep 11, 2020
07228ba
Merge branch 'master' into marie/protobuf-pubkeys
blushi Sep 11, 2020
2b63374
Merge branch 'marie/protobuf-pubkeys' into marie/7109-multisig
blushi Sep 11, 2020
34ed4a0
Revert tests keys values
blushi Sep 12, 2020
a39dd4c
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into mari…
amaury1093 Sep 14, 2020
34e3f89
Add Amino overrides to proto keys
amaury1093 Sep 14, 2020
ddd1a72
Add pubkey test
amaury1093 Sep 14, 2020
935c51b
Fix tests
amaury1093 Sep 14, 2020
f31d625
Use threshold isntead of K
amaury1093 Sep 14, 2020
f8af7fc
Merge branch 'master' into marie/protobuf-pubkeys
amaury1093 Sep 14, 2020
e410121
Merge branch 'master' into marie/protobuf-pubkeys
amaury1093 Sep 14, 2020
4114ce9
Standardize Type
amaury1093 Sep 14, 2020
af415fc
Revert standardize types commit
amaury1093 Sep 14, 2020
0934a00
Merge branch 'master' into marie/protobuf-pubkeys
alexanderbez Sep 14, 2020
0006cb7
Merge branch 'marie/protobuf-pubkeys' of ssh://github.com/cosmos/cosm…
amaury1093 Sep 14, 2020
d9294ee
Merge branch 'master' into marie/protobuf-pubkeys
amaury1093 Sep 14, 2020
7177df5
Fix build
amaury1093 Sep 14, 2020
794bc35
Fix lint
amaury1093 Sep 14, 2020
8001673
Fix lint
amaury1093 Sep 14, 2020
ee712f1
Add comment
amaury1093 Sep 14, 2020
912561f
Merge branch 'marie/protobuf-pubkeys' of ssh://github.com/cosmos/cosm…
amaury1093 Sep 14, 2020
9623425
Merge branch 'marie/protobuf-pubkeys' of ssh://github.com/cosmos/cosm…
amaury1093 Sep 14, 2020
56ecf47
Register crypto.PubKey
amaury1093 Sep 14, 2020
d3e4d1e
Add empty key in BuildSimTx
amaury1093 Sep 14, 2020
c5d5c81
Simplify proto names
amaury1093 Sep 15, 2020
37be659
Merge branch 'marie/protobuf-pubkeys' of ssh://github.com/cosmos/cosm…
amaury1093 Sep 15, 2020
afddbc9
Unpack interfaces for signing desc
amaury1093 Sep 15, 2020
f70ab56
Fix IBC tests?
amaury1093 Sep 15, 2020
9d0ac0a
Format proto
amaury1093 Sep 15, 2020
d3b2896
Use secp256k1 in ibc
amaury1093 Sep 15, 2020
e8b30d7
Merge branch 'marie/protobuf-pubkeys' of ssh://github.com/cosmos/cosm…
amaury1093 Sep 15, 2020
96c27ec
Fixed merge issues
amaury1093 Sep 15, 2020
9e0a4bb
Uncomment tests
amaury1093 Sep 15, 2020
f2dafe7
Update x/ibc/testing/solomachine.go
colin-axner Sep 15, 2020
ccc3afe
Merge branch 'am-7147-aminojson' of ssh://github.com/cosmos/cosmos-sd…
amaury1093 Sep 15, 2020
e5778a0
UnpackInterfaces for solomachine types
amaury1093 Sep 15, 2020
0a47ff3
Remove old multisig
amaury1093 Sep 15, 2020
bb0b56d
Add amino marshal for multisig
amaury1093 Sep 15, 2020
9f9921e
Fix lint
amaury1093 Sep 15, 2020
f5d3701
Correctly register amino
amaury1093 Sep 16, 2020
18eeb67
One test left!
amaury1093 Sep 16, 2020
bf72fbd
Remove old struct
amaury1093 Sep 16, 2020
9c07e68
Fix test
amaury1093 Sep 16, 2020
66f78cd
Fix test
amaury1093 Sep 16, 2020
9f8aab7
Unpack into tmcrypto
amaury1093 Sep 16, 2020
5a0490f
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into mari…
amaury1093 Sep 16, 2020
c7c289e
Merge branch 'marie/7109-multisig' of ssh://github.com/cosmos/cosmos-…
amaury1093 Sep 16, 2020
7a596dc
Remove old threshold pubkey tests
blushi Sep 16, 2020
04b86d9
Fix register amino
amaury1093 Sep 16, 2020
3211baa
Fix lint
amaury1093 Sep 16, 2020
2103eca
Use sdk crypto PubKey in multisig UnpackInterfaces
blushi Sep 16, 2020
bf3ffbe
Merge branch 'master' into marie/7109-multisig
blushi Sep 16, 2020
421f948
Potential fix?
amaury1093 Sep 17, 2020
fa3840a
Merge branch 'marie/7109-multisig' of ssh://github.com/cosmos/cosmos-…
amaury1093 Sep 17, 2020
c63f3e7
Register LegacyAminoPubKey
amaury1093 Sep 17, 2020
9e5f57c
Merge branch 'master' into marie/7109-multisig
amaury1093 Sep 17, 2020
d195542
Register our own PubKey
amaury1093 Sep 17, 2020
b35c35e
Register tmcrypto PubKey
amaury1093 Sep 17, 2020
b19450f
Register both PubKeys
amaury1093 Sep 17, 2020
7175814
Register interfaces in test
amaury1093 Sep 17, 2020
bf2347d
Refactor fiels
amaury1093 Sep 17, 2020
09e1fbc
Add comments
amaury1093 Sep 17, 2020
49830d2
Merge branch 'am-7147-aminojson' into marie/6928-baseacc-pk
blushi Sep 17, 2020
ed01620
Remove old cosmos-sdk/crypto/keys reference
blushi Sep 17, 2020
ec1c22d
Merge branch 'master' into marie/7109-multisig
alexanderbez Sep 17, 2020
8f1fda1
Use anil's suggestion
amaury1093 Sep 17, 2020
27ae607
Add norace back
amaury1093 Sep 17, 2020
aa0867e
Merge branch 'marie/7109-multisig' into am-7147-aminojson
amaury1093 Sep 17, 2020
529eef4
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-7…
amaury1093 Sep 18, 2020
006d596
Use our own ed25519
amaury1093 Sep 18, 2020
6f7555a
Merge branch 'master' into am-7147-aminojson
amaury1093 Sep 18, 2020
57850e7
Fix pubkey types
amaury1093 Sep 18, 2020
56f5ec3
Fix network tests
amaury1093 Sep 18, 2020
fe58118
Fix more tests
amaury1093 Sep 18, 2020
7218bf6
Make ibc work?
amaury1093 Sep 18, 2020
92454ea
Use TM pubkey in NewValidator
amaury1093 Sep 18, 2020
5fe532c
Fix lint
amaury1093 Sep 18, 2020
7a423d8
Put interface in tpyes
amaury1093 Sep 18, 2020
f2e47fb
rerun CI
amaury1093 Sep 18, 2020
99ae231
Better name register
amaury1093 Sep 18, 2020
8ceb11f
Remove stray code
amaury1093 Sep 18, 2020
07c181d
Add ed25519 tests
amaury1093 Sep 18, 2020
c1d283e
Merge branch 'master' into am-7147-aminojson
alexanderbez Sep 18, 2020
3d90dd6
Check nil
amaury1093 Sep 18, 2020
7bd4538
Correct interface impl assert
amaury1093 Sep 18, 2020
ecaac5e
rerun CI
amaury1093 Sep 18, 2020
0b770a3
Merge branch 'master' into am-7147-aminojson
amaury1093 Sep 18, 2020
2d35e5e
Add fix for Bech32
amaury1093 Sep 18, 2020
6f6f3f2
Address comments
amaury1093 Sep 21, 2020
3c14018
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-7…
amaury1093 Sep 21, 2020
451e490
FIx lint
amaury1093 Sep 21, 2020
00f6a67
Add tests for solomachine unpack interfaces
amaury1093 Sep 21, 2020
cb16dbc
Fix query tx by hash
amaury1093 Sep 21, 2020
edba7cb
Better name in amino register
amaury1093 Sep 21, 2020
c1dbaa9
Merge branch 'am-7147-aminojson' of ssh://github.com/cosmos/cosmos-sd…
amaury1093 Sep 21, 2020
423b370
Merge branch 'am-own-ed25519' into marie/6928-baseacc-pk
amaury1093 Sep 21, 2020
a5a866e
Fix lint
amaury1093 Sep 21, 2020
990ef48
Add back ed25519 test (fixes #7352)
amaury1093 Sep 21, 2020
0286d53
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into mari…
amaury1093 Sep 21, 2020
572ea4f
go mod tidy
amaury1093 Sep 21, 2020
0e0e11f
Fix merge issues
amaury1093 Sep 21, 2020
afbaec0
Sort import
amaury1093 Sep 22, 2020
69212c3
Add test for backwards-compatibility
amaury1093 Sep 22, 2020
ca916de
Fix tests
amaury1093 Sep 22, 2020
ab924f3
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into mari…
amaury1093 Sep 22, 2020
a849010
Fix merge issue
amaury1093 Sep 22, 2020
2af2162
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Sep 23, 2020
eba9b77
Fix merge issues
amaury1093 Sep 23, 2020
e59ff1d
Fix tests build
amaury1093 Sep 23, 2020
63b90e3
Fix tests
amaury1093 Sep 23, 2020
abfc8d8
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Sep 24, 2020
fee5ce4
Marshal to proto
amaury1093 Sep 24, 2020
ac5f813
Fix 040 marshalling
amaury1093 Sep 24, 2020
c4edcfd
Remove dontcover
amaury1093 Sep 24, 2020
02aad5e
Fix equivocation
amaury1093 Sep 24, 2020
69fd362
Add vesting
amaury1093 Sep 24, 2020
e2cf55e
Merge branch 'marie/6928-baseacc-pk' into am-6751-migrate
amaury1093 Sep 24, 2020
56bf45b
Fix vesting
amaury1093 Sep 24, 2020
ebf67bc
Fix slashing test
amaury1093 Sep 24, 2020
829e275
Fix evidence test
amaury1093 Sep 24, 2020
07276d0
Remove pb.go files
amaury1093 Sep 25, 2020
20ad98b
Fix legacy auth tests
amaury1093 Sep 25, 2020
2633331
deterministic tests help
amaury1093 Sep 25, 2020
851becf
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Sep 25, 2020
0fb92ab
Fix auth tests
amaury1093 Sep 25, 2020
10a071a
Remove useless code
amaury1093 Sep 25, 2020
93da98f
Small cleanups
amaury1093 Sep 25, 2020
2a1ab88
Add comment
amaury1093 Sep 25, 2020
86c4046
Fix migrate hub
amaury1093 Sep 25, 2020
d1345a2
fmt.Println
amaury1093 Sep 25, 2020
4e8b135
No need to marshal indent
amaury1093 Sep 25, 2020
660b507
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Sep 25, 2020
d7e7e73
Update proto comment
amaury1093 Sep 25, 2020
7ef30db
Fix merge issues
amaury1093 Sep 25, 2020
69a90e1
Support nil pubkey
amaury1093 Sep 25, 2020
2a3b43e
Use protobuf empty
amaury1093 Sep 25, 2020
a3bb883
Merge branch 'master' into am-6751-migrate
amaury1093 Sep 28, 2020
c0bf888
Merge branch 'master' into am-6751-migrate
amaury1093 Sep 29, 2020
165f0c2
Address comments
amaury1093 Sep 29, 2020
e707f63
Fix tests
amaury1093 Sep 29, 2020
e28a430
Merge branch 'master' into am-6751-migrate
amaury1093 Sep 30, 2020
ced08d3
Merge branch 'master' into am-6751-migrate
amaury1093 Sep 30, 2020
963723c
Merge branch 'master' into am-6751-migrate
zmanian Oct 1, 2020
7dc4520
Merge branch 'master' into am-6751-migrate
amaury1093 Oct 2, 2020
448f572
Merge branch 'master' of ssh://github.com/cosmos/cosmos-sdk into am-6…
amaury1093 Oct 5, 2020
5283491
Unify legacy package names
amaury1093 Oct 5, 2020
1d4fd00
Merge branch 'master' into am-6751-migrate
Oct 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions proto/cosmos/distribution/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ message ValidatorSlashEventRecord {
uint64 height = 2;
// period is the period of the slash event.
uint64 period = 3;
// event describes the slash event.
ValidatorSlashEvent event = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"event\""];
// validator_slash_event describes the slash event.
ValidatorSlashEvent validator_slash_event = 4 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"event\""];
}

// GenesisState defines the distribution module's genesis state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DONTCOVER
// nolint
package v0_34
package v034

import (
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// DONTCOVER
// nolint
package v0_36
package v036

import (
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"
)

// Migrate accepts exported genesis state from v0.34 and migrates it to v0.36
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package v0_36
package v036

import (
"testing"

"github.com/cosmos/cosmos-sdk/types"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"

"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions x/auth/legacy/v0_36/types.go → x/auth/legacy/v036/types.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// DONTCOVER
// nolint
package v0_36
package v036

import v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34"
import v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"

const (
ModuleName = "auth"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package v038

import (
v036auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_36"
v036genaccounts "github.com/cosmos/cosmos-sdk/x/genaccounts/legacy/v0_36"
v036auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v036"
v036genaccounts "github.com/cosmos/cosmos-sdk/x/genaccounts/legacy/v036"
)

// Migrate accepts exported genesis state from v0.34 and migrates it to v0.38
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34"
v036auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_36"
v036genaccounts "github.com/cosmos/cosmos-sdk/x/genaccounts/legacy/v0_36"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"
v036auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v036"
v036genaccounts "github.com/cosmos/cosmos-sdk/x/genaccounts/legacy/v036"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -102,30 +102,6 @@ func TestMigrateInvalid(t *testing.T) {
name string
acc v036genaccounts.GenesisAccount
}{
{
"vesting account with no base coins",
v036genaccounts.GenesisAccount{
Address: accAddressFromBech32(t, "cosmos17n9sztlhx32tfy0tg0zc2ttmkeeth50yyuv9he"),
Coins: sdk.Coins{},
OriginalVesting: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000205)),
StartTime: time.Now().Unix(),
EndTime: time.Now().Add(48 * time.Hour).Unix(),
Sequence: 5,
AccountNumber: 3,
},
},
{
"vesting account with base coins <= original vesting",
v036genaccounts.GenesisAccount{
Address: accAddressFromBech32(t, "cosmos17n9sztlhx32tfy0tg0zc2ttmkeeth50yyuv9he"),
Coins: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000205)),
OriginalVesting: sdk.NewCoins(sdk.NewInt64Coin("stake", 50000205)),
StartTime: time.Now().Unix(),
EndTime: time.Now().Add(48 * time.Hour).Unix(),
Sequence: 5,
AccountNumber: 3,
},
},
{
"module account with invalid name",
v036genaccounts.GenesisAccount{
Expand Down
7 changes: 1 addition & 6 deletions x/auth/legacy/v0_38/types.go → x/auth/legacy/v038/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"
)

const (
Expand Down Expand Up @@ -223,11 +223,6 @@ func NewBaseVestingAccount(
}

func (bva BaseVestingAccount) Validate() error {
if (bva.Coins.IsZero() && !bva.OriginalVesting.IsZero()) ||
bva.OriginalVesting.IsAnyGT(bva.Coins) {
return errors.New("vesting amount cannot be greater than total amount")
}

return bva.BaseAccount.Validate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v039
import (
"fmt"

v038auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_38"
v038auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v038"
)

// Migrate accepts exported genesis state from v0.38 and migrates it to v0.39
Expand Down
9 changes: 2 additions & 7 deletions x/auth/legacy/v0_39/types.go → x/auth/legacy/v039/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
sdk "github.com/cosmos/cosmos-sdk/types"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_34"
v038auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v0_38"
v034auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v034"
v038auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v038"
)

const (
Expand Down Expand Up @@ -204,11 +204,6 @@ func (bva BaseVestingAccount) GetEndTime() int64 {
}

func (bva BaseVestingAccount) Validate() error {
if (bva.Coins.IsZero() && !bva.OriginalVesting.IsZero()) ||
bva.OriginalVesting.IsAnyGT(bva.Coins) {
return errors.New("vesting amount cannot be greater than total amount")
}

return bva.BaseAccount.Validate()
}

Expand Down
133 changes: 133 additions & 0 deletions x/auth/legacy/v040/migrate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package v040

import (
pt "github.com/gogo/protobuf/types"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
v039auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v039"
"github.com/cosmos/cosmos-sdk/x/auth/tx"
v040auth "github.com/cosmos/cosmos-sdk/x/auth/types"
v040vesting "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
)

// convertBaseAccount converts a 0.39 BaseAccount to a 0.40 BaseAccount.
func convertBaseAccount(old *v039auth.BaseAccount) *v040auth.BaseAccount {
// In `x/auth/legacy/v038/migrate.go`, when creating a BaseAccount, we
// explicitly set the PublicKey field to nil. This propagates until 0.40,
// and we don't know the PubKey for those accounts, so we just put an empty
// string inside the Any.
var any *codectypes.Any
var err error
if old.PubKey != nil {
any, err = tx.PubKeyToAny(old.PubKey)
} else {
s := pt.Empty{}
any, err = codectypes.NewAnyWithValue(&s)
}
if err != nil {
panic(err)
}

return &v040auth.BaseAccount{
Address: old.Address.String(),
PubKey: any,
AccountNumber: old.AccountNumber,
Sequence: old.Sequence,
}
}

// convertBaseVestingAccount converts a 0.39 BaseVestingAccount to a 0.40 BaseVestingAccount.
func convertBaseVestingAccount(old *v039auth.BaseVestingAccount) *v040vesting.BaseVestingAccount {
baseAccount := convertBaseAccount(old.BaseAccount)

return &v040vesting.BaseVestingAccount{
BaseAccount: baseAccount,
OriginalVesting: old.OriginalVesting,
DelegatedFree: old.DelegatedFree,
DelegatedVesting: old.DelegatedVesting,
EndTime: old.EndTime,
}
}

// Migrate accepts exported x/auth genesis state from v0.38/v0.39 and migrates
// it to v0.40 x/auth genesis state. The migration includes:
//
// - Removing coins from account encoding.
func Migrate(authGenState v039auth.GenesisState) *v040auth.GenesisState {
// Convert v0.39 accounts to v0.40 ones.
var v040Accounts = make([]v040auth.GenesisAccount, len(authGenState.Accounts))
for i, v039Account := range authGenState.Accounts {
switch v039Account := v039Account.(type) {
case *v039auth.BaseAccount:
{
v040Accounts[i] = convertBaseAccount(v039Account)
}
case *v039auth.ModuleAccount:
{
v040Accounts[i] = &v040auth.ModuleAccount{
BaseAccount: convertBaseAccount(v039Account.BaseAccount),
Name: v039Account.Name,
Permissions: v039Account.Permissions,
}
}
case *v039auth.BaseVestingAccount:
{
v040Accounts[i] = convertBaseVestingAccount(v039Account)
}
case *v039auth.ContinuousVestingAccount:
{
v040Accounts[i] = &v040vesting.ContinuousVestingAccount{
BaseVestingAccount: convertBaseVestingAccount(v039Account.BaseVestingAccount),
StartTime: v039Account.StartTime,
}
}
case *v039auth.DelayedVestingAccount:
{
v040Accounts[i] = &v040vesting.DelayedVestingAccount{
BaseVestingAccount: convertBaseVestingAccount(v039Account.BaseVestingAccount),
}
}
case *v039auth.PeriodicVestingAccount:
{
vestingPeriods := make([]v040vesting.Period, len(v039Account.VestingPeriods))
for j, period := range v039Account.VestingPeriods {
vestingPeriods[j] = v040vesting.Period{
Length: period.Length,
Amount: period.Amount,
}
}
v040Accounts[i] = &v040vesting.PeriodicVestingAccount{
BaseVestingAccount: convertBaseVestingAccount(v039Account.BaseVestingAccount),
StartTime: v039Account.StartTime,
VestingPeriods: vestingPeriods,
}
}
default:
panic(sdkerrors.Wrapf(sdkerrors.ErrInvalidType, "got invalid type %T", v039Account))
}

}

// Convert v0.40 accounts into Anys.
anys := make([]*codectypes.Any, len(v040Accounts))
for i, v040Account := range v040Accounts {
any, err := codectypes.NewAnyWithValue(v040Account)
if err != nil {
panic(err)
}

anys[i] = any
}

return &v040auth.GenesisState{
Params: v040auth.Params{
MaxMemoCharacters: authGenState.Params.MaxMemoCharacters,
TxSigLimit: authGenState.Params.TxSigLimit,
TxSizeCostPerByte: authGenState.Params.TxSizeCostPerByte,
SigVerifyCostED25519: authGenState.Params.SigVerifyCostED25519,
SigVerifyCostSecp256k1: authGenState.Params.SigVerifyCostSecp256k1,
},
Accounts: anys,
}
}
Loading