Skip to content

Commit

Permalink
Merge pull request #2965 from OriginTrail/revert-2964-v6/develop
Browse files Browse the repository at this point in the history
Revert "OriginTrail Devnet Prerelease v6.2.0 Hotfix 10"
  • Loading branch information
NZT48 authored Feb 9, 2024
2 parents 491baf8 + ec868a5 commit d7cd260
Show file tree
Hide file tree
Showing 23 changed files with 5,701 additions and 10,351 deletions.
30 changes: 10 additions & 20 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@
"rpcEndpoints": ["http://localhost:8545"],
"evmManagementPublicKey": "0x1B420da5f7Be66567526E32bc68ab29F1A63765A",
"initialStakeAmount": 50000,
"initialAskAmount": 0.2,
"operatorFee": 0
"initialAskAmount": 0.2
}
},
"hardhat2:31337": {
Expand All @@ -132,8 +131,7 @@
"rpcEndpoints": ["http://localhost:9545"],
"evmManagementPublicKey": "0x1B420da5f7Be66567526E32bc68ab29F1A63765A",
"initialStakeAmount": 50000,
"initialAskAmount": 0.2,
"operatorFee": 0
"initialAskAmount": 0.2
}
}
}
Expand Down Expand Up @@ -264,8 +262,7 @@
"hubContractAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"rpcEndpoints": ["http://localhost:8545"],
"initialStakeAmount": 50000,
"initialAskAmount": 0.2,
"operatorFee": 0
"initialAskAmount": 0.2
}
},
"hardhat2:31337": {
Expand All @@ -275,8 +272,7 @@
"hubContractAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"rpcEndpoints": ["http://localhost:9545"],
"initialStakeAmount": 50000,
"initialAskAmount": 0.2,
"operatorFee": 0
"initialAskAmount": 0.2
}
}
}
Expand Down Expand Up @@ -410,8 +406,7 @@
"rpcEndpoints": [
"https://lofar-testnet.origin-trail.network",
"https://lofar-testnet.origintrail.network"
],
"operatorFee": 0
]
}
},
"gnosis:10200": {
Expand All @@ -421,8 +416,7 @@
"config": {
"hubContractAddress": "0xC06210312C9217A0EdF67453618F5eB96668679A",
"gasPriceOracleLink": "https://blockscout.chiadochain.net/api/v1/gas-price-oracle",
"rpcEndpoints": ["https://rpc.chiadochain.net"],
"operatorFee": 0
"rpcEndpoints": ["https://rpc.chiadochain.net"]
}
}
}
Expand Down Expand Up @@ -576,8 +570,7 @@
"rpcEndpoints": [
"https://lofar-tm-rpc.origin-trail.network",
"https://lofar.origintrail.network"
],
"operatorFee": 0
]
}
},
"gnosis:10200": {
Expand All @@ -587,8 +580,7 @@
"config": {
"hubContractAddress": "0xD2bA102A0b11944d00180eE8136208ccF87bC39A",
"gasPriceOracleLink": "https://blockscout.chiadochain.net/api/v1/gas-price-oracle",
"rpcEndpoints": ["https://rpc.chiadochain.net"],
"operatorFee": 0
"rpcEndpoints": ["https://rpc.chiadochain.net"]
}
}
}
Expand Down Expand Up @@ -744,8 +736,7 @@
"https://astrosat-parachain-rpc.origin-trail.network",
"https://astrosat.origintrail.network/",
"https://astrosat-2.origintrail.network/"
],
"operatorFee": 0
]
}
},
"gnosis:100": {
Expand All @@ -754,8 +745,7 @@
"config": {
"hubContractAddress": "0xbEF14fc04F870c2dD65c13Df4faB6ba01A9c746b",
"gasPriceOracleLink": "https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice",
"rpcEndpoints": ["https://rpc.gnosischain.com/"],
"operatorFee": 0
"rpcEndpoints": ["https://rpc.gnosischain.com/"]
}
}
}
Expand Down
69 changes: 25 additions & 44 deletions installer/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -249,36 +249,6 @@ install_sql() {
perform_step systemctl restart $sql "Restarting $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
read -p "Please input the address for your $1 operational wallet no. $wallet_no:" address
[[ -z $address ]] && break
text_color $GREEN "EVM operational wallet address for $blockchain wallet no. $wallet_no: $address"

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 | length / 2) as $upto
| range(0; $upto) as $start
| [{ evmAddress: $args[$start], privateKey: $args[$start + $upto] }]
] | add
' --args "${WALLET_ADDRESSES[@]}" "${WALLET_PRIVATE_KEYS[@]}")
}

