Skip to content

feat(db): support solidity shutdown#70

Open
317787106 wants to merge 3 commits intorelease_v4.8.1from
feature/solidity_shutdown
Open

feat(db): support solidity shutdown#70
317787106 wants to merge 3 commits intorelease_v4.8.1from
feature/solidity_shutdown

Conversation

@317787106
Copy link
Copy Markdown
Owner

@317787106 317787106 commented Apr 16, 2026

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details


Summary by cubic

Adds graceful startup and shutdown for Solidity nodes and integrates them into the FullNode lifecycle, with P2P auto-disabled and trust-node validation. Moves block push logic from Manager to TronNetDelegate and uses single-thread executors for block fetch/process.

  • New Features

    • SolidityNode is now a Spring component with clean startup/shutdown (@PostConstruct/@PreDestroy), including gRPC client shutdown.
    • FullNode runs the SolidityNode bean in solidity mode, validates trustNodeAddr, and disables P2P automatically.
    • Improved block processing logging during verified block pushes.
  • Refactors

    • Removed Manager.pushVerifiedBlock; added TronNetDelegate.pushVerifiedBlock to route via processBlock.
    • Replaced manual threads with ExecutorServiceManager single-thread executors for get/process loops.
    • SolidityNode instantiation is conditional on solidity mode; processing uses TronNetDelegate and updates the latest solidified block number on success.
    • Tests updated to reflect the new API and lifecycle (deprecated usages removed).

Written for commit bc68c90. Summary will update on new commits.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57803625-cd4a-4748-898c-3efddf9ab035

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/solidity_shutdown

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="framework/src/main/java/org/tron/program/SolidityNode.java">

<violation number="1" location="framework/src/main/java/org/tron/program/SolidityNode.java:69">
P1: Shutdown can hang because stop flag is not honored inside the inner retry loops (`getBlockByNum` / `getLastSolidityBlockNum`).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

TronError.ErrCode.SOLID_NODE_INIT);
@PreDestroy
private void shutdown() {
flag = false;
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Apr 16, 2026

Choose a reason for hiding this comment

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

P1: Shutdown can hang because stop flag is not honored inside the inner retry loops (getBlockByNum / getLastSolidityBlockNum).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At framework/src/main/java/org/tron/program/SolidityNode.java, line 69:

<comment>Shutdown can hang because stop flag is not honored inside the inner retry loops (`getBlockByNum` / `getLastSolidityBlockNum`).</comment>

<file context>
@@ -2,83 +2,82 @@
-          TronError.ErrCode.SOLID_NODE_INIT);
+  @PreDestroy
+  private void shutdown() {
+    flag = false;
+    ExecutorServiceManager.shutdownAndAwaitTermination(getBlockExecutor, getBlockName);
+    ExecutorServiceManager.shutdownAndAwaitTermination(processBlockExecutor, processBlockName);
</file context>
Fix with Cubic

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