Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/relay-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
relay:
config:
DEBUG_API_ENABLED: "true"
37 changes: 37 additions & 0 deletions .github/scripts/forward-ports.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail

# Built-in SOLO port forwarding does not work :/
# Port forwarding stops shortly after a one-shot Falcon start in GitHub actions.
# For this reason, we use this script to start port forwarding directly via Bash,
# instead of relying on the Node.js script.
# This approach keeps the connection stable and ensures it lasts throughout the tests.

FORWARDS=(
"mirror-1-rest|5551"
"network-node1|50211"
"relay-1|7546"
"mirror-1-grpc|5600"
)

ps aux | grep "port-forward" | grep kubectl | awk '{print $2}' | xargs -r kill -9
NS="$(kubectl get ns -o name | sed 's|^namespace/||' | grep '^solo' | grep -v '^solo-setup$' | head -n1)"

listen() {
local pod="$1"
local port="$2"
(
while true; do
if ! ps aux | grep -F kubectl | grep -F port-forward | grep -F " ${port}:${port}" | grep -v grep >/dev/null; then
kubectl port-forward "$pod" -n "$NS" "${port}:${port}" >/dev/null 2>&1 &
fi
sleep 1
done
) &
}

for row in "${FORWARDS[@]}"; do
IFS='|' read -r include port <<<"$row"
POD="$(kubectl get pods -A --no-headers | grep -E "$include" | head -n 1 | awk '{print $2}' | head -n1)"
listen "$POD" "$port"
done
50 changes: 45 additions & 5 deletions .github/workflows/erc-registry-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,55 @@ jobs:
cd ${{env.INDEXER_PATH}}
npm run test:unit

- name: Start the local node
run: npx hedera start -d --verbose=trace
timeout-minutes: 5
- name: Generate falcon-values config file
run: |
cat > .github/falcon.yml <<EOF
network:
--release-tag: "v0.72.0"
--node-aliases: "node1"

setup:
--release-tag: "v0.72.0"
--node-aliases: "node1"

consensusNode:
--node-aliases: "node1"
--force-port-forward: true
mirrorNode:
--enable-ingress: true
--pinger: true
--mirror-node-version: "v0.151.0"
--force-port-forward: true
explorerNode:
--enable-ingress: true
relayNode:
--node-aliases: "node1"
--relay-release: "v0.75.0"
--values-file: ".github/relay-values.yml"
EOF

- name: Setup Kind
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
install_only: true
node_image: kindest/node:v1.32.5@sha256:e3b2327e3a5ab8c76f5ece68936e4cafaa82edf58486b769727ab0b3b97a5b0d
version: v0.29.0
kubectl_version: v1.32.5
verbosity: 3
wait: 120s

- name: Start the solo node
run: npx @hashgraph/solo@0.58.0 one-shot falcon deploy --values-file .github/falcon.yml --dev
timeout-minutes: 15

- name: Forward solo ports
run: .github/scripts/forward-ports.sh

- name: Run Acceptance Tests
run: |
cd ${{env.INDEXER_PATH}}
npm run test:acceptance

- name: Stop the local node
- name: Stop solo
if: ${{ !cancelled() }}
run: npx hedera stop
run: npx @hashgraph/solo@${{ inputs.soloVersion || '0.58.0' }} one-shot single destroy
92 changes: 75 additions & 17 deletions .github/workflows/migration-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ on:
description: 'Specify post-migration test tags'
required: false
default: '@post-migration'
soloVersion:
description: 'Specify solo version'
required: false
type: string

jobs:
check:
Expand Down Expand Up @@ -70,9 +74,73 @@ jobs:
with:
version: stable

- name: Start the local node with N:${{ inputs.initialNetworkNodeTag }}, M:${{ inputs.initialMirrorNodeTag }}, R:${{ inputs.initialRelayTag }}
run: npx hedera start -d --full --network-tag=${{inputs.initialNetworkNodeTag}} --mirror-tag=${{inputs.initialMirrorNodeTag}} --relay-tag=${{inputs.initialRelayTag}}
timeout-minutes: 5
- name: Generate falcon-values config file
run: |
cat > .github/initial.yml <<EOF
network:
--release-tag: "${{ inputs.initialNetworkNodeTag }}"
--node-aliases: "node1"

setup:
--release-tag: "${{ inputs.initialNetworkNodeTag }}"
--node-aliases: "node1"

consensusNode:
--node-aliases: "node1"
--force-port-forward: true
mirrorNode:
--enable-ingress: true
--pinger: true
--mirror-node-version: "${{ inputs.initialMirrorNodeTag }}"
--force-port-forward: true
explorerNode:
--enable-ingress: true
relayNode:
--node-aliases: "node1"
--relay-release: "${{ inputs.initialRelayTag }}"
--values-file: ".github/relay-values.yml"
EOF
cat > .github/target.yml <<EOF
network:
--release-tag: "${{ inputs.targetNetworkNodeTag }}"
--node-aliases: "node1"

setup:
--release-tag: "${{ inputs.targetNetworkNodeTag }}"
--node-aliases: "node1"

consensusNode:
--node-aliases: "node1"
--force-port-forward: true
mirrorNode:
--enable-ingress: true
--pinger: true
--mirror-node-version: "${{ inputs.targetlMirrorNodeTag }}"
--force-port-forward: true
explorerNode:
--enable-ingress: true
relayNode:
--node-aliases: "node1"
--relay-release: "${{ inputs.targetRelayTag }}"
--values-file: ".github/relay-values.yml"
EOF

- name: Setup Kind
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
install_only: true
node_image: kindest/node:v1.32.5@sha256:e3b2327e3a5ab8c76f5ece68936e4cafaa82edf58486b769727ab0b3b97a5b0d
version: v0.29.0
kubectl_version: v1.32.5
verbosity: 3
wait: 120s

- name: Start the solo node
run: npx @hashgraph/solo@${{ inputs.soloVersion || '0.58.0' }} one-shot falcon deploy --values-file .github/initial.yml --dev
timeout-minutes: 15

- name: Forward solo ports
run: .github/scripts/forward-ports.sh

- name: Run pre-migration tests
run: npx hardhat test --grep ${{ inputs.preMigrationTestTags }}
Expand All @@ -84,21 +152,11 @@ jobs:
sleep 30
timeout-minutes: 5

- name: Stop docker containers (network node)
run: docker stop network-node json-rpc-relay json-rpc-relay-ws
timeout-minutes: 5

- name: Run the local node with N:${{ inputs.targetNetworkNodeTag }}, M:${{ inputs.targetMirrorNodeTag }}, R:${{ inputs.targetRelayTag }}
env:
NETWORK_NODE_IMAGE_TAG: ${{inputs.targetNetworkNodeTag}}
MIRROR_IMAGE_TAG: ${{inputs.targetMirrorNodeTag}}
RELAY_IMAGE_TAG: ${{inputs.targetRelayTag}}
NETWORK_NODE_LOGS_ROOT_PATH: ~/.local/share/hedera-local/network-logs/node
- name: Start the solo node with new network
run: |
docker compose -f docker-compose-state-migration.yml up -d
sleep 5
working-directory: node_modules/@hashgraph/hedera-local/
timeout-minutes: 5
npx @hashgraph/solo@${{ inputs.soloVersion || '0.58.0' }} one-shot single destroy
npx @hashgraph/solo@${{ inputs.soloVersion || '0.58.0' }} one-shot falcon deploy --values-file .github/target.yml --dev
timeout-minutes: 15

- name: Run post-migration tests
run: npx hardhat test --grep ${{ inputs.postMigrationTestTags }}
Expand Down
47 changes: 44 additions & 3 deletions .github/workflows/opcode-logger-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,49 @@ jobs:
- name: Run opcode tests against besu
run: npx hardhat test --grep "besu comparison" --network besu_local

- name: Start the hedera local node
run: npx hedera start -d
- name: Generate falcon-values config file
run: |
cat > .github/falcon.yml <<EOF
network:
--release-tag: "v0.72.0"
--node-aliases: "node1"

setup:
--release-tag: "v0.72.0"
--node-aliases: "node1"

consensusNode:
--node-aliases: "node1"
--force-port-forward: true
mirrorNode:
--enable-ingress: true
--pinger: true
--mirror-node-version: "v0.151.0"
--force-port-forward: true
explorerNode:
--enable-ingress: true
relayNode:
--node-aliases: "node1"
--relay-release: "v0.75.0"
--values-file: ".github/relay-values.yml"
EOF

- name: Setup Kind
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
install_only: true
node_image: kindest/node:v1.32.5@sha256:e3b2327e3a5ab8c76f5ece68936e4cafaa82edf58486b769727ab0b3b97a5b0d
version: v0.29.0
kubectl_version: v1.32.5
verbosity: 3
wait: 120s

- name: Start the solo node
run: npx @hashgraph/solo@0.58.0 one-shot falcon deploy --values-file .github/falcon.yml --dev
timeout-minutes: 15

- name: Forward solo ports
run: .github/scripts/forward-ports.sh

- name: Run opcode tests against hedera local node
- name: Run opcode tests against solo
run: npx hardhat test --grep @OpcodeLogger
53 changes: 48 additions & 5 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on:
relayTag:
required: false
type: string
soloVersion:
required: false
type: string

defaults:
run:
Expand Down Expand Up @@ -67,9 +70,49 @@ jobs:
with:
version: stable

- name: Start the local node
run: npx hedera start -d --network-tag=${{inputs.networkTag}} --mirror-tag=${{inputs.mirrorTag}} --relay-tag=${{inputs.relayTag}} --verbose=trace
timeout-minutes: 5
- name: Generate falcon-values config file
run: |
cat > .github/falcon.yml <<EOF
network:
--release-tag: "${{ inputs.networkTag || 'v0.72.0' }}"
--node-aliases: "node1"

setup:
--release-tag: "${{ inputs.networkTag || 'v0.72.0' }}"
--node-aliases: "node1"

consensusNode:
--node-aliases: "node1"
--force-port-forward: true
mirrorNode:
--enable-ingress: true
--pinger: true
--mirror-node-version: "${{ inputs.mirrorTag || 'v0.151.0' }}"
--force-port-forward: true
explorerNode:
--enable-ingress: true
relayNode:
--node-aliases: "node1"
--relay-release: "${{ inputs.relayTag || 'v0.75.0' }}"
--values-file: ".github/relay-values.yml"
EOF

- name: Setup Kind
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
with:
install_only: true
node_image: kindest/node:v1.32.5@sha256:e3b2327e3a5ab8c76f5ece68936e4cafaa82edf58486b769727ab0b3b97a5b0d
version: v0.29.0
kubectl_version: v1.32.5
verbosity: 3
wait: 120s

- name: Start the solo node
run: npx @hashgraph/solo@${{ inputs.soloVersion || '0.58.0' }} one-shot falcon deploy --values-file .github/falcon.yml --dev
timeout-minutes: 15

- name: Forward solo ports
run: .github/scripts/forward-ports.sh

- name: Run the test in ${{ inputs.testfilter }}
run: npx hardhat test --grep ${{ inputs.testfilter }}
Expand All @@ -90,6 +133,6 @@ jobs:
json_thousands_separator: ','
files: 'test-*.xml'

- name: Stop the local node
- name: Stop solo
if: ${{ !cancelled() }}
run: npx hedera stop
run: npx @hashgraph/solo@${{ inputs.soloVersion || '0.58.0' }} one-shot single destroy
6 changes: 3 additions & 3 deletions .github/workflows_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ In order to make opcode logger testing easier, we decided to use Besu's **debug_
- *8541* which is mapped to Besu's WS json-rpc relay

All the overridden node properties as miner address, enabled and included apis including custom genesis file are defined in *utils/besu-configs/customConfigFile.toml*. A custom genesis file (defined in *utils/besu-configs/customGenesisFile.toml*) is needed because starting block number of all existing forks till now must be set to 0 when Besu's node is used as a local private testing network. Start-up accounts are included in *customGenesisFile.json* as well and they easily can be expanded with new user-defined ones.
- executes specific tests - These tests have custom before and after methods that detect the target network, and if it is Besu, then execute **debug_traceTransaction** against Besu node and save the opcodes response into JSON file. That step doesn't gain us any coverage, it's needed to generate a source of truth when the same tests are executed against the Hedera local node.
- starts Hedera local node
- executes specific tests - These tests have custom before and after methods that detect the target network, and if it is Hedera, then execute **debug_traceTransaction** against Hedera local node and compare response opcodes with these generated against Besu and saved in JSON several steps above.
- executes specific tests - These tests have custom before and after methods that detect the target network, and if it is Besu, then execute **debug_traceTransaction** against Besu node and save the opcodes response into JSON file. That step doesn't gain us any coverage, it's needed to generate a source of truth when the same tests are executed against solo.
- starts solo
- executes specific tests - These tests have custom before and after methods that detect the target network, and if it is Hedera, then execute **debug_traceTransaction** against solo and compare response opcodes with these generated against Besu and saved in JSON several steps above.

Entire Besu's prerequisites and responses generation are required because each time a solidity's compiler version in the **hardhat.config.js** is changed, the developer, who did the update, must locally run these tests against Besu to generate a new hardcoded JSON which will be used for further comparison. That would be needed because let's get for example changes from solidity *0.8.23* and *0.8.24*. Contracts compiled with the older version will not include EIP-5656 (for `MCOPY` opcode) and EIP-1153 (for `TSTORE` and `TLOAD` opcodes) and **debug_traceTransaction** will return opcodes based on the contract's bytecode. When a solidity version is updated to *0.8.24* in **hardhat.config.js**, contracts will be precompiled and the new opcodes (from EIP-5656 and EIP-1153) will be introduced in the contracts bytecodes, so when we run the tests and compare **debug_traceTransaction** responses with the hardcoded ones (generated with contracts compiled with solidity *0.8.23*) they will differ. After using a CI as above, the solidity version update is not binding to developers and they shouldn't take extra care for new "source of truth" JSON generation.
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
HARDHAT_BASE_COMMAND=npx hardhat
HEDERA_BASE_COMMAND=npx hedera
PRETTIER_BASE_COMMAND=npx prettier

# compiles all smart contracts
Expand All @@ -10,13 +9,13 @@ run-compile:
run-test:
$(HARDHAT_BASE_COMMAND) test

# starts a new hedera local node
start-hedera-local:
$(HEDERA_BASE_COMMAND) start -d
# starts a new solo instance
start-solo:
npx @hashgraph/solo@0.58.0 one-shot falcon deploy --values-file .github/falcon.yml --dev

# stop current hedera local node
stop-hedera-local:
$(HEDERA_BASE_COMMAND) stop
# stop a solo instance
stop-solo:
npx @hashgraph/solo@0.58.0 one-shot falcon destroy

# format all files
format-codebase:
Expand All @@ -25,4 +24,3 @@ format-codebase:
# assure all files are formatted
format-check:
$(PRETTIER_BASE_COMMAND) . --check

Loading
Loading