Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 5544 - Tessera as internal process #5968

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
42ce446
add internal process
gtebrean Sep 28, 2023
71f4b14
modiffy call
gtebrean Sep 28, 2023
0041c67
spotless
gtebrean Sep 28, 2023
0d5ddf5
fixes
gtebrean Sep 28, 2023
4a7dd7f
remove network container
gtebrean Sep 29, 2023
b184bea
fix integration tests
gtebrean Oct 2, 2023
cf5cb7e
fix build
gtebrean Oct 2, 2023
abef889
fix spotless
gtebrean Oct 10, 2023
2d05db8
change ports
gtebrean Oct 20, 2023
9e33f4c
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Dec 27, 2023
3361d6e
fix tessera process
gtebrean Jan 9, 2024
b5b95fb
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jan 9, 2024
fca3334
apply spotless
gtebrean Jan 9, 2024
ff39fa4
fix build
gtebrean Jan 9, 2024
fc8f498
spotless
gtebrean Jan 9, 2024
502cf71
spotless
gtebrean Jan 9, 2024
ba2c727
spotless
gtebrean Jan 9, 2024
556eb24
fix build
gtebrean Jan 9, 2024
6aec6c0
update changelog
gtebrean Jan 9, 2024
cd8df40
remove container class TesseraTestHarness
gtebrean Jan 9, 2024
8a18e05
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jan 9, 2024
6aa9fcd
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jan 10, 2024
b5ce971
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jan 10, 2024
32fa65d
reinstate privacy ATs
macfarla Jan 11, 2024
bfc64f1
merge
macfarla Jan 11, 2024
2f69a4d
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jan 11, 2024
d351fbe
fix unzipTessera
gtebrean Jan 12, 2024
b7f8f49
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jan 15, 2024
dd905fe
merge
macfarla Jan 16, 2024
7b859e7
Merge branch 'main' of github.com:hyperledger/besu into tessera_as_in…
macfarla Jan 16, 2024
d46dd58
don't need xl executor any more
macfarla Jan 16, 2024
c79959c
max workers
macfarla Jan 16, 2024
b749804
fixed version of external-resources
macfarla Jan 16, 2024
eb49317
parallelism
macfarla Jan 16, 2024
18d5f06
xl executor
macfarla Jan 16, 2024
46ea590
increase timeout
macfarla Jan 16, 2024
dd69777
revert changes to circle CI config
macfarla Jan 16, 2024
1e7fc6b
add sync condition for privacy tests
gtebrean Jan 16, 2024
8f767ba
merge
macfarla Feb 1, 2024
9fa3b59
add dependency
gtebrean Feb 21, 2024
892a658
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean May 29, 2024
726e14b
comment failing tests
gtebrean Jun 4, 2024
f5a2445
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jun 4, 2024
67ba2af
Merge remote-tracking branch 'upstream/main' into tessera_as_internal…
gtebrean Jun 5, 2024
5c4eb41
spotless
gtebrean Jun 5, 2024
a509b18
spotless
gtebrean Jun 5, 2024
25a6df6
update tessera version
gtebrean Jun 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ jobs:
- attach_workspace:
at: ~/project
- run:
name: AcceptanceTests (Non-Mainnet)
name: AcceptanceTests (Privacy)
no_output_timeout: 20m
command: |
CLASSNAMES=$(circleci tests glob "acceptance-tests/tests/src/test/java/**/*.java" \
Expand Down Expand Up @@ -407,7 +407,7 @@ workflows:
jobs:
- assemble
- unitTests:
requires:
requires:
- assemble
- testWindows:
requires:
Expand All @@ -428,6 +428,10 @@ workflows:
- acceptanceTestsPermissioning:
requires:
- assemble
- acceptanceTestsCliqueBft
- acceptanceTestsPrivacy:
requires:
- assemble
- buildDocker:
requires:
- assemble
Expand Down Expand Up @@ -500,3 +504,6 @@ workflows:
jobs:
- assemble
- dockerScan
- acceptanceTestsPrivacy:
requires:
- assemble
4 changes: 4 additions & 0 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
cache-disabled: true
- name: List unit tests
run: ./gradlew acceptanceTestNotPrivacy --test-dry-run -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: List privacy tests
run: ./gradlew acceptanceTestPrivacy --test-dry-run -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: Extract current test list
run: mkdir tmp; find . -type f -name TEST-*.xml | xargs -I{} bash -c "xmlstarlet sel -t -v '/testsuite/@name' '{}'; echo ' acceptanceTestNotPrivacy'" | tee tmp/currentTests.list
- name: Get acceptance test reports
Expand Down Expand Up @@ -78,6 +80,8 @@ jobs:
path: '*.txt'
- name: run acceptance tests
run: ./gradlew acceptanceTestNotPrivacy `cat gradleArgs.txt` -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: run acceptancePrivacy tests
run: ./gradlew acceptanceTestPrivacy `cat gradleArgs.txt` -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: Remove downloaded test results
run: rm -rf tmp/junit-xml-reports-downloaded
- name: Upload Acceptance Test Results
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Default bonsai to use full-flat db and code-storage-by-code-hash [#6984](https://github.com/hyperledger/besu/pull/6894)
- New RPC methods miner_setExtraData and miner_getExtraData [#7078](https://github.com/hyperledger/besu/pull/7078)
- Disconnect peers that have multiple discovery ports since they give us bad neighbours [#7089](https://github.com/hyperledger/besu/pull/7089)
- Optimize privacy acceptance tests by eliminating docker and executing them as a processes (thanks @gtebrean) [#5968](https://github.com/hyperledger/besu/pull/5968)
- Port Tuweni dns-discovery into Besu. [#7129](https://github.com/hyperledger/besu/pull/7129)

### Known Issues
Expand Down
4 changes: 4 additions & 0 deletions acceptance-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

dependencies {
tessera 'net.consensys.quorum.tessera:tessera-dist:24.4.1@tar'
}

jar { enabled = false }
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import io.vertx.core.Vertx;
import org.testcontainers.containers.Network;

public class PrivacyNodeFactory {

Expand All @@ -42,18 +40,15 @@ public PrivacyNodeFactory(final Vertx vertx) {
}

public PrivacyNode create(
final PrivacyNodeConfiguration privacyNodeConfig,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork)
final PrivacyNodeConfiguration privacyNodeConfig, final EnclaveType enclaveType)
throws IOException {
return new PrivacyNode(privacyNodeConfig, vertx, enclaveType, containerNetwork);
return new PrivacyNode(privacyNodeConfig, vertx, enclaveType);
}

public PrivacyNode createPrivateTransactionEnabledMinerNode(
final String name,
final PrivacyAccount privacyAccount,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork,
final boolean isFlexiblePrivacyGroupEnabled,
final boolean isMultitenancyEnabled,
final boolean isPrivacyPluginEnabled)
Expand All @@ -77,15 +72,13 @@ public PrivacyNode createPrivateTransactionEnabledMinerNode(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}

public PrivacyNode createPrivateTransactionEnabledNode(
final String name,
final PrivacyAccount privacyAccount,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork,
final boolean isFlexiblePrivacyGroupEnabled,
final boolean isMultitenancyEnabled,
final boolean isPrivacyPluginEnabled)
Expand All @@ -108,16 +101,14 @@ public PrivacyNode createPrivateTransactionEnabledNode(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}

public PrivacyNode createIbft2NodePrivacyEnabled(
final String name,
final PrivacyAccount privacyAccount,
final boolean minerEnabled,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork,
final boolean isFlexiblePrivacyGroupEnabled,
final boolean isMultitenancyEnabled,
final boolean isPrivacyPluginEnabled,
Expand Down Expand Up @@ -145,16 +136,14 @@ public PrivacyNode createIbft2NodePrivacyEnabled(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}

public PrivacyNode createIbft2NodePrivacyEnabledWithGenesis(
final String name,
final PrivacyAccount privacyAccount,
final boolean minerEnabled,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork,
final boolean isFlexiblePrivacyGroupEnabled,
final boolean isMultitenancyEnabled,
final boolean isPrivacyPluginEnabled,
Expand Down Expand Up @@ -184,15 +173,13 @@ public PrivacyNode createIbft2NodePrivacyEnabledWithGenesis(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}

public PrivacyNode createQbftNodePrivacyEnabled(
final String name,
final PrivacyAccount privacyAccount,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork,
final boolean isFlexiblePrivacyGroupEnabled,
final boolean isMultitenancyEnabled,
final boolean isPrivacyPluginEnabled,
Expand Down Expand Up @@ -220,16 +207,14 @@ public PrivacyNode createQbftNodePrivacyEnabled(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}

public PrivacyNode createFlexiblePrivacyGroupEnabledMinerNode(
final String name,
final PrivacyAccount privacyAccount,
final boolean multiTenancyEnabled,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork)
final EnclaveType enclaveType)
throws IOException, URISyntaxException {
final BesuNodeConfigurationBuilder besuNodeConfigurationBuilder =
new BesuNodeConfigurationBuilder();
Expand Down Expand Up @@ -259,16 +244,14 @@ public PrivacyNode createFlexiblePrivacyGroupEnabledMinerNode(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}

public PrivacyNode createFlexiblePrivacyGroupEnabledNode(
final String name,
final PrivacyAccount privacyAccount,
final boolean multiTenancyEnabled,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork)
final EnclaveType enclaveType)
throws IOException {
return create(
new PrivacyNodeConfiguration(
Expand All @@ -288,7 +271,6 @@ public PrivacyNode createFlexiblePrivacyGroupEnabledNode(
privacyAccount.getEnclaveKeyPaths(),
privacyAccount.getEnclavePrivateKeyPaths(),
privacyAccount.getEnclaveEncryptorType())),
enclaveType,
containerNetwork);
enclaveType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
import org.hyperledger.besu.tests.acceptance.dsl.condition.net.NetConditions;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNodeRunner;
import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode;
import org.hyperledger.enclave.testutil.EnclaveType;
import org.hyperledger.enclave.testutil.TesseraTestHarness;

import java.net.URI;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -154,24 +151,7 @@ private void startNode(final PrivacyNode node, final boolean isBootNode) {
.ifPresent(node.getConfiguration()::setGenesisConfig);

if (!isBootNode) {
if (bootNode.getEnclave().getEnclaveType() == EnclaveType.TESSERA) {
final URI otherNode = bootNode.getEnclave().nodeUrl();
try {
// Substitute IP with hostname for test container network
final URI otherNodeHostname =
new URI(
otherNode.getScheme()
+ "://"
+ bootNode.getName()
+ ":"
+ TesseraTestHarness.p2pPort);
node.addOtherEnclaveNode(otherNodeHostname);
} catch (Exception ex) {
throw new RuntimeException("Invalid node URI");
}
} else {
node.addOtherEnclaveNode(bootNode.getEnclave().nodeUrl());
}
node.addOtherEnclaveNode(bootNode.getEnclave().nodeUrl());
}

LOG.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.hyperledger.besu.ethereum.privacy.storage.PrivacyStorageProvider;
import org.hyperledger.besu.ethereum.privacy.storage.keyvalue.PrivacyKeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBKeyValuePrivacyStorageFactory;
import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBKeyValueStorageFactory;
Expand Down Expand Up @@ -64,7 +65,6 @@
import org.awaitility.Awaitility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.Network;

public class PrivacyNode implements AutoCloseable {

Expand All @@ -81,13 +81,11 @@ public class PrivacyNode implements AutoCloseable {
public PrivacyNode(
final PrivacyNodeConfiguration privacyConfiguration,
final Vertx vertx,
final EnclaveType enclaveType,
final Optional<Network> containerNetwork)
final EnclaveType enclaveType)
throws IOException {
final Path enclaveDir = Files.createTempDirectory("acctest-orion");
final BesuNodeConfiguration config = privacyConfiguration.getBesuConfig();
this.enclave =
selectEnclave(enclaveType, enclaveDir, config, privacyConfiguration, containerNetwork);
this.enclave = selectEnclave(enclaveType, enclaveDir, config, privacyConfiguration);
this.vertx = vertx;

this.besuConfig = config;
Expand Down Expand Up @@ -275,7 +273,7 @@ private PrivacyStorageProvider createKeyValueStorageProvider(
final Path dataLocation, final Path dbLocation) {
final var besuConfiguration = new BesuConfigurationImpl();
besuConfiguration
.init(dataLocation, dbLocation, null)
.init(dataLocation, dbLocation, DataStorageConfiguration.DEFAULT_FOREST_CONFIG)
.withMiningParameters(besuConfig.getMiningParameters());
return new PrivacyKeyValueStorageProviderBuilder()
.withStorageFactory(
Expand All @@ -298,15 +296,14 @@ private EnclaveTestHarness selectEnclave(
final EnclaveType enclaveType,
final Path tempDir,
final BesuNodeConfiguration config,
final PrivacyNodeConfiguration privacyConfiguration,
final Optional<Network> containerNetwork) {
final PrivacyNodeConfiguration privacyConfiguration) {

switch (enclaveType) {
case ORION:
throw new UnsupportedOperationException("The Orion tests are getting deprecated");
case TESSERA:
return TesseraTestHarnessFactory.create(
config.getName(), tempDir, privacyConfiguration.getKeyConfig(), containerNetwork);
config.getName(), tempDir, privacyConfiguration.getKeyConfig());
default:
return new NoopEnclaveTestHarness(tempDir, privacyConfiguration.getKeyConfig());
}
Expand Down
11 changes: 11 additions & 0 deletions acceptance-tests/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ plugins {
id 'org.web3j.solidity' version '0.4.1'
}

configurations {
tessera.extendsFrom integrationTestRuntimeOnly
}

web3j { generatedPackageName = 'org.hyperledger.besu.tests.web3j.generated' }

sourceSets.main.solidity.srcDirs = ["$projectDir/contracts"]
Expand Down Expand Up @@ -81,6 +85,7 @@ dependencies {
testImplementation 'org.wiremock:wiremock'

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
tessera 'net.consensys.quorum.tessera:tessera-dist:24.4.1@tar'
}

test.enabled = false
Expand Down Expand Up @@ -205,16 +210,21 @@ task acceptanceTestCliqueBft(type: Test) {
doFirst { mkdir "${buildDir}/jvmErrorLogs" }
}


def tesseraDist = '24.4.1'

task acceptanceTestPrivacy(type: Test) {
inputs.property "integration.date", LocalTime.now() // so it runs at every invocation
include '**/privacy/**'

useJUnitPlatform {}

dependsOn(rootProject.installDist)
dependsOn(unzipTessera)
setSystemProperties(test.getSystemProperties())
systemProperty 'acctests.runBesuAsProcess', 'true'
systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security"
systemProperty 'tessera-dist', "${buildDir}/tessera/dist/tessera-${tesseraDist}/bin/tessera"
mustRunAfter rootProject.subprojects*.test
description = 'Runs Privacy Besu acceptance tests.'
group = 'verification'
Expand All @@ -239,6 +249,7 @@ task acceptanceTestPermissioning(type: Test) {
useJUnitPlatform {}

dependsOn(rootProject.installDist)
dependsOn(unzipTessera)
setSystemProperties(test.getSystemProperties())
systemProperty 'acctests.runBesuAsProcess', 'true'
systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security"
Expand Down
Loading
Loading