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

perf: Reduce unnecessary JSON validation #2844

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Oct 17, 2024

Reduces unnecessary JSON validation when handling JSON-RPC requests to and from Snaps. For large payloads, JSON validation may be expensive, so we should attempt to reduce additional validation where inputs are already validated.

@@ -122,12 +115,6 @@ export function assertSnapOutboundRequest(args: RequestArguments) {
},
}),
);
assertStruct(
Copy link
Member Author

Choose a reason for hiding this comment

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

As part of input sanitation we already validate that requests from Snaps are valid JSON, making this unnecessary

@FrederikBolding FrederikBolding marked this pull request as ready for review October 21, 2024 08:31
@FrederikBolding FrederikBolding requested a review from a team as a code owner October 21, 2024 08:31
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.45%. Comparing base (6ac62e6) to head (e9c6618).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2844      +/-   ##
==========================================
- Coverage   94.45%   94.45%   -0.01%     
==========================================
  Files         484      484              
  Lines       10330    10329       -1     
  Branches     1574     1574              
==========================================
- Hits         9757     9756       -1     
  Misses        573      573              

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

@FrederikBolding FrederikBolding merged commit 47f4a94 into main Oct 21, 2024
166 checks passed
@FrederikBolding FrederikBolding deleted the fb/json-validation-perf branch October 21, 2024 11:13
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