js-stellar-sdk icon indicating copy to clipboard operation
js-stellar-sdk copied to clipboard

ContractClient: default `timeoutInSeconds` not working

Open chadoh opened this issue 1 year ago • 2 comments

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.

chadoh avatar Apr 30 '24 20:04 chadoh

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

Shaptic avatar May 01 '24 16:05 Shaptic

@Shaptic yes, PR here

  • https://github.com/stellar/js-stellar-sdk/pull/951

chadoh avatar May 02 '24 18:05 chadoh

Fixed in #951

Shaptic avatar May 23 '24 18:05 Shaptic