fix(crypto): remove unused topicsList from shielded TRC20 APIs#3
fix(crypto): remove unused topicsList from shielded TRC20 APIs#3Federico2014 wants to merge 1 commit intodevelopfrom
Conversation
📝 WalkthroughWalkthroughThe changes remove the Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
framework/src/main/java/org/tron/core/services/RpcApiService.java (1)
724-726: Throttle these new deprecation warnings.These are public RPC paths. If older clients keep sending
events, aWARNon every request will get noisy fast and hide real failures. A once-per-process or rate-limited helper would keep the migration hint without turning it into log spam, and the same helper can be reused by the HTTP servlets.Also applies to: 747-749, 2416-2418, 2444-2446
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@framework/src/main/java/org/tron/core/services/RpcApiService.java` around lines 724 - 726, Replace the direct logger.warn calls for the deprecated "events" field with a rate-limited/once-per-process deprecation helper so logs aren't spammed; add a small reusable utility (e.g., DeprecationLogger.warnOnce(key, message) or RateLimitedLogger.warn(key, message, intervalMillis)) that uses a static ConcurrentHashMap<String, AtomicLong/Boolean> to track last-warning times or whether a key was already logged, then call that helper from RpcApiService where you currently call logger.warn("'events' field in IvkDecryptTRC20Parameters is deprecated and ignored") (and the analogous sites handling the same deprecation) so the message is emitted only once or at a controlled rate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@framework/src/main/java/org/tron/core/services/RpcApiService.java`:
- Around line 724-726: Replace the direct logger.warn calls for the deprecated
"events" field with a rate-limited/once-per-process deprecation helper so logs
aren't spammed; add a small reusable utility (e.g.,
DeprecationLogger.warnOnce(key, message) or RateLimitedLogger.warn(key, message,
intervalMillis)) that uses a static ConcurrentHashMap<String,
AtomicLong/Boolean> to track last-warning times or whether a key was already
logged, then call that helper from RpcApiService where you currently call
logger.warn("'events' field in IvkDecryptTRC20Parameters is deprecated and
ignored") (and the analogous sites handling the same deprecation) so the message
is emitted only once or at a controlled rate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4244d416-87e5-46d0-b8ec-92d11e3e1842
📒 Files selected for processing (7)
framework/src/main/java/org/tron/core/Wallet.javaframework/src/main/java/org/tron/core/services/RpcApiService.javaframework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByIvkServlet.javaframework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByOvkServlet.javaframework/src/test/java/org/tron/core/ShieldedTRC20BuilderTest.javaframework/src/test/java/org/tron/core/WalletMockTest.javaprotocol/src/main/protos/api/api.proto
What does this PR do?
This PR removes the unused
topicsListparameter from shielded TRC20 log APIs.Changes:
ProtocolStringList topicsListparameter fromgetShieldedTRC20LogType()methodeventsfield as deprecated inIvkDecryptTRC20ParametersandOvkDecryptTRC20Parameterseventsfield is providedWhy are these changes required?
The
topicsListparameter was never used in the actual logic. The method always used the topics from the log itself. This change:This PR has been tested by:
./gradlew framework:test --tests org.tron.core.WalletMockTest./gradlew framework:test --tests org.tron.core.ShieldedTRC20BuilderTestSummary by cubic
Removes the unused topicsList from shielded TRC20 log APIs and simplifies log type detection to direct topic-bytes comparison. Deprecates the events fields in decrypt parameters and logs a warning when they’re sent, without changing behavior.
Refactors
topicsListfrom internal methods and RPC/HTTP paths; APIs now ignore events.eventsas deprecated in proto and added warning logs when present.Migration
events; it is ignored.Written for commit 09bdc09. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
Deprecated Features
eventsparameter is now deprecated and will be ignored.API Changes
eventsparameter from method signatures.Improvements