cardano-foundation / cardano-graphql

GraphQL API for Cardano
Apache License 2.0
262 stars 104 forks source link

submitTransaction rejects a well-formed transaction #603

Closed dingxiangfei2009 closed 2 years ago

dingxiangfei2009 commented 3 years ago

Environment

Environment set up with docker-compose. Version is 5.1.0.

When building and running, the environment variable NETWORK=testnet is set.

Platform

Platform version:

Runtime

Runtime version:

$ docker version

Client:
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.13.8
 Git commit:        20.10.7-0ubuntu1~20.04.1
 Built:             Wed Aug  4 22:52:25 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.8
  Git commit:       20.10.7-0ubuntu1~20.04.1
  Built:            Wed Aug  4 19:07:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.2-0ubuntu1~20.04.2
  GitCommit:        
 runc:
  Version:          1.0.0~rc95-0ubuntu1~20.04.2
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:

Steps to reproduce the bug

Execute this query,

mutation SubmitTransaction(
  $transaction: String!
) {
  submitTransaction(transaction: $transaction) {
    hash
  }
}

With this query parameter:

{
  "transaction": "hKQAgYJYII7KxiJ6DU8DHdpaAQDw6wZ12T8FkfXyGPpEUfdZu650AQGCglg5AAdD0Wz+PE/MDBHCQDu8ENvH7N1Ed+BTSBo2jnoG4q5E3/Z3DcD0raPPTPJgUAjieuzbMyrTSf2nGgAPQkCCWB1gxYD83vjt5PVUIPYNAh7V+vQ0xGEZEvncHHLYoho6E7eEAhoAAotNDwChAIGCWCDRZ8CH8OF/Rl9BbmztRrHvnP+pM4d5f801p6ll1Ekcn1hA1pAxa2CKXo4YgWppJfq1FtQX1SOSZoHv0caV9Oj4P/rMTg/rrtAEM/wDDSLdx+oAKG8Fn9g3FqNV0RkJJeTsC/X2"
}

Note that the hexdecimal representation of this transaction is the following.

84a400818258208ecac6227a0d4f031dda5a0100f0eb0675d93f0591f5f218fa4451f759bbae74010182825839000743d16cfe3c4fcc0c11c2403bbc10dbc7ecdd4477e053481a368e7a06e2ae44dff6770dc0f4ada3cf4cf2605008e27aecdb332ad349fda71a000f424082581d60c580fcdef8ede4f55420f60d021ed5faf434c4611912f9dc1c72d8a21a3a13b784021a00028b4d0f00a10081825820d167c087f0e17f465f416e6ced46b1ef9cffa93387797fcd35a7a965d4491c9f5840d690316b608a5e8e18816a6925fab516d417d523926681efd1c695f4e8f83ffacc4e0febaed00433fc030d22ddc7ea00286f059fd83716a355d1190925e4ec0bf5f6

It returns this error:

{
  "errors": [
    {
      "message": "UnknownResultError: {\"type\":\"jsonwsp/fault\",\"version\":\"1.0\",\"servicename\":\"ogmios\",\"fault\":{\"code\":\"client\",\"string\":\"Invalid request: DeserialiseFailure 263 \\\"Size mismatch when decoding \\\\nRecord RecD.\\\\nExpected 4, but found 3.\\\".\"},\"reflection\":{\"requestId\":\"miRZQ\"}} is an unknown result",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "submitTransaction"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: UnknownResultError: {\"type\":\"jsonwsp/fault\",\"version\":\"1.0\",\"servicename\":\"ogmios\",\"fault\":{\"code\":\"client\",\"string\":\"Invalid request: DeserialiseFailure 263 \\\"Size mismatch when decoding \\\\nRecord RecD.\\\\nExpected 4, but found 3.\\\".\"},\"reflection\":{\"requestId\":\"miRZQ\"}} is an unknown result",
            "    at Object.<anonymous> (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:77:43)",
            "    at Generator.throw (<anonymous>)",
            "    at rejected (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:6:65)",
            "    at runMicrotasks (<anonymous>)",
            "    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
          ]
        }
      }
    }
  ],
  "data": null
}

What is the expected behavior?

