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

test: add check in e2e test to ensure deletion of stale ballots #3503

Merged
merged 12 commits into from
Feb 11, 2025

Conversation

kingpinXD
Copy link
Contributor

@kingpinXD kingpinXD commented Feb 7, 2025

Description

  • Order ballots by creation height when returning the list of ballots
  • Add pagination flags to cli command to fetch all ballots
  • Add check in e2e test to ensure stale ballots are deleted

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features

    • Enhanced chain parameters now support multiple confirmation counts and Sui chain information for improved connectivity.
    • Added new CLI options for ballot queries, including pagination controls (limit, offset, page, page-key, reverse) and total record counting, along with result sorting.
  • Bug Fixes

    • Updated cross-chain contract calls for Bitcoin and Solana to a new workflow.
    • Introduced additional checks to ensure stale ballots are cleared, bolstering system reliability.

Copy link
Contributor

coderabbitai bot commented Feb 7, 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

The pull request updates the changelog and modifies several components. A new field, ConfirmationParams, is introduced (while deprecating confirmation_count) and Sui chain information is added. Enhancements include invoking a new EnsureNoStaleBallots method in E2E tests to verify stale ballot deletion, pagination support for ballot queries via additional CLI options, and sorting improvements in observer responses based on ballot creation height. Refactoring of Bitcoin observer and signer components further streamlines the code.

Changes

File(s) Change Summary
changelog.md Updated changelog with new field ConfirmationParams (deprecating confirmation_count), added Sui chain info, refactored Bitcoin observer/signer, organized outbound logic, and enhanced E2E tests with a stale ballots deletion check.
cmd/zetae2e/local/local.go,
e2e/runner/require.go
Introduced E2E tests enhancement: added EnsureNoStaleBallots method in E2ERunner (in require.go) and invoked it in localE2ETest (in local.go) to verify removal of stale ballots.
docs/cli/zetacored/cli.md,
x/observer/client/cli/query_ballot.go
Added new CLI options and pagination flags (e.g., --count-total, --limit, --offset, --page, --page-key, --reverse) for ballot query commands.
x/observer/keeper/grpc_query_ballot.go Implemented sorting of ballots using sort.SliceStable based on BallotCreationHeight before responding to queries.

Sequence Diagram(s)

sequenceDiagram
    participant TR as Test Runner
    participant ER as E2ERunner (EnsureNoStaleBallots)
    participant ZC as Zetacore Client
    participant OC as Observer Client

    TR->>ER: Invoke EnsureNoStaleBallots()
    ER->>ZC: Request current block height
    ZC-->>ER: Return current block height
    ER->>ER: Calculate stale block start (current - maturity blocks)
    ER->>OC: Query for ballots
    OC-->>ER: Return list of ballots
    ER->>ER: Verify first ballot's creation height > stale start
    ER-->>TR: Return verification result
Loading
sequenceDiagram
    participant U as User
    participant CLI as CLI Command
    participant QH as Query Handler
    participant GS as gRPC Service (Ballot Keeper)

    U->>CLI: Run ballot query with pagination flags
    CLI->>QH: Process pagination options (--count-total, --limit, etc.)
    QH->>GS: Forward paginated query request
    GS->>GS: Retrieve and sort ballots by creation height
    GS-->>QH: Return sorted ballot list
    QH-->>CLI: Provide paginated results
    CLI-->>U: Display ballot data
Loading

Possibly related PRs

Suggested labels

no-changelog, TSS_MIGRATION_TESTS

Suggested reviewers

  • ws4charlie
  • lumtis
  • fbac
  • skosito
  • 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.

@kingpinXD kingpinXD marked this pull request as ready for review February 7, 2025 19:12
@kingpinXD kingpinXD requested a review from a team as a code owner February 7, 2025 19:12
@kingpinXD kingpinXD self-assigned this Feb 7, 2025
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.42%. Comparing base (c388b4e) to head (6e3e9cd).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3503   +/-   ##
========================================
  Coverage    65.42%   65.42%           
========================================
  Files          442      442           
  Lines        30531    30534    +3     
========================================
+ Hits         19974    19977    +3     
  Misses        9702     9702           
  Partials       855      855           
Files with missing lines Coverage Δ
x/observer/keeper/grpc_query_ballot.go 90.76% <100.00%> (+0.44%) ⬆️

