Skip to content

Commit a4933aa

Browse files
committed
merge develop
2 parents 3069ffa + 84362f1 commit a4933aa

40 files changed

Lines changed: 1142 additions & 1511 deletions

.github/ISSUE_TEMPLATE/ask-a-question.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Ask a question
33
about: Something is unclear or needs clarification
4-
title: '[QUESTION] '
4+
title: '[Question]'
55
labels: 'type:docs'
66
assignees: ''
77

@@ -46,6 +46,6 @@ These channels provide faster responses for general inquiries.
4646
- Operating System: <!-- e.g., Ubuntu 20.04 -->
4747
- Java version: <!-- e.g., java version "1.8.0_391" -->
4848

49-
## Additional Information
49+
## Additional Information (Optional)
5050

5151
<!-- Any other details that might be helpful -->

.github/ISSUE_TEMPLATE/report-a-bug.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Report a bug
33
about: Create a report to help us improve
4-
title: '[BUG] '
4+
title: '[Bug]'
55
labels: 'type:bug'
66
assignees: ''
77

@@ -72,7 +72,7 @@ Include relevant logs from FullNode.jar or other components
7272
[Paste error messages, stack traces, or relevant logs here]
7373
```
7474

75-
## Additional Context
75+
## Additional Context (Optional)
7676

7777
<!-- Add any other context about the problem -->
7878

.github/ISSUE_TEMPLATE/request-a-feature.md

Lines changed: 28 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Request a feature
33
about: Suggest an idea for this project
4-
title: '[FEATURE] '
4+
title: '[Feature]'
55
labels: 'type:feature'
66
assignees: ''
77

@@ -12,28 +12,9 @@ Thank you for contributing to java-tron!
1212
Please provide as much detail as possible to help us evaluate your feature request.
1313
-->
1414

15-
## Background
16-
17-
<!-- Describe the context and motivation for this feature request -->
18-
1915
## Problem Statement
2016

21-
<!-- What problem does this feature solve? What pain points does it address? -->
22-
23-
## Rationale
24-
25-
**Why should this feature exist?**
26-
<!-- Explain the benefits and value this feature would provide -->
27-
28-
**What are the use cases?**
29-
<!-- Describe specific scenarios where this feature would be useful -->
30-
31-
1.
32-
2.
33-
3.
34-
35-
**Who would benefit from this feature?**
36-
<!-- e.g., node operators, developers, end users, validators -->
17+
<!-- Describe the problem this feature solves, the context/motivation, and who would benefit -->
3718

3819
## Proposed Solution
3920

@@ -52,30 +33,17 @@ Please provide as much detail as possible to help us evaluate your feature reque
5233
**Protocol Changes** (if applicable)
5334
<!-- Describe any changes to the TRON protocol -->
5435

55-
## Testing Strategy
56-
57-
<!-- How should this feature be tested? -->
58-
59-
**Test Scenarios**
60-
61-
1.
62-
2.
63-
3.
64-
65-
**Performance Considerations**
66-
<!-- Describe any performance implications -->
67-
6836
## Scope of Impact
6937

70-
<!-- What parts of the system will be affected? -->
71-
72-
- [ ] Core protocol
73-
- [ ] API/RPC
74-
- [ ] Database
75-
- [ ] Network layer
76-
- [ ] Smart contracts
77-
- [ ] Documentation
78-
- [ ] Other: <!-- specify -->
38+
<!-- Select the system components that will be affected by this feature:
39+
- Core protocol
40+
- API/RPC
41+
- Database
42+
- Network layer
43+
- Smart contracts
44+
- Documentation
45+
- Others, please specify
46+
-->
7947

8048
**Breaking Changes**
8149
<!-- Will this feature introduce any breaking changes? -->
@@ -90,23 +58,29 @@ Please provide as much detail as possible to help us evaluate your feature reque
9058

9159
**Are you willing to implement this feature?**
9260
<!-- Let us know if you'd like to contribute the implementation -->
93-
- [ ] Yes, I can implement this feature
94-
- [ ] I can help with implementation
95-
- [ ] I need help with implementation
96-
- [ ] I'm just suggesting the idea
9761

9862
**Estimated Complexity**
99-
<!-- Your assessment of implementation complexity -->
100-
- [ ] Low (minor changes)
101-
- [ ] Medium (moderate changes)
102-
- [ ] High (significant changes)
103-
- [ ] Unknown
63+
<!-- Your assessment of implementation complexity, choose among
64+
- Low (minor changes)
65+
- Medium (moderate changes)
66+
- High (significant changes)
67+
- Unknown
68+
-->
69+
70+
## Testing Strategy
71+
72+
<!-- How should this feature be tested? -->
73+
74+
**Test Scenarios**
75+
76+
**Performance Considerations**
77+
<!-- Describe any performance implications -->
10478

105-
## Alternatives Considered
79+
## Alternatives Considered (Optional)
10680

10781
<!-- Describe any alternative solutions or features you've considered -->
10882

109-
## Additional Context
83+
## Additional Context (Optional)
11084

11185
<!-- Add any other context, mockups, diagrams, or examples -->
11286

.github/workflows/pr-build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ jobs:
130130
- name: Build
131131
run: ./gradlew clean build --no-daemon
132132

133+
- name: Test with RocksDB engine
134+
run: ./gradlew :framework:testWithRocksDb --no-daemon
135+
133136
docker-build-debian11:
134137
name: Build debian11 (JDK 8 / x86_64)
135138
if: ${{ github.event_name == 'pull_request' || inputs.job == 'all' || inputs.job == 'debian11' }}
@@ -171,3 +174,6 @@ jobs:
171174
172175
- name: Build
173176
run: ./gradlew clean build --no-daemon
177+
178+
- name: Test with RocksDB engine
179+
run: ./gradlew :framework:testWithRocksDb --no-daemon

common/src/main/java/org/tron/core/config/args/Storage.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.apache.commons.lang3.StringUtils;
3030
import org.iq80.leveldb.CompressionType;
3131
import org.iq80.leveldb.Options;
32-
import org.tron.common.arch.Arch;
3332
import org.tron.common.cache.CacheStrategies;
3433
import org.tron.common.cache.CacheType;
3534
import org.tron.common.utils.DbOptionalsUtils;
@@ -90,7 +89,6 @@ public class Storage {
9089
* Default values of directory
9190
*/
9291
private static final String DEFAULT_DB_ENGINE = "LEVELDB";
93-
private static final String ROCKS_DB_ENGINE = "ROCKSDB";
9492
private static final boolean DEFAULT_DB_SYNC = false;
9593
private static final boolean DEFAULT_EVENT_SUBSCRIBE_CONTRACT_PARSE = true;
9694
private static final String DEFAULT_DB_DIRECTORY = "database";
@@ -175,10 +173,6 @@ public class Storage {
175173
private final Map<String, Sha256Hash> dbRoots = Maps.newConcurrentMap();
176174

177175
public static String getDbEngineFromConfig(final Config config) {
178-
if (Arch.isArm64()) {
179-
logger.warn("Arm64 architecture detected, using RocksDB as db engine, ignore config.");
180-
return ROCKS_DB_ENGINE;
181-
}
182176
return config.hasPath(DB_ENGINE_CONFIG_KEY)
183177
? config.getString(DB_ENGINE_CONFIG_KEY) : DEFAULT_DB_ENGINE;
184178
}

framework/build.gradle

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,38 @@ run {
106106
}
107107
}
108108

109-
test {
110-
retry {
109+
def configureTestTask = { Task t ->
110+
t.retry {
111111
maxRetries = 5
112112
maxFailures = 20
113113
}
114-
testLogging {
114+
t.testLogging {
115115
exceptionFormat = 'full'
116116
}
117+
if (isWindows()) {
118+
t.exclude '**/ShieldedTransferActuatorTest.class'
119+
t.exclude '**/BackupDbUtilTest.class'
120+
t.exclude '**/ManagerTest.class'
121+
t.exclude 'org/tron/core/zksnark/**'
122+
t.exclude 'org/tron/common/runtime/vm/PrecompiledContractsVerifyProofTest.class'
123+
t.exclude 'org/tron/core/ShieldedTRC20BuilderTest.class'
124+
t.exclude 'org/tron/common/runtime/vm/WithdrawRewardTest.class'
125+
}
126+
t.maxHeapSize = "1024m"
127+
t.doFirst {
128+
t.forkEvery = 100
129+
t.jvmArgs "-XX:MetaspaceSize=128m", "-XX:MaxMetaspaceSize=256m", "-XX:+UseG1GC"
130+
}
131+
}
132+
133+
test {
134+
configureTestTask(it)
117135
jacoco {
118136
destinationFile = file("$buildDir/jacoco/jacocoTest.exec")
119137
classDumpDir = file("$buildDir/jacoco/classpathdumps")
120138
}
121139
if (rootProject.archInfo.isArm64) {
140+
systemProperty 'storage.db.engine', 'ROCKSDB'
122141
exclude { element ->
123142
element.file.name.toLowerCase().contains('leveldb')
124143
}
@@ -129,21 +148,14 @@ test {
129148
excludeTestsMatching '*.*LevelDb*'
130149
}
131150
}
132-
if (isWindows()) {
133-
exclude '**/ShieldedTransferActuatorTest.class'
134-
exclude '**/BackupDbUtilTest.class'
135-
exclude '**/ManagerTest.class'
136-
exclude 'org/tron/core/zksnark/**'
137-
exclude 'org/tron/common/runtime/vm/PrecompiledContractsVerifyProofTest.class'
138-
exclude 'org/tron/core/ShieldedTRC20BuilderTest.class'
139-
exclude 'org/tron/common/runtime/vm/WithdrawRewardTest.class'
140-
}
141-
maxHeapSize = "1024m"
142-
doFirst {
143-
// Restart the JVM after every 100 tests to avoid memory leaks and ensure test isolation
144-
forkEvery = 100
145-
jvmArgs "-XX:MetaspaceSize=128m","-XX:MaxMetaspaceSize=256m", "-XX:+UseG1GC"
146-
}
151+
}
152+
153+
task testWithRocksDb(type: Test) {
154+
description = 'Run tests with RocksDB engine'
155+
group = 'verification'
156+
configureTestTask(it)
157+
systemProperty 'storage.db.engine', 'ROCKSDB'
158+
exclude '**/LevelDbDataSourceImplTest.class'
147159
}
148160

149161
jacocoTestReport {

framework/src/main/java/org/tron/common/logsfilter/nativequeue/NativeMessageQueue.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,15 @@ public boolean start(int bindPort, int sendQueueLength) {
5151
public void stop() {
5252
if (Objects.nonNull(publisher)) {
5353
publisher.close();
54+
publisher = null;
5455
}
5556

5657
if (Objects.nonNull(context)) {
5758
context.close();
59+
context = null;
60+
}
61+
synchronized (NativeMessageQueue.class) {
62+
instance = null;
5863
}
5964
}
6065

framework/src/main/java/org/tron/core/config/args/Args.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,27 @@ public static void setParam(final String[] args, final String confFileName) {
130130
// 3. CLI overrides Config (highest priority)
131131
applyCLIParams(cmd, jc);
132132

133-
// 4. Init witness (depends on CLI witness flag)
133+
// 4. Apply platform constraints (e.g. ARM64 forces RocksDB)
134+
applyPlatformConstraints();
135+
136+
// 5. Init witness (depends on CLI witness flag)
134137
initLocalWitnesses(config, cmd);
135138
}
136139

140+
/**
141+
* Apply platform-specific constraints after all config sources are resolved.
142+
* ARM64 does not support LevelDB (native JNI library unavailable),
143+
* so db.engine is forced to RocksDB regardless of config or CLI settings.
144+
*/
145+
private static void applyPlatformConstraints() {
146+
if (Arch.isArm64()
147+
&& !Constant.ROCKSDB.equalsIgnoreCase(PARAMETER.storage.getDbEngine())) {
148+
logger.warn("ARM64 only supports RocksDB, ignoring db.engine='{}'",
149+
PARAMETER.storage.getDbEngine());
150+
PARAMETER.storage.setDbEngine(Constant.ROCKSDB);
151+
}
152+
}
153+
137154
/**
138155
* Apply parameters from config file.
139156
*/
@@ -784,11 +801,8 @@ public static void applyConfigParams(
784801
.getInt(ConfigKey.COMMITTEE_ALLOW_OPTIMIZED_RETURN_VALUE_OF_CHAIN_ID) : 0;
785802

786803
initBackupProperty(config);
787-
if (Constant.ROCKSDB.equalsIgnoreCase(CommonParameter
788-
.getInstance().getStorage().getDbEngine())) {
789-
initRocksDbBackupProperty(config);
790-
initRocksDbSettings(config);
791-
}
804+
initRocksDbBackupProperty(config);
805+
initRocksDbSettings(config);
792806

793807
PARAMETER.actuatorSet =
794808
config.hasPath(ConfigKey.ACTUATOR_WHITELIST)

framework/src/main/java/org/tron/core/db/backup/NeedBeanCondition.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ public class NeedBeanCondition implements Condition {
99

1010
@Override
1111
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
12-
return ("ROCKSDB".equals(Args.getInstance().getStorage().getDbEngine().toUpperCase()))
12+
if (Args.getInstance() == null || Args.getInstance().getStorage() == null
13+
|| Args.getInstance().getStorage().getDbEngine() == null
14+
|| Args.getInstance().getDbBackupConfig() == null) {
15+
return false;
16+
}
17+
return "ROCKSDB".equalsIgnoreCase(Args.getInstance().getStorage().getDbEngine())
1318
&& Args.getInstance().getDbBackupConfig().isEnable() && !Args.getInstance().isWitness();
1419
}
1520
}

0 commit comments

Comments
 (0)