o1js
o1js copied to clipboard
Add retry functionality to the makeGraphqlRequest
During the last day, all Berkeley testnet graphql endpoints were unstable, that was leading to many o1js errors when fetching the accounts or blocks.
Although there is timeout for makeGraphqlRequest that is set by default to 5 minutes, there were no attempts being made by the makeGraphqlRequest to retry fetching the account or block in case of the error and error is being thrown like
Error making GraphQL request: Bad Gateway
or
value.get() failed, either:
1. We can't find this zkapp account in the ledger
2. Because the zkapp account was not found in the cache. Try calling `await fetchAccount(zkappAddress)` first.
If none of these are the case, then please reach out on Discord at #zkapp-developers and/or open an issue to tell us!
getAccount: Could not find account for public key B62qnWyoDZP5QoqJ7tiRAuoaUtEzs2xHw8ETsrGFgQjniLFk5XP6qC2
Graphql endpoint: https://api.minascan.io/node/berkeley/v1/graphql
See also discussion on discord started with https://discord.com/channels/484437221055922177/915745847692636181/1204548331121016853 and my comment https://discord.com/channels/484437221055922177/915745847692636181/1204698561820758046
Proposal:
- Add retry functionality to the makeGraphqlRequest similar to the tx.wait() to retry getting the information from graphql endpoints till the timeout.
Temporary workarounds: https://github.com/dfstio/he-contract-demo/blob/main/tests/api.test.ts#L234 https://github.com/dfstio/he-contract-demo/blob/main/tests/api.test.ts#L244
Good idea! Shouldn't be hard to implement
See also https://github.com/o1-labs/o1js/issues/1427 and https://github.com/o1-labs/o1js/issues/1426 that can be related to this issue