e2e/runner/require.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

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

overall looks good to me

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: 3

🧹 Nitpick comments (1)
cmd/zetae2e/local/local.go (1)

544-544: Add skip flag for stale ballot check.

For consistency with other verification checks (like skipTrackerCheck), consider adding a flag to optionally skip the stale ballot verification.

Consider adding a flag and conditional check:

+	cmd.Flags().Bool(flagSkipStaleBallotCheck, false, "set to true to skip stale ballot check")
 	// ...
-	deployerRunner.EnsureNoStaleBallots()
+	if !skipStaleBallotCheck {
+		deployerRunner.EnsureNoStaleBallots()
+	}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2640b35 and a2a54fb.

📒 Files selected for processing (6)
  • changelog.md (1 hunks)
  • cmd/zetae2e/local/local.go (1 hunks)
  • docs/cli/zetacored/cli.md (1 hunks)
  • e2e/runner/require.go (2 hunks)
  • x/observer/client/cli/query_ballot.go (1 hunks)
  • x/observer/keeper/grpc_query_ballot.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.go`: Review the Go code, point out issues relative to ...

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

  • x/observer/keeper/grpc_query_ballot.go
  • cmd/zetae2e/local/local.go
  • e2e/runner/require.go
  • x/observer/client/cli/query_ballot.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: start-e2e-test / e2e
🔇 Additional comments (7)
changelog.md (1)

21-22: Confirm New Test Entry Formatting.

The new bullet for PR [3503] clearly conveys the addition of an e2e test to ensure the deletion of stale ballots. Its formatting and description are consistent with other test-related entries in the changelog.

docs/cli/zetacored/cli.md (6)

7227-7227: New Flag Addition: --count-total
The newly introduced '--count-total' flag effectively enhances the CLI by enabling users to obtain the total record count for ballot queries. The description is succinct and consistent with the style of other CLI options.


7232-7232: New Flag Addition: --limit
The addition of the '--limit' flag, with a default value of 100, clearly specifies the pagination limit for ballot queries. Ensure that this default matches the logic implemented in the backend settings for pagination.


7234-7234: New Flag Addition: --offset
The '--offset' flag provides a straightforward method to specify the starting record for pagination. Please verify that its behavior in the CLI is fully compatible with the underlying pagination mechanism.


7236-7236: New Flag Addition: --page
The '--page' flag is a user-friendly enhancement that automatically adjusts the offset based on the page number, with a default of 1. Confirm that this implementation is in sync with the pagination strategy adopted in the codebase.


7237-7237: New Flag Addition: --page-key
The '--page-key' option offers advanced pagination control. Ensure that there is adequate supporting documentation elsewhere to guide users on scenarios where a pagination key might be preferred over offset-based pagination.


7238-7238: New Flag Addition: --reverse
The '--reverse' flag is a valuable addition for altering the sort order to descending. Verify that the reverse ordering is properly implemented and that corresponding end-to-end tests cover this functionality.

x/observer/client/cli/query_ballot.go Outdated Show resolved Hide resolved
e2e/runner/require.go Outdated Show resolved Hide resolved
x/observer/keeper/grpc_query_ballot.go Outdated Show resolved Hide resolved
@kingpinXD kingpinXD enabled auto-merge February 7, 2025 21:30
@kingpinXD kingpinXD added this pull request to the merge queue Feb 7, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 7, 2025
@kingpinXD kingpinXD added this pull request to the merge queue Feb 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 8, 2025
@kingpinXD kingpinXD added this pull request to the merge queue Feb 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 10, 2025
@kingpinXD kingpinXD added this pull request to the merge queue Feb 10, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 10, 2025
@kingpinXD kingpinXD added UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light UPGRADE_TESTS Run make start-upgrade-tests and removed UPGRADE_LIGHT_TESTS Run make start-upgrade-test-light labels Feb 10, 2025
@kingpinXD kingpinXD enabled auto-merge February 10, 2025 23:45
@kingpinXD kingpinXD added this pull request to the merge queue Feb 11, 2025
Merged via the queue into develop with commit c2fd4bd Feb 11, 2025
49 of 56 checks passed
@kingpinXD kingpinXD deleted the order-list-ballots-query branch February 11, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli UPGRADE_TESTS Run make start-upgrade-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants