-
Notifications
You must be signed in to change notification settings - Fork 253
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
feat: data commitment for height support for yet to be committed heights #1389
feat: data commitment for height support for yet to be committed heights #1389
Conversation
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 types.DataCommitment{}, err | ||
} | ||
if !found { | ||
return types.DataCommitment{}, fmt.Errorf("couldn't find attestation with nonce %d", latestNonce-i) |
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.
[non-blocking]
do we have an specific error type for this? it feels general enough to warrant one
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.
This we're creating errors on the fly throughout the whole package, I created an issue to handle the all #1390
Co-authored-by: Evan Forbes <42654277+evan-forbes@users.noreply.github.com>
// GetLastDataCommitment returns the last data commitment. | ||
func (k Keeper) GetLastDataCommitment(ctx sdk.Context) (types.DataCommitment, error) { | ||
latestNonce := k.GetLatestAttestationNonce(ctx) | ||
for i := uint64(0); i < latestNonce; i++ { |
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.
[no change needed] sorry for delayed review but this iteration may read easier with
for i := latestNonce; i >= 0; i-- {
because the contents of this for loop care about iterating from the latest nonce down to 0. This proposal removes the need for subtraction in the body of the for loop
Addresses this delayed feedback: #1389 (comment)
Overview
Closes #1388
Checklist