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: upstream runtime/v2 #20320

Merged
merged 23 commits into from
May 14, 2024
Merged

chore: upstream runtime/v2 #20320

merged 23 commits into from
May 14, 2024

Conversation

kocubinski
Copy link
Member

@kocubinski kocubinski commented May 8, 2024

Description

Upstream runtime/v2 used in server/v2 development branches. Depends on: #20315, #20286

Also brings in some store/v2 bug fixes and required features discovered in the simapp/v2 integration (so far).


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

  • New Features

    • Introduced in-memory tree management capabilities, including operations like removing keys, version management, and data import/export.
  • Enhancements

    • Updated the CommitStore with improved function signatures and internal operation adjustments.
    • Enhanced error reporting in storage systems to include requested version details in pruned version errors.
  • Refactor

    • Reorganized import statements and updated function parameters in various store management files.
    • Commented out the creation and testing of RocksDB instances, shifting focus towards other database systems.
  • Documentation

    • Minor adjustments in comments and error message strings for better clarity and consistency.

@kocubinski kocubinski requested a review from a team as a code owner May 8, 2024 14:06
Copy link
Contributor

coderabbitai bot commented May 8, 2024

Walkthrough

Walkthrough

The updates across various modules primarily enhance functionality and introduce new features in memory management, data storage, and module interaction. Key enhancements include the addition of new methods for tree management, restructuring of database interactions, and the introduction of a new module manager for streamlined module operations. These changes aim to improve efficiency, extend capabilities, and provide clearer error handling and version management.

Changes

Files Grouped by Similar Changes Summary
store/v2/commitment/mem/tree.go, store/v2/commitment/store.go Enhanced tree and store functionalities with new methods for operations like version management, proof retrieval, and data import/export.
store/v2/db/db.go Suspended creation of RocksDB instance in NewRawDB function.
store/v2/root/store.go Improved error message clarity by updating "SS" to "SC" in the loadVersion method.

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.

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

@kocubinski kocubinski marked this pull request as draft May 8, 2024 14:06
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: 4

Out of diff range and nitpick comments (1)
runtime/v2/manager.go (1)

32-38: Ensure proper documentation for the MM struct to enhance code maintainability.

Consider adding a descriptive comment above the MM struct to explain its purpose and main responsibilities within the system. This will improve code readability and maintainability.

Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 03d70aa and b36b6cd.
Files ignored due to path filters (2)
  • runtime/v2/go.mod is excluded by !**/*.mod
  • runtime/v2/go.sum is excluded by !**/*.sum
Files selected for processing (10)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/manager.go (1 hunks)
  • runtime/v2/migrations.go (1 hunks)
  • runtime/v2/module.go (1 hunks)
  • runtime/v2/services/autocli.go (1 hunks)
  • runtime/v2/services/comet.go (1 hunks)
  • runtime/v2/services/reflection.go (1 hunks)
  • runtime/v2/store.go (1 hunks)
  • runtime/v2/types.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • runtime/v2/services/comet.go
  • runtime/v2/types.go
Additional Context Used
Path-based Instructions (8)
runtime/v2/services/reflection.go (1)

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

runtime/v2/store.go (1)

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

runtime/v2/migrations.go (1)

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

runtime/v2/services/autocli.go (1)

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

runtime/v2/app.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/module.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 (23)
runtime/v2/services/reflection.go (2)

12-25: The implementation of ReflectionService and its constructor NewReflectionService are correctly handling the initialization of file descriptors. Good use of error handling in the constructor.


27-31: The FileDescriptors method correctly constructs and returns the file descriptor response. Proper use of context and error handling.

runtime/v2/store.go (2)

10-15: The NewKVStoreService function is implemented correctly, ensuring backward compatibility by accepting a string key and converting it to bytes.


17-50: The Store interface is well-defined, covering all necessary methods for state management and data querying with clear and consistent method signatures.

runtime/v2/migrations.go (3)

12-22: The migrationRegistrar struct and its constructor newMigrationRegistrar are correctly implemented, initializing the migration map appropriately.


24-42: The Register method in migrationRegistrar correctly handles registration of module migrations, including validation for version numbering and prevention of duplicate registrations.


44-69: The RunModuleMigrations method is well-implemented, ensuring that migrations are run sequentially and handling cases where no migrations are necessary or where a migration is missing.

runtime/v2/services/autocli.go (3)

18-33: The AutoCLIQueryService struct and its constructor NewAutoCLIQueryService are correctly implemented, effectively extracting AutoCLI options from app modules and handling errors appropriately.


35-86: The ExtractAutoCLIOptions method is well-implemented, handling the extraction of AutoCLI options from various types of modules with comprehensive error handling and conditional logic.


88-92: The AppOptions method correctly constructs and returns the AutoCLI options response. Proper use of context and error handling.

runtime/v2/app.go (7)

23-143: The App struct and its associated methods like Logger, ModuleManager, DefaultGenesis, etc., are well-implemented, effectively managing various aspects of the application lifecycle and configurations.


