mirror of https://github.com/hyperledger/besu
commit
b38f72691d
@ -0,0 +1,50 @@ |
||||
--- |
||||
name: Bug Report |
||||
about: necessary information to help us resolve the issue |
||||
title: '' |
||||
labels: 'bug' |
||||
assignees: '' |
||||
|
||||
--- |
||||
|
||||
<!-- Have you done the following? --> |
||||
<!-- * read the Code of Conduct? By filing an Issue, you are expected to --> |
||||
<!-- comply with it, including treating everyone with respect: --> |
||||
<!-- https://github.com/hyperledger/besu/blob/main/CODE_OF_CONDUCT.md --> |
||||
<!-- * Reproduced the issue in the latest version of the software --> |
||||
<!-- * Read the debugging docs: https://besu.hyperledger.org/private-networks/how-to --> |
||||
<!-- * Duplicate Issue check: https://github.com/search?q=+is%3Aissue+repo%3Ahyperledger/Besu --> |
||||
|
||||
### Steps to Reproduce |
||||
1. [Step 1] |
||||
2. [Step 2] |
||||
3. [Step ...] |
||||
|
||||
**Expected behavior:** [What you expect to happen] |
||||
|
||||
**Actual behavior:** [What actually happens] |
||||
|
||||
**Frequency:** [What percentage of the time does it occur?] |
||||
|
||||
### Logs |
||||
Please post relevant logs from Besu (and the consensus client, if running proof of stake) from before and after the issue. |
||||
|
||||
### Versions (Add all that apply) |
||||
* Software version: [`besu --version`] |
||||
* Java version: [`java -version`] |
||||
* OS Name & Version: [`cat /etc/*release`] |
||||
* Kernel Version: [`uname -a`] |
||||
* Virtual Machine software & version: [`vmware -v`] |
||||
* Docker Version: [`docker version`] |
||||
* Cloud VM, type, size: [Amazon Web Services I3-large] |
||||
* Consensus Client & Version if using Proof of Stake: [e.g. Teku, Lighthouse, Prysm, Nimbus, Lodestar] |
||||
|
||||
### Smart contract information (If you're reporting an issue arising from deploying or calling a smart contract, please supply related information) |
||||
* Solidity version [`solc --version`] |
||||
* Repo with minimal set of deployable/reproducible contract code - please provide a link |
||||
* Please include specifics on how you are deploying/calling the contract |
||||
* Have you reproduced the issue on other eth clients |
||||
|
||||
### Additional Information (Add any of the following or anything else that may be relevant) |
||||
* Besu setup info - genesis file, config options |
||||
* System info - memory, CPU |
@ -0,0 +1,45 @@ |
||||
--- |
||||
name: Feature Request |
||||
about: suggesting new or altered functionality |
||||
title: '' |
||||
labels: '' |
||||
assignees: '' |
||||
|
||||
--- |
||||
|
||||
<!-- Have you done the following? --> |
||||
<!-- * read the Code of Conduct? By filing an Issue, you are expected to --> |
||||
<!-- comply with it, including treating everyone with respect: --> |
||||
<!-- https://github.com/hyperledger/besu/blob/main/CODE_OF_CONDUCT.md --> |
||||
<!-- * Duplicate Issue check: https://github.com/search?q=+is%3Aissue+repo%3Ahyperledger/Besu --> |
||||
|
||||
### Description |
||||
As an [Actor], I want [feature] so that [why]. |
||||
|
||||
### Acceptance Criteria |
||||
* [Criteria 1] |
||||
* [Criteria 2] |
||||
* [Criteria 3...] |
||||
|
||||
### Logs (if a change in behavior) |
||||
Please post relevant logs from Besu (and the consensus client, if running proof of stake) illustrating behavior to be altered |
||||
|
||||
### Versions (Add all that apply) |
||||
* Software version: [`besu --version`] |
||||
* Java version: [`java -version`] |
||||
* OS Name & Version: [`cat /etc/*release`] |
||||
* Kernel Version: [`uname -a`] |
||||
* Virtual Machine software & version: [`vmware -v`] |
||||
* Docker Version: [`docker version`] |
||||
* Cloud VM, type, size: [Amazon Web Services I3-large] |
||||
* Consensus Client & Version if using Proof of Stake: [e.g. Teku, Lighthouse, Prysm, Nimbus, Lodestar] |
||||
|
||||
### Smart contract information (If you're reporting an issue arising from deploying or calling a smart contract, please supply related information) |
||||
* Solidity version [`solc --version`] |
||||
* Repo with minimal set of deployable/reproducible contract code - please provide a link |
||||
* Please include specifics on how you are deploying/calling the contract |
||||
* Have you reproduced the issue on other eth clients |
||||
|
||||
### Additional Information (Add any of the following or anything else that may be relevant) |
||||
* Besu setup info - genesis file, config options |
||||
* System info - memory, CPU |
@ -1,149 +0,0 @@ |
||||
/* |
||||
* Copyright ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
* |
||||
* SPDX-License-Identifier: Apache-2.0 |
||||
*/ |
||||
package org.hyperledger.besu.cli.subcommands; |
||||
|
||||
import static org.hyperledger.besu.cli.subcommands.RetestethSubCommand.COMMAND_NAME; |
||||
|
||||
import org.hyperledger.besu.BesuInfo; |
||||
import org.hyperledger.besu.cli.DefaultCommandValues; |
||||
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty; |
||||
import org.hyperledger.besu.cli.options.stable.LoggingLevelOption; |
||||
import org.hyperledger.besu.cli.util.VersionProvider; |
||||
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; |
||||
import org.hyperledger.besu.ethereum.retesteth.RetestethConfiguration; |
||||
import org.hyperledger.besu.ethereum.retesteth.RetestethService; |
||||
import org.hyperledger.besu.util.LogConfigurator; |
||||
|
||||
import java.net.InetAddress; |
||||
import java.nio.file.Path; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import picocli.CommandLine.Command; |
||||
import picocli.CommandLine.Mixin; |
||||
import picocli.CommandLine.Option; |
||||
|
||||
/** Subcommand to run a Retesteth compatible server for reference tests. */ |
||||
@Command( |
||||
name = COMMAND_NAME, |
||||
description = "Run a Retesteth compatible server for reference tests.", |
||||
mixinStandardHelpOptions = true, |
||||
versionProvider = VersionProvider.class) |
||||
@SuppressWarnings("unused") |
||||
public class RetestethSubCommand implements Runnable { |
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(RetestethSubCommand.class); |
||||
|
||||
/** The constant COMMAND_NAME. */ |
||||
public static final String COMMAND_NAME = "retesteth"; |
||||
|
||||
/** |
||||
* Using a distinct port for retesteth will result in less testing collisions and accidental RPC |
||||
* calls. This is <code>0xba5e</code> in hex, a hex speak play on the english translation of |
||||
* "Besu." |
||||
*/ |
||||
public static final int RETESTETH_PORT = 47710; |
||||
|
||||
@Option( |
||||
names = {"--data-path"}, |
||||
paramLabel = DefaultCommandValues.MANDATORY_PATH_FORMAT_HELP, |
||||
description = "The path to Besu data directory (default: ${DEFAULT-VALUE})") |
||||
private final Path dataPath = DefaultCommandValues.getDefaultBesuDataPath(this); |
||||
|
||||
@Mixin private LoggingLevelOption loggingLevelOption; |
||||
|
||||
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings.
|
||||
@Option( |
||||
names = {"--rpc-http-host"}, |
||||
paramLabel = DefaultCommandValues.MANDATORY_HOST_FORMAT_HELP, |
||||
description = "Host for Retesteth JSON-RPC HTTP to listen on (default: ${DEFAULT-VALUE})", |
||||
arity = "1") |
||||
private String rpcHttpHost = autoDiscoverDefaultIP().getHostAddress(); |
||||
|
||||
@Option( |
||||
names = {"--rpc-http-port"}, |
||||
paramLabel = DefaultCommandValues.MANDATORY_PORT_FORMAT_HELP, |
||||
description = "Port for Retesteth JSON-RPC HTTP to listen on (default: ${DEFAULT-VALUE})", |
||||
arity = "1") |
||||
private final Integer rpcHttpPort = RETESTETH_PORT; |
||||
|
||||
@Option( |
||||
names = {"--host-allowlist", "--host-whitelist"}, |
||||
paramLabel = "<hostname>[,<hostname>...]... or * or all", |
||||
description = |
||||
"Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})", |
||||
defaultValue = "localhost,127.0.0.1") |
||||
private final JsonRPCAllowlistHostsProperty hostsAllowlist = new JsonRPCAllowlistHostsProperty(); |
||||
|
||||
private InetAddress autoDiscoveredDefaultIP; |
||||
|
||||
/** Default Constructor. */ |
||||
public RetestethSubCommand() {} |
||||
|
||||
// Used to discover the default IP of the client.
|
||||
// Loopback IP is used by default as this is how smokeTests require it to be
|
||||
// and it's probably a good security behaviour to default only on the localhost.
|
||||
private InetAddress autoDiscoverDefaultIP() { |
||||
|
||||
if (autoDiscoveredDefaultIP != null) { |
||||
return autoDiscoveredDefaultIP; |
||||
} |
||||
|
||||
autoDiscoveredDefaultIP = InetAddress.getLoopbackAddress(); |
||||
|
||||
return autoDiscoveredDefaultIP; |
||||
} |
||||
|
||||
private void prepareLogging() { |
||||
// set log level per CLI flags
|
||||
final String logLevel = loggingLevelOption.getLogLevel(); |
||||
if (logLevel != null) { |
||||
System.out.println("Setting logging level to " + logLevel); |
||||
LogConfigurator.setLevel("", logLevel); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void run() { |
||||
prepareLogging(); |
||||
|
||||
final RetestethConfiguration retestethConfiguration = new RetestethConfiguration(dataPath); |
||||
final JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault(); |
||||
jsonRpcConfiguration.setHost(rpcHttpHost); |
||||
jsonRpcConfiguration.setPort(rpcHttpPort); |
||||
jsonRpcConfiguration.setHostsAllowlist(hostsAllowlist); |
||||
|
||||
final RetestethService retestethService = |
||||
new RetestethService(BesuInfo.version(), retestethConfiguration, jsonRpcConfiguration); |
||||
|
||||
Runtime.getRuntime() |
||||
.addShutdownHook( |
||||
new Thread( |
||||
() -> { |
||||
try { |
||||
retestethService.close(); |
||||
LogConfigurator.shutdown(); |
||||
} catch (final Exception e) { |
||||
LOG.error("Failed to stop Besu Retesteth"); |
||||
} |
||||
})); |
||||
retestethService.start(); |
||||
try { |
||||
Thread.sleep(Long.MAX_VALUE); // Is there a better way?
|
||||
} catch (final InterruptedException e) { |
||||
// e.printStackTrace();
|
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue