Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-10 committed Aug 30, 2024
2 parents 915fcb0 + 1ea1d4c commit bff864b
Show file tree
Hide file tree
Showing 96 changed files with 1,059 additions and 680 deletions.
34 changes: 21 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

## [Unreleased]

### Fixed
- **DebugMetrics**: Fixed a `ClassCastException` occurring in `DebugMetrics` when handling nested metric structures. Previously, `Double` values within these structures were incorrectly cast to `Map` objects, leading to errors. This update allows for proper handling of both direct values and nested structures at the same level. Issue# [#7383](https://github.com/hyperledger/besu/pull/7383)
- `evmtool` was not respecting the `--genesis` setting, resulting in unexpected trace results. [#7433](https://github.com/hyperledger/besu/pull/7433)

### Tests
- Added a comprehensive test case to reproduce the bug and verify the fix for the `ClassCastException` in `DebugMetrics`. This ensures that complex, dynamically nested metric structures can be handled without errors.

## Next release

### Upcoming Breaking Changes

### Breaking Changes
Expand All @@ -20,13 +11,16 @@
- Add 'inbound' field to admin_peers JSON-RPC Call [#7461](https://github.com/hyperledger/besu/pull/7461)
- Add pending block header to `TransactionEvaluationContext` plugin API [#7483](https://github.com/hyperledger/besu/pull/7483)
- Add bootnode to holesky config [#7500](https://github.com/hyperledger/besu/pull/7500)
- Implement engine_getClientVersionV1
- Performance optimzation for ECMUL (1 of 2) [#7509](https://github.com/hyperledger/besu/pull/7509)
- Performance optimzation for ECMUL (2 of 2) [#7543](https://github.com/hyperledger/besu/pull/7543)

### Bug fixes
- Fix tracing in precompiled contracts when halting for out of gas [#7318](https://github.com/hyperledger/besu/issues/7318)
- Correctly release txpool save and restore lock in case of exceptions [#7473](https://github.com/hyperledger/besu/pull/7473)
- Fix for `eth_gasPrice` could not retrieve block error [#7482](https://github.com/hyperledger/besu/pull/7482)

- Correctly drops messages that exceeds local message size limit [#5455](https://github.com/hyperledger/besu/pull/7507)
- **DebugMetrics**: Fixed a `ClassCastException` occurring in `DebugMetrics` when handling nested metric structures. Previously, `Double` values within these structures were incorrectly cast to `Map` objects, leading to errors. This update allows for proper handling of both direct values and nested structures at the same level. Issue# [#7383](https://github.com/hyperledger/besu/pull/7383)
- `evmtool` was not respecting the `--genesis` setting, resulting in unexpected trace results. [#7433](https://github.com/hyperledger/besu/pull/7433)

## 24.8.0

Expand All @@ -45,15 +39,19 @@
- In process RPC service [#7395](https://github.com/hyperledger/besu/pull/7395)
- Added support for tracing private transactions using `priv_traceTransaction` API. [#6161](https://github.com/hyperledger/besu/pull/6161)
- Wrap WorldUpdater into EVMWorldupdater [#7434](https://github.com/hyperledger/besu/pull/7434)
- Bump besu-native to 0.9.4 [#7456](https://github.com/hyperledger/besu/pull/7456)

- Bump besu-native to 0.9.4 [#7456](https://github.com/hyperledger/besu/pull/7456)=

### Bug fixes
- Correct entrypoint in Docker evmtool [#7430](https://github.com/hyperledger/besu/pull/7430)
- Fix protocol schedule check for devnets [#7429](https://github.com/hyperledger/besu/pull/7429)
- Fix behaviour when starting in a pre-merge network [#7431](https://github.com/hyperledger/besu/pull/7431)
- Fix Null pointer from DNS daemon [#7505](https://github.com/hyperledger/besu/issues/7505)

### Download Links
https://github.com/hyperledger/besu/releases/tag/24.8.0
https://github.com/hyperledger/besu/releases/download/24.8.0/besu-24.8.0.tar.gz / sha256 9671157a623fb94005357bc409d1697a0d62bb6fd434b1733441bb301a9534a4
https://github.com/hyperledger/besu/releases/download/24.8.0/besu-24.8.0.zip / sha256 9ee217d2188e8da89002c3f42e4f85f89aab782e9512bd03520296f0a4dcdd90

## 24.7.1

### Breaking Changes
Expand Down Expand Up @@ -89,6 +87,11 @@
- Add 30 second timeout to trie log pruner preload [#7365](https://github.com/hyperledger/besu/pull/7365)
- Avoid executing pruner preload during trie log subcommands [#7366](https://github.com/hyperledger/besu/pull/7366)

### Download Links
https://github.com/hyperledger/besu/releases/tag/24.7.1
https://github.com/hyperledger/besu/releases/download/24.7.1/besu-24.7.1.tar.gz / sha256 59ac352a86fd887225737a5fe4dad1742347edd3c3fbed98b079177e4ea8d544
https://github.com/hyperledger/besu/releases/download/24.7.1/besu-24.7.1.zip / sha256 e616f8100f026a71a146a33847b40257c279b38085b17bb991df045cccb6f832

## 24.7.0

### Upcoming Breaking Changes
Expand Down Expand Up @@ -121,6 +124,11 @@
- Fix "Could not confirm best peer had pivot block" [#7109](https://github.com/hyperledger/besu/issues/7109)
- Fix "Chain Download Halt" [#6884](https://github.com/hyperledger/besu/issues/6884)

### Download Links
https://github.com/hyperledger/besu/releases/tag/24.7.0
https://github.com/hyperledger/besu/releases/download/24.7.0/besu-24.7.0.tar.gz / sha256 96cf47defd1d8c10bfc22634e53e3d640eaa81ef58cb0808e5f4265998979530
https://github.com/hyperledger/besu/releases/download/24.7.0/besu-24.7.0.zip / sha256 7e92e2eb469be197af8c8ca7ac494e7a2e7ee91cbdb02d99ff87fb5209e0c2a0



## 24.6.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Pre-requisites
* [Truffle](https://truffleframework.com/) installed
* [Truffle](https://archive.trufflesuite.com/truffle/) installed
```
npm install -g truffle
```
Expand Down
39 changes: 3 additions & 36 deletions besu/src/main/java/org/hyperledger/besu/BesuInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,16 @@
import org.hyperledger.besu.util.platform.PlatformDetector;

import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Represent Besu information such as version, OS etc. Used with --version option and during Besu
* start.
*/
public final class BesuInfo {
private static final String CLIENT = "besu";
private static final String VERSION = BesuInfo.class.getPackage().getImplementationVersion();
private static final String OS = PlatformDetector.getOS();
private static final String VM = PlatformDetector.getVM();
private static final String VERSION;
private static final String COMMIT;

static {
String projectVersion = BesuInfo.class.getPackage().getImplementationVersion();
if (projectVersion == null) {
// protect against unset project version (e.g. unit tests being run, etc)
VERSION = null;
COMMIT = null;
} else {
Pattern pattern =
Pattern.compile("(?<version>\\d+\\.\\d+\\.?\\d?-?\\w*)-(?<commit>[0-9a-fA-F]{8})");
Matcher matcher = pattern.matcher(projectVersion);
if (matcher.find()) {
VERSION = matcher.group("version");
COMMIT = matcher.group("commit");
} else {
throw new RuntimeException("Invalid project version: " + projectVersion);
}
}
}

private BesuInfo() {}

Expand All @@ -68,7 +46,7 @@ public static String shortVersion() {
* or "besu/v23.1.0/osx-aarch_64/corretto-java-19"
*/
public static String version() {
return String.format("%s/v%s-%s/%s/%s", CLIENT, VERSION, COMMIT, OS, VM);
return String.format("%s/v%s/%s/%s", CLIENT, VERSION, OS, VM);
}

/**
Expand All @@ -79,18 +57,7 @@ public static String version() {
*/
public static String nodeName(final Optional<String> maybeIdentity) {
return maybeIdentity
.map(
identity ->
String.format("%s/%s/v%s-%s/%s/%s", CLIENT, identity, VERSION, COMMIT, OS, VM))
.map(identity -> String.format("%s/%s/v%s/%s/%s", CLIENT, identity, VERSION, OS, VM))
.orElse(version());
}

/**
* Generate the commit hash for this besu version
*
* @return the commit hash for this besu version
*/
public static String commit() {
return COMMIT;
}
}
2 changes: 0 additions & 2 deletions besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -1291,8 +1291,6 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
new JsonRpcMethodsFactory()
.methods(
BesuInfo.nodeName(identityString),
BesuInfo.shortVersion(),
BesuInfo.commit(),
ethNetworkConfig.networkId(),
besuController.getGenesisConfigOptions(),
network,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static com.google.common.base.Preconditions.checkNotNull;

import org.hyperledger.besu.config.BftConfigOptions;
import org.hyperledger.besu.config.BftFork;
import org.hyperledger.besu.config.QbftConfigOptions;
import org.hyperledger.besu.config.QbftFork;
Expand Down Expand Up @@ -103,6 +104,7 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder {
private ForksSchedule<QbftConfigOptions> qbftForksSchedule;
private ValidatorPeers peers;
private TransactionValidatorProvider transactionValidatorProvider;
private BftConfigOptions bftConfigOptions;

/** Default Constructor. */
public QbftBesuControllerBuilder() {}
Expand All @@ -120,6 +122,7 @@ protected void prepForBuild() {
qbftConfig = genesisConfigOptions.getQbftConfigOptions();
bftEventQueue = new BftEventQueue(qbftConfig.getMessageQueueLimit());
qbftForksSchedule = QbftForksSchedulesFactory.create(genesisConfigOptions);
bftConfigOptions = qbftConfig;
}

@Override
Expand All @@ -132,7 +135,8 @@ protected JsonRpcMethods createAdditionalJsonRpcMethodFactory(
protocolContext,
protocolSchedule,
miningParameters,
createReadOnlyValidatorProvider(protocolContext.getBlockchain()));
createReadOnlyValidatorProvider(protocolContext.getBlockchain()),
bftConfigOptions);
}

private ValidatorProvider createReadOnlyValidatorProvider(final Blockchain blockchain) {
Expand Down
7 changes: 3 additions & 4 deletions besu/src/test/java/org/hyperledger/besu/BesuInfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public final class BesuInfoTest {
*/
@Test
public void versionStringIsEthstatsFriendly() {
assertThat(BesuInfo.version())
.matches("[^/]+/v(\\d+\\.\\d+\\.\\d+[^/]*|null-null)/[^/]+/[^/]+");
assertThat(BesuInfo.version()).matches("[^/]+/v(\\d+\\.\\d+\\.\\d+[^/]*|null)/[^/]+/[^/]+");
}

/**
Expand All @@ -46,7 +45,7 @@ public void versionStringIsEthstatsFriendly() {
@Test
public void noIdentityNodeNameIsEthstatsFriendly() {
assertThat(BesuInfo.nodeName(Optional.empty()))
.matches("[^/]+/v(\\d+\\.\\d+\\.\\d+[^/]*|null-null)/[^/]+/[^/]+");
.matches("[^/]+/v(\\d+\\.\\d+\\.\\d+[^/]*|null)/[^/]+/[^/]+");
}

/**
Expand All @@ -59,6 +58,6 @@ public void noIdentityNodeNameIsEthstatsFriendly() {
@Test
public void userIdentityNodeNameIsEthstatsFriendly() {
assertThat(BesuInfo.nodeName(Optional.of("TestUserIdentity")))
.matches("[^/]+/[^/]+/v(\\d+\\.\\d+\\.\\d+[^/]*|null-null)/[^/]+/[^/]+");
.matches("[^/]+/[^/]+/v(\\d+\\.\\d+\\.\\d+[^/]*|null)/[^/]+/[^/]+");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import org.hyperledger.besu.services.kvstore.InMemoryKeyValueStorage;
import org.hyperledger.besu.testutil.DeterministicEthScheduler;
import org.hyperledger.besu.testutil.TestClock;
import org.hyperledger.besu.util.number.ByteUnits;

import java.math.BigInteger;
import java.time.ZoneId;
Expand Down Expand Up @@ -154,7 +155,7 @@ public void setUp() {
.when(mockWorldStateArchive.getMutable(any(), anyBoolean()))
.thenReturn(Optional.of(mockWorldState));

blockBroadcaster = new BlockBroadcaster(mockEthContext);
blockBroadcaster = new BlockBroadcaster(mockEthContext, 10 * ByteUnits.MEGABYTE);
syncState = new SyncState(blockchain, mockEthPeers);
TransactionPoolConfiguration txPoolConfig =
ImmutableTransactionPoolConfiguration.builder()
Expand Down
33 changes: 15 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ plugins {
id 'maven-publish'
}

tasks.register('spotlessCheckFast') {
dependsOn subprojects.collect { it.tasks.withType(com.diffplug.gradle.spotless.SpotlessCheck) }
}

if (!JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_21)) {
throw new GradleException("Java 21 or later is required to build Besu.\n" +
" Detected version ${JavaVersion.current()}")
Expand All @@ -45,12 +41,15 @@ group = 'io.consensys.linea-besu'

defaultTasks 'build', 'checkLicense', 'javadoc'

def buildAliases = ['dev': [
def buildAliases = [
'dev': [
'spotlessApply',
'build',
'checkLicense',
'javadoc'
]]
],
'build': ['spotlessCheck', 'build']
]

def expandedTaskList = []
gradle.startParameter.taskNames.each {
Expand Down Expand Up @@ -423,12 +422,6 @@ allprojects {
options.addStringOption('Xwerror', '-html5')
options.encoding = 'UTF-8'
}

plugins.withType(JavaPlugin) {
tasks.withType(JavaCompile) {
it.dependsOn(rootProject.tasks.named('spotlessCheckFast'))
}
}
}

task deploy() {}
Expand All @@ -452,7 +445,7 @@ task checkMavenCoordinateCollisions {

tasks.register('checkPluginAPIChanges', DefaultTask) {}
checkPluginAPIChanges.dependsOn(':plugin-api:checkAPIChanges')
check.dependsOn('checkPluginAPIChanges', 'checkMavenCoordinateCollisions', 'spotlessCheckFast')
check.dependsOn('checkPluginAPIChanges', 'checkMavenCoordinateCollisions')

subprojects {

Expand Down Expand Up @@ -804,7 +797,7 @@ task distDocker {
dockerPlatform = "--platform ${project.getProperty('docker-platform')}"
println "Building for platform ${project.getProperty('docker-platform')}"
}
def gitDetails = getGitCommitDetails()
def gitDetails = getGitCommitDetails(7)
executable shell
workingDir dockerBuildDir
args "-c", "docker buildx build ${dockerPlatform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${gitDetails.hash} -t ${image} --push ."
Expand Down Expand Up @@ -972,13 +965,17 @@ def buildTime() {
def calculateVersion() {
// Regex pattern for basic calendar versioning, with provision to omit patch rev
def calVerPattern = ~/\d+\.\d+(\.\d+)?(-.*)?/
def gitDetails = getGitCommitDetails() // Adjust length as needed

if (project.hasProperty('version') && (project.version =~ calVerPattern)) {
println("Generating project version using supplied version: ${project.version}-${gitDetails.hash}")
return "${project.version}-${gitDetails.hash}"
if (project.hasProperty('versionappendcommit') && project.versionappendcommit == "true") {
def gitDetails = getGitCommitDetails(7) // Adjust length as needed
return "${project.version}-${gitDetails.hash}"
}
return "${project.version}"
} else {
// If no version is supplied or it doesn't match the semantic versioning, calculate from git
println("Generating project version using date (${gitDetails.date}-develop-${gitDetails.hash}), as supplied version is not semver: ${project.version}")
println("Generating project version as supplied is version not semver: ${project.version}")
def gitDetails = getGitCommitDetails(7) // Adjust length as needed
return "${gitDetails.date}-develop-${gitDetails.hash}"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
*/
package org.hyperledger.besu.consensus.qbft.jsonrpc;

import org.hyperledger.besu.config.BftConfigOptions;
import org.hyperledger.besu.consensus.common.BlockInterface;
import org.hyperledger.besu.consensus.common.bft.BftContext;
import org.hyperledger.besu.consensus.common.validator.ValidatorProvider;
import org.hyperledger.besu.consensus.qbft.jsonrpc.methods.QbftDiscardValidatorVote;
import org.hyperledger.besu.consensus.qbft.jsonrpc.methods.QbftGetPendingVotes;
import org.hyperledger.besu.consensus.qbft.jsonrpc.methods.QbftGetRequestTimeoutSeconds;
import org.hyperledger.besu.consensus.qbft.jsonrpc.methods.QbftGetSignerMetrics;
import org.hyperledger.besu.consensus.qbft.jsonrpc.methods.QbftGetValidatorsByBlockHash;
import org.hyperledger.besu.consensus.qbft.jsonrpc.methods.QbftGetValidatorsByBlockNumber;
Expand All @@ -40,6 +42,7 @@ public class QbftJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final ValidatorProvider readOnlyValidatorProvider;
private final ProtocolSchedule protocolSchedule;
private final MiningParameters miningParameters;
private final BftConfigOptions bftConfig;

/**
* Instantiates a new Qbft json rpc methods.
Expand All @@ -48,16 +51,19 @@ public class QbftJsonRpcMethods extends ApiGroupJsonRpcMethods {
* @param protocolSchedule the protocol schedule
* @param miningParameters the mining parameters
* @param readOnlyValidatorProvider the read only validator provider
* @param bftConfig the BFT config options, containing QBFT-specific settings
*/
public QbftJsonRpcMethods(
final ProtocolContext context,
final ProtocolSchedule protocolSchedule,
final MiningParameters miningParameters,
final ValidatorProvider readOnlyValidatorProvider) {
final ValidatorProvider readOnlyValidatorProvider,
final BftConfigOptions bftConfig) {
this.context = context;
this.readOnlyValidatorProvider = readOnlyValidatorProvider;
this.protocolSchedule = protocolSchedule;
this.miningParameters = miningParameters;
this.bftConfig = bftConfig;
}

@Override
Expand All @@ -77,12 +83,16 @@ protected Map<String, JsonRpcMethod> create() {
final BlockInterface blockInterface = bftContext.getBlockInterface();
final ValidatorProvider validatorProvider = bftContext.getValidatorProvider();

return mapOf(
new QbftProposeValidatorVote(validatorProvider),
new QbftGetValidatorsByBlockNumber(blockchainQueries, readOnlyValidatorProvider),
new QbftDiscardValidatorVote(validatorProvider),
new QbftGetValidatorsByBlockHash(context.getBlockchain(), readOnlyValidatorProvider),
new QbftGetSignerMetrics(readOnlyValidatorProvider, blockInterface, blockchainQueries),
new QbftGetPendingVotes(validatorProvider));
Map<String, JsonRpcMethod> methods =
mapOf(
new QbftProposeValidatorVote(validatorProvider),
new QbftGetValidatorsByBlockNumber(blockchainQueries, readOnlyValidatorProvider),
new QbftDiscardValidatorVote(validatorProvider),
new QbftGetValidatorsByBlockHash(context.getBlockchain(), readOnlyValidatorProvider),
new QbftGetSignerMetrics(readOnlyValidatorProvider, blockInterface, blockchainQueries),
new QbftGetPendingVotes(validatorProvider),
new QbftGetRequestTimeoutSeconds(bftConfig));

return methods;
}
}
Loading

0 comments on commit bff864b

Please sign in to comment.