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

feat: update double echo to use pending CF #418

Merged
merged 13 commits into from
Jan 12, 2024

Conversation

Freyskeyd
Copy link
Member

@Freyskeyd Freyskeyd commented Dec 20, 2023

Description

This PR is the final one regarding the stabilization of the soft-fork playbook for devnet.

It contains various fixes and changes that allow the network to be upgraded without the need of purging it, allowing the continuity of the delivery while upgrading. This PR biggest change is that the broadcast is actively asking for certificates, instead of receiving them from a channel. It allows us to stack incoming certificates in the Storage and process them at node pace. When shutting down, the broadcast will restart from the next certificate still in pending in the Storage.

Changes per crates

topos

  • Update on the node up command, the parsing of the boot_peers from genesis is needed in order to define the is-bootnode config value as soon as possible.
  • The is-bootnode is a config value but is not available in the config file. Mostly to prevent anyone of defining is-bootnode = true directly, relying solely on the genesis file.

topos-p2p

  • Uses a is-bootnode from configuration in place of the old value
  • Add new logs in order to detect corner cases such as kademelia error when bootstrapping

topos-tce-broadcast

  • Refactor how the task_manager is handling shutdown
  • The task_manager will actively request for new pending certificates on interval (currently 1sec), improvements need to be made on this, it'll be part of another PR.
  • Add logs to better understand the flow of a certificate or message inside the task manager

topos-tce-storage

  • Add a new variant on the InternalStorageError to catch when a certificate is CertificateAlreadyPending
    • The PendingResult also expose a AlreadyPending
  • Add a new method on Map trait to iter_at a specific index, implemented in DBColumn
  • ValidatorStore exposes a new get_next_pending_certificates allowing to get the next N certificates in pending
  • Logs have been added to better understand the flow of the certificate inside the storage
  • Inserting a pending certificate that is already present will return the newly define CertificateAlreadyPending
  • The ValidatorStore implementation of insert_certificate_delivered will now correctly remove the child certificate from precedence_pool after adding it to pending_pool
  • ValidatorPendingTables is properly fetching the current pending_id from the storage when starting, if not, falling back as expected on 1

topos-tce

  • Dump values of the storage when shutting down to better understand the final state of the node before it stops
  • Improve various logs in different places (app_context/api and app_context/network mostly)

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 requested a review from a team as a code owner December 20, 2023 09:34
@Freyskeyd Freyskeyd requested review from hadjiszs and JDawg287 and removed request for a team December 20, 2023 09:34
Copy link

codecov bot commented Dec 20, 2023

Codecov Report

Attention: 62 lines in your changes are missing coverage. Please review.

Comparison is base (5b0257b) 69.24% compared to head (29ce9bf) 68.75%.

Files Patch % Lines
crates/topos-tce-storage/src/validator/mod.rs 67.34% 16 Missing ⚠️
crates/topos-tce-broadcast/src/task_manager/mod.rs 79.16% 15 Missing ⚠️
crates/topos-tce-storage/src/validator/tables.rs 53.84% 12 Missing ⚠️
crates/topos-tce/src/app_context/api.rs 0.00% 10 Missing ⚠️
crates/topos-tce/src/app_context/network.rs 0.00% 5 Missing ⚠️
crates/topos-p2p/src/runtime/mod.rs 50.00% 2 Missing ⚠️
crates/topos-tce-broadcast/src/constant.rs 0.00% 1 Missing ⚠️
...ates/topos/src/components/node/services/process.rs 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #418      +/-   ##
==========================================
- Coverage   69.24%   68.75%   -0.50%     
==========================================
  Files         220      220              
  Lines       11969    12109     +140     
==========================================
+ Hits         8288     8325      +37     
- Misses       3681     3784     +103     

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

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.

This seems like a pretty big change. Do you mind adding more info in the description so reviewers can understand the motivation and consequences a bit better?

@Freyskeyd Freyskeyd marked this pull request as draft December 20, 2023 12:49
@Freyskeyd Freyskeyd force-pushed the chore/update-signal-handled-by-tce branch from 289864b to 04c1af6 Compare December 20, 2023 12:51
@Freyskeyd Freyskeyd changed the title feat: update double echo to use lending CF feat: update double echo to use pending CF Dec 20, 2023
@Freyskeyd Freyskeyd added this to the Soft-fork investigation milestone Dec 20, 2023
@Freyskeyd Freyskeyd force-pushed the chore/update-signal-handled-by-tce branch from d72275f to 5e9def2 Compare December 20, 2023 17:06
Base automatically changed from chore/update-signal-handled-by-tce to main December 20, 2023 17:44
@Freyskeyd Freyskeyd changed the base branch from main to feature/updating-p2p-config-file December 20, 2023 17:55
@Freyskeyd Freyskeyd force-pushed the feature/updating-p2p-config-file branch 7 times, most recently from e19650d to cc9165a Compare December 22, 2023 09:25
@Freyskeyd Freyskeyd force-pushed the feature/refactor-double-echo-priorities branch from fa51568 to 12bc779 Compare December 22, 2023 09:28
@Freyskeyd Freyskeyd changed the base branch from feature/updating-p2p-config-file to chore/updating-double-echo-devnet December 22, 2023 09:29
@Freyskeyd Freyskeyd force-pushed the feature/refactor-double-echo-priorities branch 3 times, most recently from c7b386c to 5336df3 Compare December 22, 2023 14:05
@Freyskeyd Freyskeyd force-pushed the feature/refactor-double-echo-priorities branch from 768a2ca to 11918dd Compare January 2, 2024 14:10
@Freyskeyd Freyskeyd force-pushed the chore/updating-double-echo-devnet branch 4 times, most recently from a0b98cb to 881c2bf Compare January 9, 2024 12:43
Base automatically changed from chore/updating-double-echo-devnet to main January 9, 2024 15:05
@Freyskeyd Freyskeyd force-pushed the feature/refactor-double-echo-priorities branch 2 times, most recently from 2db73f9 to 01b85d0 Compare January 10, 2024 23:25
the task manager (double_echo) will fetch new certificate to broadcast every seconds if needed

Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
@Freyskeyd Freyskeyd force-pushed the feature/refactor-double-echo-priorities branch from 01b85d0 to aa11f72 Compare January 11, 2024 09:29
@Freyskeyd Freyskeyd marked this pull request as ready for review January 11, 2024 09:46
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
@Freyskeyd Freyskeyd force-pushed the feature/refactor-double-echo-priorities branch from aa11f72 to ce340e0 Compare January 11, 2024 10:09
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.

Lots of good micro-improvments here, good stuff.

I fixed a few typos and log messages, but the rest of my comments are questions or topics best addressed in separate PRs. Feel free to respond to question at your convenience (not a blocker to merge).

Copy link
Contributor

@gruberb gruberb left a comment

Choose a reason for hiding this comment

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

Just one nitpick about having a const for the amount of pending_certificates we want to fetch with each tick.

Generally, I would like some explanation how the intented flow is. When we re-deploy the network, how is the pending_certificate help us? Do we do partial shutdowns and then the nodes pick up, and then get shutdown?

Signed-off-by: Simon Paitrault <simon.paitrault@gmail.com>
Copy link
Contributor

@gruberb gruberb left a comment

Choose a reason for hiding this comment

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

👍

@Freyskeyd Freyskeyd merged commit 8fb4003 into main Jan 12, 2024
@Freyskeyd Freyskeyd deleted the feature/refactor-double-echo-priorities branch January 12, 2024 19:05
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