Skip to content

Commit

Permalink
Re-enable integration tests (hyperledger#4871)
Browse files Browse the repository at this point in the history
When Integration tests were migrated to JUnit 5 the gradle configuration was not added.
Fix various tests that had broken in the meantime:
 - NPEs when EnclaveEncryptorType was introduced
 - Account for new future nonce restrictions in the txpool

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
  • Loading branch information
2 people authored and macfarla committed Jan 10, 2023
1 parent 8441f0c commit 0bfc714
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ subprojects {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
useJUnitPlatform {}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.hyperledger.besu.enclave.types.PrivacyGroup;
import org.hyperledger.besu.enclave.types.ReceiveResponse;
import org.hyperledger.besu.enclave.types.SendResponse;
import org.hyperledger.enclave.testutil.EnclaveEncryptorType;
import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration;
import org.hyperledger.enclave.testutil.TesseraTestHarness;
import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory;
Expand All @@ -47,11 +48,11 @@ public class EnclaveTest {

private static final String PAYLOAD = "a wonderful transaction";
private static final String MOCK_KEY = "iOCzoGo5kwtZU0J41Z9xnGXHN6ZNukIa9MspvHtu3Jk=";
private static Enclave enclave;
private Enclave enclave;
private Vertx vertx;
private EnclaveFactory factory;

private static TesseraTestHarness testHarness;
private TesseraTestHarness testHarness;

@BeforeEach
public void setUp() throws Exception {
Expand All @@ -62,7 +63,10 @@ public void setUp() throws Exception {
TesseraTestHarnessFactory.create(
"enclave",
Files.createTempDirectory(folder, "enclave"),
new EnclaveKeyConfiguration("enclave_key_0.pub", "enclave_key_0.key"),
new EnclaveKeyConfiguration(
new String[] {"enclave_key_0.pub"},
new String[] {"enclave_key_0.key"},
EnclaveEncryptorType.NOOP),
Optional.empty());

testHarness.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private Transaction createTransaction(final int transactionNumber) {
.type(TransactionType.FRONTIER)
.gasLimit(100)
.gasPrice(Wei.ZERO)
.nonce(1)
.nonce(0)
.payload(Bytes.EMPTY)
.to(Address.ID)
.value(Wei.of(transactionNumber))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.hyperledger.besu.ethereum.privacy.storage.PrivateStateStorage;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPOutput;
import org.hyperledger.besu.plugin.data.Restriction;
import org.hyperledger.enclave.testutil.EnclaveEncryptorType;
import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration;
import org.hyperledger.enclave.testutil.TesseraTestHarness;
import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory;
Expand Down Expand Up @@ -127,7 +128,10 @@ public void setUp() throws Exception {
TesseraTestHarnessFactory.create(
"enclave",
Files.createTempDirectory(folder, "enclave"),
new EnclaveKeyConfiguration("enclave_key_0.pub", "enclave_key_0.key"),
new EnclaveKeyConfiguration(
new String[] {"enclave_key_0.pub"},
new String[] {"enclave_key_0.key"},
EnclaveEncryptorType.NOOP),
Optional.empty());

testHarness.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private Transaction createTransaction(final int transactionNumber) {
.type(TransactionType.FRONTIER)
.gasLimit(100)
.gasPrice(Wei.ZERO)
.nonce(1)
.nonce(0)
.payload(Bytes.EMPTY)
.to(Address.ID)
.value(Wei.of(transactionNumber))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.hyperledger.besu.evm.precompile.PrecompiledContract;
import org.hyperledger.besu.evm.tracing.OperationTracer;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
import org.hyperledger.enclave.testutil.EnclaveEncryptorType;
import org.hyperledger.enclave.testutil.EnclaveKeyConfiguration;
import org.hyperledger.enclave.testutil.TesseraTestHarness;
import org.hyperledger.enclave.testutil.TesseraTestHarnessFactory;
Expand Down Expand Up @@ -123,7 +124,10 @@ public static void setUpOnce() throws Exception {
TesseraTestHarnessFactory.create(
"enclave",
Files.createTempDirectory(folder, "enclave"),
new EnclaveKeyConfiguration("enclave_key_0.pub", "enclave_key_1.key"),
new EnclaveKeyConfiguration(
new String[] {"enclave_key_0.pub"},
new String[] {"enclave_key_1.key"},
EnclaveEncryptorType.NOOP),
Optional.empty());

testHarness.start();
Expand Down

0 comments on commit 0bfc714

Please sign in to comment.