Skip to content

Commit

Permalink
Merge branch 'main' into errors
Browse files Browse the repository at this point in the history
  • Loading branch information
intls authored Nov 25, 2024
2 parents ea242a0 + 674a7ba commit 973bcc2
Show file tree
Hide file tree
Showing 77 changed files with 353 additions and 178 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Create and publish Besu BOM (Bill of Materials) [#7615](https://github.com/hyperledger/besu/pull/7615)
- Update Java dependencies [#7786](https://github.com/hyperledger/besu/pull/7786)
- Add a method to get all the transaction in the pool, to the `TransactionPoolService`, to easily access the transaction pool content from plugins [#7813](https://github.com/hyperledger/besu/pull/7813)
- Upgrade RocksDB JNI library from version 8.3.2 to 9.7.3 [#7817](https://github.com/hyperledger/besu/pull/7817)
- Add a method to check if a metric category is enabled to the plugin API [#7832](https://github.com/hyperledger/besu/pull/7832)
- Add a new metric collector for counters which get their value from suppliers [#7894](https://github.com/hyperledger/besu/pull/7894)
- Add account and state overrides to `eth_call` [#7801](https://github.com/hyperledger/besu/pull/7801) and `eth_estimateGas` [#7890](https://github.com/hyperledger/besu/pull/7890)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@
import org.hyperledger.besu.plugin.services.TransactionSelectionService;
import org.hyperledger.besu.plugin.services.TransactionSimulationService;
import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry;
import org.hyperledger.besu.plugin.services.mining.MiningService;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin;
import org.hyperledger.besu.plugin.services.transactionpool.TransactionPoolService;
import org.hyperledger.besu.services.BesuConfigurationImpl;
import org.hyperledger.besu.services.BesuEventsImpl;
import org.hyperledger.besu.services.BesuPluginContextImpl;
import org.hyperledger.besu.services.BlockchainServiceImpl;
import org.hyperledger.besu.services.MiningServiceImpl;
import org.hyperledger.besu.services.PermissioningServiceImpl;
import org.hyperledger.besu.services.PicoCLIOptionsImpl;
import org.hyperledger.besu.services.PrivacyPluginServiceImpl;
Expand Down Expand Up @@ -220,6 +222,8 @@ public void startNode(final BesuNode node) {
besuPluginContext.addService(
TransactionPoolService.class,
new TransactionPoolServiceImpl(besuController.getTransactionPool()));
besuPluginContext.addService(
MiningService.class, new MiningServiceImpl(besuController.getMiningCoordinator()));

component.rpcEndpointService().init(runner.getInProcessRpcMethods());

Expand Down
5 changes: 5 additions & 0 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
import org.hyperledger.besu.plugin.services.TransactionSimulationService;
import org.hyperledger.besu.plugin.services.exception.StorageException;
import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry;
import org.hyperledger.besu.plugin.services.mining.MiningService;
import org.hyperledger.besu.plugin.services.p2p.P2PService;
import org.hyperledger.besu.plugin.services.rlp.RlpConverterService;
import org.hyperledger.besu.plugin.services.securitymodule.SecurityModule;
Expand All @@ -181,6 +182,7 @@
import org.hyperledger.besu.services.BesuEventsImpl;
import org.hyperledger.besu.services.BesuPluginContextImpl;
import org.hyperledger.besu.services.BlockchainServiceImpl;
import org.hyperledger.besu.services.MiningServiceImpl;
import org.hyperledger.besu.services.P2PServiceImpl;
import org.hyperledger.besu.services.PermissioningServiceImpl;
import org.hyperledger.besu.services.PicoCLIOptionsImpl;
Expand Down Expand Up @@ -1301,6 +1303,9 @@ private void startPlugins(final Runner runner) {
miningParametersSupplier.get()),
besuController.getProtocolSchedule()));

besuPluginContext.addService(
MiningService.class, new MiningServiceImpl(besuController.getMiningCoordinator()));

besuController.getAdditionalPluginServices().appendPluginServices(besuPluginContext);
besuPluginContext.startPlugins();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.hyperledger.besu.ethereum.trie.Node;
import org.hyperledger.besu.ethereum.trie.PersistVisitor;
import org.hyperledger.besu.ethereum.trie.RestoreVisitor;
import org.hyperledger.besu.ethereum.trie.common.PmtStateTrieAccountValue;
import org.hyperledger.besu.ethereum.trie.forest.ForestWorldStateArchive;
import org.hyperledger.besu.ethereum.trie.forest.storage.ForestWorldStateKeyValueStorage;
import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue;
import org.hyperledger.besu.util.io.RollingFileReader;

import java.io.IOException;
Expand Down Expand Up @@ -192,8 +192,8 @@ private void restoreAccounts() throws IOException {
final Bytes accountRlp = accountInput.readBytes();
final Bytes code = accountInput.readBytes();

final StateTrieAccountValue trieAccount =
StateTrieAccountValue.readFrom(new BytesValueRLPInput(accountRlp, false, true));
final PmtStateTrieAccountValue trieAccount =
PmtStateTrieAccountValue.readFrom(new BytesValueRLPInput(accountRlp, false, true));
if (!trieAccount.getCodeHash().equals(Hash.hash(code))) {
throw new RuntimeException("Code hash doesn't match");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright contributors to Besu.
*
* 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.services;

import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import org.hyperledger.besu.plugin.services.mining.MiningService;

/**
* Implementation of the {@link MiningService} interface. This class provides methods to start and
* stop the mining process using a {@link MiningCoordinator}.
*/
public class MiningServiceImpl implements MiningService {

private final MiningCoordinator miningCoordinator;

/**
* Constructs a new {@code MiningServiceImpl} with the specified {@link MiningCoordinator}.
*
* @param miningCoordinator the mining coordinator to be used for starting and stopping the mining
* process
*/
public MiningServiceImpl(final MiningCoordinator miningCoordinator) {
this.miningCoordinator = miningCoordinator;
}

/** Stops the mining process by delegating to the {@link MiningCoordinator}. */
@Override
public void stop() {
miningCoordinator.stop();
}

/** Starts the mining process by delegating to the {@link MiningCoordinator}. */
@Override
public void start() {
miningCoordinator.start();
}
}
2 changes: 0 additions & 2 deletions consensus/qbft/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ dependencies {
implementation project(':ethereum:p2p')
implementation project(':ethereum:rlp')
implementation project(':evm')
implementation project(':pki')
implementation project(':services:kvstore')

implementation 'com.google.guava:guava'
implementation 'io.vertx:vertx-core'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
public class DebugSetHead extends AbstractBlockParameterOrBlockHashMethod {
private final ProtocolContext protocolContext;
private static final Logger LOG = LoggerFactory.getLogger(DebugSetHead.class);
private static final int DEFAULT_MAX_TRIE_LOGS_TO_ROLL_AT_ONCE = 512;
private static final int DEFAULT_MAX_TRIE_LOGS_TO_ROLL_AT_ONCE = 32;

private final long maxTrieLogsToRollAtOnce;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;

@Deprecated(since = "24.11.0")
public class DisabledPrivacyRpcMethod implements JsonRpcMethod {

private final String methodName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class MultiTenancyRpcMethodDecorator implements JsonRpcMethod {
private static final Logger LOG = LoggerFactory.getLogger(MultiTenancyRpcMethodDecorator.class);
private final JsonRpcMethod rpcMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.vertx.ext.auth.User;

@Deprecated(since = "24.11.0")
public class MultiTenancyUserUtil {
private static final String PRIVACY_USER_ID_CLAIM = "privacyUserId";
private static final String ENCLAVE_PRIVACY_PUBLIC_KEY_CLAIM = "privacyPublicKey";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import java.util.List;

@Deprecated(since = "24.11.0")
public class PrivGetFilterChanges implements JsonRpcMethod {

private final PrivacyController privacyController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

import java.util.List;

@Deprecated(since = "24.11.0")
public class PrivGetFilterLogs implements JsonRpcMethod {

private final PrivacyController privacyController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.hyperledger.besu.ethereum.privacy.MultiTenancyPrivacyController;
import org.hyperledger.besu.ethereum.privacy.PrivacyController;

@Deprecated(since = "24.11.0")
public class PrivUninstallFilter implements JsonRpcMethod {

private final FilterManager filterManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.vertx.ext.auth.User;

@FunctionalInterface
@Deprecated(since = "24.11.0")
public interface PrivacyIdProvider {

String getPrivacyUserId(Optional<User> user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public abstract class AbstractEeaSendRawTransaction implements JsonRpcMethod {
private static final Logger LOG = LoggerFactory.getLogger(AbstractEeaSendRawTransaction.class);
private final TransactionPool transactionPool;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;

@Deprecated(since = "24.11.0")
public class JsonRpcErrorResponseException extends RuntimeException {

private final RpcErrorType jsonRpcError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.vertx.ext.auth.User;
import org.apache.tuweni.bytes.Bytes;

@Deprecated(since = "24.11.0")
public class PluginEeaSendRawTransaction extends AbstractEeaSendRawTransaction {
private final PrivacyController privacyController;
private final PrivacyIdProvider privacyIdProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import io.vertx.ext.auth.User;
import org.apache.tuweni.bytes.Bytes;

@Deprecated(since = "24.11.0")
public class RestrictedFlexibleEeaSendRawTransaction extends AbstractEeaSendRawTransaction {

private final PrivacyController privacyController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import io.vertx.ext.auth.User;
import org.apache.tuweni.bytes.Bytes;

@Deprecated(since = "24.11.0")
public class RestrictedOffchainEeaSendRawTransaction extends AbstractEeaSendRawTransaction {

final PrivacyController privacyController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.function.Supplier;
import java.util.stream.Stream;

@Deprecated(since = "24.11.0")
public abstract class AbstractPrivateTraceByHash implements JsonRpcMethod {

protected final Supplier<PrivateBlockTracer> blockTracerSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;

@Deprecated(since = "24.11.0")
public class PrivCall extends AbstractBlockParameterMethod {

private final PrivacyIdProvider privacyIdProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivCreatePrivacyGroup implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivCreatePrivacyGroup.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivDebugGetStateRoot extends AbstractBlockParameterMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivDebugGetStateRoot.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivDeletePrivacyGroup implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivDeletePrivacyGroup.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivDistributeRawTransaction implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivDistributeRawTransaction.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.slf4j.LoggerFactory;

@SuppressWarnings("MockNotUsedInProduction")
@Deprecated(since = "24.11.0")
public class PrivFindPrivacyGroup implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivFindPrivacyGroup.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.apache.tuweni.bytes.Bytes;

@Deprecated(since = "24.11.0")
public class PrivGetCode extends AbstractBlockParameterMethod {

private final PrivacyController privacyController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivGetEeaTransactionCount implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivGetEeaTransactionCount.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.List;
import java.util.Optional;

@Deprecated(since = "24.11.0")
public class PrivGetLogs implements JsonRpcMethod {

private final BlockchainQueries blockchainQueries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;

@Deprecated(since = "24.11.0")
public class PrivGetPrivacyPrecompileAddress implements JsonRpcMethod {

private final Address privacyAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivGetPrivateTransaction implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivGetPrivateTransaction.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivGetTransactionCount implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivGetTransactionCount.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivGetTransactionReceipt implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivGetTransactionReceipt.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.hyperledger.besu.ethereum.privacy.MultiTenancyPrivacyController;
import org.hyperledger.besu.ethereum.privacy.PrivacyController;

@Deprecated(since = "24.11.0")
public class PrivNewFilter implements JsonRpcMethod {

private final FilterManager filterManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivTraceTransaction extends AbstractPrivateTraceByHash implements JsonRpcMethod {
private static final Logger LOG = LoggerFactory.getLogger(TraceTransaction.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.Optional;

@Deprecated(since = "24.11.0")
public class PrivUtil {

public static void checkMembershipForAuthenticatedUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated(since = "24.11.0")
public class PrivxFindFlexiblePrivacyGroup implements JsonRpcMethod {

private static final Logger LOG = LoggerFactory.getLogger(PrivxFindFlexiblePrivacyGroup.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.hyperledger.besu.ethereum.privacy.PrivacyController;

// Use PrivxFindFlexiblePrivacyGroup instead
@Deprecated
@Deprecated(since = "21.10.3")
public class PrivxFindOnchainPrivacyGroup extends PrivxFindFlexiblePrivacyGroup {

public PrivxFindOnchainPrivacyGroup(
Expand Down
Loading

0 comments on commit 973bcc2

Please sign in to comment.