Skip to content

Commit

Permalink
fix(jstzd): replace localhost with 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
huancheng-trili committed Jan 24, 2025
1 parent da31f80 commit ba52514
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions crates/jstz_cli/src/sandbox/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ async fn create_config_file_and_client_dir() -> Result<(PathBuf, PathBuf)> {
.into_path();
let content = serde_json::to_string(&serde_json::json!({
"octez_client": {
"octez_node_endpoint": format!("http://localhost:{SANDBOX_OCTEZ_NODE_RPC_PORT}"),
"octez_node_endpoint": format!("http://0.0.0.0:{SANDBOX_OCTEZ_NODE_RPC_PORT}"),
"base_dir": JSTZD_OCTEZ_CLIENT_DIR_PATH,
},
"octez_node": {
"rpc_endpoint": format!("localhost:{SANDBOX_OCTEZ_NODE_RPC_PORT}")
"rpc_endpoint": format!("0.0.0.0:{SANDBOX_OCTEZ_NODE_RPC_PORT}")
},
})).context("Failed to serialise sandbox config")?;
let config_file_path = NamedTempFile::new()
Expand Down Expand Up @@ -239,6 +239,7 @@ fn new_create_container_config(
mounts: create_mounts(mounts),
port_bindings: create_port_bindings(ports.as_ref()),
auto_remove: Some(true),
network_mode: Some("bridge".to_string()),
..Default::default()
}),
attach_stdin: Some(true),
Expand Down Expand Up @@ -439,6 +440,7 @@ mod tests {
host_port: Some("1234".to_owned()),
}])
)])),
network_mode: Some("bridge".to_owned()),
auto_remove: Some(true),
..Default::default()
}),
Expand Down Expand Up @@ -478,11 +480,11 @@ mod tests {
value,
serde_json::json!({
"octez_client": {
"octez_node_endpoint": format!("http://localhost:{SANDBOX_OCTEZ_NODE_RPC_PORT}"),
"octez_node_endpoint": format!("http://0.0.0.0:{SANDBOX_OCTEZ_NODE_RPC_PORT}"),
"base_dir": super::JSTZD_OCTEZ_CLIENT_DIR_PATH,
},
"octez_node": {
"rpc_endpoint": format!("localhost:{SANDBOX_OCTEZ_NODE_RPC_PORT}")
"rpc_endpoint": format!("0.0.0.0:{SANDBOX_OCTEZ_NODE_RPC_PORT}")
},
})
);
Expand Down
6 changes: 4 additions & 2 deletions crates/jstzd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
jstz_rollup_path, EXCHANGER_ADDRESS, JSTZ_NATIVE_BRIDGE_ADDRESS, JSTZ_ROLLUP_ADDRESS,
};
use anyhow::{Context, Result};
use http::Uri;
use jstz_node::config::JstzNodeConfig;
use octez::r#async::endpoint::Endpoint;
use octez::r#async::protocol::{
Expand All @@ -24,7 +25,7 @@ use tezos_crypto_rs::hash::SmartRollupHash;
use tokio::io::AsyncReadExt;

const DEFAULT_JSTZD_SERVER_PORT: u16 = 54321;
const DEFAULT_JSTZ_NODE_PORT: u16 = 8933;
const DEFAULT_JSTZ_NODE_ENDPOINT: &str = "0.0.0.0:8933";
const ACTIVATOR_PK: &str = "edpkuSLWfVU1Vq7Jg9FucPyKmma6otcMHac9zG4oU1KMHSTBpJuGQ2";
pub const BOOTSTRAP_CONTRACT_NAMES: [(&str, &str); 2] = [
("exchanger", EXCHANGER_ADDRESS),
Expand Down Expand Up @@ -111,7 +112,8 @@ pub(crate) async fn build_config(
.build()
.unwrap();

let jstz_node_rpc_endpoint = Endpoint::localhost(DEFAULT_JSTZ_NODE_PORT);
let jstz_node_rpc_endpoint =
Endpoint::try_from(Uri::from_static(DEFAULT_JSTZ_NODE_ENDPOINT)).unwrap();
let jstz_node_config = JstzNodeConfig::new(
&jstz_node_rpc_endpoint,
&octez_rollup_config.rpc_endpoint,
Expand Down
2 changes: 2 additions & 0 deletions crates/octez/src/async/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ impl OctezNode {
// the node executable does not accept the scheme part
"--rpc-addr",
&rpc_endpoint.to_authority(),
"--allow-all-rpc",
&rpc_endpoint.to_authority(),
"--connections",
num_connections.to_string().as_str(),
"--net-addr",
Expand Down

0 comments on commit ba52514

Please sign in to comment.