-
Notifications
You must be signed in to change notification settings - Fork 936
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
feat(provider): consistent database view #6896
Conversation
@mattsse ptal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had some time to review, simple enough. I think the mevoors like Snoopy may want this too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense,
but this is really enforces consistent Tip, so view sounds a bit too general to me
wdyt @shekhirin
imo it's fine to call it a view as it gets invalidated on chain advancement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do I understand correctly that this is just a precautionary measure in an already consistent scenario (trie update), when we're already sure there are no other write transactions happening during that time? Not fully understand what will happen if this doesn't hold, do we just crash?
agreed it's fine to call it a view, although can add it to comments why so: because all updates are atomic, and the tip changes at the same time as other parts of the database. |
@shekhirin this is a pre-cautionary measure against the misuse of the parallel/async API. if we misuse it internally, ye we should crash because our logic is flawed. for external use it's handy to catch that error and decide what to do next |
Description
Extracted from #6576 and modified.
This PR adds an ability to create a consistent view of the database. Each attempt to create a provider will be followed by tip consistency checks.
Intended Usage
This view is useful when attempting to perform parallel reads of the state across multiple threads while preserving the guarantee that the state remains unchanged.