diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java index a9a165c68b..2bbf04534d 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java @@ -19,6 +19,7 @@ import org.hyperledger.besu.datatypes.Hash; 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; @@ -112,4 +113,8 @@ public class PrivConditions { final Transaction transaction, final RpcErrorType error) { return new ExpectJsonRpcError(transaction, error); } + + public PrivateCondition syncingStatus(final boolean isSyncing) { + return new PrivateSyncingStatusCondition(transactions.syncing(), isSyncing); + } } diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java new file mode 100644 index 0000000000..c80683e2c5 --- /dev/null +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java @@ -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)); + } +} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java new file mode 100644 index 0000000000..dc36a8dca5 --- /dev/null +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java @@ -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 { + + 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); + } + } +} diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java index 89a06e8b73..db51fc2742 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java @@ -62,4 +62,8 @@ public class PrivacyTransactions { public PrivGetTransactionReceiptTransaction getTransactionReceipt(final Hash transactionHash) { return new PrivGetTransactionReceiptTransaction(transactionHash); } + + public PrivSyncingTransactions syncing() { + return new PrivSyncingTransactions(); + } } diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/BftPrivacyClusterAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/BftPrivacyClusterAcceptanceTest.java index 2baf1d1f5c..4475627fd1 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/BftPrivacyClusterAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/BftPrivacyClusterAcceptanceTest.java @@ -111,6 +111,9 @@ public class BftPrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase { 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( diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/DeployPrivateSmartContractAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/DeployPrivateSmartContractAcceptanceTest.java index 71aa618cdd..65786988c9 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/DeployPrivateSmartContractAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/DeployPrivateSmartContractAcceptanceTest.java @@ -51,6 +51,7 @@ public class DeployPrivateSmartContractAcceptanceTest extends ParameterizedEncla restriction == UNRESTRICTED); privacyCluster.start(minerNode); + minerNode.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/EnclaveErrorAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/EnclaveErrorAcceptanceTest.java index 266284a498..3eab2b7243 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/EnclaveErrorAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/EnclaveErrorAcceptanceTest.java @@ -94,6 +94,9 @@ public class EnclaveErrorAcceptanceTest extends PrivacyAcceptanceTestBase { "0xBB"); privacyCluster.start(alice, bob); + alice.verify(priv.syncingStatus(false)); + bob.verify(priv.syncingStatus(false)); + final byte[] wrongPublicKeyBytes = EnclaveEncryptorType.EC.equals(enclaveEncryptorType) ? getSECP256r1PublicKeyByteArray() diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/FlexiblePrivacyAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/FlexiblePrivacyAcceptanceTest.java index 3f32904ba7..fb0a128b86 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/FlexiblePrivacyAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/FlexiblePrivacyAcceptanceTest.java @@ -111,6 +111,10 @@ public class FlexiblePrivacyAcceptanceTest extends FlexiblePrivacyAcceptanceTest 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 diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PluginPrivacySigningAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PluginPrivacySigningAcceptanceTest.java index 68d5117fd6..330f00554d 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PluginPrivacySigningAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PluginPrivacySigningAcceptanceTest.java @@ -93,6 +93,8 @@ public class PluginPrivacySigningAcceptanceTest extends PrivacyAcceptanceTestBas Optional.empty()); privacyCluster.start(minerNode); + + minerNode.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivCallAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivCallAcceptanceTest.java index bb5e829dc5..9d8a325903 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivCallAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivCallAcceptanceTest.java @@ -76,6 +76,7 @@ public class PrivCallAcceptanceTest extends ParameterizedEnclaveTestBase { restriction == UNRESTRICTED); privacyCluster.start(minerNode); + minerNode.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootFlexibleGroupAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootFlexibleGroupAcceptanceTest.java index 59973fd00b..b2e0d92dd7 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootFlexibleGroupAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootFlexibleGroupAcceptanceTest.java @@ -76,6 +76,9 @@ public class PrivDebugGetStateRootFlexibleGroupAcceptanceTest Optional.of(containerNetwork)); privacyCluster.start(aliceNode, bobNode); + + aliceNode.verify(priv.syncingStatus(false)); + bobNode.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootOffchainGroupAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootOffchainGroupAcceptanceTest.java index 92643446dd..6921da147e 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootOffchainGroupAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootOffchainGroupAcceptanceTest.java @@ -72,6 +72,9 @@ public class PrivDebugGetStateRootOffchainGroupAcceptanceTest extends Parameteri "0xBB"); privacyCluster.start(aliceNode, bobNode); + + aliceNode.verify(priv.syncingStatus(false)); + bobNode.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetCodeAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetCodeAcceptanceTest.java index c08006f694..6ca47035dc 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetCodeAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetCodeAcceptanceTest.java @@ -55,6 +55,7 @@ public class PrivGetCodeAcceptanceTest extends ParameterizedEnclaveTestBase { restriction == UNRESTRICTED); privacyCluster.start(alice); + alice.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetLogsAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetLogsAcceptanceTest.java index 62519385a2..7ebdcea826 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetLogsAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetLogsAcceptanceTest.java @@ -65,6 +65,7 @@ public class PrivGetLogsAcceptanceTest extends ParameterizedEnclaveTestBase { restriction == UNRESTRICTED); privacyCluster.start(node); + node.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetPrivateTransactionAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetPrivateTransactionAcceptanceTest.java index 91896761d0..59c5b8f71f 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetPrivateTransactionAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetPrivateTransactionAcceptanceTest.java @@ -75,6 +75,9 @@ public class PrivGetPrivateTransactionAcceptanceTest extends ParameterizedEnclav "0xBB"); privacyCluster.start(alice, bob); + + alice.verify(priv.syncingStatus(false)); + bob.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyClusterAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyClusterAcceptanceTest.java index 1284daf917..419286f168 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyClusterAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyClusterAcceptanceTest.java @@ -108,6 +108,10 @@ public class PrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase { false, false); privacyCluster.start(alice, bob, charlie); + + alice.verify(priv.syncingStatus(false)); + bob.verify(priv.syncingStatus(false)); + charlie.verify(priv.syncingStatus(false)); } @After diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyGroupAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyGroupAcceptanceTest.java index a1739b1fc8..ea94bb293a 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyGroupAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyGroupAcceptanceTest.java @@ -94,6 +94,10 @@ public class PrivacyGroupAcceptanceTest extends PrivacyAcceptanceTestBase { false, false); privacyCluster.start(alice, bob, charlie); + + alice.verify(priv.syncingStatus(false)); + bob.verify(priv.syncingStatus(false)); + charlie.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyReceiptAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyReceiptAcceptanceTest.java index 0b45d29732..56e2b04a36 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyReceiptAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyReceiptAcceptanceTest.java @@ -61,6 +61,8 @@ public class PrivacyReceiptAcceptanceTest extends ParameterizedEnclaveTestBase { restriction == UNRESTRICTED, "0xAA"); privacyCluster.start(alice); + + alice.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateContractPublicStateAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateContractPublicStateAcceptanceTest.java index 83a7ce66d8..c0a63446ba 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateContractPublicStateAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateContractPublicStateAcceptanceTest.java @@ -75,6 +75,9 @@ public class PrivateContractPublicStateAcceptanceTest extends ParameterizedEncla restriction == UNRESTRICTED); privacyCluster.start(minerNode, transactionNode); + + minerNode.verify(priv.syncingStatus(false)); + transactionNode.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateGenesisAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateGenesisAcceptanceTest.java index 29d5b655e3..82267f8b52 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateGenesisAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateGenesisAcceptanceTest.java @@ -60,6 +60,7 @@ public class PrivateGenesisAcceptanceTest extends ParameterizedEnclaveTestBase { "AA"); privacyCluster.start(alice); + alice.verify(priv.syncingStatus(false)); } @Test diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateLogFilterAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateLogFilterAcceptanceTest.java index a6837f9546..e9307beda9 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateLogFilterAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateLogFilterAcceptanceTest.java @@ -60,6 +60,7 @@ public class PrivateLogFilterAcceptanceTest extends ParameterizedEnclaveTestBase restriction == UNRESTRICTED); privacyCluster.start(node); + node.verify(priv.syncingStatus(false)); } @Test