feat(plugin): fill section bloom using exist db#80
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
4 issues found across 5 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="plugins/build.gradle">
<violation number="1" location="plugins/build.gradle:73">
P1: Missing `project(':chainbase').jar` in `binaryRelease`'s explicit `dependsOn` list. The comment states all project dependency jars must be declared explicitly to avoid Gradle warnings and ensure correct build ordering for fat jar assembly.</violation>
</file>
<file name="plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java">
<violation number="1" location="plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java:113">
P3: `latest block = 0` is treated as an error, causing valid genesis-only backfill runs to fail.</violation>
<violation number="2" location="plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java:140">
P2: Section-level exceptions are logged but not counted, so the command may return success after failed section processing.</violation>
<violation number="3" location="plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java:192">
P2: Default latest-block detection ignores checkpoint state, which can make backfill end too early.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| implementation 'io.github.tronprotocol:leveldb:1.18.2' | ||
| } | ||
| implementation project(":protocol") | ||
| implementation project(":chainbase") |
There was a problem hiding this comment.
P1: Missing project(':chainbase').jar in binaryRelease's explicit dependsOn list. The comment states all project dependency jars must be declared explicitly to avoid Gradle warnings and ensure correct build ordering for fat jar assembly.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/build.gradle, line 73:
<comment>Missing `project(':chainbase').jar` in `binaryRelease`'s explicit `dependsOn` list. The comment states all project dependency jars must be declared explicitly to avoid Gradle warnings and ensure correct build ordering for fat jar assembly.</comment>
<file context>
@@ -70,6 +70,7 @@ dependencies {
implementation 'io.github.tronprotocol:leveldb:1.18.2'
}
implementation project(":protocol")
+ implementation project(":chainbase")
}
</file context>
|
|
||
| private Long getLatestBlockNumber() { | ||
| try { | ||
| DBInterface propertiesDb = DbTool.getDB(databaseDirectory, "properties"); |
There was a problem hiding this comment.
P2: Default latest-block detection ignores checkpoint state, which can make backfill end too early.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java, line 192:
<comment>Default latest-block detection ignores checkpoint state, which can make backfill end too early.</comment>
<file context>
@@ -0,0 +1,463 @@
+
+ private Long getLatestBlockNumber() {
+ try {
+ DBInterface propertiesDb = DbTool.getDB(databaseDirectory, "properties");
+ byte[] latestBlockKey = "latest_block_header_number".getBytes();
+ byte[] latestBlockBytes = propertiesDb.get(latestBlockKey);
</file context>
| } catch (Exception e) { | ||
| logger.error("Backfill failed", e); | ||
| spec.commandLine().getErr().println("Backfill failed: " + e.getMessage()); | ||
| return 1; |
There was a problem hiding this comment.
P2: Section-level exceptions are logged but not counted, so the command may return success after failed section processing.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java, line 140:
<comment>Section-level exceptions are logged but not counted, so the command may return success after failed section processing.</comment>
<file context>
@@ -0,0 +1,463 @@
+
+ return result;
+
+ } catch (Exception e) {
+ logger.error("Backfill failed", e);
+ spec.commandLine().getErr().println("Backfill failed: " + e.getMessage());
</file context>
| } catch (Exception e) { | |
| logger.error("Backfill failed", e); | |
| spec.commandLine().getErr().println("Backfill failed: " + e.getMessage()); | |
| return 1; | |
| } catch (Exception e) { | |
| errorCount.incrementAndGet(); | |
| spec.commandLine().getErr().printf("Error processing section %d to %d, %s%n", | |
| finalSectionStart, finalSectionEnd, e.getMessage()); | |
| } |
| // Determine end block if not specified | ||
| if (endBlock == null) { | ||
| endBlock = getLatestBlockNumber(); | ||
| if (endBlock == null || endBlock == 0) { |
There was a problem hiding this comment.
P3: latest block = 0 is treated as an error, causing valid genesis-only backfill runs to fail.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/src/main/java/common/org/tron/plugins/DbBackfillBloom.java, line 113:
<comment>`latest block = 0` is treated as an error, causing valid genesis-only backfill runs to fail.</comment>
<file context>
@@ -0,0 +1,463 @@
+ // Determine end block if not specified
+ if (endBlock == null) {
+ endBlock = getLatestBlockNumber();
+ if (endBlock == null || endBlock == 0) {
+ spec.commandLine().getErr().println("Failed to determine latest block number");
+ return 1;
</file context>
What does this PR do?
DB backfill-bloom provides the ability to backfill SectionBloom data for historical blocks to enable
eth_getLogsaddress/topics filtering. This is useful whenisJsonRpcFilterEnabledwas disabled during block processing and later enabled, causing historical blocks to lack SectionBloom data.Why are these changes required?
Refer to tronprotocol#6390
This PR has been tested by: