-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add NodeGateway retrying nonce requests if response outdated #1946
base: develop
Are you sure you want to change the base?
Conversation
dcd5562
to
49c6024
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1946 +/- ##
===========================================
- Coverage 79.91% 79.89% -0.02%
===========================================
Files 101 103 +2
Lines 3450 3497 +47
Branches 733 742 +9
===========================================
+ Hits 2757 2794 +37
- Misses 381 386 +5
- Partials 312 317 +5 ☔ View full report in Codecov by Sentry. |
49c6024
to
1f977aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did only functional review. This is formal approval of the new strategy not the codebase/implementation.
If I understand it correctly this changes are making sure that the gateway/node/backend nonce is in sync with the SDK instance (kind of/partially). In general I don’t see possible regressions (other than extra error that must be probably handled by the apps), and only eventual improvement.
I think the default 8 retries are a bit too much, while currently there are no RPS limits we'll implement it at some point (as protection measure) which can cause issues. In general I don't think the SDK should care about of the "gateway" concepts and should tread it as ordinal node/API backend, however the user/developer should be able to choose the proposed nonce strategy for any backend. Also hardcoding the endpoints also sounds like a bad idea, yes we should keep them as defaults, but the users should be able to change it? |
Okay I was confused (didn't fully read) these lines: https://github.com/aeternity/aepp-sdk-js/pull/1946/files#diff-9f5cadd5139250f5eef2e796974c1db0f422f7adb4541f5b5b356a26c54711afR43 It still means one would get the waring if they don't use our gateways? A bit annoying I guess as there are multiple environments, user nodes, hyperchains etc. |
It is a hint to use |
1f977aa
to
27d1a4c
Compare
This PR is supported by the Æternity Crypto Foundation
We are retrying requests multiple times if the response status code is 404 or so. It is made because a public API gateway has a load balancer, and some nodes behind it can be a bit unsynced producing outdated results. The same issue with nonce tracking, node can return an outdated nonce, but it is much harder to detect. A wrong nonce completely blocks tx mining (see aeternity/aeternity#4173).
To solve this problem I've implemented a class inherited from Node. This class extracts nonces from submitted transactions and if the nonce returned by node looks outdated then it retries the request the same way if it would be 404. Sdk tests became much more stable using this on testnet.
A general solution would be #291.