This is a valid transaction, as it was successfully submitted to the testnet using cardano-cli.

The expected response shall contain the transaction ID 20e65fbbbb08e6085853b828d52bed364e19e50a35d7d9e241e9f43a0fd4aa2f.

rhyslbw commented 3 years ago

Thanks for the report. I'll be updating the Ogmios dependency shortly so will test this out to see if it's been resolved already.

hzccc commented 3 years ago

Hello. Could you please provide your GraphQL service for me to use? SubmitTransaction also ran into problems. this issue: https://github.com/input-output-hk/cardano-graphql/issues/606,

dingxiangfei2009 commented 3 years ago

Hello @rhyslbw, I see that Ogmios is updated to 4.1.0. This issue persists with the same error message.

rhyslbw commented 3 years ago

Thanks for the update @dingxiangfei2009, I'll dig into this further.

dingxiangfei2009 commented 3 years ago

@rhyslbw I have a question. In the current plan, do transaction submissions through cardano-graphql accept only Alonzo transaction bodies or accept transaction bodies from Alonzo and earlier eras for backward compatibility?

dingxiangfei2009 commented 3 years ago

If indeed all Shelley-compatible transaction submissions should be acceptable, CardanoSolutions/ogmios#131 will enable such support.

dingxiangfei2009 commented 3 years ago

Looks like this issue will be resolved once the latest ogmios is used. :+1:

rhyslbw commented 3 years ago

Thanks for the contributions @dingxiangfei2009, we'll get this updated ASAP

masa-matt commented 2 years ago

I have exactly the same error. I tried the latest v6.2.0 in testnet, but it seems like the same issue remains. Why does this error happen when using docker? No problem is found at wss://ogmios-api.testnet.dandelion.link.

{
  "transaction": "84a40081825820fa1fe8bf72a4c4608181865b106950e1caa4f83ae2d9df53d0a49ea9e461457a01018282581d60247f3006b36b3b39f5e3cf5135df39e74e773d3860d6d6e4639099b41a000f42408258390030b1d8b9642d2072c03c2af4b42c887a23df8c56482ee2763e9083999d6732b5ca23796d8710ab1268dfa50c8bfc613c4973aca7bef2dedc1a01ac4392021a0002ae8a031a02f89627a100818258209c264a4c9a43a3711de00d60e201a4a75f24aefe19dfbab30c6776d3bdb5b5b6584043581e3be1af1d429dfb144c59056512a45b7acdae93ff3c60716511670727f385d6f6b373c80b7224aecc1dd51ba031dfae7f6d36231d20ccb3a1e3a6f4bc00f5f6"
}
dingxiangfei2009 commented 2 years ago

@masa-matt v6.2.0 is still using the old ogmios @ v4.1.0

masa-matt commented 2 years ago

@dingxiangfei2009 I'm afraid, but v6.2.0 seems to be using ogmios @ v5.1.0. https://github.com/input-output-hk/cardano-graphql/releases/tag/6.2.0

mahnunchik commented 2 years ago

I've faced with the same issue:

errors: [
    {
      message: 'Deserialization failed in Transaction.metadata because: Expected null, found other type',
      locations: [ { line: 4, column: 3 } ],
      path: [ 'submitTransaction' ],
      extensions: {
        code: 'INTERNAL_SERVER_ERROR',
        exception: {
          stacktrace: [
            'Error: Deserialization failed in Transaction.metadata because: Expected null, found other type',
            '    at Object.<anonymous> (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:77:43)',
            '    at Generator.throw (<anonymous>)',
            '    at rejected (/app/packages/api-cardano-db-hasura/dist/executableSchema.js:6:65)',
            '    at runMicrotasks (<anonymous>)',
            '    at processTicksAndRejections (internal/process/task_queues.js:95:5)'
          ]
        }
      }
    }
  ]
apufvqsp commented 2 years ago

Is there a plan to solve this issue? Does the v6.2.0 mainnet also have this problem?

silvestrst-crypto commented 2 years ago

Hey guys could you please give an update on the state of this issue?

rhyslbw commented 2 years ago

The next version will be using Ogmios v5.5.0, which supports the Babbage era. Transactions need to be constructed using era-compatible libraries, although the original report indicates it wasn't the case.