Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3064 +/- ##
==========================================
+ Coverage 58.32% 58.38% +0.05%
==========================================
Files 2076 2078 +2
Lines 171478 171673 +195
==========================================
+ Hits 100020 100231 +211
+ Misses 62549 62506 -43
- Partials 8909 8936 +27
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| "github.com/sei-protocol/sei-chain/sei-db/common/evm" | ||
| "github.com/sei-protocol/sei-chain/sei-db/common/metrics" | ||
| "github.com/sei-protocol/sei-chain/sei-db/config" | ||
| flatkvpkg "github.com/sei-protocol/sei-chain/sei-db/state_db/sc/flatkv" |
There was a problem hiding this comment.
flatkv pkg is imported twice
| if err != nil { | ||
| return nil, fmt.Errorf("open iterator for db %d: %w", e.currentDB, err) | ||
| } | ||
| if iter == nil || !iter.First() { |
There was a problem hiding this comment.
if iter.First() fails because of an iterator/IO error rather than because the DB is empty, we should also handle the iter.Error()?
| }, nil | ||
| } | ||
|
|
||
| func (s *SnapshotExporter) Next() (interface{}, error) { |
There was a problem hiding this comment.
Short godoc explaining the methods in struct would be helpful. Purpose of these methods wasn't immediately obvious based on function names and context.
| pendingNodes []*types.SnapshotNode | ||
| } | ||
|
|
||
| func NewKVExporter(store *CommitStore, version int64) *KVExporter { |
There was a problem hiding this comment.
Does this sort of export happen on validators on mainnet? If so, would it make sense to have throttles to prevent an export from impacting the handling of regular traffic? Do we currently throttle export from memIAVL?
There was a problem hiding this comment.
Export only happens on RPC nodes, validator doesn't export at all
Describe your changes and provide context
This PR is adding exporter used by state sync to export live state into snapshot files.
Composite Exporter (composite/exporter.go): Orchestrates the export stream from both the Cosmos (memiavl) and FlatKV backends. All Cosmos modules are exported first, then FlatKV EVM data is appended as a distinct module named "evm_flatkv". The FlatKV phase is only included when WriteMode == SplitWrite or DualWrite.
Composite Importer routing (composite/importer.go): Updated to route the "evm_flatkv" module exclusively to the FlatKV importer, and all other modules exclusively to the Cosmos importer. Previously, EVM data was duplicated to both importers based on the "evm" module name.
FlatKV Importer snapshot fix (flatkv/importer.go): The importer now writes a snapshot after import completes. Import bypasses the WAL and writes directly to PebbleDB in the working directory. Without a snapshot, the next LoadVersion would re-clone the working directory from the pre-import snapshot (e.g. snapshot-0), destroying all imported data.
Testing performed to validate your change