Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Nischal Sharma <[email protected]>
  • Loading branch information
NickSneo committed Mar 21, 2024
1 parent c34a8cb commit 1c39643
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.web3j.crypto.TransactionEncoder;
import org.web3j.protocol.besu.response.privacy.PrivateTransactionReceipt;
import org.web3j.protocol.besu.response.privacy.PrivateTransactionWithPrivacyGroup;
import org.web3j.protocol.core.methods.response.EthSendTransaction;
import org.web3j.protocol.eea.crypto.PrivateTransactionEncoder;
import org.web3j.protocol.eea.crypto.RawPrivateTransaction;
import org.web3j.protocol.http.HttpService;
Expand Down Expand Up @@ -86,7 +87,7 @@ public static void setUpOnce() throws InterruptedException, IOException {

int blockNumber = 0;
do {
TimeUnit.MINUTES.sleep(1);
TimeUnit.SECONDS.sleep(30);
blockNumber = rpcNode.ethBlockNumber().send().getBlockNumber().intValue();
} while (blockNumber <= 100);
}
Expand All @@ -113,14 +114,11 @@ public void testConnection() throws IOException {
public void simplePrivateTransactions() throws Exception {

// Build new privacy group using the create API
final Base64String privacyGroupId =
nodeBob.privCreatePrivacyGroup(
Arrays.asList(
ENCLAVE_KEY_ALICE, ENCLAVE_KEY_BOB, ENCLAVE_KEY_CHARLIE),
"AliceBobCharlie",
"AliceBobCharlie group")
.send()
.getPrivacyGroupId();
Base64String privacyGroupId;
do {
privacyGroupId = getPrivacyGroupId();
TimeUnit.SECONDS.sleep(30);
} while (privacyGroupId == null);

final BigInteger nonce =
nodeCharlie
Expand All @@ -142,9 +140,13 @@ public void simplePrivateTransactions() throws Exception {
PrivateTransactionEncoder.signMessage(
rawPrivateTransaction, CHAIN_ID, ALICE));

final String transactionHash =
nodeAlice.eeaSendRawTransaction(signedTransactionData).send().getTransactionHash();
EthSendTransaction eeaTransaction;
do {
eeaTransaction = nodeAlice.eeaSendRawTransaction(signedTransactionData).send();
TimeUnit.SECONDS.sleep(30);
} while (eeaTransaction.hasError());

final String transactionHash = eeaTransaction.getTransactionHash();
final PollingPrivateTransactionReceiptProcessor receiptProcessor =
new PollingPrivateTransactionReceiptProcessor(nodeAlice, 1 * 1000, 120);
final PrivateTransactionReceipt receipt =
Expand Down Expand Up @@ -304,6 +306,15 @@ public void privacyGroupContract() throws Exception {
testBalances(tokenAlice, tokenBob, BigInteger.ZERO, BigInteger.TEN);
}

public Base64String getPrivacyGroupId() throws IOException {
return nodeBob.privCreatePrivacyGroup(
Arrays.asList(ENCLAVE_KEY_ALICE, ENCLAVE_KEY_BOB, ENCLAVE_KEY_CHARLIE),
"AliceBobCharlie",
"AliceBobCharlie group")
.send()
.getPrivacyGroupId();
}

private void testBalances(
final HumanStandardToken tokenAlice,
final HumanStandardToken tokenBob,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file defines environment variables defaults for Docker-compose
# but we also use it for shell scripts as a sourced file

BESU_VERSION=23.7.2
BESU_VERSION=23.10.3
QUORUM_VERSION=23.4.0
TESSERA_VERSION=23.4.0
ETHSIGNER_VERSION=22.1.3
Expand Down

0 comments on commit 1c39643

Please sign in to comment.