Skip to content

FlatKV Value Type Structs#3164

Open
cody-littley wants to merge 1 commit intomainfrom
cjl/vtypes
Open

FlatKV Value Type Structs#3164
cody-littley wants to merge 1 commit intomainfrom
cjl/vtypes

Conversation

@cody-littley
Copy link
Copy Markdown
Contributor

Describe your changes and provide context

For each DB in FlatKV (other than metadata), we need to add 9 extra bytes of metadata. This PR introduces structs for each DB that facilitate this metadata addtion.

Testing performed to validate your change

Unit tests, ran full tests in branch where this code is integrated.

@cody-littley cody-littley self-assigned this Apr 1, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed❌ failed (0)Apr 3, 2026, 1:10 PM

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.63%. Comparing base (3d64c1b) to head (c42bbb6).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3164      +/-   ##
==========================================
+ Coverage   58.55%   58.63%   +0.07%     
==========================================
  Files        2099     2105       +6     
  Lines      173847   174179     +332     
==========================================
+ Hits       101803   102135     +332     
  Misses      62873    62873              
  Partials     9171     9171              
Flag Coverage Δ
sei-chain-pr 100.00% <100.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/state_db/sc/flatkv/vtype/account_data.go 100.00% <100.00%> (ø)
sei-db/state_db/sc/flatkv/vtype/base_types.go 100.00% <100.00%> (ø)
sei-db/state_db/sc/flatkv/vtype/code_data.go 100.00% <100.00%> (ø)
sei-db/state_db/sc/flatkv/vtype/legacy_data.go 100.00% <100.00%> (ø)
.../state_db/sc/flatkv/vtype/pending_account_write.go 100.00% <100.00%> (ø)
sei-db/state_db/sc/flatkv/vtype/storage_data.go 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +38 to +40
accountVersionStart = 0
accountBlockHeightStart = 1
accountBalanceStart = 9
Copy link
Copy Markdown
Contributor

@yzang2019 yzang2019 Apr 3, 2026

Choose a reason for hiding this comment

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

IMO, this VersionStartPos, MetadataStartPos, MetadataLength can be a global const shared by all DB instead of redefine in each DB

Comment on lines +41 to +44
accountNonceStart = 41
accountCodeHashStart = 49
accountCompactLength = accountCodeHashStart // 49
accountDataLength = 81
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Length can be hardcoded, but Position should be derived from some math calculation

Comment on lines +20 to +21
|---------|--------------|--------------|
| 1 byte | 8 bytes | variable |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think for legacyDB, we probably don't want this extra 8 bytes to start with, because we could in the future store all cosmos module state to this legacyDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants