Skip to content

feat(apollo_mempool): add transaction queue to snapshot #5129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

lev-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

lev-starkware commented Mar 20, 2025

@lev-starkware lev-starkware requested a review from alonh5 March 20, 2025 14:32
@lev-starkware lev-starkware marked this pull request as ready for review March 20, 2025 14:32
@lev-starkware lev-starkware force-pushed the lev/monitor_mempool_snap branch from c72b0b4 to 57d4e32 Compare March 20, 2025 16:40
Copy link

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [34.368 ms 34.414 ms 34.463 ms]
change: [-1.8081% -1.6358% -1.4635%] (p = 0.00 < 0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild

@lev-starkware lev-starkware changed the base branch from lev/monitor_mempool_snap to graphite-base/5129 March 23, 2025 18:21
@lev-starkware lev-starkware changed the base branch from graphite-base/5129 to lev/monitor_mempool_snap March 23, 2025 19:16
@lev-starkware lev-starkware force-pushed the lev/monitor_mempool_snap branch from e4c2aca to cea46eb Compare March 27, 2025 12:57
@lev-starkware lev-starkware force-pushed the lev/monitor_mempool_snap branch from cea46eb to 8e60985 Compare March 30, 2025 06:58
Copy link

Benchmark movements:
tree_computation_flow performance improved 😺
tree_computation_flow time: [34.666 ms 34.701 ms 34.745 ms]
change: [-4.1234% -2.5069% -1.0777%] (p = 0.00 < 0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 6 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @lev-starkware)


crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 131 at r2 (raw file):

}

fn create_mempool_snapshot() -> MempoolSnapshot {

Suggestion:

expected_mempool_snapshot()

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 146 at r2 (raw file):

fn return_mempool_snapshot() -> MempoolClientResult<MempoolSnapshot> {
    Ok(create_mempool_snapshot())
}

Is this function still needed?

Code quote:

fn return_mempool_snapshot() -> MempoolClientResult<MempoolSnapshot> {
    Ok(create_mempool_snapshot())
}

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 154 at r2 (raw file):

fn create_json_from_mempool_snapshot(snapshot: &MempoolSnapshot) -> Value {
    to_value(snapshot).expect("Failed to serialize MempoolSnapshot")
}

Do you think these one line functions are needed?

Code quote:

fn create_json_from_string(json_str: &str) -> Value {
    from_str(json_str).expect("Failed to parse JSON string")
}

fn create_json_from_mempool_snapshot(snapshot: &MempoolSnapshot) -> Value {
    to_value(snapshot).expect("Failed to serialize MempoolSnapshot")
}

crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 163 at r2 (raw file):

    assert_eq!(response.status(), StatusCode::OK);
    let body_bytes = hyper::body::to_bytes(response.into_body()).await.unwrap();
    let body_string = String::from_utf8(body_bytes.to_vec()).unwrap();

Use serde_json::from_slice instead of going through String.

Code quote:

let body_string = String::from_utf8(body_bytes.to_vec()).unwrap();

crates/starknet_mempool/src/mempool.rs line 597 at r2 (raw file):

        Ok(MempoolSnapshot {
            transactions: self.tx_pool.get_chronological_txs_hashes(),
            transaction_queue: self.tx_queue.get_queue_snapshot(),

Convention in rust is not to use the get prefix in getters.

Suggestion:

            transactions: self.tx_pool.chronological_txs_hashes(),
            transaction_queue: self.tx_queue.queue_snapshot(),

Copy link
Contributor Author

@lev-starkware lev-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @alonh5)


crates/starknet_mempool/src/mempool.rs line 597 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Convention in rust is not to use the get prefix in getters.

Done.


crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 146 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Is this function still needed?

Done.


crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 154 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Do you think these one line functions are needed?

Done.


crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 163 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Use serde_json::from_slice instead of going through String.

Done.


crates/starknet_monitoring_endpoint/src/monitoring_endpoint_test.rs line 131 at r2 (raw file):

}

fn create_mempool_snapshot() -> MempoolSnapshot {

Done.

@lev-starkware lev-starkware force-pushed the lev/monitor_mempool_snap branch from c699f9b to b8abc79 Compare March 31, 2025 09:02
@lev-starkware lev-starkware changed the title feat(starknet_mempool): add transaction queue to snapshot feat(apollo_mempool): add transaction queue to snapshot Mar 31, 2025
@lev-starkware lev-starkware force-pushed the lev/monitor_mempool_snap branch from b8abc79 to 165e454 Compare March 31, 2025 10:24
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 14 of 14 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @lev-starkware)


crates/apollo_mempool/src/communication.rs line 104 at r3 (raw file):

    }

    fn get_mempool_snapshot(&self) -> MempoolResult<MempoolSnapshot> {

Suggestion:

mempool_snapshot

Copy link
Contributor Author

@lev-starkware lev-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alonh5)


crates/apollo_mempool/src/communication.rs line 104 at r3 (raw file):

    }

    fn get_mempool_snapshot(&self) -> MempoolResult<MempoolSnapshot> {

Done.

@lev-starkware lev-starkware force-pushed the lev/monitor_mempool_snap branch from 165e454 to 4abeceb Compare March 31, 2025 15:09
Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 4 of 4 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lev-starkware)

@noamsp-starkware noamsp-starkware changed the base branch from lev/monitor_mempool_snap to main April 1, 2025 08:09
Copy link

graphite-app bot commented Apr 1, 2025

Merge activity

  • Apr 1, 4:11 AM EDT: Graphite rebased this pull request after merging its parent, because this pull request is set to merge when ready.

Copy link
Contributor Author

@lev-starkware lev-starkware left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lev-starkware)

@lev-starkware lev-starkware added this pull request to the merge queue Apr 1, 2025
Merged via the queue into main with commit 0f4a265 Apr 1, 2025
23 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2025
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.

3 participants