install_node() {
# Change directory to ot-node/current
cd $OTNODE_DIR
Expand All @@ -297,7 +267,7 @@ install_node() {

# Blockchains prompt based on the selected environment
if [ "$nodeEnv" == "mainnet" ]; then
blockchain_prompt=("OriginTrail Parachain" "Gnosis" "Both")
blockchain_prompt=("OriginTrail Parachain")
elif [ "$nodeEnv" == "testnet" ]; then
blockchain_prompt=("OriginTrail Parachain" "Gnosis" "Both")
fi
Expand All @@ -323,8 +293,11 @@ done
case "$blockchain" in
"OriginTrail Parachain" | "Gnosis" )
# Input wallets for the selected blockchain
request_operational_wallet_keys $blockchain
EVM_OP_WALLET_KEYS_BLOCKCHAIN=$OP_WALLET_KEYS_JSON
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 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 for $blockchain: " EVM_MANAGEMENT_WALLET
text_color $GREEN "EVM management wallet address for $blockchain: $EVM_MANAGEMENT_WALLET"
Expand All @@ -345,15 +318,17 @@ case "$blockchain" in
"Both" )
if [ "$nodeEnv" == "mainnet" ]; then
blockchain1="OTP"
blockchain2="Gnosis"
elif [ "$nodeEnv" == "testnet" ]; then
blockchain1="OTP"
blockchain2="Gnosis"
fi

# Input wallets for the first blockchain
request_operational_wallet_keys $blockchain1
EVM_OP_WALLET_KEYS_BLOCKCHAIN1=$OP_WALLET_KEYS_JSON
read -p "Enter your EVM operational wallet address for $blockchain1: " EVM_OPERATIONAL_WALLET
text_color $GREEN "EVM operational wallet address for $blockchain1: $EVM_OPERATIONAL_WALLET"

read -p "Enter your EVM operational wallet private key for $blockchain1: " EVM_OPERATIONAL_PRIVATE_KEY
text_color $GREEN "EVM operational wallet private key for $blockchain1: $EVM_OPERATIONAL_PRIVATE_KEY"

read -p "Enter your EVM management wallet address for $blockchain1: " EVM_MANAGEMENT_WALLET
text_color $GREEN "EVM management wallet address for $blockchain1: $EVM_MANAGEMENT_WALLET"
Expand All @@ -365,8 +340,11 @@ case "$blockchain" in
text_color $GREEN "Profile shares token symbol for $blockchain1: $SHARES_TOKEN_SYMBOL"

# Input wallets for the second blockchain
request_operational_wallet_keys $blockchain2
EVM_OP_WALLET_KEYS_BLOCKCHAIN2=$OP_WALLET_KEYS_JSON
read -p "Enter your EVM operational wallet address for $blockchain2: " EVM_OPERATIONAL_WALLET_2
text_color $GREEN "EVM operational wallet address for $blockchain2: $EVM_OPERATIONAL_WALLET_2"

read -p "Enter your EVM operational wallet private key for $blockchain2: " EVM_OPERATIONAL_PRIVATE_KEY_2
text_color $GREEN "EVM operational wallet private key for $blockchain2: $EVM_OPERATIONAL_PRIVATE_KEY_2"

read -p "Enter your EVM management wallet address for $blockchain2: " EVM_MANAGEMENT_WALLET_2
text_color $GREEN "EVM management wallet address for $blockchain2: $EVM_MANAGEMENT_WALLET_2"
Expand Down Expand Up @@ -431,20 +409,20 @@ perform_step $(jq --null-input --arg tripleStore "$tripleStore" '{"logLevel": "t
# Set blockchain IDs based on the environment
if [ "$nodeEnv" == "mainnet" ]; then
otp_blockchain_id=2043
gnosis_blockchain_id=100
else
otp_blockchain_id=20430
gnosis_blockchain_id=10200
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" --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" --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,
"evmOperationalWalletPublicKey": $EVM_OPERATIONAL_WALLET,
"evmOperationalWalletPrivateKey": $EVM_OPERATIONAL_PRIVATE_KEY,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET,
"sharesTokenName": $SHARES_TOKEN_NAME,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL
Expand All @@ -453,7 +431,8 @@ if [ "$blockchain" == "Both" ]; then
"gnosis:'$gnosis_blockchain_id'": {
"enabled": true,
"config": {
"operationalWallets": $EVM_OP_WALLET_KEYS_BLOCKCHAIN2,
"evmOperationalWalletPublicKey": $EVM_OPERATIONAL_WALLET_2,
"evmOperationalWalletPrivateKey": $EVM_OPERATIONAL_PRIVATE_KEY_2,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET_2,
"sharesTokenName": $SHARES_TOKEN_NAME_2,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL_2,
Expand All @@ -480,7 +459,8 @@ else
blockchain_arg="$blockchain:$blockchain_id"

jq --arg blockchain_arg "$blockchain_arg" \
--argjson EVM_OP_WALLET_KEYS_BLOCKCHAIN "$EVM_OP_WALLET_KEYS_BLOCKCHAIN" \
--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" \
Expand All @@ -490,7 +470,8 @@ jq --arg blockchain_arg "$blockchain_arg" \
($blockchain_arg): {
"enabled": true,
"config": {
"operationalWallets": $EVM_OP_WALLET_KEYS_BLOCKCHAIN,
"evmOperationalWalletPublicKey": $EVM_OPERATIONAL_WALLET,
"evmOperationalWalletPrivateKey": $EVM_OPERATIONAL_PRIVATE_KEY,
"evmManagementWalletPublicKey": $EVM_MANAGEMENT_WALLET,
"sharesTokenName": $SHARES_TOKEN_NAME,
"sharesTokenSymbol": $SHARES_TOKEN_SYMBOL
Expand Down
11 changes: 2 additions & 9 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ class OTNode {
await this.checkForUpdate();
await this.removeUpdateFile();

await MigrationExecutor.executeMultipleOpWalletsUserConfigurationMigration(
this.container,
this.logger,
this.config,
);

this.logger.info(' ██████╗ ████████╗███╗ ██╗ ██████╗ ██████╗ ███████╗');
this.logger.info('██╔═══██╗╚══██╔══╝████╗ ██║██╔═══██╗██╔══██╗██╔════╝');
this.logger.info('██║ ██║ ██║ ██╔██╗ ██║██║ ██║██║ ██║█████╗');
Expand Down Expand Up @@ -217,7 +211,7 @@ class OTNode {
const blockchainConfig =
blockchainModuleManager.getModuleConfiguration(blockchain);
execSync(
`npm run set-stake -- --rpcEndpoint=${blockchainConfig.rpcEndpoints[0]} --stake=${blockchainConfig.initialStakeAmount} --operationalWalletPrivateKey=${blockchainConfig.operationalWallets[0].privateKey} --managementWalletPrivateKey=${blockchainConfig.evmManagementWalletPrivateKey} --hubContractAddress=${blockchainConfig.hubContractAddress}`,
`npm run set-stake -- --rpcEndpoint=${blockchainConfig.rpcEndpoints[0]} --stake=${blockchainConfig.initialStakeAmount} --operationalWalletPrivateKey=${blockchainConfig.evmOperationalWalletPrivateKey} --managementWalletPrivateKey=${blockchainConfig.evmManagementWalletPrivateKey} --hubContractAddress=${blockchainConfig.hubContractAddress}`,
{ stdio: 'inherit' },
);
execSync(
Expand All @@ -227,14 +221,13 @@ class OTNode {
blockchainConfig.initialAskAmount +
(Math.random() - 0.5) * blockchainConfig.initialAskAmount
} --privateKey=${
blockchainConfig.operationalWallets[0].privateKey
blockchainConfig.evmOperationalWalletPrivateKey
} --hubContractAddress=${blockchainConfig.hubContractAddress}`,
{ stdio: 'inherit' },
);
}
}
const identityId = await blockchainModuleManager.getIdentityId(blockchain);

this.logger.info(`Identity ID: ${identityId}`);
} catch (error) {
this.logger.warn(
Expand Down
Loading

0 comments on commit d7cd260

Please sign in to comment.