feat(rpc): validate external message accept before broadcast#1065
feat(rpc): validate external message accept before broadcast#1065pashinov wants to merge 4 commits into
Conversation
🧪 Network TestsTo run network tests for this PR, use: gh workflow run network-tests.yml -f pr_number=1065Available test options:
Test types: Results will be posted as workflow runs in the Actions tab. |
4ad7468 to
14ce06d
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1065 +/- ##
==========================================
- Coverage 58.94% 58.84% -0.11%
==========================================
Files 459 459
Lines 76880 77025 +145
Branches 76880 77025 +145
==========================================
+ Hits 45316 45322 +6
- Misses 29448 29587 +139
Partials 2116 2116 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if state.config().validate_external_messages { | ||
| let msg_cell = match parse_external_message(&p.message).await { | ||
| Ok(cell) => cell, | ||
| Err(e) => { | ||
| return ProtoErrorResponse { | ||
| code: INVALID_BOC_CODE, | ||
| message: e.to_string().into(), | ||
| } | ||
| .into_response(); | ||
| } | ||
| }; | ||
|
|
||
| if let Err(e) = state.check_external_message(msg_cell).await { | ||
| return error_to_response(e); |
There was a problem hiding this comment.
Parse and validate must come as a single rayon spawn, otherwise spawn overhead can be >= check itself
There was a problem hiding this comment.
I’d keep it split for now. Small messages are parsed inline. Two Rayon tasks happen only for large BOCs where parsing/validation cost should dominate the spawn overhead. Also, there is get_account_state between parsing and validation. I’d rather not move shared state (read/locking) into the Rayon task just to save one spawn
14ce06d to
b8ed74c
Compare
No description provided.