Skip to content

Commit

Permalink
Merge commit '473a650730efa401a23305579534254654425354' into 01081-D-…
Browse files Browse the repository at this point in the history
…explorer

Signed-off-by: Jeffrey Tang <[email protected]>

# Conflicts:
#	src/commands/mirror_node.ts
  • Loading branch information
JeffreyDallas committed Jan 18, 2025
2 parents 6944087 + 473a650 commit b0e139f
Show file tree
Hide file tree
Showing 31 changed files with 430 additions and 194 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/flow-task-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ jobs:
example-task-file-test:
timeout-minutes: 20
runs-on: solo-linux-large
strategy:
matrix:
type: ["NO_ACCOUNT_INIT", "ACCOUNT_INIT"]
steps:
- name: Harden Runner
uses: step-security/harden-runner@c95a14d0e5bab51a9f56296a4eb0e416910cd350 # v2.10.3
Expand All @@ -53,6 +56,11 @@ jobs:
node-version: 20
cache: npm

- name: Setup Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: "v3.12.3" # helm version

- name: Setup Kind
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
Expand All @@ -63,9 +71,9 @@ jobs:
verbosity: 3
wait: 120s

- name: Run Example Task File Test
- name: Run Example Task File Test with type ${{ matrix.type }}
run: |
task default-with-relay
sleep 10
.github/workflows/script/solo_smoke_test.sh
export CONSENSUS_NODE_VERSION=v0.58.3
task default
.github/workflows/script/solo_smoke_test.sh ${{ matrix.type }}
task clean
4 changes: 3 additions & 1 deletion .github/workflows/script/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ function create_test_account ()

