Skip to content

apollo_mempool: add timestamp logic to flow#12701

Closed
ayeletstarkware wants to merge 1 commit intoayelet/mempool/fifo/impl-fifo-queuefrom
ayelet/mempool/fifo/integrate-get-timestamp-logic
Closed

apollo_mempool: add timestamp logic to flow#12701
ayeletstarkware wants to merge 1 commit intoayelet/mempool/fifo/impl-fifo-queuefrom
ayelet/mempool/fifo/integrate-get-timestamp-logic

Conversation

@ayeletstarkware
Copy link
Copy Markdown
Contributor

@ayeletstarkware ayeletstarkware commented Feb 18, 2026

Note

Medium Risk
Changes transaction selection semantics in Echonet mode by gating FIFO pops on timestamp thresholds, which can affect batching/order and stall processing if timestamps are missing or inconsistent; other modes are largely unaffected.

Overview
Adds an update_timestamps flow from the HTTP server (POST /gateway/update_timestamps) through GatewayRequest::UpdateTimestamps into the mempool, allowing external timestamp mappings (tx_hash -> UnixTimestamp) to be applied.

Refactors the Echonet FIFO queue to be hash-based and timestamp-aware: get_timestamp() now derives a batching threshold from the first queued tx’s timestamp (and reuses the last value when empty), and get_txs() only pops transactions matching that threshold; tests/utilities are updated accordingly and Grafana dashboards gain client/server latency panels for the new request variant.

Written by Cursor Bugbot for commit 4ba2f2d. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link
Copy Markdown

This change is Reviewable

Copy link
Copy Markdown
Contributor Author

ayeletstarkware commented Feb 18, 2026

Comment thread crates/apollo_mempool/src/fifo_transaction_queue.rs
Comment thread crates/apollo_mempool/src/fifo_transaction_queue.rs
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/integrate-get-timestamp-logic branch from 646ff64 to 71ffc55 Compare February 18, 2026 12:40
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/impl-fifo-queue branch from c74ef8c to 6d7d544 Compare February 18, 2026 12:40
Comment thread crates/apollo_mempool/src/fifo_transaction_queue.rs
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/impl-fifo-queue branch from 6d7d544 to 416a976 Compare February 19, 2026 10:22
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/integrate-get-timestamp-logic branch from 71ffc55 to 00633f3 Compare February 19, 2026 10:22
Comment thread crates/apollo_mempool/src/mempool.rs
self.post_method_router(add_tx),
)
// Echonet timestamp update endpoint
.route("/gateway/update_timestamps", post(update_timestamps))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing body size limit on update_timestamps endpoint

Medium Severity

The /gateway/update_timestamps route uses post(update_timestamps) directly, unlike all other POST routes which use self.post_method_router(...). The post_method_router applies a DefaultBodyLimit::max(max_request_body_size) layer. The new endpoint bypasses this body size limit, allowing arbitrarily large request bodies that could lead to memory exhaustion.

Fix in Cursor Fix in Web

Comment thread crates/apollo_mempool/src/fifo_transaction_queue.rs
Comment thread crates/apollo_mempool/src/fifo_transaction_queue.rs
Comment thread crates/apollo_mempool/src/fifo_transaction_queue.rs
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/impl-fifo-queue branch from 416a976 to f87f2bb Compare February 22, 2026 09:53
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/integrate-get-timestamp-logic branch 2 times, most recently from 2002362 to b6c7b85 Compare February 22, 2026 10:12
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/impl-fifo-queue branch 2 times, most recently from 3d543fb to ead7396 Compare February 22, 2026 12:02
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/integrate-get-timestamp-logic branch 2 times, most recently from b31eca5 to bbbd00d Compare February 22, 2026 15:01
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/impl-fifo-queue branch 2 times, most recently from 96db6da to ef24d43 Compare February 23, 2026 14:33
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/integrate-get-timestamp-logic branch from bbbd00d to 0705cb6 Compare February 23, 2026 14:33
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/impl-fifo-queue branch from ef24d43 to 9f27529 Compare February 24, 2026 10:28
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/fifo/integrate-get-timestamp-logic branch from 0705cb6 to 4ba2f2d Compare February 24, 2026 10:28
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

})
.await
.expect("Should be able to get update_timestamps result");
result?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Timestamp endpoint can panic on join

Medium Severity

update_timestamps wraps the call in tokio::spawn(...).await.expect(...). If the spawned task panics or the runtime is shutting down, the .expect panics the HTTP server handler, potentially taking down request handling instead of returning an error.

Fix in Cursor Fix in Web

@ayeletstarkware ayeletstarkware marked this pull request as draft February 25, 2026 09:56
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 28, 2026
@ayeletstarkware ayeletstarkware marked this pull request as ready for review March 9, 2026 10:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants