Skip to content

Conversation

@zhangchiqing
Copy link
Member

@zhangchiqing zhangchiqing commented Dec 13, 2025

Close #8244

This PR implemented a basic validator to check the consistency between payloads stored in checkpoint file and in storehouse.

Tested the validation with Testnet EN3, it took 42 mins to complete the validation, and no mismatch was found 🎉

@github-actions
Copy link
Contributor

github-actions bot commented Dec 13, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2025

@zhangchiqing zhangchiqing force-pushed the leo/storehouse-checkpoint-validator branch from fdab802 to 8212b18 Compare December 15, 2025 20:54
@zhangchiqing zhangchiqing marked this pull request as ready for review December 16, 2025 00:17
@zhangchiqing zhangchiqing requested a review from a team as a code owner December 16, 2025 00:17
Copy link
Member

@fxamacker fxamacker left a comment

Choose a reason for hiding this comment

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

I left some comments about a possible deadlock and also about removing some limitations from the current approach.

Copy link
Member

@fxamacker fxamacker left a comment

Choose a reason for hiding this comment

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

Thanks for updating and resolving the deadlock! 👍

I only left a few more minor comments for consideration.

}

// IsErrMismatch returns true if the given error is an ErrMismatch or wraps an ErrMismatch.
func IsErrMismatch(err error) bool {
Copy link
Member

Choose a reason for hiding this comment

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

IsErrMismatch doesn't appear to be used.

Comment on lines 23 to 29
type ErrMismatch struct {
RegisterID flow.RegisterID
Height uint64
StoredLength int
ExpectedLength int
Message string
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe also include StoredData and ExpectedData in the ErrMismatch struct.

Comment on lines 136 to 142
log.Error().
Str("owner", mismatchErr.RegisterID.Owner).
Str("key", mismatchErr.RegisterID.Key).
Uint64("height", mismatchErr.Height).
Int("stored_length", mismatchErr.StoredLength).
Int("expected_length", mismatchErr.ExpectedLength).
Msg("register value mismatch")
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can simplify this when ErrMismatch.Error() returns a complete message with owner, key, height, and other information.

Suggested change
log.Error().
Str("owner", mismatchErr.RegisterID.Owner).
Str("key", mismatchErr.RegisterID.Key).
Uint64("height", mismatchErr.Height).
Int("stored_length", mismatchErr.StoredLength).
Int("expected_length", mismatchErr.ExpectedLength).
Msg("register value mismatch")
log.Error().Err(err).Msg("register value mismatch")

Comment on lines 31 to 37
func (e *ErrMismatch) Error() string {
if e.Message != "" {
return e.Message
}
return fmt.Sprintf("register value mismatch: owner=%s, key=%s, height=%d, stored_length=%d, expected_length=%d",
e.RegisterID.Owner, e.RegisterID.Key, e.Height, e.StoredLength, e.ExpectedLength)
}

This comment was marked as resolved.

Comment on lines 173 to 179
return &ErrMismatch{
RegisterID: registerID,
Height: height,
StoredLength: 0,
ExpectedLength: len(payload.Value()),
Message: fmt.Sprintf("register not found in store: owner=%s, key=%s, height=%d", registerID.Owner, registerID.Key, height),
}

This comment was marked as resolved.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storehouse: Background indexing

4 participants