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

refactor!: Keyring migration #9695

Merged
merged 302 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
302 commits
Select commit Hold shift + click to select a range
372cc34
update migration algorithm
cyberbono3 Jun 9, 2021
6ed3edd
set proper naming k for Record
cyberbono3 Jun 10, 2021
1b16f94
some cosmetic stuff
cyberbono3 Jun 10, 2021
d362139
implement protoUnmarshalRecord
cyberbono3 Jun 10, 2021
68816b7
minor fixes
cyberbono3 Jun 10, 2021
3df8c9b
gen new protos according to robert suggestion
cyberbono3 Jun 10, 2021
5bf2889
fix new methods for local,ledger,empty items
cyberbono3 Jun 10, 2021
36764e3
latest version
cyberbono3 Jun 11, 2021
e3fe793
minor fixes
cyberbono3 Jun 14, 2021
17b45ae
modify VERSION_KEY to 1(string repr)
cyberbono3 Jun 14, 2021
241feb6
trying to fix an error - unable to unpack private key
cyberbono3 Jun 15, 2021
7815f41
any unpack does not work in protoUnmarshalRecord
cyberbono3 Jun 16, 2021
c538c57
minor fixes in record.go
cyberbono3 Jun 16, 2021
0a92755
keyring record marshaling tests
robert-zaremba Jun 17, 2021
9f5678d
TestRecordMarshaling pass
cyberbono3 Jun 17, 2021
23b33b2
TestLocalRecordMarshaling pass
cyberbono3 Jun 18, 2021
520cc56
TODO fix TestExtractPrivKeyFromItem test
cyberbono3 Jun 18, 2021
7a4b74e
TODO fix TestMigrationOneLegacyKey too many failed passphrase attempts
cyberbono3 Jun 18, 2021
d717da0
TestMigrationOneLegacyLocalKey and TestMigrationRecord pass
cyberbono3 Jun 21, 2021
7cd88cb
WIP finishing migration tests
cyberbono3 Jun 21, 2021
45fdfcb
all migration tests pass except TestMigrationLegacyLedgerKey
cyberbono3 Jun 21, 2021
f74cf65
debugging TestExtractPrivKeyFromItem
cyberbono3 Jun 21, 2021
fe68c74
all record tests pass
cyberbono3 Jun 22, 2021
e690fde
fix all tests in migration_test.go
cyberbono3 Jun 22, 2021
f9965e7
remove LegacyInfoWriter interface from legacy_info.go
cyberbono3 Jun 22, 2021
4c48fea
update checkMigrate and migrate funcs
cyberbono3 Jun 22, 2021
8109936
update migration algo and fix migration tests
cyberbono3 Jun 23, 2021
303e7fe
update Migrate,MigrateAll and fix migration tests
cyberbono3 Jun 24, 2021
9d87490
remove VERSION_KEY, add some migration tests
cyberbono3 Jun 28, 2021
dbd041c
fix errors clients/keys package
cyberbono3 Jun 29, 2021
0c751ed
fix migrate logic and migrateCmd tests
cyberbono3 Jun 29, 2021
fe39205
WIP debugging TestKeyManagementKeyRing
cyberbono3 Jun 29, 2021
35dbe9c
fix TestKeyManagementKeyRing test
cyberbono3 Jun 30, 2021
f5af15c
fix MigrateAll and adjust migrations tests
cyberbono3 Jun 30, 2021
f0988b1
fix TestSignVerifyKeyRing
cyberbono3 Jun 30, 2021
381dc27
fix TestExportImportKeyRing
cyberbono3 Jun 30, 2021
89764ba
fix TestSeedPhraseKeyRing test
cyberbono3 Jun 30, 2021
b232cea
fix TestKeyringKeybaseExportImportPrivKey
cyberbono3 Jun 30, 2021
599b413
WIP fixing keyring tests
cyberbono3 Jun 30, 2021
8dcefee
fix all keyring tests except ExampleNew
cyberbono3 Jul 1, 2021
a8856d3
fix TestProtoMarshalJSON
cyberbono3 Jul 1, 2021
4468f7d
fix TestArmorUnarmorPubKey
cyberbono3 Jul 1, 2021
4235a58
fix TestSign
cyberbono3 Jul 1, 2021
1214b2e
WIP debugging client/keys tests
cyberbono3 Jul 1, 2021
0ebbfaf
fix server/init tests
cyberbono3 Jul 1, 2021
654e34e
Test_runAddCmdBasic panic
cyberbono3 Jul 1, 2021
d1bccca
WIP fixing tests
cyberbono3 Jul 2, 2021
e0b0073
cdc is nil
cyberbono3 Jul 6, 2021
4735d9f
fix x/auth/tx/service_test.go test
cyberbono3 Jul 6, 2021
c728543
WIP debugging Test_runAddCmdBasic
cyberbono3 Jul 6, 2021
41b0d03
fix Test_runAddCmdBasic
cyberbono3 Jul 6, 2021
4d88638
fix Test_runDeleteCmd
cyberbono3 Jul 6, 2021
e0e4915
fix all tests in client/keys except export_test
cyberbono3 Jul 7, 2021
78d81be
fix rest tests
cyberbono3 Jul 7, 2021
42a5c62
fix grps_query_test
cyberbono3 Jul 7, 2021
d272991
cleanup
cyberbono3 Jul 7, 2021
c03be48
WIP fix no registered implementations of type types.PrivKey
cyberbono3 Jul 7, 2021
c736b8f
merge master to current branch and resolve conflicts
cyberbono3 Jul 7, 2021
fcf1b70
remove legacy and legacy_test entirely
cyberbono3 Jul 7, 2021
baaeda0
WIP fix extractPrivKeyFromLocal Unable to cast any to cryptotypes.Pr…
cyberbono3 Jul 8, 2021
39cd82c
fix TestSignVerifyKeyRing and cast any to PrivKey issue
cyberbono3 Jul 8, 2021
b6cb87f
WIP fix all keyring tests
cyberbono3 Jul 9, 2021
4c45144
fix all keyring_test package tests
cyberbono3 Jul 9, 2021
5ff7551
fix all client/keys package tests
cyberbono3 Jul 9, 2021
f209635
WIP fix tests
cyberbono3 Jul 9, 2021
faf232e
run make format
cyberbono3 Jul 9, 2021
30d7f3c
WIP fix tests and debug Test_runAddCmdLedgerDryRun
cyberbono3 Jul 11, 2021
f1e2084
fix all tests except TestIntegrationTestSuite
cyberbono3 Jul 12, 2021
3117ce9
fix all tests
cyberbono3 Jul 12, 2021
4882db8
minor fixes
cyberbono3 Jul 12, 2021
c691246
Merge branch 'master' into kerying-migration
cyberbono3 Jul 13, 2021
5514769
remove dead code
cyberbono3 Jul 13, 2021
b0685fe
gofmt
cyberbono3 Jul 13, 2021
4d8c0e8
refactor keyring_test.go
cyberbono3 Jul 13, 2021
24f44e8
add TestMigrateErrEmptyItemData to migration_test.go
cyberbono3 Jul 13, 2021
fe572c9
set proper codec in genaccounts.go
cyberbono3 Jul 13, 2021
dda1851
set proper codec in testnet.go
cyberbono3 Jul 13, 2021
8f239df
remove some comments from x/authz/client/testutil/tx.go
cyberbono3 Jul 13, 2021
1401291
fix lint comments
cyberbono3 Jul 13, 2021
7beebb2
fix ineffectual assignment to err in 2 suite files
cyberbono3 Jul 13, 2021
8652e00
update proto files
cyberbono3 Jul 13, 2021
4c24476
gofmt
cyberbono3 Jul 14, 2021
5e4a93b
minor changes
cyberbono3 Jul 14, 2021
0befb95
move types.proto to keyring/v1
cyberbono3 Jul 20, 2021
0922ae5
Update .gitignore
cyberbono3 Jul 21, 2021
f8feced
Update proto/cosmos/crypto/hd/hd.proto
cyberbono3 Jul 21, 2021
61c914a
move hd.proto to hd/v1
cyberbono3 Jul 21, 2021
07b7608
add comments to types.proto and hd.proto
cyberbono3 Jul 21, 2021
89a5fb8
remove unnecessary WithCodec from initClientCtx
cyberbono3 Jul 21, 2021
fc1d957
replace go-metrics import
cyberbono3 Jul 21, 2021
b28215d
fix bip39 import
cyberbono3 Jul 21, 2021
7d077af
remove GetAlgo() from Record
cyberbono3 Jul 25, 2021
60b8df9
add Multi,Offline empty messages to keyring/types.proto and modify Re…
cyberbono3 Jul 25, 2021
05c5621
merge master to my branch and resolve conflicts
cyberbono3 Jul 26, 2021
0392b0c
fix runRenameCmd
cyberbono3 Jul 26, 2021
691101a
cleanup
cyberbono3 Jul 27, 2021
2ab3c9e
resolve conflicts
cyberbono3 Jul 27, 2021
104d985
fix TestCLIQueryTxCmdByEvents
cyberbono3 Jul 27, 2021
f113ca3
fix lint issues
cyberbono3 Jul 27, 2021
ac6f553
cleanup
cyberbono3 Jul 27, 2021
e1f8b44
fix Test_runAddCmdLedgerWithCustomCoinType
cyberbono3 Jul 29, 2021
193d810
fix Test_runDeleteCmd
cyberbono3 Jul 29, 2021
4ef2a0f
set cdc outside for loop in Test_runAddCmdLedgerDryRun
cyberbono3 Jul 29, 2021
cc47f90
WIP remove keysCdc from printKeyringRecords
cyberbono3 Jul 29, 2021
2d78837
make LegacyInfo as private interface
cyberbono3 Jul 29, 2021
2fa2cf5
remove legacyInfoImporter from keyring.go
cyberbono3 Jul 29, 2021
93db061
remove Setter interface from keyring
cyberbono3 Jul 29, 2021
af0a829
add MarshalInterface to ExportPubKeyArmor
cyberbono3 Jul 29, 2021
fff6342
remove unnecessary comments in ExportPrivKeyArmor
cyberbono3 Jul 29, 2021
66a9f4f
set old signature for ExportPrivateKeyObject
cyberbono3 Jul 29, 2021
e7be004
cleanup
cyberbono3 Jul 29, 2021
4e3c516
set godocs for ExportPrivKeyArmor
cyberbono3 Jul 29, 2021
a29d672
mark no-lint for ed25519.PrivKey and set TODO in printKeyringRecords
cyberbono3 Jul 29, 2021
9ca30e7
WIP make setItem work in keyring_test
cyberbono3 Jul 29, 2021
f80fead
refactoring: get rid of keyring_test package
cyberbono3 Jul 30, 2021
9d64b12
fix migration tests
cyberbono3 Jul 30, 2021
29fac09
fix TestSignVerifyKeyRing
cyberbono3 Jul 30, 2021
db1c491
TODO fix keys/migtate_test.go
cyberbono3 Jul 30, 2021
207b20e
fix keys/add_ledger_test
cyberbono3 Jul 30, 2021
45ce571
fix keys/add_tests
cyberbono3 Jul 30, 2021
8559f79
fix keys/export test
cyberbono3 Jul 30, 2021
af6e02e
fix keys/import test
cyberbono3 Jul 30, 2021
5180234
fix keys/rename_test
cyberbono3 Jul 30, 2021
69ce1e3
fix keys/show test
cyberbono3 Jul 30, 2021
8cb8237
TODO fix Test_runAddCmdDryRun
cyberbono3 Jul 30, 2021
88c10db
fix Test_runAddCmdDryRun
cyberbono3 Aug 2, 2021
d0dc084
make SetItem public and fix all tests
cyberbono3 Aug 2, 2021
709156e
update SetItem comment
cyberbono3 Aug 2, 2021
e73cd29
remove Setter interface and fix tests
cyberbono3 Aug 2, 2021
cbdac38
fix record test
cyberbono3 Aug 2, 2021
9c73350
fix output test
cyberbono3 Aug 2, 2021
479ebb5
fix keyring_ledger_test.go
cyberbono3 Aug 2, 2021
b178dc8
fix some lint issues
cyberbono3 Aug 2, 2021
9d697ce
minor fixes
cyberbono3 Aug 2, 2021
0827c17
merge master to my branch and fix the conflicts
cyberbono3 Aug 2, 2021
1cc5faa
fix bip39 import
cyberbono3 Aug 2, 2021
98c21fd
update changelog and fix TestAltKeyring_SaveLedgerKey
cyberbono3 Aug 2, 2021
f226282
update changelog
cyberbono3 Aug 2, 2021
791821f
fix Test_runAddCmdLedgerDryRun
cyberbono3 Aug 3, 2021
10a41b7
update changelog and migrate test
cyberbono3 Aug 3, 2021
fb48a8f
revert cosmovisor import change
cyberbono3 Aug 3, 2021
e3d2579
update hdpath.go and changelog entries
cyberbono3 Aug 3, 2021
39fb2e1
make newKWalletBackendKeyringConfig private
cyberbono3 Aug 3, 2021
17fb2ca
make NewPassBackendKeyringConfig private
cyberbono3 Aug 3, 2021
1ba5d0e
update accAddr
cyberbono3 Aug 3, 2021
9b0bdcf
minor fixes
cyberbono3 Aug 3, 2021
587d9c3
fix module_test imports
cyberbono3 Aug 3, 2021
f89c0e7
fix variable name in SignTx
cyberbono3 Aug 3, 2021
5ecd82b
add some changelog entries
cyberbono3 Aug 3, 2021
f112d99
update migrate CLI description
cyberbono3 Aug 3, 2021
dc7d441
minor fix
cyberbono3 Aug 3, 2021
8fc1f36
remove TODO
cyberbono3 Aug 3, 2021
64df9ed
make ExtractPrivKeyFromRecord private
cyberbono3 Aug 3, 2021
7a926e0
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into cy…
cyberbono3 Aug 3, 2021
cf5a23b
fix some lint issues
cyberbono3 Aug 3, 2021
c73268a
nolint
cyberbono3 Aug 4, 2021
5e7a5fd
move newLegacy***Info constructors to migration_test.go
cyberbono3 Aug 6, 2021
1795c43
predefine res from keyring.List() and fix tests accordingly
cyberbono3 Aug 6, 2021
b6987cb
make legacyInfo public to resolve lint issue
cyberbono3 Aug 6, 2021
3aaa331
cleanup
cyberbono3 Aug 6, 2021
73072bc
resolve conflicts,fix tests
cyberbono3 Aug 9, 2021
bad3dab
resolve changelog conflicts
cyberbono3 Aug 9, 2021
53f393f
fix x/auth/client/testutil suite test
cyberbono3 Aug 9, 2021
2d0a71c
Update client/keys/add_ledger_test.go
cyberbono3 Aug 11, 2021
c48ab74
Update client/keys/migrate.go
cyberbono3 Aug 11, 2021
b9dc410
expose only 4 New***Record funcs
cyberbono3 Aug 11, 2021
78b94f6
fix Test_multiSigKey_Properties
cyberbono3 Aug 11, 2021
198649b
add comments to some field in types.proto
cyberbono3 Aug 11, 2021
67e144d
add cdc argument to GenerateCoinKey and fix test
cyberbono3 Aug 11, 2021
d26cb81
remove unnecessary encCfg.Codec usage fron non test files
cyberbono3 Aug 11, 2021
9a1474a
check an err by calling GetAddress()
cyberbono3 Aug 11, 2021
50484bf
fix comment
cyberbono3 Aug 11, 2021
b31489d
fix legacyMultiInfo variable
cyberbono3 Aug 11, 2021
6e99bf7
remove nolint in converter.Tx()
cyberbono3 Aug 11, 2021
ca24c3e
add comment to TODO
cyberbono3 Aug 11, 2021
b148b58
fix imports imn cosmovisor/upgrade.go
cyberbono3 Aug 11, 2021
e756bc3
update getIndices in keyring_test
cyberbono3 Aug 12, 2021
87b3283
update changelog according to reviewer suggestion
cyberbono3 Aug 12, 2021
02e01f6
add comment to Migrator
cyberbono3 Aug 12, 2021
ab56011
fix imports in keyring_test.go
cyberbono3 Aug 12, 2021
f7fe694
deprecate legacyInfo
cyberbono3 Aug 12, 2021
46d0414
add comments to public funcs in record
cyberbono3 Aug 12, 2021
707665e
resolve conflicts
cyberbono3 Aug 12, 2021
562cd09
group changelog entries into important pieces
cyberbono3 Aug 12, 2021
29cc5f9
fix testutil/suite test
cyberbono3 Aug 12, 2021
9cee1fc
fix lint issues
cyberbono3 Aug 12, 2021
51f111f
Update CHANGELOG.md
cyberbono3 Aug 18, 2021
eaf552c
Update CHANGELOG.md
cyberbono3 Aug 18, 2021
42c64c9
Update client/keys/import_test.go
cyberbono3 Aug 18, 2021
6082612
Update crypto/ledger/ledger_mock.go
cyberbono3 Aug 18, 2021
0b40e0b
Update client/keys/migrate.go
cyberbono3 Aug 18, 2021
0966929
Update client/keys/migrate.go
cyberbono3 Aug 18, 2021
17c6ab1
Update client/keys/migrate.go
cyberbono3 Aug 18, 2021
01dcb73
Update client/keys/rename_test.go
cyberbono3 Aug 18, 2021
ed5a4d3
Update crypto/keyring/keyring.go
cyberbono3 Aug 18, 2021
eec63ce
fix migrate.go
cyberbono3 Aug 18, 2021
d2fce15
rename types.proto to record.proto
cyberbono3 Aug 18, 2021
c5e2bbf
update runMigrateCmd
cyberbono3 Aug 18, 2021
9baace1
fix NewKeyringFromBackend
cyberbono3 Aug 18, 2021
803b51d
fix import test
cyberbono3 Aug 18, 2021
b7f5ad2
update keystore.Sign func
cyberbono3 Aug 18, 2021
67dc742
Update client/context.go
cyberbono3 Aug 19, 2021
e36b1cc
get rid of nolint in GetFromFields
cyberbono3 Aug 19, 2021
675bb60
add godoc to writeRecord
cyberbono3 Aug 19, 2021
875862b
rename requireEqualNames
cyberbono3 Aug 19, 2021
b35f2b7
set godoc for getIndices
cyberbono3 Aug 19, 2021
2b0abeb
rename exportPrivateKeyFromLegacyInfo to privKeyFromLegacyInfo
cyberbono3 Aug 19, 2021
31958e3
update existsInDb godoc
cyberbono3 Aug 19, 2021
ff7a515
update convertFromLegacyInfo
cyberbono3 Aug 19, 2021
94be644
make migrate() return item,bool,err
cyberbono3 Aug 19, 2021
c36ef1a
migrate returns record,bool,error
cyberbono3 Aug 19, 2021
dbdcbf6
add migration test suite in migration_test.go
cyberbono3 Aug 19, 2021
5db4e6d
add record test suite in record_test.go
cyberbono3 Aug 19, 2021
17d6b7f
remove unneccesary funcs from record.go
cyberbono3 Aug 20, 2021
f991e01
add migrate test suite for CLI
cyberbono3 Aug 20, 2021
5098173
WIP debugging suite tests
cyberbono3 Aug 20, 2021
bfe4857
fix test suites and CLI test
cyberbono3 Aug 23, 2021
c38c780
get rid of encCfg := simapp.MakeTestEncodingConfig() in network.New()
cyberbono3 Aug 28, 2021
4e6a9f1
update changelog
cyberbono3 Aug 28, 2021
c9420a0
remove commented code
cyberbono3 Aug 28, 2021
d8a261d
add tests for migrate CLI command
cyberbono3 Aug 28, 2021
fff333a
get rid of protoMarshalRecord func
cyberbono3 Aug 28, 2021
e5705d6
add godoc for ErrPrivKeyExtr
cyberbono3 Aug 28, 2021
300e3eb
add default case to Record.GetType() method
cyberbono3 Aug 28, 2021
a7feb12
fix changelog
cyberbono3 Aug 28, 2021
638b4f6
fix line
cyberbono3 Aug 28, 2021
8c7bd63
rename s.n1 to s.appName
cyberbono3 Aug 29, 2021
d728fba
update changelog
cyberbono3 Aug 29, 2021
b853cab
update testnet.go
cyberbono3 Aug 29, 2021
fd9dc5f
gofmt
cyberbono3 Aug 29, 2021
0f8ee97
add cmd.Println() to runMigrateCmd
cyberbono3 Sep 7, 2021
ec68bab
add error case: no keys available for migration
cyberbono3 Sep 7, 2021
cf3e898
fix list CLI
cyberbono3 Sep 9, 2021
eb217de
merge master to my branch and resolve conflicts
cyberbono3 Sep 9, 2021
aad66f9
fix lint issues
cyberbono3 Sep 9, 2021
36cf1ac
fix tests
cyberbono3 Sep 9, 2021
fe50c36
fix merge conflict in go.mod
cyberbono3 Sep 9, 2021
e5eda08
add go.sum entry
cyberbono3 Sep 11, 2021
7d7a5e1
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into cy…
cyberbono3 Sep 13, 2021
93047c8
restore TestRenameKey
cyberbono3 Sep 13, 2021
baddec5
update record_test.go
cyberbono3 Sep 13, 2021
f754a78
remove const from TestLocalRecordMarshaling()
cyberbono3 Sep 13, 2021
547d1af
fix merge conflict
cyberbono3 Sep 14, 2021
25ceaf0
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into cy…
cyberbono3 Sep 14, 2021
062b8d1
kr.List() does not return empty items + fix tests
cyberbono3 Sep 16, 2021
a9a8e41
replace *KeyOutput by KeyOutput in client/keys/utils.go
cyberbono3 Sep 16, 2021
3aaffce
keyring.List() returns no error if there are no keys
cyberbono3 Sep 17, 2021
9654b4a
rename to requireEqualRenamedKey
cyberbono3 Sep 18, 2021
1b7b8af
fix error output at privKeyFromLegacyInfo
cyberbono3 Sep 18, 2021
f9ecae8
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into cy…
cyberbono3 Sep 18, 2021
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
6 changes: 5 additions & 1 deletion client/keys/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func runListCmd(cmd *cobra.Command, _ []string) error {
return err
}

