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: current code is not based on stargate scaffold #55

Merged
merged 2 commits into from
Sep 15, 2020
Merged

Conversation

yihuang
Copy link
Collaborator

@yihuang yihuang commented Sep 11, 2020

Solution:

  • Re-generate with starport's stargate branch

@leejw51crypto
Copy link
Contributor

add-genesis-account not working.

i ran this command)
chain-maind add-genesis-account cro1.......................... 200000000cro

@tomtau
Copy link
Contributor

tomtau commented Sep 14, 2020

add-genesis-account not working.

i ran this command)
chain-maind add-genesis-account cro1.......................... 200000000cro

@leejw51crypto @yihuang it seems this re-generated code 1) doesn't set up bech32 prefixes, 2) does cro->basecro conversion?

@leejw51crypto
Copy link
Contributor

leejw51crypto commented Sep 14, 2020

chain-maind keys add validator1

generation fine, but

chain-maind keys list
[]

@yihuang
Copy link
Collaborator Author

yihuang commented Sep 14, 2020

it seems this re-generated code 1) doesn't set up bech32 prefixes,

copied the prefix module from master branch.

  1. does cro->basecro conversion?

did the conversion by hacking the cli arguments.

@yihuang yihuang force-pushed the stargate branch 2 times, most recently from f1adb50 to 612cd86 Compare September 14, 2020 04:26
Comment on lines 75 to 78
if coin.Denom == "cro" {
coin.Denom = "basecro"
coin.Amount = coin.Amount.Mul(sdk.NewInt(100000000))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can this instead call sdk.ConvertCoin(amount, app.BaseCoinUnit) ? just in case we have other units (e.g. "millicro")

Copy link
Collaborator Author

@yihuang yihuang Sep 14, 2020

Choose a reason for hiding this comment

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

If we call sdk.ConvertCoin, we need also register the denominations in cosmos-sdk, the alternative is we just maintain all the conversions here, since the chain itself only care about basecro.

Copy link
Contributor

Choose a reason for hiding this comment

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

one needs register other types of things in SDK -- it'll be a bit easier to have that in one place and not duplicate what's provided by SDK

Copy link
Contributor

Choose a reason for hiding this comment

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

cosmos/cosmos-sdk#3510

is it merged?
in my testing, it's not done automatically

Copy link
Contributor

Choose a reason for hiding this comment

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

it's possible to use "denom_metadata"

Copy link
Collaborator Author

@yihuang yihuang Sep 14, 2020

Choose a reason for hiding this comment

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

cosmos/cosmos-sdk#3510

is it merged?
in my testing, it's not done automatically

It seems they only added the ConvertCoin utility, don't call it in cli. we calls it when pre-process command arguments.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

one needs register other types of things in SDK -- it'll be a bit easier to have that in one place and not duplicate what's provided by SDK

done

func convertDenom(args []string) {
if len(args) >= 5 && args[0] == "tx" && args[1] == "bank" && args[2] == "send" {
args[5] = convertCoin(args[5])
} else if len(args) >= 4 && args[0] == "tx" && args[1] == "staking" && args[2] == "delegate" {
Copy link
Contributor

@tomtau tomtau Sep 14, 2020

Choose a reason for hiding this comment

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

+ unbond + redelegate?

Copy link
Contributor

Choose a reason for hiding this comment

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

add-genesis-account

Copy link
Contributor

Choose a reason for hiding this comment

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

also in "init" -- it was modified to put "basecro" as unit in other modules (gov, staking, ...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

Copy link
Contributor

Choose a reason for hiding this comment

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

@yihuang for init, maybe changing "NewDefaultGenesisState" ?

Copy link
Collaborator Author

@yihuang yihuang Sep 14, 2020

Choose a reason for hiding this comment

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

@yihuang for init, maybe changing "NewDefaultGenesisState" ?

it seems already working? I change the denom in config.yml to "cro", it get translated to "basecro" in genesis.json after starport --serve.

Copy link
Collaborator Author

@yihuang yihuang Sep 14, 2020

Choose a reason for hiding this comment

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

oh, you mean config of other modules, like staking's bond_denom?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

@yihuang yihuang Sep 14, 2020

Choose a reason for hiding this comment

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

Supported the genesis patch by add post-processing to the init command, similar to how starport works.

@yihuang
Copy link
Collaborator Author

yihuang commented Sep 14, 2020

Current code fails with following backtrace:
(FYI, test with this version of starport: ignite/cli#230)

Validator consensus-address crocnclcons1h5mag6w8lyp0f0gz9dudpyp8fae6n3rl663rxq not found

goroutine 46 [running]:
runtime/debug.Stack(0xc00122b788, 0x51b2080, 0xc0029cea60)
	/usr/local/Cellar/go/1.15/libexec/src/runtime/debug/stack.go:24 +0x9f
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine.func2(0xc0001bd500, 0x5639068)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:684 +0x57
panic(0x51b2080, 0xc0029cea60)
	/usr/local/Cellar/go/1.15/libexec/src/runtime/panic.go:969 +0x175
github.com/cosmos/cosmos-sdk/x/slashing/keeper.Keeper.HandleValidatorSignature(0x57cd560, 0xc0005c0d20, 0x2ec99018, 0xc00007ff80, 0x57f4f40, 0xc0001de240, 0x57eaee0, 0xc00072a060, 0x57e72a0, 0xc0000440e0, ...)
	/Users/huangyi/go/pkg/mod/github.com/cosmos/[email protected]/x/slashing/keeper/infractions.go:20 +0x1dc5
github.com/cosmos/cosmos-sdk/x/slashing.BeginBlocker(0x57e72a0, 0xc0000440e0, 0x57f9800, 0xc0029d6000, 0xb, 0x0, 0xc001043230, 0xa, 0x2, 0x21a6d670, ...)
	/Users/huangyi/go/pkg/mod/github.com/cosmos/[email protected]/x/slashing/abci.go:23 +0x287
github.com/cosmos/cosmos-sdk/x/slashing.AppModule.BeginBlock(...)
	/Users/huangyi/go/pkg/mod/github.com/cosmos/[email protected]/x/slashing/module.go:163
github.com/cosmos/cosmos-sdk/types/module.(*Manager).BeginBlock(0xc00011d0a0, 0x57e72a0, 0xc0000440e0, 0x57f9800, 0xc0029d6000, 0xb, 0x0, 0xc001043230, 0xa, 0x2, ...)
	/Users/huangyi/go/pkg/mod/github.com/cosmos/[email protected]/types/module/module.go:337 +0x1a2
github.com/crypto-com/chain-main/app.(*App).BeginBlocker(...)
	/Users/huangyi/src/chain-main/app/app.go:335
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).BeginBlock(0xc0000ec2c0, 0xc0029c79e0, 0x20, 0x20, 0xb, 0x0, 0xc001043230, 0xa, 0x2, 0x21a6d670, ...)
	/Users/huangyi/go/pkg/mod/github.com/cosmos/[email protected]/baseapp/abci.go:147 +0x658
github.com/tendermint/tendermint/abci/client.(*localClient).BeginBlockSync(0xc00061ede0, 0xc0029c79e0, 0x20, 0x20, 0xb, 0x0, 0xc001043230, 0xa, 0x2, 0x21a6d670, ...)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/abci/client/local_client.go:274 +0xfa
github.com/tendermint/tendermint/proxy.(*appConnConsensus).BeginBlockSync(0xc00022f1a0, 0xc0029c79e0, 0x20, 0x20, 0xb, 0x0, 0xc001043230, 0xa, 0x2, 0x21a6d670, ...)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/proxy/app_conn.go:81 +0x75
github.com/tendermint/tendermint/state.execBlockOnProxyApp(0x57e7660, 0xc000d323c0, 0x57f2600, 0xc00022f1a0, 0xc00107e8c0, 0x57fb700, 0xc0005a20c8, 0x1, 0xc000045466, 0xa, ...)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/state/execution.go:294 +0x3a2
github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock(0xc0005ce1c0, 0xb, 0x0, 0xc000045460, 0x6, 0xc000045466, 0xa, 0x1, 0x1, 0xc00107cb20, ...)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/state/execution.go:137 +0x1a5
github.com/tendermint/tendermint/consensus.(*State).finalizeCommit(0xc0001bd500, 0x2)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:1548 +0x994
github.com/tendermint/tendermint/consensus.(*State).tryFinalizeCommit(0xc0001bd500, 0x2)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:1466 +0x3ba
github.com/tendermint/tendermint/consensus.(*State).enterCommit.func1(0xc0001bd500, 0xc000000000, 0x2)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:1401 +0x8e
github.com/tendermint/tendermint/consensus.(*State).enterCommit(0xc0001bd500, 0x2, 0x0)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:1438 +0x5e5
github.com/tendermint/tendermint/consensus.(*State).addVote(0xc0001bd500, 0xc00129c1e0, 0x0, 0x0, 0x0, 0x0, 0xc0010c3028)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:2001 +0xb28
github.com/tendermint/tendermint/consensus.(*State).tryAddVote(0xc0001bd500, 0xc00129c1e0, 0x0, 0x0, 0x6230e70, 0x563b4d0, 0xc001231bb8)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:1809 +0x59
github.com/tendermint/tendermint/consensus.(*State).handleMsg(0xc0001bd500, 0x57b46a0, 0xc000010ed0, 0x0, 0x0)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:780 +0x865
github.com/tendermint/tendermint/consensus.(*State).receiveRoutine(0xc0001bd500, 0x0)
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:731 +0x5ca
created by github.com/tendermint/tendermint/consensus.(*State).OnStart
	/Users/huangyi/go/pkg/mod/github.com/tendermint/[email protected]/consensus/state.go:370 +0x846

@tomtau
Copy link
Contributor

tomtau commented Sep 14, 2020

@yihuang the error I traced to is " parameter BondDenom not registered"

@yihuang
Copy link
Collaborator Author

yihuang commented Sep 14, 2020

@yihuang the error I traced to is " parameter BondDenom not registered"

fixed, seems caused by keeper initialization order.

@yihuang
Copy link
Collaborator Author

yihuang commented Sep 14, 2020

In my local test, both send tx and delegate tx works, I guess it's good to switch to reviewable now ;D

@yihuang yihuang marked this pull request as ready for review September 14, 2020 17:12
@tomtau
Copy link
Contributor

tomtau commented Sep 15, 2020

In my local test, both send tx and delegate tx works, I guess it's good to switch to reviewable now ;D

tried locally now and it seems to work

Solution:
- re-generated with starport's stargate branch
- ported the fixes (bech32 prefix, bip44 path, denomination conversion) to chain command line
@tomtau
Copy link
Contributor

tomtau commented Sep 15, 2020

/runsim

Copy link
Collaborator

@devashishdxt devashishdxt left a comment

Choose a reason for hiding this comment

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

LGTM. Just some lint issues.

@tomtau tomtau merged commit 19fa3fe into master Sep 15, 2020
@tomtau tomtau deleted the stargate branch September 15, 2020 04:01
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.

4 participants