stellar / stellar-rpc

RPC server for Soroban contracts.
19 stars 20 forks source link

soroban-rpc: `simulateTransaction` returning invalid `results` #20

Open Shaptic opened 1 year ago

Shaptic commented 1 year ago

What version are you using?

https://rpc-futurenet.stellar.org/

What did you do?

Ran simulation of a transaction:

curl -s 'https://rpc-futurenet.stellar.org/' -H 'Content-Type: application/json' --data '{
  "jsonrpc": "2.0",
  "id": 10235,
  "method": "simulateTransaction",
  "params": [ 
    "AAAAAgAAAADzwQ11keCAXiGbzzenrJCF67uR4i8TRh6rq10fRyygkwAAA+gAALIrAAAARQAAAAEAAAAAAAAAAAAAAABk+MefAAAAAAAAAAEAAAAAAAAAGgAAAAAAAAABAAAAAAAAAAAAAAACAAAABzvHl6ljHJiGxSRWVNXrog1BZenOcFxRa/PN/pljigY5AAAAAAAAAAYAAAABO8eXqWMcmIbFJFZU1euiDUFl6c5wXFFr883+mWOKBjkAAAAUAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  ]
}' | jq

The response was:

{
  "jsonrpc": "2.0",
  "id": 10235,
  "result": {
    "transactionData": "AAAAAAAAAAAAAAACAAAABzvHl6ljHJiGxSRWVNXrog1BZenOcFxRa/PN/pljigY5AAAAAAAAAAYAAAABO8eXqWMcmIbFJFZU1euiDUFl6c5wXFFr883+mWOKBjkAAAAUAAAAAQAAAAAAAAAAAAAAzAAAAMwAAAGYAAAAAAAAAFA=",
    "events": null,
    "minResourceFee": "62171",
    "results": [
      {
        "auth": null,
        "xdr": ""
      }
    ],
    "cost": {
      "cpuInsns": "0",
      "memBytes": "0"
    },
    "latestLedger": "771779"
  }
}

(More context on Discord.)

What did you expect to see?

According to the documentation, the results field should not have any optional components, so this should either:

What did you see instead?

results[0] is not a valid result structure, since xdr is an empty string and auth is null.

Shaptic commented 1 year ago

I'm almost certain this is fixed in current versions so feel free to just close this as such, but I just want to raise it in case it's not.