Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e): always wait for at least height 1 #3415

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

gartnera
Copy link
Member

@gartnera gartnera commented Jan 24, 2025

Seeing increased e2e failure rates after #3357. Let's always wait for at least height 1 on e2e.

Unable to continue execution: rpc error: code = Unknown desc = zetacore is not ready; please wait for first block: invalid height.

Also change this info log spam to debug:

2025-01-24T20:12:56Z INF Received new block event height=42 module=zetacoreClient
2025-01-24T20:12:58Z INF Received new block event height=43 module=zetacoreClient
2025-01-24T20:13:01Z INF Received new block event height=44 module=zetacoreClient
2025-01-24T20:13:03Z INF Received new block event height=45 module=zetacoreClient
2025-01-24T20:13:06Z INF Received new block event height=46 module=zetacoreClient
2025-01-24T20:13:08Z INF Received new block event height=47 module=zetacoreClient
2025-01-24T20:13:10Z INF Received new block event height=48 module=zetacoreClient
2025-01-24T20:13:13Z INF Received new block event height=49 module=zetacoreClient
2025-01-24T20:13:15Z INF Received new block event height=50 module=zetacoreClient
2025-01-24T20:13:17Z INF Received new block event height=51 module=zetacoreClient
2025-01-24T20:13:20Z INF Received new block event height=52 module=zetacoreClient
2025-01-24T20:13:22Z INF Received new block event height=53 module=zetacoreClient
2025-01-24T20:13:24Z INF Received new block event height=54 module=zetacoreClient
2025-01-24T20:13:27Z INF Received new block event height=55 module=zetacoreClient
2025-01-24T20:13:29Z INF Received new block event height=56 module=zetacoreClient

Summary by CodeRabbit

  • New Features

    • None
  • Bug Fixes

    • None
  • Improvements

    • Reduced waiting time for zetacore0 RPC availability from 20 to 10 seconds
    • Enhanced WaitForBlockHeight function with improved error handling and retry mechanism
    • Changed block event logging from info to debug level for reduced verbosity
  • Configuration Changes

    • Updated default waitForHeight flag from 0 to 1 in local command tests

@gartnera gartnera added no-changelog Skip changelog CI check UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light labels Jan 24, 2025
@gartnera gartnera requested a review from a team as a code owner January 24, 2025 20:16
Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request encompasses modifications across multiple files in the Zeta project, focusing on test infrastructure and logging adjustments. The changes include updating the default wait-for-height flag in local end-to-end testing, reducing script wait times, enhancing block height waiting mechanism robustness, and adjusting logging verbosity for block event tracking.

Changes

File Change Summary
cmd/zetae2e/local/local.go Changed default flagWaitForHeight from 0 to 1, simplifying block height waiting mechanism
contrib/localnet/scripts/start-zetaclientd.sh Reduced RPC availability wait time from 20 to 10 seconds
e2e/utils/zetacore.go Enhanced WaitForBlockHeight with improved error handling, added sleep interval, and limited retry attempts
zetaclient/zetacore/client_subscriptions.go Downgraded block event logging from info to debug level

Possibly related PRs

Suggested labels

UPGRADE_TESTS

Suggested reviewers

  • fbac
  • lumtis
  • swift1337
  • skosito
  • kingpinXD
  • brewmaster012

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.87%. Comparing base (367e4aa) to head (988d5d2).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3415      +/-   ##
===========================================
- Coverage    63.01%   62.87%   -0.15%     
===========================================
  Files          436      436              
  Lines        30683    30759      +76     
===========================================
+ Hits         19336    19339       +3     
- Misses       10535    10608      +73     
  Partials       812      812              
Files with missing lines Coverage Δ
zetaclient/zetacore/client_subscriptions.go 65.57% <100.00%> (ø)

... and 1 file with indirect coverage changes

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
e2e/utils/zetacore.go (2)

317-317: One-second polling may affect performance on large-scale tests.

While a 1-second interval is straightforward, consider a more adaptive approach if system load necessitates shorter or dynamic backoff intervals.


328-330: Adding a 100-attempt limit prevents infinite loops.

Capping the retries is prudent. If deployments or nodes are particularly slow, consider allowing a configurable upper limit through a flag or environment variable.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 367e4aa and e6427bd.

📒 Files selected for processing (4)
  • cmd/zetae2e/local/local.go (2 hunks)
  • contrib/localnet/scripts/start-zetaclientd.sh (1 hunks)
  • e2e/utils/zetacore.go (1 hunks)
  • zetaclient/zetacore/client_subscriptions.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
contrib/localnet/scripts/start-zetaclientd.sh (1)

Pattern **/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

e2e/utils/zetacore.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

zetaclient/zetacore/client_subscriptions.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

cmd/zetae2e/local/local.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: start-e2e-test / e2e
🔇 Additional comments (5)
zetaclient/zetacore/client_subscriptions.go (1)

82-82: Lowering log level reduces spam and is beneficial.

Switching from info to debug helps keep the logs succinct while still monitoring block events for debugging use cases.

cmd/zetae2e/local/local.go (2)

64-64: Good default to always wait for at least height 1.

This ensures that the test environment is initialized past genesis height, reducing flakiness.


153-153: Enforcing block wait unconditionally improves consistency.

Relying on utils.WaitForBlockHeight without conditional checks guarantees a stable testing environment, helping mitigate race conditions observed earlier.

contrib/localnet/scripts/start-zetaclientd.sh (1)

47-47: Reduced wait time improves responsiveness with caution.

Shortening the sleep from 20s to 10s accelerates startup but might impact test stability in slower setups. Confirm that nodes reliably become available within this timeframe.

✅ Verification successful

Sleep duration aligns with codebase patterns

The 10-second wait time matches existing timeouts in end-to-end testing scripts while exceeding the 1-second delay used by core services, providing adequate buffer for node availability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Checking logs for delayed node availability beyond 10s
# The script looks at all logs in the local environment for "Waiting for zetacore0 rpc" messages lasting longer than 10s

rg "Waiting for zetacore0 rpc" -A 5

Length of output: 1645

e2e/utils/zetacore.go (1)

320-320: Continuing instead of erroring promotes resilience.

By retrying when an RPC status call fails, the tests are more robust. Be mindful of masking persistent errors that might persist across intervals.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
e2e/utils/zetacore.go (1)

317-317: Introducing a 1-second sleep helps reduce CPU usage when waiting
This approach avoids busy waiting but may prolong total test runtime on slower machines.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 367e4aa and e6427bd.

📒 Files selected for processing (4)
  • cmd/zetae2e/local/local.go (2 hunks)
  • contrib/localnet/scripts/start-zetaclientd.sh (1 hunks)
  • e2e/utils/zetacore.go (1 hunks)
  • zetaclient/zetacore/client_subscriptions.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
contrib/localnet/scripts/start-zetaclientd.sh (1)

Pattern **/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

zetaclient/zetacore/client_subscriptions.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

cmd/zetae2e/local/local.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

e2e/utils/zetacore.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: start-e2e-test / e2e
🔇 Additional comments (5)
zetaclient/zetacore/client_subscriptions.go (1)

82-82: Lowering the log level to debug is more appropriate for frequent block event messages
This helps reduce log spam while preserving important visibility for debugging.

e2e/utils/zetacore.go (2)

320-320: Swallowing errors might mask legitimate connection issues
Consider logging them at debug level or applying an exponential backoff for repeated failures.


328-330: Imposing a maximum of 100 attempts prevents infinite loops
This approach is sensible, yet it may be beneficial to allow runtime configuration or environment override for certain CI environments.

cmd/zetae2e/local/local.go (1)

64-64: Always waiting for at least block height 1
This ensures minimal readiness before proceeding, potentially preventing invalid height errors.

contrib/localnet/scripts/start-zetaclientd.sh (1)

47-47: Reducing wait time from 20 to 10 seconds
This speeds up initialization but might pose a risk if the node occasionally needs more time to start.

// prevent spamming logs
if i%10 == 0 {
logger.Info("waiting for block: %d, current height: %d\n", desiredHeight, currentHeight)
}
if i > 100 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe 100 seconds is too long. set to 30?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli no-changelog Skip changelog CI check UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants