File tree 3 files changed +8
-18
lines changed
3 files changed +8
-18
lines changed Original file line number Diff line number Diff line change 1
1
package v040
2
2
3
3
import (
4
- pt "github.com/gogo/protobuf/types"
5
-
6
4
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
7
5
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
8
6
v039auth "github.com/cosmos/cosmos-sdk/x/auth/legacy/v039"
@@ -13,20 +11,15 @@ import (
13
11
14
12
// convertBaseAccount converts a 0.39 BaseAccount to a 0.40 BaseAccount.
15
13
func convertBaseAccount (old * v039auth.BaseAccount ) * v040auth.BaseAccount {
16
- // In `x/auth/legacy/v038/migrate.go`, when creating a BaseAccount, we
17
- // explicitly set the PublicKey field to nil. This propagates until 0.40,
18
- // and we don't know the PubKey for those accounts, so we just put an empty
19
- // string inside the Any.
20
14
var any * codectypes.Any
21
- var err error
15
+ // If the old genesis had a pubkey, we pack it inside an Any. Or else, we
16
+ // just leave it nil.
22
17
if old .PubKey != nil {
18
+ var err error
23
19
any , err = tx .PubKeyToAny (old .PubKey )
24
- } else {
25
- s := pt.Empty {}
26
- any , err = codectypes .NewAnyWithValue (& s )
27
- }
28
- if err != nil {
29
- panic (err )
20
+ if err != nil {
21
+ panic (err )
22
+ }
30
23
}
31
24
32
25
return & v040auth.BaseAccount {
Original file line number Diff line number Diff line change @@ -228,10 +228,7 @@ func TestMigrate(t *testing.T) {
228
228
"@type": "/cosmos.auth.v1beta1.BaseAccount",
229
229
"account_number": "1",
230
230
"address": "cosmos16ydaqh0fcnh4qt7a3jme4mmztm2qel5axcpw00",
231
- "pub_key": {
232
- "@type": "/google.protobuf.Empty",
233
- "value": {}
234
- },
231
+ "pub_key": null,
235
232
"sequence": "0"
236
233
}
237
234
],
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
19
19
legacytx .RegisterLegacyAminoCodec (cdc )
20
20
}
21
21
22
- // RegisterInterface associates protoName with AccountI interface
22
+ // RegisterInterfaces associates protoName with AccountI interface
23
23
// and creates a registry of it's concrete implementations
24
24
func RegisterInterfaces (registry types.InterfaceRegistry ) {
25
25
registry .RegisterInterface (
You can’t perform that action at this time.
0 commit comments