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

docs: ADR for High Throughput Recovery #4315

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

evan-forbes
Copy link
Member

Overview

still a draft for now as we'll add more details as the implementation comes along

@evan-forbes evan-forbes added ADR item is directly relevant to writing or modifying an ADR WS: Big Blonks 🔭 Improving consensus critical gossiping protocols labels Feb 10, 2025
@evan-forbes evan-forbes self-assigned this Feb 10, 2025
@evan-forbes evan-forbes requested a review from a team as a code owner February 10, 2025 13:59
@evan-forbes evan-forbes requested review from cmwaters and ninabarbakadze and removed request for a team February 10, 2025 13:59
@evan-forbes evan-forbes marked this pull request as draft February 10, 2025 14:01
Copy link
Contributor

coderabbitai bot commented Feb 10, 2025

📝 Walkthrough

Walkthrough

This pull request introduces a new ADR document, "ADR 024: High Throughput Recovery," that outlines a separation of block propagation into a "Preparation" and a "Recovery" phase for the Celestia protocol. Additional supporting documents detail the integration of backward-compatible block propagation into the gossip protocols, including a new syncing routine, handshake logic to differentiate between legacy and upgraded nodes, a “Logic and State” section explaining PBBT reactor behavior, and the definition of new PBBT messages with their validation logic.

Changes

File(s) Change Summary
docs/architecture/adr-024-high-throughput-recovery.md Added a new ADR document outlining high throughput recovery with details on block propagation phases, decision status, design references, alternative approaches, and impact consequences.
docs/architecture/assets/adr024/{connecting_to_consensus.md, handlers_and_state.md, messages.md} Extended ADR024 with backward-compatible block propagation details: introduced handshake logic with a syncing routine for new nodes versus legacy propagation, a new "Logic and State" section for PBBT reactor logic, and new PBBT message types, constants, types, and methods.

Sequence Diagram(s)

sequenceDiagram
    participant Peer
    participant Node
    participant ConsensusReactor
    Peer->>Node: Initiate handshake (node info)
    Node->>ConsensusReactor: Check block propagation capabilities
    alt Supports new reactor
        ConsensusReactor->>Node: Trigger syncData routine
    else Legacy support
        ConsensusReactor->>Node: Activate legacyPropagation routine
    end
    Node->>Peer: Communicate block propagation method
Loading
sequenceDiagram
    participant Proposer
    participant Validator
    Proposer->>Validator: Send Commitment (CompactBlock details)
    Validator->>Proposer: Verify signature and merkle proof (via HaveParts)
    Validator->>Proposer: Request missing parts (using WantParts)
    Proposer->>Validator: Provide RecoveryPart (Data message)
    Validator->>Proposer: Confirm data integrity
Loading

Suggested labels

documentation

Suggested reviewers

  • rach-id
  • ninabarbakadze
  • rootulp

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (13)
docs/architecture/adr-024-high-throughput-recovery.md (1)

13-16: Refine Descriptive Wording and Hyphenation

The context paragraph uses phrases such as “pull based” which should be hyphenated (e.g. “pull‐based”) to clearly indicate the compound adjective. Also, consider simplifying the wording to reduce repetitiveness.

🧰 Tools
🪛 LanguageTool

[style] ~13-~13: Consider a shorter alternative to avoid wordiness.
Context: ... data after the block has been created. In order to utilize the data distributed before the...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~13-~13: The adjective “pull-based” is spelled with a hyphen.
Context: ...reated, the recovery phase must also be pull based. Therefore, the constraints for recover...

(BASED_HYPHEN)


[uncategorized] ~16-~16: This expression is usually spelled with a hyphen.
Context: ...e ProposalTimeout is reached - MUST use pull based gossip ## Decision TBD ## Detailed D...

(BASED_HYPHEN)

docs/architecture/assets/adr024/connecting_to_consensus.md (7)

1-4: Enhance Header Hyphenation

The header “Backwards Compatible Block Propagation” would benefit from hyphenating the compound adjective. For example, use “Backwards‐Compatible Block Propagation.”

🧰 Tools
🪛 LanguageTool

[uncategorized] ~1-~1: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: # Backwards Compatible Block Propagation This document is an ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


7-11: Correct Spelling and Terminology in Intro

There are a couple of typographical issues in this section:

  • “seemless” should be corrected to “seamless.”
  • “hotswapple” appears to be a misspelling; consider replacing it with “hotswappable” or “hot‐swappable.”

15-17: Fix Typographic and Possessive Errors

In the sentence discussing entry points, “the consenus reactors internal message channel” should be revised to “the consensus reactor’s internal message channel” to fix both the spelling of “consensus” and to correctly apply the possessive form.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~16-~16: It seems likely that a singular genitive (’s) apostrophe is missing.
Context: ...s that exist now. That is, the consenus reactors internal message channel to the consens...

(AI_HYDRA_LEO_APOSTROPHE_S_XS)


22-75: Review of syncData Function Implementation

The Go function syncData is well structured and clearly handles synchronization. One suggestion is to verify that the channel cs.peerMsgQueue is appropriately buffered to avoid blocking in high-throughput scenarios.


78-86: Clarify Legacy Propagation Explanation

The explanatory text before the legacyPropagation code can be made more direct. For instance, instead of “Something along the lines of the below code should suffice,” consider “The following code illustrates the legacy propagation approach.” This change improves clarity and professionalism.

🧰 Tools
🪛 LanguageTool

[style] ~84-~84: ‘along the lines of’ might be wordy. Consider a shorter alternative.
Context: ...tines are simply not spun up. Something along the lines of the below code should suffice. ```go f...

(EN_WORDINESS_PREMIUM_ALONG_THE_LINES_OF)


87-104: Improve Variable Naming in legacyPropagation

Within the legacyPropagation function, the variable legacyblockProp could be more readable as legacyBlockProp (using camelCase) to enhance consistency in naming.


106-116: Refine Text in the Parity Data Section

A few improvements are suggested in this section:

  • Change “pull based gossip” to “pull‐based gossip.”
  • Correct the misspelling “Simulataneously” to “Simultaneously.”
  • Consider substituting phrases like “At the moment” with “Currently” to streamline the text.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~108-~108: This expression is usually spelled with a hyphen.
Context: ...ly advantageous for broadcast trees and pull based gossip. However, the added parity data ...

(BASED_HYPHEN)


[style] ~110-~110: For conciseness, consider replacing this expression with an adverb.
Context: ...res being committed to by the proposer. At the moment, the proposer commits over the block da...

(AT_THE_MOMENT)


[style] ~111-~111: Consider a shorter alternative to avoid wordiness.
Context: ...the block data via the PartSetHeader. In order to be backwards compatible, we can't break...

(IN_ORDER_TO_PREMIUM)


[style] ~113-~113: Consider a shorter alternative to avoid wordiness.
Context: ...a requiring commitments computed twice. In order to solve this dilemma, we can simply reuse...

(IN_ORDER_TO_PREMIUM)

docs/architecture/assets/adr024/messages.md (5)

28-32: Correct Misspelling in Note

In the note following the CompactBlock definition, “siganture” is misspelled. Please change it to “signature.”


33-40: Fix Typographical Error

The word “messasges” (referring to the Have messages) is misspelled. Please correct it to “messages.”


89-100: Refine Explanatory Wording in Parity Data Section

The explanation regarding parity data can be tightened for clarity. Consider:

  • Revising “chunked in an even size” to “divided into even‐sized chunks.”
  • Streamlining the sentence structure to reduce wordiness, for instance by replacing transitional phrases such as “however” when used improperly.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~94-~94: The preposition “into” seems more likely in this position than the preposition “in”.
Context: ...ing means that the data must be chunked in an even size. All transactions in that ...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION_IN_INTO)


[style] ~95-~95: Consider a shorter alternative to avoid wordiness.
Context: ...in that chunk must have been downloaded in order to use it alongside parity data to reconst...

(IN_ORDER_TO_PREMIUM)


[typographical] ~96-~96: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...ock. Most scenarios would likely be fine, however it would be possible for a node to have...

(HOWEVER_SENTENCE)


[style] ~98-~98: Consider removing “of” to be more concise
Context: ..., but have no complete parts, rendering all of the parity data useless. The way to fix thi...

(ALL_OF_THE)


122-131: Add Boundary Checks in SubParts Method

In the SubParts method of the Part type, the slice operation assumes that p.Bytes is sufficiently long. It would be prudent to add a boundary check before slicing to avoid potential panics if the byte slice isn’t the expected length.

Suggested Diff:

-  for i := uint32(0); i < SubPartsPerPart; i++ {
-    sps[i] = SubPart{
-      Index: uint32(i),
-      Bytes: p.Bytes[i*SubPartSize : (i+1)*SubPartSize],
-    }
-  }
+  for i := uint32(0); i < SubPartsPerPart; i++ {
+    if len(p.Bytes) < int((i+1)*SubPartSize) {
+      panic(fmt.Sprintf("unexpected byte length: got %d, need at least %d", len(p.Bytes), int((i+1)*SubPartSize)))
+    }
+    sps[i] = SubPart{
+      Index: i,
+      Bytes: p.Bytes[i*SubPartSize : (i+1)*SubPartSize],
+    }
+  }

133-145: Clarify Omitted Proof in PartFromSubParts

In the PartFromSubParts function, note that the returned Part does not set the Proof field. It might be helpful to add a comment explaining why this field is omitted or how it is handled in downstream logic.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4316ea0 and 3b46eed.

📒 Files selected for processing (4)
  • docs/architecture/adr-024-high-throughput-recovery.md (1 hunks)
  • docs/architecture/assets/adr024/connecting_to_consensus.md (1 hunks)
  • docs/architecture/assets/adr024/handlers_and_state.md (1 hunks)
  • docs/architecture/assets/adr024/messages.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/architecture/assets/adr024/handlers_and_state.md
🧰 Additional context used
🪛 LanguageTool
docs/architecture/adr-024-high-throughput-recovery.md

[style] ~13-~13: Consider a shorter alternative to avoid wordiness.
Context: ... data after the block has been created. In order to utilize the data distributed before the...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~13-~13: The adjective “pull-based” is spelled with a hyphen.
Context: ...reated, the recovery phase must also be pull based. Therefore, the constraints for recover...

(BASED_HYPHEN)


[uncategorized] ~16-~16: This expression is usually spelled with a hyphen.
Context: ...e ProposalTimeout is reached - MUST use pull based gossip ## Decision TBD ## Detailed D...

(BASED_HYPHEN)

docs/architecture/assets/adr024/connecting_to_consensus.md

[uncategorized] ~1-~1: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: # Backwards Compatible Block Propagation This document is an ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[uncategorized] ~16-~16: It seems likely that a singular genitive (’s) apostrophe is missing.
Context: ...s that exist now. That is, the consenus reactors internal message channel to the consens...

(AI_HYDRA_LEO_APOSTROPHE_S_XS)


[style] ~84-~84: ‘along the lines of’ might be wordy. Consider a shorter alternative.
Context: ...tines are simply not spun up. Something along the lines of the below code should suffice. ```go f...

