Skip to content

perf - optimize State witness internal forwarding #13818

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

Merged
merged 5 commits into from
Jul 7, 2025

Conversation

Trisfald
Copy link
Contributor

This is a small optimization for how validators forward SW parts to themselves.

Before, the part owner was doing:

  • SW part validation
  • forward to itself + other nodes
  • SW part validation
  • add to good parts

After this change it does:

  • SW part validation
  • add to good parts
  • forward to other nodes

@Trisfald Trisfald requested a review from jancionear June 27, 2025 15:11
@Trisfald Trisfald requested a review from a team as a code owner June 27, 2025 15:11
@Trisfald Trisfald marked this pull request as draft June 27, 2025 15:34
Comment on lines 439 to 442
// Store the part locally (as part owner) to avoid need for self-forwarding.
if let Err(err) = partial_witness_tracker.store_partial_encoded_state_witness(partial_witness.clone()) {
tracing::error!(target: "client", "Failed to store partial encoded state witness: {}", err);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be better to move store_partial_encoded_state_witness after sending the forward message.
Storing is potentially costly (could do reed solomon decoding), so it's better to first forward the message and then do the (potentially) expensive computation, the latency will be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I think it makes sense to prioritize other validators before self

@jancionear jancionear requested a review from shreyan-gupta June 30, 2025 11:09
Copy link

codecov bot commented Jun 30, 2025

Codecov Report

Attention: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Project coverage is 69.52%. Comparing base (2760d76) to head (2dcbc70).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...alidation/partial_witness/partial_witness_actor.rs 88.88% 1 Missing and 1 partial ⚠️
...nt/src/stateless_validation/chunk_validator/mod.rs 90.90% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #13818   +/-   ##
=======================================
  Coverage   69.52%   69.52%           
=======================================
  Files         960      960           
  Lines      185684   185702   +18     
  Branches   185684   185702   +18     
=======================================
+ Hits       129090   129118   +28     
+ Misses      51482    51473    -9     
+ Partials     5112     5111    -1     
Flag Coverage Δ
pytests 1.37% <0.00%> (-0.01%) ⬇️
pytests-nightly 1.45% <0.00%> (-0.01%) ⬇️
unittests 69.14% <89.65%> (+<0.01%) ⬆️
unittests-nightly 69.04% <89.65%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@Trisfald Trisfald marked this pull request as ready for review June 30, 2025 13:46
darioush added a commit that referenced this pull request Jul 2, 2025
@Trisfald Trisfald added this pull request to the merge queue Jul 7, 2025
Merged via the queue into near:master with commit 4e2766b Jul 7, 2025
28 of 29 checks passed
@Trisfald Trisfald deleted the optimize-part-validation-path branch July 7, 2025 15:40
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