Skip to content

Commit

Permalink
chore: Remove network parameter from CLI (#1484)
Browse files Browse the repository at this point in the history
Co-authored-by: xgreenx <[email protected]>
  • Loading branch information
Brandon Vrooman and xgreenx authored Nov 14, 2023
1 parent be5e4b1 commit ee5efb6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Description of the upcoming release here.
### Removed

#### Breaking
- [#1484](https://github.com/FuelLabs/fuel-core/pull/1484): Removed `--network` CLI argument. Now the name of the network is fetched form chain configuration.
- [#1399](https://github.com/FuelLabs/fuel-core/pull/1399): Removed `relayer-da-finalization` parameter from the relayer CLI.
- [#1338](https://github.com/FuelLabs/fuel-core/pull/1338): Updated GraphQL client to use `DependentCost` for `k256`, `mcpi`, `s256`, `scwq`, `swwq` opcodes.
- [#1322](https://github.com/FuelLabs/fuel-core/pull/1322): The `manual_blocks_enabled` flag is removed from the CLI. The analog is a `debug` flag.
21 changes: 3 additions & 18 deletions bin/fuel-core/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl Command {
let relayer_cfg = relayer_args.into_config();

#[cfg(feature = "p2p")]
let p2p_cfg = p2p_args.into_config(metrics)?;
let p2p_cfg = p2p_args.into_config(chain_conf.chain_name.clone(), metrics)?;

let trigger: Trigger = poa_trigger.into();

Expand Down Expand Up @@ -348,25 +348,11 @@ impl Command {
}

pub async fn exec(command: Command) -> anyhow::Result<()> {
let network_name = {
#[cfg(feature = "p2p")]
{
command
.p2p_args
.network
.clone()
.unwrap_or_else(|| "default_network".to_string())
}
#[cfg(not(feature = "p2p"))]
"default_network"
}
.to_string();

let profiling = command.profiling.clone();
let config = command.get_config()?;

// start profiling agent if url is configured
let _profiling_agent = start_pyroscope_agent(profiling, &config, network_name)?;
let _profiling_agent = start_pyroscope_agent(profiling, &config)?;

// log fuel-core version
info!("Fuel Core version v{}", env!("CARGO_PKG_VERSION"));
Expand Down Expand Up @@ -409,7 +395,6 @@ fn load_consensus_key(
fn start_pyroscope_agent(
profiling_args: profiling::ProfilingArgs,
config: &Config,
network_name: String,
) -> anyhow::Result<Option<PyroscopeAgent<PyroscopeAgentRunning>>> {
profiling_args
.pyroscope_url
Expand All @@ -419,7 +404,7 @@ fn start_pyroscope_agent(
let agent = PyroscopeAgent::builder(url, &"fuel-core".to_string())
.tags(vec![
("service", config.name.as_str()),
("network", network_name.as_str()),
("network", config.chain_conf.chain_name.as_str()),
])
.backend(pprof_backend(
PprofConfig::new().sample_rate(profiling_args.pprof_sample_rate),
Expand Down
9 changes: 2 additions & 7 deletions bin/fuel-core/src/cli/run/p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ pub struct P2PArgs {
#[arg(requires_if(IsPresent, "enable_p2p"))]
pub keypair: Option<KeypairArg>,

/// The name of the p2p Network
#[clap(long = "network", env)]
#[arg(required_if_eq("enable_p2p", "true"))]
#[arg(requires_if(IsPresent, "enable_p2p"))]
pub network: Option<String>,

/// p2p network's IP Address
#[clap(long = "address", env)]
pub address: Option<IpAddr>,
Expand Down Expand Up @@ -236,6 +230,7 @@ impl From<SyncArgs> for fuel_core::sync::Config {
impl P2PArgs {
pub fn into_config(
self,
network_name: String,
metrics: bool,
) -> anyhow::Result<Option<Config<NotInitialized>>> {
if !self.enable_p2p {
Expand Down Expand Up @@ -290,7 +285,7 @@ impl P2PArgs {

let config = Config {
keypair: local_keypair,
network_name: self.network.expect("mandatory value"),
network_name,
checksum: Default::default(),
address: self
.address
Expand Down

0 comments on commit ee5efb6

Please sign in to comment.