test(flat): make the arena allocated-bytes assertion page-size portable - #12794
Conversation
ArenaWriter.Complete pads a shared arena's frontier up to an OS page, so the ArenaAllocatedBytes delta is one page rather than the logical write. The test hard-coded a 4096-byte payload and expected a 4096-byte delta, which only holds on 4 KiB-page systems; on 16 KiB-page hosts (Apple Silicon) the gauge advanced by 16384 and the assertion failed. CI on 4 KiB Linux was unaffected. Size the payload to Environment.SystemPageSize so the delta equals exactly one page on any platform, still proving the gauge tracks the frontier and not the 64 KiB mapped size.
|
Claude finished @AnkushinDaniil's task in 2m 49s —— View job Review: page-size-portable arena assertionVerified the change against the production code path. The fix is correct. No Critical, High, or Medium findings — two Low nits, both about keeping the test meaningful rather than about it passing. Why the fix is correct
long newFrontier = _dedicated ? dataEnd : Math.Min(PageLayout.RoundUpToOsPage(dataEnd), _file.MappedSize);The arena is fresh, so Scope is right too: the neighbouring No security, performance, or consensus surface — test-only, one line. FindingsLow — the assertion degenerates on 64 KiB-page hosts (inline) Low — comment doesn't record the coupling Checklist
Not done: I could not execute Verdict: mergeable — both findings are Low and optional. |
|
@claude review |
|
Claude finished @AnkushinDaniil's task in 2m 19s —— View job Review: page-size-portable arena assertionRe-reviewed after Current diff vs
|
Changes
ArenaMetricsTests.ArenaWriter_Complete_AdvancesAllocatedBytes_ByFrontierDelta_NotMappedSizesized its payload to a hard-coded 4096 bytes and expected theArenaAllocatedBytesgauge to advance by exactly 4096.ArenaWriter.Completepads a shared arena's frontier up to an OS page, so the gauge advances by one page, not the logical write. On 4 KiB-page hosts (Linux CI) the two coincide; on 16 KiB-page hosts (Apple Silicon) the gauge advanced by 16384 and the assertion failed locally.Environment.SystemPageSizeso the delta equals exactly one page on any platform, still proving the gauge tracks the written frontier and not the 64 KiB mapped size.Types of changes
Testing
Requires testing
Notes on testing
Nethermind.State.Flat.Testwas red locally on arm64 macOS on this one case and is green after the change (961 passed / 10 skipped / 0 failed). Unaffected on 4 KiB Linux CI.