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

improvement(best-orders): return an rpc error when we can't find best orders #2318

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

mariocynicys
Copy link
Collaborator

Return an RPC error in best orders rpc if we were not able to get the best orders because nobody in the network replied to our p2p request.
This is saner that returning a successful result with no best orders inside.

Kinda addresses #2228

@mariocynicys
Copy link
Collaborator Author

in progress since i will check also other p2p interacting RPCs and apply the same patch to.
p2p interactions aren't guaranteed to succeed, so we should make that obvious/visible from the RPC side.

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

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

Since it's been a month, can you share the status quo of this PR?

Changes seem harmless, so the current status is also LGTM.

@mariocynicys
Copy link
Collaborator Author

@onur-ozkan there is one last place we ask for any peer's response but we don't error.
i opted for not erroring here since part of the response is computed from local data and isn't completely dependent p2p network.

@shamardy shamardy self-requested a review February 17, 2025 10:08
@onur-ozkan
Copy link
Member

onur-ozkan commented Feb 19, 2025

Please ping me once this is on "pending review" status.

@mariocynicys
Copy link
Collaborator Author

ping @onur-ozkan :)

@mariocynicys
Copy link
Collaborator Author

mariocynicys commented Feb 21, 2025

some tests are failing now because when a single seed node in a network does orderbook request it must fail (no other seed node to reply).
I am not sure whether it's better to adjust for this case in test environment or revert the last commit all together? (or maybe never error for seednodes p2p requests. as the nicer UX this PR brings is targeted for users anyway).

@shamardy shamardy requested review from shamardy and removed request for shamardy March 3, 2025 11:52
Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

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

LGTM.

Just to make sure, when remote peers return no data, will we still be able to return an empty list as a response?

@mariocynicys
Copy link
Collaborator Author

Just to make sure, when remote peers return no data, will we still be able to return an empty list as a response?

yup, a no data (i.e. empty vector/set) response is a valid response.

@onur-ozkan
Copy link
Member

Can you pull dev branch to this PR, test pipelines are so red right now.

@shamardy
Copy link
Collaborator

shamardy commented Mar 5, 2025

I am not sure whether it's better to adjust for this case in test environment or revert the last commit all together? (or maybe never error for seednodes p2p requests. as the nicer UX this brings is targeted for users anyway).

If the local node is a seed node, we should never return an error, as it has already subscribed to all topics and possesses the order book. It should still request and fill the order book in case it doesn't have the latest state or just came online, but if no other seeds respond, we should return the local copy of the order book. For test cases you mentioned, we should run this single node as a seed node. We will still get this issue #2228 with seednodes, but it's a GUI issue so not a problem. What do you think @mariocynicys ?

@shamardy
Copy link
Collaborator

shamardy commented Mar 5, 2025

don't forget to pull the latest commit @mariocynicys, I wanted to see which tests were failing

@mariocynicys
Copy link
Collaborator Author

If the local node is a seed node, we should never return an error,

agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants