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

MPC Sign Transaction Timeouts #1448

Open
4 tasks done
bh2smith opened this issue Jan 9, 2025 · 0 comments
Open
4 tasks done

MPC Sign Transaction Timeouts #1448

bh2smith opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@bh2smith
Copy link

bh2smith commented Jan 9, 2025

Prerequisites

  • I'm using the latest version of near-api-js.
  • I have tried to start with a fresh project and reproduce the defect with minimal code changes.
  • I have read the console error messages carefully (if applicable).

Description

the providers package has a hard-coded backoff/retry configuration that times out at 11.33 seconds:

const BACKOFF_MULTIPLIER = 1.5;
const RETRY_NUMBER = 10;

These sign transactions on v1.signer are taking approximately 12 blocks to confirm. Example Tx:

https://nearblocks.io/txns/F683A1dLFZYbqRbNjEuNpQTA9gKFVfHVkgUfyeYuhnrx#execution

Results in errors like this:

.../near-ca/node_modules/@near-js/providers/lib/commonjs/fetch_json.cjs:47
            throw new ProviderError(await res.text(), { cause: status });
                  ^

ProviderError: {"jsonrpc":"2.0","error":{"name":"HANDLER_ERROR","cause":{"name":"TIMEOUT_ERROR"},"code":-32000,"message":"Server error","data":"Timeout"},"id":127}
    at BackOff.request (.../near-ca/node_modules/@near-js/providers/lib/commonjs/fetch_json.cjs:47:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  cause: undefined,
  context: ErrorContext {
    transactionHash: 'GSVoBzcfcW6aaSwQmzp45pSZ6h3gJbjLUtPDaecfnX1T'
  }
}

Reproducible demo

https://github.com/Mintbase/near-ca

Steps to reproduce

  1. Set Appropriate env vars
  2. Run npx tsx examples/send-eth.ts
  3. Watch for timeout.

Expected behavior

Not a timeout

Actual behavior

always a timeout.

Your environment

  • NEAR JavaScript API version used: latest

Self-service

  • I'd be willing to fix this bug myself.
@bh2smith bh2smith added the bug Something isn't working label Jan 9, 2025
@github-project-automation github-project-automation bot moved this to NEW❗ in DevTools Jan 9, 2025
bh2smith added a commit to BitteProtocol/near-ca that referenced this issue Jan 9, 2025
The MPC Sign Requests are timing out when calling
`account.signAndSendTransaction`. This appears to be buried deeply in
the non-configurable `provider.txStatus` polling (when waiting for an
EXECUTED status).

Add alternate/semi-manual transaction broadcast & result fetching as
follows:

 - signTransaction
 - sendTransactionAsync
- poll txStatus for INCLUDED instead of EXECUTED on a loop until
EXECUTED (with 1 second/block sleep).


This is entirely due to some usability issue with near-js/providers:
near/near-api-js#1448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: NEW❗
Development

No branches or pull requests

1 participant