Skip to content

Commit

Permalink
Merge pull request #3048 from OriginTrail/v6/prerelease/mainnet
Browse files Browse the repository at this point in the history
OriginTrail Mainnet Release v6.2.1
  • Loading branch information
djordjekovac authored Feb 27, 2024
2 parents 51b6985 + 8f5f6ee commit 96cf197
Show file tree
Hide file tree
Showing 38 changed files with 1,318 additions and 393 deletions.
10 changes: 5 additions & 5 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"maximumAssertionSizeInKb": 10000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "info",
Expand Down Expand Up @@ -305,7 +305,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"maximumAssertionSizeInKb": 10000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down Expand Up @@ -471,7 +471,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"maximumAssertionSizeInKb": 10000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down Expand Up @@ -637,7 +637,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"maximumAssertionSizeInKb": 10000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down Expand Up @@ -803,7 +803,7 @@
}
}
},
"maximumAssertionSizeInKb": 2500,
"maximumAssertionSizeInKb": 10000,
"commandExecutorVerboseLoggingEnabled": false,
"appDataPath": "data",
"logLevel": "trace",
Expand Down
101 changes: 72 additions & 29 deletions installer/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ install_sql() {
request_operational_wallet_keys() {
WALLET_ADDRESSES=()
WALLET_PRIVATE_KEYS=()

echo "You'll now be asked to input addresses and private keys of your operational wallets for $1. Input an empty value to stop."
wallet_no=1
while true; do
Expand All @@ -263,15 +263,15 @@ request_operational_wallet_keys() {
read -p "Please input the private key for your $1 operational wallet no. $wallet_no:" private_key
[[ -z $private_key ]] && break
text_color $GREEN "EVM operational wallet private key for $blockchain wallet no. $wallet_no: $private_key"

WALLET_ADDRESSES+=($address)
WALLET_PRIVATE_KEYS+=($private_key)
wallet_no=$((wallet_no + 1))
done

OP_WALLET_KEYS_JSON=$(jq -n '
[
$ARGS.positional as $args
$ARGS.positional as $args
| ($args | length / 2) as $upto
| range(0; $upto) as $start
| [{ evmAddress: $args[$start], privateKey: $args[$start + $upto] }]
Expand Down Expand Up @@ -302,6 +302,7 @@ elif [ "$nodeEnv" == "testnet" ]; then
blockchain_prompt=("OriginTrail Parachain" "Gnosis" "Both")
fi


# Ask user which blockchain to connect to with strict input validation
while true; do
read -p "Please select the blockchain you want to connect your node to:
Expand All @@ -319,9 +320,33 @@ while true; do
esac
done


# Function to validate Operator Fees input
validate_operator_fees() {
local blockchain=$1
local operator_fee_variable="${blockchain}_OPERATOR_FEES"

read -p "Enter Operator Fees (0% - 100%) for $blockchain: " OPERATOR_FEES
if (( OPERATOR_FEES >= 0 && OPERATOR_FEES <= 100 )); then
text_color $GREEN "Operator Fees for $blockchain: $OPERATOR_FEES"
eval "${operator_fee_variable}=$OPERATOR_FEES"
else
text_color $RED "Please enter Operator Fees in the range of 0% - 100%. Try again."
validate_operator_fees $blockchain
fi
}


# Case statement to handle blockchain-specific configurations
case "$blockchain" in
"OriginTrail Parachain" | "Gnosis" )


if [ "$blockchain" == "OriginTrail Parachain" ]; then
blockchain="OTP"
fi


# Input wallets for the selected blockchain
request_operational_wallet_keys $blockchain
EVM_OP_WALLET_KEYS_BLOCKCHAIN=$OP_WALLET_KEYS_JSON
Expand All @@ -335,9 +360,13 @@ case "$blockchain" in
read -p "Enter your profile shares token symbol for $blockchain: " SHARES_TOKEN_SYMBOL
text_color $GREEN "Profile shares token symbol for $blockchain: $SHARES_TOKEN_SYMBOL"

# Prompt and validate Operator Fees for the first blockchain
validate_operator_fees $blockchain
eval "OPERATOR_FEE=\$${blockchain}_OPERATOR_FEES"

if [ "$blockchain" == "Gnosis" ]; then
read -p "Enter your Gnosis RPC endpoint: " GNOSIS_RPC_ENDPOINT
text_color $GREEN "Gnosis RPC endpoint: $GNOSIS_RPC_ENDPOINT"
text_color $GREEN "Gnosis RPC endpoint: $GNOSIS_RPC_ENDPOINT"
fi


Expand All @@ -364,6 +393,10 @@ case "$blockchain" in
read -p "Enter your profile shares token symbol for $blockchain1: " SHARES_TOKEN_SYMBOL
text_color $GREEN "Profile shares token symbol for $blockchain1: $SHARES_TOKEN_SYMBOL"

# Prompt and validate Operator Fees for the first blockchain
validate_operator_fees $blockchain1
OPERATOR_FEES_1=$OTP_OPERATOR_FEES

# Input wallets for the second blockchain
request_operational_wallet_keys $blockchain2
EVM_OP_WALLET_KEYS_BLOCKCHAIN2=$OP_WALLET_KEYS_JSON
Expand All @@ -377,6 +410,11 @@ case "$blockchain" in
read -p "Enter your profile shares token symbol for $blockchain2: " SHARES_TOKEN_SYMBOL_2
text_color $GREEN "Profile shares token symbol for $blockchain2: $SHARES_TOKEN_SYMBOL_2"

# Prompt and validate Operator Fees for the second blockchain
validate_operator_fees $blockchain2
OPERATOR_FEES_2=$Gnosis_OPERATOR_FEES


read -p "Enter your Gnosis RPC endpoint: " GNOSIS_RPC_ENDPOINT
text_color $GREEN "Gnosis RPC endpoint: $GNOSIS_RPC_ENDPOINT"

Expand All @@ -386,6 +424,7 @@ case "$blockchain" in
exit;;
esac


perform_step npm ci --omit=dev --ignore-scripts "Executing npm install"

CONFIG_DIR=$OTNODE_DIR/..
Expand Down Expand Up @@ -439,15 +478,16 @@ fi

# Check if "Both" blockchains are selected
if [ "$blockchain" == "Both" ]; then
perform_step $(jq --arg otp_blockchain_id "$otp_blockchain_id" --argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN1 "$EVM_OP_WALLET_KEYS_BLOCKCHAIN1" --argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN2 "$EVM_OP_WALLET_KEYS_BLOCKCHAIN2" --arg EVM_MANAGEMENT_WALLET "$EVM_MANAGEMENT_WALLET" --arg SHARES_TOKEN_NAME "$SHARES_TOKEN_NAME" --arg SHARES_TOKEN_SYMBOL "$SHARES_TOKEN_SYMBOL" --arg gnosis_blockchain_id "$gnosis_blockchain_id" --arg EVM_OPERATIONAL_WALLET_2 "$EVM_OPERATIONAL_WALLET_2" --arg EVM_OPERATIONAL_PRIVATE_KEY_2 "$EVM_OPERATIONAL_PRIVATE_KEY_2" --arg EVM_MANAGEMENT_WALLET_2 "$EVM_MANAGEMENT_WALLET_2" --arg SHARES_TOKEN_NAME_2 "$SHARES_TOKEN_NAME_2" --arg SHARES_TOKEN_SYMBOL_2 "$SHARES_TOKEN_SYMBOL_2" --arg GNOSIS_RPC_ENDPOINT "$GNOSIS_RPC_ENDPOINT" '
perform_step $(jq --arg otp_blockchain_id "$otp_blockchain_id" --argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN1 "$EVM_OP_WALLET_KEYS_BLOCKCHAIN1" --argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN2 "$EVM_OP_WALLET_KEYS_BLOCKCHAIN2" --arg EVM_MANAGEMENT_WALLET "$EVM_MANAGEMENT_WALLET" --arg SHARES_TOKEN_NAME "$SHARES_TOKEN_NAME" --arg SHARES_TOKEN_SYMBOL "$SHARES_TOKEN_SYMBOL" --argjson OPERATOR_FEES_1 "$OPERATOR_FEES_1" --argjson OPERATOR_FEES_2 "$OPERATOR_FEES_2" --arg gnosis_blockchain_id "$gnosis_blockchain_id" --arg EVM_OPERATIONAL_WALLET_2 "$EVM_OPERATIONAL_WALLET_2" --arg EVM_OPERATIONAL_PRIVATE_KEY_2 "$EVM_OPERATIONAL_PRIVATE_KEY_2" --arg EVM_MANAGEMENT_WALLET_2 "$EVM_MANAGEMENT_WALLET_2" --arg SHARES_TOKEN_NAME_2 "$SHARES_TOKEN_NAME_2" --arg SHARES_TOKEN_SYMBOL_2 "$SHARES_TOKEN_SYMBOL_2" --arg GNOSIS_RPC_ENDPOINT "$GNOSIS_RPC_ENDPOINT" '
.modules.blockchain.implementation += {
"otp:'$otp_blockchain_id'": {
"enabled": true,
"config": {
"operationalWallets": $EVM_OP_WALLET_KEYS_BLOCKCHAIN1,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET,
"sharesTokenName": $SHARES_TOKEN_NAME,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL,
"operatorFee": $OPERATOR_FEES_1
}
},
"gnosis:'$gnosis_blockchain_id'": {
Expand All @@ -457,14 +497,16 @@ if [ "$blockchain" == "Both" ]; then
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET_2,
"sharesTokenName": $SHARES_TOKEN_NAME_2,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL_2,
"rpcEndpoints": [$GNOSIS_RPC_ENDPOINT]
"operatorFee": $OPERATOR_FEES_2,
"rpcEndpoints": [$GNOSIS_RPC_ENDPOINT]
}
}
}' $CONFIG_DIR/.origintrail_noderc > $CONFIG_DIR/origintrail_noderc_tmp) "Adding node wallets to node config file 1/2 for Both"

else


# Single blockchain selected
if [ "$blockchain" = "OriginTrail Parachain" ]; then
if [ "$blockchain" = "OriginTrail Parachain" ] || [ "$blockchain" = "OTP" ]; then
blockchain="otp"
blockchain_id="$otp_blockchain_id"
elif [ "$blockchain" = "Gnosis" ]; then
Expand All @@ -476,29 +518,30 @@ else
ADD_GNOSIS_RPC="true"
fi


blockchain_arg="$blockchain:$blockchain_id"

jq --arg blockchain_arg "$blockchain_arg" \
--argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN "$EVM_OP_WALLET_KEYS_BLOCKCHAIN" \
--arg EVM_MANAGEMENT_WALLET "$EVM_MANAGEMENT_WALLET" \
--arg SHARES_TOKEN_NAME "$SHARES_TOKEN_NAME" \
--arg SHARES_TOKEN_SYMBOL "$SHARES_TOKEN_SYMBOL" \
--argjson ADD_GNOSIS_RPC "$ADD_GNOSIS_RPC" \
--arg GNOSIS_RPC_ENDPOINT "$GNOSIS_RPC_ENDPOINT" '
(.modules.blockchain.implementation += {
($blockchain_arg): {
"enabled": true,
"config": {
"operationalWallets": $EVM_OP_WALLET_KEYS_BLOCKCHAIN,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET,
"sharesTokenName": $SHARES_TOKEN_NAME,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL
}
}
}) | if $ADD_GNOSIS_RPC then .blockchain.implementation[$blockchain_arg].config += {"rpcEndpoints": [$GNOSIS_RPC_ENDPOINT]} else . end
' "$CONFIG_DIR/.origintrail_noderc" > "$CONFIG_DIR/origintrail_noderc_tmp"
jq --arg blockchain_arg "$blockchain_arg" \
--argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN "$EVM_OP_WALLET_KEYS_BLOCKCHAIN" \
--arg EVM_MANAGEMENT_WALLET "$EVM_MANAGEMENT_WALLET" \
--arg SHARES_TOKEN_NAME "$SHARES_TOKEN_NAME" \
--arg SHARES_TOKEN_SYMBOL "$SHARES_TOKEN_SYMBOL" \
--argjson ADD_GNOSIS_RPC "$ADD_GNOSIS_RPC" \
--argjson OPERATOR_FEE $OPERATOR_FEE \
--arg GNOSIS_RPC_ENDPOINT "$GNOSIS_RPC_ENDPOINT" '
(.modules.blockchain.implementation += {
($blockchain_arg): {
"enabled": true,
"config": {
"operationalWallets": $EVM_OP_WALLET_KEYS_BLOCKCHAIN,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET,
"sharesTokenName": $SHARES_TOKEN_NAME,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL,
"operatorFee": $OPERATOR_FEE
}
}
}) | if $ADD_GNOSIS_RPC then .modules.blockchain.implementation[$blockchain_arg].config += {"rpcEndpoints": [$GNOSIS_RPC_ENDPOINT]} else . end
' "$CONFIG_DIR/.origintrail_noderc" > "$CONFIG_DIR/origintrail_noderc_tmp"
fi

perform_step mv $CONFIG_DIR/origintrail_noderc_tmp $CONFIG_DIR/.origintrail_noderc "Adding node wallets to node config file 2/2"
Expand Down
2 changes: 2 additions & 0 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import OtAutoUpdater from './src/modules/auto-updater/implementation/ot-auto-upd
import MigrationExecutor from './src/migration/migration-executor.js';

const require = createRequire(import.meta.url);
const { setTimeout } = require('timers/promises');
const pjson = require('./package.json');
const configjson = require('./config/config.json');

Expand Down Expand Up @@ -220,6 +221,7 @@ class OTNode {
`npm run set-stake -- --rpcEndpoint=${blockchainConfig.rpcEndpoints[0]} --stake=${blockchainConfig.initialStakeAmount} --operationalWalletPrivateKey=${blockchainConfig.operationalWallets[0].privateKey} --managementWalletPrivateKey=${blockchainConfig.evmManagementWalletPrivateKey} --hubContractAddress=${blockchainConfig.hubContractAddress}`,
{ stdio: 'inherit' },
);
await setTimeout(10000);
execSync(
`npm run set-ask -- --rpcEndpoint=${
blockchainConfig.rpcEndpoints[0]
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.2.0",
"version": "6.2.1",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
Loading

0 comments on commit 96cf197

Please sign in to comment.