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

Hermes can't write transaction to Ethermint chain (unauthorized error) #3166

Closed
5 tasks
Pitasi opened this issue Mar 14, 2023 · 19 comments
Closed
5 tasks

Hermes can't write transaction to Ethermint chain (unauthorized error) #3166

Pitasi opened this issue Mar 14, 2023 · 19 comments

Comments

@Pitasi
Copy link

Pitasi commented Mar 14, 2023

Summary of Bug

Can't get Hermes to write txs to (local) Ethermint chain.

Version

hermes 1.3.0

Steps to Reproduce

Launch a local ethermint chain
$ git clone https://github.com/evmos/ethermint
$ cd ethermint
$ ./init.sh

Then I naively generated a new key for the relayer account (the problem might be here):

Create a new account
$ ethermintd keys add relayer

# took note of the mnemonic output and pasted into /tmp/m
$ echo -n 'memory bus [...] seek benefit' > /tmp/m

# fund the new account
$ ethermintd tx bank send mykey 'ethm1pqspvm4j3cl68z2tgfnm5h3zdglkxhwapkgg8e' 100000photon --fees 20photon --yes
Add chain to config.toml
[[chains]]
id = 'ethermint'
rpc_addr = 'http://localhost:26657'
grpc_addr = 'http://localhost:9090'
websocket_addr = 'ws://localhost:26657/websocket'
rpc_timeout = '15s'
account_prefix = 'ethm'
key_name = 'wallet'
store_prefix = 'ibc'
gas_price = { price = 10000, denom = 'aphoton' }
max_gas = 10000000
clock_drift = '5s'
trust_threshold = { numerator = '2', denominator = '3' }
address_type = { derivation = 'ethermint', proto_type = { pk_type = '/ethermint.crypto.v1.ethsecp256k1.PubKey' } }

I actually tweaked gas_price to see if it changed anything.

Import key into hermes
$ cargo run keys add --mnemonic-file /tmp/m --chain ethermint --hd-path "m/44'/60'/0'/0/0"
SUCCESS Restored key 'wallet' (ethm1pqspvm4j3cl68z2tgfnm5h3zdglkxhwapkgg8e) on chain ethermint
Hermes error
$ hermes create client --host-chain ethermint --reference-chain otherchain

2023-03-14T15:44:51.776038Z  INFO ThreadId(01) using default configuration from '/Users/antonio/.hermes/config.toml'
2023-03-14T15:44:51.777293Z  INFO ThreadId(01) running Hermes v1.3.0+4602d8cd
2023-03-14T15:44:51.820651Z ERROR ThreadId(25) send_messages_and_wait_commit{chain=ethermint tracking_id=create client}:send_tx_with_account_sequence_retry{chain=ethermint account.sequence=0}: failed to broadcast tx with unrecoverable error response=Response { code: Err(4), data: b"", log: "\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SigVerificationDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:302\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SigGasConsumeDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:194\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ValidateSigCountDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:384\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SetPubKeyDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:126\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.DeductFeeDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/fee.go:67\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ConsumeTxSizeGasDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:142\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ValidateMemoDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:66\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/evmos/ethermint/app/ante.MinGasPriceDecorator.AnteHandle\n\tgithub.com/evmos/ethermint/app/ante/fees.go:89\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.TxTimeoutHeightDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:205\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ValidateBasicDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:34\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.RejectExtensionOptionsDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/ext.go:52\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/setup.go:62\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/evmos/ethermint/app/ante.RejectMessagesDecorator.AnteHandle\n\tgithub.com/evmos/ethermint/app/ante/reject_msgs.go:40\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\ngithub.com/evmos/ethermint/app/ante.NewAnteHandler.func1\n\tgithub.com/evmos/ethermint/app/ante/ante.go:88\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/baseapp/baseapp.go:685\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).CheckTx\n\tgithub.com/cosmos/cosmos-sdk@v0.46.8/baseapp/abci.go:244\ngithub.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync\n\tgithub.com/tendermint/tendermint@v0.34.24/abci/client/local_client.go:104\ngithub.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync\n\tgithub.com/tendermint/tendermint@v0.34.24/proxy/app_conn.go:126\nsignature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized", hash: Hash::Sha256(1801BF323F6C80D47D479E71FB738E64F1B56240362C664917B2CA6E3807A8DB) } diagnostic=unknown TX sync response error: 4
SUCCESS ChainError(
    "check_tx (broadcast_tx_sync) on chain ethermint for Tx hash 1801BF323F6C80D47D479E71FB738E64F1B56240362C664917B2CA6E3807A8DB reports error: code=Err(4), log=\"\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SigVerificationDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:302\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SigGasConsumeDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:194\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ValidateSigCountDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:384\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SetPubKeyDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/sigverify.go:126\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.DeductFeeDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/fee.go:67\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ConsumeTxSizeGasDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:142\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ValidateMemoDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:66\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/evmos/ethermint/app/ante.MinGasPriceDecorator.AnteHandle\\n\\tgithub.com/evmos/ethermint/app/ante/fees.go:89\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.TxTimeoutHeightDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:205\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.ValidateBasicDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/basic.go:34\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.RejectExtensionOptionsDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/ext.go:52\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/x/auth/ante/setup.go:62\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/evmos/ethermint/app/ante.RejectMessagesDecorator.AnteHandle\\n\\tgithub.com/evmos/ethermint/app/ante/reject_msgs.go:40\\ngithub.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/types/handler.go:40\\ngithub.com/evmos/ethermint/app/ante.NewAnteHandler.func1\\n\\tgithub.com/evmos/ethermint/app/ante/ante.go:88\\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/baseapp/baseapp.go:685\\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).CheckTx\\n\\tgithub.com/cosmos/cosmos-sdk@v0.46.8/baseapp/abci.go:244\\ngithub.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync\\n\\tgithub.com/tendermint/tendermint@v0.34.24/abci/client/local_client.go:104\\ngithub.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync\\n\\tgithub.com/tendermint/tendermint@v0.34.24/proxy/app_conn.go:126\\nsignature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized\"",
)

previous line is quite long but I think the important bit is the end:

signature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized

Any ideas? Did I miss something?

Thanks!

Acceptance Criteria

Hermes should write txs correctly to an Ethermint chain :)


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate milestone (priority) applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@romac
Copy link
Member

romac commented Mar 15, 2023

@yihuang @tomtau @hu55a1n1 Do you have any idea what might be going wrong here? I see a reference to the same problem in @hu55a1n1's comment here but I am not sure I understand what the fix was.

@romac
Copy link
Member

romac commented Mar 15, 2023

@Pitasi Maybe the account_prefix is wrong? You use ethm here, but in #1295 it is set to eth.

@yihuang
Copy link
Contributor

yihuang commented Mar 15, 2023

I think the gorc need to be built with ethermint feature, right?

sorry, confused with gravity-bridge relayer ;D

@yihuang
Copy link
Contributor

yihuang commented Mar 15, 2023

we always set the id field in [[chains]] to full chain-id ethermint_9000-1 , not sure if that makes any difference.

@tomtau
Copy link
Contributor

tomtau commented Mar 15, 2023

@romac my hunch is that:

$ ethermintd keys add relayer

# took note of the mnemonic output and pasted into /tmp/m
$ echo -n 'memory bus [...] seek benefit' > /tmp/m

# fund the new account
$ ethermintd tx bank send mykey 'ethm1pqspvm4j3cl68z2tgfnm5h3zdglkxhwapkgg8e' 100000photon --fees 20photon --

non-evm bank send will just create a normal base account instead of ethaccount, so for signing, it should use sha256 message digest instead of keccak256. you can try to change the address type to cosmos (or proto_type in the configuration to the SDK one)

@Pitasi
Copy link
Author

Pitasi commented Mar 15, 2023

@Pitasi Maybe the account_prefix is wrong? You use ethm here, but in #1295 it is set to eth.

no, ethm is the correct one for my local chain

we always set the id field in [[chains]] to full chain-id ethermint_9000-1 , not sure if that makes any difference.

afaiu id in config is just a friendly name you give to that config, the actual chain-id is automatically fetched from the chain using Tendermint RPC