84-92: The methods for managing application state, such as LoadLatest and LoadHeight, are correctly implemented, handling different versions of the application state with appropriate error handling.


94-97: The Close method is correctly implemented for resource cleanup, aligning with the current requirements of the application.


99-112: The methods RegisterStores and GetStoreKeys are correctly implemented, handling the registration and retrieval of store keys effectively.


114-123: The UnsafeFindStoreKey method is correctly implemented for testing purposes, using a linear search to find a store key. Caution is advised if used outside of testing due to its linear search time complexity.


125-131: The getter methods GetStore and GetLogger are straightforward and correctly implemented, providing essential access to the application's store and logger.


133-143: The methods ExecuteGenesisTx, SetAppVersion, and AppVersion are placeholders and currently not implemented, throwing a panic. Consider implementing these methods or handling them more gracefully in production environments.

runtime/v2/builder.go (3)

20-61: The AppBuilder struct and its methods like DefaultGenesis and RegisterModules are well-implemented, effectively managing various aspects of application building and configurations.


63-148: The Build method in AppBuilder is well-implemented, orchestrating the building of an application instance with comprehensive error handling and conditional logic for handling defaults and configurations.


150-167: The AppBuilderOption functions, such as AppBuilderWithBranch and AppBuilderWithTxValidator, provide effective customization options for the application builder, allowing for setting custom implementations and configurations.

runtime/v2/module.go (2)

40-101: The appModule struct and its methods like RegisterServices and AutoCLIOptions are well-implemented, effectively managing various aspects of module management and service registration.


103-321: The init function and associated provider functions in runtime/v2/module.go are correctly implemented, registering various providers and invokers for the application configuration effectively.

runtime/v2/manager.go (1)

143-195: Validate the error handling in InitGenesisJSON.

The method InitGenesisJSON handles various error scenarios, but it's crucial to ensure that all potential errors are appropriately managed and that the error messages are clear and informative. Consider adding tests or checks to verify the robustness of error handling.

Verification successful

The verification of the error handling in the InitGenesisJSON method within manager.go has been successfully conducted. The results from the script show a variety of error handling patterns, including the use of errorsmod.Wrap, errorsmod.Wrapf, and direct returns of err. These patterns indicate that the method and related code handle errors robustly and provide clear, informative error messages through wrapping errors with additional context.

Here are some specific findings:

  • Errors are wrapped with context, providing clarity on what the error pertains to, such as "can't begin a none operation" or "failed to create snapshot directory".
  • Direct returns of err are also present, which is typical in Go for propagating errors up the call stack.
  • The method InitGenesisJSON specifically handles a critical error scenario where validator updates are already set by a previous module, returning a new error with a clear message.

Based on these observations, the error handling within the InitGenesisJSON method and associated parts of manager.go appears to be well-implemented, with comprehensive checks and clear, informative error messages.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify error handling in InitGenesisJSON.

# Test: Search for error handling patterns. Expect: Comprehensive error checks and clear messages.
rg --type go 'return err' 'manager.go'

Length of output: 89



Script:

#!/bin/bash
# Locate the correct path for manager.go and verify error handling in InitGenesisJSON.
fd manager.go --exec rg --type go 'return err' {}

Length of output: 3173

@julienrbrt julienrbrt mentioned this pull request May 8, 2024
12 tasks
@kocubinski kocubinski marked this pull request as ready for review May 10, 2024 17:38
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.

🚢

runtime/v2/services/autocli.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
runtime/v2/manager.go Dismissed Show dismissed Hide dismissed
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: 10

Out of diff range and nitpick comments (1)
server/v2/stf/stf.go (1)

Line range hint 81-81: Avoid using panic for error handling in constructors.

Using panic within the NewSTF constructor (line 81) can lead to abrupt termination of the application. It's generally better practice in Go to return errors from constructors and let the caller handle them gracefully.

-	panic(err)
+	return nil, err
Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between b36b6cd and d5d3469.
Files ignored due to path filters (4)
  • runtime/v2/go.mod is excluded by !**/*.mod
  • runtime/v2/go.sum is excluded by !**/*.sum
  • store/v2/go.mod is excluded by !**/*.mod
  • store/v2/go.sum is excluded by !**/*.sum
