Skip to content

Commit

Permalink
cfg-gate the legacy refactor (#269)
Browse files Browse the repository at this point in the history
* cfg-gate the refactor
  • Loading branch information
QuentinI authored Dec 6, 2024
1 parent a1551a4 commit 7cf96d9
Show file tree
Hide file tree
Showing 23 changed files with 7,898 additions and 20 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build_nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ on:

jobs:
nix:
strategy:
matrix:
flags: ["--cfg legacy_builder_refactored", ""]
env:
RUSTFLAGS: "${{ matrix.flags }}"
RUSTDOCFLAGS: "${{ matrix.flags }}"
runs-on: ubuntu-latest
timeout-minutes: 90
steps:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ concurrency:

jobs:
lint:
strategy:
matrix:
flags: ["--cfg legacy_builder_refactored", ""]
runs-on: ubuntu-latest

env:
RUSTFLAGS: "${{ matrix.flags }}"
RUSTDOCFLAGS: "${{ matrix.flags }}"
RUST_LOG: info
steps:
- uses: actions/checkout@v4
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ concurrency:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
flags: ["--cfg legacy_builder_refactored", ""]
env:
RUSTFLAGS: "${{ matrix.flags }}"
RUSTDOCFLAGS: "${{ matrix.flags }}"
RUST_LOG: info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ either = "1.13"
futures = "0.3"
jf-vid = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5" }
hex = "0.4.3"
lru = "0.12"
multimap = "0.10.0"
nonempty-collections = "0.2"
once_cell = "1.20"
Expand Down Expand Up @@ -56,13 +57,15 @@ version = "0.1.56"
edition = "2021"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(legacy_builder_refactored, values(none()))',
'cfg(coverage_nightly)',
] }

[workspace.lints.clippy]
disallowed-names = "deny"
doc_markdown = "deny"
doc_link_with_quotes = "deny"
clone_on_ref_ptr = "deny"

[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
Expand Down
1 change: 1 addition & 0 deletions crates/legacy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ futures = { workspace = true }
hotshot = { workspace = true }
hotshot-builder-api = { workspace = true }
hotshot-types = { workspace = true }
lru = { workspace = true }
once_cell = { workspace = true }
serde = { workspace = true, features = ["derive"] }
sha2 = { workspace = true }
Expand Down
21 changes: 4 additions & 17 deletions crates/legacy/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
//! Builder Phase 1
//! It mainly provides three API services to hotshot proposers:
//! 1. Serves a proposer(leader)'s request to provide blocks information
//! 2. Serves a proposer(leader)'s request to provide the full blocks information
//! 3. Serves a proposer(leader)'s request to provide the block header information
//!
//! It also provides one API service to external users:
//! 1. Serves a user's request to submit a private transaction
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
#[cfg_attr(legacy_builder_refactored, path = "refactored/lib.rs")]
#[cfg_attr(not(legacy_builder_refactored), path = "old/lib.rs")]
mod implementation;

pub mod block_size_limits;
pub mod block_store;
pub mod service;

// tracking the testing
#[cfg(test)]
#[cfg_attr(coverage_nightly, coverage(off))]
pub mod testing;
pub use implementation::*;
Loading

0 comments on commit 7cf96d9

Please sign in to comment.