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

Add Ethermint chain support to v7 / v6 #835

Closed
ItayLevyOfficial opened this issue Oct 19, 2023 · 26 comments · Fixed by #878
Closed

Add Ethermint chain support to v7 / v6 #835

ItayLevyOfficial opened this issue Oct 19, 2023 · 26 comments · Fixed by #878
Assignees

Comments

@ItayLevyOfficial
Copy link

I am trying to utilize the tests with my cosmos-sdk chain, but it can't start it. It fails with

?panic: validator set is empty after InitGenesis, please ensure at least one validator is initialized with a delegation greater than or equal to the DefaultPowerReduction 

What may it be? My current chain config is

[]*interchaintest.ChainSpec{
		{Name: "dymension", Version: "latest", ChainConfig: ibc.ChainConfig{
			Type:           "cosmos",
			ChainID:        "dymension_100-1",
			Images:         []ibc.DockerImage{{Repository: "dymension", UidGid: "1025:1025"}},
			Bin:            "dymd",
			Bech32Prefix:   "dym",
			Denom:          "udym",
			CoinType:       "60",
			GasPrices:      "0udym",
			GasAdjustment:  0,
			TrustingPeriod: "168h0m0s",
		}},
		{Name: "osmosis", Version: "v7.2.0", ChainConfig: ibc.ChainConfig{ChainID: "osmosis-1001"}},
	}

Dymension fails, osmosis works.

@Reecepbcups
Copy link
Member

Reecepbcups commented Oct 23, 2023

@ItayLevyOfficial The Docker Image Repository should be the full link to the docker image

ex: ghcr.io/Org/Image

where ghcr is for github or you can use docker hub

also a Version: element is require in the DockerImage struct

@ItayLevyOfficial
Copy link
Author

ItayLevyOfficial commented Oct 23, 2023

Hey! Thanks for reaching back to me. I don't think this is the problem, as I am pointing to a local docker image and it is being fetched successfully. The problem happens when the test try to start the container chain, which throws the error I writed above: ?panic: validator set is empty after InitGenesis, please ensure at least one validator is initialized with a delegation greater than or equal to the DefaultPowerReduction

@ItayLevyOfficial
Copy link
Author

Are you familiar with this error by any chance?

@Reecepbcups
Copy link
Member

Reecepbcups commented Oct 23, 2023

@ItayLevyOfficial Gotcha, and yes - could you make it []ibc.DockerImage{{Repository: "dymension", Version: "latest", UidGid: "1025:1025"}}, and try again?

(make sure version is latest and not local. Some will build as dymension:local)

if this does not fix it, please send me your entire log via a pastebin (or gist) and I will dive in further

@ItayLevyOfficial
Copy link
Author

ItayLevyOfficial commented Oct 24, 2023

Hey! I've made the changes, but the error persists. I believe I've pinpointed the issue. Our chain, "Dymension," uses 18 token decimals, while the default in Cosmos is 6. We adopted 18 decimals for compatibility with Ethereum. The validator delegation specified by interchaintest in the genesis configuration is 5000000000000, likely assuming 6 decimals. This amount is beneath the hardcoded minimum delegation in our chain's code. Do you know if there's a straightforward way to adjust the chain's decimal settings?

@ItayLevyOfficial
Copy link
Author

Apparently there is a ModifyGenesisAmounts parameter to modify those, I will try and see if it solves the issue

@Reecepbcups
Copy link
Member

@ItayLevyOfficial I just checked and interchaintest does not yet have ethermint support. This should become easier to add after the Avalance support PR is added. But for now due to the use of hex addresses, I am unsure if interchaintest can handle this properly.

@ItayLevyOfficial
Copy link
Author

ItayLevyOfficial commented Nov 1, 2023

Ye, also, the genesis amounts are limited to fewer than 10 tokens when you use 18 decimals due to this line. Is there an open issue on this? We want to utilize your framework for our chain to test our IBC connection with Dymension rollapps

@jtieri
Copy link
Contributor

jtieri commented Nov 1, 2023

I started utilizing the sdk's Int type, which is a wrapper around big.Int, in a few places some months ago to get support for Penumbra off the ground since they use int128 iirc. I'm not sure if there is an open issue for the limitation that you have pointed out but I personally am not opposed to the proliferation of the sdk.Int type throughout the framework given we have a few chains in the pipeline who need support for values greater than what a 64bit integer can represent.

#679

@Reecepbcups Reecepbcups changed the title Fails to start my chain Add Ethermint chain support Nov 9, 2023
@Reecepbcups
Copy link
Member

Completed. Ethermint support is added in the main branch

@ItayLevyOfficial
Copy link
Author

ItayLevyOfficial commented Nov 14, 2023

Hey, thanks for the update. When trying to upgrade the dependency and run my test I get

itaylevy@Itays-MacBook-Pro dymension_interchaintest % go test ./...
# github.com/cosmos/cosmos-sdk/types
../../.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/cosmos/[email protected]/types/context.go:64:29: undefined: comet.BlockInfo
../../.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/cosmos/[email protected]/types/context.go:91:36: undefined: comet.BlockInfo
../../.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/cosmos/[email protected]/types/context.go:299:48: undefined: comet.BlockInfo
FAIL	dymension_interchaintest [build failed]
FAIL
itaylevy@Itays-MacBook-Pro dymension_interchaintest

Are you familiar with with this error? @Reecepbcups

@Reecepbcups
Copy link
Member

@ItayLevyOfficial Were you using the v7 branch before? Can you share me a gist / pastebin of your code? I did not run into this issue in my test on build

@ItayLevyOfficial
Copy link
Author

ItayLevyOfficial commented Nov 14, 2023

Nop, v8. I just copied the learn_ibc_test.go file to a new repo i created and I try to make it work with our chain. You can take a look here --> https://github.com/dymensionxyz/dymension_interchaintest/tree/itay-games

@ItayLevyOfficial
Copy link
Author

I looked a bit more into this – you have github.com/cosmos/cosmos-sdk v0.50.0-rc.1.0.20231026141021-0469fc17e158 as a dependency in interchaintest, and this version doesn't compile. There is a closed issue on it here, but there hasn't been a new release with a fix yet. Do you have any idea how I can get my code to compile?

@Reecepbcups
Copy link
Member

@ItayLevyOfficial can you confirm if the latest ictest main commit solves this for you? (sdk v0.50.1, seems the have had many issues tagging upstream)

if not, replacing the cosmossdk.io/core => v0.11.0 in your go.mod should resolve it

@ItayLevyOfficial
Copy link
Author

Confirmed. Thanks a lot buddy!

@ItayLevyOfficial
Copy link
Author

Now I am getting this error

Error: error creating clients: failed to create client on src chain{dymension_100-1}: failed to send messages on chain{dymension_100-1}: no concrete type registered for type URL /ethermint.types.v1.EthAccount against interface *types.AccountI

When trying

	require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{
		TestName:  t.Name(),
		Client:    client,
		NetworkID: network,
		// BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(),

		SkipPathCreation: false},
	),
	)

Do you have any idea why this may happen?

@Reecepbcups
Copy link
Member

@ItayLevyOfficial You need to register the ethermint Interface type(s) for your test since Ethermint is it's own Module.

ibc.ChainConfig example: https://github.com/CosmosContracts/juno/blob/main/interchaintest/setup.go#L81-L110

@ItayLevyOfficial
Copy link
Author

Tried to run go get github.com/evmos/evmos/v12/crypto/codec to get the Ethermint interface types but got

go: dymension_interchaintest tested by
	dymension_interchaintest.test imports
	github.com/evmos/evmos/v12/crypto/codec imports
	github.com/evmos/evmos/v12/crypto/ethsecp256k1 imports
	github.com/evmos/evmos/v12/ethereum/eip712 imports
	github.com/cosmos/cosmos-sdk/simapp/params: github.com/cosmos/cosmos-sdk/[email protected]: parsing go.mod:
	module declares its path as: cosmossdk.io/simapp
	        but was required as: github.com/cosmos/cosmos-sdk/simapp

Do you know how it can be solved? I think this is because evmos is using a different cosmos-sdk version

@Reecepbcups
Copy link
Member

@ItayLevyOfficial likely due to changes in v8 vs v7. I need to see if we can backport math.Int to v7 branch since ethermint is not using that hmm

@ItayLevyOfficial
Copy link
Author

Cool ping me when there's an update on this

@ItayLevyOfficial
Copy link
Author

Can you re-open this issue pls?

@Reecepbcups Reecepbcups changed the title Add Ethermint chain support Add Ethermint chain support to v7 Nov 19, 2023
@Reecepbcups Reecepbcups reopened this Nov 19, 2023
@Reecepbcups
Copy link
Member

Reecepbcups commented Dec 2, 2023

Ahh, looks like Ethermint on SDK v46 is causing some problems in relation to all imports. The v7 branch is SDK 47, which uses the new cosmossdk.io/ namespace instead of github.com/cosmos/cosmos-sdk/simapp. This has cascading effects through IBC-Go, Tendermint/CometBFT, Ethermint, and the Cosmos-SDK.

So it looks like this has to be ported to the v6 interchaintest branch instead of v7 as originally hoped. Will look to back port to v6 as I assume there are no plans for ethermint to v7

@Reecepbcups Reecepbcups changed the title Add Ethermint chain support to v7 Add Ethermint chain support to v7 / v6 Dec 4, 2023
@Reecepbcups
Copy link
Member

Reecepbcups commented Dec 5, 2023

@ItayLevyOfficial I have the interchaintest case passing now for Ethermint
image

Currently I use a slightly modified relayer (to register the extra ethermint codec for accounts) but that is it (works in the native relayer, just some interchaintest things)

@Reecepbcups
Copy link
Member

@ItayLevyOfficial This is completed and a PR has been made to your branch at dymensionxyz/dymension_interchaintest#1

@ItayLevyOfficial
Copy link
Author

Thanks a lot man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants