Conversation
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (65.57%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2338 +/- ##
==========================================
+ Coverage 60.76% 60.81% +0.04%
==========================================
Files 314 314
Lines 30986 31041 +55
==========================================
+ Hits 18830 18878 +48
- Misses 10854 10857 +3
- Partials 1302 1306 +4
🚀 New features to boost your workflow:
|
| // It checks both Tendermint block retention (min-retain-blocks) and app state retention (ss-keep-recent). | ||
| func ValidateBlockAccess(blockNumber int64, params BlockValidationParams) error { | ||
| // Check Tendermint block retention (min-retain-blocks) | ||
| if params.MaxBlockLookback >= 0 && blockNumber < params.LatestHeight-params.MaxBlockLookback { |
There was a problem hiding this comment.
is the config enough to validatae that the block exists/doesn't? what if someone increases their min-retain-blocks, but the history isn't there?
There was a problem hiding this comment.
Yup, these checks are for the state level @philipsu522 and directly calls api.backend.app.CommitMultiStore().GetEarliestVersion() which has the earliest historical version.
And for the new test file, you can suggest it as an added block (you’d need to paste into That way maintainers can literally click “Apply suggestion” in GitHub’s review UI to merge your fix. |
|
One idea, what if we actually return the correct error type from the SS KV/Storage layer to indicate the height is not available instead of adding this check in the api layer? API layer can just return the correct message automatically right? |
|
Yep, you're absolutely right, and your instinct is on point..
Instead of placing a height-not-available check in the API layer, return a
typed error from the SS KV/Storage layer when a request is made for a
height that hasn't been committed yet. This would allow the API layer to
simply handle and forward the error cleanly without needing to embed
chain-specific logic.
Why this is the better architecture:
Layer Responsibility Why this belongs there
Storage / KV Layer Canonical source of truth It knows whether a block
height is persisted or not. It's the correct place to determine and emit
this error.
API Layer User-facing conversion/forwarding Should translate errors into
user-facing messages but not guess chain status or revalidate lower-layer
assumptions.
Suggested implementation plan:
In Storage Layer (kv.go or storage.go)
var ErrHeightUnavailable = errors.New("height not available")
func (s *Store) GetStateAtHeight(height int64) (*State, error) {
if height > s.LatestCommittedHeight {
return nil, ErrHeightUnavailable
}
// proceed to fetch...
}
In API Layer (query_handler.go)
state, err := store.GetStateAtHeight(req.Height)
if errors.Is(err, storage.ErrHeightUnavailable) {
return nil, status.Errorf(codes.NotFound, "Requested height %d is not
yet committed", req.Height)
} else if err != nil {
return nil, status.Errorf(codes.Internal, "Unexpected storage error:
%v", err)
}
Benefits:
Decouples concerns, avoids leaking consensus-level detail into the API.
Easier testing, errors are predictable and mockable.
Future extensibility... if you later want to add retry-on-height-missing or
alternative handling logic, it stays isolated.
…On Thu, Aug 28, 2025, 12:41 PM Yiming Zang ***@***.***> wrote:
*yzang2019* left a comment (sei-protocol/sei-chain#2338)
<#2338 (comment)>
One idea, what if we actually return the correct error type from the SS
KV/Storage layer to indicate the height is not available instead of adding
this check in the api layer? API layer can just return the correct message
automatically right?
—
Reply to this email directly, view it on GitHub
<#2338 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BVBXSPW5GCUC2KXN2W4ZTZL3P45ODAVCNFSM6AAAAACE4NPRR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEMZUGM4TCMZXGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
Closing in favor of root cause fix at sei-db layer: sei-protocol/sei-db#105 |
Describe your changes and provide context
method handler crashedTesting performed to validate your change