Skip to content

Commit

Permalink
lookup operator key
Browse files Browse the repository at this point in the history
Signed-off-by: Jeffrey Tang <[email protected]>
  • Loading branch information
JeffreyDallas committed Jan 14, 2025
1 parent 86b4f76 commit 2c19987
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/script/solo_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,21 @@ function start_sdk_test ()
return $result
}

echo "Change to parent directory"
cd ../
create_test_account

cd solo
# if first parameter equals to ACCOUNT_INIT,
# then call solo account init before deploy relay node
if [ "$1" == "ACCOUNT_INIT" ]; then
echo "Call solo account init"
npm run solo-test -- account init -n solo-e2e
fi

npm run solo-test -- relay deploy -n solo-e2e -i node1 --operator-key $OPERATOR_KEY --operator-id $OPERATOR_ID
kubectl port-forward -n solo-e2e svc/relay-node1-hedera-json-rpc-relay 7546:7546 > /dev/null 2>&1 &
task solo:mirror-node
task solo:relay

else
task solo:relay
fi
cd -
echo "Change to parent directory"

cd ../
create_test_account
clone_smart_contract_repo
setup_smart_contract_test
start_background_transactions
Expand Down
8 changes: 7 additions & 1 deletion src/commands/mirror_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,13 @@ export class MirrorNodeCommand extends BaseCommand {
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.nodes.0.host=${pod.status.podIP}`;

ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.accountId=${constants.OPERATOR_ID}`;
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.privateKey=${constants.OPERATOR_KEY}`;
try {
const keys = await this.accountManager.getAccountKeys(constants.OPERATOR_ID);
const newOperatorKey = keys[0].toString();
ctx.config.valuesArg += ` --set monitor.config.hedera.mirror.monitor.operator.privateKey=${newOperatorKey}`;
} catch (e: Error | any) {
throw new SoloError(`Failed to get operator key for mirror node monitor. ${e.message}`, e);
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/commands/relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,21 @@ export class RelayCommand extends BaseCommand {

if (operatorID) {
valuesArg += ` --set config.OPERATOR_ID_MAIN=${operatorID}`;
} else {
this.logger.info(`Use default operator id ${constants.OPERATOR_ID}`);
}

if (operatorKey) {
valuesArg += ` --set config.OPERATOR_KEY_MAIN=${operatorKey}`;
} else {
//lookup the operator key from GENESIS ACCOUNT since it could have been changed
try {
const keys = await this.accountManager.getAccountKeys(constants.OPERATOR_ID);
const newOperatorKey = keys[0].toString();
valuesArg += ` --set config.OPERATOR_KEY_MAIN=${newOperatorKey}`;
} catch (e: Error | any) {
throw new SoloError(`Error getting operator key or relay node: ${e.message}`, e);
}
}

if (!nodeAliases) {
Expand Down

0 comments on commit 2c19987

Please sign in to comment.