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

chore: clean-up main #22787

Merged
merged 3 commits into from
Dec 6, 2024
Merged

chore: clean-up main #22787

merged 3 commits into from
Dec 6, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Dec 6, 2024

Description

Removes simapp legacy from main. Additionally, all baseapp related stuff are being deleted from main (see #22392), so this starts that.
We advice users to use runtime, it will make the migration to v2 easier, as runtime -> runtime/v2 is 3 line change.

This won't be backported, legacy wiring will always be available on release/v0.52.x and lower branches.


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

  • New Features

    • Updated the SimApp changelog to reflect new modules and changes in functionality.
    • Introduced a versioned approach to the build process with improved architecture support.
  • Bug Fixes

    • Streamlined testing workflow by removing redundant steps and enhancing error handling.
  • Documentation

    • Updated changelog to include significant changes and new features in the SimApp.
  • Chores

    • Managed dependencies effectively in the go.mod file to ensure compatibility.

Copy link
Contributor

coderabbitai bot commented Dec 6, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request involve significant modifications to the build and testing workflows for the SimApp project, including the transition from a legacy build process to a versioned approach. The build configuration now supports only amd64 and arm64 architectures, while the testing workflow has streamlined the process by removing outdated steps. Additionally, various files related to the application structure and dependencies have been updated or removed, reflecting a shift towards a more modular and organized configuration, particularly in light of the new versioning strategy.

Changes

File Change Summary
.github/workflows/build.yml Renamed build step to "Build v2", updated build options to COSMOS_BUILD_OPTIONS=v2, dropped arm support, and refined caching for rocksdb.
.github/workflows/test.yml Removed testing step for simapp version 1 (test-simapp-v1), streamlined testing process.
scripts/build/build.mk Removed conditional for app_v1 build tag, updated SIMAPP and APPNAME for v2.
scripts/go-lint-all.bash Removed linting for cosmossdk.io/simapp with app_v1 build tag.
simapp/CHANGELOG.md Updated changelog for SimApp from v0.50 to v0.52, reflecting module updates and removals.
simapp/app.go Deleted file containing the SimApp implementation and its associated methods.
simapp/app_di.go Updated init function for error handling and restructured NewSimApp for better configuration.
simapp/go.mod Updated dependencies, marking some as indirect and adding new ones for compatibility.
simapp/simd/cmd/root.go Deleted file containing the NewRootCmd function for the simd application.
simapp/simd/cmd/root_di.go Removed build constraint for app_v1, retaining core command functionality.
schema/indexer/start.go Updated error handling in StartIndexing function for indexer configuration.
tests/integration/v2/app.go Enhanced RunMsg method to include t.Helper() and context validation.
tests/integration/v2/evidence/infraction_test.go Removed testEquivocationHandler function, simplifying double-signing tests.
math/dec_test.go Added and adjusted test cases for the Dec type, enhancing edge case coverage.
server/v2/cometbft/abci_test.go Updated message handling to use gogoproto.Message instead of proto.Message.

Possibly related PRs

Suggested labels

backport/v0.52.x

Suggested reviewers

  • tac0turtle
  • sontrinh16
  • akhilkumarpilli
  • facundomedica

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

🧹 Outside diff range and nitpick comments (3)
simapp/CHANGELOG.md (3)

50-50: Address the TODO comment about moving changelog elements.

The TODO comment suggests moving changelog elements, but it's unclear which elements should be moved and where they should go.

Would you like me to help create a GitHub issue to track this task and provide a detailed plan for reorganizing the changelog elements?


Line range hint 1-50: Fix typos in the changelog documentation.

There are a few typos in the changelog:


Line range hint 1-50: Improve changelog structure and consistency.

The changelog structure could be improved:

  1. The v0.50 to v0.52 section contains a mix of bullet points with and without PR references
  2. Older versions (v0.47 to v0.50, v0.46 to v0.47, v0.45 to v0.46) lack detailed changelog entries

Consider:

  • Consistently formatting all entries with PR references
  • Adding detailed changelog entries for older versions instead of just referring to UPGRADING.md
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3a2a0ac and df70c65.

📒 Files selected for processing (10)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/test.yml (0 hunks)
  • scripts/build/build.mk (0 hunks)
  • scripts/go-lint-all.bash (0 hunks)
  • simapp/CHANGELOG.md (1 hunks)
  • simapp/app.go (0 hunks)
  • simapp/app_di.go (0 hunks)
  • simapp/go.mod (1 hunks)
  • simapp/simd/cmd/root.go (0 hunks)
  • simapp/simd/cmd/root_di.go (0 hunks)
💤 Files with no reviewable changes (7)
  • simapp/simd/cmd/root_di.go
  • scripts/go-lint-all.bash
  • simapp/app_di.go
  • .github/workflows/test.yml
  • simapp/simd/cmd/root.go
  • scripts/build/build.mk
  • simapp/app.go
🧰 Additional context used
📓 Path-based instructions (1)
simapp/CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

🔇 Additional comments (4)
.github/workflows/build.yml (2)

53-54: LGTM: Build v2 step addition

The addition of the v2 build step with COSMOS_BUILD_OPTIONS=v2 aligns with the PR objectives of transitioning away from legacy components. This change supports the migration path to SDK v2.


Line range hint 18-19: Verify impact of dropping 32-bit ARM support

The removal of 32-bit ARM support could affect users still running on older ARM devices. Please ensure this change is documented in the release notes and migration guide.

✅ Verification successful

32-bit ARM support removal is a deliberate change with limited impact

The codebase shows this is an intentional architectural change where 32-bit ARM support is being dropped while maintaining ARM64 support. The impact is minimal because:

  • ARM64 (64-bit ARM) support is still maintained in the build matrix
  • The project's release artifacts (.goreleaser.yml) already support ARM64 builds
  • No critical ARM32-specific configurations or dependencies were found in the codebase
  • The change is clearly documented in the build.yml comment as "drop 32 bit support for now (and maybe forever)"
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any ARM-specific build configurations or dependencies
rg -i "arm32|armv7" --type yaml

Length of output: 33


Script:

#!/bin/bash
# Let's check for any ARM-related configurations in the entire codebase
rg -i "arm|aarch" --type yaml

# Also check the build.yml file specifically to understand the changes
cat .github/workflows/build.yml

# Look for any architecture-related configurations
rg -i "architecture|platform|arch" --type yaml

Length of output: 3660

simapp/go.mod (2)

35-35: LGTM: Dependency cleanup

Appropriate cleanup of dependencies by marking tx and cast packages as indirect, as they are not directly imported by the module.

Also applies to: 42-42


Line range hint 7-8: Verify stability of pre-release dependencies

The module depends on pre-release versions:

  • collections v0.4.1-0.20241128094659-bd76b47e1d8b
  • cometbft v1.0.0-rc2.0.20241127125717-4ce33b646ac9

Please ensure these versions are stable enough for production use.

✅ Verification successful

Based on the results from checking the repositories, I can now provide a final assessment:

Pre-release dependencies appear to be actively maintained and stable

The pre-release versions in use are from actively maintained repositories:

  • CometBFT v1.0.0-rc2 was released in November 2024 and is a release candidate (RC) version, indicating it's in the final stages of testing before a stable release. The repository shows active development with recent commits and releases.
  • The collections module version is tied to a specific commit from November 2024, which is a common practice for ensuring dependency stability while waiting for the next official release.

No critical issues were found related to these specific versions in the repositories. The pre-release status is acceptable in this context as these are part of the broader Cosmos SDK ecosystem where coordinated releases are common.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any reported issues with these dependencies
gh api graphql -f query='
{
  repository(owner: "cosmos", name: "cosmos-sdk") {
    issues(first: 5, states: OPEN, labels: ["bug"], searchQuery: "collections v0.4.1 in:body OR cometbft v1.0.0-rc2 in:body") {
      nodes {
        title
        url
      }
    }
  }
}'

Length of output: 604


Script:

#!/bin/bash
# Let's try a different approach to check for issues
# First, let's check if these dependencies are being actively maintained
gh api repos/cosmos/collections/commits?per_page=5
echo "---"
gh api repos/cometbft/cometbft/commits?per_page=5

# Also check for open issues mentioning these versions
gh api search/issues?q="collections+v0.4.1+repo:cosmos/cosmos-sdk+is:issue+is:open+label:bug"
echo "---"
gh api search/issues?q="cometbft+v1.0.0-rc2+repo:cosmos/cosmos-sdk+is:issue+is:open+label:bug"

# Let's also check the go.mod file for any additional context
cat go.mod

Length of output: 63907


Script:

#!/bin/bash
# Let's check the stability of these dependencies by looking at their recent releases and activity
# Check collections repository
gh api repos/cosmos/cosmos-sdk/commits?path=collections&per_page=5
echo "---"

# Check CometBFT repository releases
gh api repos/cometbft/cometbft/releases?per_page=5

# Also check if there are any recent discussions or issues about these versions
gh api search/issues?q="v1.0.0-rc2+repo:cometbft/cometbft+is:issue+state:open"

Length of output: 69845

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 (2)
tests/integration/v2/app.go (2)

Line range hint 448-467: Improve error handling before state commit

The function should verify handler execution success before committing state changes. Consider this refactor:

 func (app *App) RunMsg(t *testing.T, ctx context.Context, handler handler, option ...Option) (resp transaction.Msg, err error) {
 	t.Helper()
 
 	// set options
 	cfg := &RunMsgConfig{}
 	for _, opt := range option {
 		opt(cfg)
 	}
 
 	// need to have integration context
 	integrationCtx, ok := ctx.Value(contextKey).(*integrationContext)
 	require.True(t, ok)
 
 	resp, err = handler(ctx)
+	// Only commit if handler execution was successful
+	if err == nil && cfg.Commit {
+		if commitErr := app.Commit(integrationCtx.state); commitErr != nil {
+			return resp, fmt.Errorf("failed to commit state: %w", commitErr)
+		}
+		app.lastHeight++
+	}
-	if cfg.Commit {
-		app.lastHeight++
-		_, err := app.Commit(integrationCtx.state)
-		require.NoError(t, err)
-	}
 
 	return resp, err
 }

Line range hint 448-467: Add unit tests for RunMsg function

This test helper is critical for integration testing but lacks its own test coverage. Consider adding tests for:

  • Success and failure scenarios
  • Commit behavior with different options
  • Error handling cases

Would you like me to help generate comprehensive test cases for this function?

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between df70c65 and d230ee2.

📒 Files selected for processing (3)
  • schema/indexer/start.go (1 hunks)
  • tests/integration/v2/app.go (1 hunks)
  • tests/integration/v2/evidence/infraction_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
schema/indexer/start.go (1)

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

tests/integration/v2/evidence/infraction_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/integration/v2/app.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"

🔇 Additional comments (3)
tests/integration/v2/evidence/infraction_test.go (1)

252-252: LGTM: Added essential consensus parameter validation

The addition of error checking for consensus parameters retrieval is crucial for the test setup, ensuring that the evidence validation will work with the correct parameters.

schema/indexer/start.go (1)

123-123: 🛠️ Refactor suggestion

Consider modernizing error handling and improving error message.

The comment indicates maintaining Go 1.12 compatibility, which seems to conflict with the PR's objective of cleaning up legacy components. Additionally, the error message could be more descriptive.

Let's verify the minimum Go version requirement:

If Go 1.12 compatibility is no longer required, consider these improvements:

-			return IndexingTarget{}, fmt.Errorf("failed to unmarshal indexer config for target %q: %v", targetName, err) //nolint:errorlint // we support go 1.12, so no error wrapping
+			return IndexingTarget{}, fmt.Errorf("failed to unmarshal indexer config for target %q: config type %T: %w", targetName, targetCfg.Config, err)

The suggested changes:

  1. Use error wrapping (%w) for better error handling
  2. Include the config type in the error message for better debugging
  3. Remove the legacy Go 1.12 comment
tests/integration/v2/app.go (1)

448-449: Good addition of t.Helper()

The addition of t.Helper() improves test failure reporting by showing the correct line numbers in test output. This is a good practice for test helper functions.

@tac0turtle
Copy link
Member

lint is failing

@julienrbrt julienrbrt enabled auto-merge December 6, 2024 14:00
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 (2)
math/dec_test.go (1)

1285-1285: LGTM with a minor suggestion for test naming.

The test execution block follows Go testing best practices with proper error handling and validation. Consider making the test names more descriptive by using the test case values in a formatted string:

-t.Run(fmt.Sprint(tc.src), func(t *testing.T) {
+t.Run(fmt.Sprintf("input=%s exp=%s", tc.src, tc.exp), func(t *testing.T) {
server/v2/cometbft/abci_test.go (1)

823-834: Add error handling for handler registration.

While the implementation is correct, it would be beneficial to handle potential errors from the handler registration to ensure robustness.

-_ = queryRouterBuilder.RegisterHandler(
+if err := queryRouterBuilder.RegisterHandler(
   gogoproto.MessageName(&testdata.SayHelloRequest{}),
   helloFooHandler,
-  )
+); err != nil {
+   t.Fatalf("failed to register handler: %v", err)
+}
📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d230ee2 and 5e1e03e.

📒 Files selected for processing (2)
  • math/dec_test.go (1 hunks)
  • server/v2/cometbft/abci_test.go (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
math/dec_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"

server/v2/cometbft/abci_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 (4)
server/v2/cometbft/abci_test.go (4)

67-67: LGTM: Interface constraint changes are correct.

The transition from proto.Message to gogoproto.Message aligns with the modernization goals and provides better performance characteristics.

Also applies to: 71-71


79-79: LGTM: Message name retrieval updated correctly.

The change to gogoproto.MessageName maintains consistency with the new gogoproto-based message handling system.


109-109: LGTM: Message name retrieval updated correctly.

The change to gogoproto.MessageName maintains consistency with the new gogoproto-based message handling system.


897-897: LGTM: Proto registry initialization updated correctly.

The change to gogoproto.MergedRegistry with sync.OnceValues ensures thread-safe and consistent proto registry initialization.

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

Successfully merging this pull request may close these issues.

8 participants