Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
Signed-off-by: Danno Ferrin <[email protected]>
  • Loading branch information
shemnon committed Oct 23, 2023
2 parents 731db59 + 9d9fe8c commit a61a63b
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 15 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Changelog

## Next release
- Cache last n blocks by using a new Besu flag --cache-last-blocks=n
- Optimize performances of RPC method Eth_feeHistory
### Breaking Changes

### Deprecations

### Additions and Improvements

### Bug Fixes

### Download Links

## 23.10.1
- Cache last n blocks by using a new Besu flag --cache-last-blocks=n [#6009](https://github.com/hyperledger/besu/pull/6009)
- Optimize performances of RPC method Eth_feeHistory [#6011](https://github.com/hyperledger/besu/pull/6011)

### Breaking Changes

Expand Down
2 changes: 2 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 @@ -3555,6 +3555,8 @@ private String generateConfigurationOverview() {

builder.setTxPoolImplementation(buildTransactionPoolConfiguration().getTxPoolImplementation());

builder.setPluginContext(besuComponent.getBesuPluginContext());

return builder.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.hyperledger.besu.BesuInfo;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.services.BesuPluginContextImpl;
import org.hyperledger.besu.util.log.FramedLogMessage;
import org.hyperledger.besu.util.platform.PlatformDetector;

Expand Down Expand Up @@ -50,6 +51,7 @@ public class ConfigurationOverviewBuilder {
private boolean isHighSpec = false;
private TransactionPoolConfiguration.Implementation txPoolImplementation;
private Map<String, String> environment;
private BesuPluginContextImpl besuPluginContext;

/**
* @param logger the logger
Expand Down Expand Up @@ -277,6 +279,12 @@ public String build() {
lines.add("Total memory: " + normalizeSize(hardwareInfo.getMemory().getTotal()));
lines.add("CPU cores: " + hardwareInfo.getProcessor().getLogicalProcessorCount());

lines.add("");

if (besuPluginContext != null) {
lines.addAll(besuPluginContext.getPluginsSummaryLog());
}

return FramedLogMessage.generate(lines);
}

Expand Down Expand Up @@ -308,4 +316,13 @@ private void detectJemalloc(final List<String> lines) {
private String normalizeSize(final long size) {
return String.format("%.02f", (double) (size) / 1024 / 1024 / 1024) + " GB";
}

/**
* set the plugin context
*
* @param besuPluginContext the plugin context
*/
public void setPluginContext(final BesuPluginContextImpl besuPluginContext) {
this.besuPluginContext = besuPluginContext;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static void checkMultiOptionDependencies(
}

/**
* Fail if option doesnt meet requirement.
* Fail if option doesn't meet requirement.
*
* @param commandLine the command line
* @param errorMessage the error message
Expand All @@ -126,7 +126,8 @@ public static void failIfOptionDoesntMeetRequirement(
final String affectedOptions = getAffectedOptions(commandLine, dependentOptionsNames);

if (!affectedOptions.isEmpty()) {
throw new CommandLine.ParameterException(commandLine, errorMessage);
throw new CommandLine.ParameterException(
commandLine, errorMessage + " [" + affectedOptions + "]");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.services.BesuService;
import org.hyperledger.besu.plugin.services.PluginVersionsProvider;
import org.hyperledger.besu.util.log.FramedLogMessage;

import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -76,6 +75,7 @@ private enum Lifecycle {
private final Map<Class<?>, ? super BesuService> serviceRegistry = new HashMap<>();
private final List<BesuPlugin> plugins = new ArrayList<>();
private final List<String> pluginVersions = new ArrayList<>();
final List<String> lines = new ArrayList<>();

/**
* Add service.
Expand Down Expand Up @@ -105,9 +105,7 @@ public <T extends BesuService> Optional<T> getService(final Class<T> serviceType
* @param pluginsDir the plugins dir
*/
public void registerPlugins(final Path pluginsDir) {
final List<String> lines = new ArrayList<>();
lines.add("plugins dir " + pluginsDir.toAbsolutePath());
lines.add("");
lines.add("Plugins:");
checkState(
state == Lifecycle.UNINITIALIZED,
"Besu plugins have already been registered. Cannot register additional plugins.");
Expand All @@ -120,11 +118,13 @@ public void registerPlugins(final Path pluginsDir) {
final ServiceLoader<BesuPlugin> serviceLoader =
ServiceLoader.load(BesuPlugin.class, pluginLoader);

int pluginsCount = 0;
for (final BesuPlugin plugin : serviceLoader) {
pluginsCount++;
try {
plugin.register(this);
LOG.info("Registered plugin of type {}.", plugin.getClass().getName());
lines.add(String.format("SUCCESS %s", plugin.getClass().getSimpleName()));
lines.add(String.format(plugin.getClass().getSimpleName()));
addPluginVersion(plugin);
} catch (final Exception e) {
LOG.error(
Expand All @@ -139,13 +139,23 @@ public void registerPlugins(final Path pluginsDir) {
}

LOG.debug("Plugin registration complete.");
lines.add("");
lines.add("TOTAL = " + plugins.size());
LOG.debug(FramedLogMessage.generate(lines));
lines.add(
String.format(
"TOTAL = %d of %d plugins successfully loaded", plugins.size(), pluginsCount));
lines.add(String.format("from %s", pluginsDir.toAbsolutePath()));

state = Lifecycle.REGISTERED;
}

/**
* get the summary log, as a list of string lines
*
* @return the summary
*/
public List<String> getPluginsSummaryLog() {
return lines;
}

private void addPluginVersion(final BesuPlugin plugin) {
final Package pluginPackage = plugin.getClass().getPackage();
final String implTitle =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;

/** The Rpc endpoint service implementation. */
/** The RPC endpoint service implementation. */
public class RpcEndpointServiceImpl implements RpcEndpointService {
private final Map<String, Function<PluginRpcRequest, ?>> rpcMethods = new HashMap<>();

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=23.10.1-SNAPSHOT
version=23.10.2-SNAPSHOT

org.gradle.welcome=never
# Set exports/opens flags required by Google Java Format and ErrorProne plugins. (JEP-396)
Expand Down

0 comments on commit a61a63b

Please sign in to comment.