Skip to content
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

core: addressed some panic instances #2783

Merged
merged 1 commit into from
Jan 12, 2024
Merged

Conversation

pinebit
Copy link
Contributor

@pinebit pinebit commented Jan 12, 2024

Removed some unnecessary panic() calls and added recover() where appropriate.

category: refactor
ticket: none

Copy link

sonarcloud bot commented Jan 12, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@pinebit pinebit changed the title Addressed some panic instances core: addressed some panic instances Jan 12, 2024
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (586168f) 53.29% compared to head (2a0ccda) 53.26%.
Report is 1 commits behind head on main.

Files Patch % Lines
core/proto.go 50.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2783      +/-   ##
==========================================
- Coverage   53.29%   53.26%   -0.03%     
==========================================
  Files         199      199              
  Lines       27604    27602       -2     
==========================================
- Hits        14711    14703       -8     
- Misses      11073    11078       +5     
- Partials     1820     1821       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// TODO(corver): This can panic due to json unmarshalling unexpected data.
// For now, it is a good way to catch compatibility issues. But we should
// recover panics and return an error before launching mainnet.
func ParSignedDataFromProto(typ DutyType, data *pbv1.ParSignedData) (odata ParSignedData, oerr error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

where is odata returned?

Copy link
Contributor Author

@pinebit pinebit Jan 12, 2024

Choose a reason for hiding this comment

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

nowhere, but I think I cannot omit one while having names on the others..
or maybe I could just use _

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup, _ will do the trick.

Copy link
Contributor

@xenowits xenowits left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -30,7 +30,8 @@ func StartDutyTrace(ctx context.Context, duty Duty, spanName string, opts ...tra
ctx, outerSpan = tracer.Start(tracer.RootedCtx(ctx, traceID), fmt.Sprintf("core/duty.%s", strings.Title(duty.Type.String())))
ctx, innerSpan = tracer.Start(ctx, spanName, opts...)

outerSpan.SetAttributes(attribute.Int64("slot", safeInt64(duty.Slot)))
slotStr := strconv.FormatUint(duty.Slot, 10)
outerSpan.SetAttributes(attribute.String("slot", slotStr))
Copy link
Collaborator

Choose a reason for hiding this comment

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

@xenowits @dB2510 this line changes the "slot" tracing attribute from int64 to string.

I don't think it'll lead to any worrisome behavior, but since you guys have the most experience on the codebase, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it should cause any ripple behaviors

@pinebit pinebit added the merge when ready Indicates bulldozer bot may merge when all checks pass label Jan 12, 2024
@obol-bulldozer obol-bulldozer bot merged commit fb86353 into main Jan 12, 2024
15 of 16 checks passed
@obol-bulldozer obol-bulldozer bot deleted the pinebit/preventing-panics branch January 12, 2024 11:47
@gsora gsora added the v0.19.1 label Jan 15, 2024
@gsora gsora added the qs-audit label Jan 22, 2024
gsora pushed a commit that referenced this pull request Jan 24, 2024
Removed some unnecessary panic() calls and added recover() where appropriate.

category: refactor
ticket: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass qs-audit v0.19.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants