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

refactor(rooch-da): restructure backend architecture for OpenDA #3140

Merged
merged 16 commits into from
Jan 1, 2025

Conversation

popcnt1
Copy link
Collaborator

@popcnt1 popcnt1 commented Dec 30, 2024

Summary

Refactored OpenDA backend by introducing an adapter-based architecture, consolidating repeated logic, and reorganizing code structure. Simplified configurations, removed deprecated files, and added backend prioritization for efficient batch submission.

popcnt1 added 11 commits December 29, 2024 22:55
Refactored DAConfig and submission strategies to improve clarity and extensibility. Renamed `DAServerSubmitStrategy` to `DASubmitStrategy`, unified constants, and enhanced documentation. Added `background_submit_interval` at the top `DAConfig` level.
Move `background_submit_interval` assignment to server initialization. This simplifies `ServerBackends` by removing unused fields and centralizing configuration. No functional changes introduced.
Extract backend management logic to a shared `DABackends` struct. This removes duplication and simplifies backend initialization in both `mod.rs` and `server.rs`.
Update `DABackends::build` to accept an optional `DABackendConfig` and streamline DA backend setup. Renamed methods for better clarity, such as `create_background_submitter` to `run_background_submitter`.
Standardize naming by replacing "names" with "identifiers" for backend variables and updating method names to clarify purpose. This improves code readability and consistency across the deployment architecture.
Streamlined DA backend handling by removing the Nop backend and its associated constructs (`is_nop_backend`, `nop_backend` flags). Updated backend initialization and submission logic to handle configurations more effectively without defaulting to a no-op implementation.
Refactor batch submission to utilize `Arc<DABatch>` for improved memory efficiency and concurrent sharing. Adjusted method signatures and implementations to align with the new structure.
Reorganized OpenDA backend to enhance modularity and maintainability. Split `new_operator` into its own function, restructured module imports, and relocated `backend.rs` to `openda_backend.rs`. Improved error handling in segment submission logic.
Revamped the README to include a detailed architecture diagram and explanation for backend development. Clarifies the relationship between components like DAServerActor, OpenDABackendManager, and specific adapters.
Set a default submission strategy using a constant for clarity and consistency. Updated the fallback behavior in `adjust_submit_strategy` and `calculate_submit_threshold` methods to align with this default.
Refactored OpenDA backend by introducing an adapter-based architecture, consolidating repeated logic, and reorganizing code structure. Simplified configurations, removed deprecated files, and added backend prioritization for efficient batch submission.
Copy link

vercel bot commented Dec 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal-v2.1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 31, 2024 5:33pm
test-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 31, 2024 5:33pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Dec 31, 2024 5:33pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 14 changed files in this pull request and generated 1 comment.

Files not reviewed (9)
  • crates/rooch-da/src/backend/openda/backend.rs: Evaluated as low risk
  • crates/rooch-da/src/backend/openda/operator.rs: Evaluated as low risk
  • crates/rooch-da/src/backend/openda/mod.rs: Evaluated as low risk
  • crates/rooch-da/src/backend/openda/celestia.rs: Evaluated as low risk
  • crates/rooch-da/src/backend/openda/manager.rs: Evaluated as low risk
  • crates/rooch-da/src/backend/openda/opendal.rs: Evaluated as low risk
  • crates/rooch-store/src/da_store/mod.rs: Evaluated as low risk
  • crates/rooch-types/src/da/status.rs: Evaluated as low risk
  • crates/rooch-da/src/backend/openda/avail.rs: Evaluated as low risk
Comments suppressed due to low confidence (3)

crates/rooch-da/src/backend/mod.rs:97

  • The variable name max_retires is misspelled. It should be max_retries.
max_retires: None,

crates/rooch-da/src/backend/mod.rs:37

  • The method load_backends_from_configs should handle the case where genesis_namespace is empty or invalid.
genesis_namespace: String,

crates/rooch-config/src/da_config.rs:34

  • Ensure all instances of DAServerSubmitStrategy are updated to DASubmitStrategy.
pub enum DASubmitStrategy {

crates/rooch-da/src/backend/mod.rs Show resolved Hide resolved
popcnt1 and others added 4 commits January 1, 2025 00:18
Trim leading slashes from the namespace when updating storage root in config. Updated tests to validate behavior with and without an existing root path, ensuring consistent namespace handling.
Corrected `max_retires` to `max_retries` across related files and tests. Ensures consistency and prevents potential misconfigurations due to the typo.
Replaces linear priority lookup with a HashMap to optimize backend sorting. Introduces `UNKNOWN_BACKEND_PRIORITY` for unrecognized identifiers to handle edge cases efficiently.
@popcnt1 popcnt1 merged commit 15c0421 into rooch-network:main Jan 1, 2025
10 checks passed
@popcnt1 popcnt1 deleted the refactor/da/adapter branch January 1, 2025 04:12
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.

2 participants