Skip to content

Ayelet/mempool/naive mempool/rebase over 14 1 get ts#12368

Closed
ayeletstarkware wants to merge 1 commit intoayelet/mempool/naive-mempool/rebase-over-14-1from
ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts
Closed

Ayelet/mempool/naive mempool/rebase over 14 1 get ts#12368
ayeletstarkware wants to merge 1 commit intoayelet/mempool/naive-mempool/rebase-over-14-1from
ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts

Conversation

@ayeletstarkware
Copy link
Contributor

@ayeletstarkware ayeletstarkware commented Feb 8, 2026

Note

Medium Risk
Changes the mempool’s transaction selection semantics in Echonet mode and introduces a new externally callable timestamp update endpoint, which could affect block assembly and ordering if timestamp mappings are incorrect or missing.

Overview
Adds Echonet timestamp propagation across the stack: new POST /gateway/update_timestamps endpoint forwards a HashMap<TransactionHash, u64> through apollo_http_serverapollo_gatewayapollo_mempool via new UpdateTimestamps requests.

Extends mempool’s Echonet FIFO behavior with a get_ts/timestamp-threshold mechanism: FIFO queue tracks per-tx timestamps, get_ts() returns the first queued tx’s timestamp and sets a threshold, and get_txs() only pops contiguous transactions matching that timestamp (otherwise returns none), with tests updated/added accordingly. Also updates Grafana dashboard panels to include get_timestamp latency metrics for batcher and mempool.

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

@reviewable-StarkWare
Copy link

This change is Reviewable

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts branch from 8c2f44b to 66cbada Compare February 8, 2026 13:44
// Queue is empty, return 0
info!("Mempool get_ts (FIFO): queue empty, returning 0");
0
}
Copy link

Choose a reason for hiding this comment

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

Empty queue returns timestamp zero instead of clock fallback

Medium Severity

When the FIFO queue is empty, get_ts() returns 0, which propagates as Ok(0) through the batcher client. In get_proposal_timestamp, Ok(ts) matches and returns 0 (Unix epoch) as the block timestamp, bypassing the clock.unix_now() fallback. The old code using state_sync_client correctly fell through to clock time when no data was available.

Additional Locations (1)

Fix in Cursor Fix in Web

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts branch from 66cbada to 1dffdf0 Compare February 9, 2026 11:13
//
// // Don't call get_ts() - get_txs() should return empty
// get_txs_and_assert_expected(&mut mempool, 1, &[]);
// }
Copy link

Choose a reason for hiding this comment

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

Commented-out test code accidentally committed

Low Severity

A commented-out test test_get_txs_returns_empty_if_get_ts_not_called references create_mempool_with_mock_server, a function that doesn't exist in the codebase. This appears to be work-in-progress scaffolding that was left behind and clutters the test file.

Fix in Cursor Fix in Web

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts branch from 1dffdf0 to 4449e93 Compare February 9, 2026 12:13
@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts branch 2 times, most recently from 40d0c5e to 50cb3ca Compare February 9, 2026 13:46
Copy link

@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 2 potential issues.

| MempoolRequest::GetMempoolSnapshot() => RequestPriority::Normal,
| MempoolRequest::GetMempoolSnapshot()
| MempoolRequest::GetTimestamp
| MempoolRequest::UpdateTimestamps(_) => RequestPriority::Normal,
Copy link

Choose a reason for hiding this comment

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

GetTimestamp request priority too low for block creation

Medium Severity

MempoolRequest::GetTimestamp is assigned Normal priority, but it's on the block creation critical path — get_ts must be called before get_txs in Echonet mode to set the timestamp threshold that pop_ready_chunk uses to filter transactions. Since GetTransactions and CommitBlock are High priority, under load the GetTimestamp request could be starved by high-priority requests, delaying block creation. It likely belongs alongside GetTransactions at High priority.

Additional Locations (1)

Fix in Cursor Fix in Web

@ayeletstarkware ayeletstarkware force-pushed the ayelet/mempool/naive-mempool/rebase-over-14-1-get_ts branch from 50cb3ca to 8dcc1c4 Compare February 9, 2026 14:01
@github-actions github-actions bot locked and limited conversation to collaborators Feb 28, 2026
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