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

Problem: feeibc, evm and feemarket gensis migrate is broken #1124

Merged

Conversation

mmsqe
Copy link
Collaborator

@mmsqe mmsqe commented Aug 7, 2023

👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻

Closes: #1122

PR Checklist:

  • Have you read the CONTRIBUTING.md?
  • Does your PR follow the C4 patch requirements?
  • Have you rebased your work on top of the latest master?
  • Have you checked your code compiles? (make)
  • Have you included tests for any non-trivial functionality?
  • Have you checked your code passes the unit tests? (make test)
  • Have you checked your code formatting is correct? (go fmt)
  • Have you checked your basic code style is fine? (golangci-lint run)
  • If you added any dependencies, have you checked they do not contain any known vulnerabilities? (go list -json -m all | nancy sleuth)
  • If your changes affect the client infrastructure, have you run the integration test?
  • If your changes affect public APIs, does your PR follow the C4 evolution of public contracts?
  • If your code changes public APIs, have you incremented the crate version numbers and documented your changes in the CHANGELOG.md?
  • If you are contributing for the first time, please read the agreement in CONTRIBUTING.md now and add a comment to this pull request stating that your PR is in accordance with the Developer's Certificate of Origin.

Thank you for your code, it's appreciated! :)

…rypto-org-chain#1125)

* Problem: feeibc, evm and feemarket gensis migrate is broken

* make use of sdk

* add test

* fix gravity genesis

* update deps

* add change doc

* update deps

* Update CHANGELOG.md

Co-authored-by: yihuang <huang@crypto.com>
Signed-off-by: mmsqe <mavis@crypto.com>

---------

Signed-off-by: mmsqe <mavis@crypto.com>
Co-authored-by: yihuang <huang@crypto.com>
@mmsqe mmsqe force-pushed the release/v1.0.x-migrate-gen branch from b10c2ee to e76a2cc Compare August 8, 2023 14:35
@mmsqe mmsqe marked this pull request as ready for review August 8, 2023 14:36
@mmsqe mmsqe requested a review from a team as a code owner August 8, 2023 14:36
@mmsqe mmsqe requested review from devashishdxt and leejw51crypto and removed request for a team August 8, 2023 14:36
@yihuang yihuang merged commit a314e1d into crypto-org-chain:release/v1.0.x Aug 10, 2023
@alpha-omega-labs
Copy link

It seems like migration is still not working with this commit:

trying to migrate 0.43 to 0.46 genesis.json

  1. merged this commit: alpha-omega-labs/genesis-ethermint@a54d8a9

  2. built and made migration, something changed in genesis.json

cronosd migrate v0.46 genesis.json > genesis46_new.json
10377997590 Aug 17 19:44 genesis.json
10378009564 Aug 17 19:59 genesis46_new.json

  1. Had same error upon validation of genesis:

rm -r genesis.json
mv genesis46_new.json genesis.json

cronosd validate-genesis --trace
Error: error validating genesis file /root/.cronos/config/genesis.json: failed to unmarshal feeibc genesis state: EOF

@mmsqe
Copy link
Collaborator Author

mmsqe commented Aug 18, 2023

cronosd validate-genesis --trace Error: error validating genesis file /root/.cronos/config/genesis.json: failed to unmarshal feeibc genesis state: EOF

Have you try cronosd tx cronos migrate v1.0 genesis.json? Since the new migrate cmd is in cronos side

@alpha-omega-labs
Copy link

cronosd validate-genesis --trace Error: error validating genesis file /root/.cronos/config/genesis.json: failed to unmarshal feeibc genesis state: EOF

Have you try cronosd tx cronos migrate v1.0 genesis.json? Since the new migrate cmd is in cronos side

Yes, thank you, command worked for migration process, however validation of migrated json still return error:

cronosd validate-genesis --trace

Error: error validating genesis file /root/.cronos/config/genesis.json: failed to unmarshal cronos genesis state: EOF

@alpha-omega-labs
Copy link

If some field were absent at all because it was not cronos exported - can it be an issue here?

@alpha-omega-labs
Copy link

This is the error upon cronosd start

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x141a438]

goroutine 1 [running]:
math/big.(*Int).Sign(...)
        math/big/int.go:41
github.com/cosmos/cosmos-sdk/types.Dec.IsNegative(...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/types/decimal.go:211
github.com/cosmos/cosmos-sdk/x/staking/types.validateMinCommissionRate({0x2b33b60?, 0x0?})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/staking/types/params.go:226 +0x58
github.com/cosmos/cosmos-sdk/x/params/types.Subspace.SetParamSet({{0x3cb2ed0, 0xc0016370c0}, 0xc000014040, {0x3c83788, 0xc00146b6d0}, {0x3c837d8, 0xc00146b790}, {0xc001d42348, 0x7, 0x18}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/params/types/subspace.go:262 +0x20d
github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper.SetParams(...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/staking/keeper/params.go:71
github.com/cosmos/cosmos-sdk/x/staking/keeper.Keeper.InitGenesis({{0x3c83788, 0xc00146b680}, {0x3cb2ed0, 0xc0016370c0}, {0x3ca4f20, 0xc001686be0}, {0x7f7718254338, 0xc0016fd8c0}, {0x3cb23b0, 0xc00160cfc0}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/staking/keeper/genesis.go:28 +0x1c5
github.com/cosmos/cosmos-sdk/x/staking.AppModule.InitGenesis({{{0x3cbb158, 0xc0016370c0}}, {{0x3c83788, 0xc00146b680}, {0x3cb2ed0, 0xc0016370c0}, {0x3ca4f20, 0xc001686be0}, {0x7f7718254338, 0xc0016fd8c0}, ...}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/staking/module.go:152 +0x105
github.com/cosmos/cosmos-sdk/types/module.(*Manager).InitGenesis(_, {{0x3c9fe68, 0xc000056090}, {0x3cb38e0, 0xc00159f300}, {{0x0, 0x0}, {0xc001d7a020, 0xc}, 0x67049f, ...}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/types/module/module.go:322 +0x363
github.com/crypto-org-chain/cronos/app.(*App).InitChainer(_, {{0x3c9fe68, 0xc000056090}, {0x3cb38e0, 0xc00159f300}, {{0x0, 0x0}, {0xc001d7a020, 0xc}, 0x67049f, ...}, ...}, ...)
        github.com/crypto-org-chain/cronos/app/app.go:872 +0x1cf
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).InitChain(0xc001b3e380, {{0x1, 0xed9ed0804, 0x0}, {0xc001d7a020, 0xc}, 0xc0013872a0, {0xc00112a000, 0x2c, 0x2c}, ...})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/baseapp/abci.go:71 +0x3f5
github.com/tendermint/tendermint/abci/client.(*localClient).InitChainSync(0xc00162daa0, {{0x1, 0xed9ed0804, 0x0}, {0xc001d7a020, 0xc}, 0xc0013872a0, {0xc00112a000, 0x2c, 0x2c}, ...})
        github.com/tendermint/tendermint@v0.34.29/abci/client/local_client.go:272 +0x118
github.com/tendermint/tendermint/proxy.(*appConnConsensus).InitChainSync(0xc001391470?, {{0x1, 0xed9ed0804, 0x0}, {0xc001d7a020, 0xc}, 0xc0013872a0, {0xc00112a000, 0x2c, 0x2c}, ...})
        github.com/tendermint/tendermint@v0.34.29/proxy/app_conn.go:77 +0x55
github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocksWithContext(_, {_, _}, {{{0xb, 0x0}, {0x2b61993, 0x7}}, {0xc001d7a020, 0xc}, 0x67049f, ...}, ...)
        github.com/tendermint/tendermint@v0.34.29/consensus/replay.go:336 +0xf58
github.com/tendermint/tendermint/consensus.(*Handshaker).HandshakeWithContext(0xc000ee0ca0, {0x3c9fe30, 0xc0011616d0}, {0x3cb6728?, 0xc00163e820?})
        github.com/tendermint/tendermint@v0.34.29/consensus/replay.go:274 +0x405
github.com/tendermint/tendermint/node.doHandshake({_, _}, {_, _}, {{{0xb, 0x0}, {0x2b61993, 0x7}}, {0xc001d7a020, 0xc}, ...}, ...)
        github.com/tendermint/tendermint@v0.34.29/node/node.go:330 +0x1c8
github.com/tendermint/tendermint/node.NewNodeWithContext({0x3c9fe30, 0xc0011616d0}, 0xc0001932c0, {0x3c9bf90, 0xc00158e780}, 0xc0017120e0, {0x3c7aa40, 0xc0001dca80}, 0xbebc2?, 0x37c4420, ...)
        github.com/tendermint/tendermint@v0.34.29/node/node.go:797 +0x5b7
github.com/evmos/ethermint/server.startInProcess(_, {{0x0, 0x0, 0x0}, {0x3cc8728, 0xc00180a8d0}, 0x0, {0x0, 0x0}, {0x3cbb158, ...}, ...}, ...)
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:347 +0xcc5
github.com/evmos/ethermint/server.StartCmd.func2.2()
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:145 +0x5e
github.com/evmos/ethermint/server.wrapCPUProfile(0xc0001e9280, 0xc0018cd928)
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:656 +0x2cb
github.com/evmos/ethermint/server.StartCmd.func2(0xc00121d800?, {0x54eba78?, 0x0?, 0x0?})
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:144 +0x279
github.com/spf13/cobra.(*Command).execute(0xc00121d800, {0x54eba78, 0x0, 0x0})
        github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc001013800)
        github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.6.1/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        github.com/spf13/cobra@v1.6.1/command.go:961
github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x2498210?, {0x2b5fd7f, 0x6}, {0xc000e60390, 0xd})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/server/cmd/execute.go:36 +0x20f
main.main()
        github.com/crypto-org-chain/cronos/cmd/cronosd/main.go:13 +0x38

@mmsqe
Copy link
Collaborator Author

mmsqe commented Aug 18, 2023

If some field were absent at all because it was not cronos exported - can it be an issue here?

Not sure which fields you mean, do you see min_commission_rate in your genesis?

@alpha-omega-labs
Copy link

If some field were absent at all because it was not cronos exported - can it be an issue here?

Not sure which fields you mean, do you see min_commission_rate in your genesis?

No such field (after conversion with suggested v1 command).
I assume we

  1. Have some fields that should not be there
  2. Have some fields absent

Besides this update handlers way there is also a manual way: Ive made a script that parse only structure of big genesis.json (cut repeating sequences and value, leave only keys structures). Is there a place to download any cronos state to compare it with genesisL1 state and fix differences?

I can also provide v1 converted state as it is now.

@alpha-omega-labs
Copy link

So here are 2 files:

  1. migrated genesis.json to v1 with your provided command
  2. json keys structure extracted from it

http://142.44.143.79/genesis_v1_converted_pretty.json
http://142.44.143.79/output_keys_structure-L1-cronos-v1-pretty.json

Now need to manually compare keys structure with cronos genesis.json (or state exported genesis.json) structure and get out of diffs.

@alpha-omega-labs
Copy link

genesis.json of cronos mainnet also not have min_commission_rate, so I assume its only exported state of cronos has it and should be compared

@alpha-omega-labs
Copy link

Just in case, cronos latest state:
http://51.195.61.14/cronos_pretty_state.json

@alpha-omega-labs
Copy link

So far found:

  1. L1 genesis.json have

"intrarelayer": {
"params": "...",
"token_pairs": []
},
Which is absent in cronos

  1. L1 genesis.json dont have

    "cronos": {
    "params": {
    "ibc_cro_denom": "ibc/F16FDC11A7662B86BC0B9CE61871CBACF7C20606F95E86260FD38915184B75B4",
    "ibc_timeout": "86400000000000",
    "cronos_admin": "genesis14ch295rgshayusha4eg3kkqlzg0xhnxdpqrp5y",
    "enable_auto_deployment": false
    },
    "external_contracts": [],
    "auto_contracts": []
    },

Which is presented in cronos

@alpha-omega-labs
Copy link

Not exactly clear:

  1. L1 have empty:

    "feegrant": {
    "allowances": []
    },

And cronos have it filled with stuff

@alpha-omega-labs
Copy link

We have a colossal mismatch in gov module structure:

Cronos gov:

"gov": {
      "deposit_params": {
        "max_deposit_period": "21600s",
        "min_deposit": [
          {
            "amount": "20000000000000000000000",
            "denom": "basecro"
          }
        ]
      },
      "deposits": [],
      "proposals": [
        {
          "deposit_end_time": "2022-05-05T17:05:04.588417263Z",
          "final_tally_result": {
            "abstain_count": "0",
            "no_count": "0",
            "no_with_veto_count": "0",
            "yes_count": "40450000000"
          },
          "id": "2",
          "messages": [
            {
              "@type": "/cosmos.gov.v1.MsgExecLegacyContent",
              "authority": "crc10d07y265gmmuvt4z0w9aw880jnsr700jdufnyd",
              "content": {
                "@type": "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal",
                "description": "v0.7.0 Cronos Mainnet beta network upgrade",
                "plan": {
                  "height": "2693800",
                  "info": "{\"binaries\":{\"darwin/amd64\":\"https://github.com/crypto-org-chain/cronos/releases/download/v0.7.0/cronos_0.7.0_Darwin_x86_64.tar.gz?checksum=sha256:05699ac25a971780e8e63e5316d8eca8e905fc6b9b86e74bcd93fdf85b4759d9\",\"darwin/arm64\":\"https://github.com/crypto-org-chain/cronos/releases/download/v0.7.0/cronos_0.7.0_Darwin_arm64.tar.gz?checksum=sha256:e9bcdf0adce2c8a189657f91b07a11>
                  "name": "v0.7.0",
                  "time": "0001-01-01T00:00:00Z",
                  "upgraded_client_state": null
                },
                "title": "Cronos Mainnet network upgrade to beta v0.7.0"
              }
            }
          ],
          "metadata": "",
          "status": "PROPOSAL_STATUS_PASSED",
          "submit_time": "2022-05-05T11:05:04.588417263Z",
          "total_deposit": [
            {
              "amount": "20000000000000000000000",
              "denom": "basecro"
            }
          ],
          "voting_end_time": "2022-05-08T11:05:04.588417263Z",
          "voting_start_time": "2022-05-05T11:05:04.588417263Z"
        },
        {
          "deposit_end_time": "2022-05-12T09:10:18.139904407Z",
          "final_tally_result": {
            "abstain_count": "0",
            "no_count": "0",
            "no_with_veto_count": "0",
            "yes_count": "40900000000"
          },
          "id": "3",
          "messages": [
            {
              "@type": "/cosmos.gov.v1.MsgExecLegacyContent",
              "authority": "crc10d07y265gmmuvt4z0w9aw880jnsr700jdufnyd",
              "content": {
                "@type": "/cosmos.params.v1beta1.ParameterChangeProposal",
                "changes": [
                  {
                    "key": "BlockParams",
                    "subspace": "baseapp",
                    "value": "{ \"max_bytes\": \"1048576\", \"max_gas\": \"20000000\" }"
                  }
                ],
                "description": "Increase block gas limit from 10000000 to 20000000",
                "title": "Increase block gas limit from 10000000 to 20000000"
              }
            }
          ],
          "metadata": "",
          "status": "PROPOSAL_STATUS_PASSED",
          "submit_time": "2022-05-12T03:10:18.139904407Z",
          "total_deposit": [
            {
              "amount": "20000000002000000000001",
              "denom": "basecro"
            }
          ],
          "voting_end_time": "2022-05-15T04:08:53.394099785Z",
          "voting_start_time": "2022-05-12T04:08:53.394099785Z"
        },

GenesisL1 gov:

"gov": {
      "deposit_params": {
        "max_deposit_period": "1209600s",
        "min_deposit": [
          {
            "amount": "10000000000000000000000",
            "denom": "el1"
          }
        ]
      },
      "deposits": [],
      "proposals": [
        {
          "content": {
            "@type": "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal",
            "amount": [
              {
                "amount": "50000000000000000000",
                "denom": "el1"
              }
            ],
            "description": "Testing the spending proposal, 50 L1 to genesis19xtey3vr3fngys8r5dvjgw60kjancdys4w8qld",
            "recipient": "genesis19xtey3vr3fngys8r5dvjgw60kjancdys4w8qld",
            "title": "Spending proposal"
          },
          "deposit_end_time": "2022-05-10T00:01:33.347170875Z",
          "final_tally_result": {
            "abstain": "0",
            "no": "0",
            "no_with_veto": "0",
            "yes": "3674921390506196877709494"
          },
          "proposal_id": "1",
          "status": "PROPOSAL_STATUS_PASSED",
          "submit_time": "2022-04-26T00:01:33.347170875Z",
          "total_deposit": [
            {
              "amount": "10000000000000000000000",
              "denom": "el1"
            }
          ],
          "voting_end_time": "2022-05-10T00:01:33.347170875Z",
          "voting_start_time": "2022-04-26T00:01:33.347170875Z"
        },
        {
          "content": {
            "@type": "/cosmos.gov.v1beta1.TextProposal",
            "description": "Allocate 2,500,000 L1 coins for the genesis.gift to Cosmos ATOM delegators. By voting YES to this proposal, you will signal that you approve allocation of L1 coins for the gift to Cosmos ATOM delegators.",
            "title": "Signaling Proposal - Allocation of 2,500,000 L1 to genesis.gift"
          },
          "deposit_end_time": "2022-05-26T18:19:05.608935764Z",
          "final_tally_result": {
            "abstain": "0",
            "no": "0",
            "no_with_veto": "0",
            "yes": "2693943396045493765156103"
          },
          "proposal_id": "2",
          "status": "PROPOSAL_STATUS_PASSED",
          "submit_time": "2022-05-12T18:19:05.608935764Z",
          "total_deposit": [
            {
              "amount": "10000000000000000000000",
              "denom": "el1"
            }
          ],
          "voting_end_time": "2022-05-26T18:19:05.608935764Z",
          "voting_start_time": "2022-05-12T18:19:05.608935764Z"
        },
        {
          "content": {
            "@type": "/cosmos.gov.v1beta1.TextProposal",
            "description": "Allocate 500,000 L1 coins for the Osmosis LP. By voting YES to this proposal, you will signal that you approve allocation of L1 coins from the community budget to Osmosis LP to open the doors for other projects to GenesisL1 blockchain.",
            "title": "Signaling Proposal - Allocation of 500,000 L1 to Osmosis LP"
          },
          "deposit_end_time": "2022-05-26T18:27:34.577800344Z",
          "final_tally_result": {
            "abstain": "0",
            "no": "405607319950849857387739",
            "no_with_veto": "0",
            "yes": "2668586874539296835903254"
          },

@alpha-omega-labs
Copy link

Mismatch in gov proposal structure:

CRONOS


                {
                    "deposit_end_time": "...",
                    "final_tally_result": {
                        "abstain_count": "...",
                        "no_count": "...",
                        "no_with_veto_count": "...",
                        "yes_count": "..."
                    },
                    "id": "...",
                    "messages": [
                        {
                            "@type": "...",
                            "authority": "...",
                            "content": {
                                "@type": "...",
                                "description": "...",
                                "plan": {
                                    "height": "...",
                                    "info": "...",
                                    "name": "...",
                                    "time": "...",
                                    "upgraded_client_state": "..."
                                },
                                "title": "..."
                            }
                        }
                    ],
                    "metadata": "...",
                    "status": "...",
                    "submit_time": "...",
                    "total_deposit": [],
                    "voting_end_time": "...",
                    "voting_start_time": "..."
                },

GENESISL1


                {
                    "content": {
                        "@type": "...",
                        "amount": "...",
                        "description": "...",
                        "recipient": "...",
                        "title": "..."
                    },
                    "deposit_end_time": "...",
                    "final_tally_result": {
                        "abstain": "...",
                        "no": "...",
                        "no_with_veto": "...",
                        "yes": "..."
                    },
                    "proposal_id": "...",
                    "status": "...",
                    "submit_time": "...",
                    "total_deposit": [],
                    "voting_end_time": "...",
                    "voting_start_time": "..."
                },

@alpha-omega-labs
Copy link

What is an "authority" field? is it someone who submit proposal?

@alpha-omega-labs
Copy link

Seems like all diffs fixed and got this weird big.INT bug
cosmos/cosmos-sdk#15029 (comment)
:)

@alpha-omega-labs
Copy link

If some field were absent at all because it was not cronos exported - can it be an issue here?

Not sure which fields you mean, do you see min_commission_rate in your genesis?

  1. genesis.json of L1 have no "min_commission_rate" field in staking params
  2. genesis.json of cronos mainnet also have no "min_commission_rate" in staking params
  3. genesis.json of cronos exported state DOES HAVE "min_commission_rate" in staking params

Adding min_commission_rate to staking params and still have that issue. Field copied from exported cronos state.

@mmsqe
Copy link
Collaborator Author

mmsqe commented Aug 20, 2023

@alpha-omega-labs I see some patch patterns like add missing or cast wrong type, but might take the risk when modify since cronos genesis is valid.

@alpha-omega-labs
Copy link

@alpha-omega-labs I see some patch patterns like add missing or cast wrong type, but might take the risk when modify since cronos genesis is valid.

Thank you very much for your help! I will try those in a few hours!
I see this commit fixing migration of min_commission_rate 8434f63

But is this one 8d56138 for export or also for migration?

Also question about gov structure - it totally different. I will fix it with custom python script to match cronos format, but is this an issue? For now just deleted gov module state to concentrate on this stake space problem with min_commission_rate.

Another question - may it be related to denom somewhere in state? I see its "stake" in many places in cronos genesis.json and we have "el1" everywhere.

I can't figure out why it comes as "types.Dec.IsNegative(...)" in no place its negative and its actually default "0" - exact same as in cronos genesis.json

I will provide migrated and updated genesis.json with all fixes to date and gov ommited, maybe you will see something else that don't allow validation.

Anyways, really appreciate your help and time with this, it really matter!

@alpha-omega-labs
Copy link

@alpha-omega-labs I see some patch patterns like add missing or cast wrong type, but might take the risk when modify since cronos genesis is valid.

Migration command with those 2 commits fail:

cronosd tx cronos migrate v1.0 genesis.json > fix.json
panic: json: cannot unmarshal string into Go struct field RedelegationEntry.redelegations.entries.creation_height of type int64

goroutine 1 [running]:
github.com/crypto-org-chain/cronos/x/cronos/client/cli.Migrate(_, {{0x0, 0x0, 0x0}, {0x3ccfc88, 0xc0016cc030}, 0x0, {0x0, 0x0}, {0x3cc26b8, ...}, ...})
        github.com/crypto-org-chain/cronos/x/cronos/client/cli/tx.go:337 +0x607
github.com/cosmos/cosmos-sdk/x/genutil/client/cli.MigrateHandler(0x0?, {0xc000dcb640, 0x2, 0x0?}, 0x0?)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/genutil/client/cli/migrate.go:109 +0x1f5
github.com/crypto-org-chain/cronos/x/cronos/client/cli.MigrateGenesisCmd.func1(0xc001408000?, {0xc000dcb640?, 0x2?, 0x2?})
        github.com/crypto-org-chain/cronos/x/cronos/client/cli/tx.go:369 +0x25
github.com/spf13/cobra.(*Command).execute(0xc001408000, {0xc000dcb600, 0x2, 0x2})
        github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000fa9800)
        github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.6.1/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        github.com/spf13/cobra@v1.6.1/command.go:961
github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x249e410?, {0x2b66b9f, 0x6}, {0xc001154000, 0xd})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/server/cmd/execute.go:36 +0x20f
main.main()
        github.com/crypto-org-chain/cronos/cmd/cronosd/main.go:13 +0x38

@alpha-omega-labs
Copy link

Some weird part:
Ive exported cronosd state.
It is well validated - genesis.json is VALID by cronosd daemon, HOWEVER!
starting chain with it throw panic:


initializing blockchain state from genesis.json
panic: value is nil

goroutine 1 [running]:
github.com/cosmos/cosmos-sdk/store/types.AssertValidValue(...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/store/types/validity.go:13
github.com/cosmos/cosmos-sdk/store/gaskv.(*Store).Set(0x5272070?, {0xc0fd499d20?, 0x1?, 0x1?}, {0x0?, 0xed?, 0xed?})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/store/gaskv/store.go:49 +0x11c
github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper.SetAccount({{0x3c83788, 0xc0016b5190}, {0x3cb2ed0, 0xc0010be170}, {{0x3cb2ed0, 0xc0010be170}, 0xc000d84000, {0x3c83788, 0xc0016b5200}, {0x3c837d8, ...}, ...}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/auth/keeper/account.go:82 +0x2da
github.com/cosmos/cosmos-sdk/x/auth/keeper.AccountKeeper.InitGenesis({{0x3c83788, 0xc0016b5190}, {0x3cb2ed0, 0xc0010be170}, {{0x3cb2ed0, 0xc0010be170}, 0xc000d84000, {0x3c83788, 0xc0016b5200}, {0x3c837d8, ...}, ...}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/auth/keeper/genesis.go:23 +0x285
github.com/cosmos/cosmos-sdk/x/auth.AppModule.InitGenesis({{}, {{0x3c83788, 0xc0016b5190}, {0x3cb2ed0, 0xc0010be170}, {{0x3cb2ed0, 0xc0010be170}, 0xc000d84000, {0x3c83788, 0xc0016b5200}, ...}, ...}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/x/auth/module.go:144 +0x125
github.com/cosmos/cosmos-sdk/types/module.(*Manager).InitGenesis(_, {{0x3c9fe68, 0xc0000560a0}, {0x3cb38e0, 0xc000e2a2c0}, {{0x0, 0x0}, {0xc001d0c010, 0xc}, 0x67049f, ...}, ...}, ...)
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/types/module/module.go:322 +0x363
github.com/crypto-org-chain/cronos/app.(*App).InitChainer(_, {{0x3c9fe68, 0xc0000560a0}, {0x3cb38e0, 0xc000e2a2c0}, {{0x0, 0x0}, {0xc001d0c010, 0xc}, 0x67049f, ...}, ...}, ...)
        github.com/crypto-org-chain/cronos/app/app.go:872 +0x1cf
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).InitChain(0xc0001488c0, {{0x1, 0xed9ed0804, 0x0}, {0xc001d0c010, 0xc}, 0xc00059f4a0, {0xc001230480, 0x2c, 0x2c}, ...})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/baseapp/abci.go:71 +0x3f5
github.com/tendermint/tendermint/abci/client.(*localClient).InitChainSync(0xc00001f680, {{0x1, 0xed9ed0804, 0x0}, {0xc001d0c010, 0xc}, 0xc00059f4a0, {0xc001230480, 0x2c, 0x2c}, ...})
        github.com/tendermint/tendermint@v0.34.29/abci/client/local_client.go:272 +0x118
github.com/tendermint/tendermint/proxy.(*appConnConsensus).InitChainSync(0xc000fee570?, {{0x1, 0xed9ed0804, 0x0}, {0xc001d0c010, 0xc}, 0xc00059f4a0, {0xc001230480, 0x2c, 0x2c}, ...})
        github.com/tendermint/tendermint@v0.34.29/proxy/app_conn.go:77 +0x55
github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocksWithContext(_, {_, _}, {{{0xb, 0x0}, {0x2b6199c, 0x7}}, {0xc001d0c010, 0xc}, 0x67049f, ...}, ...)
        github.com/tendermint/tendermint@v0.34.29/consensus/replay.go:336 +0xf58
github.com/tendermint/tendermint/consensus.(*Handshaker).HandshakeWithContext(0xc0006baca0, {0x3c9fe30, 0xc000020fa0}, {0x3cb6728?, 0xc002600000?})
        github.com/tendermint/tendermint@v0.34.29/consensus/replay.go:274 +0x405
github.com/tendermint/tendermint/node.doHandshake({_, _}, {_, _}, {{{0xb, 0x0}, {0x2b6199c, 0x7}}, {0xc001d0c010, 0xc}, ...}, ...)
        github.com/tendermint/tendermint@v0.34.29/node/node.go:330 +0x1c8
github.com/tendermint/tendermint/node.NewNodeWithContext({0x3c9fe30, 0xc000020fa0}, 0xc000d52500, {0x3c9bf90, 0xc001014be0}, 0xc001ddbc10, {0x3c7aa40, 0xc0000125a0}, 0xbebc2?, 0x37c4420, ...)
        github.com/tendermint/tendermint@v0.34.29/node/node.go:797 +0x5b7
github.com/evmos/ethermint/server.startInProcess(_, {{0x0, 0x0, 0x0}, {0x3cc8728, 0xc0012e0750}, 0x0, {0x0, 0x0}, {0x3cbb158, ...}, ...}, ...)
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:347 +0xcc5
github.com/evmos/ethermint/server.StartCmd.func2.2()
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:145 +0x5e
github.com/evmos/ethermint/server.wrapCPUProfile(0xc0012f3f80, 0xc001a7f928)
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:656 +0x2cb
github.com/evmos/ethermint/server.StartCmd.func2(0xc001003800?, {0x54eba78?, 0x0?, 0x0?})
        github.com/evmos/ethermint@v0.0.0-00010101000000-000000000000/server/start.go:144 +0x279
github.com/spf13/cobra.(*Command).execute(0xc001003800, {0x54eba78, 0x0, 0x0})
        github.com/spf13/cobra@v1.6.1/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0xc000eef800)
        github.com/spf13/cobra@v1.6.1/command.go:1044 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.6.1/command.go:968
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        github.com/spf13/cobra@v1.6.1/command.go:961
github.com/cosmos/cosmos-sdk/server/cmd.Execute(0x2498210?, {0x2b5fd82, 0x6}, {0xc00109ab60, 0xd})
        github.com/cosmos/cosmos-sdk@v0.46.15-0.20230807104542-537257060180/server/cmd/execute.go:36 +0x20f
main.main()
        github.com/crypto-org-chain/cronos/cmd/cronosd/main.go:13 +0x38

What can be the reason? Its literally nothing changed there after export and binary is original cronosd but with cometbft changed to allow big genesis.json by disabling compression.

@alpha-omega-labs
Copy link

alpha-omega-labs commented Aug 23, 2023

Do you know the way to address this cosmos/cosmos-sdk#17250
and make validate-genesis command showing exact place in json where it stuck? That would be extremely handy!

@alpha-omega-labs
Copy link

Aside from gov module everything since to be valid atm, thank you very much for help again!

Can you please tell what is an "authority": key in proposals?
Is it specific to cronos? Can anyone submit proposals in cronos or its some sort of hardcoded key of who can submit proposals?
Thank you

@alpha-omega-labs
Copy link

Aside from gov module everything since to be valid atm, thank you very much for help again!

Can you please tell what is an "authority": key in proposals? Is it specific to cronos? Can anyone submit proposals in cronos or its some sort of hardcoded key of who can submit proposals? Thank you

Found it - its a gov module address, BTW! its same for all networks, just prefix different.

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