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

Rosetta: /construction/submit endpoint times out on first/second use after Node/API start #2169

Closed
crustywhale opened this issue Nov 18, 2024 · 2 comments

Comments

@crustywhale
Copy link

Node: 3.0.0.0.2
API: 8.2.2

After starting or restarting a stacks node and stacks api, the first 1 or 2 attempts to use the /construction/submit endpoint to broadcast a transaction will fail (timeout). By the third or fourth attempt it will start working, and once it does the problem will not reappear again until the stacks node and stacks API are restarted.

@github-project-automation github-project-automation bot moved this to 🆕 New in API Board Nov 18, 2024
@crustywhale crustywhale changed the title Rosetta: /construction/submit endpoint times out on first/second submit after Node/API start Rosetta: /construction/submit endpoint times out on first/second use after Node/API start Nov 18, 2024
@zone117x
Copy link
Member

zone117x commented Nov 19, 2024

I suspect the services (stacks-node and/or stacks-blockchain-api) are not ready for N second after boot, and that the broadcast is succeeding after that period of time rather than number of retries.

The rosetta /construction/submit endpoint is essentially a wrapper around the stacks-core POST /v2/transactions endpoint. It can only succeed once the stack-core RPC endpoints are responsive.

The API and postgres typically don't take long to start (maybe a few seconds?), so I'm assuming stacks-core isn't yet ready.

Here's a few things you can try:

  1. Specify the env var SKIP_STACKS_CHAIN_ID_CHECK=1 in the API. This instructs the API to skip the startup validation request to the stacks-node at http://$STACKS_CORE_RPC_HOST:$STACKS_CORE_RPC_PORT. This can shave off up 2.5 seconds from the API http server init time (if we assume the stacks-node is ready immediately just after the first API validation request).

  2. Determine how long stacks-node takes to be ready by polling http://$STACKS_CORE_RPC_HOST:$STACKS_CORE_RPC_PORT/v2/pox. This is the earliest possible time the Rosetta submit endpoint can work.

@zone117x
Copy link
Member

@crustywhale closing this issue. Please feel free to re-open or comment if you have any additional issues or questions

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in API Board Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants