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

TRCL-2801 To avoid having a node with slow latency (thus +1 on height) being the preferred node #52

Merged
merged 3 commits into from
Oct 10, 2023

Conversation

johnqh
Copy link
Contributor

@johnqh johnqh commented Oct 9, 2023

Imagine two nodes.
Node 1 returns quickly with height.
Node 2 is slow and takes a while to return height + 1.

Previous logic would pick Node 2.

Changed it so both maxHeight and maxHeight + 1 are filtered. This should be fine because if an indexer is halted, it would lag way more than 1 block

@linear
Copy link

linear bot commented Oct 9, 2023

TRCL-2801 Improve logic for choosing fastest validator by allowing for block height to be within 1 of highest value returned

https://dydx-team.slack.com/archives/C050EGGP57X/p1695923222139669?thread_ts=1695921391.023729&cid=C050EGGP57X

Current validator logic will often return an sub-optimal node:

Imagine a scenario in which you ping a close node and a far node (both increment to new block height at the same time). The further node will more often return the higher block number as it doesn’t receive the request until later than the close node.
The current logic will in general return you the node with the higher latency!

Adjust algorithm to allow for latest block height - 1 to account for scenario above. Also cap the request to timeout at 1.5 seconds.

@johnqh johnqh merged commit 16a2c9a into main Oct 10, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants