Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OriginTrail Mainnet Release v6.1.2 #2871

Merged
merged 38 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0b0f104
Merge pull request #2844 from OriginTrail/v6/release/mainnet
0xbraindevd Dec 21, 2023
864fc31
V6/improvement/reduce rpc calls (#2834)
milosstanisavljevic Dec 25, 2023
4c74af0
Update installer to work with new blockchain id's for OTP (#2843)
Niks988 Dec 25, 2023
4b5aeb9
Added error handling when bid suggestion call fails
djordjekovac Dec 25, 2023
a3f1b1d
Prevent infinite processing loop on unexpected errors from getting KA
NZT48 Dec 25, 2023
ba0dc28
Handle blazegraph special characters corruption
NZT48 Dec 25, 2023
7ce252e
Added error handling when bid suggestion call fails (#2847)
djordjekovac Dec 25, 2023
c83c41b
Merge branch 'v6/develop' into v6/fix/blazegraph-handling-utf-8
NZT48 Dec 25, 2023
49d9a74
Merge pull request #2848 from OriginTrail/v6/fix/blazegraph-handling-…
NZT48 Dec 25, 2023
49c5260
Bump version to 6.1.1
NZT48 Dec 25, 2023
86d7969
Merge pull request #2849 from OriginTrail/v6/chore/bump-version-6.1.1
NZT48 Dec 25, 2023
0117e94
Merge branch 'v6/develop' into v6/bid-suggestion-bug-fix
djordjekovac Dec 25, 2023
c61b35c
Updated error handling for empty sharding table
djordjekovac Dec 25, 2023
3eb281e
Merge pull request #2850 from OriginTrail/v6/bid-suggestion-bug-fix
NZT48 Dec 25, 2023
1d3f842
Merge pull request #2851 from OriginTrail/v6/develop
NZT48 Dec 25, 2023
d03df94
Merge pull request #2852 from OriginTrail/v6/prerelease/devnet
NZT48 Dec 25, 2023
42828ea
Fix getGas price in set-ask, set-stake and specify which blockchain i…
Mihajlo-Pavlovic Dec 26, 2023
6b02de4
Migration for events synchronization & events chunking for events ins…
NZT48 Dec 26, 2023
fe33bcf
Merge pull request #2856 from OriginTrail/v6/develop
NZT48 Dec 26, 2023
c2ad3f6
Merge pull request #2857 from OriginTrail/v6/prerelease/devnet
NZT48 Dec 26, 2023
b4f464f
Merge pull request #2858 from OriginTrail/v6/development-network
NZT48 Dec 27, 2023
f79eb42
Merge pull request #2859 from OriginTrail/v6/prerelease/testnet
NZT48 Dec 27, 2023
ffcd77b
Resolved issue with cache as class variable
djordjekovac Dec 28, 2023
ab19117
Merge pull request #2860 from OriginTrail/v6/caching-bug-fix
NZT48 Dec 28, 2023
84c0d4c
Merge branch 'v6/prerelease/devnet' into v6/develop
NZT48 Dec 28, 2023
ba1c9e6
Merge pull request #2861 from OriginTrail/v6/develop
NZT48 Dec 28, 2023
d1ada8f
Merge pull request #2862 from OriginTrail/v6/prerelease/devnet
NZT48 Dec 28, 2023
e6fd15d
Merge pull request #2863 from OriginTrail/v6/development-network
NZT48 Dec 28, 2023
9e9c809
Merge pull request #2864 from OriginTrail/v6/prerelease/testnet
NZT48 Dec 28, 2023
9b6369a
Set version to 6.1.2
NZT48 Dec 28, 2023
f05e518
Merge pull request #2865 from OriginTrail/v6/fix-version
NZT48 Dec 28, 2023
509a24e
Merge pull request #2866 from OriginTrail/v6/develop
NZT48 Dec 28, 2023
55b37d3
Merge pull request #2867 from OriginTrail/v6/prerelease/devnet
NZT48 Dec 28, 2023
c026053
Merge pull request #2868 from OriginTrail/v6/development-network
NZT48 Dec 28, 2023
0247820
Merge pull request #2869 from OriginTrail/v6/prerelease/testnet
NZT48 Dec 28, 2023
ffd5049
Fix version conflicts
NZT48 Dec 28, 2023
1854a65
Merge pull request #2870 from OriginTrail/v6/release/testnet
NZT48 Dec 28, 2023
cd0ec11
Merge branch 'v6/release/mainnet' into v6/prerelease/mainnet
NZT48 Dec 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 83 additions & 53 deletions installer/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,60 +253,67 @@ install_node() {
# Change directory to ot-node/current
cd $OTNODE_DIR

#request node env
read -p "Please select node environment: (Default: Mainnet) [T]estnet [M]ainnet [E]xit " choice
# Request node env with strict input validation
while true; do
read -p "Please select node environment: (Default: Mainnet) [T]estnet [M]ainnet [E]xit " choice
case "$choice" in
[tT]* ) nodeEnv="testnet";;
[eE]* ) text_color $RED"Installer stopped by user"; exit;;
* ) nodeEnv="mainnet";;
[tT]* ) nodeEnv="testnet"; break;;
[mM]* ) nodeEnv="mainnet"; break;;
[eE]* ) text_color $RED "Installer stopped by user"; exit;;
* ) text_color $RED "Invalid choice. Please enter either [T]estnet, [M]ainnet, or [E]xit."; continue;;
esac
done
echo "NODE_ENV=$nodeEnv" >> $OTNODE_DIR/.env

#blockchains=("otp" "polygon")
#for ((i = 0; i < ${#blockchains[@]}; ++i));
#do
# read -p "Do you want to connect your node to blockchain: ${blockchains[$i]} ? [Y]Yes [N]No [E]Exit: " choice
# case "$choice" in
# [Yy]* )

# read -p "Enter your substrate operational wallet address: " SUBSTRATE_OPERATIONAL_WALLET
# echo "Substrate operational wallet address: $SUBSTRATE_OPERATIONAL_WALLET"

# read -p "Enter your substrate operational wallet private key: " SUBSTRATE_OPERATIONAL_PRIVATE_KEY
# echo "Substrate operational wallet private key: $SUBSTRATE_OPERATIONAL_PRIVATE_KEY"

read -p "Enter your EVM operational wallet address: " EVM_OPERATIONAL_WALLET
text_color $GREEN "EVM operational wallet address: $EVM_OPERATIONAL_WALLET"
# Blockchains prompt based on the selected environment
if [ "$nodeEnv" == "mainnet" ]; then
blockchain_prompt=("OriginTrail Parachain")
elif [ "$nodeEnv" == "testnet" ]; then
blockchain_prompt=("OriginTrail Parachain")
fi

read -p "Enter your EVM operational wallet private key: " EVM_OPERATIONAL_PRIVATE_KEY
text_color $GREEN "EVM operational wallet private key: $EVM_OPERATIONAL_PRIVATE_KEY"
# 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:
1. ${blockchain_prompt[0]}
Your choice: " blockchain_choice

case "$blockchain_choice" in
[1]* ) blockchain="${blockchain_prompt[0]}"; break;;
[eE]* ) text_color $RED "Installer stopped by user"; exit;;
* ) text_color $RED "Invalid choice. Please enter a valid number."; continue;;
esac
done

# read -p "Enter your substrate management wallet address: " SUBSTRATE_MANAGEMENT_WALLET
# echo "Substrate management wallet address: $SUBSTRATE_MANAGEMENT_WALLET"
# Case statement to handle blockchain-specific configurations
case "$blockchain" in
"OriginTrail Parachain")
# Input wallets for the selected blockchain
read -p "Enter your EVM operational wallet address for $blockchain: " EVM_OPERATIONAL_WALLET
text_color $GREEN "EVM operational wallet address for $blockchain: $EVM_OPERATIONAL_WALLET"

# read -p "Enter your substrate management wallet private key: " SUBSTRATE_MANAGEMENT_WALLET_PRIVATE_KEY
# echo "Substrate management wallet private key: $SUBSTRATE_MANAGEMENT_WALLET_PRIVATE_KEY"
read -p "Enter your EVM operational wallet private key for $blockchain: " EVM_OPERATIONAL_PRIVATE_KEY
text_color $GREEN "EVM operational wallet private key for $blockchain: $EVM_OPERATIONAL_PRIVATE_KEY"

read -p "Enter your EVM management wallet address: " EVM_MANAGEMENT_WALLET
text_color $GREEN "EVM management wallet address: $EVM_MANAGEMENT_WALLET"
read -p "Enter your EVM management wallet address for $blockchain: " EVM_MANAGEMENT_WALLET
text_color $GREEN "EVM management wallet address for $blockchain: $EVM_MANAGEMENT_WALLET"

read -p "Enter your profile shares token name: " SHARES_TOKEN_NAME
text_color $GREEN "Profile shares token name: $SHARES_TOKEN_NAME"
read -p "Enter your profile shares token name for $blockchain: " SHARES_TOKEN_NAME
text_color $GREEN "Profile shares token name for $blockchain: $SHARES_TOKEN_NAME"

read -p "Enter your profile shares token symbol: " SHARES_TOKEN_SYMBOL
text_color $GREEN "Profile shares token name: $SHARES_TOKEN_SYMBOL"
# ;;
# [Nn]* ) ;;
# [Ee]* ) echo "Installer stopped by user"; exit;;
# * ) ((--i));echo "Please make a valid choice and try again.";;
#esac
#done
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"
;;
* )
text_color $RED "Invalid blockchain choice. Exiting installer."
exit;;
esac

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

CONFIG_DIR=$OTNODE_DIR/..
perform_step touch $CONFIG_DIR/.origintrail_noderc "Configuring node config file"
perform_step $(jq --null-input --arg tripleStore "$tripleStore" '{"logLevel": "trace", "auth": {"ipWhitelist": ["::1", "127.0.0.1"]}}' > $CONFIG_DIR/.origintrail_noderc) "Adding loglevel and auth values to node config file"
CONFIG_DIR=$OTNODE_DIR/..
perform_step touch $CONFIG_DIR/.origintrail_noderc "Configuring node config file"
perform_step $(jq --null-input --arg tripleStore "$tripleStore" '{"logLevel": "trace", "auth": {"ipWhitelist": ["::1", "127.0.0.1"]}}' > $CONFIG_DIR/.origintrail_noderc) "Adding loglevel and auth values to node config file"

perform_step $(jq --arg tripleStore "$tripleStore" --arg tripleStoreUrl "$tripleStoreUrl" '.modules.tripleStore.implementation[$tripleStore] |=
{
Expand Down Expand Up @@ -343,16 +350,38 @@ install_node() {

perform_step mv $CONFIG_DIR/origintrail_noderc_tmp $CONFIG_DIR/.origintrail_noderc "Adding node wallets to node config file 2/2"

perform_step $(jq --arg blockchain "otp" --arg evmOperationalWallet "$EVM_OPERATIONAL_WALLET" --arg evmOperationalWalletPrivateKey "$EVM_OPERATIONAL_PRIVATE_KEY" --arg evmManagementWallet "$EVM_MANAGEMENT_WALLET" --arg evmManagementWallet "$SHARES_TOKEN_NAME" --arg evmManagementWallet "$SHARES_TOKEN_SYMBOL" --arg sharesTokenName "$SHARES_TOKEN_NAME" --arg sharesTokenSymbol "$SHARES_TOKEN_SYMBOL" '.modules.blockchain.implementation[$blockchain].config |=
{
"evmOperationalWalletPublicKey": $evmOperationalWallet,
"evmOperationalWalletPrivateKey": $evmOperationalWalletPrivateKey,
"evmManagementWalletPublicKey": $evmManagementWallet,
"sharesTokenName": $sharesTokenName,
"sharesTokenSymbol": $sharesTokenSymbol
} + .' $CONFIG_DIR/.origintrail_noderc > $CONFIG_DIR/origintrail_noderc_tmp) "Adding node wallets to node config file 1/2"
# Set blockchain IDs based on the environment
if [ "$nodeEnv" == "mainnet" ]; then
otp_blockchain_id=2043
else
otp_blockchain_id=20430
fi

perform_step mv $CONFIG_DIR/origintrail_noderc_tmp $CONFIG_DIR/.origintrail_noderc "Adding node wallets to node config file 2/2"


# Single blockchain selected
if [ "$blockchain" = "OriginTrail Parachain" ]; then
blockchain="otp"
blockchain_id="$otp_blockchain_id"
fi

blockchain_arg="$blockchain:$blockchain_id"

perform_step $(jq --arg blockchain_arg "$blockchain_arg" --arg EVM_OPERATIONAL_WALLET "$EVM_OPERATIONAL_WALLET" --arg EVM_OPERATIONAL_PRIVATE_KEY "$EVM_OPERATIONAL_PRIVATE_KEY" --arg EVM_MANAGEMENT_WALLET "$EVM_MANAGEMENT_WALLET" --arg SHARES_TOKEN_NAME "$SHARES_TOKEN_NAME" --arg SHARES_TOKEN_SYMBOL "$SHARES_TOKEN_SYMBOL" '
.modules.blockchain.implementation += {
($blockchain_arg): {
"enabled": true,
"config": {
"evmOperationalWalletPublicKey": $EVM_OPERATIONAL_WALLET,
"evmOperationalWalletPrivateKey": $EVM_OPERATIONAL_PRIVATE_KEY,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET,
"sharesTokenName": $SHARES_TOKEN_NAME,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL
}
}
}' "$CONFIG_DIR/.origintrail_noderc" > "$CONFIG_DIR/origintrail_noderc_tmp") "Adding node wallets to node config file 1/2"

perform_step mv $CONFIG_DIR/origintrail_noderc_tmp $CONFIG_DIR/.origintrail_noderc "Adding node wallets to node config file 2/2"

perform_step cp $OTNODE_DIR/installer/data/otnode.service /lib/systemd/system/ "Copying otnode service file"

Expand Down Expand Up @@ -449,6 +478,9 @@ install_node

header_color $BGREEN"INSTALLATION COMPLETE !"

rm -r /root/ot-node-6-release-testnet
journalctl -u otnode --output cat -fn 200

text_color $GREEN "
New aliases added:
otnode-restart
Expand All @@ -466,5 +498,3 @@ If the logs do not show and the screen hangs, press ctrl+c to exit the installat

"
read -p "Press enter to continue..."

journalctl -u otnode --output cat -fn 200
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.1.1",
"version": "6.1.2",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions scripts/set-ask.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ async function getGasPrice(gasPriceOracleLink) {
if (
gasPriceOracleLink === 'https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice'
) {
gasPrice = Number(response.result, 10);
gasPrice = Number(response.data.result, 10);
} else if (
gasPriceOracleLink === 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle'
) {
gasPrice = Math.round(response.average * 1e9);
gasPrice = Math.round(response.data.average * 1e9);
} else {
gasPrice = Math.round(response.result * 1e9);
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/set-stake.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ async function getGasPrice(gasPriceOracleLink) {
if (
gasPriceOracleLink === 'https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice'
) {
gasPrice = Number(response.result, 10);
gasPrice = Number(response.data.result, 10);
} else if (
gasPriceOracleLink === 'https://blockscout.chiadochain.net/api/v1/gas-price-oracle'
) {
gasPrice = Math.round(response.average * 1e9);
gasPrice = Math.round(response.data.average * 1e9);
} else {
gasPrice = Math.round(response.result * 1e9);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/protocols/common/submit-commit-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class SubmitCommitCommand extends Command {
return Command.empty();
}

const txGasPrice = gasPrice ?? (await this.blockchainModuleManager.getGasPrice());
const txGasPrice = gasPrice ?? (await this.blockchainModuleManager.getGasPrice(blockchain));

const transactionCompletePromise = new Promise((resolve, reject) => {
this.blockchainModuleManager.submitCommit(
Expand Down
2 changes: 1 addition & 1 deletion src/commands/protocols/common/submit-proofs-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class SubmitProofsCommand extends Command {
return Command.empty();
}

const txGasPrice = gasPrice ?? (await this.blockchainModuleManager.getGasPrice());
const txGasPrice = gasPrice ?? (await this.blockchainModuleManager.getGasPrice(blockchain));

const transactionCompletePromise = new Promise((resolve, reject) => {
this.blockchainModuleManager.sendProof(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SubmitUpdateCommitCommand extends Command {
return Command.empty();
}

const txGasPrice = gasPrice ?? (await this.blockchainModuleManager.getGasPrice());
const txGasPrice = gasPrice ?? (await this.blockchainModuleManager.getGasPrice(blockchain));

const transactionCompletePromise = new Promise((resolve, reject) => {
this.blockchainModuleManager.submitUpdateCommit(
Expand Down
30 changes: 30 additions & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ export const CONTRACTS = {
HUB_CONTRACT: 'HubContract',
COMMIT_MANAGER_V1_U1_CONTRACT: 'CommitManagerV1U1Contract',
SERVICE_AGREEMENT_V1_CONTRACT: 'ServiceAgreementV1Contract',
PARAMETERS_STORAGE_CONTRACT: 'ParametersStorageContract',
IDENTITY_STORAGE_CONTRACT: 'IdentityStorageContract',
};

export const CONTRACT_EVENTS = {
Expand All @@ -563,6 +565,7 @@ export const CONTRACT_EVENTS = {
PROFILE: ['AskUpdated'],
COMMIT_MANAGER_V1: ['StateFinalized'],
SERVICE_AGREEMENT_V1: ['ServiceAgreementV1Extended', 'ServiceAgreementV1Terminated'],
PARAMETERS_STORAGE: ['ParameterChanged'],
};

export const NODE_ENVIRONMENTS = {
Expand All @@ -586,3 +589,30 @@ export const BLOCK_TIME_MILLIS = {
};

export const TRANSACTION_CONFIRMATIONS = 1;

export const CACHE_DATA_TYPES = {
NUMBER: 'number',
};

/**
* CACHED_FUNCTIONS:
* ContractName: {
* functionName: returnType
* }
* @type {{IdentityStorageContract: [{name: string, type: string}], ParametersStorageContract: *}}
*/
export const CACHED_FUNCTIONS = {
ParametersStorageContract: {
r0: CACHE_DATA_TYPES.NUMBER,
r1: CACHE_DATA_TYPES.NUMBER,
r2: CACHE_DATA_TYPES.NUMBER,
finalizationCommitsNumber: CACHE_DATA_TYPES.NUMBER,
updateCommitWindowDuration: CACHE_DATA_TYPES.NUMBER,
commitWindowDurationPerc: CACHE_DATA_TYPES.NUMBER,
proofWindowDurationPerc: CACHE_DATA_TYPES.NUMBER,
epochLength: CACHE_DATA_TYPES.NUMBER,
},
IdentityStorageContract: {
getIdentityId: CACHE_DATA_TYPES.NUMBER,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ class BidSuggestionController extends BaseController {
}

async handleRequest(req, res) {
if ((await this.repositoryModuleManager.getPeersCount(req.query.blockchain)) === 0)
this.returnResponse(res, 400, {
code: 400,
message: 'Empty Sharding Table',
if ((await this.repositoryModuleManager.getPeersCount(req.query.blockchain)) === 0) {
const message = `Unable to get bid suggestion. Empty sharding table for blockchain id: ${req.query.blockchain}`;
this.logger.error(message);
this.returnResponse(res, 406, {
code: 406,
message,
});
return;
}

// Uncomment when switch to ethers.js
// if (
Expand Down Expand Up @@ -45,17 +49,24 @@ class BidSuggestionController extends BaseController {
firstAssertionId,
hashFunctionId,
} = req.query;

this.returnResponse(res, 200, {
bidSuggestion: await this.shardingTableService.getBidSuggestion(
try {
const bidSuggestion = await this.shardingTableService.getBidSuggestion(
blockchain,
epochsNumber,
assertionSize,
contentAssetStorageAddress,
firstAssertionId,
hashFunctionId,
),
});
);

this.returnResponse(res, 200, { bidSuggestion });
} catch (error) {
this.logger.error(`Unable to get bid suggestion. Error: ${error}`);
this.returnResponse(res, 500, {
code: 500,
message: 'Unable to calculate bid suggestion',
});
}
}
}

Expand Down
Loading