Files selected for processing (33)
  • core/appmodule/v2/genesis.go (1 hunks)
  • core/appmodule/v2/message.go (1 hunks)
  • core/context/context.go (2 hunks)
  • core/transaction/transaction.go (2 hunks)
  • go.work.example (2 hunks)
  • proto/cosmos/app/runtime/v2/module.proto (1 hunks)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/manager.go (1 hunks)
  • runtime/v2/migrations.go (1 hunks)
  • runtime/v2/module.go (1 hunks)
  • runtime/v2/services/autocli.go (1 hunks)
  • runtime/v2/services/comet.go (1 hunks)
  • runtime/v2/services/reflection.go (1 hunks)
  • runtime/v2/services/transaction.go (1 hunks)
  • runtime/v2/store.go (1 hunks)
  • runtime/v2/types.go (1 hunks)
  • server/v2/stf/core_router_service.go (1 hunks)
  • server/v2/stf/export_test.go (1 hunks)
  • server/v2/stf/mock/tx.go (1 hunks)
  • server/v2/stf/stf.go (1 hunks)
  • server/v2/stf/stf_router.go (2 hunks)
  • store/v2/commitment/mem/tree.go (1 hunks)
  • store/v2/commitment/store.go (8 hunks)
  • store/v2/db/db.go (1 hunks)
  • store/v2/db/db_test.go (1 hunks)
  • store/v2/errors/errors.go (1 hunks)
  • store/v2/internal/util.go (1 hunks)
  • store/v2/root/factory.go (1 hunks)
  • store/v2/root/store.go (1 hunks)
  • store/v2/storage/pebbledb/db.go (1 hunks)
  • store/v2/storage/rocksdb/db.go (1 hunks)
  • store/v2/storage/sqlite/db.go (3 hunks)
Files skipped from review due to trivial changes (3)
  • go.work.example
  • server/v2/stf/export_test.go
  • store/v2/root/store.go
Files skipped from review as they are similar to previous changes (9)
  • runtime/v2/app.go
  • runtime/v2/builder.go
  • runtime/v2/migrations.go
  • runtime/v2/module.go
  • runtime/v2/services/autocli.go
  • runtime/v2/services/comet.go
  • runtime/v2/services/reflection.go
  • runtime/v2/store.go
  • runtime/v2/types.go
Additional Context Used
Path-based Instructions (20)
store/v2/internal/util.go (1)

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

core/context/context.go (1)

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

core/appmodule/v2/message.go (1)

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

store/v2/db/db.go (1)

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

core/appmodule/v2/genesis.go (1)

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

runtime/v2/services/transaction.go (1)

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

core/transaction/transaction.go (1)

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

store/v2/commitment/mem/tree.go (1)

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

store/v2/errors/errors.go (1)

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

server/v2/stf/mock/tx.go (1)

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

store/v2/db/db_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"

store/v2/root/factory.go (1)

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

server/v2/stf/core_router_service.go (1)

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

server/v2/stf/stf_router.go (1)

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

store/v2/storage/rocksdb/db.go (1)

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

store/v2/storage/sqlite/db.go (1)

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

store/v2/storage/pebbledb/db.go (1)

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

store/v2/commitment/store.go (1)

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

server/v2/stf/stf.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 (19)
store/v2/internal/util.go (1)

5-7: The implementation of IsMemoryStoreKey is concise and correctly checks for the "memory:" prefix in keys. Good use of strings.HasPrefix for this purpose.

core/context/context.go (1)

Line range hint 1-21: The definitions of ExecMode and related constants are well-implemented. Using iota for ExecModeKey ensures uniqueness and clarity in its usage within contexts.

core/appmodule/v2/message.go (1)

Line range hint 8-14: The implementation of messageName function and the type alias Message are well-designed. The type switch in messageName is effectively used to handle different message types, ensuring robustness.

store/v2/db/db.go (1)

25-26: Please add a comment explaining why the DBTypeRocksDB case is commented out. This will help maintain clarity and prevent confusion about the support status of RocksDB.

core/appmodule/v2/genesis.go (1)

18-20: The introduction of the HasABCIGenesis interface is well-thought-out, providing clear and modular handling of genesis-related operations, especially with the ability to return ValidatorUpdate from InitGenesis.

core/transaction/transaction.go (1)

25-25: Please ensure that the TODO comment in GetSenders is tracked in an issue or resolved. It's important to have clarity on whether the method will be adjusted to return a single identity.

store/v2/errors/errors.go (2)

46-47: The addition of RequestedVersion and EarliestVersion fields in the ErrVersionPruned struct enhances error descriptiveness.


51-51: The error message now effectively utilizes the new fields to provide a clearer context on version pruning issues.

server/v2/stf/mock/tx.go (1)

25-26: The implementation of GetMessages correctly returns the transaction's message in a slice.

store/v2/db/db_test.go (1)

109-118: The TestRocksDBSuite is commented out with a note to re-enable it behind a build flag. Verify the reason for this and consider tracking this as an issue or TODO in the project.

proto/cosmos/app/runtime/v2/module.proto (1)

7-56: The protobuf message Module is well-defined with clear configurations for runtime modules.

store/v2/root/factory.go (1)

41-101: The CreateRootStore function is well-implemented, demonstrating the necessary steps and configurations for creating a root store based on the provided options.

server/v2/stf/core_router_service.go (1)

15-37: The NewRouterService function correctly initializes a router service with separate handlers for messages and queries, using appropriate error handling.

server/v2/stf/stf_router.go (1)

57-60: The HandlerExists method correctly checks for the existence of a handler for a given message type.

store/v2/storage/rocksdb/db.go (1)

102-102: The getSlice method appropriately handles version checks and uses the ErrVersionPruned error to report issues effectively.

store/v2/storage/sqlite/db.go (1)

142-142: Enhanced error descriptiveness in version pruning is a good improvement.

store/v2/storage/pebbledb/db.go (1)

152-152: Enhanced error descriptiveness in version pruning is a good improvement.

store/v2/commitment/store.go (2)

48-53: Initialization of default pruning options when none are provided enhances robustness.


92-94: Skipping memory store keys in commit info generation aligns with best practices for data persistence.

@@ -290,7 +290,7 @@ func (s STF[T]) runTxMsgs(
if err != nil {
return nil, 0, nil, err
}
msgs := tx.GetMessages()
msgs, err := tx.GetMessages()
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider handling errors more gracefully in runTxMsgs.

The error handling in the runTxMsgs method could be improved. Currently, if an error occurs when fetching messages with tx.GetMessages(), the method returns immediately. This might leave some cleanup or state finalization steps skipped, which could lead to inconsistent state or resource leaks. Consider adding a deferred function to handle such cleanup tasks.

+	defer func() {
+		if err != nil {
+			// Perform necessary cleanup
+		}
+	}()

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
msgs, err := tx.GetMessages()
msgs, err := tx.GetMessages()
defer func() {
if err != nil {
// Perform necessary cleanup
}
}()

Optimize error handling in message processing.

In the runTxMsgs function, the error handling could be optimized by adding a deferred cleanup or rollback mechanism. This would ensure that any resources are properly released or states are reverted in case of an error during message processing.

+	defer func() {
+		if err != nil {
+			// Cleanup or rollback
+		}
+	}()

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
msgs, err := tx.GetMessages()
msgs, err := tx.GetMessages()
defer func() {
if err != nil {
// Cleanup or rollback
}
}()

runtime/v2/manager.go Show resolved Hide resolved
runtime/v2/manager.go Show resolved Hide resolved
@@ -84,7 +84,7 @@ func New(dataDir string) (*Database, error) {

return &Database{
storage: storage,
earliestVersion: pruneHeight + 1,
earliestVersion: pruneHeight,
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The analysis of the earliestVersion usage in the codebase suggests a potential issue with its initialization. The variable is used to determine if a targetVersion is pruned by comparing it against earliestVersion. Additionally, earliestVersion is updated to version + 1 elsewhere in the code, indicating that it should be one more than the last pruned version. Initializing it directly to pruneHeight could lead to versions being considered pruned earlier than intended. This discrepancy needs attention:

  • File: store/v2/storage/sqlite/db.go
    • Line 87: Initialization of earliestVersion to pruneHeight might be incorrect.
    • Line 102: earliestVersion is set to version + 1, which conflicts with the initialization logic.
Analysis chain

Verify the change in earliestVersion initialization.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the intended behavior of `earliestVersion` initialization change.

# Test: Search for the usage of `earliestVersion`. Expect: Consistent usage considering the new initialization.
rg --type go $'earliestVersion' -- 'store/v2/storage/sqlite/'

Length of output: 638

@@ -60,7 +66,7 @@ func NewCommitStore(trees map[string]Tree, db store.RawDB, pruneOpts *store.Prun
func (c *CommitStore) WriteBatch(cs *corestore.Changeset) error {
for _, pairs := range cs.Changes {

key := internal.UnsafeBytesToStr(pairs.Actor)
key := conv.UnsafeBytesToStr(pairs.Actor)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using a safer method for byte-to-string conversion to avoid potential issues.

- key := conv.UnsafeBytesToStr(pairs.Actor)
+ key := string(pairs.Actor)

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
key := conv.UnsafeBytesToStr(pairs.Actor)
key := string(pairs.Actor)

store/v2/commitment/store.go Show resolved Hide resolved

// ExecMode returns the execution mode stored in the context.
func (c ContextAwareTransactionService) ExecMode(ctx context.Context) transaction.ExecMode {
return ctx.Value(corecontext.ExecModeKey).(transaction.ExecMode)
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding error handling for the type assertion in ExecMode. This will prevent potential runtime panics if ExecModeKey is not present in the context or if it is not of type transaction.ExecMode.

- return ctx.Value(corecontext.ExecModeKey).(transaction.ExecMode)
+ execMode, ok := ctx.Value(corecontext.ExecModeKey).(transaction.ExecMode)
+ if !ok {
+     return transaction.ExecMode{}, fmt.Errorf("exec mode not found in context")
+ }
+ return execMode

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
return ctx.Value(corecontext.ExecModeKey).(transaction.ExecMode)
execMode, ok := ctx.Value(corecontext.ExecModeKey).(transaction.ExecMode)
if !ok {
return transaction.ExecMode{}, fmt.Errorf("exec mode not found in context")
}
return execMode

store/v2/commitment/mem/tree.go Show resolved Hide resolved
Comment on lines 15 to 30
cosmossdk.io/x/auth => ../../x/auth
cosmossdk.io/x/authz => ../../x/authz
cosmossdk.io/x/bank => ../../x/bank
cosmossdk.io/x/circuit => ../../x/circuit
cosmossdk.io/x/consensus => ../../x/consensus
cosmossdk.io/x/distribution => ../../x/distribution
cosmossdk.io/x/evidence => ../../x/evidence
cosmossdk.io/x/feegrant => ../../x/feegrant
cosmossdk.io/x/gov => ../../x/gov
cosmossdk.io/x/group => ../../x/group
cosmossdk.io/x/mint => ../../x/mint
cosmossdk.io/x/nft => ../../x/nft
cosmossdk.io/x/params => ../../x/params
cosmossdk.io/x/protocolpool => ../../x/protocolpool
cosmossdk.io/x/slashing => ../../x/slashing
cosmossdk.io/x/staking => ../../x/staking
Copy link
Member

Choose a reason for hiding this comment

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

do we need all these?

Comment on lines +13 to +33
type ReflectionService struct {
reflectionv1.UnimplementedReflectionServiceServer
files *descriptorpb.FileDescriptorSet
}

func NewReflectionService() (*ReflectionService, error) {
fds, err := proto.MergedGlobalFileDescriptors()
if err != nil {
return nil, err
}

return &ReflectionService{files: fds}, nil
}

func (r ReflectionService) FileDescriptors(_ context.Context, _ *reflectionv1.FileDescriptorsRequest) (*reflectionv1.FileDescriptorsResponse, error) {
return &reflectionv1.FileDescriptorsResponse{
Files: r.files.File,
}, nil
}

var _ reflectionv1.ReflectionServiceServer = &ReflectionService{}
Copy link
Member

Choose a reason for hiding this comment

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

taking note for later, but I believe we should move this out of runtime. There isn't a need for this to live in runtime. It would be the underlying server that would set this up

// InvokeTyped execute a message and fill-in a response.
// The response must be known and passed as a parameter.
// Use InvokeUntyped if the response type is not known.
func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp protoiface.MessageV1) error {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp protoiface.MessageV1) error {
func (m *msgRouterService) InvokeTyped(ctx context.Context, msg, resp *protoiface.MessageV1) error {

isn't this suppose to be a pointer?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't give it much thought because we have the same usage in runtime/v1 router, but I don't think it will work as intended even as a pointer. That usage only works there due to the proto.Merge usages in the hybrid router I believe.

Copy link
Member Author

Choose a reason for hiding this comment

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

see: #20349

}

// InvokeUntyped execute a message and returns a response.
func (m *msgRouterService) InvokeUntyped(ctx context.Context, msg protoiface.MessageV1) (protoiface.MessageV1, error) {
Copy link
Member

Choose a reason for hiding this comment

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

should msg everywhere be transaction.Msg?

Copy link
Member Author

Choose a reason for hiding this comment

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

var _ commitment.Tree = (*Tree)(nil)

// Tree is a simple in-memory implementation of commitment.Tree.
type Tree struct {
Copy link
Member

Choose a reason for hiding this comment

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

what is this used for?

Copy link
Member Author

Choose a reason for hiding this comment

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

replicates the usage of memory stores in store/server v1, store v2 usage: https://github.com/cosmos/cosmos-sdk/blob/kocu/runtime-v2/runtime/v2/module.go#L241-L243

store/v2/db/db_test.go Outdated Show resolved Hide resolved
store/v2/go.mod Outdated Show resolved Hide resolved
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

left a few comments, but overall ACK. I think we can do some cleanup here and there.

store/v2/root/factory.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: 3

Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between d5d3469 and 612f0fc.
Files selected for processing (6)
  • runtime/v2/manager.go (1 hunks)
  • server/v2/appmanager/config.go (1 hunks)
  • server/v2/stf/core_router_service.go (1 hunks)
  • server/v2/stf/stf_router.go (1 hunks)
  • store/v2/db/db.go (1 hunks)
  • store/v2/root/factory.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • server/v2/appmanager/config.go
Files skipped from review as they are similar to previous changes (4)
  • server/v2/stf/core_router_service.go
  • server/v2/stf/stf_router.go
  • store/v2/db/db.go
  • store/v2/root/factory.go
Additional Context Used
Path-based Instructions (1)
runtime/v2/manager.go (1)

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

Comment on lines +39 to +83
// NewModuleManager is the constructor for the module manager
// It handles all the interactions between the modules and the application
func NewModuleManager(
logger log.Logger,
cdc codec.Codec,
config *runtimev2.Module,
modules map[string]appmodulev2.AppModule,
) *MM {
// good defaults for the module manager order
modulesName := maps.Keys(modules)
if len(config.PreBlockers) == 0 {
config.PreBlockers = modulesName
}
if len(config.BeginBlockers) == 0 {
config.BeginBlockers = modulesName
}
if len(config.EndBlockers) == 0 {
config.EndBlockers = modulesName
}
if len(config.TxValidators) == 0 {
config.TxValidators = modulesName
}
if len(config.InitGenesis) == 0 {
config.InitGenesis = modulesName
}
if len(config.ExportGenesis) == 0 {
config.ExportGenesis = modulesName
}
if len(config.OrderMigrations) == 0 {
config.OrderMigrations = sdkmodule.DefaultMigrationsOrder(modulesName)
}

mm := &MM{
logger: logger,
cdc: cdc,
config: config,
modules: modules,
migrationRegistrar: newMigrationRegistrar(),
}

if err := mm.validateConfig(); err != nil {
panic(err)
}

return mm
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider replacing panic with error handling in the constructor.

Using panic for error handling in the constructor (line 80) is aggressive and could lead to abrupt termination of the application. Consider returning the error to the caller to allow for more graceful error handling.

- func NewModuleManager(...) *MM {
+ func NewModuleManager(...) (*MM, error) {
-   panic(err)
+   return nil, err
- return mm
+ return mm, nil

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
// NewModuleManager is the constructor for the module manager
// It handles all the interactions between the modules and the application
func NewModuleManager(
logger log.Logger,
cdc codec.Codec,
config *runtimev2.Module,
modules map[string]appmodulev2.AppModule,
) *MM {
// good defaults for the module manager order
modulesName := maps.Keys(modules)
if len(config.PreBlockers) == 0 {
config.PreBlockers = modulesName
}
if len(config.BeginBlockers) == 0 {
config.BeginBlockers = modulesName
}
if len(config.EndBlockers) == 0 {
config.EndBlockers = modulesName
}
if len(config.TxValidators) == 0 {
config.TxValidators = modulesName
}
if len(config.InitGenesis) == 0 {
config.InitGenesis = modulesName
}
if len(config.ExportGenesis) == 0 {
config.ExportGenesis = modulesName
}
if len(config.OrderMigrations) == 0 {
config.OrderMigrations = sdkmodule.DefaultMigrationsOrder(modulesName)
}
mm := &MM{
logger: logger,
cdc: cdc,
config: config,
modules: modules,
migrationRegistrar: newMigrationRegistrar(),
}
if err := mm.validateConfig(); err != nil {
panic(err)
}
return mm
// NewModuleManager is the constructor for the module manager
// It handles all the interactions between the modules and the application
func NewModuleManager(
logger log.Logger,
cdc codec.Codec,
config *runtimev2.Module,
modules map[string]appmodulev2.AppModule,
) (*MM, error) {
// good defaults for the module manager order
modulesName := maps.Keys(modules)
if len(config.PreBlockers) == 0 {
config.PreBlockers = modulesName
}
if len(config.BeginBlockers) == 0 {
config.BeginBlockers = modulesName
}
if len(config.EndBlockers) == 0 {
config.EndBlockers = modulesName
}
if len(config.TxValidators) == 0 {
config.TxValidators = modulesName
}
if len(config.InitGenesis) == 0 {
config.InitGenesis = modulesName
}
if len(config.ExportGenesis) == 0 {
config.ExportGenesis = modulesName
}
if len(config.OrderMigrations) == 0 {
config.OrderMigrations = sdkmodule.DefaultMigrationsOrder(modulesName)
}
mm := &MM{
logger: logger,
cdc: cdc,
config: config,
modules: modules,
migrationRegistrar: newMigrationRegistrar(),
}
if err := mm.validateConfig(); err != nil {
return nil, err
}
return mm, nil
}

Comment on lines +91 to +98
// RegisterLegacyAminoCodec registers all module codecs
func (m *MM) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
for _, b := range m.modules {
if mod, ok := b.(sdkmodule.HasAminoCodec); ok {
mod.RegisterLegacyAminoCodec(cdc)
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Optimize the codec registration loop.

The current implementation checks each module individually to see if it implements the HasAminoCodec interface. This could be optimized by pre-filtering modules that implement this interface.

+ filteredModules := filterModulesWithAminoCodec(m.modules)
- for _, b := range m.modules {
+ for _, b := range filteredModules {
    if mod, ok := b.(sdkmodule.HasAminoCodec); ok {
        mod.RegisterLegacyAminoCodec(cdc)
    }
}

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
// RegisterLegacyAminoCodec registers all module codecs
func (m *MM) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
for _, b := range m.modules {
if mod, ok := b.(sdkmodule.HasAminoCodec); ok {
mod.RegisterLegacyAminoCodec(cdc)
}
}
}
// RegisterLegacyAminoCodec registers all module codecs
func (m *MM) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
filteredModules := filterModulesWithAminoCodec(m.modules)
for _, b := range filteredModules {
if mod, ok := b.(sdkmodule.HasAminoCodec); ok {
mod.RegisterLegacyAminoCodec(cdc)
}
}
}

Comment on lines +198 to +250
// ExportGenesisForModules performs export genesis functionality for modules
func (m *MM) ExportGenesisForModules(ctx context.Context, modulesToExport ...string) (map[string]json.RawMessage, error) {
if len(modulesToExport) == 0 {
modulesToExport = m.config.ExportGenesis
}
// verify modules exists in app, so that we don't panic in the middle of an export
if err := m.checkModulesExists(modulesToExport); err != nil {
return nil, err
}

type genesisResult struct {
bz json.RawMessage
err error
}

type ModuleI interface {
ExportGenesis(ctx context.Context) (json.RawMessage, error)
}

channels := make(map[string]chan genesisResult)
for _, moduleName := range modulesToExport {
mod := m.modules[moduleName]
var moduleI ModuleI

if module, hasGenesis := mod.(appmodulev2.HasGenesis); hasGenesis {
moduleI = module.(ModuleI)
} else if module, hasABCIGenesis := mod.(appmodulev2.HasGenesis); hasABCIGenesis {
moduleI = module.(ModuleI)
}

channels[moduleName] = make(chan genesisResult)
go func(moduleI ModuleI, ch chan genesisResult) {
jm, err := moduleI.ExportGenesis(ctx)
if err != nil {
ch <- genesisResult{nil, err}
return
}
ch <- genesisResult{jm, nil}
}(moduleI, channels[moduleName])
}

genesisData := make(map[string]json.RawMessage)
for moduleName := range channels {
res := <-channels[moduleName]
if res.err != nil {
return nil, fmt.Errorf("genesis export error in %s: %w", moduleName, res.err)
}

genesisData[moduleName] = res.bz
}

return genesisData, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Limit the number of concurrent goroutines in ExportGenesisForModules.

The method ExportGenesisForModules uses goroutines to parallelize the export process but does not limit the number of concurrent goroutines, which could lead to resource exhaustion. Consider using a worker pool or limiting the number of concurrent goroutines.

+ const maxGoroutines = 10
+ semaphore := make(chan struct{}, maxGoroutines)
  for _, moduleName := range modulesToExport {
+   semaphore <- struct{}{}
    go func(moduleI ModuleI, ch chan genesisResult) {
+     defer func() { <-semaphore }()
      jm, err := moduleI.ExportGenesis(ctx)
      if err != nil {
          ch <- genesisResult{nil, err}
          return
      }
      ch <- genesisResult{jm, nil}
    }(moduleI, channels[moduleName])
  }

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
// ExportGenesisForModules performs export genesis functionality for modules
func (m *MM) ExportGenesisForModules(ctx context.Context, modulesToExport ...string) (map[string]json.RawMessage, error) {
if len(modulesToExport) == 0 {
modulesToExport = m.config.ExportGenesis
}
// verify modules exists in app, so that we don't panic in the middle of an export
if err := m.checkModulesExists(modulesToExport); err != nil {
return nil, err
}
type genesisResult struct {
bz json.RawMessage
err error
}
type ModuleI interface {
ExportGenesis(ctx context.Context) (json.RawMessage, error)
}
channels := make(map[string]chan genesisResult)
for _, moduleName := range modulesToExport {
mod := m.modules[moduleName]
var moduleI ModuleI
if module, hasGenesis := mod.(appmodulev2.HasGenesis); hasGenesis {
moduleI = module.(ModuleI)
} else if module, hasABCIGenesis := mod.(appmodulev2.HasGenesis); hasABCIGenesis {
moduleI = module.(ModuleI)
}
channels[moduleName] = make(chan genesisResult)
go func(moduleI ModuleI, ch chan genesisResult) {
jm, err := moduleI.ExportGenesis(ctx)
if err != nil {
ch <- genesisResult{nil, err}
return
}
ch <- genesisResult{jm, nil}
}(moduleI, channels[moduleName])
}
genesisData := make(map[string]json.RawMessage)
for moduleName := range channels {
res := <-channels[moduleName]
if res.err != nil {
return nil, fmt.Errorf("genesis export error in %s: %w", moduleName, res.err)
}
genesisData[moduleName] = res.bz
}
return genesisData, nil
}
// ExportGenesisForModules performs export genesis functionality for modules
func (m *MM) ExportGenesisForModules(ctx context.Context, modulesToExport ...string) (map[string]json.RawMessage, error) {
if len(modulesToExport) == 0 {
modulesToExport = m.config.ExportGenesis
}
// verify modules exists in app, so that we don't panic in the middle of an export
if err := m.checkModulesExists(modulesToExport); err != nil {
return nil, err
}
type genesisResult struct {
bz json.RawMessage
err error
}
type ModuleI interface {
ExportGenesis(ctx context.Context) (json.RawMessage, error)
}
channels := make(map[string]chan genesisResult)
const maxGoroutines = 10
semaphore := make(chan struct{}, maxGoroutines)
for _, moduleName := range modulesToExport {
mod := m.modules[moduleName]
var moduleI ModuleI
if module, hasGenesis := mod.(appmodulev2.HasGenesis); hasGenesis {
moduleI = module.(ModuleI)
} else if module, hasABCIGenesis := mod.(appmodulev2.HasGenesis); hasABCIGenesis {
moduleI = module.(ModuleI)
}
channels[moduleName] = make(chan genesisResult)
semaphore <- struct{}{}
go func(moduleI ModuleI, ch chan genesisResult) {
defer func() { <-semaphore }()
jm, err := moduleI.ExportGenesis(ctx)
if err != nil {
ch <- genesisResult{nil, err}
return
}
ch <- genesisResult{jm, nil}
}(moduleI, channels[moduleName])
}
genesisData := make(map[string]json.RawMessage)
for moduleName := range channels {
res := <-channels[moduleName]
if res.err != nil {
return nil, fmt.Errorf("genesis export error in %s: %w", moduleName, res.err)
}
genesisData[moduleName] = res.bz
}
return genesisData, nil
}

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 612f0fc and f9907f0.
Files ignored due to path filters (3)
  • runtime/v2/go.mod is excluded by !**/*.mod
  • store/v2/go.mod is excluded by !**/*.mod
  • store/v2/go.sum is excluded by !**/*.sum
Files selected for processing (1)
  • server/v2/stf/core_router_service.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • server/v2/stf/core_router_service.go

@@ -1,11 +1,11 @@
package transaction

import (
"github.com/cosmos/gogoproto/proto"
gogoproto "github.com/cosmos/gogoproto/proto"
Copy link
Contributor

Choose a reason for hiding this comment

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

@tac0turtle is it possible to decouple

cosmossdk.io/core and gogoproto dependency tree wise?

Copy link
Member

Choose a reason for hiding this comment

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

Gogoproto is already a type within core. Since it's directly related to how the system works it's not needed to decouple. This import also does not prevent compiling down to rv32. What is the reason you would want to avoid this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't see why it can't be

type Marshallalable interface {
Marshal()
Unmarshal()
}

Having core abstracted from any implementation details around serialization seems like good practice.

cosmossdk.io/core should be over the wire agnostic imo.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we continue on the path of enshrining protobuf into base types of the system we will never get rid of the nightmares.

Copy link
Member

Choose a reason for hiding this comment

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

proto.message is an interface,

type Message interface {
	Reset()
	String() string
	ProtoMessage()
}

its annoying I understand but this isn't defining serialisation either.

Marshal and unmarshal dont work here since you cant assume a type has those

Comment on lines +13 to +19
cosmossdk.io/x/accounts => ../../x/accounts
cosmossdk.io/x/auth => ../../x/auth
cosmossdk.io/x/bank => ../../x/bank
cosmossdk.io/x/consensus => ../../x/consensus
cosmossdk.io/x/distribution => ../../x/distribution
cosmossdk.io/x/staking => ../../x/staking
cosmossdk.io/x/tx => ../../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.

This coupling feels like a bad smell as well.

Copy link
Member Author

@kocubinski kocubinski May 12, 2024

Choose a reason for hiding this comment

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

these module imports are 2nd order (indirect) from importing github.com/cosmos/cosmos-sdk which is the root code smell. I think the only way to avoid this is the creation of a codec/v2/go.mod to decouple the codec package usages. @tac0turtle wdyt?

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

requesting changes sine I dont think we should merge the current design into main. Im afraid it has a few code smells that will lead to tech debt from day one

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 f9907f0 and bb2413e.
Files selected for processing (3)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/module.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • runtime/v2/app.go
  • runtime/v2/module.go
Additional Context Used
Path-based Instructions (1)
runtime/v2/builder.go (1)

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

Additional comments not posted (6)
runtime/v2/builder.go (6)

33-36: Method DefaultGenesis correctly retrieves the default genesis configuration from the module manager.


62-71: Method RegisterStores correctly handles appending provided store keys, with proper nil checks on storeOptions.


73-160: Method Build correctly constructs an App instance with comprehensive error handling and default settings.


166-171: Method AppBuilderWithBranch correctly implements the functional option pattern for setting a custom branch implementation.


173-179: Method AppBuilderWithTxValidator correctly implements the functional option pattern for setting a custom transaction validator.


181-187: Method AppBuilderWithPostTxExec correctly implements the functional option pattern for setting custom post-transaction execution logic.

runtime/v2/builder.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 bb2413e and 182578c.
Files selected for processing (3)
  • runtime/v2/app.go (1 hunks)
  • runtime/v2/builder.go (1 hunks)
  • runtime/v2/store.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • runtime/v2/app.go
  • runtime/v2/builder.go
  • runtime/v2/store.go

Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

discussed in slack, we will do cleanup in a few follow up prs

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 182578c and 85d0581.
Files selected for processing (3)
  • store/v2/commitment/store.go (8 hunks)
  • store/v2/db/db.go (1 hunks)
  • store/v2/root/store.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • store/v2/commitment/store.go
  • store/v2/db/db.go
  • store/v2/root/store.go

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 85d0581 and e3fa7e0.
Files selected for processing (2)
  • runtime/v2/module.go (1 hunks)
  • store/v2/root/factory.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • runtime/v2/module.go
  • store/v2/root/factory.go

@tac0turtle tac0turtle added this pull request to the merge queue May 14, 2024
Merged via the queue into main with commit 7ae23e2 May 14, 2024
68 of 69 checks passed
@tac0turtle tac0turtle deleted the kocu/runtime-v2 branch May 14, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants