add sync condition for privacy tests (#6479)

* add sync condition for privacy tests

Signed-off-by: George Tebrean <george@web3labs.com>

* headers

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

* revert configs

Signed-off-by: George Tebrean <george@web3labs.com>

---------

Signed-off-by: George Tebrean <george@web3labs.com>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
Co-authored-by: George Tebrean <george@web3labs.com>
pull/6504/head
Sally MacFarlane 10 months ago committed by GitHub
parent 497faef833
commit 1537e961ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivConditions.java
  2. 40
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/priv/PrivateSyncingStatusCondition.java
  3. 40
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivSyncingTransactions.java
  4. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyTransactions.java
  5. 3
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/BftPrivacyClusterAcceptanceTest.java
  6. 1
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/DeployPrivateSmartContractAcceptanceTest.java
  7. 3
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/EnclaveErrorAcceptanceTest.java
  8. 4
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/FlexiblePrivacyAcceptanceTest.java
  9. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PluginPrivacySigningAcceptanceTest.java
  10. 1
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivCallAcceptanceTest.java
  11. 3
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootFlexibleGroupAcceptanceTest.java
  12. 3
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootOffchainGroupAcceptanceTest.java
  13. 1
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetCodeAcceptanceTest.java
  14. 1
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetLogsAcceptanceTest.java
  15. 3
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivGetPrivateTransactionAcceptanceTest.java
  16. 4
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyClusterAcceptanceTest.java
  17. 4
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyGroupAcceptanceTest.java
  18. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivacyReceiptAcceptanceTest.java
  19. 3
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateContractPublicStateAcceptanceTest.java
  20. 1
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateGenesisAcceptanceTest.java
  21. 1
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivateLogFilterAcceptanceTest.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.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.privacy.PrivateTransaction; import org.hyperledger.besu.ethereum.privacy.PrivateTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.condition.Condition; 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.Transaction;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions; import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyTransactions;
@ -112,4 +113,8 @@ public class PrivConditions {
final Transaction<?> transaction, final RpcErrorType error) { final Transaction<?> transaction, final RpcErrorType error) {
return new ExpectJsonRpcError(transaction, error); return new ExpectJsonRpcError(transaction, error);
} }
public PrivateCondition syncingStatus(final boolean isSyncing) {
return new PrivateSyncingStatusCondition(transactions.syncing(), isSyncing);
}
} }

@ -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));
}
}

@ -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);
}
}
}

@ -62,4 +62,8 @@ public class PrivacyTransactions {
public PrivGetTransactionReceiptTransaction getTransactionReceipt(final Hash transactionHash) { public PrivGetTransactionReceiptTransaction getTransactionReceipt(final Hash transactionHash) {
return new PrivGetTransactionReceiptTransaction(transactionHash); return new PrivGetTransactionReceiptTransaction(transactionHash);
} }
public PrivSyncingTransactions syncing() {
return new PrivSyncingTransactions();
}
} }

@ -111,6 +111,9 @@ public class BftPrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase {
charlie = createNode(containerNetwork, "node3", 2); charlie = createNode(containerNetwork, "node3", 2);
privacyCluster.start(alice, bob, charlie); privacyCluster.start(alice, bob, charlie);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
} }
private PrivacyNode createNode( private PrivacyNode createNode(

@ -51,6 +51,7 @@ public class DeployPrivateSmartContractAcceptanceTest extends ParameterizedEncla
restriction == UNRESTRICTED); restriction == UNRESTRICTED);
privacyCluster.start(minerNode); privacyCluster.start(minerNode);
minerNode.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -94,6 +94,9 @@ public class EnclaveErrorAcceptanceTest extends PrivacyAcceptanceTestBase {
"0xBB"); "0xBB");
privacyCluster.start(alice, bob); privacyCluster.start(alice, bob);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
final byte[] wrongPublicKeyBytes = final byte[] wrongPublicKeyBytes =
EnclaveEncryptorType.EC.equals(enclaveEncryptorType) EnclaveEncryptorType.EC.equals(enclaveEncryptorType)
? getSECP256r1PublicKeyByteArray() ? getSECP256r1PublicKeyByteArray()

@ -111,6 +111,10 @@ public class FlexiblePrivacyAcceptanceTest extends FlexiblePrivacyAcceptanceTest
enclaveType, enclaveType,
Optional.of(containerNetwork)); Optional.of(containerNetwork));
privacyCluster.start(alice, bob, charlie); privacyCluster.start(alice, bob, charlie);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -93,6 +93,8 @@ public class PluginPrivacySigningAcceptanceTest extends PrivacyAcceptanceTestBas
Optional.empty()); Optional.empty());
privacyCluster.start(minerNode); privacyCluster.start(minerNode);
minerNode.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -76,6 +76,7 @@ public class PrivCallAcceptanceTest extends ParameterizedEnclaveTestBase {
restriction == UNRESTRICTED); restriction == UNRESTRICTED);
privacyCluster.start(minerNode); privacyCluster.start(minerNode);
minerNode.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -76,6 +76,9 @@ public class PrivDebugGetStateRootFlexibleGroupAcceptanceTest
Optional.of(containerNetwork)); Optional.of(containerNetwork));
privacyCluster.start(aliceNode, bobNode); privacyCluster.start(aliceNode, bobNode);
aliceNode.verify(priv.syncingStatus(false));
bobNode.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -72,6 +72,9 @@ public class PrivDebugGetStateRootOffchainGroupAcceptanceTest extends Parameteri
"0xBB"); "0xBB");
privacyCluster.start(aliceNode, bobNode); privacyCluster.start(aliceNode, bobNode);
aliceNode.verify(priv.syncingStatus(false));
bobNode.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -55,6 +55,7 @@ public class PrivGetCodeAcceptanceTest extends ParameterizedEnclaveTestBase {
restriction == UNRESTRICTED); restriction == UNRESTRICTED);
privacyCluster.start(alice); privacyCluster.start(alice);
alice.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -65,6 +65,7 @@ public class PrivGetLogsAcceptanceTest extends ParameterizedEnclaveTestBase {
restriction == UNRESTRICTED); restriction == UNRESTRICTED);
privacyCluster.start(node); privacyCluster.start(node);
node.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -75,6 +75,9 @@ public class PrivGetPrivateTransactionAcceptanceTest extends ParameterizedEnclav
"0xBB"); "0xBB");
privacyCluster.start(alice, bob); privacyCluster.start(alice, bob);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -108,6 +108,10 @@ public class PrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase {
false, false,
false); false);
privacyCluster.start(alice, bob, charlie); privacyCluster.start(alice, bob, charlie);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
} }
@After @After

@ -94,6 +94,10 @@ public class PrivacyGroupAcceptanceTest extends PrivacyAcceptanceTestBase {
false, false,
false); false);
privacyCluster.start(alice, bob, charlie); privacyCluster.start(alice, bob, charlie);
alice.verify(priv.syncingStatus(false));
bob.verify(priv.syncingStatus(false));
charlie.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -61,6 +61,8 @@ public class PrivacyReceiptAcceptanceTest extends ParameterizedEnclaveTestBase {
restriction == UNRESTRICTED, restriction == UNRESTRICTED,
"0xAA"); "0xAA");
privacyCluster.start(alice); privacyCluster.start(alice);
alice.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -75,6 +75,9 @@ public class PrivateContractPublicStateAcceptanceTest extends ParameterizedEncla
restriction == UNRESTRICTED); restriction == UNRESTRICTED);
privacyCluster.start(minerNode, transactionNode); privacyCluster.start(minerNode, transactionNode);
minerNode.verify(priv.syncingStatus(false));
transactionNode.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -60,6 +60,7 @@ public class PrivateGenesisAcceptanceTest extends ParameterizedEnclaveTestBase {
"AA"); "AA");
privacyCluster.start(alice); privacyCluster.start(alice);
alice.verify(priv.syncingStatus(false));
} }
@Test @Test

@ -60,6 +60,7 @@ public class PrivateLogFilterAcceptanceTest extends ParameterizedEnclaveTestBase
restriction == UNRESTRICTED); restriction == UNRESTRICTED);
privacyCluster.start(node); privacyCluster.start(node);
node.verify(priv.syncingStatus(false));
} }
@Test @Test

Loading…
Cancel
Save