(EN_WORDINESS_PREMIUM_ALONG_THE_LINES_OF)


[uncategorized] ~108-~108: This expression is usually spelled with a hyphen.
Context: ...ly advantageous for broadcast trees and pull based gossip. However, the added parity data ...

(BASED_HYPHEN)


[style] ~110-~110: For conciseness, consider replacing this expression with an adverb.
Context: ...res being committed to by the proposer. At the moment, the proposer commits over the block da...

(AT_THE_MOMENT)


[style] ~111-~111: Consider a shorter alternative to avoid wordiness.
Context: ...the block data via the PartSetHeader. In order to be backwards compatible, we can't break...

(IN_ORDER_TO_PREMIUM)


[style] ~113-~113: Consider a shorter alternative to avoid wordiness.
Context: ...a requiring commitments computed twice. In order to solve this dilemma, we can simply reuse...

(IN_ORDER_TO_PREMIUM)

docs/architecture/assets/adr024/messages.md

[uncategorized] ~94-~94: The preposition “into” seems more likely in this position than the preposition “in”.
Context: ...ing means that the data must be chunked in an even size. All transactions in that ...

(AI_EN_LECTOR_REPLACEMENT_PREPOSITION_IN_INTO)


[style] ~95-~95: Consider a shorter alternative to avoid wordiness.
Context: ...in that chunk must have been downloaded in order to use it alongside parity data to reconst...

(IN_ORDER_TO_PREMIUM)


[typographical] ~96-~96: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...ock. Most scenarios would likely be fine, however it would be possible for a node to have...

(HOWEVER_SENTENCE)


[style] ~98-~98: Consider removing “of” to be more concise
Context: ..., but have no complete parts, rendering all of the parity data useless. The way to fix thi...

(ALL_OF_THE)

⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: docker-txsim-build / docker-build (GHCR; ghcr.io/celestiaorg/txsim)
  • GitHub Check: docker-security-build / docker-build (GHCR; ghcr.io/celestiaorg/celestia-app)
  • GitHub Check: test / test-race
  • GitHub Check: test / test-short
  • GitHub Check: test / test-fuzz
  • GitHub Check: test / test-coverage
  • GitHub Check: test / test
  • GitHub Check: markdown-linter / markdown-link-check
  • GitHub Check: Summary
🔇 Additional comments (3)
docs/architecture/adr-024-high-throughput-recovery.md (2)

1-6: Initial Document Structure Approved

The ADR title, changelog, status, and introduction sections are clearly laid out and provide a solid starting point for further elaboration.


22-27: Good Linking of Detailed Design References

The detailed design section cleanly references related files (Messages, Handlers and State, Connecting to Consensus). Please double-check that these links remain valid as the related documents evolve.

docs/architecture/assets/adr024/messages.md (1)

1-5: Document Structure and Clarity

The introductory part of the messages document is clear and provides a concise overview of the PBBT message types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADR item is directly relevant to writing or modifying an ADR WS: Big Blonks 🔭 Improving consensus critical gossiping protocols
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant