Skip to content

Commit

Permalink
Merge pull request #1153 from ainblockchain/release/v1.0.13
Browse files Browse the repository at this point in the history
Release/v1.0.13
  • Loading branch information
platfowner committed Apr 20, 2023
2 parents 7c1be49 + e52775d commit 9ca9812
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [ '14.x', '16.x' ]
node-version: [ '18.x' ]
runs-on: ${{ matrix.os }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ You can use some environment variables, and these have the following options.
```
After the node is executed, you should inject your account into the node.
```
node inject_account_gcp.js <NODE_ENDPOINT_URL> --private-key
node inject_account_gcp.js <NODE_ENDPOINT_URL> --keystore
node inject_account_gcp.js <NODE_ENDPOINT_URL> --mnemonic
node inject_node_account.js <NODE_ENDPOINT_URL> --private-key
node inject_node_account.js <NODE_ENDPOINT_URL> --keystore
node inject_node_account.js <NODE_ENDPOINT_URL> --mnemonic
```
If you want to inject your account automatically, add one of these environment variables before running the node.
```
Expand Down
3 changes: 3 additions & 0 deletions client/protocol_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,8 @@
},
"1.0.12": {
"min": "1.0.0"
},
"1.0.13": {
"min": "1.0.0"
}
}
10 changes: 6 additions & 4 deletions deploy_blockchain_genesis_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

if [[ $# -lt 2 ]] || [[ $# -gt 8 ]]; then
printf "Usage: bash deploy_blockchain_genesis_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data] [--kill-only|--skip-kill]\n"
printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --setup --keystore --no-keep-code --no-chown-data\n"
printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --keystore --no-keep-code --keep-data\n"
printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --keystore --keep-code --keep-data\n"
printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --setup --keystore --no-keep-code\n"
printf "\n"
exit
fi
Expand Down Expand Up @@ -158,7 +160,7 @@ function inject_account() {
echo $KEYSTORE_FILE_PATH
sleep 1
echo $PASSWORD
} | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
} | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
elif [[ "$ACCOUNT_INJECTION_OPTION" = "--mnemonic" ]]; then
local MNEMONIC=${MNEMONIC_LIST[${node_index}]}
printf "\n* >> Injecting an account for node $node_index ********************\n\n"
Expand All @@ -167,7 +169,7 @@ function inject_account() {
echo $MNEMONIC
sleep 1
echo 0
} | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
} | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
else
printf "\n* >> Injecting an account for node $node_index ********************\n\n"
printf "node_ip_addr='$node_ip_addr'\n"
Expand All @@ -176,7 +178,7 @@ function inject_account() {
GENESIS_ACCOUNTS_PATH="blockchain-configs/testnet-prod/genesis_accounts.json"
fi
PRIVATE_KEY=$(cat $GENESIS_ACCOUNTS_PATH | jq -r '.others['$node_index'].private_key')
echo $PRIVATE_KEY | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
echo $PRIVATE_KEY | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
fi
}

Expand Down
11 changes: 7 additions & 4 deletions deploy_blockchain_incremental_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

if [[ $# -lt 4 ]] || [[ $# -gt 11 ]]; then
printf "Usage: bash deploy_blockchain_incremental_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> <Begin Parent Node Index> <End Parent Node Index> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data]\n"
printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 -1 1 --setup --keystore --no-keep-code --full-sync --no-chown-data\n"
printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 -1 9 --keystore --no-keep-code --keep-data\n"
printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 0 0 --keystore --keep-code --keep-data\n"
printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 0 0 --setup --keystore --no-keep-code --keep-data\n"
printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 -1 -1 --setup --keystore --no-keep-code\n"
printf "Note: <Begin Parent Node Index> = -1 is for tracker\n"
printf "Note: <End Parent Node Index> is inclusive\n"
printf "\n"
Expand Down Expand Up @@ -266,7 +269,7 @@ function deploy_node() {
echo $KEYSTORE_FILE_PATH
sleep 1
echo $PASSWORD
} | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
} | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
elif [[ $ACCOUNT_INJECTION_OPTION = "--mnemonic" ]]; then
local node_ip_addr=${IP_ADDR_LIST[${node_index}]}
local MNEMONIC=${MNEMONIC_LIST[${node_index}]}
Expand All @@ -277,7 +280,7 @@ function deploy_node() {
echo $MNEMONIC
sleep 1
echo 0
} | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
} | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
else
local node_ip_addr=${IP_ADDR_LIST[${node_index}]}
printf "\n* >> Injecting an account for node $node_index ($node_target_addr) ********************\n\n"
Expand All @@ -287,7 +290,7 @@ function deploy_node() {
GENESIS_ACCOUNTS_PATH="blockchain-configs/testnet-prod/genesis_accounts.json"
fi
PRIVATE_KEY=$(cat $GENESIS_ACCOUNTS_PATH | jq -r '.others['$node_index'].private_key')
echo $PRIVATE_KEY | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
echo $PRIVATE_KEY | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
fi

# 5. Wait until node is synced
Expand Down
2 changes: 1 addition & 1 deletion deploy_blockchain_sandbox_gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function inject_account() {
printf "\n* >> Injecting an account for node $node_index ********************\n\n"
printf "node_ip_addr='$node_ip_addr'\n"
PRIVATE_KEY=$(cat $GENESIS_ACCOUNTS_PATH | jq -r '.others['$node_index'].private_key')
echo $PRIVATE_KEY | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
echo $PRIVATE_KEY | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION
}

# GCP node address
Expand Down
11 changes: 6 additions & 5 deletions deploy_monitoring_gcp.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

if [[ "$#" -lt 2 ]]; then
printf "Usage: bash deploy_monitoring_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <GCP Username> [--setup]\n"
printf "Example: bash deploy_monitoring_gcp.sh dev gcp_user \n"
if [[ "$#" -lt 1 ]]; then
printf "Usage: bash deploy_monitoring_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [--setup]\n"
printf "Example: bash deploy_monitoring_gcp.sh dev --setup\n"
printf "Example: bash deploy_monitoring_gcp.sh dev\n"
printf "\n"
exit
fi
Expand All @@ -24,10 +25,10 @@ fi
printf "SEASON=$SEASON\n"
printf "PROJECT_ID=$PROJECT_ID\n"

GCP_USER="$2"
GCP_USER="runner"
printf "GCP_USER=$GCP_USER\n"

OPTIONS="$3"
OPTIONS="$2"
printf "OPTIONS=$OPTIONS\n"

# Get confirmation.
Expand Down
2 changes: 1 addition & 1 deletion inject_account_gcp.js → inject_node_account.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async function processArguments() {
}

function usage() {
console.log('\nExample commandlines:\n node inject_account_gcp.js <ENDPOINT_URL> <ACCOUNT_INJECTION_OPTION>\n');
console.log('\nExample commandlines:\n node inject_node_account.js <ENDPOINT_URL> <ACCOUNT_INJECTION_OPTION>\n');
process.exit(0);
}

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ain-blockchain",
"description": "AI Network Blockchain",
"version": "1.0.12",
"version": "1.0.13",
"private": true,
"license": "MIT",
"author": "[email protected]",
Expand All @@ -10,7 +10,7 @@
"url": "https://github.com/ainblockchain/ain-blockchain"
},
"engines": {
"node": ">=14"
"node": ">=18"
},
"scripts": {
"client": "UNSAFE_PRIVATE_KEY=b22c95ffc4a5c096f7d7d0487ba963ce6ac945bdc91c79b64ce209de289bec96 DEBUG=true node ./client/index.js",
Expand Down
26 changes: 16 additions & 10 deletions setup_blockchain_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

printf "\n[[[[[ setup_blockchain_ubuntu.sh ]]]]]\n\n"

printf 'Upgrading apt..\n'
printf '\n[[ Upgrading apt.. ]]\n'
sudo apt update
# skip prompting (see https://serverfault.com/questions/527789/how-to-automate-changed-config-files-during-apt-get-upgrade-in-ubuntu-12)
apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
sudo apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade

printf 'Installing NodeJS..\n'
printf '\n[[ Uninstalling NodeJS.. ]]\n'
sudo apt-get -y purge nodejs
sudo apt-get -y autoremove

printf '\n[[ Installing NodeJS.. ]]\n'
sudo apt update
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt -y install nodejs
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
# skip prompting for daemon restart (see https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services)
sudo NEEDRESTART_MODE=a apt -y install nodejs

printf 'node -v\n'
node -v
Expand All @@ -20,29 +25,30 @@ printf 'npm --version\n'
npm --version


printf 'Installing yarn..\n'
printf '\n[[ Installing yarn.. ]]\n'
sudo npm install -g yarn

printf 'yarn --version\n'
sudo yarn --version


printf 'Installing make..\n'
printf '\n[[ Installing make.. ]]\n'
sudo apt update
sudo apt-get install -y build-essential
# skip prompting for daemon restart (see https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services)
sudo NEEDRESTART_MODE=a apt-get install -y build-essential

printf 'make --version\n'
make --version


printf 'Installing vim..\n'
printf '\n[[ Installing vim.. ]]\n'
sudo apt update
sudo apt install -y vim

printf 'vim --version\n'
vim --version

printf 'Installing jq..\n'
printf '\n[[ Installing jq.. ]]\n'
sudo apt update
sudo apt install -y jq

Expand Down
5 changes: 3 additions & 2 deletions setup_monitoring_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ printf "\n[[[[[ setup_monitoring_ubuntu.sh ]]]]]\n\n"

printf 'Installing NodeJS..\n'
sudo apt update
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs

printf 'node -v\n'
Expand Down Expand Up @@ -54,4 +54,5 @@ wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

sudo apt-get update
sudo apt-get install -y grafana
# NOTE(platfowner): Fix grafana version to 8.5.13 for compatibility.
sudo apt-get install -y grafana=8.5.13
6 changes: 3 additions & 3 deletions start_node_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ elif [[ $ACCOUNT_INJECTION_OPTION = "private_key" ]]; then
if [[ -z "$PRIVATE_KEY" ]]; then
printf 'You should manually inject your account into this node.\n'
else
echo $PRIVATE_KEY | node inject_account_gcp.js $NODE_ENDPOINT --private-key
echo $PRIVATE_KEY | node inject_node_account.js $NODE_ENDPOINT --private-key
unset PRIVATE_KEY
fi
elif [[ $ACCOUNT_INJECTION_OPTION = "keystore" ]]; then
Expand All @@ -42,7 +42,7 @@ elif [[ $ACCOUNT_INJECTION_OPTION = "keystore" ]]; then
echo $KEYSTORE_FILE_PATH
sleep 1
echo $PASSWORD
} | node inject_account_gcp.js $NODE_ENDPOINT --keystore
} | node inject_node_account.js $NODE_ENDPOINT --keystore
fi
elif [[ $ACCOUNT_INJECTION_OPTION = "mnemonic" ]]; then
if [[ -z "$MNEMONIC" ]]; then
Expand All @@ -52,7 +52,7 @@ elif [[ $ACCOUNT_INJECTION_OPTION = "mnemonic" ]]; then
echo $MNEMONIC
sleep 1
echo 0
} | node inject_account_gcp.js $NODE_ENDPOINT --mnemonic
} | node inject_node_account.js $NODE_ENDPOINT --mnemonic
unset MNEMONIC
fi
else
Expand Down

0 comments on commit 9ca9812

Please sign in to comment.