evmos / evmosjs

JS and TS libs for Evmos
https://www.npmjs.com/package/evmosjs
Apache License 2.0
65 stars 56 forks source link

MsgSubmitProposal RLP Type #81

Open zakarialounes opened 2 years ago

zakarialounes commented 2 years ago

Anyone have any idea what the problem is with submitting a text-based governance proposal? This is the only type of message for which I can't get Evmos + Ledger to work with Keplr.

I get the below error:

Error: signature verification failed; please verify account number (1990873) and chain-id (evmos_9001-2): feePayer pubkey EthPubKeySecp256k1{026F434A5E0356CDC54D9999145F5681628D042AE487DE0E44293C134DBBAE5CB6} is different from transaction pubkey EthPubKeySecp256k1{022E10BA94588FE6B3965F46F29F6EF68008B80EF823B0FFB746A53BCD61A3B915}: invalid pubkey [evmos/ethermint@v0.19.3/app/ante/eip712.go:253]: unauthorized
    at r (injectedScript.bundle.js:1:15627)

The used RLP Type:

{
    MsgValue: [
      { name: "content", type: "TypeProposalTextDescription" },
      { name: "initial_deposit", type: "TypeAmount[]" },
      { name: "proposer", type: "string" },
    ],
    TypeProposalTextDescription: [
      { name: "description", type: "string" },
      { name: "title", type: "string" },
      { name: "type", type: "string" },
    ],
    TypeAmount: [
      { name: "denom", type: "string" },
      { name: "amount", type: "string" }
    ],
}

The signDoc content looks like this:

{
    "chain_id": "evmos_9001-2",
    "account_number": "1990873",
    "sequence": "54",
    "fee": {
        "amount": [
            {
                "amount": "2500000000",
                "denom": "aevmos"
            }
        ],
        "gas": "250000",
        "feePayer": "evmos1lmdw0am9y4pa53n33rn8m9wgsyvhl8dhcllmm6"
    },
    "msgs": [
        {
            "type": "cosmos-sdk/MsgSubmitProposal",
            "value": {
                "content": {
                    "type": "cosmos-sdk/TextProposal",
                    "title": "test evmos+ledger with Keplr (please don't deposit for this proposal)",
                    "description": "test evmos+ledger with Keplr (please don't deposit for this proposal)"
                },
                "initial_deposit": [
                    {
                        "amount": "1000000000000",
                        "denom": "aevmos"
                    }
                ],
                "proposer": "evmos1lmdw0am9y4pa53n33rn8m9wgsyvhl8dhcllmm6"
            }
        }
    ],
    "memo": ""
}

If I use type: any for the content property, I get the below error:

Error: unknown type "any" (argument="types", value={"Tx":[{"name":"account_number","type":"string"},{"name":"chain_id","type":"string"},{"name":"fee","type":"Fee"},{"name":"memo","type":"string"},{"name":"msgs","type":"Msg[]"},{"name":"sequence","type":"string"}],"Fee":[{"name":"feePayer","type":"string"},{"name":"amount","type":"Coin[]"},{"name":"gas","type":"string"}],"Coin":[{"name":"denom","type":"string"},{"name":"amount","type":"string"}],"Msg":[{"name":"type","type":"string"},{"name":"value","type":"MsgValue"}],"MsgValue":[{"name":"content","type":"any"},{"name":"initial_deposit","type":"TypeAmount[]"},{"name":"proposer","type":"string"}],"TypeAmount":[{"name":"denom","type":"string"},{"name":"amount","type":"string"}]}, code=INVALID_ARGUMENT, version=hash/5.7.0)
    at r (injectedScript.bundle.js:formatted:847:41)

Thanks in advance 🙏

hanchon commented 2 years ago

I need to create some examples and fix some issues on the submit proposals to make sure that it works. Probably at the end of this week I should be able to do it!

zakarialounes commented 2 years ago

Okay, thank you very much @hanchon. I tried to change the order of the properties of the RLP types, but it didn't work.

I also have the same problem with the message set-withdraw-addr (whatever the order, it doesn't work either).

I use the below RLP information:

MsgValue: [
      { name: "withdraw_address", type: "string" },
      { name: "delegator_address", type: "string" },
    ]

I would like to understand what could be the problem (by the way, I don't use this repository to avoid overloading with dependencies, I have my own EIP712 type file and custom binding logic).

Thanks in advance

juansalvatore commented 1 year ago

@hanchon It would be great to have some examples! I'm trying to get it to work and I'm having a hard time. Opened a question here: https://github.com/evmos/evmosjs/issues/173