-
Notifications
You must be signed in to change notification settings - Fork 862
feat(flatkv): introduce interface layer (Store/Iterator) and typed keys #2710
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?
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
6e680a7 to
708274e
Compare
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6e680a7ea3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
sei-db/state_db/sc/flatkv/api.go
Outdated
| // Exporter creates an exporter for the given version (0 = current). | ||
| Exporter(version int64) (*Exporter, error) |
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.
* Return Exporter interface, not Exporter
The method signature Exporter(version int64) (*Exporter, error) returns a pointer to an interface, which is almost always a mistake in Go. Callers will have to dereference just to call methods, and it becomes easy to return a non-nil pointer that wraps a nil interface (e.g., exp != nil but *exp == nil), which will still panic when methods are invoked once the interface grows methods. Returning the interface value (Exporter) avoids these nil-check pitfalls and matches standard Go API semantics.
Useful? React with 👍 / 👎.
3193ca9 to
ccddbf3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2710 +/- ##
==========================================
+ Coverage 44.00% 44.02% +0.02%
==========================================
Files 1980 1982 +2
Lines 162724 162837 +113
==========================================
+ Hits 71612 71695 +83
- Misses 84592 84611 +19
- Partials 6520 6531 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
ccddbf3 to
263345b
Compare
11cea82 to
3e3c469
Compare
Describe your changes and provide context
This PR introduces the FlatKV interface layer, designed to bridge x/evm state access with a multi-DB storage architecture:
Store Interface: Defines a unified contract for EVM state storage that internally maps logical keys to isolated physical DBs (accounts, code, storage).
Type-Safe Keys: Adds strong types (Address, CodeHash, AccountKey, etc.) and constructors to prevent raw byte manipulation errors.
Key Mapping: Implements ParseEVMKey to robustly translate x/evm memiavl keys into internal DB selectors.
Iterator Semantics: Adopts PebbleDB-style iterator semantics (Next/Prev/SeekGE) with explicit support for multiplexed iteration across the multi-DB layout.
Testing performed to validate your change