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

Evmos bech32 prefix is not detected #1785

Closed
5 tasks done
arnabghose997 opened this issue Jan 18, 2022 · 11 comments · Fixed by #1794
Closed
5 tasks done

Evmos bech32 prefix is not detected #1785

arnabghose997 opened this issue Jan 18, 2022 · 11 comments · Fixed by #1794
Assignees
Labels
I: configuration Internal: related to Hermes configuration O: usability Objective: cause to improve the user experience (UX) and ease using the product
Milestone

Comments

@arnabghose997
Copy link

arnabghose997 commented Jan 18, 2022

Crate

Summary of Bug

As you might have heard that Ethermint have changed their name to EVMOS, this might be causing an issue while I was trying to establish an IBC path locally between Gaia and Evmos as the Bech32 prefix for EVMOS is evmos. Following is the log for reference:

$ hermes start
The Hermes configuration file at path '~/.hermes/config.toml' is invalid, reason: parse error: unknown variant `evmos`, expected `cosmos` or `ethermint` for key `chains.address_type` at line 251 column 31

Version

Version: v0.10.0

Steps to Reproduce

There needs to be a replacement of ethermint bech32 address prefix with evmos

Acceptance Criteria


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@adizere adizere self-assigned this Jan 18, 2022
@adizere adizere added I: configuration Internal: related to Hermes configuration O: usability Objective: cause to improve the user experience (UX) and ease using the product labels Jan 18, 2022
@adizere
Copy link
Member

adizere commented Jan 18, 2022

This codepath in Hermes hasn't been tested in months (since #1295), thank you for highlighting the problem!

I prepared a quick dev branch for you to give it a try, seems like the most important change is just renaming some variables: https://github.com/informalsystems/ibc-rs/tree/1785_evmos

Can you let us know if this works?

@arnabghose997
Copy link
Author

Hey @adizere, thanks for the update. I will need some time to test it out. Will post my update here soon.

@arnabghose997
Copy link
Author

arnabghose997 commented Jan 19, 2022

HI @adizere , below are my observations:

Oberservations from running both Gaia and Evmos chain

Both Gaia and Evmos chains were run using starport. Below are their config.yml configuration:

Gaia:

accounts:
  - name: akash
    coins: ["10000000000000uatom", "100000000stake"]
  - name: badal
    coins: ["50000000000uatom"]
validator:
  name: akash
  staked: "1000000stake"
host:
  rpc: ":26657"
  p2p: ":26656"
  prof: ":6061"
  grpc: ":9095"
  grpc-web: ":9093"
  api: ":1318"
  frontend: ":8081"
  dev-ui: ":12346"
faucet:
  name: badal 
  coins: ["100000uatom"]
  port: 4500
build:
  binary: "gaiad"
init:
  home: "home/arnab/.gaia"
genesis:
  chain_id: "localcosmos-1"

Evmos:

accounts:
  - name: alice
    coins: ["100000000stake", "100000000000000000000aevmos"]
  - name: bob
    coins: ["5000000000000aevmos"]
validator:
  name: alice
  staked: "100000000000000000000aevmos"
host:
  rpc: ":36657"
  p2p: ":36656"
  prof: ":7061"
  grpc: ":10095"
  grpc-web: ":10093"
  api: ":2318"
  frontend: ":9081"
  dev-ui: ":22346"
faucet:
  name: bob 
  coins: ["100000aevmos"]
  port: 4501
build:
  binary: "evmosd"
init:
  home: "$HOME/.evmosd"
  app:
    evm-rpc:
      address: "0.0.0.0:8545"     # change the JSON-RPC address and port
      ws-address: "0.0.0.0:8546"  # change the JSON-RPC websocket address and port
genesis:
  chain_id: "evmosd_9000-1"
  app_state:
    staking:
      params:
        bond_denom: "aevmos"
    mint:
      params:
        mint_denom: "aevmos"
    crisis:
      constant_fee:
        denom: "aevmos"
    gov:
      deposit_params:
        min_deposit:
          - amount: "10000000"
            denom: "aevmos"
    evm:
      params:
        evm_denom: "aevmos"

Account badal from gaiad, and bob from evmos were chosen to be the relayer accounts. So we will focus on them

When both chains were started, the mnemonics of badal and bob were noted as follows:

badal:

[GAIA DAEMON] cosmos16xv7mzk9gffqs28wxq9etdsz083af7jxhzu2xt
[STARPORT] 🙂 Created account "badal" with address "cosmos16xv7mzk9gffqs28wxq9etdsz083af7jxhzu2xt" with mnemonic: "path oak treat put saddle quarter uniform broom aunt text cotton slice hotel mention dwarf prosper prepare buffalo still alone sweet lesson worth gentle"

bob:

[EVMOS DAEMON] evmos147h9vvlhxxe8nhjgaadraeu93rv9xv36dvfv0v
[STARPORT] 🙂 Created account "bob" with address "evmos147h9vvlhxxe8nhjgaadraeu93rv9xv36dvfv0v" with mnemonic: "scissors crouch hair bacon magnet analyst drip scare palace tragic verify forget have census blame best rabbit buzz hip whale define also october flag"

Now while trying to use the hermes CLI to restore the account addresses through following comand:

$ hermes keys restore --mnemonic <account-mnemonic> <chain-id>

Account address of badal (Gaia chain) was imported exactly how its supposed to be. But the account address of bob (Evmos chain) was different.

  • Account address of bob when starting the chain with starport: evmos147h9vvlhxxe8nhjgaadraeu93rv9xv36dvfv0v
  • Account address of bob after the mnemonic import through hermes CLI: evmos1e5qlekdtkqwud53dtdau9pqxttempkdzxwd8nw

The public key type of Evmos is /ethermint.crypto.v1.ethsecp256k1.PubKey. It seems that version of Public key type defined in Evmos could be different from what is defined in Hermes.

@adizere
Copy link
Member

adizere commented Jan 19, 2022

Can you also share you Hermes config.toml?

But the account address of bob (Evmos chain) was different.

Damn! I have no clear idea yet what could be causing this. We'll try to reproduce the problem in the meantime.

CC-ing @tomtau since he was the original contributor of evmos support in Hermes, and he might know best what the problem is here (or if my PR is missing something).

@hu55a1n1
Copy link
Member

I remember facing a similar problem when testing the Ethermint support PR. @arnabghose997 Can you try with an explicit derivation path? ->

hermes keys restore --mnemonic <MNEMONIC> --hd-path "m/44'/60'/0'/0/0" <CHAIN_ID> 

@arnabghose997
Copy link
Author

arnabghose997 commented Jan 19, 2022

Sure @adizere, following is the Hermes config.toml file I used:

[global]
log_level = 'info'

[mode]

[mode.clients]
enabled = true
refresh = true
misbehaviour = true


[mode.connections]
enabled = false


[mode.channels]
enabled = false


[mode.packets]
enabled = true
clear_interval = 100
clear_on_start = true
filter = false
tx_confirmation = true

[rest]
enabled = true
host = '127.0.0.1'
port = 3000


[telemetry]
enabled = true
host = '127.0.0.1'
port = 3001

[[chains]]
id = 'localcosmos-1'
rpc_addr = 'http://127.0.0.1:26657'
grpc_addr = 'http://127.0.0.1:9095'
websocket_addr = 'ws://127.0.0.1:26657/websocket'
rpc_timeout = '10s'
account_prefix = 'cosmos'
key_name = 'testkey'
address_type = { derivation = 'cosmos' }
store_prefix = 'ibc'
default_gas = 100000
max_gas = 400000
gas_price = { price = 0.001, denom = 'uatom' }
gas_adjustment = 1.0
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
max_block_time = '10s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
memo_prefix = ''

[[chains]]
id = 'evmos_9000-1'
rpc_addr = 'http://127.0.0.1:36657'
grpc_addr = 'http://127.0.0.1:10095'
websocket_addr = 'ws://127.0.0.1:36657/websocket'
rpc_timeout = '10s'
account_prefix = 'evmos'
key_name = 'testkey'
store_prefix = 'ibc'
default_gas = 100000
max_gas = 400000
gas_price = { price = 0.001, denom = 'aevmos' }
gas_adjustment = 0.1
max_msg_num = 30
max_tx_size = 2097152
clock_drift = '5s'
max_block_time = '10s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
address_type = { derivation = 'evmos', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }

@arnabghose997
Copy link
Author

