-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: Make extension snapshotter interface safer to use #11825
Conversation
Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests.
return nil | ||
} | ||
|
||
func (s *extSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshottypes.ExtensionPayloadReader) error { |
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.
An typical extension implementation.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@JeancarloBarrios any chance you can review this, seems like this was assigned with no follow wup |
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.
@alexanderbez could you pop in for a review
Codecov Report
@@ Coverage Diff @@
## main #11825 +/- ##
==========================================
+ Coverage 55.50% 55.57% +0.07%
==========================================
Files 646 646
Lines 54870 54891 +21
==========================================
+ Hits 30453 30508 +55
+ Misses 21962 21919 -43
- Partials 2455 2464 +9
|
m.items = [][]byte{} | ||
for { | ||
item := &snapshottypes.SnapshotItem{} | ||
err := protoReader.ReadMsg(item) | ||
item.Reset() |
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.
is there a test case to test this in handled correctly? I recently ran into an issue where we used .Reset like this and the api is different than what we expected
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.
func (m *SnapshotItem) Reset() { *m = SnapshotItem{} }
looks straightforward enough to me, what issue did you have? Do you have a concern that after ReadMsg
, some fields still keep the values from the last one?
@yihuang could you quickly take a look at the linting failures pls?
|
It's strange this PR doesn't touch this file. I update the main branch again and it disppears. |
* Make extension snapshotter interface safer to use Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests. * update changelog * Update snapshots/types/util.go * changelog * go linter * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* Make extension snapshotter interface safer to use Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests. * update changelog * Update snapshots/types/util.go * changelog * go linter * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit e397434)
* Make extension snapshotter interface safer to use Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests. * update changelog * Update snapshots/types/util.go * changelog * go linter * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit e397434)
* Make extension snapshotter interface safer to use Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests. * update changelog * Update snapshots/types/util.go * changelog * go linter * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit e397434)
* Make extension snapshotter interface safer to use Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests. * update changelog * Update snapshots/types/util.go * changelog * go linter * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit e397434)
* Make extension snapshotter interface safer to use Closes: cosmos#11824 Solution: - Use new methods `SnapshotExtension`/`RestoreExtension` to handle payload stream specifically. - Improve unit tests. * update changelog * Update snapshots/types/util.go * changelog * go linter * Update CHANGELOG.md Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> (cherry picked from commit e397434)
Closes: #11824
Solution:
SnapshotExtension
/RestoreExtension
to handle payload stream specifically.Description
more details in the closed issue.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change