-
Notifications
You must be signed in to change notification settings - Fork 0
chore(p2p): internalize libp2p v2.2.9 as a local p2p module
#15
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
base: release_v4.8.3
Are you sure you want to change the base?
Changes from all commits
880eef6
bd69f33
4169abc
4d8849c
c64caa3
1e50a0f
d84c603
9480064
cbbecb6
ffbadb5
0b41846
99c6344
ae791fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,8 +155,6 @@ public long calculateGlobalEnergyLimit(AccountCapsule accountCapsule) { | |
| long totalEnergyWeight = dynamicPropertiesStore.getTotalEnergyWeight(); | ||
| if (dynamicPropertiesStore.allowNewReward() && totalEnergyWeight <= 0) { | ||
| return 0; | ||
| } else { | ||
| assert totalEnergyWeight > 0; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Removing this else-assert is safe only in the sense that assertions were never enabled here — but it was the sole tripwire for a real gap this method still has. When Prompt for AI agents |
||
| } | ||
| if (hardenCalculation()) { | ||
| return calculateGlobalLimitV1(frozeBalance, totalEnergyLimit, totalEnergyWeight); | ||
|
|
@@ -205,4 +203,3 @@ private long scaleByRate(long value, long numerator, long denominator) { | |
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1045,8 +1045,9 @@ private static void loadDnsPublishParameters(NodeConfig.DnsConfig dns, | |
| String serverType = dns.getServerType(); | ||
| if (StringUtils.isNotEmpty(serverType)) { | ||
| if (!"aws".equalsIgnoreCase(serverType) && !"aliyun".equalsIgnoreCase(serverType)) { | ||
| throw new IllegalArgumentException( | ||
| "Check node.dns.serverType, must be aws or aliyun"); | ||
| throw new TronError( | ||
| "Check node.dns.serverType, must be aws or aliyun", | ||
| TronError.ErrCode.PARAMETER_INIT); | ||
| } | ||
| if ("aws".equalsIgnoreCase(serverType)) { | ||
| publishConfig.setDnsType(DnsType.AwsRoute53); | ||
|
|
@@ -1088,7 +1089,8 @@ private static void loadDnsPublishParameters(NodeConfig.DnsConfig dns, | |
| } | ||
|
|
||
| private static void logEmptyError(String arg) { | ||
| throw new IllegalArgumentException(String.format("Check %s, must not be null or empty", arg)); | ||
| throw new TronError(String.format("Check %s, must not be null or empty", arg), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: This changes the exception contract of the public loadDnsPublishParameters path from IllegalArgumentException (RuntimeException) to TronError, which extends Error. Any caller or test that catches Exception/RuntimeException/IllegalArgumentException around config parsing will no longer intercept these failures — Error bypasses those handlers. If the goal is just to carry an exit code (PARAMETER_INIT=1), make TronError extend RuntimeException, or confirm and document this deliberate contract change, since the PR description states 'no functional changes'. Prompt for AI agents |
||
| TronError.ErrCode.PARAMETER_INIT); | ||
| } | ||
|
|
||
| // createTriggerConfig removed — logic moved to applyEventConfig() | ||
|
|
@@ -1315,4 +1317,3 @@ private static Map<String, String[]> getOptionGroup() { | |
| return optionGroupMap; | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # protobuf generated code (rebuilt by ./gradlew :p2p:generateProto) | ||
| src/main/java/org/tron/p2p/protos/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: These asserts were the only guard on two runtime invariants, and removing them turns invalid states into silent miscomputation instead of a loud failure. If
now < lastTime(e.g. account state carrying a later latestConsumeTime), the decay factor(windowSize - delta)/windowSizebecomes > 1 and inflates energy/net usage; iftotalEnergyWeight == 0, the hardened path throws a naked ArithmeticException while the non-hardened path returns Long.MAX_VALUE. Assertions are disabled by default in production, so the checks were only active under-ea(Gradle tests default), but that was the only protection. Replace them with explicit validation that throws regardless of-ea, or document why both invariants are guaranteed by construction, so the removal is justified.Prompt for AI agents