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

feat: export genesis in simapp v2 #21199

Merged
merged 48 commits into from
Aug 16, 2024
Merged

feat: export genesis in simapp v2 #21199

merged 48 commits into from
Aug 16, 2024

Conversation

randygrok
Copy link
Collaborator

@randygrok randygrok commented Aug 7, 2024

Description

Closes: #20514


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

    • Introduced methods for enhanced functionality, including loading the latest height and exporting genesis data.
    • Added a new structure for better application state management in the CLI.
    • Implemented a robust testing framework for the SimApp to validate core functionalities.
    • Enhanced command-line capabilities with a structured approach for managing the genesis process.
  • Bug Fixes

    • Improved error handling and state management during the export process.
  • Chores

    • Updated dependency versions for better stability and control.

@randygrok randygrok requested a review from a team as a code owner August 7, 2024 12:35
Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Walkthrough

Walkthrough

The recent updates to the Cosmos SDK significantly enhance module structure and functionality. Key improvements include the addition of new dependencies that strengthen server capabilities, alongside methods for retrieving the latest blockchain height and exporting genesis data. Existing methods have been refined for better error handling and state management, collectively advancing the server infrastructure toward a production-ready state, ensuring improved integration and stability across modules.

Changes

File Change Summary
go.mod, runtime/v2/go.mod, simapp/v2/go.mod New dependencies added and existing ones updated to specific versions, improving stability and functionality across modules.
runtime/v2/app.go, runtime/v2/builder.go New methods LoadLatestHeight and ExportGenesis introduced for retrieving blockchain height and exporting genesis data, respectively.
server/v2/appmanager/appmanager.go, runtime/v2/manager.go Logic in ExportGenesis modified for improved error handling; ExportGenesisForModules control flow streamlined for clarity and efficiency.
simapp/v2/export.go, simapp/v2/simdv2/cmd/commands.go Significant changes in ExportAppStateAndValidators logic enhance control flow and consistency in exporting application state; new CLI commands for genesis process added.
simapp/v2/app_di.go Configuration flag initialization commented out, indicating a change in application setup behavior.
simapp/v2/simdv2/cmd/commands.go Functions updated to shift return types from servertypes.ExportedApp to genutilv2.ExportedApp, reflecting a refactor in application structure.

Sequence Diagram(s)

sequenceDiagram
    participant App as App[T]
    participant DB as Database
    participant Manager as ModuleManager

    App->>DB: LoadLatestHeight()
    DB-->>App: return latest height
    App->>Manager: ExportGenesis(ctx, version)
    Manager->>App: Retrieve genesis data
    App-->>Manager: Exported data
    Manager-->>App: return exported genesis data
Loading
sequenceDiagram
    participant AppManager as AppManager[T]
    participant DB as Database

    AppManager->>DB: StateAt(version)
    DB-->>AppManager: return current state
    AppManager->>AppManager: RunWithCtx(callback)
    AppManager->>AppManager: Check if exportGenesis is set
    AppManager-->>AppManager: return error if not set
    AppManager->>DB: Export genesis state
    DB-->>AppManager: return exported state
Loading

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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, codebase verification and nitpick comments (1)
runtime/v2/builder.go (1)

178-190: Ensure robust error handling and consider logging.

The ExportGenesis method handles errors appropriately, but consider adding logging for better traceability.

+ import "log"
...
  if err != nil {
+   log.Printf("Error exporting genesis: %v", err)
    return nil, fmt.Errorf("failed to export genesis: %w", err)
  }
...
  if err != nil {
+   log.Printf("Error marshaling genesis: %v", err)
    return nil, fmt.Errorf("failed to marshal genesis: %w", err)
  }
Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 72e77c3 and 7bc73f0.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • runtime/v2/go.sum is excluded by !**/*.sum
Files selected for processing (12)
  • go.mod (1 hunks)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/go.mod (2 hunks)
  • runtime/v2/manager.go (1 hunks)
  • server/v2/appmanager/appmanager.go (1 hunks)
  • server/v2/cometbft/go.mod (1 hunks)
  • simapp/v2/app_di.go (2 hunks)
  • simapp/v2/app_test.go (1 hunks)
  • simapp/v2/export.go (1 hunks)
  • simapp/v2/go.mod (4 hunks)
  • x/staking/genesis.go (2 hunks)
Additional context used
Path-based instructions (8)
simapp/v2/export.go (1)

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

x/staking/genesis.go (1)

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

simapp/v2/app_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"

runtime/v2/app.go (1)

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

server/v2/appmanager/appmanager.go (1)

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

simapp/v2/app_di.go (1)

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

runtime/v2/builder.go (1)

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

runtime/v2/manager.go (1)

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

Additional comments not posted (22)
simapp/v2/export.go (4)

10-15: Context creation and height retrieval logic.

The context creation and height retrieval logic are appropriate. Ensure that context.Background() is suitable for your use case and consider using a more specific context if needed.


16-23: Error handling for height retrieval.

The error handling for height retrieval is correct.


24-27: Review the commented-out section for zero-height genesis preparation.

The commented-out section for zero-height genesis preparation indicates potential future functionality. Ensure this is revisited and implemented if required.


34-39: Incomplete implementation for CometBFT consensus params.

The TODO comment indicates that the CometBFT consensus params are not yet implemented. Ensure this is completed before the final release.

x/staking/genesis.go (2)

18-18: Context type change to context.Context.

The change to use context.Context instead of sdk.Context aligns with Go context package conventions and enhances interoperability.


18-18: Verify the internal logic of WriteValidators.

The internal logic of the function remains unchanged and appears correct.

simapp/v2/app_test.go (3)

24-68: Initialization logic for NewTestApp.

The initialization logic for NewTestApp appears correct and handles errors appropriately.


70-103: State advancement logic for MoveNextBlock.

The state advancement logic for MoveNextBlock appears correct and handles errors appropriately.


105-114: Test logic for TestSimAppExportAndBlockedAddrs.

The test logic for TestSimAppExportAndBlockedAddrs appears correct and handles errors appropriately.

runtime/v2/app.go (1)

82-85: LGTM!

The method LoadLatestHeight is correctly implemented and adheres to best practices.

server/v2/appmanager/appmanager.go (1)

94-111: LGTM!

The updated ExportGenesis method includes improved error handling and control flow, making it more robust and reliable.

simapp/v2/app_di.go (1)

94-94: Verify the reason for commenting out the line.

The line that sets the configuration flag in the viper instance is commented out. Ensure this change is intentional and does not affect the initialization process.

runtime/v2/go.mod (3)

29-29: Verify the necessity and compatibility of the updated dependency version.

Ensure that the new version v0.0.0-20240802110823-cffeedff643d of cosmossdk.io/server/v2/appmanager is compatible with the project and necessary for the new features.


32-32: Verify the necessity and compatibility of the updated dependency version.

Ensure that the new version v0.0.0-20240226161501-23359a0b6d91 of cosmossdk.io/x/bank is compatible with the project and necessary for the new features.


44-165: Verify the necessity and compatibility of the new indirect dependencies.

Ensure that the newly added indirect dependencies are necessary for the project and do not introduce any conflicts.

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

29-29: Verify the necessity and compatibility of the updated dependency version.

Ensure that the new version v0.0.0-20240802110823-cffeedff643d of cosmossdk.io/server/v2/appmanager is compatible with the project and necessary for the new features.

go.mod (1)

15-15: Dependency Addition Approved.

The addition of the cosmossdk.io/server/v2/appmanager dependency with the specified version is appropriate.

simapp/v2/go.mod (3)

15-15: Change from Indirect to Direct Dependency Approved.

The change of cosmossdk.io/store/v2 from an indirect to a direct dependency is appropriate.


47-47: New Dependency Addition Approved.

The addition of the github.com/cometbft/cometbft/api dependency is appropriate and necessary for the project.


61-61: Dependency Version Update Approved.

The version update of the cosmossdk.io/server/v2/appmanager dependency is appropriate and necessary.

runtime/v2/manager.go (2)

224-225: Control Flow Improvement Approved.

The addition of the else clause to handle cases where the module does not satisfy the conditions for either ModuleI or appmodulev2.HasGenesis is appropriate and improves the control flow.


230-230: Logging Statement Addition Approved.

The addition of the logging statement enhances the traceability of the export process.

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

Outside diff range, codebase verification and nitpick comments (1)
simapp/v2/export.go (1)

4-5: Add a blank line after import statements.

To improve readability, add a blank line after the import statements.

import (
	"context"

	cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
	servertypes "github.com/cosmos/cosmos-sdk/server/types"
)
Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 72e77c3 and 7bc73f0.

Files ignored due to path filters (2)
  • go.sum is excluded by !**/*.sum
  • runtime/v2/go.sum is excluded by !**/*.sum
Files selected for processing (12)
  • go.mod (1 hunks)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/go.mod (2 hunks)
  • runtime/v2/manager.go (1 hunks)
  • server/v2/appmanager/appmanager.go (1 hunks)
  • server/v2/cometbft/go.mod (1 hunks)
  • simapp/v2/app_di.go (2 hunks)
  • simapp/v2/app_test.go (1 hunks)
  • simapp/v2/export.go (1 hunks)
  • simapp/v2/go.mod (4 hunks)
  • x/staking/genesis.go (2 hunks)
Additional context used
Path-based instructions (8)
simapp/v2/export.go (1)

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

x/staking/genesis.go (1)

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

simapp/v2/app_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"

runtime/v2/app.go (1)

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

server/v2/appmanager/appmanager.go (1)

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

simapp/v2/app_di.go (1)

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

runtime/v2/builder.go (1)

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

runtime/v2/manager.go (1)

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

Additional comments not posted (24)
simapp/v2/export.go (3)

18-23: Proper error handling for loading the latest height.

The error handling for loading the latest height is correctly implemented. Ensure that the error messages are logged for better debugging.


29-32: Proper error handling for exporting genesis.

The error handling for exporting genesis is correctly implemented. Ensure that the error messages are logged for better debugging.


34-39: Handle consensus parameters TODO.

The consensus parameters are currently set to an empty struct with a TODO comment. Ensure that the consensus parameters are correctly set before deploying to production.

x/staking/genesis.go (3)

4-4: Import context package for context management.

The context package has been correctly imported to support the context management changes.


18-18: Update function signature for context management.

The function WriteValidators has been updated to use context.Context instead of sdk.Context. This change aligns with Go's standard context management practices.


18-18: Ensure correct context usage in keeper methods.

Ensure that all keeper methods called within WriteValidators are compatible with context.Context and handle context appropriately.

simapp/v2/app_test.go (4)

24-24: Initialize new test application.

The function NewTestApp initializes a new SimApp instance for testing. Ensure that all necessary components are correctly initialized.


70-70: Move to the next block in the test application.

The function MoveNextBlock advances the blockchain state by one block for testing purposes. Ensure that all necessary state changes are correctly committed.


80-86: Remove TODO comment and handle context properly.

The TODO comment indicates a hack to set the comet info in the context. Ensure that this is properly handled before deploying to production.


105-114: Test exporting app state and blocked addresses.

The function TestSimAppExportAndBlockedAddrs tests the export of the app state and blocked addresses. Ensure that the test covers all necessary scenarios and edge cases.

runtime/v2/app.go (1)

82-85: LGTM! But verify the method usage in the codebase.

The code changes are approved.

However, ensure that all method calls to LoadLatestHeight are correctly implemented.

Verification successful

LGTM! The method LoadLatestHeight is correctly implemented and its usage in the codebase is appropriate.

  • simapp/v2/export.go: The method is used with proper error handling.
  • simapp/v2/app_test.go: The method is used with proper error handling in the test case.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all method calls to `LoadLatestHeight` are correctly implemented.

# Test: Search for the method usage. Expect: Correct implementation of the method calls.
rg --type go -A 5 $'LoadLatestHeight'

Length of output: 1038


Script:

#!/bin/bash
# Extracting more context from simapp/v2/export.go around the usage of LoadLatestHeight
rg --type go -A 10 -B 10 $'LoadLatestHeight' simapp/v2/export.go

# Extracting more context from simapp/v2/app_test.go around the usage of LoadLatestHeight
rg --type go -A 10 -B 10 $'LoadLatestHeight' simapp/v2/app_test.go

Length of output: 1384

server/v2/appmanager/appmanager.go (1)

94-111: Enhanced error handling and state management.

The changes improve the robustness of the ExportGenesis function by adding better error handling and state management.

However, ensure that all method calls to ExportGenesis are correctly implemented and tested.

Verification successful

Enhanced error handling and state management.

The changes improve the robustness of the ExportGenesis function by adding better error handling and state management.

The method calls to ExportGenesis are correctly implemented and thoroughly tested across various modules and scenarios.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all method calls to `ExportGenesis` are correctly implemented and tested.

# Test: Search for the method usage. Expect: Correct implementation and testing of the method calls.
rg --type go -A 5 $'ExportGenesis'

Length of output: 76653

simapp/v2/app_di.go (1)

94-94: Verify the application's initialization process.

Commenting out the line viper.Set(serverv2.FlagHome, DefaultNodeHome) could affect the application's initialization, particularly regarding its home directory configuration. The TODO note suggests that this setting might need to be applied earlier.

Ensure that the application's initialization process is not adversely affected by this change.

runtime/v2/builder.go (1)

178-190: LGTM! Ensure the method is used correctly in the codebase.

The ExportGenesis method is well-implemented with proper error handling. The code changes are approved.

However, ensure that the method is correctly integrated and used in the codebase.

runtime/v2/go.mod (2)

44-165: LGTM! Ensure the new dependencies are necessary.

The addition of new indirect dependencies is approved. The changes expand the functionality of the module.

However, verify that the new dependencies are necessary for the project.


29-32: LGTM! Ensure the updated dependencies are necessary.

The dependency updates to specific commit versions are approved. The changes enhance stability by replacing placeholders with defined versions.

However, verify that the updated dependencies are necessary for the project.

Verification successful

The updated dependencies are necessary and used throughout the codebase.

The dependencies cosmossdk.io/server/v2/appmanager, cosmossdk.io/server/v2/stf, cosmossdk.io/store/v2, and cosmossdk.io/x/bank are all utilized in various files, confirming their necessity.

  • cosmossdk.io/server/v2/appmanager is used in server/v2/types.go, server/v2/server_test.go, server/v2/cometbft/abci.go, runtime/v2/builder.go, and runtime/v2/app.go.
  • cosmossdk.io/server/v2/stf is used in server/v2/stf/stf.go, server/v2/stf/stf_test.go, server/v2/stf/core_branch_service_test.go, runtime/v2/builder.go, runtime/v2/manager.go, runtime/v2/app.go, runtime/v2/store.go, and runtime/v2/module.go.
  • cosmossdk.io/store/v2 is used in numerous files such as store/v2/migration/manager.go, store/v2/store.go, store/v2/migration/manager_test.go, store/v2/database.go, store/v2/migration/stream.go, store/v2/storage/store.go, store/v2/snapshots/manager_test.go, store/v2/snapshots/chunk_test.go, store/v2/snapshots/store.go, store/v2/snapshots/helpers_test.go, store/v2/snapshots/store_test.go, store/v2/snapshots/snapshotter.go, store/v2/root/store_test.go, store/v2/pruning/manager_test.go, store/v2/storage/storage_test_suite.go, store/v2/root/store.go, store/v2/root/migrate_test.go, store/v2/snapshots/manager.go, store/v2/storage/sqlite/batch.go, store/v2/root/factory.go, store/v2/root/reader.go, store/v2/storage/sqlite/db_test.go, store/v2/storage/pebbledb/db.go, store/v2/storage/pebbledb/db_test.go, store/v2/storage/rocksdb/db_test.go, store/v2/storage/storage_bench_test.go, store/v2/snapshots/chunk.go, store/v2/storage/sqlite/db.go, store/v2/storage/rocksdb/batch.go, store/v2/proof/proof.go, store/v2/proof/commit_info.go, store/v2/storage/database.go, store/v2/db/goleveldb.go, store/v2/commitment/store.go, store/v2/storage/pebbledb/batch.go, store/v2/db/rocksdb_noflag.go, store/v2/storage/rocksdb/db.go, store/v2/db/pebbledb.go, store/v2/commitment/mem/tree.go, store/v2/commitment/tree.go, store/v2/db/db.go, store/v2/db/memdb.go, store/v2/commitment/metadata.go, store/v2/db/prefixdb.go, store/v2/db/rocksdb.go, store/v2/commitment/iavl/tree.go, store/v2/commitment/iavl/tree_test.go, store/v2/commitment/store_bench_test.go, store/v2/commitment/iavl/exporter.go, store/v2/commitment/iavl/importer.go, store/v2/commitment/store_test_suite.go, store/v2/pruning/manager.go, simapp/v2/app_test.go, server/v2/cometbft/server.go, server/v2/cometbft/snapshots.go, server/v2/cometbft/types/store.go, server/v2/cometbft/options.go, server/v2/store/commands.go, server/v2/store/config.go, server/v2/cometbft/abci.go, runtime/v2/builder.go, runtime/v2/store.go.
  • cosmossdk.io/x/bank is used in x/group/simulation/genesis.go, x/group/simulation/genesis_test.go, x/group/testutil/expected_keepers_mocks.go, x/group/testutil/app_config.go, x/group/keeper/tally_test.go, x/group/keeper/msg_server_test.go, x/group/keeper/genesis_test.go, x/group/keeper/abci_test.go, x/group/genesis_test.go, x/group/testutil/expected_keepers.go, x/group/simulation/operations_test.go, x/group/keeper/keeper_test.go, x/group/client/cli/tx_test.go, x/gov/types/v1/msgs_test.go, x/gov/keeper/msg_server_test.go, x/gov/migrations/v5/store_test.go, x/gov/keeper/common_test.go, x/gov/client/cli/util_test.go, x/distribution/migrations/v4/migrate_funds_test.go, x/genutil/types/genesis_state_test.go, x/genutil/types/expected_keepers.go, x/genutil/testutil/expected_keepers_mocks.go, x/genutil/gentx_test.go, x/genutil/gentx.go, x/genutil/genaccounts.go, x/feegrant/filtered_fee_test.go, x/bank/simulation/operations.go, x/bank/types/send_authorization_test.go, x/bank/types/metadata_test.go, x/bank/types/restrictions_test.go, x/bank/types/balance_test.go, x/bank/types/balance.go, x/authz/generic_authorization_test.go, x/authz/testutil/bank_helpers.go, x/authz/simulation/operations.go, x/authz/simulation/genesis.go, x/authz/simulation/decoder_test.go, x/authz/msgs_test.go, x/authz/keeper/grpc_query_test.go, x/authz/migrations/v2/store_test.go, x/authz/simulation/genesis_test.go, x/authz/keeper/keys_test.go, x/authz/keeper/msg_server_test.go, x/authz/keeper/keeper_test.go, x/authz/module/abci_test.go, x/authz/module/abci_test.go, x/authz/module/autocli.go, x/accounts/defaults/multisig/utils_test.go, x/bank/simulation/genesis_test.go, x/accounts/defaults/lockup/utils_test.go, x/accounts/defaults/lockup/lockup.go, x/genutil/client/cli/gentx_test.go, x/accounts/cli/cli_test.go, x/authz/codec.go, x/genutil/client/cli/commands.go, x/authz/client/cli/tx_test.go, x/authz/client/cli/tx.go, x/bank/simulation/proposals.go, x/bank/depinject.go, x/bank/testutil/helpers.go, x/bank/client/cli/tx_test.go, x/bank/client/cli/tx.go, x/bank/module.go, x/bank/keeper/genesis.go, x/bank/keeper/msg_server.go, x/bank/keeper/keeper.go, x/bank/keeper/view.go, x/bank/keeper/keeper_test.go, x/bank/keeper/send.go, x/bank/keeper/invariants.go, x/bank/keeper/msg_server_test.go, x/bank/keeper/grpc_query.go, x/bank/keeper/genesis_test.go, x/bank/keeper/grpc_query_test.go, x/bank/keeper/collections_test.go, x/bank/keeper/export_test.go, testutil/network/network.go, testutil/sims/state_helpers.go, testutil/sims/app_helpers.go, tests/sims/slashing/app_config.go, tests/sims/slashing/operations_test.go, tests/sims/gov/operations_test.go, testutil/network/util.go, tests/sims/nft/operations_test.go, tests/sims/protocolpool/app_config.go, tests/sims/protocolpool/operations_test.go, tests/sims/distribution/app_config.go, tests/sims/distribution/operations_test.go, tests/sims/bank/operations_test.go, tests/sims/feegrant/operations_test.go, tests/sims/authz/operations_test.go, tests/e2e/bank/grpc.go, tests/e2e/tx/service_test.go, tests/sims/nft/app_config.go, tests/e2e/staking/suite.go, tests/integration/gov/genesis_test.go, tests/integration/bank/bench_test.go, tests/integration/bank/app_test.go, tests/integration/gov/keeper/keeper_test.go, tests/e2e/tx/benchmarks_test.go, tests/integration/gov/common_test.go, tests/integration/distribution/appconfig.go, tests/integration/distribution/keeper/msg_server_test.go, tests/e2e/bank/suite.go, tests/integration/bank/keeper/deterministic_test.go, tests/e2e/distribution/withdraw_all_suite.go, tests/integration/gov/abci_test.go, tests/integration/types/pagination_test.go, tests/integration/types/filtered_pagination_test.go, tests/e2e/baseapp/utils.go, tests/integration/staking/app_config.go, tests/e2e/authz/grpc.go, tests/integration/tx/decode_test.go, tests/integration/types/fuzz_test.go, tests/integration/staking/simulation/operations_test.go, tests/e2e/group/suite.go, tests/e2e/authz/tx.go, tests/integration/staking/keeper/delegation_test.go, tests/integration/staking/keeper/unbonding_test.go, tests/integration/staking/keeper/validator_bench_test.go, tests/integration/staking/keeper/slash_test.go, tests/integration/staking/keeper/msg_server_test.go, tests/integration/tx/aminojson/aminojson_test.go, tests/integration/staking/keeper/common_test.go, tests/integration/staking/keeper/genesis_test.go, tests/integration/staking/keeper/validator_test.go, tests/e2e/accounts/wiring_test.go, tests/e2e/auth/suite.go, tests/integration/slashing/slashing_test.go, tests/integration/server/grpc/out_of_gas_test.go, tests/integration/staking/keeper/deterministic_test.go, tests/integration/slashing/abci_test.go, tests/integration/slashing/keeper/slash_redelegation_test.go, tests/e2e/accounts/multisig/test_suite.go, tests/integration/server/grpc/server_test.go, tests/e2e/accounts/lockup/utils.go, tests/e2e/auth/keeper/app_config.go, tests/e2e/accounts/base_account_test.go, tests/integration/slashing/app_config.go, tests/integration/slashing/keeper/keeper_test.go, tests/integration/protocolpool/module_test.go, tests/integration/evidence/keeper/infraction_test.go, tests/integration/mint/app_config.go, tests/integration/rapidgen/rapidgen.go, tests/integration/auth/client/cli/suite_test.go, tests/integration/auth/keeper/msg_server_test.go, tests/integration/runtime/query_test.go, tests/integration/protocolpool/app_config.go, simapp/app_di.go, simapp/app_test.go, simapp/app.go, simapp/v2/app_di.go, simapp/test_helpers.go, simapp/v2/simdv2/cmd/testnet.go, simapp/v2/app_config.go, simapp/simd/cmd/testnet.go, simapp/simd/cmd/testnet_test.go, simapp/mint_fn.go, simapp/app_config.go, tests/integration/evidence/app_config.go, client/v2/autocli/common_test.go.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the necessity of the updated dependencies.

# Test: Search for the usage of the updated dependencies. Expect: Necessary usage in the codebase.
rg --type go -A 5 $'cosmossdk.io/server/v2/appmanager'

Length of output: 1737


Script:

#!/bin/bash
# Description: Verify the necessity of the updated dependencies.

# Test: Search for the usage of the updated dependencies. Expect: Necessary usage in the codebase.
rg --type go -A 5 $'cosmossdk.io/server/v2/stf'
rg --type go -A 5 $'cosmossdk.io/store/v2'
rg --type go -A 5 $'cosmossdk.io/x/bank'

Length of output: 105565

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

29-29: LGTM! Ensure the updated dependency is necessary.

The dependency update to a specific commit version is approved. The change enhances stability by replacing the placeholder with a defined version.

However, verify that the updated dependency is necessary for the project.

Verification successful

Dependency Update Verified

The update to the cosmossdk.io/server/v2/appmanager dependency is necessary and used across multiple files in the project:

  • runtime/v2/builder.go
  • server/v2/server_test.go
  • server/v2/types.go
  • runtime/v2/app.go
  • server/v2/cometbft/abci.go

This confirms that the dependency is essential for the project's functionality.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the necessity of the updated dependency.

# Test: Search for the usage of the updated dependency. Expect: Necessary usage in the codebase.
rg --type go -A 5 $'cosmossdk.io/server/v2/appmanager'

Length of output: 1737

go.mod (1)

15-15: Dependency Addition Approved

The addition of the cosmossdk.io/server/v2/appmanager dependency looks good and is correctly formatted.

simapp/v2/go.mod (4)

15-15: Indirect Comment Removal Approved

The removal of the indirect comment from cosmossdk.io/store/v2 is appropriate and looks good.


47-47: New Dependency Addition Approved

The addition of the github.com/cometbft/cometbft/api dependency is correctly formatted and looks good.


61-61: Version Update Approved

The version update for cosmossdk.io/server/v2/appmanager is appropriate and correctly formatted.


48-48: Indirect Comment Removal Approved

The removal of the indirect comment from github.com/cometbft/cometbft/api is appropriate and looks good.

runtime/v2/manager.go (2)

224-225: Control Flow Improvement Approved

The addition of the else clause to handle cases where the module does not satisfy previous type assertions improves robustness.


230-230: Logging Statement Approved

The logging statement before the call to moduleI.ExportGenesis enhances visibility into the function's execution flow.

func (app *SimApp[T]) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) {
panic("not implemented")
// as if they could withdraw from the start of the next block
ctx := context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

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

Use context with timeout or cancellation.

Using context.Background() does not allow for timeout or cancellation. Consider using context.WithTimeout or context.WithCancel to handle potential long-running operations.

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()


bz := sha256.Sum256([]byte{})

ctx := context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

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

Use context with timeout or cancellation.

Using context.Background() does not allow for timeout or cancellation. Consider using context.WithTimeout or context.WithCancel to handle potential long-running operations.

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

server/v2/appmanager/appmanager.go Show resolved Hide resolved
@@ -92,7 +91,7 @@ func NewSimApp[T transaction.Tx](
logger log.Logger,
viper *viper.Viper,
) *SimApp[T] {
viper.Set(serverv2.FlagHome, DefaultNodeHome) // TODO possibly set earlier when viper is created
//viper.Set(serverv2.FlagHome, DefaultNodeHome) // TODO possibly set earlier when viper is created
Copy link
Member

Choose a reason for hiding this comment

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

Why is it commented?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this was the only way to enforce another folder than the home one. For the tests in order to be able to clear it in the end I want to use t.TempDir().

I even wonder if having the viper.set there if it is correct.

Copy link
Member

Choose a reason for hiding this comment

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

It was for avoiding it doing it in newApp (in root.go or somewhere there). We should move it there then

Copy link
Member

Choose a reason for hiding this comment

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

bump on this

go.mod Outdated 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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7bc73f0 and 728313a.

Files selected for processing (1)
  • runtime/v2/go.mod (1 hunks)
Files skipped from review due to trivial changes (1)
  • runtime/v2/go.mod

Copy link
Contributor

github-actions bot commented Aug 7, 2024

@randygrok your pull request is missing a changelog!

runtime/v2/manager.go Outdated 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: 1

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 728313a and e97fda6.

Files selected for processing (3)
  • server/v2/appmanager/appmanager.go (1 hunks)
  • simapp/v2/app_test.go (1 hunks)
  • simapp/v2/export.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • server/v2/appmanager/appmanager.go
  • simapp/v2/app_test.go
Additional context used
Path-based instructions (1)
simapp/v2/export.go (1)

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

Additional comments not posted (3)
simapp/v2/export.go (3)

16-20: LGTM!

The logic for loading the latest height and handling errors is correct.


23-26: LGTM!

The logic for exporting the genesis state and handling errors is correct.


28-33: LGTM! But address the TODO item.

The construction of the ExportedApp object is correct. Ensure to address the TODO item for the CometBFT consensus params.

simapp/v2/export.go 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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e97fda6 and 57c9751.

Files selected for processing (2)
  • simapp/v2/app_test.go (1 hunks)
  • simapp/v2/export.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • simapp/v2/app_test.go
Additional context used
Path-based instructions (1)
simapp/v2/export.go (1)

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

Additional comments not posted (5)
simapp/v2/export.go (5)

4-5: Imports look good.

The added imports for context and staking are necessary for the new functionality.


11-12: Comments are informative.

The added comments effectively describe the purpose of the ExportAppStateAndValidators function.


15-15: Use context with timeout or cancellation.

Using context.Background() does not allow for timeout or cancellation. Consider using context.WithTimeout or context.WithCancel to handle potential long-running operations.

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

17-21: Error handling is implemented correctly.

The function correctly handles errors when loading the latest height.


24-35: Error handling is correct, but address the TODO.

The function correctly handles errors when exporting genesis and validators. However, the consensus parameters are currently a placeholder (TODO).

Ensure that the consensus parameters are correctly implemented before finalizing the PR.

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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 57c9751 and a32d778.

Files selected for processing (3)
  • server/v2/appmanager/appmanager.go (2 hunks)
  • simapp/v2/app_test.go (1 hunks)
  • simapp/v2/export.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • server/v2/appmanager/appmanager.go
  • simapp/v2/app_test.go
Additional context used
Path-based instructions (1)
simapp/v2/export.go (1)

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

Additional comments not posted (3)
simapp/v2/export.go (3)

18-22: LGTM: Robust error handling for loading the latest height.

The code correctly loads the latest height and handles errors, ensuring robustness in case of failures.


25-28: LGTM: Effective error handling for exporting genesis state.

The code correctly exports the genesis state and handles errors, ensuring that any issues during export are managed.


30-40: LGTM: Context-aware validator handling with error management.

The use of RunWithCtx allows for context-aware operations, and error handling ensures any issues are addressed.

simapp/v2/export.go Outdated Show resolved Hide resolved
@randygrok randygrok marked this pull request as ready for review August 15, 2024 13:02
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)
simapp/app.go (1)

267-267: Inconsistent Refactoring Detected

The refactoring from consensusparamtypes to consensustypes is incomplete. The following files still contain references to consensusparamtypes:

  • testutil/integration/router.go
  • tests/integration/evidence/keeper/infraction_test.go

Please ensure that all occurrences are updated to maintain consistency across the codebase.

Analysis chain

Confirm consistency of refactoring.

The store key reference has been updated from consensusparamtypes.StoreKey to consensustypes.StoreKey. Ensure that all related references have been consistently updated throughout the codebase.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent renaming of `consensusparamtypes` to `consensustypes`.

# Test: Search for any remaining instances of `consensusparamtypes` in the codebase. Expect: No occurrences.
rg --type go 'consensusparamtypes'

Length of output: 950

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 91570fb and 858af16.

Files selected for processing (11)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (2 hunks)
  • runtime/v2/manager.go (2 hunks)
  • server/v2/appmanager/appmanager.go (2 hunks)
  • server/v2/cometbft/go.mod (1 hunks)
  • simapp/app.go (4 hunks)
  • simapp/v2/app_di.go (2 hunks)
  • simapp/v2/app_test.go (1 hunks)
  • simapp/v2/export.go (1 hunks)
  • simapp/v2/go.mod (5 hunks)
  • simapp/v2/simdv2/cmd/commands.go (5 hunks)
Files skipped from review due to trivial changes (1)
  • server/v2/cometbft/go.mod
Files skipped from review as they are similar to previous changes (5)
  • runtime/v2/app.go
  • runtime/v2/builder.go
  • runtime/v2/manager.go
  • simapp/v2/app_test.go
  • simapp/v2/go.mod
Additional context used
Path-based instructions (5)
simapp/v2/export.go (1)

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

simapp/v2/simdv2/cmd/commands.go (1)

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

server/v2/appmanager/appmanager.go (1)

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

simapp/v2/app_di.go (1)

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

simapp/app.go (1)

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

Additional comments not posted (13)
simapp/v2/export.go (4)

4-5: Use context with timeout or cancellation.

Using context.Background() does not allow for timeout or cancellation. Consider using context.WithTimeout or context.WithCancel to handle potential long-running operations.

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

15-18: LGTM: Correct error handling for LoadLatestHeight.

The error handling for LoadLatestHeight is correctly implemented by returning the error.


20-23: LGTM: Correct error handling for ExportGenesis.

The error handling for ExportGenesis is correctly implemented by returning the error.


25-28: LGTM: Correct construction of v2.ExportedApp.

The return statement correctly constructs and returns the v2.ExportedApp instance.

simapp/v2/simdv2/cmd/commands.go (3)

31-32: LGTM: Imports for genutilv2 and v2.

The imports for genutilv2 and v2 are correctly added and used in the file.


86-89: LGTM: Updated genesisCommand to use genutilv2.AppExporter.

The genesisCommand function correctly uses genutilv2.AppExporter and aligns with the new module structure.


Line range hint 149-164:
LGTM: Updated appExport to return genutilv2.ExportedApp.

The appExport function correctly returns genutilv2.ExportedApp and aligns with the new module structure.

server/v2/appmanager/appmanager.go (4)

92-95: LGTM: Correct error handling for StateAt.

The error handling for StateAt is correctly implemented by returning a formatted error message.


97-101: LGTM: Check for exportGenesis function configuration.

The logic correctly checks if exportGenesis is set and returns an error if not, ensuring proper configuration.


103-106: LGTM: Correct error handling for exportGenesis.

The error handling for exportGenesis is correctly implemented by returning a formatted error message.


190-203: Note on UnsafeRunWithCtx: Intended for genesis support.

The function is marked as unsafe and is intended for genesis support. Consider its removal as indicated by the TODO comment.

simapp/app.go (2)

521-521: Ensure module name consistency.

The module name has been updated from consensusparamtypes.ModuleName to consensustypes.ModuleName. Verify that this change is consistently applied across all module references.

Verification successful

Module Name Consistency Verified

The module name change from consensusparamtypes.ModuleName to consensustypes.ModuleName has been consistently applied across the codebase. Instances of the new module name are found in various files, confirming the update.

  • Files with consensustypes.ModuleName:
    • simapp/v2/app_config.go
    • simapp/app.go
    • simapp/app_config.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify consistent application of the new module name `consensustypes.ModuleName`.

# Test: Search for any remaining instances of `consensusparamtypes.ModuleName` in the codebase. Expect: No occurrences.
rg --type go 'consensusparamtypes.ModuleName'

Length of output: 45


Script:

#!/bin/bash
# Description: Verify presence and usage of the new module name `consensustypes.ModuleName`.

# Test: Search for occurrences of `consensustypes.ModuleName` in the codebase to ensure it is being used.
rg --type go 'consensustypes.ModuleName'

Length of output: 358


290-290: Verify the initialization of ConsensusParamsKeeper.

The ConsensusParamsKeeper is now initialized using consensustypes.StoreKey. Confirm that this change aligns with the updated package structure and does not affect the application's functionality.

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

Noice, utACK! I left a few comments.

runtime/v2/manager.go Outdated Show resolved Hide resolved
server/v2/appmanager/appmanager.go Outdated Show resolved Hide resolved
simapp/v2/app_di.go Show resolved Hide resolved
simapp/v2/go.mod Outdated Show resolved Hide resolved
x/genutil/v2/cli/commands.go Outdated 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

Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 858af16 and 4324f42.

Files selected for processing (4)
  • runtime/v2/manager.go (2 hunks)
  • server/v2/appmanager/appmanager.go (1 hunks)
  • simapp/v2/go.mod (4 hunks)
  • x/genutil/v2/cli/commands.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • runtime/v2/manager.go
  • server/v2/appmanager/appmanager.go
  • simapp/v2/go.mod
Additional context used
Path-based instructions (1)
x/genutil/v2/cli/commands.go (1)

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

Additional comments not posted (4)
x/genutil/v2/cli/commands.go (4)

3-15: Imports are well-organized.

The import statements are correctly grouped with a blank line separating standard library imports from third-party and local imports, adhering to the Uber Go style guide.


17-20: Interface genesisMM is well-defined.

The interface is concise and appropriately named, following Go's conventions for interface naming.


22-25: Function Commands is well-implemented.

The function effectively delegates to CommandsWithCustomMigrationMap, promoting code reuse and simplicity.


27-46: Function CommandsWithCustomMigrationMap is well-structured.

The function initializes a Cobra command with appropriate subcommands, ensuring modularity and clarity. The use of client.ValidateCmd for RunE is a good practice for command validation.

Ensure that the integration of this new command into the overall CLI structure is verified.

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 4324f42 and 1874e0c.

Files selected for processing (1)
  • simapp/v2/simdv2/cmd/commands.go (4 hunks)
Additional context used
Path-based instructions (1)
simapp/v2/simdv2/cmd/commands.go (1)

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

Additional comments not posted (5)
simapp/v2/simdv2/cmd/commands.go (5)

37-41: Function newApp appears correct.

The function initializes a new SimApp instance and sets a default node home using Viper. Ensure that the use of Viper aligns with best practices.


Line range hint 43-78: Function initRootCmd is well-structured.

The function correctly initializes the root command with various subcommands and handles logger creation. Verify that the logger setup is consistent with the rest of the application.


Line range hint 170-209: Type genericTxDecoder correctly implements transaction.Codec.

The implementation of transaction decoding appears correct. Ensure that error messages are informative and consistent with the rest of the application.


88-95: Function genesisCommand correctly uses genutilv2.AppExporter.

The function builds a command for genesis-related operations using the updated genutilv2.AppExporter type. Verify that this change aligns with the intended refactoring and does not introduce breaking changes.


150-168: Function appExport correctly transitions to genutilv2.ExportedApp.

The function exports the application state and validators using the new genutilv2.ExportedApp type. Ensure that this transition is seamless and consistent across the codebase.

@julienrbrt julienrbrt added this pull request to the merge queue Aug 16, 2024
Merged via the queue into main with commit aeeaca6 Aug 16, 2024
79 checks passed
@julienrbrt julienrbrt deleted the randy/export-genesis branch August 16, 2024 11:20
mergify bot pushed a commit that referenced this pull request Aug 16, 2024
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
(cherry picked from commit aeeaca6)

# Conflicts:
#	runtime/v2/app.go
#	runtime/v2/builder.go
#	runtime/v2/manager.go
#	server/v2/appmanager/appmanager.go
#	server/v2/cometbft/go.mod
#	simapp/app.go
#	simapp/v2/go.mod
julienrbrt added a commit that referenced this pull request Aug 16, 2024
Co-authored-by: Randy Grok <98407738+randygrok@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
lucaslopezf pushed a commit that referenced this pull request Aug 16, 2024
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
alpe added a commit that referenced this pull request Aug 19, 2024
* main: (76 commits)
  docs: more app v2 renaming (#21336)
  chore: update link in disclaimer (#21339)
  refactor(x/distribution): audit QA (#21316)
  docs: rename app v2 to app di when talking about runtime v0 (#21329)
  feat(schema): specify JSON mapping (#21243)
  fix(x/authz): bring back msg response in `DispatchActions` (#21044)
  chore: fix all lint issue since golangci-lint bump (#21326)
  refactor(x/mint): v0.52 audit x/mint (#21301)
  chore: fix spelling errors (#21327)
  feat: export genesis in simapp v2 (#21199)
  fix(baseapp)!: Halt at height now does not produce the halt height block (#21256)
  refactor(scripts): remove unused variable (#21320)
  chore(schema/testing): upgrade to go 1.23 iterators (#21282)
  chore: readmes + upgrading docs (#21271)
  feat(client): add auto cli for node service (#21074)
  ci: fix github workflow vulnerable to script injection (#21304)
  build(deps): Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.0 (#21307)
  build(deps): use Go 1.23 instead of Go 1.22 (#21280)
  refactor(x/auth): audit x/auth changes (#21146)
  chore: remove todo: "abstract out staking message back to staking" (#21266)
  ...
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:server/v2 appmanager C:server/v2 cometbft C:server/v2 Issues related to server/v2 C:x/genutil genutil module issues C:x/staking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

simapp/v2 needs an export implementation
5 participants