stellar / js-stellar-sdk

Main Stellar client library for the JavaScript language.
https://stellar.github.io/js-stellar-sdk/
Apache License 2.0
628 stars 311 forks source link

ContractClient: default `timeoutInSeconds` not working #950

Closed chadoh closed 4 months ago

chadoh commented 5 months ago

Describe the bug The default timeoutInSeconds is (supposed to be) 10. This is either not getting set correctly, or it needs to be longer. Copying from the comment that @shan-57blocks left at https://github.com/stellar/soroban-cli/pull/1258#issuecomment-2078700843:

After upgraded to the latest version of ts-bindings generated by soroban-cli 20.3.4, the signAndSend function always returns txTooLate error. The previous ts-bindings version works fine. (I'm interacting with the example increment contract deployed to testnet). @chadoh Could you please take a look? Thanks.

Here is the demo repo: https://github.com/shan-57blocks/soroban-ts-bindings-playground

Here is the error message:

Error SendFailedError: Sending the transaction to the network failed!
{
  "status": "ERROR",
  "hash": "f2f240838c0718e2e5fe9e156cee9588e7084262e1783f3d1866c2148a82db5a",
  "latestLedger": 1307318,
  "latestLedgerCloseTime": "1714111201",
  "errorResult": {
    "_attributes": {
      "feeCharged": {
        "_value": "1113253"
      },
      "result": {
        "_switch": {
          "name": "txTooLate",
          "value": -3
        }
      },
      "ext": {
        "_switch": 0
      }
    }
  }
}
    at _callee$ (/Users/57block/Documents/projects/huma-soroban-playground/node_modules/@huma/increment/node_modules/@stellar/stellar-sdk/lib/contract_client/sent_transaction.js:56:19)
    at tryCatch (/Users/57block/Documents/projects/huma-soroban-playground/node_modules/@huma/increment/node_modules/@stellar/stellar-sdk/lib/contract_client/sent_transaction.js:21:913)
    at Generator.<anonymous> (/Users/57block/Documents/projects/huma-soroban-playground/node_modules/@huma/increment/node_modules/@stellar/stellar-sdk/lib/contract_client/sent_transaction.js:21:2859)
    at Generator.next (/Users/57block/Documents/projects/huma-soroban-playground/node_modules/@huma/increment/node_modules/@stellar/stellar-sdk/lib/contract_client/sent_transaction.js:21:1550)
    at asyncGeneratorStep (/Users/57block/Documents/projects/huma-soroban-playground/node_modules/@huma/increment/node_modules/@stellar/stellar-sdk/lib/contract_client/sent_transaction.js:22:103)
    at _next (/Users/57block/Documents/projects/huma-soroban-playground/node_modules/@huma/increment/node_modules/@stellar/stellar-sdk/lib/contract_client/sent_transaction.js:23:194)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

What version are you on? 11.3.0

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo created by @shan-57blocks: https://github.com/shan-57blocks/soroban-ts-bindings-playground/tree/main
  2. Exercise the call to incrementClient.increment
  3. See that it times out

I have seen reports that this is happening with other contracts and methods, too. Running against a local network and contract might help with debugging, if it can be reproduced in that context.

Expected behavior The default timeoutInSeconds should work most of the time.

Shaptic commented 5 months ago

Looks like there's another report of this on Discord. This issue seems mildly urgent: is someone investigating?

chadoh commented 5 months ago

@Shaptic yes, PR here

Shaptic commented 4 months ago

Fixed in #951