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

fix: add wrong address to genesis file in add-genesis-account command. #81

Merged
merged 3 commits into from
Aug 2, 2022

Conversation

zemyblue
Copy link
Member

@zemyblue zemyblue commented Aug 2, 2022

Description

Fix the problem to add wrong address in genesis when execute add-genesis-account command with account address.

Motivation and context

When execute below command, the added address in genesis file is wrong address.

lbm add-genesis-account $(lbm keys show account0 -a --keyring-backend=test --testnet) 100tcony --testnet

Error step

  1. lbm keys show jack -a --keyring-backend=test
  2. lbm add-genesis-account link146asaycmtydq45kxc8evntqfgepagygelel00h 1000link,1000000000000stake
  3. lbm gentx jack 100000000stake --keyring-backend=test --chain-id=lbm

AS-IS

Error: failed to validate account in genesis: account link146asaycmtydq45kxc8evntqfgepagygelel00h does not have a balance in the genesis state
in genesis.json

 29   "app_state": {
 30     "auth": {
 31       "params": {
 32         "max_memo_characters": "256",
 33         "tx_sig_limit": "7",
 34         "tx_size_cost_per_byte": "10",
 35         "sig_verify_cost_ed25519": "590",
 36         "sig_verify_cost_secp256k1": "1000"
 37       },
 38       "accounts": [
 39         {
 40           "@type": "/cosmos.auth.v1beta1.BaseAccount",
 41           "address": "link1d35ku6e3xsmxzump093k6arev3cngdtt0p3nsetkde68zen8v4cxzemevajkcetvxqcxsdjr7hn",
 42           "pub_key": null,
 43           "account_number": "0",
 44           "sequence": "0"
 45         }, 

Address type not match

TO-BE

Address type matched

Screenshots (if appropriate):

Checklist:

  • I followed the contributing guidelines.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Signed-off-by: zemyblue <zemyblue@gmail.com>
@zemyblue zemyblue requested review from 0Tech, dudong2, tnasu and ulbqb August 2, 2022 09:54
@zemyblue zemyblue self-assigned this Aug 2, 2022
Copy link
Member

@tnasu tnasu left a comment

Choose a reason for hiding this comment

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

LGTM your changes, but, I found other wrong converts.

Should fix the below with the diff.

$ git diff
diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go
index 4a1161fa..0198dfca 100644
--- a/cli_test/cli_test.go
+++ b/cli_test/cli_test.go
@@ -339,7 +339,7 @@ func TestLBMCreateValidator(t *testing.T) {
        defer n.Cleanup()
 
        barAddr := f.KeyAddress(keyBar)
-       barVal := barAddr.ToValAddress()
+       barVal := sdk.ValAddress(barAddr)
 
        consPubKey := sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeConsPub, ed25519.GenPrivKey().PubKey())
 
diff --git a/cli_test/multi_test.go b/cli_test/multi_test.go
index 150700ce..2b485979 100644
--- a/cli_test/multi_test.go
+++ b/cli_test/multi_test.go
@@ -111,7 +111,7 @@ func TestMultiValidatorAddNodeAndPromoteValidator(t *testing.T) {
        }
 
        barAddr := f2.KeyAddress(keyBar)
-       barVal := barAddr.ToValAddress()
+       barVal := sdk.ValAddress(barAddr)
 
        sendTokens := sdk.TokensFromConsensusPower(10)
        {
@@ -152,4 +152,4 @@ func TestMultiValidatorAddNodeAndPromoteValidator(t *testing.T) {
                require.Len(t, validatorDelegations.DelegationResponses, 1)
                require.NotZero(t, validatorDelegations.DelegationResponses[0].Delegation.GetShares())
        }
-}
\ No newline at end of file
+}

Signed-off-by: zemyblue <zemyblue@gmail.com>
@zemyblue zemyblue requested a review from tnasu August 2, 2022 11:29
@zemyblue
Copy link
Member Author

zemyblue commented Aug 2, 2022

cli_test.go and multi_test.go are not compiled because this codes refer old lbm-sdk version.
So we need to bump up to latest gaia.
I added this problem as issue. #82

Copy link
Member

@tnasu tnasu left a comment

Choose a reason for hiding this comment

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

Got it, it's okay to merge within this change.

@zemyblue zemyblue merged commit 979c4d2 into rc/v0.5.0-rc0 Aug 2, 2022
@zemyblue zemyblue deleted the fix_add_genesis_account branch August 2, 2022 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants