Skip to content

refactor(tests): improve transaction waiting logic and epoch checks i…#5057

Draft
Frozen wants to merge 2 commits into
devfrom
feature/improve-tests-performance
Draft

refactor(tests): improve transaction waiting logic and epoch checks i…#5057
Frozen wants to merge 2 commits into
devfrom
feature/improve-tests-performance

Conversation

@Frozen

@Frozen Frozen commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

This pull request improves the reliability and efficiency of test scripts by replacing fixed sleep intervals with readiness and polling scripts. The changes ensure that scripts wait for services or blockchain epochs to be ready before proceeding, reducing flakiness and unnecessary waiting time.

Test orchestration improvements:

  • Replaced fixed sleep 10s delays with a call to ./test/wait_rpc_ready.sh in several Makefile targets (debug-ext, debug-multi-bls, debug-multi-bls-with-terminal, debug-multi-bls-multi-ext-node), ensuring that the RPC endpoint is ready before starting the validator setup. [1] [2]

  • In test/build-localnet-validator.sh, replaced the epoch polling loop with a call to the new ./test/wait_till_n_epoch.sh script for waiting until the blockchain reaches a specific epoch.

Script enhancements:

  • Added a robust test/wait_till_n_epoch.sh script that polls the node for the current epoch, supports configurable timeouts and intervals, and fails gracefully if the target epoch is not reached in time.

  • Updated scripts/api_test.sh to replace fixed sleep 20s waits with a call to ./test/wait_tx_receipt.sh, polling for transaction receipts instead of relying on arbitrary delays. [1] [2]

@Frozen Frozen self-assigned this Jun 12, 2026
go-version: '1.24.2'
cache-dependency-path: go/src/github.com/harmony-one/harmony/go.sum

- &cache-native-libs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea is good, but you aren't changing the way how CI works rn, because bls and mcl are still building every time.

Main idea of cache is to cache some actions one time and skip them on the next run if they are present.

What we are seeing on the 2 runs of the same PR is almost same timing results.

  • one thing - make on the harmony repo automatically build mcl and bls again.

Example diagram of the build stage:

flowchart TD
    A["Checkout harmony/mcl/bls"] --> B["Set up Go"]
    B --> C["actions/cache restores native mcl/bls cache"]

    C --> D{"Exact cache hit?"}

    D -->|yes| E["Cached bin/lib/obj restored"]
    D -->|no| F["No exact cached native outputs"]

    E --> G["Build mcl runs anyway"]
    F --> G

    G --> H["Build bls runs anyway"]
    H --> I["Build harmony runs"]

    I --> J["Job completes"]

    J --> K{"Cache miss and job success?"}
    K -->|yes| L["actions/cache may save native outputs"]
    K -->|no| M["No new native cache saved"]
Loading


- &cache-native-libs
name: Cache native mcl/bls libraries
uses: actions/cache@v4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lest use best practice here - last version + sha1 # v1.1.1 comment

path: go/src/github.com/harmony-one/harmony-test
persist-credentials: false

- &setup-docker-buildx

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this one?
all github runners has docker by default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants