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

docs(adr75): server v2 #21069

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

docs(adr75): server v2 #21069

wants to merge 12 commits into from

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Jul 25, 2024

Description

ADR for server v2 with design diagrams


Author Checklist

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

I have...

  • included the correct type prefix in the PR title, you can find examples of the prefixes below:
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

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

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

I have...

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

Summary by CodeRabbit

  • New Features

    • Introduced a comprehensive guide on the "V2 Upgrades" of the Cosmos SDK architecture, detailing significant improvements in modularity and performance.
    • Added a new interface for the State Transition Function to enhance transaction execution.
  • Documentation

    • Updated documentation to include high-level diagrams and migration paths for users transitioning from V1 to V2.

Copy link
Contributor

coderabbitai bot commented Jul 25, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new document titled "ADR 75: V2 Upgrades," which outlines a comprehensive rewrite of the Cosmos SDK architecture. This version, V2, aims to enhance modularity, extensibility, and performance by breaking down the monolithic structure into smaller, more manageable components. The document details the migration path from V1 to V2 and includes high-level diagrams of the new architecture, including the Consensus and State Transition Function components.

Changes

File Change Summary
docs/architecture/adr-75-v2.md - New document added detailing the V2 architectural overhaul.
- Introduced interface StateTransitionFunction[T transaction.Tx].

Suggested labels

C:server/v2

Suggested reviewers

  • akhilkumarpilli
  • sontrinh16
  • julienrbrt
  • kocubinski

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tac0turtle tac0turtle changed the title start adr75 for server v2 docs(adr75): server v2 Jul 25, 2024
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@tac0turtle
Copy link
Member Author

opening this r4r but happy to hear on things missing

@tac0turtle tac0turtle marked this pull request as ready for review October 4, 2024 11:11
@tac0turtle tac0turtle requested a review from a team as a code owner October 4, 2024 11:11
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (12)
docs/architecture/adr-75-v2.md (12)

13-15: Minor grammatical improvement suggested in the abstract.

The abstract provides a concise overview of the V2 upgrades. Consider the following minor grammatical improvement:

-V2 is a reset in the Cosmos SDK architecture. It is a complete rewrite of the SDK, with a focus on modularity, extensibility, and performance. The V2 SDK breaks apart the core SDK into smaller modular components allowing users to pick and choose the components they need for their specific use case. This document outlines the changes and migration path for users of the V1 SDK.
+V2 is a reset in the Cosmos SDK architecture. It is a complete rewrite of the SDK, with a focus on modularity, extensibility, and performance. The V2 SDK breaks apart the core SDK into smaller modular components, allowing users to select the components they need for their specific use case. This document outlines the changes and migration path for users of the V1 SDK.

This change improves readability and adheres to standard English grammar rules.

🧰 Tools
🪛 LanguageTool

[style] ~13-~13: ‘pick and choose’ might be wordy. Consider a shorter alternative.
Context: ...er modular components allowing users to pick and choose the components they need for their spec...

(EN_WORDINESS_PREMIUM_PICK_AND_CHOOSE)


17-18: Fix typo and improve sentence structure in the context section.

There's a typo and a missing space in the first sentence. Consider the following changes:

-The Cosmos SDK began in 2016, at this time the software was written with the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, with new features and improvements being added over time.
+The Cosmos SDK began in 2016. At this time, the software was written with the direct use case of the Cosmos Hub. Since then, we have seen the SDK evolve and grow, with new features and improvements being added over time.

These changes improve readability and correct the grammatical issues.

🧰 Tools
🪛 LanguageTool

[typographical] ~17-~17: It seems that a comma is missing after this introductory phrase.
Context: ...h the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, w...

(SINCE_THEN_COMMA)


50-51: Improve clarity in the description of Baseapp.

The description of Baseapp could be more precise. Consider the following change:

-This is a high-level overview of Baseapp today. As we can see baseapp houses all the logic for the ABCI methods, state management, transaction processing, and query handling. This has led baseapp to be a very large monolith.
+This is a high-level overview of Baseapp today. As we can see, Baseapp houses all the logic for the ABCI methods, state management, transaction processing, and query handling. This structure has led Baseapp to become a large monolithic component.

This change improves clarity and avoids the use of subjective intensifiers like "very".

🧰 Tools
🪛 LanguageTool

[style] ~50-~50: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ry handling. This has led baseapp to be a very large monolith. ## Alternatives The alterna...

(EN_WEAK_ADJECTIVE)


52-56: Improve grammar in the alternatives section.

Consider the following changes to improve grammar and clarity:

-The alternative to doing a rewrite is to spend more time cleaning up baseapp. This would not fix issues around forking the repository to make changes like we see today. Keeping the current codebase does not allow the project to progress and reduce the maintenance burden on the project.
+The alternative to a rewrite is to spend more time cleaning up Baseapp. However, this would not address issues related to forking the repository for making changes, as we see today. Maintaining the current codebase would not allow the project to progress or reduce its maintenance burden.

These changes improve the flow and clarity of the text while maintaining the original meaning.

🧰 Tools
🪛 LanguageTool

[style] ~54-~54: Consider using a different verb for a more formal wording.
Context: ...ime cleaning up baseapp. This would not fix issues around forking the repository to...

(FIX_RESOLVE)


59-59: Fix typo in the decision statement.

There's a typo in the word "Decision". Please correct it as follows:

-The Descision is to rewrite the core componenets (baseapp, server, store) of the SDK into smaller modules. 
+The Decision is to rewrite the core components (baseapp, server, store) of the SDK into smaller modules. 

This correction improves the professionalism of the document.


88-89: Correct typo and improve clarity in the runtime/v2 description.

There's a typo and the sentence could be clearer. Consider the following change:

-In the above diagram we do not mention runtime/v2 because it is the componend that is responsible for combining all the other components into a single application.
+In the above diagram, we do not mention runtime/v2 because it is the component responsible for combining all the other components into a single application.

This change improves readability and corrects the spelling error.


92-93: Improve clarity in the Consensus component description.

The description of the Consensus component could be clearer. Consider the following change:

-Consensus is the component that handles communication to the Consensus Engine (Networking & Consensus). The default implementation will be CometBFT, but other consensus engines can be used with v2. The goal of consensus is not to offer a consensus API to meet all needs, but a way to allow developers to swap out the server for a different consensus engine. An application developer should not assume that the cometbftserver will work with other consensus engines. 
+Consensus is the component that handles communication with the Consensus Engine (Networking & Consensus). The default implementation will be CometBFT, but other consensus engines can be used with v2. The goal of the Consensus component is not to offer a universal consensus API, but to provide a way for developers to swap out the server for a different consensus engine. Application developers should not assume that the CometBFT server will work with other consensus engines.

These changes improve clarity and consistency in terminology.


164-196: Improve formatting and add comments to the Go interface.

The Go interface for the State Transition Function could benefit from better formatting and comments. Consider the following changes:

 type StateTransitionFunction[T transaction.Tx] interface {
 	// DeliverBlock executes a block of transactions.
 	DeliverBlock(
 		ctx context.Context,
 		block *server.BlockRequest[T],
 		state store.ReaderMap,
-	) (blockResult *server.BlockResponse, newState store.WriterMap, err error)
+	) (*server.BlockResponse, store.WriterMap, error)
 	
 	// ValidateTx validates a transaction.
 	ValidateTx(
 		ctx context.Context,
 		state store.ReaderMap,
 		gasLimit uint64,
 		tx T,
 	) server.TxResult
 	
 	// Simulate executes a transaction in simulation mode.
 	Simulate(
 		ctx context.Context,
 		state store.ReaderMap,
 		gasLimit uint64,
 		tx T,
-	) (server.TxResult, store.WriterMap)
+	) (txResult server.TxResult, newState store.WriterMap)
 	
 	// Query executes a query on the application.
 	Query(
 		ctx context.Context,
 		state store.ReaderMap,
 		gasLimit uint64,
 		req transaction.Msg,
-	) (transaction.Msg, error)
+	) (response transaction.Msg, err error)
 }

These changes improve readability and follow Go best practices for interface definitions.


207-208: Improve clarity in the backwards compatibility explanation.

The explanation of backwards compatibility could be clearer. Consider the following changes:

-The state machine was made to not affect modules that are not using the state transition function. If a user would like to migrate to v2 they will need to migrate to `appmodule.Environment` from `sdk.Context`.  `sdk.Context` is a struct which is a global in the state machine, this desing limits the concurrency. 
+The state machine was designed to not affect modules that are not using the state transition function. Users migrating to v2 will need to transition from `sdk.Context` to `appmodule.Environment`. `sdk.Context` is a global struct in the state machine, which limits concurrency. The new design addresses this limitation.

