Skip to content

Conversation

@finiteops
Copy link

No description provided.

@finiteops finiteops requested a review from ufoscout February 26, 2025 13:18
@finiteops finiteops force-pushed the bitfinity-lb-endpoint branch from b8165ff to f046a05 Compare February 26, 2025 13:19
Copy link

@ufoscout ufoscout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, the approach proposed in this PR will not work in many situations. For example, if the node is not able to properly reach the primary URL or if the node's primary URL is out of sync, this will return a wrong result.

None => U256::from(3),
};

let network_block = BitfinityEvmRpc::network_block_number(self).await?;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our system manages remote URLs with automatic fallbacks if a URL is not reachable. The way this endpoint is implemented, instead, does not respect it; as a consequence, this function could return a wrong result if the URL is not the primary one that the node is currently using

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there will be no issues unless it returns response from the node that it currently syncs with

@finiteops finiteops force-pushed the bitfinity-lb-endpoint branch from 036410e to efc6162 Compare March 6, 2025 10:26
@finiteops
Copy link
Author

finiteops commented Mar 6, 2025

In general, the approach proposed in this PR will not work in many situations. For example, if the node is not able to properly reach the primary URL or if the node's primary URL is out of sync, this will return a wrong result.

If primary URL is not available (none of them). It will return success (acceptable lag) just to do not break LB.
If there is no primary URL working than we could not detect lag so we prefer to make it look like Ok for LB


// Need time to generate extra blocks at `eth_server`
// Assuming it ticks 100ms for the next block
tokio::time::sleep(std::time::Duration::from_millis(1500)).await;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually avoid direct sleeping when possible. Instead of sleeping, check your condition in a finite-loop with minimal sleep of a few ms between loops.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upated

@finiteops finiteops merged commit d0b4545 into bitfinity-archive-node Mar 7, 2025
5 of 37 checks passed
@finiteops finiteops deleted the bitfinity-lb-endpoint branch March 7, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants