Skip to content
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

HTTP message service handles signed entities #1366

Merged
merged 16 commits into from
Nov 30, 2023
Merged

Conversation

ghubertpalo
Copy link
Collaborator

@ghubertpalo ghubertpalo commented Nov 22, 2023

Content

This PR includes a patch that use the HTTP message service to deliver directly HTTP messages for signed entities to the web server. By doing so, it avoids expensive key decode / encode.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • No clippy warnings in the CI
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)

Comments

None

Issue(s)

Relates to #1327

Copy link

github-actions bot commented Nov 22, 2023

Test Results

    3 files  ±0    30 suites  ±0   7m 33s ⏱️ -10s
745 tests +8  745 ✔️ +8  0 💤 ±0  0 ±0 
853 runs  +8  853 ✔️ +8  0 💤 ±0  0 ±0 

Results for commit adc59bd. ± Comparison against base commit b36415b.

This pull request removes 5 and adds 13 tests. Note that renamed tests count towards both.
mithril-aggregator ‑ message_adapters::to_certificate_list_message::tests::adapt_ok
mithril-aggregator ‑ message_adapters::to_certificate_message::tests::adapt_ok
mithril-aggregator ‑ services::http_message::tests::get_certificate
mithril-aggregator ‑ services::http_message::tests::get_last_certificates
mithril-aggregator ‑ services::http_message::tests::get_no_certificate
mithril-aggregator ‑ services::message::tests::get_certificate
mithril-aggregator ‑ services::message::tests::get_last_certificates
mithril-aggregator ‑ services::message::tests::get_mithril_no_stake_distribution
mithril-aggregator ‑ services::message::tests::get_mithril_stake_distribution
mithril-aggregator ‑ services::message::tests::get_mithril_stake_distribution_list_message
mithril-aggregator ‑ services::message::tests::get_no_certificate
mithril-aggregator ‑ services::message::tests::get_no_snapshot
mithril-aggregator ‑ services::message::tests::get_snapshot
mithril-aggregator ‑ services::message::tests::get_snapshot_list_message
mithril-signer ‑ aggregator_client::tests::test_epoch_settings_timeout
…

♻️ This comment has been updated with latest results.

Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

Do we still need to keep the previous message adapters that are not used anymore?

mithril-aggregator/src/database/provider/signed_entity.rs Outdated Show resolved Hide resolved
mithril-aggregator/src/database/provider/signed_entity.rs Outdated Show resolved Hide resolved
mithril-aggregator/src/services/http_message.rs Outdated Show resolved Hide resolved
mithril-aggregator/src/services/http_message.rs Outdated Show resolved Hide resolved
mithril-aggregator/src/services/http_message.rs Outdated Show resolved Hide resolved
mithril-aggregator/src/services/http_message.rs Outdated Show resolved Hide resolved
async fn get_snapshot() {
let beacon = fake_data::beacon();
let entity = SignedEntity {
signed_entity_id: "msd1".to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

It's a bit confusing to use Mithril stake distribution code in snapshot test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, I don't see the issue here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
signed_entity_id: "msd1".to_string(),
signed_entity_id: "snapshot1".to_string(),

.await?;

entities.into_iter().map(|i| i.try_into()).collect()
}
}

#[cfg(test)]
Copy link
Member

Choose a reason for hiding this comment

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

Given all the boilerplate in these tests, it would have been a good idea to create dummy functions for SignedEntity<T> types IMHO.

Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

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

I have no comments other than those raised by @jpraynaud. Otherwise, LGTM

@ghubertpalo
Copy link
Collaborator Author

Do we still need to keep the previous message adapters that are not used anymore?

They are still used mainly in tests in MessageService but not only.

Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ghubertpalo ghubertpalo merged commit 0e90d2c into main Nov 30, 2023
30 of 31 checks passed
@ghubertpalo ghubertpalo deleted the greg/1327/signed_entity branch November 30, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants