Skip to content

Commit

Permalink
Merge pull request AleoNet#3272 from AleoNet/revert-multiple-prs
Browse files Browse the repository at this point in the history
Revert multiple prs
  • Loading branch information
apruden2008 authored May 24, 2024
2 parents 7ae9d73 + 7dbaadd commit 07ef982
Show file tree
Hide file tree
Showing 32 changed files with 105 additions and 378 deletions.
35 changes: 6 additions & 29 deletions .devnet/.analytics/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function calculateRoundsInBlocks(baseUrl, latestHeight) {
}
}

async function checkBlockHash(networkName, blockHeight) {
async function checkBlockHash(blockHeight) {
const numNodes = await getAWSNodeCount();
console.log(`Detected ${numNodes} AWS nodes... \n`);

Expand All @@ -125,7 +125,7 @@ async function checkBlockHash(networkName, blockHeight) {
// Get the IP address of the AWS node
const ipAddress = await getIPAddress(awsNodeName);
// Define the base URL for the node
const baseUrl = `http://${ipAddress}:3030/${networkName}/block`;
const baseUrl = `http://${ipAddress}:3030/mainnet/block`;

// Fetch the block data
const blockData = await fetchBlockData(baseUrl, blockHeight);
Expand All @@ -138,23 +138,7 @@ async function checkBlockHash(networkName, blockHeight) {
}

// Main function to fetch block metrics
async function fetchBlockMetrics(metricType, optionalBlockHeight, networkID) {
// Derive the network name based on the network ID.
let networkName;
switch (networkID) {
case 0:
networkName = "mainnet";
break;
case 1:
networkName = "testnet";
break;
case 2:
networkName = "canary";
break;
default:
throw new Error(`Unknown network ID (${networkID})`);
}

async function fetchBlockMetrics(metricType, optionalBlockHeight) {
// Function to get the latest block height
async function getLatestBlockHeight(baseUrl) {
try {
Expand All @@ -173,7 +157,7 @@ async function fetchBlockMetrics(metricType, optionalBlockHeight, networkID) {
// Get the IP address of the AWS node
const ipAddress = await getIPAddress(awsNodeName);
// Define the base URL for the node.
const baseUrl = `http://${ipAddress}:3030/${networkName}/block`;
const baseUrl = `http://${ipAddress}:3030/mainnet/block`;

console.log(`${dimStart}IP Address: ${ipAddress}${dimEnd}`);
console.log(`${dimStart}Base URL: ${baseUrl}${dimEnd}`);
Expand All @@ -191,7 +175,7 @@ async function fetchBlockMetrics(metricType, optionalBlockHeight, networkID) {
} else if (metricType === 'roundsInBlocks') {
calculateRoundsInBlocks(baseUrl, latestHeight);
} else if (metricType === 'checkBlockHash' && optionalBlockHeight) {
checkBlockHash(networkName, optionalBlockHeight);
checkBlockHash(optionalBlockHeight);
} else {
console.error('Invalid metric type. Supported types: "averageBlockTime" or "roundsInBlocks".');
}
Expand All @@ -212,13 +196,6 @@ async function main() {
describe: 'Block height to examine for checkBlockHash metric',
type: 'number',
},
'network-id': {
alias: 'n',
describe: 'Network ID to fetch block metrics from',
demandOption: true,
type: 'number',
choices: [0, 1, 2],
}
})
.check((argv) => {
// Check if metric-type is checkBlockHash and block-height is provided
Expand All @@ -230,7 +207,7 @@ async function main() {
.argv;

// Fetch and output the specified block metric
fetchBlockMetrics(argv['metric-type'], argv['block-height'], argv['network-id']);
fetchBlockMetrics(argv['metric-type'], argv['block-height']);
}

// Run the main function
Expand Down
17 changes: 3 additions & 14 deletions .devnet/analytics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ else
echo "Node.js dependencies already installed."
fi

# Prompt the user to specify a network ID
while true; do
echo "Please specify a network ID (0 for mainnet, 1 for testnet, 2 for canary):"
read networkID
if [[ $networkID == 0 || $networkID == 1 || $networkID == 2 ]]; then
break
else
echo "Invalid network ID. Please enter 0 or 1."
fi
done

# Prompt the user to select a metric type
PS3="Select a metric type: "
options=("Average Block Time" "Rounds in Blocks" "Check Block Hash" "Quit")
Expand All @@ -33,12 +22,12 @@ do
case $opt in
"Average Block Time")
echo ""
node analytics.js --metric-type averageBlockTime --network-id $networkID
node analytics.js --metric-type averageBlockTime
break
;;
"Rounds in Blocks")
echo ""
node analytics.js --metric-type roundsInBlocks --network-id $networkID
node analytics.js --metric-type roundsInBlocks
break
;;
"Check Block Hash")
Expand All @@ -50,7 +39,7 @@ do
echo "Error: Block height must be a positive integer."
exit 1
fi
node analytics.js --metric-type checkBlockHash --block-height "$blockHeight" --network-id $networkID
node analytics.js --metric-type checkBlockHash --block-height "$blockHeight"
break
;;
"Quit")
Expand Down
8 changes: 1 addition & 7 deletions .devnet/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ NUM_INSTANCES="${NUM_INSTANCES:-$NODE_ID}"

echo "Using $NUM_INSTANCES AWS EC2 instances for querying."

# Read the network ID from user or use a default value of 1
read -p "Enter the network ID (mainnet = 0, testnet = 1, canary = 2) (default: 1): " NETWORK_ID
NETWORK_ID=${NETWORK_ID:-1}

echo "Using network ID $NETWORK_ID."

# Define a function to terminate the tmux session on a node
terminate_tmux_session() {
local NODE_ID=$1
Expand All @@ -30,7 +24,7 @@ terminate_tmux_session() {
cd \$WORKSPACE
tmux kill-session -t snarkos-session
snarkos clean --dev $NODE_ID --network $NETWORK_ID
snarkos clean --dev $NODE_ID
exit # Exit root user
EOF
Expand Down
8 changes: 1 addition & 7 deletions .devnet/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ NUM_INSTANCES="${NUM_INSTANCES:-$NODE_ID}"

echo "Using $NUM_INSTANCES AWS EC2 instances for querying."

# Read the network ID from user or use a default value of 1
read -p "Enter the network ID (mainnet = 0, testnet = 1, canary = 2) (default: 1): " NETWORK_ID
NETWORK_ID=${NETWORK_ID:-1}

echo "Using network ID $NETWORK_ID."

# Read the verbosity level from the user (default: 1)
read -p "Enter the verbosity level (default: 1): " VERBOSITY
VERBOSITY="${VERBOSITY:-1}"
Expand All @@ -43,7 +37,7 @@ start_snarkos_in_tmux() {
tmux new-session -d -s snarkos-session
# Send the snarkOS start command to the tmux session with the NODE_ID
tmux send-keys -t "snarkos-session" "snarkos start --nodisplay --bft 0.0.0.0:5000 --rest 0.0.0.0:3030 --allow-external-peers --peers $NODE_IP:4130 --validators $NODE_IP:5000 --rest-rps 1000 --verbosity $VERBOSITY --network $NETWORK_ID --dev $NODE_ID --dev-num-validators $NUM_INSTANCES --validator --metrics" C-m
tmux send-keys -t "snarkos-session" "snarkos start --nodisplay --bft 0.0.0.0:5000 --rest 0.0.0.0:3030 --allow-external-peers --peers $NODE_IP:4130 --validators $NODE_IP:5000 --rest-rps 1000 --verbosity $VERBOSITY --dev $NODE_ID --dev-num-validators $NUM_INSTANCES --validator --metrics" C-m
exit # Exit root user
EOF
Expand Down
8 changes: 1 addition & 7 deletions .devnet/start_sync_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ NUM_INSTANCES="${NUM_INSTANCES:-$NODE_ID}"

echo "Using $NUM_INSTANCES AWS EC2 instances for querying."

# Read the network ID from user or use a default value of 1
read -p "Enter the network ID (mainnet = 0, testnet = 1, canary = 2) (default: 1): " NETWORK_ID
NETWORK_ID=${NETWORK_ID:-1}

echo "Using network ID $NETWORK_ID."

# Read the verbosity level from the user (default: 1)
read -p "Enter the verbosity level (default: 1): " VERBOSITY
VERBOSITY="${VERBOSITY:-1}"
Expand All @@ -43,7 +37,7 @@ start_snarkos_in_tmux() {
tmux new-session -d -s snarkos-session
# Send the snarkOS start command to the tmux session with the NODE_ID
tmux send-keys -t "snarkos-session" "snarkos start --client --nocdn --nodisplay --rest 0.0.0.0:3030 --node 0.0.0.0:4130 --verbosity 4 --network $NETWORK_ID --metrics --logfile "/tmp/snarkos-syncing-range-3.log" --peers 167.71.249.65:4130,157.245.218.195:4130,167.71.249.55:4130" C-m
tmux send-keys -t "snarkos-session" "snarkos start --client --nocdn --nodisplay --rest 0.0.0.0:3030 --node 0.0.0.0:4130 --verbosity 4 --metrics --logfile "/tmp/snarkos-syncing-range-3.log" --peers 167.71.249.65:4130,157.245.218.195:4130,167.71.249.55:4130" C-m
exit # Exit root user
EOF
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
wasm/Cargo.lock
**/build
**.ledger-*
**.current-proposal-cache-*
**.logs-*
validator-*
**.bft-storage-*/
Expand Down
Loading

0 comments on commit 07ef982

Please sign in to comment.