# get private key of the account
npm run solo-test -- account get -n solo-e2e --account-id ${OPERATOR_ID} --private-key > test.log
export OPERATOR_KEY=$(grep "privateKey" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')

# retrieve the field privateKey but not privateKeyRaw
export OPERATOR_KEY=$(grep "privateKey" test.log | grep -v "privateKeyRaw" | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
export CONTRACT_TEST_KEY_ONE=0x$(grep "privateKeyRaw" test.log | awk '{print $2}' | sed 's/"//g'| sed 's/,//g')
echo "CONTRACT_TEST_KEY_ONE=${CONTRACT_TEST_KEY_ONE}"
rm test.log
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/script/solo_smoke_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,48 @@ function start_sdk_test ()
return $result
}

function check_monitor_log()
{
# get the logs of mirror-monitor
kubectl get pods -n solo-e2e | grep mirror-monitor | awk '{print $1}' | xargs kubectl logs -n solo-e2e > mirror-monitor.log

if grep -q "ERROR" mirror-monitor.log; then
echo "mirror-monitor.log contains ERROR"
exit 1
fi

# any line contains "Scenario pinger published" should contain the string "Errors: {}"
if grep -q "Scenario pinger published" mirror-monitor.log; then
if grep -q "Errors: {}" mirror-monitor.log; then
echo "mirror-monitor.log contains Scenario pinger published and Errors: {}"
else
echo "mirror-monitor.log contains Scenario pinger published but not Errors: {}"
exit 1
fi
fi
}

function check_importer_log()
{
kubectl get pods -n solo-e2e | grep mirror-importer | awk '{print $1}' | xargs kubectl logs -n solo-e2e > mirror-importer.log
if grep -q "ERROR" mirror-importer.log; then
echo "mirror-importer.log contains ERROR"
exit 1
fi
}

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

task solo:mirror-node
task solo:relay

echo "Change to parent directory"

cd ../
create_test_account
clone_smart_contract_repo
Expand All @@ -97,3 +138,8 @@ start_contract_test
start_sdk_test
echo "Sleep a while to wait background transactions to finish"
sleep 30

echo "Run mirror node acceptance test"
helm test mirror -n solo-e2e --timeout 10m
check_monitor_log
check_importer_log
2 changes: 1 addition & 1 deletion .github/workflows/zxc-e2e-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
if: ${{ runner.os == 'linux' && (inputs.npm-test-script == 'test-e2e-node-local-hedera' || inputs.npm-test-script == 'test-e2e-node-local-ptt' || inputs.npm-test-script == 'test-e2e-node-add-local') && !cancelled() && !failure() }}
run: |
cd ..
git clone https://github.com/hashgraph/hedera-services.git --depth 1 --branch v0.58.1
git clone https://github.com/hashgraph/hedera-services.git --depth 1 --branch v0.58.3
cd hedera-services
ls -ltr
${{ env.CG_EXEC }} ./gradlew assemble --stacktrace --info
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.helper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ tasks:
cmds:
- |
if [[ "${CONSENSUS_NODE_VERSION}" != "" ]]; then
export CONSENSUS_NODE_FLAG='--release-tag ${CONSENSUS_NODE_VERSION}'
export CONSENSUS_NODE_FLAG='--release-tag {{.CONSENSUS_NODE_VERSION}}'
fi
SOLO_HOME_DIR=${SOLO_HOME_DIR} npm run solo -- node setup --namespace "${SOLO_NAMESPACE}" --node-aliases-unparsed {{.node_identifiers}} ${CONSENSUS_NODE_FLAG} ${LOCAL_BUILD_FLAG} -q --dev
Expand Down
8 changes: 6 additions & 2 deletions docs/content/User/StepByStepGuide.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Advanced User Guide

For those who would like to have more control or need some customized setups, here are some step by step instructions of how to setup and deploy a solo network.

### Setup Kubernetes cluster

#### Remote cluster
Expand Down Expand Up @@ -28,6 +30,7 @@ Then run the following command to set the kubectl context to the new cluster:
```bash
kind create cluster -n "${SOLO_CLUSTER_NAME}"
```

Example output

```
Expand All @@ -48,7 +51,6 @@ Thanks for using kind! 😊

You may now view pods in your cluster using `k9s -A` as below:


```
Context: kind-solo <0> all <a> Attach <ctr… ____ __.________
Cluster: kind-solo <ctrl-d> Delete <l> | |/ _/ __ \______
Expand All @@ -75,7 +77,6 @@ You may now view pods in your cluster using `k9s -A` as below:
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```


### Step by Step Instructions

* Initialize `solo` directories:
Expand Down Expand Up @@ -136,13 +137,16 @@ Kubernetes Cluster : kind-solo
✔ Generate gRPC TLS Keys
✔ Finalize
```

PEM key files are generated in `~/.solo/keys` directory.

```
hedera-node1.crt hedera-node3.crt s-private-node1.pem s-public-node1.pem unused-gossip-pem
hedera-node1.key hedera-node3.key s-private-node2.pem s-public-node2.pem unused-tls
hedera-node2.crt hedera-node4.crt s-private-node3.pem s-public-node3.pem
hedera-node2.key hedera-node4.key s-private-node4.pem s-public-node4.pem
```

* Setup cluster with shared components

```
Expand Down
14 changes: 11 additions & 3 deletions examples/address-book/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Yahcli Address Book Example

This is an example of how to use Yahcli to pull the ledger and mirror node address book. And to update the ledger address book. It updates File 101 (the ledger address book file) and File 102 (the ledger node details file).
This is an example of how to use Yahcli to pull the ledger and mirror node address book. And to update the ledger address book. It updates File 101 (the ledger address book file) and File 102 (the ledger node details file).

NOTE: Mirror Node refers to File 102 as its address book.

## Usage

To get the address book from the ledger, this requires a port forward to be setup on port 50211 to consensus node with node ID = 0.
To get the address book from the ledger, this requires a port forward to be setup on port 50211 to consensus node with node ID = 0.

```bash
# try and detect if the port forward is already setup
netstat -na | grep 50211
Expand All @@ -17,28 +18,35 @@ kubectl port-forward -n "${SOLO_NAMESPACE}" pod/network-node1-0 50211:50211
```

To get the address book from the ledger, run the following command:

```bash
cd <solo-root>/examples/address-book
task get:ledger:addressbook
```
It will output the address book in JSON format to:

It will output the address book in JSON format to:

* `examples/address-book/localhost/sysfiles/addressBook.json`
* `examples/address-book/localhost/sysfiles/nodeDetails.json`

You can update the address book files with your favorite text editor.

Once the files are ready, you can upload them to the ledger by running the following command:

```bash
cd <solo-root>/examples/address-book
task update:ledger:addressbook
```

To get the address book from the mirror node, run the following command:

```bash
cd <solo-root>/examples/address-book
task get:mirror:addressbook
```

NOTE: Mirror Node may not pick up the changes automatically, it might require running some transactions through, example:

```bash
cd <solo-root>
npm run solo -- account create
Expand Down
2 changes: 1 addition & 1 deletion examples/performance-tuning/latitude/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vars:
env:
SOLO_NETWORK_SIZE: 10
SOLO_NAMESPACE: %SOLO_NAMESPACE%
SOLO_CHART_VERSION: 0.42.3
SOLO_CHART_VERSION: 0.42.10
#CONSENSUS_NODE_VERSION: 0.0.0
VALUES_FLAG: "--values-file {{.USER_WORKING_DIR}}/init-containers-values.yaml"
SETTINGS_FLAG: "--settings-txt {{.USER_WORKING_DIR}}/settings.txt"
Expand Down
2 changes: 2 additions & 0 deletions examples/performance-tuning/latitude/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
contracts.chainId=298
entities.unlimitedAutoAssociationsEnabled=true
bootstrap.throttleJsonDef.resource=genesis/throttles-dev.json
networkAdmin.exportCandidateRoster=true
addressBook.useRosterLifecycle=true
Empty file.
2 changes: 2 additions & 0 deletions resources/templates/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ blockStream.streamMode=RECORDS
scheduling.longTermEnabled=false
# TODO: uncomment this when we are ready to use genesis-network.json
#addressBook.useRosterLifecycle=true
# TODO: we can remove this after we no longer need less than v0.59.x
networkAdmin.exportCandidateRoster=true
11 changes: 11 additions & 0 deletions src/commands/cluster/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {Flags as flags} from '../flags.js';
import * as constants from '../../core/constants.js';
import {ListrEnquirerPromptAdapter} from '@listr2/prompt-adapter-enquirer';
import {SoloError} from '../../core/errors.js';
import {type Namespace} from '../../core/config/remote/types.js';

export const CONNECT_CONFIGS_NAME = 'connectConfig';

Expand Down Expand Up @@ -123,3 +124,13 @@ export interface ClusterResetConfigClass {
clusterName: string;
clusterSetupNamespace: string;
}

export interface SelectClusterContextContext {
config: {
quiet: boolean;
namespace: Namespace;
clusterName: string;
context: string;
clusters: string[];
};
}
4 changes: 2 additions & 2 deletions src/commands/cluster/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export class ClusterCommandHandlers implements CommandHandlers {
this.tasks.initialize(argv, connectConfigBuilder.bind(this)),
this.parent.setupHomeDirectoryTask(),
this.parent.getLocalConfig().promptLocalConfigTask(this.parent.getK8()),
this.tasks.selectContext(argv),
this.tasks.selectContext(),
RemoteConfigTasks.loadRemoteConfig.bind(this)(argv),
this.tasks.readClustersFromRemoteConfig(argv),
this.tasks.updateLocalConfig(argv),
this.tasks.updateLocalConfig(),
],
{
concurrent: false,
Expand Down
Loading

0 comments on commit b0e139f

Please sign in to comment.