-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
refactor(store): add missing error checks in store #17817
Conversation
@@ -223,7 +223,9 @@ | |||
// Implements types.KVStore. | |||
func (st *Store) Delete(key []byte) { | |||
defer telemetry.MeasureSince(time.Now(), "store", "iavl", "delete") | |||
st.tree.Remove(key) | |||
if _, _, err := st.tree.Remove(key); err != nil { | |||
panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
@@ -144,6 +144,8 @@ | |||
// onWrite writes a KVStore operation to all of the WriteListeners | |||
func (s *Store) onWrite(delete bool, key, value []byte) { | |||
for _, l := range s.listeners { | |||
l.OnWrite(s.parentStoreKey, key, value, delete) | |||
if err := l.OnWrite(s.parentStoreKey, key, value, delete); err != nil { | |||
panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
@@ -1068,7 +1068,9 @@ func (rs *Store) GetCommitInfo(ver int64) (*types.CommitInfo, error) { | |||
func (rs *Store) flushMetadata(db dbm.DB, version int64, cInfo *types.CommitInfo) { | |||
rs.logger.Debug("flushing metadata", "height", version) | |||
batch := db.NewBatch() | |||
defer batch.Close() | |||
defer func() { | |||
_ = batch.Close() |
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.
why have this instead of only batch.Close()?
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.
because otherwise the error isn't checked. (here too, but now it's explicitly not checked)
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.
approving because of the audit but this is annoying
Description
A-7
Relates to #17794, but targets v0.47.
Store is its own go.mod on main.
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
make lint
andmake test
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