Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

refactor: improve delivery timing #466

Merged
merged 4 commits into from
Mar 12, 2024
Merged

Conversation

Freyskeyd
Copy link
Member

@Freyskeyd Freyskeyd commented Feb 27, 2024

Description

This PR refactors a bit the workflow that trigger new certs for delivery.
It also adds new queries on GraphQL in order to extract context from nodes.

Previous refactorization introduced pull mechanism on the broadcast where the task manager where actively pulling the next certificate from the pending_pool, the setup was to allow the broadcast to start consuming the pending_pool when ready. However, a corner case exists that this PR is solving:

  • pending_pool checking tick is 10sec (1sec in reality) and tick at S0
  • certificate A arrives on the node, is valid and can be delivered at S2
  • ...
  • pending_pool checking tick execute at S10
  • certificate A is being broadcast

Between S2 and S10 the certificate is waiting in the pending_pool for nothing.

The changes are modifying this and do:

  • pending_pool checking tick is 10sec (1sec in reality) and tick at S0
  • certificate A arrives on the node, is valid and can be delivered at S2
  • A broadcast command is sent to the task manager at S2, the task manager check the precedence of the certificate and see that the parent is delivered
  • certificate A is being broadcast
  • ...
  • pending_pool checking tick execute at S10

Next / Questions / Options

  • The pending_pool tick could be set to a lower value or even switched to a proper channel between the pending_pool and the task_manager

PR Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added or updated tests that comprehensively prove my change is effective or that my feature works

@Freyskeyd Freyskeyd force-pushed the chore/improve-delivery-time branch 2 times, most recently from 408ea1b to 707fe93 Compare February 29, 2024 15:50
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 78.21782% with 44 lines in your changes are missing coverage. Please review.

Project coverage is 71.95%. Comparing base (d2ec941) to head (faf394d).

Files Patch % Lines
crates/topos-tce-storage/src/validator/mod.rs 58.82% 14 Missing ⚠️
crates/topos-tce/src/app_context/api.rs 47.82% 12 Missing ⚠️
crates/topos-tce-api/src/graphql/query.rs 91.13% 7 Missing ⚠️
crates/topos-tce/src/app_context/network.rs 63.15% 7 Missing ⚠️
crates/topos-tce-broadcast/src/task_manager/mod.rs 57.14% 3 Missing ⚠️
crates/topos-tce-storage/src/client.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #466      +/-   ##
==========================================
+ Coverage   71.60%   71.95%   +0.35%     
==========================================
  Files         225      225              
  Lines       12504    12659     +155     
==========================================
+ Hits         8953     9109     +156     
+ Misses       3551     3550       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Freyskeyd Freyskeyd force-pushed the chore/improve-delivery-time branch 2 times, most recently from 4217661 to 22cf5ba Compare March 6, 2024 20:56
@Freyskeyd Freyskeyd marked this pull request as ready for review March 7, 2024 09:01
@Freyskeyd Freyskeyd requested a review from a team as a code owner March 7, 2024 09:01
@Freyskeyd Freyskeyd force-pushed the chore/improve-delivery-time branch 2 times, most recently from 7bff5e9 to cc5d681 Compare March 8, 2024 06:30
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

I need a better PR description to give me the context for these changes. I'm too slow to review this otherwise.

crates/topos-tce-storage/src/validator/mod.rs Outdated Show resolved Hide resolved
crates/topos-tce/src/app_context/api.rs Outdated Show resolved Hide resolved
crates/topos-tce/src/app_context/api.rs Show resolved Hide resolved
crates/topos-tce/src/app_context/network.rs Outdated Show resolved Hide resolved
crates/topos-tce-broadcast/src/lib.rs Show resolved Hide resolved
@Freyskeyd Freyskeyd force-pushed the chore/improve-delivery-time branch 3 times, most recently from ae3e1b5 to e5c3dc1 Compare March 12, 2024 14:40
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but I have a bunch of questions.

crates/topos-tce-storage/src/validator/mod.rs Outdated Show resolved Hide resolved
crates/topos-tce-storage/src/validator/mod.rs Outdated Show resolved Hide resolved
crates/topos-tce-storage/src/validator/mod.rs Show resolved Hide resolved
crates/topos-core/src/api/graphql/certificate.rs Outdated Show resolved Hide resolved
crates/topos-tce-api/src/graphql/builder.rs Outdated Show resolved Hide resolved
crates/topos-tce-api/src/graphql/builder.rs Outdated Show resolved Hide resolved
crates/topos-tce-storage/src/validator/mod.rs Outdated Show resolved Hide resolved
crates/topos-tce-api/src/graphql/query.rs Outdated Show resolved Hide resolved
crates/topos-tce-api/src/graphql/query.rs Show resolved Hide resolved
Signed-off-by: Simon Paitrault <[email protected]>
@Freyskeyd Freyskeyd merged commit 96e862f into main Mar 12, 2024
21 checks passed
@Freyskeyd Freyskeyd deleted the chore/improve-delivery-time branch March 12, 2024 18:20
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