Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(rpc): validate external message accept before broadcast#1065

Open
pashinov wants to merge 4 commits into
masterfrom
check-ext-message
Open

feat(rpc): validate external message accept before broadcast#1065
pashinov wants to merge 4 commits into
masterfrom
check-ext-message

Conversation

@pashinov
Copy link
Copy Markdown
Member

@pashinov pashinov commented Apr 9, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 9, 2026

🧪 Network Tests

To run network tests for this PR, use:

gh workflow run network-tests.yml -f pr_number=1065

Available test options:

  • Run all tests: gh workflow run network-tests.yml -f pr_number=1065
  • Run specific test: gh workflow run network-tests.yml -f pr_number=1065 -f test_selection=ping-pong

Test types: destroyable, ping-pong, one-to-many-internal-messages, fq-deploy, nft-index, persistent-sync

Results will be posted as workflow runs in the Actions tab.

@pashinov pashinov requested review from 0xdeafbeef and Rexagon April 13, 2026 12:09
@pashinov pashinov force-pushed the check-ext-message branch from 4ad7468 to 14ce06d Compare April 15, 2026 08:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 2.73224% with 178 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.84%. Comparing base (af4b813) to head (5ea4ad2).

Files with missing lines Patch % Lines
rpc/src/state/mod.rs 0.99% 100 Missing ⚠️
core/src/node/mod.rs 0.00% 33 Missing ⚠️
rpc/src/endpoint/jrpc/mod.rs 0.00% 17 Missing ⚠️
rpc/src/endpoint/proto/mod.rs 0.00% 15 Missing ⚠️
core/src/blockchain_rpc/service.rs 23.07% 9 Missing and 1 partial ⚠️
rpc/src/node.rs 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +110 to +123
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);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Parse and validate must come as a single rayon spawn, otherwise spawn overhead can be >= check itself

Copy link
Copy Markdown
Member Author

@pashinov pashinov May 13, 2026

Choose a reason for hiding this comment

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

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

@pashinov pashinov requested a review from 0xdeafbeef May 13, 2026 18:17
@pashinov pashinov force-pushed the check-ext-message branch from 14ce06d to b8ed74c Compare May 14, 2026 23: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.

3 participants