Skip to content

Commit

Permalink
Merge pull request #2323 from OriginTrail/v6/release/testnet
Browse files Browse the repository at this point in the history
OriginTrail 6.0.1 Mainnet Release
  • Loading branch information
NZT48 authored Dec 27, 2022
2 parents e85041c + b55477e commit 29cf84e
Show file tree
Hide file tree
Showing 35 changed files with 571 additions and 84 deletions.
6 changes: 6 additions & 0 deletions dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@
- **version**: ^6.21.4
- **description**: used to communicate with sql repository

##### [timeout-abort-controller](https://www.npmjs.com/package/timeout-abort-controller)

- **version**: ^3.0.0
- **description**: timeout network messages


##### [multiformats](https://www.npmjs.com/package/multiformats)

- **version**: ^9.8.1
Expand Down
65 changes: 65 additions & 0 deletions installer/data/archlinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
install_prereqs() {
perform_step install_aliases "Updating .bashrc file with OriginTrail node aliases"
perform_step pacman -Syu --noconfirm "Updating server"
perform_step pacman -S unzip wget jq --noconfirm "Installing unzip, wget, jq"
perform_step pacman -S jre-openjdk --noconfirm "Installing default-jre"
perform_step pacman -S npm nodejs-lts-gallium tcl --noconfirm "Installing npm, nodejs and tcl"
}

install_sql() {
sql=mariadb
perform_step pacman -S mariadb --noconfirm "Downloading mariadb"
perform_step mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql "Installing mariadb"
perform_step systemctl enable mariadb "Enabling mariadb"
perform_step systemctl start mariadb "Starting mariadb"

#check old sql password
OUTPUT=$($sql -u root -e "status;" 2>&1)
if [[ $? -ne 0 ]]; then
while true; do
read -s -p "Enter your old sql password: " oldpassword
echo
echo -n "Password check: "
OUTPUT=$(MYSQL_PWD=$oldpassword $sql -u root -e "status;" 2>&1)
if [[ $? -ne 0 ]]; then
text_color $YELLOW "ERROR - The sql repository password provided does not match your sql password. Please try again."
else
text_color $GREEN "OK"
break
fi
done
fi

#check operationaldb
if [[ -d "/var/lib/mysql/operationaldb/" ]]; then
read -p "Old operationaldb repository detected. Would you like to overwrite it ? (Default: No) [Y]es [N]o [E]xit " choice
case "$choice" in
[yY]* ) perform_step $(MYSQL_PWD=$oldpassword $sql -u root -e "DROP DATABASE IF EXISTS operationaldb;") "Overwritting slq repository";;
[eE]* ) text_color $RED"Installer stopped by user"; exit;;
* ) text_color $GREEN"Keeping previous sql repository"; NEW_DB=FALSE;;
esac
fi

#check sql new password
read -p "Would you like to change your sql password or add one ? (Default: Yes) [Y]es [N]o [E]xit " choice
case "$choice" in
[nN]* ) text_color $GREEN"Keeping previous sql password"; password=$oldpassword;;
[eE]* ) text_color $RED"Installer stopped by user"; exit;;
* ) while true; do
read -s -p "Enter your new sql password: " password
echo
read -s -p "Please confirm your new sql password: " password2
echo
[[ $password = $password2 ]] && break
text_color $YELLOW "Password entered do not match. Please try again."
done
perform_step $(MYSQL_PWD=$oldpassword $sql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$password';") "Changing sql password";;
esac

perform_step $(echo "REPOSITORY_PASSWORD=$password" > $OTNODE_DIR/.env) "Adding sql password to .env"
if [[ $NEW_DB != FALSE ]]; then
perform_step $(MYSQL_PWD=$password $sql -u root -e "CREATE DATABASE operationaldb /*\!40100 DEFAULT CHARACTER SET utf8 */;") "Creating new sql repository"
fi
perform_step $(echo -e "disable_log_bin\nwait_timeout = 31536000\ninteractive_timeout = 31536000" >> /etc/my.cnf.d/server.cnf) "Adding disable_log_bin, wait_timeout, interactive_timeout variables to $sql config"
perform_step systemctl restart $sql "Restarting $sql"
}
6 changes: 3 additions & 3 deletions installer/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ install_fuseki() {

perform_step wget https://dlcdn.apache.org/jena/binaries/$FUSEKI_VER.zip "Downloading Fuseki"
perform_step unzip $FUSEKI_VER.zip "Unzipping Fuseki"
perform_step rm /root/$FUSEKI_VER.zip /root/ot-node/$FUSEKI_VER.zip "Removing Fuseki zip file"
perform_step rm /root/$FUSEKI_VER.zip "Removing Fuseki zip file"
perform_step mkdir /root/ot-node/fuseki "Making /root/ot-node/fuseki directory"
perform_step mkdir /root/ot-node/fuseki/tdb "Making /root/ot-node/fuseki/tdb directory"
perform_step cp /root/$FUSEKI_VER/fuseki-server.jar /root/ot-node/fuseki/ "Copying Fuseki files to $OTNODE_DIR/fuseki/ 1/2"
Expand Down Expand Up @@ -312,12 +312,12 @@ case "$choice" in
esac

if [[ $tripleStore = "ot-fuseki" ]]; then
if [[ -d "/root/fuseki" ]]; then
if [[ -d "$OTNODE_DIR/../fuseki" ]]; then
read -p "Previously installed Fuseki triplestore detected. Would you like to overwrite it? (Default: Yes) [Y]es [N]o [E]xit " choice
case "$choice" in
[nN]* ) text_color $GREEN"Keeping previous Fuseki installation.";;
[eE]* ) text_color $RED"Installer stopped by user"; exit;;
* ) text_color $GREEN"Reinstalling Fuseki."; perform_step rm -rf fuseki* "Removing previous Fuseki installation"; install_fuseki;;
* ) text_color $GREEN"Reinstalling Fuseki."; perform_step rm -rf $OTNODE_DIR/../fuseki "Removing previous Fuseki installation"; install_fuseki;;
esac
else
install_fuseki
Expand Down
67 changes: 43 additions & 24 deletions package-lock.json

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

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "origintrail_node",
"version": "6.0.0",
"description": "OTNode v6 Beta 2",
"version": "6.0.1",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
"scripts": {
Expand Down Expand Up @@ -65,16 +65,16 @@
"solhint": "^3.3.7"
},
"dependencies": {
"assertion-tools": "^2.0.2",
"@polkadot/api": "^9.3.2",
"app-root-path": "^3.1.0",
"@comunica/query-sparql": "^2.4.3",
"@ethersproject/bytes": "^5.6.1",
"@ethersproject/hash": "^5.6.1",
"@ethersproject/wallet": "^5.6.2",
"@polkadot/api": "^9.3.2",
"@polkadot/keyring": "^10.1.4",
"@polkadot/util": "^10.1.4",
"@polkadot/util-crypto": "^10.1.4",
"app-root-path": "^3.1.0",
"assertion-tools": "^2.0.2",
"async": "^3.2.4",
"async-mutex": "^0.3.2",
"awilix": "^7.0.3",
Expand Down Expand Up @@ -120,6 +120,7 @@
"rolling-rate-limiter": "^0.2.13",
"semver": "^7.3.7",
"sequelize": "^6.21.4",
"timeout-abort-controller": "^3.0.0",
"toobusy-js": "^0.5.1",
"uint8arrays": "^3.1.0",
"umzug": "^3.2.1",
Expand Down
1 change: 1 addition & 0 deletions scripts/set-ask.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { ethers } from 'ethers';
import { createRequire } from 'module';
import validateArguments from './utils.js';
Expand Down
1 change: 1 addition & 0 deletions scripts/set-stake.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { ethers } from 'ethers';
import { createRequire } from 'module';
import validateArguments from './utils.js';
Expand Down
5 changes: 5 additions & 0 deletions src/commands/protocols/common/protocol-message-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ProtocolMessageCommand extends Command {
operationId,
keyword,
message,
this.messageTimeout(),
);

switch (response.header.messageType) {
Expand All @@ -67,6 +68,10 @@ class ProtocolMessageCommand extends Command {
}
}

messageTimeout() {
throw Error('messageTimeout not implemented');
}

async handleAck(command) {
return this.continueSequence(command.data, command.sequence);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ProtocolInitCommand from '../../../common/protocol-init-command.js';
import { ERROR_TYPE } from '../../../../../constants/constants.js';
import { NETWORK_MESSAGE_TIMEOUT_MILLS, ERROR_TYPE } from '../../../../../constants/constants.js';

class GetInitCommand extends ProtocolInitCommand {
constructor(ctx) {
Expand All @@ -13,6 +13,10 @@ class GetInitCommand extends ProtocolInitCommand {
return { assertionId: command.data.assertionId };
}

messageTimeout() {
return NETWORK_MESSAGE_TIMEOUT_MILLS.GET.INIT;
}

/**
* Builds default getInitCommand
* @param map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import ProtocolRequestCommand from '../../../common/protocol-request-command.js';
import { ERROR_TYPE, OPERATION_REQUEST_STATUS } from '../../../../../constants/constants.js';
import {
NETWORK_MESSAGE_TIMEOUT_MILLS,
ERROR_TYPE,
OPERATION_REQUEST_STATUS,
} from '../../../../../constants/constants.js';

class GetRequestCommand extends ProtocolRequestCommand {
constructor(ctx) {
Expand Down Expand Up @@ -39,6 +43,10 @@ class GetRequestCommand extends ProtocolRequestCommand {
return this.handleNack(command, responseData);
}

messageTimeout() {
return NETWORK_MESSAGE_TIMEOUT_MILLS.GET.REQUEST;
}

/**
* Builds default getRequest
* @param map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ProtocolInitCommand from '../../../common/protocol-init-command.js';
import { ERROR_TYPE } from '../../../../../constants/constants.js';
import { NETWORK_MESSAGE_TIMEOUT_MILLS, ERROR_TYPE } from '../../../../../constants/constants.js';

class PublishInitCommand extends ProtocolInitCommand {
constructor(ctx) {
Expand All @@ -16,6 +16,10 @@ class PublishInitCommand extends ProtocolInitCommand {
return { assertionId, blockchain, contract, tokenId, keyword, hashFunctionId };
}

messageTimeout() {
return NETWORK_MESSAGE_TIMEOUT_MILLS.PUBLISH.INIT;
}

/**
* Builds default publishInitCommand
* @param map
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ProtocolRequestCommand from '../../../common/protocol-request-command.js';
import { ERROR_TYPE } from '../../../../../constants/constants.js';
import { NETWORK_MESSAGE_TIMEOUT_MILLS, ERROR_TYPE } from '../../../../../constants/constants.js';

class PublishRequestCommand extends ProtocolRequestCommand {
constructor(ctx) {
Expand All @@ -19,6 +19,10 @@ class PublishRequestCommand extends ProtocolRequestCommand {
};
}

messageTimeout() {
return NETWORK_MESSAGE_TIMEOUT_MILLS.PUBLISH.REQUEST;
}

/**
* Builds default publishRequestCommand
* @param map
Expand Down
11 changes: 11 additions & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ export const NETWORK_MESSAGE_TYPES = {
},
};

export const NETWORK_MESSAGE_TIMEOUT_MILLS = {
PUBLISH: {
INIT: 60 * 1000,
REQUEST: 60 * 1000,
},
GET: {
INIT: 60 * 1000,
REQUEST: 60 * 1000,
},
};

export const MAX_OPEN_SESSIONS = 10;

export const ERROR_TYPE = {
Expand Down
Loading

0 comments on commit 29cf84e

Please sign in to comment.