@hu55a1n1
Copy link
Member

hu55a1n1 commented Mar 15, 2023

Shouldn't the key_name in hermes config.toml be relayer instead of wallet?

@Pitasi
Copy link
Author

Pitasi commented Mar 15, 2023

Shouldn't the keyname in config.toml be relayer instead of wallet?

Sorry for the confusion. relayer is the name of the key in ethermintd's keyring, while wallet is the (default) name in hermes' keyring :)

@Pitasi
Copy link
Author

Pitasi commented Mar 15, 2023

I'm investigating @tomtau insights.

Here is the the account I created, it is of type "EthAccount" but I'm still not convinced. You might be correct about the message digest.

$ ethermintd q auth accounts
accounts:
- '@type': /ethermint.types.v1.EthAccount
  base_account:
    account_number: "8"
    address: ethm1pqspvm4j3cl68z2tgfnm5h3zdglkxhwapkgg8e
    pub_key: null
    sequence: "0"
  code_hash: 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470

And here is the hermes' key:

cat ~/.hermes/keys/ethermint/keyring-test/wallet.json
{
  "private_key": "770c9343cdc0c152d5935c783db114e5963c3bd67d41b482639ca753fc22451f",
  "public_key": "03d9cda5667e2e7517ae657e8990613d01fa273d8f978e2d9abf3f2f2f8895097f",
  "address": [
    8,
    32,
    22,
    110,
    178,
    142,
    63,
    163,
    137,
    75,
    66,
    103,
    186,
    94,
    34,
    106,
    63,
    99,
    93,
    221
  ],
  "address_type": "Ethermint",
  "account": "ethm1pqspvm4j3cl68z2tgfnm5h3zdglkxhwapkgg8e"
}

The two addresses match, so I think the key was imported correctly (and with the correct hd path, etc.). Also the bech32 prefix (ethm) is correct.

But this is nothing if we sign the wrong payload, right? 😁
(i.e. if we sign a keccak256 digest instead of a sha256 one, or viceversa)

@Pitasi
Copy link
Author

Pitasi commented Mar 15, 2023

This should be the code that decides what needs to be signed:

fn sign(&self, message: &[u8]) -> Result<Vec<u8>, Error> {
let hashed_message: GenericArray<u8, U32> = match self.address_type {
Secp256k1AddressType::Ethermint => keccak256_hash(message).into(),
Secp256k1AddressType::Cosmos => Sha256::digest(message),
};

To be sure after these lines I added a

        println!("address type: {:?}", self.address_type);

And I get these logs:

2023-03-15T10:08:14.090445Z  INFO ThreadId(01) using default configuration from '/Users/antonio/.hermes/config.toml'
2023-03-15T10:08:14.091548Z  INFO ThreadId(01) running Hermes v1.3.0+4602d8cd
address type: Ethermint
address type: Ethermint
address type: Ethermint
2023-03-15T10:08:14.141740Z ERROR ThreadId(25) send_messages_and_wait_commit{chain=ethermint tracking_id=create client}:send_tx_with_account_sequence_retry{chain=ethermint account.sequence=0}: failed to broadcast tx with unrecoverable error response=Response { code: Err(4), data: b"", log: "signature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized", hash: Hash::Sha256(3B65280ACC4F3732A9598E1470CDB601788BE8C95C9E38D903DF1A626C969770) } diagnostic=unknown TX sync response error: 4
SUCCESS ChainError(
    "check_tx (broadcast_tx_sync) on chain ethermint for Tx hash 3B65280ACC4F3732A9598E1470CDB601788BE8C95C9E38D903DF1A626C969770 reports error: code=Err(4), log=\"signature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized\"",
)

So if I edited ~/.hermes/keys/ethermint/keyring-test/wallet.json and replaced Ethermint with Cosmos:

2023-03-15T10:08:43.995267Z  INFO ThreadId(01) using default configuration from '/Users/antonio/.hermes/config.toml'
2023-03-15T10:08:43.996379Z  INFO ThreadId(01) running Hermes v1.3.0+4602d8cd
address type: Cosmos
address type: Cosmos
address type: Cosmos
2023-03-15T10:08:44.030077Z ERROR ThreadId(25) send_messages_and_wait_commit{chain=ethermint tracking_id=create client}:send_tx_with_account_sequence_retry{chain=ethermint account.sequence=0}: failed to broadcast tx with unrecoverable error response=Response { code: Err(4), data: b"", log: "signature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized", hash: Hash::Sha256(8048CC6E2538960E6863F58A0A2BA101294AD81E783F5DD8D71F95F5C82F2258) } diagnostic=unknown TX sync response error: 4
SUCCESS ChainError(
    "check_tx (broadcast_tx_sync) on chain ethermint for Tx hash 8048CC6E2538960E6863F58A0A2BA101294AD81E783F5DD8D71F95F5C82F2258 reports error: code=Err(4), log=\"signature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized\"",
)

Looks like the same error.

@Pitasi
Copy link
Author

Pitasi commented Mar 15, 2023

Oh and just to be sure my relayer keys can actually send transactions on the chain I ran this:

# send back some funds to the genesis account
$ ethermintd tx bank send relayer 'ethm1zskzw7jlxrdpxh26g69y27fvjfxxjmzgjy6cam' 100000photon --fees 20photon --yes

that worked correctly.

@tomtau
Copy link
Contributor

tomtau commented Mar 15, 2023

Hm, strange, it's an EthAccount, so your original config should be ok.
There was this PR that did some cleanup in signing: https://github.com/informalsystems/hermes/pull/2863/files#diff-08bcf6496eddb7428a6a3c7894c2ac3e33be5b3767c0a27a1953eda3dbbabe96L391 which shouldn't affect it, but you can possibly try to bring back the sign_recoverable.

@Pitasi
Copy link
Author

Pitasi commented Mar 15, 2023

I confirm that sign_recoverable doesn't solve it.

@Pitasi
Copy link
Author

Pitasi commented Mar 16, 2023

non-evm bank send will just create a normal base account instead of ethaccount

Anyway I also tried playing a bit with Metamask:

  • I imported both relayer and genesis keys into Metamask
  • Metamask was correctly showing the relayer balance (i.e. funds I sent originally with the cli)
  • I was able to send tokens from relayer to genesis
  • I was able to send tokens from genesis to relayer

Hermes txs are still rejected.

@Pitasi
Copy link
Author

Pitasi commented Mar 16, 2023

we always set the id field in [[chains]] to full chain-id ethermint_9000-1 , not sure if that makes any difference.

That's embarrassing, this was the problem. 😅

afaiu id in config is just a friendly name you give to that config, the actual chain-id is automatically fetched from the chain using Tendermint RPC

I don't know who told me that but my "afaiu" should've triggered a bell for myself lol

So...sorry folks. Thanks @yihuang who actually spotted the issue really quickly.

Always set the hermes id to the actual chain id of your chain!

@Pitasi
Copy link
Author

Pitasi commented Mar 16, 2023

To debug my own mind, the error message the chain gave:

signature verification failed; please verify account number (8) and chain-id (ethermint_9000-1): unauthorized

is put in a way that I thought 8 and ethermint_9000-1 are the parameters contained in the transaction, while in reality they are actually what they should be.

@Pitasi Pitasi closed this as completed Mar 16, 2023
@romac
Copy link
Member

romac commented Mar 16, 2023

Always set the hermes id to the actual chain id of your chain!

Ah sorry for missing this :/ We'll make sure to highlight this in the config file and in the Hermes guide. We'll see if there is also a way to check for this and report an error otherwise.

@yihuang
Copy link
Contributor

yihuang commented Mar 16, 2023

Always set the hermes id to the actual chain id of your chain!

Ah sorry for missing this :/ We'll make sure to highlight this in the config file and in the Hermes guide. We'll see if there is also a way to check for this and report an error otherwise.

If the field is named as chain-id, it'a probably clearer, otherwise it could be interpreted as an arbitrary unique id :)

@Pitasi
Copy link
Author

Pitasi commented Mar 16, 2023

if you think it's worth doing it you can actually retrieve the correct chain id from Tendermint RPC (using the /genesis endpoint)

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

No branches or pull requests

5 participants