These changes improve the flow and clarity of the explanation.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~207-~207: Possible missing comma found.
Context: ...ion. If a user would like to migrate to v2 they will need to migrate to `appmodule...

(AI_HYDRA_LEO_MISSING_COMMA)


209-210: Clarify the breaking changes in CometBFT interaction.

The description of breaking changes could be more precise. Consider the following changes:

-V2 will have a breaking changes in regards to how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK paniced and recovered in the case of out of gas, providing an error to CometBFT which we do not return in the new design. 
+V2 introduces breaking changes in how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK panicked and recovered in the case of out-of-gas errors, providing an error to CometBFT. In the new design, this error is not returned to CometBFT.

These changes provide a clearer explanation of the breaking changes.

🧰 Tools
🪛 LanguageTool

[misspelling] ~209-~209: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...ency. V2 will have a breaking changes in regards to how CometBFT handles certain fields in ...

(IN_OR_WITH_REGARDS_TO_OF)


[grammar] ~209-~209: The usual collocation for “return” is “to”, not “in”.
Context: ...ng an error to CometBFT which we do not return in the new design. V2 only works with `S...

(RETURN_IN_THE)


227-230: Consider expanding the further discussions section.

The further discussions section is quite brief and could benefit from more context. Consider expanding this section to provide more details on:

  1. The potential benefits of rewriting the core in Rust.
  2. What "crosslang" refers to and its significance.
  3. Any other potential future developments or areas of research.

This expansion would give readers a better understanding of the long-term vision for the Cosmos SDK beyond the V2 upgrades.


231-233: Add relevant references to the document.

The references section currently contains only a placeholder. To enhance the document's credibility and provide readers with additional resources, consider adding relevant references. These could include:

  1. Links to related Cosmos SDK documentation
  2. Academic papers or articles that influenced the V2 design decisions
  3. Relevant discussions or proposals in the Cosmos community

Adding these references will make the document more comprehensive and valuable to readers.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between dc14960 and d99d189.

📒 Files selected for processing (1)
  • docs/architecture/adr-75-v2.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/architecture/adr-75-v2.md (1)

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

🪛 LanguageTool
docs/architecture/adr-75-v2.md

[style] ~13-~13: ‘pick and choose’ might be wordy. Consider a shorter alternative.
Context: ...er modular components allowing users to pick and choose the components they need for their spec...

(EN_WORDINESS_PREMIUM_PICK_AND_CHOOSE)


[typographical] ~17-~17: It seems that a comma is missing after this introductory phrase.
Context: ...h the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, w...

(SINCE_THEN_COMMA)


[style] ~50-~50: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ry handling. This has led baseapp to be a very large monolith. ## Alternatives The alterna...

(EN_WEAK_ADJECTIVE)


[style] ~54-~54: Consider using a different verb for a more formal wording.
Context: ...ime cleaning up baseapp. This would not fix issues around forking the repository to...

(FIX_RESOLVE)


[duplication] ~99-~99: Possible typo: you repeated a word
Context: ...the transactions in the same block. * Optimistic * Optimistic execution means different things to dif...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~100-~100: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ...nsensus may not be made on every block. Instead consensus is made after execution. This...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~100-~100: Possible missing comma found.
Context: ...er execution. This design favors a fast chain as it will not slow down for execution ...

(AI_HYDRA_LEO_MISSING_COMMA)


[duplication] ~101-~101: Possible typo: you repeated a word
Context: ...optimistic window may be exceeded. * Delayed * Delayed execution is the default execution mode...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~106-~106: Consider adding a comma.
Context: ... Since consensus servers can be swapped there are certain features features specific ...

(IF_THERE_COMMA)


[duplication] ~106-~106: Possible typo: you repeated a word
Context: ...ervers can be swapped there are certain features features specific to consensus engines need to b...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~106-~106: Possible missing comma found.
Context: ...lemented in the server. In the CometBFT server we have implemented the following featu...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~113-~113: Possible missing comma found.
Context: ... server would like to utilize the above features they can be copied or implemented in th...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~131-~131: When ‘read-only’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...n function is stateless, it is handed a read only view of state and returns state changes...

(READ_ONLY_HYPHEN)


[uncategorized] ~202-~202: Possible missing comma found.
Context: ...enance cost can be the same as existing Baseapp as handling many go.mods is a overhead....

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~202-~202: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ing Baseapp as handling many go.mods is a overhead. * Modularity means different ...

(EN_A_VS_AN)


[uncategorized] ~207-~207: Possible missing comma found.
Context: ...ion. If a user would like to migrate to v2 they will need to migrate to `appmodule...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~209-~209: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...ency. V2 will have a breaking changes in regards to how CometBFT handles certain fields in ...

(IN_OR_WITH_REGARDS_TO_OF)


[grammar] ~209-~209: The usual collocation for “return” is “to”, not “in”.
Context: ...ng an error to CometBFT which we do not return in the new design. V2 only works with `S...

(RETURN_IN_THE)


[typographical] ~211-~211: It seems that a comma is missing.
Context: ...e and Commitment. Once the migration is completed the state machine will query informatio...

(IF_COMMA)

🔇 Additional comments (2)
docs/architecture/adr-75-v2.md (2)

1-11: LGTM: Header and changelog section are well-structured.

The header section provides clear information about the ADR title, changelog, and current status. This follows good documentation practices for Architecture Decision Records.


1-233: Overall, a well-structured and informative ADR with room for minor improvements.

This Architecture Decision Record (ADR) provides a comprehensive overview of the V2 upgrades for the Cosmos SDK. The document effectively communicates the context, decisions, and consequences of this significant architectural change.

Key strengths:

  1. Clear explanation of the motivation behind V2 upgrades
  2. Detailed description of the new architecture and components
  3. Balanced discussion of consequences and backwards compatibility

Areas for improvement:

  1. Minor grammatical and typographical errors throughout the document
  2. Some sections could benefit from improved clarity and precision
  3. The references section needs to be completed with relevant sources

Addressing the suggested improvements will enhance the document's professionalism and make it more valuable to the Cosmos SDK community. Great work on documenting this important architectural change!

🧰 Tools
🪛 LanguageTool

[style] ~13-~13: ‘pick and choose’ might be wordy. Consider a shorter alternative.
Context: ...er modular components allowing users to pick and choose the components they need for their spec...

(EN_WORDINESS_PREMIUM_PICK_AND_CHOOSE)


[typographical] ~17-~17: It seems that a comma is missing after this introductory phrase.
Context: ...h the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, w...

(SINCE_THEN_COMMA)


[style] ~50-~50: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ry handling. This has led baseapp to be a very large monolith. ## Alternatives The alterna...

(EN_WEAK_ADJECTIVE)


[style] ~54-~54: Consider using a different verb for a more formal wording.
Context: ...ime cleaning up baseapp. This would not fix issues around forking the repository to...

(FIX_RESOLVE)


[duplication] ~99-~99: Possible typo: you repeated a word
Context: ...the transactions in the same block. * Optimistic * Optimistic execution means different things to dif...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~100-~100: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ...nsensus may not be made on every block. Instead consensus is made after execution. This...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~100-~100: Possible missing comma found.
Context: ...er execution. This design favors a fast chain as it will not slow down for execution ...

(AI_HYDRA_LEO_MISSING_COMMA)


[duplication] ~101-~101: Possible typo: you repeated a word
Context: ...optimistic window may be exceeded. * Delayed * Delayed execution is the default execution mode...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~106-~106: Consider adding a comma.
Context: ... Since consensus servers can be swapped there are certain features features specific ...

(IF_THERE_COMMA)


[duplication] ~106-~106: Possible typo: you repeated a word
Context: ...ervers can be swapped there are certain features features specific to consensus engines need to b...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~106-~106: Possible missing comma found.
Context: ...lemented in the server. In the CometBFT server we have implemented the following featu...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~113-~113: Possible missing comma found.
Context: ... server would like to utilize the above features they can be copied or implemented in th...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~131-~131: When ‘read-only’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...n function is stateless, it is handed a read only view of state and returns state changes...

(READ_ONLY_HYPHEN)


[uncategorized] ~202-~202: Possible missing comma found.
Context: ...enance cost can be the same as existing Baseapp as handling many go.mods is a overhead....

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~202-~202: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ing Baseapp as handling many go.mods is a overhead. * Modularity means different ...

(EN_A_VS_AN)


[uncategorized] ~207-~207: Possible missing comma found.
Context: ...ion. If a user would like to migrate to v2 they will need to migrate to `appmodule...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~209-~209: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...ency. V2 will have a breaking changes in regards to how CometBFT handles certain fields in ...

(IN_OR_WITH_REGARDS_TO_OF)


[grammar] ~209-~209: The usual collocation for “return” is “to”, not “in”.
Context: ...ng an error to CometBFT which we do not return in the new design. V2 only works with `S...

(RETURN_IN_THE)


[typographical] ~211-~211: It seems that a comma is missing.
Context: ...e and Commitment. Once the migration is completed the state machine will query informatio...

(IF_COMMA)

* Store/v2
* Runtime/v2

The flow of all the components was designed to be as simple as possible, and the flow is as follows:
Copy link
Member

Choose a reason for hiding this comment

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

i think we should mention server components as well


```mermaid
graph TD
subgraph Server
Copy link
Member

Choose a reason for hiding this comment

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

this is only server/v2/cometbft, I think we should show other servers and the server/v2 itself

Copy link
Member Author

Choose a reason for hiding this comment

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

server/v2 is the cosensus server. Server/v2 the pkg is a set of apis, I can show different apis (grpc/gateway) if needed

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

🧹 Outside diff range and nitpick comments (6)
docs/architecture/adr-75-v2.md (6)

13-13: Consider adding a comma for improved readability

The sentence structure could be improved by adding a comma after "components". This would enhance readability and clarify the relationship between the clauses.

Consider revising the sentence as follows:

-V2 is a reset in the Cosmos SDK architecture. It is a complete rewrite of the SDK, with a focus on modularity, extensibility, and performance. The V2 SDK breaks apart the core SDK into smaller modular components allowing users to pick and choose the components they need for their specific use case.
+V2 is a reset in the Cosmos SDK architecture. It is a complete rewrite of the SDK, with a focus on modularity, extensibility, and performance. The V2 SDK breaks apart the core SDK into smaller modular components, allowing users to pick and choose the components they need for their specific use case.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~13-~13: Possible missing comma found.
Context: ...apart the core SDK into smaller modular components allowing users to pick and choose the c...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~13-~13: ‘pick and choose’ might be wordy. Consider a shorter alternative.
Context: ...er modular components allowing users to pick and choose the components they need for their spec...

(EN_WORDINESS_PREMIUM_PICK_AND_CHOOSE)


50-50: Improve sentence structure and word choice

The sentence structure can be improved, and the use of "very" can be replaced with a more precise descriptor.

Consider revising the sentence as follows:

-This is a high-level overview of Baseapp today. As we can see baseapp houses all the logic for the ABCI methods, state management, transaction processing, and query handling. This has led baseapp to be a very large monolith.
+This is a high-level overview of Baseapp today. As we can see, Baseapp houses all the logic for the ABCI methods, state management, transaction processing, and query handling. This has led Baseapp to become a substantial monolith.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~50-~50: Possible missing comma found.
Context: ...el overview of Baseapp today. As we can see baseapp houses all the logic for the AB...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~50-~50: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ry handling. This has led baseapp to be a very large monolith. ## Alternatives The alterna...

(EN_WEAK_ADJECTIVE)


54-54: Improve wording and consider expanding the Alternatives section

The wording can be improved for clarity, and the section could benefit from more detailed alternatives.

Consider revising the sentence and expanding the section:

-The alternative to doing a rewrite is to spend more time cleaning up baseapp. This would not fix issues around forking the repository to make changes like we see today. Keeping the current codebase does not allow the project to progress and reduce the maintenance burden on the project.
+The alternative to a complete rewrite is to invest more time in refactoring and improving the existing baseapp. However, this approach would not address issues related to repository forking for making changes, as we see today. Maintaining the current codebase structure would limit the project's ability to progress and reduce its maintenance burden.

Additionally, consider expanding this section to include:

  1. More detailed exploration of potential alternatives
  2. Pros and cons of each alternative
  3. Reasons why these alternatives were ultimately rejected in favor of a complete rewrite

Would you like assistance in drafting an expanded Alternatives section?

🧰 Tools
🪛 LanguageTool

[style] ~54-~54: Consider using a different verb for a more formal wording.
Context: ...ime cleaning up baseapp. This would not fix issues around forking the repository to...

(FIX_RESOLVE)


208-208: Improve sentence structure and clarity

The sentence structure can be improved for better clarity.

Consider revising the sentence as follows:

-The state machine was made to not affect modules that are not using the state transition function. If a user would like to migrate to v2 they will need to migrate to `appmodule.Environment` from `sdk.Context`.  `sdk.Context` is a struct which is a global in the state machine, this desing limits the concurrency. 
+The state machine was designed to avoid affecting modules that are not using the state transition function. Users migrating to v2 will need to transition from `sdk.Context` to `appmodule.Environment`. `sdk.Context` is a struct that acts as a global in the state machine, a design that limits concurrency.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~208-~208: Possible missing comma found.
Context: ...ion. If a user would like to migrate to v2 they will need to migrate to `appmodule...

(AI_HYDRA_LEO_MISSING_COMMA)


228-231: Consider expanding the Further Discussions section

The Further Discussions section is quite brief and could benefit from more detailed exploration of future directions.

Consider expanding this section to include:

  1. More detailed explanation of the potential Rust rewrite, including benefits and challenges
  2. Elaboration on what "crosslang" refers to and its significance
  3. Other potential future directions or areas of research for the Cosmos SDK
  4. Timeline considerations for these future discussions

Would you like assistance in drafting an expanded Further Discussions section?


