Skip to content

Conversation

Olshansk
Copy link

@Olshansk Olshansk commented Aug 4, 2025

This is an untested vibe-coded flag to skip the EndBlocker.

Summary by CodeRabbit

  • New Features

    • Introduced a new CLI flag to optionally skip EndBlocker processing during application startup.
    • Added configuration options to enable or disable EndBlocker logic for advanced use cases, such as query-only modes.
  • Chores

    • Improved logging to indicate when EndBlocker processing is disabled or if disabling fails.

@Olshansk Olshansk marked this pull request as draft August 4, 2025 21:16
Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

📝 Walkthrough

Walkthrough

A new mechanism to optionally skip the EndBlocker logic in the BaseApp was introduced. This includes a skipEndBlocker flag in BaseApp, a CLI flag to enable this behavior, and supporting methods and option functions. Reflection-based logic retrieves the BaseApp instance from the application to set this flag at runtime.

Changes

Cohort / File(s) Change Summary
BaseApp skipEndBlocker flag & logic
baseapp/baseapp.go
Added skipEndBlocker boolean field to BaseApp; updated endBlock method to bypass EndBlocker processing if the flag is set.
BaseApp option & setter
baseapp/options.go
Added SkipEndBlocker() option function and SetSkipEndBlocker(bool) method to control the new flag.
CLI integration & runtime flag handling
server/start.go
Introduced skip-endblocker CLI flag; added logic to extract BaseApp from the app and set the flag at startup using reflection if necessary; logging for success/failure.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant App
    participant BaseApp

    User->>CLI: Start node with --skip-endblocker flag
    CLI->>App: Create application instance
    CLI->>App: getBaseAppFromApp()
    App->>BaseApp: (via method or reflection) retrieve BaseApp pointer
    CLI->>BaseApp: SetSkipEndBlocker(true)
    CLI->>App: Start application

    App->>BaseApp: endBlock(ctx)
    BaseApp->>BaseApp: Check skipEndBlocker flag
    alt skipEndBlocker is true
        BaseApp-->>App: Return empty EndBlock, no error
    else skipEndBlocker is false
        BaseApp->>BaseApp: Run normal EndBlocker logic
        BaseApp-->>App: Return EndBlock result
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
server/start.go (1)

637-671: Reasonable approach with appropriate fallback handling.

The function uses a sensible two-tier approach: trying the interface method first, then falling back to reflection for embedded fields. The reflection logic is implemented correctly with proper type checking and safety guards.

Consider adding a comment about the reflection approach being fragile and dependent on specific embedding patterns, as this could help future maintainers understand the constraints.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 0290439 and fe26e40.

📒 Files selected for processing (3)
  • baseapp/baseapp.go (2 hunks)
  • baseapp/options.go (2 hunks)
  • server/start.go (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Summary
🔇 Additional comments (7)
baseapp/options.go (1)

147-150: LGTM! Well-structured option function.

The function follows the established pattern for BaseApp options and provides a clean way to configure EndBlocker skipping. The comment clearly explains the use case.

baseapp/baseapp.go (2)

166-168: LGTM! Well-documented field addition.

The field placement and documentation are appropriate. The field is logically grouped with similar configuration flags and has a clear comment explaining its purpose.


742-745: LGTM! Clean early return implementation.

The early return logic is well-implemented and maintains the method contract while effectively bypassing EndBlocker processing when the flag is set. The comment clearly explains the behavior.

server/start.go (4)

13-13: LGTM! Necessary imports for the new functionality.

The reflect and baseapp imports are appropriately added to support the BaseApp extraction and configuration functionality.

Also applies to: 43-43


84-84: LGTM! Flag constant follows established conventions.

The constant name and value follow the established patterns for CLI flags in this codebase.


694-703: LGTM! Well-implemented flag handling with appropriate logging.

The implementation correctly checks the flag, attempts to configure the BaseApp, and provides appropriate logging for both success and failure cases. The defensive approach of continuing execution even if BaseApp access fails is appropriate.


1088-1088: LGTM! Proper flag registration with clear documentation.

The flag is correctly registered as a boolean with an appropriate default value and clear help text explaining its purpose and use case.

Comment on lines +417 to +420
// SetSkipEndBlocker sets the skipEndBlocker flag for the BaseApp.
func (app *BaseApp) SetSkipEndBlocker(skipEndBlocker bool) {
app.skipEndBlocker = skipEndBlocker
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add sealed check for consistency and safety.

The method should include a sealed check like other setter methods in this file to prevent modification after BaseApp initialization.

Apply this diff to add the sealed check:

 // SetSkipEndBlocker sets the skipEndBlocker flag for the BaseApp.
 func (app *BaseApp) SetSkipEndBlocker(skipEndBlocker bool) {
+	if app.sealed {
+		panic("SetSkipEndBlocker() on sealed BaseApp")
+	}
 	app.skipEndBlocker = skipEndBlocker
 }
📝 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
// SetSkipEndBlocker sets the skipEndBlocker flag for the BaseApp.
func (app *BaseApp) SetSkipEndBlocker(skipEndBlocker bool) {
app.skipEndBlocker = skipEndBlocker
}
// SetSkipEndBlocker sets the skipEndBlocker flag for the BaseApp.
func (app *BaseApp) SetSkipEndBlocker(skipEndBlocker bool) {
if app.sealed {
panic("SetSkipEndBlocker() on sealed BaseApp")
}
app.skipEndBlocker = skipEndBlocker
}
🤖 Prompt for AI Agents
In baseapp/options.go around lines 417 to 420, the SetSkipEndBlocker method
lacks a sealed check to prevent modifications after BaseApp initialization. Add
a check at the start of the method to verify if the BaseApp is sealed, and if
so, panic or return an error to block further changes. This ensures consistency
and safety like other setter methods in the file.

baseapp/abci.go Outdated
Comment on lines 818 to 825
var response *abci.ExecTxResult

if _, err := app.txDecoder(rawTx); err == nil {
response = app.deliverTx(rawTx)
if app.queryOnlyMode {
response = app.deliverTxQueryOnly(rawTx)
} else {
response = app.deliverTx(rawTx)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).internalFinalizeBlock (baseapp/abci.go:718)
(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:885)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant