Skip to content

Commit

Permalink
fix(script): Fix final touches over launcher script (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
antiyro authored Oct 10, 2024
1 parent 5758897 commit a647235
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/starknet-js-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fail-on-cache-miss: true
- name: Setup dev chain and run tests
run: |
./target/release/madara --name madara --base-path ../madara_db --telemetry-disabled --rpc-port 9944 --rpc-cors "*" --rpc-external --devnet --preset devnet &
./target/release/madara --name madara --base-path ../madara_db --rpc-port 9944 --rpc-cors "*" --rpc-external --devnet --preset devnet &
MADARA_PID=$!
while ! echo exit | nc localhost 9944; do sleep 1; done
cd tests/js_tests
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- fix: added more launcher capabilities
- fix(cleanup): Updated EditorConfig to 4-space indents
- fix(tests): Fixed local testing scripts
- fix: override chain config
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Toggle details for each namespace to view additional settings:
<details>
<summary><strong>Metrics</strong></summary>
- **`--telemetry-disabled`**: Disable connection to the Madara telemetry server.
- **`--telemetry`**: Enable connection to the Madara telemetry server.
- **`--telemetry-url <URL VERBOSITY>`**: The URL of the telemetry server with verbosity level.
Expand Down
10 changes: 5 additions & 5 deletions crates/client/telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ impl TelemetryHandle {
}
}
pub struct TelemetryService {
no_telemetry: bool,
telemetry: bool,
telemetry_endpoints: Vec<(String, u8)>,
telemetry_handle: TelemetryHandle,
start_state: Option<mpsc::Receiver<TelemetryEvent>>,
}

impl TelemetryService {
pub fn new(no_telemetry: bool, telemetry_endpoints: Vec<(String, u8)>) -> anyhow::Result<Self> {
let (telemetry_handle, start_state) = if no_telemetry {
pub fn new(telemetry: bool, telemetry_endpoints: Vec<(String, u8)>) -> anyhow::Result<Self> {
let (telemetry_handle, start_state) = if !telemetry {
(TelemetryHandle(None), None)
} else {
let (tx, rx) = mpsc::channel(1024);
(TelemetryHandle(Some(Arc::new(tx))), Some(rx))
};
Ok(Self { no_telemetry, telemetry_endpoints, telemetry_handle, start_state })
Ok(Self { telemetry, telemetry_endpoints, telemetry_handle, start_state })
}

pub fn new_handle(&self) -> TelemetryHandle {
Expand Down Expand Up @@ -94,7 +94,7 @@ impl TelemetryService {
#[async_trait::async_trait]
impl Service for TelemetryService {
async fn start(&mut self, join_set: &mut JoinSet<anyhow::Result<()>>) -> anyhow::Result<()> {
if self.no_telemetry {
if !self.telemetry {
return Ok(());
}

Expand Down
7 changes: 3 additions & 4 deletions crates/node/src/cli/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ use clap::Args;
/// Parameters used to config telemetry.
#[derive(Debug, Clone, Args)]
pub struct TelemetryParams {
/// Disable connecting to the Madara telemetry server.
/// Telemetry is enabled by default.
#[arg(env = "MADARA_TELEMETRY_DISABLED", long, alias = "no-telemetry")]
pub telemetry_disabled: bool,
/// Enable connecting to the Madara telemetry server.
#[arg(env = "MADARA_TELEMETRY", long, alias = "telemetry")]
pub telemetry: bool,

/// The URL of the telemetry server.
/// Pass this flag multiple times specify multiple telemetry endpoints.
Expand Down
8 changes: 3 additions & 5 deletions crates/node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ async fn main() -> anyhow::Result<()> {

// Services.

let telemetry_service = TelemetryService::new(
run_cmd.telemetry_params.telemetry_disabled,
run_cmd.telemetry_params.telemetry_endpoints.clone(),
)
.context("Initializing telemetry service")?;
let telemetry_service =
TelemetryService::new(run_cmd.telemetry_params.telemetry, run_cmd.telemetry_params.telemetry_endpoints.clone())
.context("Initializing telemetry service")?;
let prometheus_service = MetricsService::new(
run_cmd.prometheus_params.prometheus_disabled,
run_cmd.prometheus_params.prometheus_external,
Expand Down
7 changes: 6 additions & 1 deletion crates/primitives/chain_config/src/chain_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ impl ChainConfig {
},
},
// We are not producing blocks for these chains.
sequencer_address: ContractAddress::default(),
sequencer_address: ContractAddress(
PatriciaKey::try_from(Felt::from_hex_unchecked(
"0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8",
))
.unwrap(),
),
max_nonce_for_validation_skip: 2,
}
}
Expand Down
1 change: 0 additions & 1 deletion crates/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ impl MadaraCmdBuilder {
self.args
.into_iter()
.chain([
"--telemetry-disabled".into(), // important: disable telemetry!!
"--no-prometheus".into(),
"--base-path".into(),
format!("{}", self.tempdir.as_ref().display()),
Expand Down
Loading

0 comments on commit a647235

Please sign in to comment.