Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 08c9fb4

Browse files
author
Alexandcoats
authored
chore(features): remove stardust feature (#1022)
* Remove `stardust` feature * Fix CI commands
1 parent 761a4f2 commit 08c9fb4

File tree

12 files changed

+24
-47
lines changed

12 files changed

+24
-47
lines changed

.cargo/config.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[alias]
22
ci-check-all = "check --all-targets --all-features"
3-
ci-check-inx = "check --all-targets --no-default-features --features inx,stardust"
4-
ci-check-api = "check --all-targets --no-default-features --features api,stardust"
3+
ci-check-inx = "check --all-targets --no-default-features --features inx"
4+
ci-check-api = "check --all-targets --no-default-features --features api"
55
ci-check-features = "hack check --each-feature --no-dev-deps"
66

77
ci-clippy-all = "clippy --all-targets --all-features -- -D warnings"
8-
ci-clippy-inx = "clippy --all-targets --no-default-features --features inx,stardust -- -D warnings"
9-
ci-clippy-api = "clippy --all-targets --no-default-features --features api,stardust -- -D warnings"
8+
ci-clippy-inx = "clippy --all-targets --no-default-features --features inx -- -D warnings"
9+
ci-clippy-api = "clippy --all-targets --no-default-features --features api -- -D warnings"
1010

1111
ci-doctest = "test --doc --all-features"
1212
ci-doc = "doc --all-features --no-deps --document-private-items"

Cargo.toml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ eyre = { version = "0.6", default-features = false, features = [ "track-caller",
3232
futures = { version = "0.3", default-features = false }
3333
humantime = { version = "2.1.0", default-features = false }
3434
humantime-serde = { version = "1.1", default-features = false }
35+
iota-types = { version = "1.0.0-rc", default-features = false, features = [ "api", "block", "std" ] }
3536
mongodb = { version = "2.3", default-features = false, features = [ "tokio-runtime" ] }
37+
packable = { version = "0.7", default-features = false }
3638
pin-project = { version = "1.0", default-features = false }
3739
prefix-hex = { version = "0.5.0", default-features = false, features = [ "primitive-types" ] }
3840
primitive-types = { version = "0.12", default-features = false }
@@ -61,7 +63,6 @@ ed25519 = { version = "1.5", default-features = false, features = [ "alloc", "pk
6163
ed25519-dalek = { version = "1.0", default-features = false, features = [ "u64_backend" ], optional = true }
6264
hex = { version = "0.4", default-features = false, optional = true }
6365
hyper = { version = "0.14", default-features = false, features = [ "server", "tcp", "stream" ], optional = true }
64-
packable = { version = "0.7", default-features = false, optional = true }
6566
rand = { version = "0.8", default-features = false, features = [ "std" ], optional = true }
6667
regex = { version = "1.7", default-features = false, features = [ "std" ], optional = true }
6768
rust-argon2 = { version = "1.0.0", default-features = false, optional = true }
@@ -80,9 +81,6 @@ tracing-loki = { version = "0.2", default-features = false, features = [ "compat
8081
# PoI
8182
iota-crypto = { version = "0.15", default-features = false, features = [ "blake2b" ], optional = true }
8283

83-
# Stardust types
84-
iota-types = { version = "1.0.0-rc", default-features = false, features = [ "api", "block", "std" ], optional = true }
85-
8684
[dev-dependencies]
8785
iota-types = { version = "1.0.0-rc", default-features = false, features = [ "api", "block", "std", "rand" ] }
8886
rand = { version = "0.8", default-features = false, features = [ "std" ] }
@@ -95,7 +93,6 @@ default = [
9593
"loki",
9694
"metrics",
9795
"poi",
98-
"stardust",
9996
]
10097
analytics = [
10198
"dep:influxdb",
@@ -108,21 +105,17 @@ api = [
108105
"dep:hex",
109106
"derive_more/from",
110107
"dep:hyper",
111-
"dep:packable",
112108
"dep:rand",
113109
"dep:regex",
114110
"dep:rust-argon2",
115111
"dep:serde_urlencoded",
116112
"dep:tower",
117113
"dep:tower-http",
118114
"dep:zeroize",
119-
"stardust",
120115
]
121116
inx = [
122117
"dep:inx",
123-
"dep:packable",
124118
"dep:tonic",
125-
"stardust",
126119
]
127120
loki = [
128121
"dep:tracing-loki",
@@ -136,11 +129,7 @@ poi = [
136129
"dep:iota-crypto",
137130
]
138131
rand = [
139-
"iota-types?/rand",
140-
]
141-
stardust = [
142-
"dep:iota-types",
143-
"dep:packable",
132+
"iota-types/rand",
144133
]
145134

146135
[profile.production]

src/bin/inx-chronicle/api/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub enum RequestError {
165165
BadPagingState,
166166
#[error("invalid time range")]
167167
BadTimeRange,
168-
#[cfg(feature = "stardust")]
168+
169169
#[error("invalid IOTA Stardust data: {0}")]
170170
IotaStardust(#[from] iota_types::block::Error),
171171
#[error("invalid bool value provided: {0}")]

src/bin/inx-chronicle/api/extractors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pub struct TimeRangeQuery {
6969
end_timestamp: Option<u32>,
7070
}
7171

72-
#[cfg(feature = "stardust")]
7372
mod stardust {
7473
use chronicle::types::stardust::milestone::MilestoneTimestamp;
7574

@@ -105,7 +104,6 @@ mod stardust {
105104
}
106105
}
107106

108-
#[cfg(feature = "stardust")]
109107
pub use stardust::*;
110108

111109
#[cfg(test)]

src/bin/inx-chronicle/api/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77
mod extractors;
88

9-
#[cfg(feature = "stardust")]
109
pub mod stardust;
1110

1211
mod error;

src/bin/inx-chronicle/api/routes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub fn routes() -> Router {
4141
#[allow(unused_mut)]
4242
let mut router = Router::new();
4343

44-
#[cfg(feature = "stardust")]
4544
{
4645
router = router.merge(super::stardust::routes())
4746
}
@@ -135,7 +134,6 @@ async fn list_routes(
135134
}
136135

137136
pub async fn is_healthy(database: &MongoDb) -> ApiResult<bool> {
138-
#[cfg(feature = "stardust")]
139137
{
140138
let newest = match database
141139
.collection::<MilestoneCollection>()

src/bin/inx-chronicle/cli.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ impl From<&InfluxDbArgs> for chronicle::db::influxdb::InfluxDbConfig {
123123
}
124124
}
125125

126-
#[cfg(all(feature = "stardust", feature = "inx"))]
126+
#[cfg(feature = "inx")]
127127
use crate::stardust_inx::config as inx;
128128

129-
#[cfg(all(feature = "stardust", feature = "inx"))]
129+
#[cfg(feature = "inx")]
130130
#[derive(Args, Debug)]
131131
pub struct InxArgs {
132132
/// The address of the node INX interface Chronicle tries to connect to - if enabled.
@@ -147,7 +147,7 @@ pub struct InxArgs {
147147
pub disable_inx: bool,
148148
}
149149

150-
#[cfg(all(feature = "stardust", feature = "inx"))]
150+
#[cfg(feature = "inx")]
151151
impl From<&InxArgs> for inx::InxConfig {
152152
fn from(value: &InxArgs) -> Self {
153153
Self {
@@ -241,7 +241,7 @@ impl From<&LokiArgs> for crate::config::loki::LokiConfig {
241241
}
242242
}
243243

244-
#[cfg(any(all(feature = "stardust", feature = "inx"), feature = "api"))]
244+
#[cfg(any(feature = "inx", feature = "api"))]
245245
fn parse_duration(arg: &str) -> Result<std::time::Duration, humantime::DurationError> {
246246
arg.parse::<humantime::Duration>().map(Into::into)
247247
}
@@ -253,7 +253,7 @@ impl ClArgs {
253253
mongodb: (&self.mongodb).into(),
254254
#[cfg(any(feature = "analytics", feature = "metrics"))]
255255
influxdb: (&self.influxdb).into(),
256-
#[cfg(all(feature = "stardust", feature = "inx"))]
256+
#[cfg(feature = "inx")]
257257
inx: (&self.inx).into(),
258258
#[cfg(feature = "api")]
259259
api: (&self.api).into(),
@@ -291,7 +291,7 @@ impl ClArgs {
291291
);
292292
return Ok(PostCommand::Exit);
293293
}
294-
#[cfg(all(feature = "analytics", feature = "stardust", feature = "inx"))]
294+
#[cfg(all(feature = "analytics", feature = "inx"))]
295295
Subcommands::FillAnalytics {
296296
start_milestone,
297297
end_milestone,
@@ -393,7 +393,7 @@ impl ClArgs {
393393
return Ok(PostCommand::Exit);
394394
}
395395
}
396-
#[cfg(feature = "stardust")]
396+
397397
Subcommands::BuildIndexes => {
398398
tracing::info!("Connecting to database using hosts: `{}`.", config.mongodb.hosts_str()?);
399399
let db = chronicle::db::MongoDb::connect(&config.mongodb).await?;
@@ -423,7 +423,7 @@ pub enum AnalyticsChoice {
423423
UnlockConditions,
424424
}
425425

426-
#[cfg(all(feature = "analytics", feature = "stardust"))]
426+
#[cfg(feature = "analytics")]
427427
impl From<AnalyticsChoice> for Box<dyn chronicle::db::collections::analytics::Analytic> {
428428
fn from(value: AnalyticsChoice) -> Self {
429429
use chronicle::db::collections::analytics::{
@@ -453,7 +453,7 @@ pub enum Subcommands {
453453
/// Generate a JWT token using the available config.
454454
#[cfg(feature = "api")]
455455
GenerateJWT,
456-
#[cfg(all(feature = "analytics", feature = "stardust"))]
456+
#[cfg(feature = "analytics")]
457457
FillAnalytics {
458458
/// The inclusive starting milestone index.
459459
#[arg(short, long)]
@@ -476,7 +476,6 @@ pub enum Subcommands {
476476
run: bool,
477477
},
478478
/// Manually build indexes.
479-
#[cfg(feature = "stardust")]
480479
BuildIndexes,
481480
}
482481

src/bin/inx-chronicle/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct ChronicleConfig {
1313
pub influxdb: chronicle::db::influxdb::InfluxDbConfig,
1414
#[cfg(feature = "api")]
1515
pub api: crate::api::ApiConfig,
16-
#[cfg(all(feature = "stardust", feature = "inx"))]
16+
#[cfg(feature = "inx")]
1717
pub inx: super::stardust_inx::InxConfig,
1818
#[cfg(feature = "loki")]
1919
pub loki: loki::LokiConfig,

src/bin/inx-chronicle/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod api;
99
mod cli;
1010
mod config;
1111
mod process;
12-
#[cfg(all(feature = "stardust", feature = "inx"))]
12+
#[cfg(feature = "inx")]
1313
mod stardust_inx;
1414

1515
use bytesize::ByteSize;
@@ -44,14 +44,13 @@ async fn main() -> eyre::Result<()> {
4444
ByteSize::b(db.size().await?)
4545
);
4646

47-
#[cfg(feature = "stardust")]
4847
build_indexes(&db).await?;
4948

5049
let mut tasks: JoinSet<eyre::Result<()>> = JoinSet::new();
5150

5251
let (shutdown_signal, _) = tokio::sync::broadcast::channel::<()>(1);
5352

54-
#[cfg(all(feature = "inx", feature = "stardust"))]
53+
#[cfg(feature = "inx")]
5554
if config.inx.enabled {
5655
#[cfg(any(feature = "analytics", feature = "metrics"))]
5756
#[allow(unused_mut)]
@@ -162,7 +161,6 @@ fn set_up_logging(#[allow(unused)] config: &ChronicleConfig) -> eyre::Result<()>
162161
Ok(())
163162
}
164163

165-
#[cfg(feature = "stardust")]
166164
async fn build_indexes(db: &MongoDb) -> eyre::Result<()> {
167165
use chronicle::db::collections;
168166
let start_indexes = db.get_index_names().await?;

src/db/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! Module that contains the database and associated models.
55
66
/// Module containing the collections in the database.
7-
#[cfg(feature = "stardust")]
87
pub mod collections;
98

109
/// Module containing InfluxDb types and traits.

src/types/ledger/inclusion_state.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ impl From<LedgerInclusionState> for Bson {
2424
}
2525
}
2626

27-
#[cfg(feature = "stardust")]
2827
impl From<iota::LedgerInclusionStateDto> for LedgerInclusionState {
2928
fn from(value: iota::LedgerInclusionStateDto) -> Self {
3029
match value {
@@ -35,7 +34,6 @@ impl From<iota::LedgerInclusionStateDto> for LedgerInclusionState {
3534
}
3635
}
3736

38-
#[cfg(feature = "stardust")]
3937
impl From<LedgerInclusionState> for iota::LedgerInclusionStateDto {
4038
fn from(value: LedgerInclusionState) -> Self {
4139
match value {

src/types/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33

44
//! Module that contains the types.
55
6-
#[cfg(feature = "stardust")]
76
pub mod context;
8-
#[cfg(feature = "stardust")]
7+
98
pub mod ledger;
10-
#[cfg(feature = "stardust")]
9+
1110
pub mod node;
12-
#[cfg(feature = "stardust")]
11+
1312
pub mod stardust;
14-
#[cfg(feature = "stardust")]
13+
1514
pub mod tangle;
1615
pub mod util;

0 commit comments

Comments
 (0)