apollo_storage: always spawn storage reader server, return 503 when disabled#12836
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
35e3331 to
3cdf781
Compare
f7283ec to
96ae2cc
Compare
96ae2cc to
0cdbfc7
Compare
Merge activity
|
0cdbfc7 to
d58eb47
Compare
864a715 to
c40ebc9
Compare
9b1dbae to
ee8fcae
Compare
d03261e to
219b0b8
Compare
d92b304 to
b518f9b
Compare
219b0b8 to
375935d
Compare
a434618 to
7f6202f
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
913ec55 to
311ad1a
Compare
311ad1a to
8b377ad
Compare
79b46be to
10e5ece
Compare
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware made 2 comments.
Reviewable status: 0 of 20 files reviewed, 1 unresolved discussion (waiting on nadin-Starkware).
crates/apollo_storage/src/storage_reader_server.rs line 161 at r12 (raw file):
storage_reader: self.storage_reader.clone(), enabled: self.enabled, _phantom: PhantomData,
Is this still required? Even if not, can be in a different pr
Code quote:
_phantom: PhantomData,crates/apollo_storage/src/storage_reader_server.rs line 202 at r12 (raw file):
{ let socket = SocketAddr::from((self.config.ip(), self.config.port())); let enabled_status = if self.config.is_enabled() { "enabled" } else { "disabled" };
IMO:
- either define a proper enum instead of using a boolean value
- print "is_enabled: {bool value}
2 is simpler
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware made 2 comments.
Reviewable status: 0 of 20 files reviewed, 3 unresolved discussions (waiting on nadin-Starkware).
crates/apollo_storage/src/storage_reader_server_test.rs line 114 at r12 (raw file):
let mut available_ports = AvailablePorts::new(TestIdentifier::StorageReaderServerUnitTests.into(), 2);
Should be using the unique_id! macro
Code quote:
2crates/apollo_storage/src/storage_reader_server_test.rs line 169 at r12 (raw file):
let mut available_ports = AvailablePorts::new(TestIdentifier::StorageReaderServerUnitTests.into(), 4);
Should be using the unique_id! macro
(throughout)
Code quote:
4
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware made 1 comment.
Reviewable status: 0 of 20 files reviewed, 4 unresolved discussions (waiting on nadin-Starkware).
deployments/sequencer/configs/overlays/hybrid/testing/node-0/services/core.yaml line 104 at r12 (raw file):
- name: state-sync-storage-reader port: 55014 targetPort: 55014
why?
Code quote:
port: 55014
targetPort: 55014
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware made 1 comment.
Reviewable status: 0 of 20 files reviewed, 4 unresolved discussions (waiting on nadin-Starkware).
crates/apollo_class_manager/src/class_storage.rs line 289 at r12 (raw file):
let storage_reader_server_handle = Arc::new(tokio::spawn(async {}).abort_handle()); Ok(Self { reader, writer: Arc::new(Mutex::new(writer)), storage_reader_server_handle }) }
Let's keep as is for this pr, but we should change this, this essentially having another config value (run the server or the mock process) manifested as a different function.
If no other alternatives I'd even prefer we actually have this as a config value.
Could you come up with some other way? A dependency injection of some sort?
Code quote:
pub fn new(
storage_config: StorageConfig,
storage_reader_server_config: ServerConfig,
) -> ClassHashStorageResult<Self> {
let (reader, writer, storage_reader_server) =
apollo_storage::open_storage_with_metric_and_server::<
GenericStorageReaderServerHandler,
StorageReaderRequest,
StorageReaderResponse,
>(
storage_config,
&CLASS_MANAGER_STORAGE_OPEN_READ_TRANSACTIONS,
storage_reader_server_config,
)?;
let storage_reader_server_handle = Arc::new(storage_reader_server.spawn());
Ok(Self { reader, writer: Arc::new(Mutex::new(writer)), storage_reader_server_handle })
}
/// Opens the storage without a storage reader server or metrics.
#[cfg(any(feature = "testing", test))]
pub(crate) fn new_plain(storage_config: StorageConfig) -> ClassHashStorageResult<Self> {
let (reader, writer) = open_storage(storage_config)?;
let storage_reader_server_handle = Arc::new(tokio::spawn(async {}).abort_handle());
Ok(Self { reader, writer: Arc::new(Mutex::new(writer)), storage_reader_server_handle })
}10e5ece to
44668ae
Compare
nadin-Starkware
left a comment
There was a problem hiding this comment.
@nadin-Starkware made 4 comments.
Reviewable status: 0 of 20 files reviewed, 4 unresolved discussions (waiting on Itay-Tsabary-Starkware).
crates/apollo_storage/src/storage_reader_server.rs line 202 at r12 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
IMO:
- either define a proper enum instead of using a boolean value
- print "is_enabled: {bool value}
2 is simpler
Done.
crates/apollo_storage/src/storage_reader_server_test.rs line 114 at r12 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Should be using the
unique_id!macro
Done in separate PR
crates/apollo_storage/src/storage_reader_server_test.rs line 169 at r12 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
Should be using the
unique_id!macro
(throughout)
Done in separate PR
deployments/sequencer/configs/overlays/hybrid/testing/node-0/services/core.yaml line 104 at r12 (raw file):
Previously, Itay-Tsabary-Starkware wrote…
why?
55012 is also used by the proof_manager component. There were no conflicts before because the server was disabled, but once we changed it to always spawn, a conflict occurred. So I changed the port to make it unique
Itay-Tsabary-Starkware
left a comment
There was a problem hiding this comment.
@Itay-Tsabary-Starkware reviewed 13 files and all commit messages, made 1 comment, and resolved 4 discussions.
Reviewable status: 13 of 20 files reviewed, all discussions resolved.
44668ae to
ca3cd9e
Compare
ca3cd9e to
ecdc945
Compare
nadin-Starkware
left a comment
There was a problem hiding this comment.
@nadin-Starkware reviewed 7 files.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on nadin-Starkware).

Note
Medium Risk
Touches shared storage/server wiring used across multiple components and changes disabled-mode behavior from “no listener” to “listener that 503s”, which may affect operational expectations and port allocation.
Overview
Storage now always creates and spawns the storage reader server (no more
Option), and a disabled server returns503 Service Unavailableto all requests instead of not starting.This updates batcher, state-sync, and class-manager to hold a mandatory keep-alive
AbortHandle, switches call sites tostorage_reader_server.spawn(), and adjusts tests/integration configs to allocate distinct storage-reader ports (including a new class-manager test identifier and updated hybrid overlay port).Written by Cursor Bugbot for commit ecdc945. This will update automatically on new commits. Configure here.