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

Don't send ResponseMessage::NotFound right away, wait for txns #3231

Merged
merged 6 commits into from
May 30, 2024

Conversation

lukaszrzasik
Copy link
Contributor

@lukaszrzasik lukaszrzasik commented May 28, 2024

Closes #3046

This PR:

  • Delays sending ResponseMessage::NotFound immediately
  • Sleeps for a specified time
  • Retries to calculate VID in hope transactions have been received during sleeping

This PR does not:

This change delays the response to the requester which blocks the requester from moving to the next possible responder.
This might be viewed as undesirable behaviour depending on the scenario.

Key places to review:

get_or_calc_vid_share method

All tests should pass.

Comment on lines 138 to 136
if consensus
.calculate_and_update_vid(view, Arc::clone(&self.quorum), &self.private_key)
.await;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I missed this in a previous pr but I think we probably want to move the calculation of vid shares back outside of consensus. This forces a write lock to be held to calculate VID which will basically block everything.

I think just the update VID should need the lock

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. My mistake I extended the write lock.

I decided to keep the function in Consensus but as a associated function which takes LockedConsensusState and locks it accordingly, either read or write as needed. I wanted to keep it in a separate function because exactly the same operations are used in both Response and DA tasks.

Side effect of this change is that now get_or_calc_vid_share locks Consensus in a more fine-grained manner, i.e. locks more often but for one operation only. I don't think it's a problem. Afaict locking is not considered as a "heavy" operation.

@lukaszrzasik lukaszrzasik merged commit 7451ed7 into main May 30, 2024
24 checks passed
@lukaszrzasik lukaszrzasik deleted the lr/delay-not-found branch May 30, 2024 06:56
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.

[LIBP2P] - Delay sending ResponseMessage::NotFound
2 participants