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

Verify archive state using a one shot in memory store #12730

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

sadhansood
Copy link
Contributor

@sadhansood sadhansood commented Jun 27, 2023

Description

Added a shared in memory store which only keeps last checkpoint and its content in memory. This helps iterate over checkpoints really fast as we don't need to use a db and can run verification without writing to rocksdb ever.

Test Plan

Added unit tests

@vercel
Copy link

vercel bot commented Jun 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Jul 5, 2023 6:58pm
explorer-storybook ⬜️ Ignored (Inspect) Jul 5, 2023 6:58pm
multisig-toolkit ⬜️ Ignored (Inspect) Jul 5, 2023 6:58pm
sui-kiosk ⬜️ Ignored (Inspect) Jul 5, 2023 6:58pm
sui-wallet-kit ⬜️ Ignored (Inspect) Jul 5, 2023 6:58pm
wallet-adapter ⬜️ Ignored (Inspect) Jul 5, 2023 6:58pm

{
let mut locked = self.0 .0.write().unwrap();
locked.checkpoints.clear();
locked.sequence_number_to_digest.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

delete all previous checkpoints when we add new one

Comment on lines +1059 to +1099
locked.transactions.clear();
locked.effects.clear();
locked.contents_digest_to_sequence_number.clear();
locked.full_checkpoint_contents.clear();
locked.checkpoint_contents.clear();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

delete all previous content when we add new one

@sadhansood sadhansood force-pushed the sadhan/verify_checkpoint branch 2 times, most recently from 6ab6ebe to 8262c7a Compare June 27, 2023 23:45
}

fn insert_committee(&self, new_committee: Committee) -> Result<(), Self::Error> {
self.0.insert_committee(new_committee)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: just self.0.insert_committee(new_committee) instead of two lines method should work

@@ -969,3 +969,138 @@ impl Display for DeleteKind {
}
}
}

#[derive(Clone, Debug, Default)]
pub struct OneShotSharedInMemoryStore(SharedInMemoryStore);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe SingleCheckpointInMemoryStore? and a small comment why do we need one

}
}

impl ReadStore for OneShotSharedInMemoryStore {
Copy link
Contributor

Choose a reason for hiding this comment

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

would be nice to avoid all the boilerplate code, but not a blocker.
We could use delegate crate or add a capacity parameter to original InMemoryStore(with default setting of u64::MAX)

@sadhansood sadhansood force-pushed the sadhan/verify_checkpoint branch 2 times, most recently from 26a0b42 to 16fe3d9 Compare July 5, 2023 17:38
@sadhansood sadhansood force-pushed the sadhan/verify_checkpoint branch from 16fe3d9 to 03c4291 Compare July 5, 2023 18:58
@sadhansood sadhansood merged commit 04092e7 into main Jul 5, 2023
@sadhansood sadhansood deleted the sadhan/verify_checkpoint branch July 5, 2023 19:31
longbowlu pushed a commit that referenced this pull request Jul 6, 2023
## Description 

Added a shared in memory store which only keeps last checkpoint and its
content in memory. This helps iterate over checkpoints really fast as we
don't need to use a db and can run verification without writing to
rocksdb ever.

## Test Plan 

Added unit tests
ebmifa pushed a commit that referenced this pull request Jul 12, 2023
## Description 

Added a shared in memory store which only keeps last checkpoint and its
content in memory. This helps iterate over checkpoints really fast as we
don't need to use a db and can run verification without writing to
rocksdb ever.

## Test Plan 

Added unit tests
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