1-234: Overall document review: Comprehensive but needs minor refinements

This ADR provides a thorough overview of the V2 upgrades for Cosmos SDK. The document is well-structured and informative, covering key aspects such as context, decision rationale, architectural changes, and consequences.

However, there are several areas that could benefit from improvement:

  1. Minor grammatical and typographical errors throughout the document.
  2. Some sections, particularly Alternatives and Further Discussions, could be expanded for more comprehensive coverage.
  3. Consistency in terminology and capitalization (e.g., "baseapp" vs "Baseapp").

Recommendation:

  1. Conduct a thorough proofreading of the entire document to address grammatical and typographical issues.
  2. Consider expanding the Alternatives and Further Discussions sections as suggested in previous comments.
  3. Ensure consistency in terminology and capitalization throughout the document.
  4. Review the mermaid diagrams to ensure they accurately represent the latest architectural decisions.

Would you like assistance in proofreading or expanding any specific sections of the document?

🧰 Tools
🪛 LanguageTool

[uncategorized] ~13-~13: Possible missing comma found.
Context: ...apart the core SDK into smaller modular components allowing users to pick and choose the c...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~13-~13: ‘pick and choose’ might be wordy. Consider a shorter alternative.
Context: ...er modular components allowing users to pick and choose the components they need for their spec...

(EN_WORDINESS_PREMIUM_PICK_AND_CHOOSE)


[typographical] ~17-~17: It seems that a comma is missing after this introductory phrase.
Context: ...h the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, w...

(SINCE_THEN_COMMA)


[uncategorized] ~50-~50: Possible missing comma found.
Context: ...el overview of Baseapp today. As we can see baseapp houses all the logic for the AB...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~50-~50: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ry handling. This has led baseapp to be a very large monolith. ## Alternatives The alterna...

(EN_WEAK_ADJECTIVE)


[style] ~54-~54: Consider using a different verb for a more formal wording.
Context: ...ime cleaning up baseapp. This would not fix issues around forking the repository to...

(FIX_RESOLVE)


[duplication] ~100-~100: Possible typo: you repeated a word
Context: ...the transactions in the same block. * Optimistic * Optimistic execution means different things to dif...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~101-~101: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ...nsensus may not be made on every block. Instead consensus is made after execution. This...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~101-~101: Possible missing comma found.
Context: ...er execution. This design favors a fast chain as it will not slow down for execution ...

(AI_HYDRA_LEO_MISSING_COMMA)


[duplication] ~102-~102: Possible typo: you repeated a word
Context: ...optimistic window may be exceeded. * Delayed * Delayed execution is the default execution mode...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~107-~107: Consider adding a comma.
Context: ... Since consensus servers can be swapped there are certain features features specific ...

(IF_THERE_COMMA)


[duplication] ~107-~107: Possible typo: you repeated a word
Context: ...ervers can be swapped there are certain features features specific to consensus engines need to b...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~107-~107: Possible missing comma found.
Context: ...lemented in the server. In the CometBFT server we have implemented the following featu...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~114-~114: Possible missing comma found.
Context: ... server would like to utilize the above features they can be copied or implemented in th...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~132-~132: When ‘read-only’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...n function is stateless, it is handed a read only view of state and returns state changes...

(READ_ONLY_HYPHEN)


[uncategorized] ~203-~203: Possible missing comma found.
Context: ...enance cost can be the same as existing Baseapp as handling many go.mods is a overhead....

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~203-~203: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ing Baseapp as handling many go.mods is a overhead. * Modularity means different ...

(EN_A_VS_AN)


[uncategorized] ~208-~208: Possible missing comma found.
Context: ...ion. If a user would like to migrate to v2 they will need to migrate to `appmodule...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~210-~210: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...ency. V2 will have a breaking changes in regards to how CometBFT handles certain fields in ...

(IN_OR_WITH_REGARDS_TO_OF)


[grammar] ~210-~210: The usual collocation for “return” is “to”, not “in”.
Context: ...ng an error to CometBFT which we do not return in the new design. V2 only works with `S...

(RETURN_IN_THE)


[typographical] ~212-~212: It seems that a comma is missing.
Context: ...e and Commitment. Once the migration is completed the state machine will query informatio...

(IF_COMMA)

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d99d189 and d51cc4a.

📒 Files selected for processing (1)
  • docs/architecture/adr-75-v2.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/architecture/adr-75-v2.md (1)

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

🪛 LanguageTool
docs/architecture/adr-75-v2.md

