PoW mining - deprecation (#7905)

pull/7964/head
Sally MacFarlane 5 days ago committed by GitHub
parent 979ea5de74
commit 792c6569cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 37
      besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java
  2. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetMinerDataByBlockHash.java
  3. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetMinerDataByBlockNumber.java
  4. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetWork.java
  5. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthHashrate.java
  6. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSubmitHashRate.java
  7. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthSubmitWork.java
  8. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerStart.java
  9. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerStop.java
  10. 1
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/MinerDataResult.java
  11. 1
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWMiningCoordinator.java
  12. 1
      ethereum/stratum/src/main/java/org/hyperledger/besu/ethereum/stratum/GetWorkProtocol.java
  13. 1
      ethereum/stratum/src/main/java/org/hyperledger/besu/ethereum/stratum/Stratum1EthProxyProtocol.java
  14. 1
      ethereum/stratum/src/main/java/org/hyperledger/besu/ethereum/stratum/Stratum1Protocol.java
  15. 1
      ethereum/stratum/src/main/java/org/hyperledger/besu/ethereum/stratum/StratumConnection.java
  16. 1
      ethereum/stratum/src/main/java/org/hyperledger/besu/ethereum/stratum/StratumProtocol.java
  17. 1
      ethereum/stratum/src/main/java/org/hyperledger/besu/ethereum/stratum/StratumServer.java
  18. 2
      plugin-api/build.gradle
  19. 2
      plugin-api/src/main/java/org/hyperledger/besu/plugin/BesuContext.java

@ -52,27 +52,34 @@ import picocli.CommandLine.ParameterException;
/** The Mining CLI options. */
public class MiningOptions implements CLIOptions<MiningConfiguration> {
private static final String DEPRECATION_PREFIX =
"Deprecated. PoW consensus is deprecated. See CHANGELOG for alternative options. ";
@Option(
names = {"--miner-enabled"},
description = "Set if node will perform mining (default: ${DEFAULT-VALUE})")
description =
DEPRECATION_PREFIX + "Set if node will perform mining (default: ${DEFAULT-VALUE})")
private Boolean isMiningEnabled = false;
@Option(
names = {"--miner-stratum-enabled"},
description =
"Set if node will perform Stratum mining (default: ${DEFAULT-VALUE})."
DEPRECATION_PREFIX
+ "Set if node will perform Stratum mining (default: ${DEFAULT-VALUE})."
+ " Compatible with Proof of Work (PoW) only."
+ " Requires the network option (--network) to be set to CLASSIC.")
private Boolean iStratumMiningEnabled = false;
@Option(
names = {"--miner-stratum-host"},
description = "Host for Stratum network mining service (default: ${DEFAULT-VALUE})")
description =
DEPRECATION_PREFIX
+ "Host for Stratum network mining service (default: ${DEFAULT-VALUE})")
private String stratumNetworkInterface = "0.0.0.0";
@Option(
names = {"--miner-stratum-port"},
description = "Stratum port binding (default: ${DEFAULT-VALUE})")
description = DEPRECATION_PREFIX + "Stratum port binding (default: ${DEFAULT-VALUE})")
private Integer stratumPort = 8008;
@Option(
@ -124,7 +131,8 @@ public class MiningOptions implements CLIOptions<MiningConfiguration> {
names = {"--block-txs-selection-max-time"},
converter = PositiveNumberConverter.class,
description =
"Specifies the maximum time, in milliseconds, that could be spent selecting transactions to be included in the block."
DEPRECATION_PREFIX
+ "Specifies the maximum time, in milliseconds, that could be spent selecting transactions to be included in the block."
+ " Not compatible with PoA networks, see poa-block-txs-selection-max-time. (default: ${DEFAULT-VALUE})")
private PositiveNumber nonPoaBlockTxsSelectionMaxTime =
DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME;
@ -146,34 +154,40 @@ public class MiningOptions implements CLIOptions<MiningConfiguration> {
hidden = true,
names = {"--Xminer-remote-sealers-limit"},
description =
"Limits the number of remote sealers that can submit their hashrates (default: ${DEFAULT-VALUE})")
DEPRECATION_PREFIX
+ "Limits the number of remote sealers that can submit their hashrates (default: ${DEFAULT-VALUE})")
private Integer remoteSealersLimit = DEFAULT_REMOTE_SEALERS_LIMIT;
@CommandLine.Option(
hidden = true,
names = {"--Xminer-remote-sealers-hashrate-ttl"},
description =
"Specifies the lifetime of each entry in the cache. An entry will be automatically deleted if no update has been received before the deadline (default: ${DEFAULT-VALUE} minutes)")
DEPRECATION_PREFIX
+ "Specifies the lifetime of each entry in the cache. An entry will be automatically deleted if no update has been received before the deadline (default: ${DEFAULT-VALUE} minutes)")
private Long remoteSealersTimeToLive = DEFAULT_REMOTE_SEALERS_TTL;
@CommandLine.Option(
hidden = true,
names = {"--Xminer-pow-job-ttl"},
description =
"Specifies the time PoW jobs are kept in cache and will accept a solution from miners (default: ${DEFAULT-VALUE} milliseconds)")
DEPRECATION_PREFIX
+ "Specifies the time PoW jobs are kept in cache and will accept a solution from miners (default: ${DEFAULT-VALUE} milliseconds)")
private Long powJobTimeToLive = DEFAULT_POW_JOB_TTL;
@CommandLine.Option(
hidden = true,
names = {"--Xmax-ommers-depth"},
description =
"Specifies the depth of ommer blocks to accept when receiving solutions (default: ${DEFAULT-VALUE})")
DEPRECATION_PREFIX
+ "Specifies the depth of ommer blocks to accept when receiving solutions (default: ${DEFAULT-VALUE})")
private Integer maxOmmersDepth = DEFAULT_MAX_OMMERS_DEPTH;
@CommandLine.Option(
hidden = true,
names = {"--Xminer-stratum-extranonce"},
description = "Extranonce for Stratum network miners (default: ${DEFAULT-VALUE})")
description =
DEPRECATION_PREFIX
+ "Extranonce for Stratum network miners (default: ${DEFAULT-VALUE})")
private String stratumExtranonce = "080c";
@CommandLine.Option(
@ -230,6 +244,9 @@ public class MiningOptions implements CLIOptions<MiningConfiguration> {
final GenesisConfigOptions genesisConfigOptions,
final boolean isMergeEnabled,
final Logger logger) {
if (Boolean.TRUE.equals(isMiningEnabled)) {
logger.warn("PoW consensus is deprecated. See CHANGELOG for alternative options.");
}
if (Boolean.TRUE.equals(isMiningEnabled) && coinbase == null) {
throw new ParameterException(
commandLine,

@ -41,6 +41,7 @@ import java.util.function.Supplier;
import com.google.common.base.Suppliers;
import org.apache.tuweni.units.bigints.BaseUInt256Value;
@Deprecated(since = "24.12.0")
public class EthGetMinerDataByBlockHash implements JsonRpcMethod {
private final Supplier<BlockchainQueries> blockchain;
private final ProtocolSchedule protocolSchedule;

@ -27,6 +27,7 @@ import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@Deprecated(since = "24.12.0")
public class EthGetMinerDataByBlockNumber extends AbstractBlockParameterMethod {
private final ProtocolSchedule protocolSchedule;

@ -35,6 +35,7 @@ import com.google.common.io.BaseEncoding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Deprecated(since = "24.12.0")
public class EthGetWork implements JsonRpcMethod {
private final MiningCoordinator miner;

@ -23,6 +23,7 @@ import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import java.util.Optional;
@Deprecated(since = "24.12.0")
public class EthHashrate implements JsonRpcMethod {
private final MiningCoordinator miningCoordinator;

@ -25,6 +25,7 @@ import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import org.apache.tuweni.bytes.Bytes;
@Deprecated(since = "24.12.0")
public class EthSubmitHashRate implements JsonRpcMethod {
private final MiningCoordinator miningCoordinator;

@ -33,6 +33,7 @@ import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Deprecated(since = "24.12.0")
public class EthSubmitWork implements JsonRpcMethod {
private final MiningCoordinator miner;

@ -24,6 +24,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.blockcreation.CoinbaseNotSetException;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
@Deprecated(since = "24.12.0")
public class MinerStart implements JsonRpcMethod {
private final MiningCoordinator miningCoordinator;

@ -21,6 +21,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcRespon
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
@Deprecated(since = "24.12.0")
public class MinerStop implements JsonRpcMethod {
private final MiningCoordinator miningCoordinator;

@ -19,6 +19,7 @@ import java.util.List;
import org.immutables.value.Value;
@Value.Immutable
@Deprecated(since = "24.12.0")
public abstract class MinerDataResult implements JsonRpcResult {
public abstract String getNetBlockReward();

@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
* Responsible for determining when a block mining operation should be started/stopped, then
* creating an appropriate miner and starting it running in a thread.
*/
@Deprecated(since = "24.12.0")
public class PoWMiningCoordinator extends AbstractMiningCoordinator<PoWBlockMiner>
implements BlockAddedObserver {

@ -36,6 +36,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Protocol using JSON-RPC HTTP methods to provide getWork/submitWork methods. */
@Deprecated(since = "24.12.0")
public class GetWorkProtocol implements StratumProtocol {
private static final Logger LOG = LoggerFactory.getLogger(GetWorkProtocol.class);
private static final ObjectMapper mapper = new ObjectMapper();

@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
*
* <p>This protocol allows miners to submit EthHash solutions over a persistent TCP connection.
*/
@Deprecated(since = "24.12.0")
public class Stratum1EthProxyProtocol implements StratumProtocol {
private static final Logger LOG = LoggerFactory.getLogger(Stratum1EthProxyProtocol.class);
private static final JsonMapper mapper = new JsonMapper();

@ -50,6 +50,7 @@ import org.slf4j.LoggerFactory;
*
* <p>This protocol allows miners to submit EthHash solutions over a persistent TCP connection.
*/
@Deprecated(since = "24.12.0")
public class Stratum1Protocol implements StratumProtocol {
private static final Logger LOG = LoggerFactory.getLogger(Stratum1Protocol.class);
private static final JsonMapper mapper = new JsonMapper();

@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
* Persistent TCP connection using a variant of the Stratum protocol, connecting the client to
* miners.
*/
@Deprecated(since = "24.12.0")
final class StratumConnection {
private static final Logger LOG = LoggerFactory.getLogger(StratumConnection.class);

@ -37,6 +37,7 @@ import org.apache.tuweni.bytes.Bytes;
* <p>Manages the lifecycle of a TCP connection according to a particular variant of the Stratum
* protocol.
*/
@Deprecated(since = "24.12.0")
public interface StratumProtocol {
/**

@ -65,6 +65,7 @@ import org.slf4j.LoggerFactory;
* TCP server allowing miners to connect to the client over persistent TCP connections, using the
* various Stratum protocols.
*/
@Deprecated(since = "24.12.0")
public class StratumServer implements PoWObserver {
private static final Logger logger = LoggerFactory.getLogger(StratumServer.class);

@ -71,7 +71,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'bULFOchupNjcCw+oZ4tykpgxzL4vsOTtDPimyiKGF98='
knownHash = 'zuu5jdZ35LcQyu3g2+p+4rcwUhCAY3woS+ZuAxSFCSg='
}
check.dependsOn('checkAPIChanges')

@ -15,5 +15,5 @@
package org.hyperledger.besu.plugin;
/** Deprecated in favor of the more precisely named ServiceManager interface. */
@Deprecated(since = "24.11.0", forRemoval = true)
@Deprecated(since = "24.12.0")
public interface BesuContext extends ServiceManager {}

Loading…
Cancel
Save