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

remove state commit on disconnect #3385

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ceyonur
Copy link
Contributor

@ceyonur ceyonur commented Sep 13, 2024

Why this should be merged

Committing state adds an overhead on peer disconnects

How this works

Removes state commit from disconnect. Block acceptance/Shutdown should be sufficient for writing disk to the state.

How this was tested

existing UTs should cover this

Comment on lines -490 to -477
if err := vm.state.Commit(); err != nil {
return err
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if we want to we can move this to SetPreference (or some periodic go routine like mempool pruning etc). I'd imagine block acceptance should be sufficient enough though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Another thing you can do is to check when was the last time you committed the disconnected nodes. If it's less than, say, 1 second ago, then not commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea good idea we could do that instead. but I slightly think that state should be commited with respect to chain progress.

Copy link

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

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