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

Fixing case where signingJobs is empty for non-DERIVE_KEY_AND_SIGN requests. #139

Conversation

JasonCWang
Copy link
Contributor

No description provided.

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@JasonCWang JasonCWang requested a review from zhenlu November 27, 2024 00:41
@JasonCWang JasonCWang marked this pull request as ready for review November 27, 2024 00:41
@@ -58,31 +58,30 @@ func GraphQLResponseForRemoteSigningWebhook(
webhook webhooks.WebhookEvent,
seedBytes []byte,
) (SigningResponse, error) {
// Calculate the xpub for each L1 signing job
// If derive key and sign, calculate the xpub for each L1 signing job
subEventTypeStr := (*webhook.Data)["sub_event_type"].(string)
Copy link

Choose a reason for hiding this comment

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

This type assertion could panic if webhook.Data is nil or if sub_event_type isn't a string. Consider using a safer type assertion with error checking:

subEventTypeStr, ok := (*webhook.Data)["sub_event_type"].(string)
if !ok {
    return nil, fmt.Errorf("sub_event_type not found or invalid type")
}

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I add this? I think this is the comment that caused the previous failure

Copy link
Contributor

Choose a reason for hiding this comment

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

no, this one is different, it checks the existence of sub_event_type

Copy link
Contributor

Choose a reason for hiding this comment

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

you should apply this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotcha, will do.

Copy link
Contributor

Choose a reason for hiding this comment

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

well, technically it's fine because we send the webhook. It's up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Guess doesn't hurt to add if someone is debugging this later

zhenlu
zhenlu previously approved these changes Nov 27, 2024
@JasonCWang JasonCWang force-pushed the 11-26-fixing_case_where_signingjobs_is_empty_for_non-derive_key_and_sign_requests branch from 00cc9c6 to f7a633c Compare November 27, 2024 00:49
@JasonCWang JasonCWang merged commit ba8741b into main Nov 27, 2024
3 checks passed
Copy link
Contributor Author

Merge activity

  • Nov 26, 8:00 PM EST: A user merged this pull request with Graphite.

@JasonCWang JasonCWang deleted the 11-26-fixing_case_where_signingjobs_is_empty_for_non-derive_key_and_sign_requests branch November 27, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants