Skip to content

Commit

Permalink
fix(epoch_sync) - fix unintential epoch sync feature inclusion (#11158)
Browse files Browse the repository at this point in the history
The epoch sync was getting enabled when using wide build commands that
included the epoch sync tool.

I'm moving the conditional enablement from Cargo.toml to the rust files.

Additional information:
https://near.zulipchat.com/#narrow/stream/300659-Rust-.F0.9F.A6.80/topic/PSA.3A.20don't.20use.20.60cargo.20build.20--bin.20neard.60
  • Loading branch information
wacban authored Apr 26, 2024
1 parent a49de7d commit 400bdf1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion neard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ rosetta_rpc = ["nearcore/rosetta_rpc"]
json_rpc = ["nearcore/json_rpc"]
protocol_feature_fix_staking_threshold = ["nearcore/protocol_feature_fix_staking_threshold"]
protocol_feature_nonrefundable_transfer_nep491 = ["near-state-viewer/protocol_feature_nonrefundable_transfer_nep491"]
new_epoch_sync = ["nearcore/new_epoch_sync", "dep:near-epoch-sync-tool"]
new_epoch_sync = ["nearcore/new_epoch_sync", "near-epoch-sync-tool/new_epoch_sync"]
yield_resume = ["nearcore/yield_resume"]

nightly = [
Expand Down
38 changes: 29 additions & 9 deletions tools/epoch-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,34 @@ publish = false
[lints]
workspace = true

# The dependencies are marked optional because we only need them when the
# new_epoch_sync feature is enabled.
[dependencies]
anyhow.workspace = true
clap.workspace = true
tracing.workspace = true
anyhow = { workspace = true, optional = true }
clap = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }

nearcore = { workspace = true, features = ["new_epoch_sync"] }
near-chain.workspace = true
near-chain-configs.workspace = true
near-epoch-manager.workspace = true
near-primitives.workspace = true
near-store.workspace = true
nearcore = { workspace = true, optional = true }
near-chain = { workspace = true, optional = true }
near-chain-configs = { workspace = true, optional = true }
near-epoch-manager = { workspace = true, optional = true }
near-primitives = { workspace = true, optional = true }
near-store = { workspace = true, optional = true }

[features]

default = []
new_epoch_sync = [
"nearcore/new_epoch_sync",

"dep:anyhow",
"dep:clap",
"dep:tracing",

"dep:nearcore",
"dep:near-chain",
"dep:near-chain-configs",
"dep:near-epoch-manager",
"dep:near-primitives",
"dep:near-store",
]
2 changes: 2 additions & 0 deletions tools/epoch-sync/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "new_epoch_sync")]

use anyhow::Context;
use clap;
use near_chain::{ChainStore, ChainStoreAccess, ChainUpdate, DoomslugThresholdMode};
Expand Down
2 changes: 2 additions & 0 deletions tools/epoch-sync/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#[cfg(feature = "new_epoch_sync")]
pub mod cli;
#[cfg(feature = "new_epoch_sync")]
pub use cli::EpochSyncCommand;

0 comments on commit 400bdf1

Please sign in to comment.