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

End builder session on a New Block #281

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

7suyash7
Copy link
Contributor

@7suyash7 7suyash7 commented Oct 6, 2024

#167

Implement a mechanism to end builder sessions when a new block arrives, to avoid simulations on invalid states.

  • SessionManager now subscribes to ChainHeadEvent
  • On receiving a new block event, all active sessions are terminated.
  • Added checks to prevent new sessions from being created after SessionManager is closed.
  • Added a Terminate method to builder for clean session ending.
  • Added tests.


func (b *builder) Terminate() {
b.cancelFunc()
b.txns = nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need to set this to nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Misunderstood how context works here, fixed it.

suave/builder/session_manager.go Outdated Show resolved Hide resolved
Signed-off-by: 7suyash7 <[email protected]>
@7suyash7 7suyash7 requested a review from ferranbt October 7, 2024 14:40
@ferranbt ferranbt merged commit 3a8a569 into flashbots:main Oct 9, 2024
4 checks passed
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.

2 participants