Skip to content

Commit dd7f110

Browse files
committed
update setup.sh
1 parent 48c008d commit dd7f110

File tree

3 files changed

+56
-22
lines changed

3 files changed

+56
-22
lines changed

rollup/src/main.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ use aptos_infallible::RwLock;
44
use aptos_node::network;
55
use aptos_storage_interface::{DbReader, DbReaderWriter, DbWriter};
66
use aptos_temppath::TempPath;
7-
use aptos_types::on_chain_config::{
8-
ApprovedExecutionHashes, ConfigID, OnChainConfig, OnChainConsensusConfig, ValidatorSet, Version,
7+
use aptos_types::{
8+
chain_id::ChainId,
9+
on_chain_config::{
10+
ApprovedExecutionHashes, ConfigID, OnChainConfig, OnChainConsensusConfig, ValidatorSet,
11+
Version,
12+
},
13+
waypoint::Waypoint,
914
};
10-
use aptos_types::{chain_id::ChainId, waypoint::Waypoint};
1115
use log::info;
1216
use std::sync::Arc;
1317
/// State sync will panic if the value of any config in this registry is uninitialized
@@ -26,13 +30,9 @@ impl DbWriter for MockDatabase {}
2630

2731
fn main() {
2832
env_logger::init();
29-
let temp_path = TempPath::new();
30-
3133
let mut node_config = NodeConfig::load_from_path("rollup/test_data/validator.yaml")
3234
.expect("Failed to load node config");
3335
info!("Node config: {:?}", node_config);
34-
node_config.set_data_dir(temp_path.path().to_path_buf());
35-
info!("node config data dir set");
3636
node_config.base.waypoint = WaypointConfig::FromConfig(Waypoint::default());
3737
info!("way point set");
3838
// Create an event subscription service

rollup/test_data/validator.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ consensus:
1616
from_file:
1717
waypoint:
1818
from_file: waypoint.txt
19-
identity_blob_path: validator-identity.yaml
19+
identity_blob_path: ../test_data/validator-identity.yaml
2020

2121
execution:
2222
genesis_file_location: "genesis.blob"
@@ -26,7 +26,7 @@ validator_network:
2626
mutual_authentication: true
2727
identity:
2828
type: "from_file"
29-
path: validator-identity.yaml
29+
path: ../test_data/validator-identity.yaml
3030

3131
full_node_networks:
3232
- network_id:
@@ -39,4 +39,4 @@ full_node_networks:
3939

4040
api:
4141
enabled: true
42-
address: "0.0.0.0:8080"
42+
address: "0.0.0.0:8080"

scripts/setup.sh

+46-12
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,51 @@
11
#!/bin/bash
22

3-
# Specify the directory path
4-
directory="/opt/aptos/data"
3+
# Specify the directory paths
4+
data_dir="/opt/aptos/data"
5+
genesis_dir="/opt/aptos/genesis"
56

6-
# Check if the directory exists
7-
if [ ! -d "$directory" ]; then
8-
# Create the directory if it doesn't exist
9-
if mkdir -p "$directory" 2>/dev/null; then
10-
echo "Directory '$directory' created."
11-
else
12-
echo "Failed to create directory '$directory'. Please check permissions and try again with appropriate privileges (e.g., using sudo)."
7+
# Check if the data directory exists
8+
if [ ! -d "$data_dir" ]; then
9+
# Create the data directory if it doesn't exist
10+
if mkdir -p "$data_dir" 2>/dev/null; then
11+
echo "Directory '$data_dir' created."
12+
else
13+
echo "Failed to create directory '$data_dir'. Please check permissions and try again with appropriate privileges (e.g., using sudo)."
14+
exit 1
15+
fi
16+
else
17+
echo "Directory '$data_dir' already exists."
18+
fi
19+
20+
# Check if the genesis directory exists
21+
if [ ! -d "$genesis_dir" ]; then
22+
# Create the genesis directory if it doesn't exist
23+
if mkdir -p "$genesis_dir" 2>/dev/null; then
24+
echo "Directory '$genesis_dir' created."
25+
else
26+
echo "Failed to create directory '$genesis_dir'. Please check permissions and try again with appropriate privileges (e.g., using sudo)."
27+
exit 1
28+
fi
29+
else
30+
echo "Directory '$genesis_dir' already exists."
31+
fi
32+
33+
# Download the genesis.blob file
34+
echo "Downloading genesis.blob..."
35+
curl -s https://devnet.aptoslabs.com/genesis.blob -o "$genesis_dir/genesis.blob"
36+
if [ $? -eq 0 ]; then
37+
echo "genesis.blob downloaded successfully."
38+
else
39+
echo "Failed to download genesis.blob. Please check your internet connection and try again."
1340
exit 1
14-
fi
41+
fi
42+
43+
# Download the waypoint.txt file
44+
echo "Downloading waypoint.txt..."
45+
curl -s https://devnet.aptoslabs.com/waypoint.txt -o "$genesis_dir/waypoint.txt"
46+
if [ $? -eq 0 ]; then
47+
echo "waypoint.txt downloaded successfully."
1548
else
16-
echo "Directory '$directory' already exists."
17-
fi
49+
echo "Failed to download waypoint.txt. Please check your internet connection and try again."
50+
exit 1
51+
fi

0 commit comments

Comments
 (0)