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
Merge the sn-node-manager
crate into the safe_network
workspace
#1218
Conversation
|
||
port=$(echo "$output" | jq -r '.[0].port') | ||
peer_id=$(echo "$output" | jq -r '.[0].peer_id') | ||
genesis_multiaddr="/ip4/127.0.0.1/tcp/${port}/p2p/${peer_id}" |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
Reviewpad Report
NOTE: this commit also contains the corresponding Spin up As in the At present you need to supply paths to both binaries, but this will be extended shortly to provide The node registry was extended to keep track of the faucet process so it can easily be cleaned up in The
|
088e704
to
81e4dd9
Compare
OsString::from("--port"), | ||
OsString::from(config.node_port.to_string()), | ||
OsString::from("--rpc"), | ||
OsString::from(format!("127.0.0.1:{}", config.rpc_port)), |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
} | ||
|
||
fn get_available_port(&self) -> Result<u16> { | ||
let addr: SocketAddr = "127.0.0.1:0".parse().unwrap(); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
} else { | ||
for node in node_registry.nodes.iter_mut() { | ||
let rpc_client = | ||
RpcClient::new(&format!("https://127.0.0.1:{}", node.rpc_port)); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
)) | ||
})?; | ||
|
||
let rpc_client = RpcClient::new(&format!("https://127.0.0.1:{}", node.rpc_port)); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
// Again confirm that services which are marked running are still actually running. | ||
// If they aren't we'll mark them as stopped. | ||
for node in &mut node_registry.nodes { | ||
let rpc_client = RpcClient::new(&format!("https://127.0.0.1:{}", node.rpc_port)); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
all_peers.extend(additional_peers); | ||
|
||
for node in node_registry.nodes.iter() { | ||
let rpc_client = RpcClient::new(&format!("https://127.0.0.1:{}", node.rpc_port)); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
for _ in start..=network_options.node_count { | ||
let port = service_control.get_available_port()?; | ||
let rpc_port = service_control.get_available_port()?; | ||
let rpc_client = RpcClient::new(&format!("https://127.0.0.1:{rpc_port}")); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
} else { | ||
let port = service_control.get_available_port()?; | ||
let rpc_port = service_control.get_available_port()?; | ||
let rpc_client = RpcClient::new(&format!("https://127.0.0.1:{rpc_port}")); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
args.push("--port".to_string()); | ||
args.push(port.to_string()); | ||
args.push("--rpc".to_string()); | ||
args.push(format!("127.0.0.1:{rpc_port}")); |
Check notice
Code scanning / devskim
Accessing localhost could indicate debug code, or could hinder scaling. Note
78fa02e
to
aae62d2
Compare
aa80b8d
to
b74ef04
Compare
sn-node-manager
crate into the safe_network
workspacesn-node-manager
crate into the safe_network
workspace
4095447
to
c8e187c
Compare
863efd8
to
45b3249
Compare
The `peers` argument is no longer declared with an `Option` and the manual parsing of `SAFE_PEERS` is removed. If the user doesn't specify any peers using `--peer` or `SAFE_PEERS`, the `get_peers_from_args` function will return a particular type of error. In this case, we can just assume the user wants the nodes to join an existing local network.
The binary path is provided because this is useful to know, particularly for nodes installed as services. The number of connected peers are also included, because again, this can be useful to know if the network has initialised itself correctly, and how it might change over time. There was a bit of a refactor in here to have the `run_node` function return a `Node` rather than a multiaddr, because there's a function on the node now to get the multiaddr. The refactor also eliminated a test case, which was no longer necessary.
If this flag is set, the `--local` flag will be added to the arguments in the service definition. This has been added to facilitate running a local network using services, which is going to be used in the backward compatibility test in the `safe_network` repo.
Output the status report in json: this will be useful during CI and backwards compatibility testing to obtain the multiaddr for the initial service node. Fail if any nodes are not running: useful for quickly asserting that all nodes in the network must be running for the test to proceed.
The difference between this and the `run` command is that it sets up the nodes as services rather than just running them as processes. It requires root to run. The script will be used by the local testnet Github Action to start a network for the backwards compatibility test. The network will then be upgraded.
This command is useful to quickly spin up a faucet for a service-based local network, and it will be used in the backwards compatibility test.
An earlier refactor to return a node rather than a multiaddr has made it unnecessary to have the `build_multiaddr` function in the node manager.
- enable this once validation passes succesfully
Use references to crates in the workspace rather than version numbers.
The crate is renamed back to `sn-node-manager` because we've already had many versions published with that name, but the directory will still be named `sn_node_manager` to be consistent with the rest of the directories in the `safe_network` workspace.
When launching a local network, for now, we need to build the node manager rather than download the latest version. Once the node manager has been added to the `safe_network` release process, we can change this. The `sn-local-testnet-action` has been updated to assume that we're building the node manager from `safe_network`, as opposed to its own repository.
fe744a6
to
0bd6461
Compare
0bd6461
to
67c9120
Compare
This retains the commit history from the node manager repository.
Description
Summary generated by Reviewpad on 23 Jan 24 20:20 UTC
This pull request includes multiple changes across different files.
These changes span across various aspects such as documentation, scripts, configuration, tests, and code enhancements. Let me know if you need more details or assistance with any specific part.