Skip to content

feat: enable block api and block api proxy service (standalone) #4580

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

Merged
merged 9 commits into from
Apr 16, 2025

Conversation

damiannolan
Copy link
Collaborator

Overview

Updates dependencies to enable core block api (in-process) and block api proxy service (standalone).

@damiannolan
Copy link
Collaborator Author

Do you want a default address/port set for the core grpc server in app/default_overrides?
Note, this is only required when running the app in standalone mode (multiplexer). The multiplexer will error on startup if this config is not set

diff --git a/app/default_overrides.go b/app/default_overrides.go
index e187647e..32167a5b 100644
--- a/app/default_overrides.go
+++ b/app/default_overrides.go
@@ -257,6 +257,7 @@ func DefaultConsensusConfig() *tmcfg.Config {
        // Set broadcast timeout to be 50 seconds in order to avoid timeouts for long block times
        cfg.RPC.TimeoutBroadcastTxCommit = 50 * time.Second
        cfg.RPC.MaxBodyBytes = int64(8388608) // 8 MiB
+       cfg.RPC.GRPCListenAddress = "tcp://0.0.0.0:9099"
 
        cfg.Mempool.TTLNumBlocks = 12
        cfg.Mempool.TTLDuration = 75 * time.Second

@damiannolan damiannolan marked this pull request as ready for review April 15, 2025 11:46
@damiannolan damiannolan requested a review from a team as a code owner April 15, 2025 11:46
@damiannolan damiannolan requested review from cmwaters and evan-forbes and removed request for a team April 15, 2025 11:46
Copy link
Contributor

coderabbitai bot commented Apr 15, 2025

📝 Walkthrough

Walkthrough

The changes remove several dependencies from the go.mod file, including github.com/tendermint/tendermint as a direct dependency and some indirect dependencies, while reintroducing github.com/tendermint/tendermint as an indirect dependency with the same zero version. The replacement versions for github.com/cometbft/cometbft and github.com/cosmos/cosmos-sdk are updated to newer release candidates. In the test utilities, the Tendermint node is now explicitly configured for RPC before starting the gRPC server, passing the resulting core environment to the server startup. The StartGRPCServer function signature is updated accordingly, registering a new block API and launching a block event listener goroutine. Additionally, the random assignment of a gRPC listen port in the Tendermint config is removed, and commission rate initialization in genesis account code is simplified.

Changes

File(s) Change Summary
go.mod Removed several dependencies from require; reintroduced tendermint as indirect; updated cometbft and cosmos-sdk replacement versions.
test/util/testnode/network.go Added explicit call to tmNode.ConfigureRPC() before starting gRPC server; passed resulting coreEnv to StartGRPCServer.
test/util/testnode/rpc_client.go Updated StartGRPCServer signature to accept coreEnv; registered new BlockAPI to gRPC server; launched block event listener goroutine.
test/util/testnode/config.go Removed assignment of a random open port to tmCfg.RPC.GRPCListenAddress in DefaultTendermintConfig; field now left unset or default.
test/util/genesis/accounts.go Simplified commission rate initialization by replacing string parsing with direct decimal construction in Validator.GenTx method.

Sequence Diagram(s)

sequenceDiagram
    participant TestNode as Tendermint Node
    participant GRPCServer as gRPC Server
    participant BlockAPI as BlockAPI

    TestNode->>TestNode: ConfigureRPC()
    Note right of TestNode: Returns coreEnv

    TestNode->>GRPCServer: StartGRPCServer(coreEnv)
    GRPCServer->>BlockAPI: Register BlockAPI(coreEnv)
    GRPCServer->>BlockAPI: Start block event listener (goroutine)
    GRPCServer->>GRPCServer: Start gRPC server (blocking)
Loading

Suggested reviewers

  • cmwaters
  • rootulp
  • ninabarbakadze

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

Error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2
Failed executing command with error: you are using a configuration file for golangci-lint v2 with golangci-lint v1: please use golangci-lint v2


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff60459 and 5138040.

📒 Files selected for processing (1)
  • test/util/genesis/accounts.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: lint / golangci-lint
  • GitHub Check: test / test-coverage
  • GitHub Check: test / test-race
  • GitHub Check: test / test
  • GitHub Check: markdown-linter / markdown-link-check
  • GitHub Check: test / test-short
  • GitHub Check: test / test-fuzz
  • GitHub Check: Summary
🔇 Additional comments (1)
test/util/genesis/accounts.go (1)

117-117:

✅ Verification successful

Verify commission rate value change

The commission rate has been changed from what appears to be 0.5 (50%) in the previous implementation to 0.05 (5%) with math.LegacyNewDecWithPrec(5, 2). While this simplifies the code by removing string parsing and error handling, please confirm this is an intentional change in test validator commission rates.

The new implementation is more direct and less error-prone since it avoids string parsing, but the rate value difference could potentially affect test outcomes.


🏁 Script executed:

#!/bin/bash
# Check if this commission rate is used consistently across the codebase
# and if other test validators use the same rate

# Find other instances of commission rate initialization
rg "NewCommissionRates" --type go
rg "LegacyNewDecWithPrec\(5, 2\)" --type go

Length of output: 653


Commission Rate Verified as 5%

The commission rate in test/util/genesis/accounts.go now uses math.LegacyNewDecWithPrec(5, 2), which correctly computes to 0.05 (5%). This is corroborated by its consistent use in app/default_overrides.go (where it’s commented as 5%) and appears to be an intentional refactor to avoid string parsing. Note that different test files (e.g., app/test/std_sdk_test.go) use other values for their specific scenarios, which seems deliberate.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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 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 generate docstrings to generate docstrings 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.

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.

evan-forbes
evan-forbes previously approved these changes Apr 15, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in core/app Apr 15, 2025
@damiannolan
Copy link
Collaborator Author

damiannolan commented Apr 15, 2025

Looks like there is tests failing all of a sudden. Going to look into it.

edit; fixed

@evan-forbes evan-forbes moved this from Needs Triage to Done in core/app Apr 15, 2025
@evan-forbes evan-forbes moved this from Done to In Review in core/app Apr 15, 2025
@cmwaters
Copy link
Contributor

Looks like the tests are still failing

@damiannolan
Copy link
Collaborator Author

damiannolan commented Apr 15, 2025

Looks like the tests are still failing

yeah, they passed in a3e6352 but adding a stop to the blockAPI listener seems to have exploded things. Working on getting this resolved asap

@damiannolan
Copy link
Collaborator Author

💀 picking up new tag with commission changes causing other test failures...

@damiannolan damiannolan merged commit 29388c8 into main Apr 16, 2025
29 checks passed
@damiannolan damiannolan deleted the damian/enable-block-api branch April 16, 2025 15:13
@github-project-automation github-project-automation bot moved this from In Review to Done in core/app Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants