Skip to content

feat(memory): use Vector in PageProtections component#962

Queued
vapourismo wants to merge 1 commit intomainfrom
ole/push-wwkyqwrkonkx
Queued

feat(memory): use Vector in PageProtections component#962
vapourismo wants to merge 1 commit intomainfrom
ole/push-wwkyqwrkonkx

Conversation

@vapourismo
Copy link
Copy Markdown
Collaborator

@vapourismo vapourismo commented Mar 27, 2026

What

Replace the boxed array with Vector in the PageProtections component.

Why

This lets us remove the const-generic parameter, which paves the way for making the memory size runtime configurable.

A nice effect of this change is that the memory overhead in Verify mode is reduced quite a bit.

  • For 4 GiB of memory at 4 KiB page size, we have 1,048,576 pages
  • Atom<bool, Verify> is 33 B
  • One PageProtections<Verify> is therefore 33 MiB - regardless of whether it's present, blinded or absent
  • We have three permission modes, therefore 3x PageProtections -> 99 MiB unconditionally

The Vector component has a 104 B footprint in Verify mode when it is completely absent.

I am not sure if it's a reference machine glitch, but it looks like there is a +2% TPS bump in it as well.

Manually Testing

make all

Regressions

Using the Vector state component in place of the previous boxed fixed-sized array changes the Merkle tree structure and therefore the hashes and proof serialisation.

Tasks for the Author

  • Link all Linear issues related to this MR using magic words (e.g. part of, relates to, closes).
  • Eliminate dead code and other spurious artefacts introduced in your changes.
  • Document new public functions, methods and types.
  • Make sure the documentation for updated functions, methods, and types is correct.
  • Add tests for bugs that have been fixed.
  • Explain changes to regression test captures when applicable.
  • Write commit messages in agreement with our guidelines.
  • Self-review your changes to ensure they are high-quality.
  • Complete all of the above before assigning this MR to reviewers.

@vapourismo vapourismo added the benchmark-trigger Force benchmark run for a PRs label Mar 27, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

Benchmark results for revision 001c765:

Metric Duration TPS
Mean 1.51977489s 26.320
Worst 1.526182235s 26.209
Best 1.51239076s 26.448
Standard Deviation ±4.469717ms ±0.077
Full results
Run Transfers Duration TPS
1 40 1.522589506s 26.271
2 40 1.524376523s 26.240
3 40 1.526182235s 26.209
4 40 1.521771923s 26.285
5 40 1.51239076s 26.448
6 40 1.513750718s 26.424
7 40 1.526021596s 26.212
8 40 1.515477274s 26.394
9 40 1.520050592s 26.315
10 40 1.515755592s 26.389
11 40 1.512877888s 26.440
12 40 1.525150866s 26.227
13 40 1.524128411s 26.245
14 40 1.521559554s 26.289
15 40 1.515578035s 26.393
16 40 1.519430773s 26.326
17 40 1.523642778s 26.253
18 40 1.517234265s 26.364
19 40 1.52201175s 26.281
20 40 1.515516756s 26.394

Compare the results above with those for the default branch.

@github-actions github-actions bot removed the benchmark-trigger Force benchmark run for a PRs label Mar 27, 2026
@vapourismo vapourismo force-pushed the ole/push-nqsnvmxywxkv branch from 0b2fc99 to 7e548e6 Compare March 27, 2026 18:52
@vapourismo vapourismo force-pushed the ole/push-wwkyqwrkonkx branch 3 times, most recently from 6c2ec75 to a5dd12e Compare March 27, 2026 19:48
@vapourismo vapourismo added the benchmark-trigger Force benchmark run for a PRs label Mar 27, 2026
@github-actions github-actions bot removed the benchmark-trigger Force benchmark run for a PRs label Mar 27, 2026
@vapourismo vapourismo force-pushed the ole/push-wwkyqwrkonkx branch from a5dd12e to 2cb7b9a Compare March 27, 2026 21:57
@vapourismo vapourismo added the benchmark-trigger Force benchmark run for a PRs label Mar 27, 2026
@github-actions github-actions bot removed the benchmark-trigger Force benchmark run for a PRs label Mar 27, 2026
@vapourismo vapourismo force-pushed the ole/push-wwkyqwrkonkx branch from 2cb7b9a to a4fa45b Compare March 27, 2026 22:33
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 93.39623% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.90%. Comparing base (6b8df3c) to head (a465155).

Files with missing lines Patch % Lines
pvm/src/pvm/linux.rs 81.81% 2 Missing ⚠️
pvm/src/pvm/tezos.rs 75.00% 2 Missing ⚠️
pvm/src/machine_state/memory/protection.rs 96.00% 1 Missing ⚠️
pvm/src/pvm/common.rs 75.00% 1 Missing ⚠️
pvm/src/pvm/linux/signals.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #962      +/-   ##
==========================================
+ Coverage   89.70%   89.90%   +0.19%     
==========================================
  Files         110      110              
  Lines       22136    22132       -4     
  Branches    22136    22132       -4     
==========================================
+ Hits        19857    19897      +40     
+ Misses       1884     1841      -43     
+ Partials      395      394       -1     

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

Base automatically changed from ole/push-nqsnvmxywxkv to main March 30, 2026 06:59
@vapourismo vapourismo force-pushed the ole/push-wwkyqwrkonkx branch 3 times, most recently from 3d8a0a8 to 49a17e3 Compare March 30, 2026 09:50
@vapourismo vapourismo marked this pull request as ready for review March 30, 2026 09:53
@vapourismo vapourismo enabled auto-merge March 30, 2026 09:53
@vapourismo vapourismo force-pushed the ole/push-wwkyqwrkonkx branch from 49a17e3 to a465155 Compare March 30, 2026 12:19
@vapourismo vapourismo added this pull request to the merge queue Mar 30, 2026
Any commits made after this event will not be merged.
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