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(server/v2): clean up storage use and config (backport #22008) #22176

Open
wants to merge 3 commits into
base: release/v0.52.x
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Oct 8, 2024

Description

Related to: #21678

This PR cleans up the dependency story for storage. After the merge of #21989 we no longer need to further bloat the AppI interface with GetStore() any, which is the core change in this PR.

--- a/server/v2/types.go
+++ b/server/v2/types.go
type AppI[T transaction.Tx] interface {
        InterfaceRegistry() server.InterfaceRegistry
        GetAppManager() *appmanager.AppManager[T]
        GetGPRCMethodsToMessageMap() map[string]func() gogoproto.Message
-       GetStore() any
 }

The store/v2.RootStore interface was also broken up slightly so that the dependency lines are cleaner for clients in server/v2.

Configuration specification was pushed down from server/v2/store into store/v2 directly. The StoreBuilder was also moved there to prevent a dependency from forming (in either direction) runtime/v2 <-> server/v2.


Author Checklist

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

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:

  • confirmed ! in the type prefix if API or client breaking change

  • targeted the correct branch (see PR Targeting)

  • provided a link to the relevant issue or specification

  • reviewed "Files changed" and left comments if necessary

  • included the necessary unit and integration tests

  • added a changelog entry to CHANGELOG.md

  • updated the relevant documentation or specification, including comments for documenting Go code

  • confirmed all CI checks have passed

Reviewers Checklist

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

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

I have...

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

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced state management through the integration of a new store backend.
    • Improved command initialization process with updated parameters for better store handling.
    • Integration of store parameter in testnet command structure for better state management.
    • Introduction of a singleton pattern for a scoped store builder to streamline store management.
  • Bug Fixes

    • Minor grammatical corrections in comments for clarity.
  • Documentation

    • Updated comments to reflect changes in method signatures and functionality.
  • Refactor

    • Streamlined server and store structures by removing obsolete parameters and methods.
    • Unified snapshot management logic for improved flexibility.
    • Enhanced configuration handling for better modularity and maintainability.

This is an automatic backport of pull request #22008 done by [Mergify](https://mergify.com).

(cherry picked from commit 05fb492)

# Conflicts:
#	runtime/v2/app.go
#	runtime/v2/builder.go
#	runtime/v2/module.go
#	runtime/v2/store.go
#	server/v2/commands.go
#	server/v2/config_test.go
#	server/v2/server.go
#	server/v2/server_test.go
#	server/v2/store/server.go
#	server/v2/store/snapshot.go
#	server/v2/types.go
#	store/v2/root/factory.go
#	store/v2/store.go
@mergify mergify bot requested a review from a team as a code owner October 8, 2024 17:18
@mergify mergify bot added the conflicts label Oct 8, 2024
Copy link
Contributor Author

mergify bot commented Oct 8, 2024

Cherry-pick of 05fb492 has failed:

On branch mergify/bp/release/v0.52.x/pr-22008
Your branch is up to date with 'origin/release/v0.52.x'.

You are currently cherry-picking commit 05fb492bd.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   server/v2/cometbft/server.go
	modified:   server/v2/cometbft/types/store.go
	modified:   simapp/v2/app_di.go
	modified:   simapp/v2/app_test.go
	modified:   simapp/v2/simdv2/cmd/commands.go
	modified:   simapp/v2/simdv2/cmd/root_di.go
	modified:   simapp/v2/simdv2/cmd/testnet.go
	new file:   store/v2/root/builder.go
	new file:   store/v2/root/config.go

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   runtime/v2/app.go
	deleted by us:   runtime/v2/builder.go
	deleted by us:   runtime/v2/module.go
	deleted by us:   runtime/v2/store.go
	deleted by us:   server/v2/commands.go
	deleted by us:   server/v2/config_test.go
	deleted by us:   server/v2/server.go
	deleted by us:   server/v2/server_test.go
	deleted by us:   server/v2/store/server.go
	deleted by us:   server/v2/store/snapshot.go
	deleted by us:   server/v2/types.go
	deleted by us:   store/v2/root/factory.go
	deleted by us:   store/v2/store.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

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.

Just need to be a partial backport. I'll do that in a bit

@julienrbrt julienrbrt self-assigned this Oct 8, 2024
@github-actions github-actions bot removed the C:Store label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:server/v2 cometbft C:server/v2 Issues related to server/v2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants