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

refactor(core)!: clean-up core and simplify preblock #19672

Merged
merged 9 commits into from
Mar 11, 2024
Merged

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Mar 6, 2024

Description

Further clean-up of core after #19652 and #19627 gets merged.

  • Rename a file for consistency
  • Alias types in the the right
  • Remove duplicates and update in module.go
  • Simplify Preblock to keep it identical in server/v2 and baseapp and simplify api

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

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

  • Refactor
    • Simplified PreBlock function across various components to return only an error, enhancing consistency and error handling.
    • Refined module migration interfaces and consensus version handling for better clarity and functionality.
  • New Features
    • Introduced new interfaces for block processing (HasBeginBlocker and HasEndBlocker) in the core app module.
  • Documentation
    • Updated CHANGELOGs reflecting the simplification of PreBlock functionality and other significant updates.
  • Chores
    • Adjusted import statements and relocated several functions and items to align with the new project structure.

Copy link
Contributor

coderabbitai bot commented Mar 6, 2024

Warning

Rate Limit Exceeded

@julienrbrt has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 14 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between f2ef59a and 24679de.

Walkthrough

These updates streamline error handling and module interactions across the codebase, notably shifting several functions to return only errors instead of a combination of response objects and errors. This simplification affects pre-block processing and module migration mechanisms, enhancing clarity and efficiency. Additionally, the modifications include interface refactoring within the app module system, emphasizing clearer function signatures and responsibilities, alongside adjustments in the upgrade module to align with these core changes.

Changes

Files Summary
baseapp/abci_test.go, runtime/app.go, simapp/app.go, testutil/mock/types_mock_appmodule.go, types/abci.go, types/module/module.go, types/module/module_test.go, x/upgrade/keeper/abci.go, x/upgrade/keeper/abci_test.go, x/upgrade/module.go Modified functions to return only an error, simplifying error handling.
baseapp/baseapp.go Updated preBlock function logic for handling ConsensusParams.
core/CHANGELOG.md, x/upgrade/CHANGELOG.md Documented changes related to PreBlock simplification and updates in the SDK and upgrade module.
core/appmodule/migrations.go, core/appmodule/v2/migrations.go, core/appmodule/module.go Introduced new interfaces for module migrations and consensus versions, and refined existing interfaces for clarity.
runtime/services/autocli.go, types/module/configurator.go Updated method signatures to use new interface types, reflecting the refined module interaction patterns.

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-tests 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 tests 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 tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@julienrbrt julienrbrt changed the title chore(core): clean-up core and simplify preblock refactor(core): clean-up core and simplify preblock Mar 11, 2024
@julienrbrt julienrbrt changed the title refactor(core): clean-up core and simplify preblock refactor(core)!: clean-up core and simplify preblock Mar 11, 2024
@julienrbrt julienrbrt marked this pull request as ready for review March 11, 2024 10:35
@julienrbrt julienrbrt requested a review from a team as a code owner March 11, 2024 10:35
@tac0turtle
Copy link
Member

we should see if we can drop gogoproto in core as well. protoiface.Messagev1 should suffice?

// write the consensus parameters in store to context
if rsp.ConsensusParamsChanged {
Copy link
Member

Choose a reason for hiding this comment

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

I like this being removed 👍

AppModule
// HasPreBlocker is the extension interface that modules should implement to run
// custom logic before BeginBlock.
// It can modify consensus parameters in storage and signal the caller through the return value.
Copy link
Member

Choose a reason for hiding this comment

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

// It can modify consensus parameters in storage and signal the caller through the return value.

This is not like this anymore, should be removed right?

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.

Review Status

Actionable comments generated: 4

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between d2e4096 and f2ef59a.
Files selected for processing (19)
  • baseapp/abci_test.go (4 hunks)
  • baseapp/baseapp.go (1 hunks)
  • core/CHANGELOG.md (1 hunks)
  • core/appmodule/migrations.go (1 hunks)
  • core/appmodule/module.go (3 hunks)
  • core/appmodule/v2/migrations.go (2 hunks)
  • core/appmodule/v2/module.go (1 hunks)
  • runtime/app.go (1 hunks)
  • runtime/services/autocli.go (1 hunks)
  • simapp/app.go (1 hunks)
  • testutil/mock/types_mock_appmodule.go (1 hunks)
  • types/abci.go (2 hunks)
  • types/module/configurator.go (4 hunks)
  • types/module/module.go (1 hunks)
  • types/module/module_test.go (1 hunks)
  • x/upgrade/CHANGELOG.md (1 hunks)
  • x/upgrade/keeper/abci.go (7 hunks)
  • x/upgrade/keeper/abci_test.go (11 hunks)
  • x/upgrade/module.go (1 hunks)
Additional comments: 58
core/appmodule/migrations.go (1)
  • 3-17: The introduction of type aliases from cosmossdk.io/core/appmodule/v2 enhances clarity and maintainability by providing a direct reference to the types related to module migrations and consensus versions. This change aligns with the PR's objective of simplifying and cleaning up the core components.
core/appmodule/v2/migrations.go (1)
  • 11-17: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [14-23]

The refinement of the HasMigrations interface to include the MigrationRegistrar for registering in-place store migrations enhances the module's upgrade capabilities. This change supports the PR's goal of improving the structure and organization of module migrations and consensus version handling.

types/abci.go (1)
  • 39-39: Modifying the PreBlocker function signature to return only an error simplifies error handling across different parts of the SDK. This change aligns with the PR's objective of standardizing the PreBlock function's behavior and simplifying error handling.
x/upgrade/CHANGELOG.md (2)
  • 28-31: The changelog entry correctly highlights the simplification of the PreBlock functionality as per the latest changes in the cosmossdk.io/core package. This entry provides clear information to users about the improvements made.
  • 38-38: The changelog entry for the modification of the NewKeeper function to take an appmodule.Environment instead of individual services accurately reflects the changes made to improve the module's flexibility and maintainability.
core/appmodule/v2/module.go (1)
  • 22-30: The addition of the HasPreBlocker interface, which allows modules to execute custom logic before BeginBlock, enhances the flexibility and modularity of the module's functionality. This change aligns with the PR's objective of simplifying and cleaning up the core components.
x/upgrade/keeper/abci.go (1)
  • 84-106: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [24-115]

Refactoring the PreBlocker method to return only an error simplifies the upgrade process by focusing on error propagation and handling, removing unnecessary complexity. This change aligns with the PR's objective of simplifying the Preblock functionality and improving the structure and organization of module migrations and consensus version handling.

x/upgrade/module.go (1)
  • 154-154: Modifying the PreBlock function to return only an error simplifies the control flow and error handling in the pre-block phase. This change aligns with the PR's objective of simplifying the Preblock functionality and enhancing the maintainability and clarity of the Cosmos SDK's core components.
types/module/configurator.go (3)
  • 12-12: The addition of "cosmossdk.io/core/appmodule" import is appropriate given the change in the method signature of Register to use appmodule.MigrationHandler. This aligns with the PR's objective of simplifying and cleaning up core components by using more specific types.
  • 50-50: The update to the Register method's signature in the Configurator interface to use appmodule.MigrationHandler instead of func(context.Context) error for the handler parameter is a positive change. It enhances clarity and maintainability by leveraging a more specific type that better represents the intended functionality. This change is consistent with the PR's objectives of simplifying and improving the SDK's core components.
  • 127-127: The implementation of the updated Register method in the configurator struct correctly adapts the appmodule.MigrationHandler to the existing RegisterMigration method by wrapping the handler in a function that matches the expected signature. This maintains compatibility and ensures that the new method signature can be integrated seamlessly with the existing migration logic. It's a good example of adapting interfaces to enhance code modularity and maintainability.
core/CHANGELOG.md (1)
runtime/app.go (1)
  • 156-156: The modification of the PreBlocker method signature to return only an error is consistent with the PR's objective to simplify the PreBlock functionality. This change should streamline error handling across the SDK.
x/upgrade/keeper/abci_test.go (17)
  • 48-48: The change from ignoring the error to explicitly handling it by assigning it to err is a good practice as it ensures that errors are not silently ignored and are properly checked.
  • 56-56: Correctly handling the error by assigning it to err and using require.NoError to assert that no error occurred is a good practice. This ensures that the test fails if an unexpected error is encountered.
  • 66-66: Assigning the error to err and checking it with require.ErrorContains is a good practice. It ensures that the specific expected error is returned, which is crucial for validating the behavior of the PreBlock function under test conditions.
  • 74-74: Properly handling the error by assigning it to err and asserting no error with require.NoError is correct. This change ensures that the test accurately reflects the expected behavior of the PreBlock function after the upgrade handler is set.
  • 178-178: Assigning the error to err and asserting no error with require.NoError is appropriate. It verifies that the PreBlock function behaves as expected when there is no upgrade plan registered in the database, which is a valid test scenario.
  • 185-185: The explicit error handling by assigning the result to err and using require.EqualError to check for a specific error message is a good practice. It ensures that the test accurately captures the expected behavior when a binary update occurs before the trigger.
  • 192-192: Properly handling the error by assigning it to err and asserting no error with require.NoError is correct. This ensures that the test accurately reflects the expected behavior of the PreBlock function when the upgrade plan is on time.
  • 226-226: Correctly handling the error by assigning it to err and using require.NoError to assert that no error occurred is a good practice. This ensures that the test fails if an unexpected error is encountered, which is crucial for validating the behavior of the PreBlock function in scenarios where no upgrade has been scheduled.
  • 263-263: Assigning the error to err and asserting no error with require.NoError is appropriate. It verifies that the PreBlock function behaves as expected when the upgrade plan is cleared due to the skip upgrade flag, which is a valid test scenario.
  • 271-271: Properly handling the error by assigning it to err and asserting no error with require.NoError is correct. This change ensures that the test accurately reflects the expected behavior of the PreBlock function after clearing a second upgrade plan due to the skip upgrade flag.
  • 298-298: Assigning the error to err and asserting no error with require.NoError is appropriate. It verifies that the PreBlock function behaves as expected when the upgrade plan is cleared in one case and proceeds with the upgrade in another, which is a valid test scenario.
  • 331-331: Properly handling the error by assigning it to err and asserting no error with require.NoError is correct. This ensures that the test accurately reflects the expected behavior of the PreBlock function when clearing upgrade plans due to the skip upgrade flag.
  • 339-339: Assigning the error to err and asserting no error with require.NoError is appropriate. It verifies that the PreBlock function behaves as expected when clearing a second upgrade plan due to the skip upgrade flag, which is a valid test scenario.
  • 360-360: Correctly handling the error by assigning it to err and using require.ErrorContains to assert that a specific error occurred is a good practice. This ensures that the test accurately captures the expected behavior when an upgrade is needed at a specific height.
  • 450-450: Assigning the error to err and conditionally checking it based on the expectError flag is a good practice. It ensures that the test accurately reflects the expected behavior of the PreBlock function under various scenarios, including both error and no-error conditions.
  • 489-489: Properly handling the error by assigning it to err and asserting no error with require.NoError is correct. This ensures that the test accurately reflects the expected behavior of the PreBlock function after a successful upgrade.
  • 539-539: Correctly handling the error by assigning it to err and conditionally checking it based on the expectError flag is a good practice. It ensures that the test accurately captures the expected behavior under various downgrade verification scenarios.
types/module/module_test.go (2)
  • 421-422: The modification to the PreBlock function to directly handle errors and the corresponding adjustment in the test to assert no error with require.NoError is a good practice. It simplifies the function's signature and focuses on error handling, which is crucial for the correctness of the test.
  • 427-427: Properly handling the error by assigning it to err and using require.EqualError to check for a specific error message is a good practice. It ensures that the test accurately captures the expected behavior when an error is returned by the PreBlock function.
testutil/mock/types_mock_appmodule.go (1)
  • 662-666: The change in the PreBlock method's return type from (appmodule.ResponsePreBlock, error) to just error aligns with the PR's objective of simplifying the PreBlock functionality. This should help in streamlining error handling and reducing complexity. However, it's important to verify that this change does not adversely affect error handling patterns or the usage of this method across the SDK.
types/module/module.go (1)
  • 709-718: The changes to the PreBlock function, including the updated return type and the adjusted error handling logic, align with the PR's objectives to simplify the PreBlock functionality. This simplification should make the code more maintainable and easier to understand. Ensure that all modules implementing appmodule.HasPreBlocker correctly handle errors in their PreBlock implementations.
simapp/app.go (1)
  • 618-618: The PreBlocker function's signature has been simplified to return only an error, aligning with the PR's objective to simplify the PreBlock functionality. This change standardizes error handling across different parts of the SDK and reduces complexity. Ensure that all calls to PreBlocker across the SDK have been updated to handle the new signature correctly.
baseapp/baseapp.go (1)
  • 709-718: The modifications to the preBlock function enhance clarity and ensure that the context is updated with the latest consensus parameters and gas metering. This is crucial for maintaining the integrity of the blockchain state and ensuring that transactions are processed correctly with respect to the current consensus rules. The error handling and context updates are implemented correctly and follow best practices for state management within the Cosmos SDK's BaseApp.

One minor suggestion is to ensure that any potential side effects of app.preBlocker(ctx, req) are well-documented, especially since the context is being updated immediately after. It's important for future maintainers to understand why these updates are necessary and how they affect the application's state.

Overall, the changes are well-implemented and contribute to the robustness of the preBlock functionality.

baseapp/abci_test.go (22)
  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [11-59]

Looks good! The test TestABCI_Info is well-structured and covers the expected behavior of the Info ABCI call comprehensively.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [61-76]

The test TestABCI_First_block_Height correctly verifies the initial block height setting during the InitChain call.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [78-169]

The test TestABCI_InitChain is comprehensive and effectively tests various scenarios related to the InitChain call, including error handling and state initialization.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [171-187]

The test TestABCI_InitChain_WithInitialHeight correctly verifies the behavior of setting an initial block height during the InitChain call.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [189-210]

The test TestABCI_FinalizeBlock_WithInitialHeight effectively verifies the behavior of finalizing a block with a specific initial height, including error handling.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [212-261]

The test TestABCI_FinalizeBlock_WithBeginAndEndBlocker correctly verifies the behavior of custom BeginBlocker and EndBlocker functions during the FinalizeBlock call, including event generation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [263-366]

The test TestABCI_ExtendVote is comprehensive and effectively tests various scenarios related to vote extension and verification, including error handling.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [368-413]

The test TestABCI_OnlyVerifyVoteExtension correctly verifies the behavior of verifying vote extensions independently of the ExtendVote call.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [415-454]

The test TestABCI_GRPCQuery effectively verifies the behavior of executing a gRPC query through the ABCI interface, including error handling and response validation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [456-485]

The test TestABCI_P2PQuery correctly verifies the behavior of executing P2P queries through the ABCI interface, including custom filter handling and response validation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [487-507]

The test TestBaseApp_PrepareCheckState effectively verifies that the PrepareCheckState hook is called with the correct context.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [509-529]

The test TestBaseApp_Precommit effectively verifies that the Precommit hook is called with the correct context.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [531-597]

The test TestABCI_CheckTx is comprehensive and effectively tests various scenarios related to the CheckTx call, including persistence of changes and error handling.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [599-660]

The test TestABCI_FinalizeBlock_DeliverTx is comprehensive and effectively tests various scenarios related to the FinalizeBlock call, including transaction delivery and event generation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [662-724]

The test TestABCI_FinalizeBlock_MultiMsg effectively verifies the behavior of delivering a transaction with multiple messages during the FinalizeBlock call, including handling of different message types.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [726-789]

The test TestABCI_Query_SimulateTx is comprehensive and effectively tests the behavior of simulating a transaction through the ABCI Query call, including gas consumption reporting and response validation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [791-870]

The test TestABCI_InvalidTransaction is comprehensive and effectively tests various scenarios related to handling invalid transactions during the FinalizeBlock call, including error handling and response validation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [872-944]

The test TestABCI_TxGasLimits is comprehensive and effectively tests various scenarios related to enforcing gas limits on transactions during the FinalizeBlock call, including error handling and response validation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [946-1008]

The test TestABCI_MaxBlockGasLimits is comprehensive and effectively tests various scenarios related to enforcing maximum block gas limits during the FinalizeBlock call, including error handling and response validation.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1010-1037]

