From 44d0f9d0a220d601bd736fddce42dd801acff43a Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Thu, 28 Nov 2024 09:48:30 +0100 Subject: [PATCH] Revert "revert to unchanged plugin interface signature (#7938)" This reverts commit f08147acef874ad4e5493854096304ee7526c5fc. # Conflicts: # plugin-api/build.gradle --- .../besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java | 5 ++--- .../besu/tests/acceptance/plugins/TestBesuEventsPlugin.java | 4 +--- .../plugins/TestBlockchainServiceFinalizedPlugin.java | 5 ++--- .../acceptance/plugins/TestInProcessRpcServicePlugin.java | 5 ++--- .../besu/tests/acceptance/plugins/TestMetricsPlugin.java | 4 +--- .../tests/acceptance/plugins/TestPermissioningPlugin.java | 5 ++--- .../besu/tests/acceptance/plugins/TestPicoCLIPlugin.java | 5 ++--- .../tests/acceptance/plugins/TestPrivacyServicePlugin.java | 4 +--- .../acceptance/plugins/TestRpcEndpointServicePlugin.java | 5 ++--- .../org/hyperledger/besu/services/BesuPluginContextImpl.java | 4 +--- plugin-api/build.gradle | 2 +- .../main/java/org/hyperledger/besu/plugin/BesuPlugin.java | 3 +-- .../besu/plugin/services/storage/rocksdb/RocksDBPlugin.java | 4 +--- .../besu/services/kvstore/InMemoryStoragePlugin.java | 4 +--- 14 files changed, 20 insertions(+), 39 deletions(-) diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java index 2bf826ec42e..ec048ea0d32 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java @@ -16,8 +16,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.ServiceManager; import org.hyperledger.besu.plugin.services.PicoCLIOptions; import java.io.File; @@ -39,8 +39,7 @@ public class BadCLIOptionsPlugin implements BesuPlugin { private File callbackDir; @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { LOG.info("Registering BadCliOptionsPlugin"); callbackDir = new File(System.getProperty("besu.plugins.dir", "plugins")); writeStatus("init"); diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBesuEventsPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBesuEventsPlugin.java index 7c218126d63..7a4a17cf711 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBesuEventsPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBesuEventsPlugin.java @@ -14,7 +14,6 @@ */ package org.hyperledger.besu.tests.acceptance.plugins; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.data.BlockHeader; @@ -43,8 +42,7 @@ public class TestBesuEventsPlugin implements BesuPlugin { private File callbackDir; @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { this.context = context; LOG.info("Registered"); callbackDir = new File(System.getProperty("besu.plugins.dir", "plugins")); diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBlockchainServiceFinalizedPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBlockchainServiceFinalizedPlugin.java index 29ccc83d8bb..4984e7a00e8 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBlockchainServiceFinalizedPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBlockchainServiceFinalizedPlugin.java @@ -17,8 +17,8 @@ import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter; 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.ServiceManager; import org.hyperledger.besu.plugin.data.BlockContext; import org.hyperledger.besu.plugin.services.BlockchainService; 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"; @Override - @SuppressWarnings("removal") - public void register(final BesuContext serviceManager) { + public void register(final ServiceManager serviceManager) { LOG.trace("Registering plugin ..."); final RpcEndpointService rpcEndpointService = diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestInProcessRpcServicePlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestInProcessRpcServicePlugin.java index a304da09380..adbc1a35792 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestInProcessRpcServicePlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestInProcessRpcServicePlugin.java @@ -15,8 +15,8 @@ package org.hyperledger.besu.tests.acceptance.plugins; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.plugin.BesuContext; 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.RpcEndpointService; import org.hyperledger.besu.plugin.services.rpc.RpcResponseType; @@ -36,8 +36,7 @@ public class TestInProcessRpcServicePlugin implements BesuPlugin { long minGasPrice = -1; @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { final PicoCLIOptions cmdlineOptions = context .getService(PicoCLIOptions.class) diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestMetricsPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestMetricsPlugin.java index 8b731725225..9400fb4bccd 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestMetricsPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestMetricsPlugin.java @@ -14,7 +14,6 @@ */ package org.hyperledger.besu.tests.acceptance.plugins; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.MetricsSystem; @@ -34,8 +33,7 @@ public class TestMetricsPlugin implements BesuPlugin { private ServiceManager serviceManager; @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { LOG.info("Registering TestMetricsPlugin"); serviceManager = context; context diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPermissioningPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPermissioningPlugin.java index b41bcbc4a5f..c2503ed8112 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPermissioningPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPermissioningPlugin.java @@ -14,8 +14,8 @@ */ package org.hyperledger.besu.tests.acceptance.plugins; -import org.hyperledger.besu.plugin.BesuContext; 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.PicoCLIOptions; @@ -40,8 +40,7 @@ public class TestPermissioningPlugin implements BesuPlugin { PermissioningService service; @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { context.getService(PicoCLIOptions.class).orElseThrow().addPicoCLIOptions("permissioning", this); service = context.getService(PermissioningService.class).orElseThrow(); } diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java index ec242fa4c68..bb83ba676db 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java @@ -14,8 +14,8 @@ */ package org.hyperledger.besu.tests.acceptance.plugins; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; +import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.PicoCLIOptions; import java.io.File; @@ -57,8 +57,7 @@ public class TestPicoCLIPlugin implements BesuPlugin { private File callbackDir; @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { LOG.info("Registering. Test Option is '{}'", testOption); state = "registering"; diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPrivacyServicePlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPrivacyServicePlugin.java index 15fc22a42fa..698653f356f 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPrivacyServicePlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPrivacyServicePlugin.java @@ -14,7 +14,6 @@ */ package org.hyperledger.besu.tests.acceptance.plugins; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.PicoCLIOptions; @@ -41,8 +40,7 @@ public class TestPrivacyServicePlugin implements BesuPlugin { new TestSigningPrivateMarkerTransactionFactory(); @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { this.context = context; context diff --git a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestRpcEndpointServicePlugin.java b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestRpcEndpointServicePlugin.java index e4f0e8fdbd1..75d72473bf1 100644 --- a/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestRpcEndpointServicePlugin.java +++ b/acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestRpcEndpointServicePlugin.java @@ -16,8 +16,8 @@ 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.ServiceManager; import org.hyperledger.besu.plugin.services.RpcEndpointService; import org.hyperledger.besu.plugin.services.rpc.PluginRpcRequest; @@ -51,8 +51,7 @@ private String throwException(final PluginRpcRequest request) { } @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { context .getService(RpcEndpointService.class) .ifPresent( diff --git a/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java b/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java index fdcf8554751..fbee90edef9 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java @@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkState; 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.ServiceManager; import org.hyperledger.besu.plugin.services.BesuService; @@ -50,8 +49,7 @@ import org.slf4j.LoggerFactory; /** The Besu plugin context implementation. */ -@SuppressWarnings("removal") -public class BesuPluginContextImpl implements BesuContext, ServiceManager, PluginVersionsProvider { +public class BesuPluginContextImpl implements ServiceManager, PluginVersionsProvider { private static final Logger LOG = LoggerFactory.getLogger(BesuPluginContextImpl.class); diff --git a/plugin-api/build.gradle b/plugin-api/build.gradle index a3a5e07edd3..ba544e7fbee 100644 --- a/plugin-api/build.gradle +++ b/plugin-api/build.gradle @@ -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 = 'f6fi+lsYVZtFjmGOyiMPPCfNDie4SIPpj6HVgXRxF8Q=' + knownHash = 'GLoCdxUZsPJeHjt1lnwCbXQluLwhgkpKdIhFzrQO3gg=' } check.dependsOn('checkAPIChanges') diff --git a/plugin-api/src/main/java/org/hyperledger/besu/plugin/BesuPlugin.java b/plugin-api/src/main/java/org/hyperledger/besu/plugin/BesuPlugin.java index d4f2a08f2c2..b05fbf83c09 100644 --- a/plugin-api/src/main/java/org/hyperledger/besu/plugin/BesuPlugin.java +++ b/plugin-api/src/main/java/org/hyperledger/besu/plugin/BesuPlugin.java @@ -48,8 +48,7 @@ default Optional getName() { * * @param context the context that provides access to Besu services. */ - @SuppressWarnings("removal") - void register(BesuContext context); + void register(ServiceManager context); /** * Called once when besu has loaded configuration but before external services have been started diff --git a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBPlugin.java b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBPlugin.java index 0496bcb02b7..91e6e427bc3 100644 --- a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBPlugin.java +++ b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/RocksDBPlugin.java @@ -14,7 +14,6 @@ */ 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.ServiceManager; import org.hyperledger.besu.plugin.services.PicoCLIOptions; @@ -60,8 +59,7 @@ public void addIgnorableSegmentIdentifier(final SegmentIdentifier ignorable) { } @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { LOG.debug("Registering plugin"); this.context = context; diff --git a/services/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/InMemoryStoragePlugin.java b/services/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/InMemoryStoragePlugin.java index ff691a2a68c..11e7656dfb7 100644 --- a/services/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/InMemoryStoragePlugin.java +++ b/services/kvstore/src/main/java/org/hyperledger/besu/services/kvstore/InMemoryStoragePlugin.java @@ -14,7 +14,6 @@ */ package org.hyperledger.besu.services.kvstore; -import org.hyperledger.besu.plugin.BesuContext; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.ServiceManager; import org.hyperledger.besu.plugin.services.BesuConfiguration; @@ -45,8 +44,7 @@ public class InMemoryStoragePlugin implements BesuPlugin { public InMemoryStoragePlugin() {} @Override - @SuppressWarnings("removal") - public void register(final BesuContext context) { + public void register(final ServiceManager context) { LOG.debug("Registering plugin"); this.context = context;