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

feat(client): Read snapshots for state #3092

Closed
wants to merge 4 commits into from
Closed

Conversation

mikhailOK
Copy link
Contributor

Make all reads from state use a read snapshot.

Refactor RuntimeAdapter: methods that touch state now require creating a
RuntimeStateAdapter.

For now client and gc run in the same thread, so nothing should change
for client. For view client it will be impossible to get storage errors
if reading storage root succeeds.

Test plan

Existing tests.
Small sanity test.

Make all reads from state use a read snapshot.

Refactor RuntimeAdapter: methods that touch state now require creating a
RuntimeStateAdapter.

For now client and gc run in the same thread, so nothing should change
for client. For view client it will be impossible to get storage errors
if reading storage root succeeds.

Test plan
---------
Existing tests.
Small sanity test.
@gitpod-io
Copy link

gitpod-io bot commented Aug 6, 2020

fn apply_transactions_with_optional_storage_proof(
/// Validate state part that expected to be given state root with provided data.
/// Returns false if the resulting part doesn't match the expected one.
fn validate_state_part(
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this part of RuntimeAdapter but not RuntimeStateAdapter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doesn't need state to validate

Comment on lines +43 to +44
/// 3. Store does not use snapshots, so data can disappear between reads.
store: Store,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really safe, but maybe not terrible. Need to review all storage uses


pub struct RocksDBOwningSnapshot {
db: Pin<Arc<RocksDB>>,
snapshot: Snapshot<'static>,
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 we do this instead of having a lifetime parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just to do less refactoring

Copy link
Collaborator

@bowenwang1996 bowenwang1996 left a comment

Choose a reason for hiding this comment

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

@SkidanovAlex should we put this on hold?

@frol
Copy link
Collaborator

frol commented Oct 6, 2020

Please, revisit this PR and merge, close, or convert into a draft, so it is easier to see which PRs awaiting reviews.

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.

4 participants