[uncategorized] ~13-~13: Possible missing comma found.
Context: ...apart the core SDK into smaller modular components allowing users to pick and choose the c...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~13-~13: ‘pick and choose’ might be wordy. Consider a shorter alternative.
Context: ...er modular components allowing users to pick and choose the components they need for their spec...

(EN_WORDINESS_PREMIUM_PICK_AND_CHOOSE)


[typographical] ~17-~17: It seems that a comma is missing after this introductory phrase.
Context: ...h the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, w...

(SINCE_THEN_COMMA)


[uncategorized] ~50-~50: Possible missing comma found.
Context: ...el overview of Baseapp today. As we can see baseapp houses all the logic for the AB...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~50-~50: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...ry handling. This has led baseapp to be a very large monolith. ## Alternatives The alterna...

(EN_WEAK_ADJECTIVE)


[style] ~54-~54: Consider using a different verb for a more formal wording.
Context: ...ime cleaning up baseapp. This would not fix issues around forking the repository to...

(FIX_RESOLVE)


[duplication] ~100-~100: Possible typo: you repeated a word
Context: ...the transactions in the same block. * Optimistic * Optimistic execution means different things to dif...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~101-~101: A comma may be missing after the conjunctive/linking adverb ‘Instead’.
Context: ...nsensus may not be made on every block. Instead consensus is made after execution. This...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)


[uncategorized] ~101-~101: Possible missing comma found.
Context: ...er execution. This design favors a fast chain as it will not slow down for execution ...

(AI_HYDRA_LEO_MISSING_COMMA)


[duplication] ~102-~102: Possible typo: you repeated a word
Context: ...optimistic window may be exceeded. * Delayed * Delayed execution is the default execution mode...

(ENGLISH_WORD_REPEAT_RULE)


[typographical] ~107-~107: Consider adding a comma.
Context: ... Since consensus servers can be swapped there are certain features features specific ...

(IF_THERE_COMMA)


[duplication] ~107-~107: Possible typo: you repeated a word
Context: ...ervers can be swapped there are certain features features specific to consensus engines need to b...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~107-~107: Possible missing comma found.
Context: ...lemented in the server. In the CometBFT server we have implemented the following featu...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~114-~114: Possible missing comma found.
Context: ... server would like to utilize the above features they can be copied or implemented in th...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~132-~132: When ‘read-only’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...n function is stateless, it is handed a read only view of state and returns state changes...

(READ_ONLY_HYPHEN)


[uncategorized] ~203-~203: Possible missing comma found.
Context: ...enance cost can be the same as existing Baseapp as handling many go.mods is a overhead....

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~203-~203: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ing Baseapp as handling many go.mods is a overhead. * Modularity means different ...

(EN_A_VS_AN)


[uncategorized] ~208-~208: Possible missing comma found.
Context: ...ion. If a user would like to migrate to v2 they will need to migrate to `appmodule...

(AI_HYDRA_LEO_MISSING_COMMA)


[misspelling] ~210-~210: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...ency. V2 will have a breaking changes in regards to how CometBFT handles certain fields in ...

(IN_OR_WITH_REGARDS_TO_OF)


[grammar] ~210-~210: The usual collocation for “return” is “to”, not “in”.
Context: ...ng an error to CometBFT which we do not return in the new design. V2 only works with `S...

(RETURN_IN_THE)


[typographical] ~212-~212: It seems that a comma is missing.
Context: ...e and Commitment. Once the migration is completed the state machine will query informatio...

(IF_COMMA)


## Context

The Cosmos SDK began in 2016, at this time the software was written with the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, with new features and improvements being added over time. The SDK today is used by over 100 different projects, with more users joining the ecosystem every day. This has led to a number of challenges, including:
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typographical error and improve sentence structure

There's a typographical error and the sentence structure could be improved for better readability.

Please revise the sentence as follows:

-The Cosmos SDK began in 2016, at this time the software was written with the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, with new features and improvements being added over time.
+The Cosmos SDK began in 2016. At this time, the software was written with the direct use case of the Cosmos Hub in mind. Since then, we have seen the SDK evolve and grow, with new features and improvements being added over time.
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The Cosmos SDK began in 2016, at this time the software was written with the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, with new features and improvements being added over time. The SDK today is used by over 100 different projects, with more users joining the ecosystem every day. This has led to a number of challenges, including:
The Cosmos SDK began in 2016. At this time, the software was written with the direct use case of the Cosmos Hub in mind. Since then, we have seen the SDK evolve and grow, with new features and improvements being added over time. The SDK today is used by over 100 different projects, with more users joining the ecosystem every day. This has led to a number of challenges, including:
🧰 Tools
🪛 LanguageTool

[typographical] ~17-~17: It seems that a comma is missing after this introductory phrase.
Context: ...h the direct use case of the Cosmos Hub.Since then we have seen the SDK evolve and grow, w...

(SINCE_THEN_COMMA)


The consensus server is responsible for handling the execution model of the state machine. The state machine executes transactions when it is told, it is unaware of the execution model.

Since consensus servers can be swapped there are certain features features specific to consensus engines need to be implemented in the server. In the CometBFT server we have implemented the following features:
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix grammatical issues and remove duplicate word

There are some grammatical issues in this sentence, including a duplicate word "features".

Please revise the sentence as follows:

-Since consensus servers can be swapped there are certain features features specific to consensus engines need to be implemented in the server.
+Since consensus servers can be swapped, certain features specific to consensus engines need to be implemented in the server.
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Since consensus servers can be swapped there are certain features features specific to consensus engines need to be implemented in the server. In the CometBFT server we have implemented the following features:
Since consensus servers can be swapped, certain features specific to consensus engines need to be implemented in the server. In the CometBFT server we have implemented the following features:
🧰 Tools
🪛 LanguageTool

[typographical] ~107-~107: Consider adding a comma.
Context: ... Since consensus servers can be swapped there are certain features features specific ...

(IF_THERE_COMMA)


[duplication] ~107-~107: Possible typo: you repeated a word
Context: ...ervers can be swapped there are certain features features specific to consensus engines need to b...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~107-~107: Possible missing comma found.
Context: ...lemented in the server. In the CometBFT server we have implemented the following featu...

(AI_HYDRA_LEO_MISSING_COMMA)

H --> J[State Commitment]
```

In the above diagram we do not mention runtime/v2 because it is the componend that is responsible for combining all the other components into a single application.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct typo and improve sentence structure

There's a typo in "component" and the sentence structure can be improved.

Please revise the sentence as follows:

-In the above diagram we do not mention runtime/v2 because it is the componend that is responsible for combining all the other components into a single application.
+In the above diagram, we do not mention runtime/v2 because it is the component responsible for combining all the other components into a single application.
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
In the above diagram we do not mention runtime/v2 because it is the componend that is responsible for combining all the other components into a single application.
In the above diagram, we do not mention runtime/v2 because it is the component responsible for combining all the other components into a single application.


## Decision

The Descision is to rewrite the core componenets (baseapp, server, store) of the SDK into smaller modules.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo in "Decision"

There's a typo in the word "Decision".

Please correct the spelling:

-The Descision is to rewrite the core componenets (baseapp, server, store) of the SDK into smaller modules. 
+The Decision is to rewrite the core components (baseapp, server, store) of the SDK into smaller modules. 
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The Descision is to rewrite the core componenets (baseapp, server, store) of the SDK into smaller modules.
The Decision is to rewrite the core components (baseapp, server, store) of the SDK into smaller modules.


The state machine was made to not affect modules that are not using the state transition function. If a user would like to migrate to v2 they will need to migrate to `appmodule.Environment` from `sdk.Context`. `sdk.Context` is a struct which is a global in the state machine, this desing limits the concurrency.

V2 will have a breaking changes in regards to how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK paniced and recovered in the case of out of gas, providing an error to CometBFT which we do not return in the new design.
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct grammatical issues and improve clarity

There are several grammatical issues in this paragraph that need to be addressed.

Please revise the paragraph as follows:

-V2 will have a breaking changes in regards to how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK paniced and recovered in the case of out of gas, providing an error to CometBFT which we do not return in the new design. 
+V2 will have breaking changes regarding how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK panicked and recovered in the case of out-of-gas errors, providing an error to CometBFT. In the new design, we do not return this error.
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
V2 will have a breaking changes in regards to how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK paniced and recovered in the case of out of gas, providing an error to CometBFT which we do not return in the new design.
V2 will have breaking changes regarding how CometBFT handles certain fields in ABCI. Previously, the Cosmos SDK panicked and recovered in the case of out-of-gas errors, providing an error to CometBFT. In the new design, we do not return this error.
🧰 Tools
🪛 LanguageTool

[misspelling] ~210-~210: Although “in regards to” is sometimes used in casual speech, it is typically considered a nonstandard phrase.
Context: ...ency. V2 will have a breaking changes in regards to how CometBFT handles certain fields in ...

(IN_OR_WITH_REGARDS_TO_OF)


[grammar] ~210-~210: The usual collocation for “return” is “to”, not “in”.
Context: ...ng an error to CometBFT which we do not return in the new design. V2 only works with `S...

(RETURN_IN_THE)

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.

5 participants