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

Panic when parsing a tx with cosmos.crypto.multisig.LegacyAminoPubKey #143

Closed
andynog opened this issue Oct 27, 2021 · 0 comments · Fixed by #147
Closed

Panic when parsing a tx with cosmos.crypto.multisig.LegacyAminoPubKey #143

andynog opened this issue Oct 27, 2021 · 0 comments · Fixed by #147

Comments

@andynog
Copy link

andynog commented Oct 27, 2021

I'm testing running a program to extract data from cosmos hub and got an error when parsing a transaction;

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: invalid type URL for public key: /cosmos.crypto.multisig.LegacyAminoPubKey

Caused by:
    cryptographic error

Location:
    /home/andy/.cargo/registry/src/gh.neting.cc-1ecc6299db9ec823/cosmrs-0.2.1/src/crypto/public_key.rs:118:22', src/main.rs:46:79

This can be reproduced running this repo https://github.com/andynog/cosmrs-tx-example

The transaction causing the issue is https://www.mintscan.io/cosmos/txs/E4AD2D2B27CB57AA2B273F4E872B3BC83D9E189B670AAEFDB50A790974D18FE1

and the information about the tx from the RPC endpoint is: (the tx base64 encoded is at the end)

{
  "jsonrpc": "2.0",
  "id": -1,
  "result": {
    "hash": "E4AD2D2B27CB57AA2B273F4E872B3BC83D9E189B670AAEFDB50A790974D18FE1",
    "height": "5258498",
    "index": 0,
    "tx_result": {
      "code": 0,
      "data": "CgYKBHNlbmQ=",
      "log": "[{\"events\":[{\"type\":\"message\",\"attributes\":[{\"key\":\"action\",\"value\":\"send\"},{\"key\":\"sender\",\"value\":\"cosmos16plylpsgxechajltx9yeseqexzdzut9g8vla4k\"},{\"key\":\"module\",\"value\":\"bank\"}]},{\"type\":\"transfer\",\"attributes\":[{\"key\":\"recipient\",\"value\":\"cosmos13pmeycgs4snkpyplwz3t8vfaupj2sya62z6k49\"},{\"key\":\"sender\",\"value\":\"cosmos16plylpsgxechajltx9yeseqexzdzut9g8vla4k\"},{\"key\":\"amount\",\"value\":\"1900000000uatom\"}]}]}]",
      "info": "",
      "gas_wanted": "200000",
      "gas_used": "102272",
      "events": [
        {
          "type": "transfer",
          "attributes": [
            {
              "key": "cmVjaXBpZW50",
              "value": "Y29zbW9zMTd4cGZ2YWttMmFtZzk2MnlsczZmODR6M2tlbGw4YzVsc2VycXRh",
              "index": true
            },
            {
              "key": "c2VuZGVy",
              "value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
              "index": true
            },
            {
              "key": "YW1vdW50",
              "value": "MjUwMDB1YXRvbQ==",
              "index": true
            }
          ]
        },
        {
          "type": "message",
          "attributes": [
            {
              "key": "c2VuZGVy",
              "value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
              "index": true
            }
          ]
        },
        {
          "type": "message",
          "attributes": [
            {
              "key": "YWN0aW9u",
              "value": "c2VuZA==",
              "index": true
            }
          ]
        },
        {
          "type": "transfer",
          "attributes": [
            {
              "key": "cmVjaXBpZW50",
              "value": "Y29zbW9zMTNwbWV5Y2dzNHNua3B5cGx3ejN0OHZmYXVwajJzeWE2Mno2azQ5",
              "index": true
            },
            {
              "key": "c2VuZGVy",
              "value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
              "index": true
            },
            {
              "key": "YW1vdW50",
              "value": "MTkwMDAwMDAwMHVhdG9t",
              "index": true
            }
          ]
        },
        {
          "type": "message",
          "attributes": [
            {
              "key": "c2VuZGVy",
              "value": "Y29zbW9zMTZwbHlscHNneGVjaGFqbHR4OXllc2VxZXh6ZHp1dDlnOHZsYTRr",
              "index": true
            }
          ]
        },
        {
          "type": "message",
          "attributes": [
            {
              "key": "bW9kdWxl",
              "value": "YmFuaw==",
              "index": true
            }
          ]
        }
      ],
      "codespace": ""
    },
    "tx": "CpYBCpM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K8+sZoOuH8stVKt8w/sLFmRn0SYu0xdQljBE="
  }
}
tony-iqlusion added a commit that referenced this issue Oct 28, 2021
Adds support for this key type when used as the `public_key` field of
`SignerInfo`.

To accomodate this, a new `SignerPublicKey` enum was added with variants
for a single `PublicKey` or a `LegacyAminoMultisig` key.

Decodes a test vector from `cosmoshub-4` (sdk@v0.42.10)

Closes #143
tony-iqlusion added a commit that referenced this issue Oct 28, 2021
Adds support for this key type when used as the `public_key` field of
`SignerInfo`.

To accomodate this, a new `SignerPublicKey` enum was added with variants
for a single `PublicKey` or a `LegacyAminoMultisig` key.

Decodes a test vector from `cosmoshub-4` (sdk@v0.42.10)

Closes #143
tony-iqlusion added a commit that referenced this issue Oct 28, 2021
Adds support for this key type when used as the `public_key` field of
`SignerInfo`.

To accomodate this, a new `SignerPublicKey` enum was added with variants
for a single `PublicKey` or a `LegacyAminoMultisig` key.

Decodes a test vector from `cosmoshub-4` (sdk@v0.42.10)

Closes #143
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 a pull request may close this issue.

1 participant