Revert "revert to unchanged plugin interface signature (#7938)" (#7977)

This reverts commit f08147acef.

# Conflicts:
#	plugin-api/build.gradle

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
pull/7838/merge
Fabio Di Fabio 1 day ago committed by GitHub
parent 2b654dd5da
commit 74929eb215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 5
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java
  3. 4
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBesuEventsPlugin.java
  4. 5
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBlockchainServiceFinalizedPlugin.java
  5. 5
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestInProcessRpcServicePlugin.java
  6. 4
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestMetricsPlugin.java
  7. 5
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPermissioningPlugin.java
  8. 5
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java
  9. 4
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPrivacyServicePlugin.java
  10. 5
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestRpcEndpointServicePlugin.java
  11. 4
      besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java
  12. 2
      plugin-api/build.gradle
  13. 3
      plugin-api/src/main/java/org/hyperledger/besu/plugin/BesuPlugin.java
  14. 4
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBPlugin.java
  15. 4
      services/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/InMemoryStoragePlugin.java

@ -5,6 +5,7 @@
### Breaking Changes ### Breaking Changes
- Removed Retesteth rpc service and commands [#7833](https://github.com/hyperledger/besu/pull/7783) - Removed Retesteth rpc service and commands [#7833](https://github.com/hyperledger/besu/pull/7783)
- TLS for P2P (early access feature) has been removed [#7942](https://github.com/hyperledger/besu/pull/7942) - TLS for P2P (early access feature) has been removed [#7942](https://github.com/hyperledger/besu/pull/7942)
- In the plugin API, `BesuContext` has been renamed to `ServiceManager` to better reflect its function, plugins must be updated to work with this version
- With the upgrade of the Prometheus Java Metrics library, there are the following changes: - With the upgrade of the Prometheus Java Metrics library, there are the following changes:
- Gauge names are not allowed to end with `total`, therefore the metric `besu_blockchain_difficulty_total` is losing the `_total` suffix - Gauge names are not allowed to end with `total`, therefore the metric `besu_blockchain_difficulty_total` is losing the `_total` suffix
- The `_created` timestamps are not returned by default, you can set the env var `BESU_OPTS="-Dio.prometheus.exporter.includeCreatedTimestamps=true"` to enable them - The `_created` timestamps are not returned by default, you can set the env var `BESU_OPTS="-Dio.prometheus.exporter.includeCreatedTimestamps=true"` to enable them

@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.acceptance.plugins;
import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.charset.StandardCharsets.UTF_8;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import java.io.File; import java.io.File;
@ -39,8 +39,7 @@ public class BadCLIOptionsPlugin implements BesuPlugin {
private File callbackDir; private File callbackDir;
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
LOG.info("Registering BadCliOptionsPlugin"); LOG.info("Registering BadCliOptionsPlugin");
callbackDir = new File(System.getProperty("besu.plugins.dir", "plugins")); callbackDir = new File(System.getProperty("besu.plugins.dir", "plugins"));
writeStatus("init"); writeStatus("init");

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.tests.acceptance.plugins; package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.data.BlockHeader; import org.hyperledger.besu.plugin.data.BlockHeader;
@ -43,8 +42,7 @@ public class TestBesuEventsPlugin implements BesuPlugin {
private File callbackDir; private File callbackDir;
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
this.context = context; this.context = context;
LOG.info("Registered"); LOG.info("Registered");
callbackDir = new File(System.getProperty("besu.plugins.dir", "plugins")); callbackDir = new File(System.getProperty("besu.plugins.dir", "plugins"));

@ -17,8 +17,8 @@ package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.data.BlockContext; import org.hyperledger.besu.plugin.data.BlockContext;
import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.BlockchainService;
import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.RpcEndpointService;
@ -40,8 +40,7 @@ public class TestBlockchainServiceFinalizedPlugin implements BesuPlugin {
private static final String RPC_METHOD_SAFE_BLOCK = "updateSafeBlockV1"; private static final String RPC_METHOD_SAFE_BLOCK = "updateSafeBlockV1";
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager serviceManager) {
public void register(final BesuContext serviceManager) {
LOG.trace("Registering plugin ..."); LOG.trace("Registering plugin ...");
final RpcEndpointService rpcEndpointService = final RpcEndpointService rpcEndpointService =

@ -15,8 +15,8 @@
package org.hyperledger.besu.tests.acceptance.plugins; package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.RpcEndpointService;
import org.hyperledger.besu.plugin.services.rpc.RpcResponseType; import org.hyperledger.besu.plugin.services.rpc.RpcResponseType;
@ -36,8 +36,7 @@ public class TestInProcessRpcServicePlugin implements BesuPlugin {
long minGasPrice = -1; long minGasPrice = -1;
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
final PicoCLIOptions cmdlineOptions = final PicoCLIOptions cmdlineOptions =
context context
.getService(PicoCLIOptions.class) .getService(PicoCLIOptions.class)

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.tests.acceptance.plugins; package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.MetricsSystem; import org.hyperledger.besu.plugin.services.MetricsSystem;
@ -34,8 +33,7 @@ public class TestMetricsPlugin implements BesuPlugin {
private ServiceManager serviceManager; private ServiceManager serviceManager;
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
LOG.info("Registering TestMetricsPlugin"); LOG.info("Registering TestMetricsPlugin");
serviceManager = context; serviceManager = context;
context context

@ -14,8 +14,8 @@
*/ */
package org.hyperledger.besu.tests.acceptance.plugins; package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.PermissioningService; import org.hyperledger.besu.plugin.services.PermissioningService;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
@ -40,8 +40,7 @@ public class TestPermissioningPlugin implements BesuPlugin {
PermissioningService service; PermissioningService service;
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
context.getService(PicoCLIOptions.class).orElseThrow().addPicoCLIOptions("permissioning", this); context.getService(PicoCLIOptions.class).orElseThrow().addPicoCLIOptions("permissioning", this);
service = context.getService(PermissioningService.class).orElseThrow(); service = context.getService(PermissioningService.class).orElseThrow();
} }

@ -14,8 +14,8 @@
*/ */
package org.hyperledger.besu.tests.acceptance.plugins; package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import java.io.File; import java.io.File;
@ -57,8 +57,7 @@ public class TestPicoCLIPlugin implements BesuPlugin {
private File callbackDir; private File callbackDir;
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
LOG.info("Registering. Test Option is '{}'", testOption); LOG.info("Registering. Test Option is '{}'", testOption);
state = "registering"; state = "registering";

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.tests.acceptance.plugins; package org.hyperledger.besu.tests.acceptance.plugins;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
@ -41,8 +40,7 @@ public class TestPrivacyServicePlugin implements BesuPlugin {
new TestSigningPrivateMarkerTransactionFactory(); new TestSigningPrivateMarkerTransactionFactory();
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
this.context = context; this.context = context;
context context

@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.acceptance.plugins;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.RpcEndpointService;
import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest; import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest;
@ -51,8 +51,7 @@ public class TestRpcEndpointServicePlugin implements BesuPlugin {
} }
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
context context
.getService(RpcEndpointService.class) .getService(RpcEndpointService.class)
.ifPresent( .ifPresent(

@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
import org.hyperledger.besu.ethereum.core.plugins.PluginConfiguration; import org.hyperledger.besu.ethereum.core.plugins.PluginConfiguration;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.BesuService; import org.hyperledger.besu.plugin.services.BesuService;
@ -50,8 +49,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** The Besu plugin context implementation. */ /** The Besu plugin context implementation. */
@SuppressWarnings("removal") public class BesuPluginContextImpl implements ServiceManager, PluginVersionsProvider {
public class BesuPluginContextImpl implements BesuContext, ServiceManager, PluginVersionsProvider {
private static final Logger LOG = LoggerFactory.getLogger(BesuPluginContextImpl.class); private static final Logger LOG = LoggerFactory.getLogger(BesuPluginContextImpl.class);

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

@ -48,8 +48,7 @@ public interface BesuPlugin {
* *
* @param context the context that provides access to Besu services. * @param context the context that provides access to Besu services.
*/ */
@SuppressWarnings("removal") void register(ServiceManager context);
void register(BesuContext context);
/** /**
* Called once when besu has loaded configuration but before external services have been started * Called once when besu has loaded configuration but before external services have been started

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.plugin.services.storage.rocksdb; package org.hyperledger.besu.plugin.services.storage.rocksdb;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
@ -60,8 +59,7 @@ public class RocksDBPlugin implements BesuPlugin {
} }
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
LOG.debug("Registering plugin"); LOG.debug("Registering plugin");
this.context = context; this.context = context;

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.services.kvstore; package org.hyperledger.besu.services.kvstore;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.ServiceManager;
import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.BesuConfiguration;
@ -45,8 +44,7 @@ public class InMemoryStoragePlugin implements BesuPlugin {
public InMemoryStoragePlugin() {} public InMemoryStoragePlugin() {}
@Override @Override
@SuppressWarnings("removal") public void register(final ServiceManager context) {
public void register(final BesuContext context) {
LOG.debug("Registering plugin"); LOG.debug("Registering plugin");
this.context = context; this.context = context;

Loading…
Cancel
Save