Skip to content

add correct default to rpcHost#7725

Merged
siladu merged 4 commits intobesu-eth:mainfrom
macfarla:p2p-host
Oct 4, 2024
Merged

add correct default to rpcHost#7725
siladu merged 4 commits intobesu-eth:mainfrom
macfarla:p2p-host

Conversation

@macfarla
Copy link
Copy Markdown
Contributor

@macfarla macfarla commented Oct 4, 2024

PR description

set the default value for the rpc Http Host CLI option so that it gets initialized correctly

Fixed Issue(s)

fixes #7721

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
@macfarla
Copy link
Copy Markdown
Contributor Author

macfarla commented Oct 4, 2024

With this PR

besu --p2p-host=9.9.9.9 --metrics-enabled

2024-10-04 14:17:10.890+10:00 | main | INFO  | MetricsHttpService | Starting metrics http service on 127.0.0.1:9545
2024-10-04 14:17:10.917+10:00 | vert.x-eventloop-thread-1 | INFO  | MetricsHttpService | Metrics service started and listening on 127.0.0.1:9545
2024-10-04 14:17:10.919+10:00 | main | INFO  | EngineJsonRpcService | Starting JSON-RPC service on 127.0.0.1:8551
2024-10-04 14:17:10.922+10:00 | vert.x-eventloop-thread-1 | INFO  | EngineJsonRpcService | JSON-RPC service started and listening on 127.0.0.1:8551

@macfarla
Copy link
Copy Markdown
Contributor Author

macfarla commented Oct 4, 2024

Without this PR

 besu --p2p-host=9.9.9.9 

...
2024-10-04 15:24:57.477+10:00 | main | INFO  | Runner | Starting external services ...
2024-10-04 15:24:57.478+10:00 | main | INFO  | EngineJsonRpcService | Starting JSON-RPC service on 9.9.9.9:8551

and with metrics enabled, since metrics service is initalized first

 besu --p2p-host=9.9.9.9 --metrics-enabled

2024-10-04 14:16:29.992+10:00 | main | INFO  | MetricsHttpService | Starting metrics http service on 9.9.9.9:9545

@siladu
Copy link
Copy Markdown
Contributor

siladu commented Oct 4, 2024

Without this PR
and with metrics enabled, since metrics service is initalized first

 besu --p2p-host=9.9.9.9 --metrics-enabled

2024-10-04 14:16:29.992+10:00 | main | INFO  | MetricsHttpService | Starting metrics http service on 9.9.9.9:9545

I don't see this behaviour on the latest main:

$ $BESU --p2p-host=9.9.9.9 --metrics-enabled
...
# Besu version 24.10-develop-81f9fc9                                                               #
...
2024-10-04 16:26:19.020+10:00 | main | INFO  | MetricsHttpService | Starting metrics http service on 127.0.0.1:9545
2024-10-04 16:26:19.053+10:00 | vert.x-eventloop-thread-1 | INFO  | MetricsHttpService | Metrics service started and listening on 127.0.0.1:9545
2024-10-04 16:26:19.054+10:00 | main | INFO  | EngineJsonRpcService | Starting JSON-RPC service on 9.9.9.9:8551

Did you test before 911f12e perhaps?

Copy link
Copy Markdown
Contributor

@siladu siladu left a comment

Choose a reason for hiding this comment

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

It fixes the issue so will approve it.

TBH, it's not clear to me why #7682 broke it and why this is the correct fix and so I don't have confidence there aren't other issues with #7682

Comment on lines +1034 to +1037
verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();

assertThat(jsonRpcConfigArgumentCaptor.getValue().getHost()).isEqualTo("127.0.0.1");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice 👍

How do we know other host configs aren't affected as well?

@siladu siladu enabled auto-merge (squash) October 4, 2024 06:40
@siladu siladu merged commit 21e95a9 into besu-eth:main Oct 4, 2024
@macfarla
Copy link
Copy Markdown
Contributor Author

macfarla commented Oct 8, 2024

Without this PR
and with metrics enabled, since metrics service is initalized first

 besu --p2p-host=9.9.9.9 --metrics-enabled

2024-10-04 14:16:29.992+10:00 | main | INFO  | MetricsHttpService | Starting metrics http service on 9.9.9.9:9545

I don't see this behaviour on the latest main:

$ $BESU --p2p-host=9.9.9.9 --metrics-enabled
...
# Besu version 24.10-develop-81f9fc9                                                               #
...
2024-10-04 16:26:19.020+10:00 | main | INFO  | MetricsHttpService | Starting metrics http service on 127.0.0.1:9545
2024-10-04 16:26:19.053+10:00 | vert.x-eventloop-thread-1 | INFO  | MetricsHttpService | Metrics service started and listening on 127.0.0.1:9545
2024-10-04 16:26:19.054+10:00 | main | INFO  | EngineJsonRpcService | Starting JSON-RPC service on 9.9.9.9:8551

Did you test before 911f12e perhaps?

yes have re-tested and it's only the JSON-RPC host that's affected

besu --p2p-host=9.9.9.9 --metrics-push-enabled

2024-10-08 11:46:30.657+10:00 | main | INFO  | MetricsPushGatewayService | Starting metrics push gateway service pushing to 127.0.0.1:9001
2024-10-08 11:46:30.659+10:00 | main | INFO  | EngineJsonRpcService | Starting JSON-RPC service on 9.9.9.9:8551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

p2p-host config leak

2 participants