Skip to content

Commit

Permalink
Merge Besu main (#34)
Browse files Browse the repository at this point in the history
* mark deleted slot during clear storage step (hyperledger#6305)

Signed-off-by: Karim Taam <[email protected]>
Co-authored-by: garyschulte <[email protected]>

* made directory structure of tests match source; fixed one typo (hyperledger#6337)

Signed-off-by: Sally MacFarlane <[email protected]>

* migrate controller tests to junit 5 (hyperledger#6338)

Signed-off-by: Sally MacFarlane <[email protected]>

* add new forkids for testnets, update forkid test to Junit5, no longer need named network specific trusted setups (hyperledger#6322)

Signed-off-by: jflo <[email protected]>

* Fix trielog shipping issue during self destruct (hyperledger#6340)

* fix trielog shipping issue

Signed-off-by: Karim Taam <[email protected]>

* bump gradle properties version and adjust changelog to match release (hyperledger#6347)

Signed-off-by: garyschulte <[email protected]>

* finalized cancun spec (hyperledger#6351)

* finalized cancun spec

Signed-off-by: jflo <[email protected]>

* finalized cancun spec

Signed-off-by: jflo <[email protected]>

---------

Signed-off-by: jflo <[email protected]>

* Optimize RocksDB WAL file (hyperledger#6328)


Signed-off-by: Fabio Di Fabio <[email protected]>

* Make RPC reason settable, pass execution failure reason in RPC error message (hyperledger#6343)

* Make RPC reason settable, pass execution failure reason in RPC error message

Signed-off-by: Matthew Whitehead <[email protected]>

* Update unit tests

Signed-off-by: Matthew Whitehead <[email protected]>

* Update tests

Signed-off-by: Matthew Whitehead <[email protected]>

* Update change log

Signed-off-by: Matthew Whitehead <[email protected]>

* Update integration tests

Signed-off-by: Matthew Whitehead <[email protected]>

---------

Signed-off-by: Matthew Whitehead <[email protected]>

* TestWatcher junit5 (hyperledger#6339)

* TestWatcher junit5
* add test class and method name to context
* moved the testwatcher junit5 function to a new junit5 superclass
* one qbft test to junit5 superclass

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>
Co-authored-by: Stefan Pingel <[email protected]>

* Migrate BFT tests to junit 5 (hyperledger#6350)

* bft tests to junit 5
* base class for pki extend AcceptanceTestBaseJunit5
* try/catch in case of empty optionals
* fixed parameterization method

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>

* fixing on selfdestruct (hyperledger#6359)

Signed-off-by: Karim Taam <[email protected]>

* migrate clique tests fully to junit5 (hyperledger#6362)

* migrate clique tests fully to junit5

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>

* fixed link to logging docs (hyperledger#6366)

Signed-off-by: Sally MacFarlane <[email protected]>

* Move logging to RunnerBuilder (hyperledger#6367)

Signed-off-by: Gabriel-Trintinalia <[email protected]>

* Use synchronized call to access the chain head block in `eth_estimateGas` (hyperledger#6345)

* Use synchronized call to access the chain head block in estimateGas()

Signed-off-by: Matthew Whitehead <[email protected]>

* Add error log entries when throwing internal error from estimateGas()

Signed-off-by: Matthew Whitehead <[email protected]>

* Update unit tests

Signed-off-by: Matthew Whitehead <[email protected]>

* Update changelog

Signed-off-by: Matthew Whitehead <[email protected]>

---------

Signed-off-by: Matthew Whitehead <[email protected]>

* Add --X-trie-log subcommand (hyperledger#6303)

* Add x-trie-log subcommand for one-off trie log backlog prune

Signed-off-by: Simon Dudley <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>

---------

Signed-off-by: Simon Dudley <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
Co-authored-by: Simon Dudley <[email protected]>

* fix typos (hyperledger#6368)

Signed-off-by: vuittont60 <[email protected]>

* Added alias --sync-min-peers for --fast-sync-min-peers (hyperledger#6372)

* sync-min-peers as an alias
* added unit tests

Signed-off-by: Sally MacFarlane <[email protected]>

---------

Signed-off-by: Sally MacFarlane <[email protected]>

* Fix: Fallback to getName when canonicalName is null in BlockHeaderValidator DEBUG log (hyperledger#6332)

* fallback to simple name when canonical name is null
* use getName instead of getSimpleName to include the package name

Signed-off-by: Manoj P R <[email protected]>

---------

Signed-off-by: Manoj P R <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>

* fix: use UID 1000 for besu user (hyperledger#6358) (hyperledger#6360)

The openjdk-latest Docker image is using UID 1001 for besu, because its
base image ubuntu:23.10 now contains a default "ubuntu" user with UID
1000. (This UID change causes the besu user with UID 1001 to not have
access to files created for past versions with UID 1000.)

We now remove the default ubuntu user and explicitly use UID 1000 when
creating the besu user.

Signed-off-by: Hal Blackburn <[email protected]>

* Ignore generated files when running the spdx license check (hyperledger#6379)

Signed-off-by: Meredith Baxter <[email protected]>

* full sync - don't fail startup if sync-min-peers specified (hyperledger#6373)

Signed-off-by: Sally MacFarlane <[email protected]>

* Copy also computed fields, when doing a Transaction detached copy (hyperledger#6329)

Signed-off-by: Fabio Di Fabio <[email protected]>

* Disable txpool when not in sync (hyperledger#6302)


Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump to nex release snapshot 24.1.1 (hyperledger#6383)

* release next snapshot 24.1.1

Signed-off-by: garyschulte <[email protected]>

* move recent changelog items to 24.1.1-SNAPSHOT

Signed-off-by: garyschulte <[email protected]>

---------

Signed-off-by: garyschulte <[email protected]>

* Correct Tangerine Whistle definition in Fluent EVM APIs. (hyperledger#6382)

The fluent API incorrectly added the code size limit in Tangerine
Whistle instead of first adding it in Spurious Dragon.

Signed-off-by: Danno Ferrin <[email protected]>

* [MINOR] Fix pki tests condition check on mac (hyperledger#6387)

Signed-off-by: Gabriel-Trintinalia <[email protected]>

* Upgrade dependencies (hyperledger#6377)

* Bump com.github.oshi:oshi-core to 6.4.10

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump com.github.tomakehurst to org.wiremock 3.3.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump com.google.auto.service:auto-service to 1.1.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump com.google.dagger group to 2.50

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump com.graphql-java:graphql-java to 21.3

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump com.splunk.logging:splunk-library-javalogging to 1.11.8

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump com.squareup.okhttp3:okhttp to 4.12.0
Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump commons-io:commons-io to 2.15.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump dnsjava:dnsjava to 3.5.3

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump info.picocli group to 4.7.5

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump io.grpc group to 1.60.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump io.kubernetes:client-java to 18.0.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump io.netty group to 4.1.104.Final

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump net.java.dev.jna:jna to 5.14.0

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.apache.commons:commons-compress to 1.25.0

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.apache.commons:commons-lang3 to 3.14.0

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.apache.commons:commons-text to 1.11.0

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.apache.logging.log4j group to 2.22.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Redorder io.tmio group

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.assertj:assertj-core to 3.25.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.bouncycastle group to 1.77

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.fusesource.jansi:jansi to 2.4.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.immutables group 2.10.0

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.java-websocket:Java-WebSocket to 1.5.5

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.jetbrains.kotlin:kotlin-stdlib to 1.9.22

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.junit.jupiter group to 5.10.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.jupnp group to 2.7.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.rocksdb:rocksdbjni to 8.9.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.slf4j group to 2.0.10

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.springframework.security:spring-security-crypto to 6.2.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.testcontainers:testcontainers to 1.19.3

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.web3j group to 4.10.3

Signed-off-by: Fabio Di Fabio <[email protected]>

* Bump org.xerial.snappy:snappy-java to 1.1.10.5

Signed-off-by: Fabio Di Fabio <[email protected]>

* Regenerate gradle verification metadata

Signed-off-by: Fabio Di Fabio <[email protected]>

* Update commons-codec:commons-codec to 1.16.0

Signed-off-by: Fabio Di Fabio <[email protected]>

* Update org.junit.vintage:junit-vintage-engine to 5.10.1

Signed-off-by: Fabio Di Fabio <[email protected]>

* Update CHANGELOG

Signed-off-by: Fabio Di Fabio <[email protected]>

---------

Signed-off-by: Fabio Di Fabio <[email protected]>

* add a fallback for docker detection on Mac (hyperledger#6356)

Signed-off-by: garyschulte <[email protected]>

* Fix test flackyness of acceptanceTestsPermissioning  (hyperledger#6384)


Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Sally MacFarlane <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>

* Upgrade `com.fasterxml.jackson` dependencies (hyperledger#6378)


Signed-off-by: Fabio Di Fabio <[email protected]>

* Use mining beneficiary from protocol spec in TraceServiceImpl (hyperledger#6390)

* use mining beneficiary from protocol spec

Signed-off-by: Daniel Lehrner <[email protected]>

---------

Signed-off-by: Daniel Lehrner <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>

* Update verification metadata and allowed licenses for Linea-Besu

---------

Signed-off-by: Karim Taam <[email protected]>
Signed-off-by: Sally MacFarlane <[email protected]>
Signed-off-by: jflo <[email protected]>
Signed-off-by: garyschulte <[email protected]>
Signed-off-by: Fabio Di Fabio <[email protected]>
Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Gabriel-Trintinalia <[email protected]>
Signed-off-by: Simon Dudley <[email protected]>
Signed-off-by: Gabriel Fukushima <[email protected]>
Signed-off-by: vuittont60 <[email protected]>
Signed-off-by: Manoj P R <[email protected]>
Signed-off-by: Hal Blackburn <[email protected]>
Signed-off-by: Meredith Baxter <[email protected]>
Signed-off-by: Danno Ferrin <[email protected]>
Signed-off-by: Daniel Lehrner <[email protected]>
Co-authored-by: Karim TAAM <[email protected]>
Co-authored-by: garyschulte <[email protected]>
Co-authored-by: Sally MacFarlane <[email protected]>
Co-authored-by: Justin Florentine <[email protected]>
Co-authored-by: Fabio Di Fabio <[email protected]>
Co-authored-by: Matt Whitehead <[email protected]>
Co-authored-by: Stefan Pingel <[email protected]>
Co-authored-by: Gabriel-Trintinalia <[email protected]>
Co-authored-by: Gabriel Fukushima <[email protected]>
Co-authored-by: Simon Dudley <[email protected]>
Co-authored-by: vuittont60 <[email protected]>
Co-authored-by: Manoj P R <[email protected]>
Co-authored-by: Hal Blackburn <[email protected]>
Co-authored-by: mbaxter <[email protected]>
Co-authored-by: Danno Ferrin <[email protected]>
Co-authored-by: daniellehrner <[email protected]>
  • Loading branch information
17 people authored Jan 12, 2024
1 parent dcb6f27 commit 6d9c8b1
Show file tree
Hide file tree
Showing 53 changed files with 2,404 additions and 2,101 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Breaking Changes
- New `EXECUTION_HALTED` error returned if there is an error executing or simulating a transaction, with the reason for execution being halted. Replaces the generic `INTERNAL_ERROR` return code in certain cases which some applications may be checking for [#6343](https://github.com/hyperledger/besu/pull/6343)
- The Besu Docker images with `openjdk-latest` tags since 23.10.3 were incorrectly using UID 1001 instead of 1000 for the container's `besu` user. The user now uses 1000 again. Containers created from or migrated to images using UID 1001 will need to chown their persistent database files to UID 1000 [#6360](https://github.com/hyperledger/besu/pull/6360)

### Deprecations
- Forest pruning (`pruning-enabled` options) is deprecated and will be removed soon. To save disk space consider switching to Bonsai data storage format [#6230](https://github.com/hyperledger/besu/pull/6230)
Expand All @@ -15,9 +16,15 @@
- Add custom genesis file name to config overview if specified [#6297](https://github.com/hyperledger/besu/pull/6297)
- Update Gradle plugins and replace unmaintained License Gradle Plugin with the actively maintained Gradle License Report [#6275](https://github.com/hyperledger/besu/pull/6275)
- Optimize RocksDB WAL files, allows for faster restart and a more linear disk space utilization [#6328](https://github.com/hyperledger/besu/pull/6328)
- Disable transaction handling when the node is not in sync, to avoid unnecessary transaction validation work [#6302](https://github.com/hyperledger/besu/pull/6302)
- Upgrade dependencies [#6377](https://github.com/hyperledger/besu/pull/6377)
- Upgrade `com.fasterxml.jackson` dependencies [#6378](https://github.com/hyperledger/besu/pull/6378)

### Bug fixes
- INTERNAL_ERROR from `eth_estimateGas` JSON/RPC calls [#6344](https://github.com/hyperledger/besu/issues/6344)
- Fix Besu Docker images with `openjdk-latest` tags since 23.10.3 using UID 1001 instead of 1000 for the `besu` user [#6360](https://github.com/hyperledger/besu/pull/6360)
- Fluent EVM API definition for Tangerine Whistle had incorrect code size validation configured [#6382](https://github.com/hyperledger/besu/pull/6382)
- Correct mining beneficiary for Clique networks in TraceServiceImpl [#6390](https://github.com/hyperledger/besu/pull/6390)

## 23.10.3

Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/dsl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies {
implementation project(':testutil')
implementation project(':util')

implementation 'com.github.tomakehurst:wiremock-jre8'
implementation 'com.google.guava:guava'
implementation 'com.google.dagger:dagger'
annotationProcessor 'com.google.dagger:dagger-compiler'
Expand All @@ -45,6 +44,7 @@ dependencies {
implementation 'org.web3j:abi'
implementation 'org.web3j:besu'
implementation 'org.web3j:crypto'
implementation 'org.wiremock:wiremock'

implementation 'org.testcontainers:testcontainers'
implementation 'org.junit.jupiter:junit-jupiter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public Condition miningStatus(final boolean isMining) {
return new MiningStatusCondition(transactions.mining(), isMining);
}

public Condition syncingStatus(final boolean isSyncing) {
return new SyncingStatusCondition(transactions.syncing(), isSyncing);
}

public Condition expectNewPendingTransactions(
final BigInteger filterId, final List<String> transactionHashes) {
return new NewPendingTransactionFilterChangesCondition(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Hyperledger Besu Contributors.
*
* 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.tests.acceptance.dsl.condition.eth;

import static org.assertj.core.api.Assertions.assertThat;

import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.eth.EthSyncingTransaction;

public class SyncingStatusCondition implements Condition {

private final EthSyncingTransaction transaction;
private final boolean syncingMiningStatus;

public SyncingStatusCondition(
final EthSyncingTransaction transaction, final boolean syncingStatus) {
this.transaction = transaction;
this.syncingMiningStatus = syncingStatus;
}

@Override
public void verify(final Node node) {
WaitUtils.waitFor(
10, () -> assertThat(node.execute(transaction)).isEqualTo(syncingMiningStatus));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,8 @@ public void start(final List<? extends RunnableNode> nodes) {
final Optional<? extends RunnableNode> bootnode = selectAndStartBootnode(nodes);

nodes.parallelStream()
.filter(
node -> {
LOG.info("starting non-bootnode {}", node.getName());
return bootnode.map(boot -> boot != node).orElse(true);
})
.filter(node -> bootnode.map(boot -> boot != node).orElse(true))
.peek(node -> LOG.info("starting non-bootnode {}", node.getName()))
.forEach(this::startNode);

if (clusterConfiguration.isAwaitPeerDiscovery()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Hyperledger Besu Contributors.
*
* 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.tests.acceptance.dsl.transaction.eth;

import static org.assertj.core.api.Assertions.assertThat;

import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction;

import java.io.IOException;

import org.web3j.protocol.core.methods.response.EthSyncing;

public class EthSyncingTransaction implements Transaction<Boolean> {

EthSyncingTransaction() {}

@Override
public Boolean execute(final NodeRequests node) {
try {
EthSyncing response = node.eth().ethSyncing().send();
assertThat(response).isNotNull();
return response.isSyncing();
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public EthMiningTransaction mining() {
return new EthMiningTransaction();
}

public EthSyncingTransaction syncing() {
return new EthSyncingTransaction();
}

public EthNewPendingTransactionFilterTransaction newPendingTransactionsFilter() {
return new EthNewPendingTransactionFilterTransaction();
}
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dependencies {
testImplementation project(':testutil')
testImplementation project(':util')

testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone'
testImplementation 'commons-io:commons-io'
testImplementation 'io.grpc:grpc-all'
testImplementation 'io.grpc:grpc-core'
Expand Down Expand Up @@ -84,6 +83,7 @@ dependencies {
testImplementation 'org.web3j:abi'
testImplementation 'org.web3j:besu'
testImplementation 'org.web3j:core'
testImplementation 'org.wiremock:wiremock'

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public void setUp() {

permissionedNode.verify(admin.addPeer(bootnode));
permissionedNode.verify(admin.addPeer(allowedNode));

allowedNode.verify(eth.syncingStatus(false));
bootnode.verify(eth.syncingStatus(false));
permissionedNode.verify(eth.syncingStatus(false));
forbiddenNode.verify(eth.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public void setUp() {

permissionedNode.execute(allowNode(permissionedNode));
permissionedNode.verify(connectionIsAllowed(permissionedNode));

allowedNode.verify(eth.syncingStatus(false));
bootnode.verify(eth.syncingStatus(false));
permissionedNode.verify(eth.syncingStatus(false));
forbiddenNode.verify(eth.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"londonBlock": 0,
"zeroBaseFee": true,
"ethash": {
"fixeddifficulty": 100
"fixeddifficulty": 500
}
},
"nonce": "0x42",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"londonBlock": 0,
"zeroBaseFee": true,
"ethash": {
"fixeddifficulty": 100
"fixeddifficulty": 500
}
},
"nonce": "0x42",
Expand Down
18 changes: 9 additions & 9 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.hyperledger.besu.cli.config.NetworkName.MAINNET;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPENDENCY_WARNING_MSG;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATION_WARNING_MSG;
import static org.hyperledger.besu.cli.util.CommandLineUtils.isOptionSet;
import static org.hyperledger.besu.controller.BesuController.DATABASE_PATH;
import static org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration.DEFAULT_GRAPHQL_HTTP_PORT;
import static org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration.DEFAULT_ENGINE_JSON_RPC_PORT;
Expand Down Expand Up @@ -521,11 +522,11 @@ private InetAddress autoDiscoverDefaultIP() {
private SyncMode syncMode = null;

@Option(
names = {"--fast-sync-min-peers"},
names = {"--sync-min-peers", "--fast-sync-min-peers"},
paramLabel = MANDATORY_INTEGER_FORMAT_HELP,
description =
"Minimum number of peers required before starting fast sync. Has only effect on PoW networks. (default: ${DEFAULT-VALUE})")
private final Integer fastSyncMinPeerCount = FAST_SYNC_MIN_PEER_COUNT;
"Minimum number of peers required before starting sync. Has effect only on non-PoS networks. (default: ${DEFAULT-VALUE})")
private final Integer syncMinPeerCount = SYNC_MIN_PEER_COUNT;

@Option(
names = {"--network"},
Expand Down Expand Up @@ -2028,11 +2029,10 @@ private void issueOptionWarnings() {
"--p2p-port",
"--remote-connections-max-percentage"));

CommandLineUtils.failIfOptionDoesntMeetRequirement(
commandLine,
"--fast-sync-min-peers can't be used with FULL sync-mode",
!SyncMode.isFullSync(getDefaultSyncModeIfNotSet()),
singletonList("--fast-sync-min-peers"));
if (SyncMode.isFullSync(getDefaultSyncModeIfNotSet())
&& isOptionSet(commandLine, "--sync-min-peers")) {
logger.warn("--sync-min-peers is ignored in FULL sync-mode");
}

CommandLineUtils.failIfOptionDoesntMeetRequirement(
commandLine,
Expand Down Expand Up @@ -2867,7 +2867,7 @@ private SynchronizerConfiguration buildSyncConfig() {
return unstableSynchronizerOptions
.toDomainObject()
.syncMode(syncMode)
.fastSyncMinimumPeerCount(fastSyncMinPeerCount)
.fastSyncMinimumPeerCount(syncMinPeerCount)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public interface DefaultCommandValues {
NatMethod DEFAULT_NAT_METHOD = NatMethod.AUTO;
/** The constant DEFAULT_JWT_ALGORITHM. */
JwtAlgorithm DEFAULT_JWT_ALGORITHM = JwtAlgorithm.RS256;
/** The constant FAST_SYNC_MIN_PEER_COUNT. */
int FAST_SYNC_MIN_PEER_COUNT = 5;
/** The constant SYNC_MIN_PEER_COUNT. */
int SYNC_MIN_PEER_COUNT = 5;
/** The constant DEFAULT_MAX_PEERS. */
int DEFAULT_MAX_PEERS = 25;
/** The constant DEFAULT_P2P_PEER_LOWER_BOUND. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ static void printUsageForColumnFamily(
final RocksDB rocksdb, final ColumnFamilyHandle cfHandle, final PrintWriter out)
throws RocksDBException, NumberFormatException {
final String size = rocksdb.getProperty(cfHandle, "rocksdb.estimate-live-data-size");
final String numberOfKeys = rocksdb.getProperty(cfHandle, "rocksdb.estimate-num-keys");
boolean emptyColumnFamily = false;
if (!size.isEmpty() && !size.isBlank()) {
if (!size.isBlank() && !numberOfKeys.isBlank()) {
try {
final long sizeLong = Long.parseLong(size);
final long numberOfKeysLong = Long.parseLong(numberOfKeys);
final String totalSstFilesSize =
rocksdb.getProperty(cfHandle, "rocksdb.total-sst-files-size");
final long totalSstFilesSizeLong =
!totalSstFilesSize.isEmpty() && !totalSstFilesSize.isBlank()
? Long.parseLong(totalSstFilesSize)
: 0;
if (sizeLong == 0) {
!totalSstFilesSize.isBlank() ? Long.parseLong(totalSstFilesSize) : 0;
if (sizeLong == 0 && numberOfKeysLong == 0) {
emptyColumnFamily = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
description = "This command provides storage related actions.",
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class,
subcommands = {StorageSubCommand.RevertVariablesStorage.class, RocksDbSubCommand.class})
subcommands = {
StorageSubCommand.RevertVariablesStorage.class,
RocksDbSubCommand.class,
TrieLogSubCommand.class
})
public class StorageSubCommand implements Runnable {

/** The constant COMMAND_NAME. */
Expand Down
Loading

0 comments on commit 6d9c8b1

Please sign in to comment.