-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Enable static check sa4006 #13350
Enable static check sa4006 #13350
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,9 @@ var ( | |
func (c *Cache) InsertDeposit(ctx context.Context, d *ethpb.Deposit, blockNum uint64, index int64, depositRoot [32]byte) error { | ||
ctx, span := trace.StartSpan(ctx, "Cache.InsertDeposit") | ||
defer span.End() | ||
if ctx.Err() != nil { | ||
return ctx.Err() | ||
} | ||
if d == nil { | ||
log.WithFields(logrus.Fields{ | ||
"block": blockNum, | ||
|
@@ -60,7 +63,7 @@ func (c *Cache) InsertDeposit(ctx context.Context, d *ethpb.Deposit, blockNum ui | |
|
||
// InsertDepositContainers inserts a set of deposit containers into our deposit cache. | ||
func (c *Cache) InsertDepositContainers(ctx context.Context, ctrs []*ethpb.DepositContainer) { | ||
ctx, span := trace.StartSpan(ctx, "Cache.InsertDepositContainers") | ||
_, span := trace.StartSpan(ctx, "Cache.InsertDepositContainers") | ||
defer span.End() | ||
c.depositsLock.Lock() | ||
defer c.depositsLock.Unlock() | ||
|
@@ -89,6 +92,10 @@ func (c *Cache) InsertFinalizedDeposits(ctx context.Context, eth1DepositIndex in | |
c.depositsLock.Lock() | ||
defer c.depositsLock.Unlock() | ||
|
||
if ctx.Err() != nil { | ||
return ctx.Err() | ||
} | ||
Comment on lines
+95
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And here you ignore the context coming from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In practice this is fine because the cancellation won't come from tracing, it will come from the parent context, but in principle we should always use the deepest context possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh lol i expanded the code pane after seeing your slack message - I too missed the interleaved func def 🤦 |
||
|
||
depositTrie := c.finalizedDeposits.depositTree | ||
insertIndex := int(c.finalizedDeposits.MerkleTrieIndex() + 1) | ||
|
||
|
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 did you insert the error check here, but replaced
ctx
with_
elsewhere?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.
Good question... I started subjectively adding some context liveness checks but only did it in a few places. I can revert if it doesnt make sense