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

ci: actually enable v2 system test #21539

Merged
merged 27 commits into from
Sep 26, 2024
Merged

ci: actually enable v2 system test #21539

merged 27 commits into from
Sep 26, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Sep 4, 2024

Description

Closes: #21881

ref: #20800

Noticed when doing the CI overview to Claude.
Our system tests were not running on v2, but only on simapp v1 legacy and simapp v1 depinject.
Deleting as well, scripts that shouldn't have been pushed.

Additionally, it fixes all error that popped up to make the test pass.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores

    • Updated the GitHub Actions workflow for system tests to streamline execution by removing job dependencies.
  • New Features

    • Introduced a new function to manage command-line arguments based on the simulator version, enhancing flexibility in test configurations.
    • Enhanced debugging capabilities in transaction processing with additional parameters for clearer logging.
  • Bug Fixes

    • Refined the skip message for a test to provide clearer context regarding the state of unordered transaction handling.
    • Clarified comments in tests to specify urgency for pending fixes before the next release.
    • Improved error handling in transaction validation to enhance response clarity.
    • Adjusted halt conditions in the consensus process for earlier triggering based on configured values.

@julienrbrt julienrbrt requested a review from a team as a code owner September 4, 2024 10:35
Copy link
Contributor

coderabbitai bot commented Sep 4, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes involve significant updates to the GitHub Actions workflow for system tests, including the removal of dependencies for the test-system job, allowing it to run independently. The commands for "system tests v1" and "system tests v2" have been modified, with the former simplifying the command and the latter explicitly setting the COSMOS_BUILD_OPTIONS to v2. Additionally, a new function has been introduced to conditionally manage command-line arguments based on the simulator version. Error handling in various components has been refined to improve clarity and robustness.

Changes

Files Change Summary
.github/workflows/test.yml Updated commands in "system tests v1" by removing COSMOS_BUILD_OPTIONS=legacy and simplifying to make test-system. In "system tests v2," added COSMOS_BUILD_OPTIONS=v2 before executing make test-system. Removed job dependencies for test-system.
tests/systemtests/testnet_init.go Added isV2 function to check for "simapp v2" configuration and adjusted command-line arguments accordingly based on the version.
tests/systemtests/unordered_tx_test.go Changed skip message in TestUnorderedTXDuplicate for clarity; test remains skipped.
x/auth/ante/basic_test.go Updated comment in TestConsumeGasForTxSize to clarify urgency regarding pending fixes.
server/v2/cometbft/abci.go Modified error handling in CheckTx function to refine conditions under which errors are returned.
server/v2/cometbft/utils.go Adjusted error handling in intoABCITxResults and modified halt conditions in checkHalt method to trigger on equality.
server/v2/cometbft/types/errors/errors.go Updated import path for errorsmod to versioned import cosmossdk.io/errors/v2.
server/v2/cometbft/query.go Updated import path for errorsmod to versioned import cosmossdk.io/errors/v2.
server/v2/cometbft/streaming.go Enhanced error information in streamDeliverBlockChanges function by extracting detailed error data.
server/v2/cometbft/go.mod Updated dependency version for cosmossdk.io/errors and reverted indirect requirement for cosmossdk.io/errors/v2.

Assessment against linked issues

Objective Addressed Explanation
Ensure TxResult.Code reflects the correct transaction status (21881) The changes do not address the core issue of incorrect transaction result codes.

Possibly related PRs

Suggested labels

C:x/staking, C:x/gov, C:x/slashing, C:x/distribution, C:x/mint, C:x/bank, C:x/params, C:x/evidence, C:x/upgrade, C:x/feegrant, C:x/authz, C:x/group, C:x/nft, C:x/consensus, C:collections, C:x/circuit, C:x/accounts, C:x/protocolpool, C:x/epochs, C:x/accounts/lockup, C:x/accounts/multisig

Suggested reviewers

  • sontrinh16
  • kocubinski
  • testinginprod
  • tac0turtle
  • julienrbrt

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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between daef054 and 1c4061c.

Files selected for processing (1)
  • .github/workflows/test.yml (2 hunks)
Additional comments not posted (2)
.github/workflows/test.yml (2)

180-180: Looks good!

The removal of the COSMOS_BUILD_OPTIONS=legacy environment variable simplifies the command for running the v1 system tests.


190-190: LGTM!

The addition of the COSMOS_BUILD_OPTIONS=v2 environment variable ensures that the v2 system tests are executed with the appropriate build options.

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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1c4061c and e0337c5.

Files selected for processing (6)
  • Makefile (1 hunks)
  • client/grpc/cmtservice/status_test.go (1 hunks)
  • client/v2/autocli/query_test.go (1 hunks)
  • tests/systemtests/testnet_init.go (3 hunks)
  • tests/systemtests/unordered_tx_test.go (1 hunks)
  • x/auth/ante/basic_test.go (1 hunks)
Files skipped from review due to trivial changes (3)
  • Makefile
  • client/grpc/cmtservice/status_test.go
  • x/auth/ante/basic_test.go
Additional context used
Path-based instructions (3)
tests/systemtests/unordered_tx_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/testnet_init.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"

client/v2/autocli/query_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

Additional comments not posted (5)
tests/systemtests/unordered_tx_test.go (1)

Line range hint 14-47: LGTM!

The code changes in the TestUnorderedTXDuplicate function are approved. The removal of the t.Skip statement indicates that the test case is now expected to run without being skipped, suggesting that the conditions or dependencies that warranted the skip have been addressed.

The test function follows a clear scenario-based approach and provides comprehensive validation of the unordered transaction handling functionality.

tests/systemtests/testnet_init.go (3)

17-20: LGTM!

The code changes are approved.


66-70: LGTM!

The code changes are approved.


124-127: LGTM!

The code changes are approved.

client/v2/autocli/query_test.go (1)

Line range hint 1-1: Test enabled.

Removing the t.Skip() call enables the TestAddressValidation test. This indicates that any underlying issues related to keyring instantiation have been resolved or the test is now deemed ready for execution.

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

Outside diff range, codebase verification and nitpick comments (1)
client/grpc/cmtservice/status_test.go (1)

17-17: Acknowledge the plan to rewrite the test as a system test.

The comment indicates that the test is to be rewritten as a system test, which is a good approach for testing the functionality at a higher level.

Consider creating a GitHub issue to track the task of rewriting the test and add a TODO comment with the issue number for better traceability:

-	t.Skip() // Rewrite as system test
+	t.Skip() // TODO: Rewrite as system test (https://github.com/cosmos/cosmos-sdk/issues/<issue-number>)
Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1c4061c and e0337c5.

Files selected for processing (6)
  • Makefile (1 hunks)
  • client/grpc/cmtservice/status_test.go (1 hunks)
  • client/v2/autocli/query_test.go (1 hunks)
  • tests/systemtests/testnet_init.go (3 hunks)
  • tests/systemtests/unordered_tx_test.go (1 hunks)
  • x/auth/ante/basic_test.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • Makefile
  • x/auth/ante/basic_test.go
Additional context used
Path-based instructions (4)
client/grpc/cmtservice/status_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/unordered_tx_test.go (3)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

tests/systemtests/testnet_init.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern tests/**/*: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"

client/v2/autocli/query_test.go (2)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

Additional comments not posted (6)
tests/systemtests/unordered_tx_test.go (1)

14-14: LGTM! The test for duplicate transactions in the unordered transaction pool is now enabled.

The test TestUnorderedTXDuplicate was previously skipped due to missing functionality in v2. By removing the skip statement, the test will now run and validate the behavior of duplicate transactions in the unordered transaction pool. This improves the test coverage for the unordered transaction pool functionality.

The test setup and assertions seem appropriate for the scenario being tested.

tests/systemtests/testnet_init.go (4)

17-20: LGTM!

The code changes are approved.


65-71: LGTM!

The code changes are approved.


123-127: LGTM!

The code changes are approved.


Line range hint 1-217: Code conforms to the Uber Golang style guide.

No deviations from the style guide were found.

client/v2/autocli/query_test.go (1)

Line range hint 1-1: Test enabled.

Removing the t.Skip() call enables the TestAddressValidation test to run, which is a positive change. It suggests that the underlying issue related to keyring instantiation has been resolved or the test is now deemed ready for execution.

@julienrbrt julienrbrt added the backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release label Sep 4, 2024
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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e0337c5 and 2e5d2bf.

Files selected for processing (3)
  • .github/workflows/test.yml (3 hunks)
  • tests/systemtests/testnet_init.go (4 hunks)
  • tests/systemtests/unordered_tx_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/test.yml
  • tests/systemtests/testnet_init.go
  • tests/systemtests/unordered_tx_test.go

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

Outside diff range and nitpick comments (1)
server/v2/cometbft/query.go (1)

Line range hint 88-134: Address TODO comment

There's a TODO comment on line 98: // TODO fastpath?. This suggests that there might be a potential optimization opportunity for converting the store name to bytes.

Consider investigating if there's a faster way to convert the store name to bytes, or remove the TODO comment if it's not applicable.

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d50a7e3 and 6146e26.

Files ignored due to path filters (1)
  • server/v2/cometbft/go.sum is excluded by !**/*.sum
Files selected for processing (6)
  • server/v2/cometbft/abci.go (6 hunks)
  • server/v2/cometbft/go.mod (3 hunks)
  • server/v2/cometbft/query.go (1 hunks)
  • server/v2/cometbft/streaming.go (2 hunks)
  • server/v2/cometbft/types/errors/errors.go (1 hunks)
  • server/v2/cometbft/utils.go (5 hunks)
Files skipped from review as they are similar to previous changes (2)
  • server/v2/cometbft/abci.go
  • server/v2/cometbft/utils.go
Additional context used
Path-based instructions (3)
server/v2/cometbft/query.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

server/v2/cometbft/streaming.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

server/v2/cometbft/types/errors/errors.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

Additional comments not posted (6)
server/v2/cometbft/streaming.go (2)

9-9: LGTM: New import added correctly

The new import for errorsmod is correctly formatted and necessary for the changes made in the function.


25-26: Improved error handling and more detailed transaction results

The changes enhance the error handling by extracting more detailed information from transaction results. The streamingTxResults structure now includes Codespace and Log in addition to Code, providing more comprehensive error information. This improvement aligns well with the Cosmos SDK error handling practices and addresses the issue mentioned in #21881.

Also applies to: 33-35

server/v2/cometbft/query.go (3)

Line range hint 39-86: LGTM: Well-structured and documented function

The handlerQueryApp function is well-implemented and thoroughly documented. It handles different query types appropriately and uses error wrapping effectively.


Line range hint 1-134: Overall code quality is good, with minor suggestions

The code in this file is well-structured and follows good practices. The main change of updating the errorsmod import has been noted and a verification task has been suggested. There's a minor TODO comment that could be addressed. Overall, the implementation looks solid and adheres to the Uber Golang style guide.


10-10: Verify consistency of errors package update

The import for errorsmod has been updated to use cosmossdk.io/errors/v2. This change to a versioned import might introduce breaking changes or require updates in other parts of the codebase.

Please run the following script to check for consistency across the project:

server/v2/cometbft/go.mod (1)

7-7: Verify the intention behind the new replace directive for cosmossdk.io/core.

A new replace directive has been added for cosmossdk.io/core, pointing to a local path. While this is useful for development, it may cause issues in production builds or when other developers clone the repository.

Please confirm:

  1. Is this replacement intended for development purposes only?
  2. How will this affect production builds and other developers working on the project?
  3. Is there a plan to remove this directive before merging to the main branch?

@@ -1,7 +1,7 @@
package errors

import (
errorsmod "cosmossdk.io/errors"
errorsmod "cosmossdk.io/errors/v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Imports of cosmossdk.io/errors/v2 are inconsistent across the codebase.

Multiple files still import the old cosmossdk.io/errors. Please update all imports to use cosmossdk.io/errors/v2 to ensure consistency and leverage the benefits of the v2 errors package.

Analysis chain

LGTM. Verify v2 package usage across the codebase.

The update to cosmossdk.io/errors/v2 aligns with the PR objective of enabling v2 system tests. This change follows the Uber Golang style guide for imports.

To ensure consistency, please run the following script to verify the usage of the v2 errors package across the codebase:

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of cosmossdk.io/errors/v2 package across the codebase.

# Test: Search for imports of the errors package. Expect: Only v2 imports.
rg --type go 'import.*cosmossdk.io/errors'

Length of output: 888

Comment on lines +25 to +35
space, code, log := errorsmod.ABCIInfo(txResult.Error, c.cfg.AppTomlConfig.Trace)

events, err := streaming.IntoStreamingEvents(txResult.Events)
if err != nil {
return err
}

streamingTxResults[i] = &streaming.ExecTxResult{
Code: txResult.Code,
Code: code,
Codespace: space,
Log: log,
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Overall improvement in error handling and transaction result details

The changes successfully address the issue mentioned in #21881 by ensuring that error codes, codespace, and logs are properly propagated in the transaction results. This improvement enhances the clarity and robustness of the error handling process.

Consider adding a debug log statement after line 26 to log the extracted error information. This could be helpful for troubleshooting in the future. For example:

c.logger.Debug("Extracted error info from transaction result",
    "codespace", space,
    "code", code,
    "log", log)

This addition would provide valuable debugging information without affecting the normal flow of the function.

server/v2/cometbft/go.mod Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (1)
server/v2/stf/stf.go (1)

323-324: Approve the change with a minor suggestion for clarity

The modification to return the error directly instead of wrapping it is a good change. It preserves the original error type and aligns with the issue #21881 by ensuring proper error code propagation.

For improved clarity and maintainability, consider adding a brief comment explaining why the error is not wrapped here. This will help future maintainers understand the rationale behind this specific error handling approach. For example:

-			return nil, 0, nil, err // do not wrap the error or we lose the original error type
+			// Return the error directly to preserve the original error type and ensure proper error code propagation
+			return nil, 0, nil, err

This comment provides context for why the error is handled differently here compared to other parts of the codebase.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6146e26 and 2ed0270.

🔇 Files ignored due to path filters (1)
  • server/v2/cometbft/go.sum is excluded by !**/*.sum
📒 Files selected for processing (2)
  • server/v2/cometbft/go.mod (3 hunks)
  • server/v2/stf/stf.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/v2/cometbft/go.mod
🧰 Additional context used
📓 Path-based instructions (1)
server/v2/stf/stf.go (1)

Pattern **/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

@julienrbrt julienrbrt added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit f927e9b Sep 26, 2024
71 of 73 checks passed
@julienrbrt julienrbrt deleted the julien/system-test branch September 26, 2024 13:22
mergify bot pushed a commit that referenced this pull request Sep 26, 2024
Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com>
(cherry picked from commit f927e9b)

# Conflicts:
#	core/server/app.go
#	server/v2/cometbft/go.mod
#	server/v2/cometbft/go.sum
#	server/v2/stf/stf.go
julienrbrt added a commit that referenced this pull request Sep 26, 2024
Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.52.x PR scheduled for inclusion in the v0.52's next stable release C:CLI C:server/v2 cometbft C:server/v2 stf C:server/v2 Issues related to server/v2 C:x/auth Type: Build Type: CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: server/v2/stf always returns TxResult.Code = 0
6 participants