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

chore: Remove network parameter from CLI #1484

Merged
merged 5 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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