Skip to content
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

feat(net): get external IPv4 from libp2p #5407

Merged
merged 18 commits into from Aug 30, 2023

Conversation

317787106
Copy link
Contributor

@317787106 317787106 commented Aug 9, 2023

What does this PR do?

  • get external IPv4 from llibp2p instead of external url

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@317787106 317787106 linked an issue Aug 9, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2023

Codecov Report

Merging #5407 (3f17ec2) into develop (10223cc) will increase coverage by 0.33%.
Report is 4 commits behind head on develop.
The diff coverage is 85.71%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@              Coverage Diff              @@
##             develop    #5407      +/-   ##
=============================================
+ Coverage      60.89%   61.23%   +0.33%     
- Complexity      9231     9254      +23     
=============================================
  Files            839      839              
  Lines          50029    49994      -35     
  Branches        5574     5569       -5     
=============================================
+ Hits           30467    30613     +146     
+ Misses         17176    16981     -195     
- Partials        2386     2400      +14     
Files Changed Coverage Δ
common/src/main/java/org/tron/core/Constant.java 50.00% <ø> (ø)
.../src/main/java/org/tron/core/config/args/Args.java 65.37% <80.00%> (+5.20%) ⬆️
...ava/org/tron/common/parameter/CommonParameter.java 58.62% <100.00%> (+1.15%) ⬆️
...rc/main/java/org/tron/core/net/TronNetService.java 87.23% <100.00%> (ø)

... and 7 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@317787106 317787106 changed the title feat(net): get external ip from libp2p feat(net): get external IPv4 from libp2p Aug 10, 2023
@@ -296,9 +297,17 @@ private static Block getBuildBlock(long timestamp, long num, long witnessId,

private void buildAssetIssue() {
AssetIssueContract.Builder builder = AssetIssueContract.newBuilder();
builder.setOwnerAddress(ByteString.copyFromUtf8("Address1"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't add non-relevant tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

test coverage will get smaller if don't add non-relevant tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please follow the PR submission guidelines.

@@ -284,7 +284,7 @@ public class Constant {
public static final String NODE_DISCOVERY_BIND_IP = "node.discovery.bind.ip";

public static final String NODE_DISCOVERY_EXTERNAL_IP = "node.discovery.external.ip";
public static final String AMAZONAWS_URL = "http://checkip.amazonaws.com";
//public static final String AMAZONAWS_URL = "http://checkip.amazonaws.com";
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest just deleting the useless code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will delete it

method2.invoke(Args.class, config3);

Assert.assertNotEquals("127.0.0.1", CommonParameter.getInstance().getNodeDiscoveryBindIp());
Assert.assertNotEquals("46.168.1.1", CommonParameter.getInstance().getNodeExternalIp());
Copy link
Contributor

Choose a reason for hiding this comment

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

"46.168.1.1": What kind of node is this IP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

46.168.1.1 is the configed node.discovery.external.ip in Constant.TEST_CONF.
127.0.0.1 s the configed node.discovery.bind.ip in Constant.TEST_CONF.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then it is recommended to get the variables from the Constant.TEST_CONF

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated this testcase.

@317787106 317787106 merged commit f9c42d6 into tronprotocol:develop Aug 30, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Acquire Internet IP from Libp2p API
5 participants