Skip to content

Commit

Permalink
Merge branch 'main' into flat-db-heal-default
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarla authored Jan 31, 2024
2 parents 6ba162c + 1537e96 commit 3618a6f
Show file tree
Hide file tree
Showing 56 changed files with 328 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivateCondition;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions;

Expand Down Expand Up @@ -112,4 +113,8 @@ public Condition multiTenancyValidationFail(
final Transaction<?> transaction, final RpcErrorType error) {
return new ExpectJsonRpcError(transaction, error);
}

public PrivateCondition syncingStatus(final boolean isSyncing) {
return new PrivateSyncingStatusCondition(transactions.syncing(), isSyncing);
}
}
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.priv;

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

import org.hyperledger.besu.tests.acceptance.dsl.WaitUtils;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivateCondition;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivSyncingTransactions;

public class PrivateSyncingStatusCondition implements PrivateCondition {

private final PrivSyncingTransactions transaction;
private final boolean syncingMiningStatus;

public PrivateSyncingStatusCondition(
final PrivSyncingTransactions transaction, final boolean syncingStatus) {
this.transaction = transaction;
this.syncingMiningStatus = syncingStatus;
}

@Override
public void verify(final PrivacyNode node) {
WaitUtils.waitFor(
10, () -> assertThat(node.execute(transaction)).isEqualTo(syncingMiningStatus));
}
}
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.privacy;

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 PrivSyncingTransactions implements Transaction<Boolean> {

PrivSyncingTransactions() {}

@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 @@ -62,4 +62,8 @@ public PrivGetEeaTransactionCountTransaction getEeaTransactionCount(
public PrivGetTransactionReceiptTransaction getTransactionReceipt(final Hash transactionHash) {
return new PrivGetTransactionReceiptTransaction(transactionHash);
}

public PrivSyncingTransactions syncing() {
return new PrivSyncingTransactions();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public void setUp() throws Exception {
charlie = createNode(containerNetwork, "node3", 2);

privacyCluster.start(alice, bob, charlie);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
}

private PrivacyNode createNode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public DeployPrivateSmartContractAcceptanceTest(
restriction == UNRESTRICTED);

privacyCluster.start(minerNode);
minerNode.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ public EnclaveErrorAcceptanceTest(
"0xBB");
privacyCluster.start(alice, bob);

alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));

final byte[] wrongPublicKeyBytes =
EnclaveEncryptorType.EC.equals(enclaveEncryptorType)
? getSECP256r1PublicKeyByteArray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public void setUp() throws Exception {
enclaveType,
Optional.of(containerNetwork));
privacyCluster.start(alice, bob, charlie);

alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public void setup() throws IOException {
Optional.empty());

privacyCluster.start(minerNode);

minerNode.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public PrivCallAcceptanceTest(
restriction == UNRESTRICTED);

privacyCluster.start(minerNode);
minerNode.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public void setUp() throws IOException, URISyntaxException {
Optional.of(containerNetwork));

privacyCluster.start(aliceNode, bobNode);

aliceNode.verify(priv.syncingStatus(false));
bobNode.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public PrivDebugGetStateRootOffchainGroupAcceptanceTest(
"0xBB");

privacyCluster.start(aliceNode, bobNode);

aliceNode.verify(priv.syncingStatus(false));
bobNode.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public PrivGetCodeAcceptanceTest(
restriction == UNRESTRICTED);

privacyCluster.start(alice);
alice.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public PrivGetLogsAcceptanceTest(
restriction == UNRESTRICTED);

privacyCluster.start(node);
node.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public PrivGetPrivateTransactionAcceptanceTest(
"0xBB");

privacyCluster.start(alice, bob);

alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ public PrivacyClusterAcceptanceTest(
false,
false);
privacyCluster.start(alice, bob, charlie);

alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public PrivacyGroupAcceptanceTest(
false,
false);
privacyCluster.start(alice, bob, charlie);

alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public PrivacyReceiptAcceptanceTest(
restriction == UNRESTRICTED,
"0xAA");
privacyCluster.start(alice);

alice.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public PrivateContractPublicStateAcceptanceTest(
restriction == UNRESTRICTED);

privacyCluster.start(minerNode, transactionNode);

minerNode.verify(priv.syncingStatus(false));
transactionNode.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public PrivateGenesisAcceptanceTest(
"AA");

privacyCluster.start(alice);
alice.verify(priv.syncingStatus(false));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public PrivateLogFilterAcceptanceTest(
restriction == UNRESTRICTED);

privacyCluster.start(node);
node.verify(priv.syncingStatus(false));
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ public Runner build() {
.timestampForks(besuController.getGenesisConfigOptions().getForkBlockTimestamps())
.allConnectionsSupplier(ethPeers::getAllConnections)
.allActiveConnectionsSupplier(ethPeers::getAllActiveConnections)
.peersLowerBound(ethPeers.getPeerLowerBound())
.maxPeers(ethPeers.getMaxPeers())
.build();
};

Expand Down
2 changes: 0 additions & 2 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,6 @@ static class MetricsOptionGroup {

@Option(
names = {"--pruning-blocks-retained"},
defaultValue = "1024",
paramLabel = "<INTEGER>",
description =
"Minimum number of recent blocks for which to keep entire world state (default: ${DEFAULT-VALUE})",
Expand All @@ -847,7 +846,6 @@ static class MetricsOptionGroup {

@Option(
names = {"--pruning-block-confirmations"},
defaultValue = "10",
paramLabel = "<INTEGER>",
description =
"Minimum number of confirmations on a block before marking begins (default: ${DEFAULT-VALUE})",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public static EvmOptions create() {
"size in kilobytes to allow the cache "
+ "of valid jump destinations to grow to before evicting the least recently used entry",
fallbackValue = "32000",
defaultValue = "32000",
hidden = true,
arity = "1")
private Long jumpDestCacheWeightKilobytes =
Expand All @@ -57,7 +56,6 @@ public static EvmOptions create() {
names = {WORLDSTATE_UPDATE_MODE},
description = "How to handle worldstate updates within a transaction",
fallbackValue = "STACKED",
defaultValue = "STACKED",
hidden = true,
arity = "1")
private EvmConfiguration.WorldUpdaterMode worldstateUpdateMode =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class MetricsCLIOptions implements CLIOptions<MetricsConfiguration.Builde
@CommandLine.Option(
names = TIMERS_ENABLED_FLAG,
hidden = true,
defaultValue = "true",
description = "Whether to enable timer metrics (default: ${DEFAULT-VALUE}).")
private Boolean timersEnabled = MetricsConfiguration.DEFAULT_METRICS_TIMERS_ENABLED;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public class NetworkingOptions implements CLIOptions<NetworkingConfiguration> {
@CommandLine.Option(
names = INITIATE_CONNECTIONS_FREQUENCY_FLAG,
hidden = true,
defaultValue = "30",
paramLabel = "<INTEGER>",
description =
"The frequency (in seconds) at which to initiate new outgoing connections (default: ${DEFAULT-VALUE})")
Expand All @@ -52,7 +51,6 @@ public class NetworkingOptions implements CLIOptions<NetworkingConfiguration> {
@CommandLine.Option(
names = CHECK_MAINTAINED_CONNECTIONS_FREQUENCY_FLAG,
hidden = true,
defaultValue = "60",
paramLabel = "<INTEGER>",
description =
"The frequency (in seconds) at which to check maintained connections (default: ${DEFAULT-VALUE})")
Expand All @@ -69,14 +67,12 @@ public class NetworkingOptions implements CLIOptions<NetworkingConfiguration> {
@CommandLine.Option(
names = DISCOVERY_PROTOCOL_V5_ENABLED,
hidden = true,
defaultValue = "false",
description = "Whether to enable P2P Discovery Protocol v5 (default: ${DEFAULT-VALUE})")
private final Boolean isPeerDiscoveryV5Enabled = false;

@CommandLine.Option(
names = FILTER_ON_ENR_FORK_ID,
hidden = true,
defaultValue = "true",
description = "Whether to enable filtering of peers based on the ENR field ForkId)")
private final Boolean filterOnEnrForkId = NetworkingConfiguration.DEFAULT_FILTER_ON_ENR_FORK_ID;

Expand Down
Loading

0 comments on commit 3618a6f

Please sign in to comment.