arnabghose997 commented Jan 19, 2022

Hey @hu55a1n1 , it worked! Thank you for your help :)

I am now curious to know more about deviation path, and why was it required to be passed as parameter in case of Evmos? But nonetheless, thank you Shoaib for your help.

I will continue further by creating the IBC channel and will update here

@hu55a1n1
Copy link
Member

I'm glad it worked. 👍

I am now curious to know more about deviation path, and why was it required to be passed as parameter in case of Evmos?

hermes defaults to this path -> m/44'/118'/0'/0/0, which is (AFAIK) the default path that gaiad keys add uses to generate keys. The 118 in the path stands for the coin_type as defined by BIP44 and the value represents ATOM according to SLIP44 and so this path works for cosmos keys. For Evmos we need to specify the right coin_type which happens to be 60.

@arnabghose997
Copy link
Author

Hey @adizere, @hu55a1n1 , I performed an IBC transfer between Gaia and Evmos chain, and it worked like a charm! Thank you again Adi and Shoaib for the help.

Before closing this issue, would it be possible for you to shed some light on when would this change be merged with the main codebase and released?

@tomtau
Copy link
Contributor

tomtau commented Jan 20, 2022

As you might have heard that Ethermint have changed their name to EVMOS, (...)

There are two concepts "Ethermint" refers or referred to:

  1. Ethermint library, i.e. a Cosmos SDK module for EVM support: the name remains the same and the code lives here: https://github.com/tharsis/ethermint
  2. Ethermint Zone, i.e. a network that uses the Ethermint module: the name was changed to Evmos and the code lives here: https://github.com/tharsis/evmos

Given the name in the "address type" in Hermes refers to the address derivation defined in the Ethermint library which is used by different networks (Injective, Evmos, Umee, Cronos...), it makes sense to keep it as is.
Similarly, the "cosmos" variant in the address type refers to the Cosmos SDK address derivation method, not Cosmos Hub.

I prepared a quick dev branch for you to give it a try, seems like the most important change is just renaming some variables: https://github.com/informalsystems/ibc-rs/tree/1785_evmos

Is this change necessary? It seems the current main can support Evmos as it is, it's just three configuration options to keep in mind:

  1. account_prefix = 'evmos' (plus id etc.)
  2. address_type = { derivation = 'ethermint', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }
  3. when restoring keys, make sure to pass the Ethereum coin type, i.e. --hd-path "m/44'/60'/0'/0/0"

Before closing this issue, would it be possible for you to shed some light on when would this change be merged with the main codebase and released?

There is no need to merge that change. There are two possible follow up changes:

  1. improving the documentation: e.g. in the sample configuration, make sure that the chain id or bech32 prefix isn't ethermint for the ethermint address type, so that it's clearer which ones refer to a network and which ones to a library
  2. possibly renaming the address type variants (a breaking change): e.g. calling them ethermint-lib and cosmos-sdk to make it more explicit

@adizere
Copy link
Member

adizere commented Jan 20, 2022

Many thanks @tomtau, that clarifies a lot.

I prepared a quick dev branch for you to give it a try, seems like the most important change is just renaming some variables: https://github.com/informalsystems/ibc-rs/tree/1785_evmos

Is this change necessary? It seems the current main can support Evmos as it is, it's just three configuration options to keep in mind:

I agree the original renaming changes I proposed are not necessary. Reverted that and added minor clarifications to our default configuration file and the guide in #1794.

There is no need to merge that change. There are two possible follow up changes:

  1. improving the documentation: e.g. in the sample configuration, make sure that the chain id or bech32 prefix isn't ethermint for the ethermint address type, so that it's clearer which ones refer to a network and which ones to a library
  2. possibly renaming the address type variants (a breaking change): e.g. calling them ethermint-lib and cosmos-sdk to make it more explicit

I tried to address (1) in #1794, please review. For the moment not sure about (2), I'd be OK to skip that unless someone has a firm opinion that it's confusing.

Before closing this issue, would it be possible for you to shed some light on when would this change be merged with the main codebase and released?

The release is aimed for end of January. Would appreciate a review (#1794) or other suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: configuration Internal: related to Hermes configuration O: usability Objective: cause to improve the user experience (UX) and ease using the product
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants