-
Notifications
You must be signed in to change notification settings - Fork 4
feat: pruning #332
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
base: main
Are you sure you want to change the base?
feat: pruning #332
Conversation
Summary of ChangesHello @pthmas, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature to implement height-based pruning for Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a pruning mechanism for ev-abci execution artifacts, which is a valuable addition for managing storage. The implementation is straightforward, adding a PruneExecMeta method to the adapter and a corresponding Prune method to the store.
My review focuses on two main points. First, in pkg/store/store.go, the Prune function can be made more efficient and atomic by using batch database operations instead of individual deletes in a loop. This is important for performance and data consistency. Second, the new test in pkg/store/store_test.go uses a fragile method for generating keys from heights; it should be updated to use strconv for consistency with the production code and to ensure correctness for all height values.
| heightKey := ds.NewKey("/abci/bid").ChildString(string(rune(h + '0'))) | ||
| require.NoError(t, db.Put(ctx, heightKey, []byte("bid"))) | ||
|
|
||
| respKey := ds.NewKey("/abci/br").ChildString(string(rune(h + '0'))) | ||
| require.NoError(t, db.Put(ctx, respKey, []byte("br"))) |
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.
The key generation in this test uses string(rune(h + '0')) to convert the height h to a string. This is fragile as it only works for single-digit heights (0-9). The production code uses strconv.FormatUint, which is more robust. To make the test more reliable and align with the production code, you should use strconv.Itoa(h) for key generation. This applies to all key constructions in this test function.
| heightKey := ds.NewKey("/abci/bid").ChildString(string(rune(h + '0'))) | |
| require.NoError(t, db.Put(ctx, heightKey, []byte("bid"))) | |
| respKey := ds.NewKey("/abci/br").ChildString(string(rune(h + '0'))) | |
| require.NoError(t, db.Put(ctx, respKey, []byte("br"))) | |
| heightKey := ds.NewKey("/abci/bid").ChildString(strconv.Itoa(h)) | |
| require.NoError(t, db.Put(ctx, heightKey, []byte("bid"))) | |
| respKey := ds.NewKey("/abci/br").ChildString(strconv.Itoa(h)) | |
| require.NoError(t, db.Put(ctx, respKey, []byte("br"))) |
b3cd390 to
9e7777d
Compare
Overview
PruneExecMetaAPI to delete per-height execution metadata (e.g. block responses, block IDs) up to a target height.ExecMetaPrunerinterface in the ev-abci adapter so it can be driven by ev-node’s pruning hook.Design notes
ExecMetaPrunerhook see no behavior change.