fix(service): Prevent potential corruption in state diffs #2578

Merged
Jade merged 1 commit from jade/short-race into main 2026-11-22 01:20:19 +00:00
Owner

This fixes a non-atomicity issue. Also fixes incorrect
calculation of a buffer size that would result in
reallocation.

This fixes a non-atomicity issue. Also fixes incorrect calculation of a buffer size that would result in reallocation.
fix(service): Prevent potential corruption in state diffs
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 3s
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 8s
Checks / Prek / Check changed files (pull_request) Successful in 6s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 59s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 9m18s
b01d27b592
This fixes a non-atomicity issue. Also fixes incorrect
calculation of a buffer size that would result in
reallocation.
nex requested changes 2026-11-21 23:27:31 +00:00
Lines 237-240
@ -237,2 +235,6 @@
}
let shortstatehash = self.services.globals.next_count().unwrap();
/// Allocates a fresh short state hash ID without publishing it yet.
pub fn next_shortstatehash(&self) -> Result<ShortStateHash> {
self.services.globals.next_count()
}
Owner

Why not just use services.globals.next_count directly? this seems like a redundant alias function

Why not just use `services.globals.next_count` directly? this seems like a redundant alias function
Author
Owner

image

![image](/attachments/e3957bae-b7f3-4063-9b6a-63d36c4d6b66)
Owner

chief you're the one introducing the new function that just calls another function where that function call could just be inlined for both callsites 🗿

chief you're the one introducing the new function that just calls another function where that function call could just be inlined for both callsites 🗿
Author
Owner

This is actually so I don't have to add globals as a service dependency to the state compressor, but I can do that if you want

This is actually so I don't have to add globals as a service dependency to the state compressor, but I can do that if you want
Owner

Is there a reason not to?

Is there a reason not to?
Author
Owner

Not really, although the service code is beginning to irritate me

Not really, although the service code is beginning to irritate me
Owner

mmm would be interested in hearing more, but probably not in forgejo review comments. If you don't wanna add a dependency then leave a comment in the function that explains what you just told me so I don't accidentally inline the calls later

mmm would be interested in hearing more, but probably not in forgejo review comments. If you don't wanna add a dependency then leave a comment in the function that explains what you just told me so I don't accidentally inline the calls later
Author
Owner

Nah I'll inline it and maybe start dealing with the service code later

Nah I'll inline it and maybe start dealing with the service code later
Owner

still wanna hear what your gripes are with the service code tho

still wanna hear what your gripes are with the service code tho
nex marked this conversation as resolved
Jade force-pushed jade/short-race from b01d27b592
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Auto Labeler / Apply labels based on changed files (pull_request_target) Successful in 3s
Checks / Changelog / Check changelog is added (pull_request_target) Failing after 8s
Checks / Prek / Check changed files (pull_request) Successful in 6s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 59s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 9m18s
to 0aaa42188e
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Check changed files (pull_request) Successful in 6s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 57s
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 31s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 9m3s
2026-11-21 23:52:08 +00:00
Compare
Jade 2026-11-21 23:53:40 +00:00
ginger approved these changes 2026-11-22 00:44:45 +00:00
Jade force-pushed jade/short-race from 0aaa42188e
All checks were successful
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Prek / Check changed files (pull_request) Successful in 6s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 57s
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 31s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 9m3s
to 3379badbd4
Some checks failed
Documentation / Build and Deploy Documentation (pull_request) Has been skipped
Checks / Changelog / Check changelog is added (pull_request_target) Successful in 7s
Checks / Prek / Check changed files (pull_request) Successful in 7s
Checks / Prek / Pre-commit & Formatting (pull_request) Successful in 1m0s
Checks / Prek / Clippy and Cargo Tests (pull_request) Successful in 11m25s
Documentation / Build and Deploy Documentation (push) Has been skipped
Checks / Prek / Check changed files (push) Successful in 8s
Checks / Prek / Pre-commit & Formatting (push) Successful in 2m3s
Checks / Prek / Clippy and Cargo Tests (push) Successful in 8m32s
Release Docker Image / Build linux-amd64 (release) (push) Successful in 18m47s
Release Docker Image / Build linux-arm64 (release) (push) Successful in 18m56s
Release Docker Image / Create Multi-arch Release Manifest (push) Successful in 23s
Release Docker Image / Build linux-amd64 (max-perf) (push) Failing after 1m35s
Release Docker Image / Build linux-arm64 (max-perf) (push) Has been cancelled
Release Docker Image / Create Max-Perf Manifest (push) Has been cancelled
Release Docker Image / Release Binaries (push) Has been cancelled
Release Docker Image / Mirror Images (push) Has been cancelled
2026-11-22 01:03:09 +00:00
Compare
Jade scheduled this pull request to auto merge when all checks succeed 2026-11-22 01:03:30 +00:00
Jade merged commit 3379badbd4 into main 2026-11-22 01:20:19 +00:00
Jade deleted branch jade/short-race 2026-11-22 01:20:20 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
continuwuation/continuwuity!2578
No description provided.