The test TestABCI_GasConsumptionBadTx correctly verifies the behavior of gas consumption for transactions that fail during the FinalizeBlock call, including handling of different failure scenarios.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1039-1071]

The test TestABCI_Query effectively verifies the behavior of executing a query through the ABCI interface, including setting and retrieving values from the store.

  • 2041-2049: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [1073-1122]

The test TestABCI_GetBlockRetentionHeight is comprehensive and effectively tests various scenarios for calculating block retention height based on different parameters.

### API Breaking Changes

* [#19672](https://github.com/cosmos/cosmos-sdk/pull/19672) `PreBlock` now returns only an error for consistency with server/v2. The SDK has upgraded x/upgrade accordingly.
* [#18857](https://github.com/cosmos/cosmos-sdk/pull/18857) Moved `FormatCoins` to `x/tx`.
Copy link
Contributor

Choose a reason for hiding this comment

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

The URL for PR #18861 contains a typo: httpes://github.com/cosmos/cosmos-sdk/pull/18861. It should be https://.

- * [#18861](httpes://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.
+ * [#18861](https://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
* [#18857](https://github.com/cosmos/cosmos-sdk/pull/18857) Moved `FormatCoins` to `x/tx`.
* [#18857](https://github.com/cosmos/cosmos-sdk/pull/18857) Moved `FormatCoins` to `x/tx`.
* [#18861](https://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.

Comment on lines 54 to 62
* Add `MsgHandler` as an alternative to grpc handlers
* Provide separate `MigrationRegistrar` instead of grouping with `RegisterServices`

### Improvements

### API Breaking Changes

* [#19672](https://github.com/cosmos/cosmos-sdk/pull/19672) `PreBlock` now returns only an error for consistency with server/v2. The SDK has upgraded x/upgrade accordingly.
* [#18857](https://github.com/cosmos/cosmos-sdk/pull/18857) Moved `FormatCoins` to `x/tx`.
* [#18861](httpes://github.com/cosmos/cosmos-sdk/pull/18861) Moved `coin.ParseCoin` to `client/v2/internal`.
* [#18866](https://github.com/cosmos/cosmos-sdk/pull/18866) All items related to depinject have been moved to `cosmossdk.io/depinject` (`Provide`, `Invoke`, `Register`)
Copy link
Contributor

Choose a reason for hiding this comment

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

📝 NOTE
This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [42-42]

There's a missing space after the period in the entry for PR #18457. This is a minor formatting issue but important for readability.

- * [#18457](https://github.com/cosmos/cosmos-sdk/pull/18457) Add branch.ExecuteWithGasLimit.
+ * [#18457](https://github.com/cosmos/cosmos-sdk/pull/18457) Add branch.ExecuteWithGasLimit. 

Comment on lines 17 to 29
// HasPreBlocker is the extension interface that modules should implement to run
// custom logic before BeginBlock.
// It can modify consensus parameters in storage and signal the caller through the return value.
// The new context (ctx) must be passed to all the other lifecycle methods.
type HasPreBlocker = appmodule.HasPreBlocker

// RegisterMigrations registers the module's migrations with the app's migrator.
RegisterMigrations(MigrationRegistrar) error
}
// HasBeginBlocker is the extension interface that modules should implement to run
// custom logic before transaction processing in a block.
type HasBeginBlocker = appmodule.HasBeginBlocker

// HasEndBlocker is the extension interface that modules should implement to run
// custom logic after transaction processing in a block.
type HasEndBlocker = appmodule.HasEndBlocker
Copy link
Contributor

Choose a reason for hiding this comment

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

The removal of the HasMigrations interface and the addition of HasBeginBlocker and HasEndBlocker interfaces are significant changes that enhance the modularity and clarity of the module's functionality. These changes align with the PR's objective of simplifying and cleaning up the core components. However, ensure that the removal of HasMigrations does not impact modules that might rely on this interface for migration logic.

Comment on lines +116 to +118
func (a *autocliConfigurator) Register(string, uint64, appmodule.MigrationHandler) error {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Updating the Register method to take a MigrationHandler type for the third parameter simplifies the method signature and potentially aligns with the broader refactoring efforts to streamline error handling and module migrations. Ensure this change is consistently applied across all relevant parts of the SDK where the Register method is used.

@julienrbrt
Copy link
Member Author

julienrbrt commented Mar 11, 2024

we should see if we can drop gogoproto in core as well. protoiface.Messagev1 should suffice?

Looks like we still need to import it for:

func messageName[M Message]() string {

I would guess it is fine? I cannot access revProtoTypes from gogoproto without importing it.

@tac0turtle tac0turtle added this pull request to the merge queue Mar 11, 2024
Merged via the queue into main with commit fea88d1 Mar 11, 2024
60 of 62 checks passed
@tac0turtle tac0turtle deleted the julien/core branch March 11, 2024 14:43
@coderabbitai coderabbitai bot mentioned this pull request May 3, 2024
12 tasks
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.

3 participants