records, err := clientCtx.Keyring.List()
records, err := clientCtx.Keyring.List()
if err != nil {
return err
}
Expand All @@ -39,6 +39,10 @@ func runListCmd(cmd *cobra.Command, _ []string) error {
}

for _, r := range records {
if r == nil {
cyberbono3 marked this conversation as resolved.
Show resolved Hide resolved
continue
}

cmd.Println(r.Name)
}

Expand Down
15 changes: 11 additions & 4 deletions client/keys/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,16 @@ func printKeyringRecords(w io.Writer, records []*cryptokeyring.Record, output st
}

func printTextInfos(w io.Writer, kos []cryptokeyring.KeyOutput) {
out, err := yaml.Marshal(&kos)
if err != nil {
panic(err)
for _, ko := range kos {
if ko == (cryptokeyring.KeyOutput{}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment. Hence, I have to print out non empty KeyOutput structs only.

continue
}

out, err := yaml.Marshal(&ko)
if err != nil {
panic(err)
}

fmt.Fprintln(w, string(out))
}
fmt.Fprintln(w, string(out))
}
8 changes: 6 additions & 2 deletions crypto/keyring/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ func MkAccKeyOutput(k *Record) (KeyOutput, error) {
func MkAccKeysOutput(records []*Record) ([]KeyOutput, error) {
kos := make([]KeyOutput, len(records))
var err error
for i, re := range records {
kos[i], err = MkAccKeyOutput(re)
for i, r := range records {
if r == nil {
continue
}

kos[i], err = MkAccKeyOutput(r)
if err != nil {
return nil, err
}
Expand Down