[PRIV] Generify orion to enclave (#745)

* Generify orion to enclave

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Vinicius Stevam 6 years ago committed by Sally MacFarlane
parent ad7c5fb54f
commit cd818814ff
  1. 0
      enclave/build.gradle
  2. 24
      enclave/src/integration-test/java/tech/pegasys/pantheon/enclave/EnclaveTest.java
  3. 24
      enclave/src/main/java/tech/pegasys/pantheon/enclave/Enclave.java
  4. 2
      enclave/src/main/java/tech/pegasys/pantheon/enclave/types/ReceiveRequest.java
  5. 2
      enclave/src/main/java/tech/pegasys/pantheon/enclave/types/ReceiveResponse.java
  6. 2
      enclave/src/main/java/tech/pegasys/pantheon/enclave/types/SendRequest.java
  7. 2
      enclave/src/main/java/tech/pegasys/pantheon/enclave/types/SendResponse.java
  8. 2
      ethereum/core/build.gradle
  9. 17
      ethereum/core/src/integration-test/java/tech/pegasys/pantheon/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContractIntegrationTest.java
  10. 6
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/PrivacyParameters.java
  11. 24
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContract.java
  12. 16
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/privacy/PrivateTransactionHandler.java
  13. 26
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/mainnet/precompiles/privacy/PrivacyPrecompiledContractTest.java
  14. 27
      ethereum/core/src/test/java/tech/pegasys/pantheon/ethereum/privacy/PrivateTransactionHandlerTest.java
  15. 2
      pantheon/build.gradle
  16. 6
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  17. 24
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
  18. 2
      settings.gradle

@ -10,17 +10,17 @@
* 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.
*/
package tech.pegasys.pantheon.orion;
package tech.pegasys.pantheon.enclave;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import tech.pegasys.orion.testutil.OrionTestHarness;
import tech.pegasys.pantheon.orion.types.ReceiveRequest;
import tech.pegasys.pantheon.orion.types.ReceiveResponse;
import tech.pegasys.pantheon.orion.types.SendRequest;
import tech.pegasys.pantheon.orion.types.SendResponse;
import tech.pegasys.pantheon.enclave.types.ReceiveRequest;
import tech.pegasys.pantheon.enclave.types.ReceiveResponse;
import tech.pegasys.pantheon.enclave.types.SendRequest;
import tech.pegasys.pantheon.enclave.types.SendResponse;
import java.io.IOException;
import java.util.List;
@ -32,12 +32,12 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
public class OrionTest {
public class EnclaveTest {
@ClassRule public static final TemporaryFolder folder = new TemporaryFolder();
private static final String PAYLOAD = "a wonderful transaction";
private static Orion orion;
private static Enclave enclave;
private static OrionTestHarness testHarness;
@ -47,7 +47,7 @@ public class OrionTest {
testHarness = OrionTestHarness.create(folder.newFolder().toPath());
orion = new Orion(testHarness.clientUrl());
enclave = new Enclave(testHarness.clientUrl());
}
@AfterClass
@ -57,7 +57,7 @@ public class OrionTest {
@Test
public void testUpCheck() throws IOException {
assertTrue(orion.upCheck());
assertTrue(enclave.upCheck());
}
@Test
@ -66,17 +66,17 @@ public class OrionTest {
SendRequest sc =
new SendRequest(PAYLOAD, publicKeys.get(0), Lists.newArrayList(publicKeys.get(1)));
SendResponse sr = orion.send(sc);
SendResponse sr = enclave.send(sc);
ReceiveRequest rc = new ReceiveRequest(sr.getKey(), publicKeys.get(1));
ReceiveResponse rr = orion.receive(rc);
ReceiveResponse rr = enclave.receive(rc);
assertEquals(PAYLOAD, new String(rr.getPayload(), UTF_8));
}
@Test(expected = IOException.class)
public void whenUpCheckFailsThrows() throws IOException {
Orion broken = new Orion("http:");
Enclave broken = new Enclave("http:");
broken.upCheck();
}

@ -10,12 +10,12 @@
* 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.
*/
package tech.pegasys.pantheon.orion;
package tech.pegasys.pantheon.enclave;
import tech.pegasys.pantheon.orion.types.ReceiveRequest;
import tech.pegasys.pantheon.orion.types.ReceiveResponse;
import tech.pegasys.pantheon.orion.types.SendRequest;
import tech.pegasys.pantheon.orion.types.SendResponse;
import tech.pegasys.pantheon.enclave.types.ReceiveRequest;
import tech.pegasys.pantheon.enclave.types.ReceiveResponse;
import tech.pegasys.pantheon.enclave.types.SendRequest;
import tech.pegasys.pantheon.enclave.types.SendResponse;
import java.io.IOException;
@ -28,7 +28,7 @@ import okhttp3.Response;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class Orion {
public class Enclave {
private static final MediaType JSON = MediaType.parse("application/json");
private static final ObjectMapper objectMapper = new ObjectMapper();
private static final Logger LOG = LogManager.getLogger();
@ -36,12 +36,8 @@ public class Orion {
private String url;
private final OkHttpClient client;
public Orion() {
this.client = new OkHttpClient();
}
public Orion(final String orionUrl) {
this.url = orionUrl;
public Enclave(final String enclaveUrl) {
this.url = enclaveUrl;
this.client = new OkHttpClient();
}
@ -51,7 +47,7 @@ public class Orion {
try (Response response = client.newCall(request).execute()) {
return response.isSuccessful();
} catch (IOException e) {
LOG.error("Orion failed to execute upcheck");
LOG.error("Enclave failed to execute upcheck");
throw new IOException("Failed to perform upcheck", e);
}
}
@ -74,7 +70,7 @@ public class Orion {
try (Response response = client.newCall(request).execute()) {
return objectMapper.readValue(response.body().string(), responseType);
} catch (IOException e) {
LOG.error("Orion failed to execute ", path);
LOG.error("Enclave failed to execute ", path);
throw new IOException("Failed to execute post", e);
}
}

@ -10,7 +10,7 @@
* 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.
*/
package tech.pegasys.pantheon.orion.types;
package tech.pegasys.pantheon.enclave.types;
public class ReceiveRequest {
private String key;

@ -10,7 +10,7 @@
* 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.
*/
package tech.pegasys.pantheon.orion.types;
package tech.pegasys.pantheon.enclave.types;
public class ReceiveResponse {

@ -10,7 +10,7 @@
* 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.
*/
package tech.pegasys.pantheon.orion.types;
package tech.pegasys.pantheon.enclave.types;
import static java.nio.charset.StandardCharsets.UTF_8;

@ -10,7 +10,7 @@
* 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.
*/
package tech.pegasys.pantheon.orion.types;
package tech.pegasys.pantheon.enclave.types;
public class SendResponse {
String key;

@ -32,7 +32,7 @@ dependencies {
implementation project(':ethereum:trie')
implementation project(':ethereum:permissioning')
implementation project(':metrics')
implementation project(':orion')
implementation project(':enclave')
implementation project(':services:kvstore')
implementation 'com.fasterxml.jackson.core:jackson-databind'

@ -17,10 +17,10 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import tech.pegasys.orion.testutil.OrionTestHarness;
import tech.pegasys.pantheon.enclave.Enclave;
import tech.pegasys.pantheon.enclave.types.SendRequest;
import tech.pegasys.pantheon.enclave.types.SendResponse;
import tech.pegasys.pantheon.ethereum.mainnet.SpuriousDragonGasCalculator;
import tech.pegasys.pantheon.orion.Orion;
import tech.pegasys.pantheon.orion.types.SendRequest;
import tech.pegasys.pantheon.orion.types.SendResponse;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.IOException;
@ -38,7 +38,7 @@ public class PrivacyPrecompiledContractIntegrationTest {
@ClassRule public static final TemporaryFolder folder = new TemporaryFolder();
private static final String PAYLOAD = "a wonderful transaction";
private static Orion orion;
private static Enclave enclave;
private static OrionTestHarness testHarness;
@ -48,7 +48,7 @@ public class PrivacyPrecompiledContractIntegrationTest {
testHarness = OrionTestHarness.create(folder.newFolder().toPath());
orion = new Orion(testHarness.clientUrl());
enclave = new Enclave(testHarness.clientUrl());
}
@AfterClass
@ -58,7 +58,7 @@ public class PrivacyPrecompiledContractIntegrationTest {
@Test
public void testUpCheck() throws IOException {
assertTrue(orion.upCheck());
assertTrue(enclave.upCheck());
}
@Test
@ -67,10 +67,11 @@ public class PrivacyPrecompiledContractIntegrationTest {
SendRequest sc =
new SendRequest(PAYLOAD, publicKeys.get(0), Lists.newArrayList(publicKeys.get(1)));
SendResponse sr = orion.send(sc);
SendResponse sr = enclave.send(sc);
PrivacyPrecompiledContract privacyPrecompiledContract =
new PrivacyPrecompiledContract(new SpuriousDragonGasCalculator(), publicKeys.get(0), orion);
new PrivacyPrecompiledContract(
new SpuriousDragonGasCalculator(), publicKeys.get(0), enclave);
BytesValue result =
privacyPrecompiledContract.compute(BytesValue.wrap(sr.getKey().getBytes(UTF_8)));

@ -21,8 +21,8 @@ import java.net.URI;
import com.google.common.io.Files;
public class PrivacyParameters {
private static final String ORION_URL = "http://localhost:8888";
public static final URI DEFAULT_ORION_URL = URI.create(ORION_URL);
private static final String ENCLAVE_URL = "http://localhost:8888";
public static final URI DEFAULT_ENCLAVE_URL = URI.create(ENCLAVE_URL);
private Integer privacyAddress;
private boolean enabled;
@ -40,7 +40,7 @@ public class PrivacyParameters {
public static PrivacyParameters noPrivacy() {
final PrivacyParameters config = new PrivacyParameters();
config.setEnabled(false);
config.setUrl(ORION_URL);
config.setUrl(ENCLAVE_URL);
config.setPrivacyAddress(Address.PRIVACY);
return config;
}

@ -14,13 +14,13 @@ package tech.pegasys.pantheon.ethereum.mainnet.precompiles.privacy;
import static java.nio.charset.StandardCharsets.UTF_8;
import tech.pegasys.pantheon.enclave.Enclave;
import tech.pegasys.pantheon.enclave.types.ReceiveRequest;
import tech.pegasys.pantheon.enclave.types.ReceiveResponse;
import tech.pegasys.pantheon.ethereum.core.Gas;
import tech.pegasys.pantheon.ethereum.core.PrivacyParameters;
import tech.pegasys.pantheon.ethereum.mainnet.AbstractPrecompiledContract;
import tech.pegasys.pantheon.ethereum.vm.GasCalculator;
import tech.pegasys.pantheon.orion.Orion;
import tech.pegasys.pantheon.orion.types.ReceiveRequest;
import tech.pegasys.pantheon.orion.types.ReceiveResponse;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.IOException;
@ -29,21 +29,21 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class PrivacyPrecompiledContract extends AbstractPrecompiledContract {
private final Orion orion;
private final String orionPublicKey;
private final Enclave enclave;
private final String enclavePublicKey;
private static final Logger LOG = LogManager.getLogger();
public PrivacyPrecompiledContract(
final GasCalculator gasCalculator, final PrivacyParameters privacyParameters) {
this(gasCalculator, privacyParameters.getPublicKey(), new Orion(privacyParameters.getUrl()));
this(gasCalculator, privacyParameters.getPublicKey(), new Enclave(privacyParameters.getUrl()));
}
PrivacyPrecompiledContract(
final GasCalculator gasCalculator, final String publicKey, final Orion orion) {
final GasCalculator gasCalculator, final String publicKey, final Enclave enclave) {
super("Privacy", gasCalculator);
this.orion = orion;
this.orionPublicKey = publicKey;
this.enclave = enclave;
this.enclavePublicKey = publicKey;
}
@Override
@ -55,13 +55,13 @@ public class PrivacyPrecompiledContract extends AbstractPrecompiledContract {
public BytesValue compute(final BytesValue input) {
try {
String key = new String(input.extractArray(), UTF_8);
ReceiveRequest receiveRequest = new ReceiveRequest(key, orionPublicKey);
ReceiveResponse receiveResponse = orion.receive(receiveRequest);
ReceiveRequest receiveRequest = new ReceiveRequest(key, enclavePublicKey);
ReceiveResponse receiveResponse = enclave.receive(receiveRequest);
LOG.info("Got the response as ", receiveResponse.getPayload());
return BytesValue.wrap(receiveResponse.getPayload());
// pass it to private tx processor
} catch (IOException e) {
LOG.fatal("Orion threw an unhandled exception.", e);
LOG.fatal("Enclave threw an unhandled exception.", e);
return BytesValue.EMPTY;
}
}

@ -12,13 +12,13 @@
*/
package tech.pegasys.pantheon.ethereum.privacy;
import tech.pegasys.pantheon.enclave.Enclave;
import tech.pegasys.pantheon.enclave.types.SendRequest;
import tech.pegasys.pantheon.enclave.types.SendResponse;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.core.PrivacyParameters;
import tech.pegasys.pantheon.ethereum.core.Transaction;
import tech.pegasys.pantheon.ethereum.rlp.BytesValueRLPOutput;
import tech.pegasys.pantheon.orion.Orion;
import tech.pegasys.pantheon.orion.types.SendRequest;
import tech.pegasys.pantheon.orion.types.SendResponse;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import tech.pegasys.pantheon.util.bytes.BytesValues;
@ -31,17 +31,17 @@ import java.util.stream.Collectors;
public class PrivateTransactionHandler {
private final Orion orion;
private final Enclave enclave;
private final Address privacyPrecompileAddress;
public PrivateTransactionHandler(final PrivacyParameters privacyParameters) {
this(
new Orion(privacyParameters.getUrl()),
new Enclave(privacyParameters.getUrl()),
Address.privacyPrecompiled(privacyParameters.getPrivacyAddress()));
}
public PrivateTransactionHandler(final Orion orion, final Address privacyPrecompileAddress) {
this.orion = orion;
public PrivateTransactionHandler(final Enclave enclave, final Address privacyPrecompileAddress) {
this.enclave = enclave;
this.privacyPrecompileAddress = privacyPrecompileAddress;
}
@ -49,7 +49,7 @@ public class PrivateTransactionHandler {
final SendRequest sendRequest = createSendRequest(privateTransaction);
final SendResponse sendResponse;
try {
sendResponse = orion.send(sendRequest);
sendResponse = enclave.send(sendRequest);
} catch (IOException e) {
throw e;
}

@ -18,10 +18,10 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import tech.pegasys.pantheon.enclave.Enclave;
import tech.pegasys.pantheon.enclave.types.ReceiveRequest;
import tech.pegasys.pantheon.enclave.types.ReceiveResponse;
import tech.pegasys.pantheon.ethereum.mainnet.SpuriousDragonGasCalculator;
import tech.pegasys.pantheon.orion.Orion;
import tech.pegasys.pantheon.orion.types.ReceiveRequest;
import tech.pegasys.pantheon.orion.types.ReceiveResponse;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.IOException;
@ -36,26 +36,26 @@ public class PrivacyPrecompiledContractTest {
private PrivacyPrecompiledContract privacyPrecompiledContract;
private PrivacyPrecompiledContract brokenPrivateTransactionHandler;
Orion mockOrion() throws IOException {
Orion mockOrion = mock(Orion.class);
Enclave mockEnclave() throws IOException {
Enclave mockEnclave = mock(Enclave.class);
ReceiveResponse response = new ReceiveResponse(actual.getBytes(UTF_8));
when(mockOrion.receive(any(ReceiveRequest.class))).thenReturn(response);
return mockOrion;
when(mockEnclave.receive(any(ReceiveRequest.class))).thenReturn(response);
return mockEnclave;
}
Orion brokenMockOrion() throws IOException {
Orion mockOrion = mock(Orion.class);
when(mockOrion.receive(any(ReceiveRequest.class))).thenThrow(IOException.class);
return mockOrion;
Enclave brokenMockEnclave() throws IOException {
Enclave mockEnclave = mock(Enclave.class);
when(mockEnclave.receive(any(ReceiveRequest.class))).thenThrow(IOException.class);
return mockEnclave;
}
@Before
public void setUp() throws IOException {
privacyPrecompiledContract =
new PrivacyPrecompiledContract(new SpuriousDragonGasCalculator(), publicKey, mockOrion());
new PrivacyPrecompiledContract(new SpuriousDragonGasCalculator(), publicKey, mockEnclave());
brokenPrivateTransactionHandler =
new PrivacyPrecompiledContract(
new SpuriousDragonGasCalculator(), publicKey, brokenMockOrion());
new SpuriousDragonGasCalculator(), publicKey, brokenMockEnclave());
}
@Test

@ -19,12 +19,12 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import tech.pegasys.pantheon.crypto.SECP256K1;
import tech.pegasys.pantheon.enclave.Enclave;
import tech.pegasys.pantheon.enclave.types.SendRequest;
import tech.pegasys.pantheon.enclave.types.SendResponse;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.core.Transaction;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.orion.Orion;
import tech.pegasys.pantheon.orion.types.SendRequest;
import tech.pegasys.pantheon.orion.types.SendResponse;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import java.io.IOException;
@ -90,25 +90,26 @@ public class PrivateTransactionHandlerTest {
Address.wrap(BytesValue.fromHexString("0x8411b12666f68ef74cace3615c9d5a377729d03f")),
1);
Orion mockOrion() throws IOException {
Orion mockOrion = mock(Orion.class);
Enclave mockEnclave() throws IOException {
Enclave mockEnclave = mock(Enclave.class);
SendResponse response = new SendResponse();
response.setKey(TRANSACTION_KEY);
when(mockOrion.send(any(SendRequest.class))).thenReturn(response);
return mockOrion;
when(mockEnclave.send(any(SendRequest.class))).thenReturn(response);
return mockEnclave;
}
Orion brokenMockOrion() throws IOException {
Orion mockOrion = mock(Orion.class);
when(mockOrion.send(any(SendRequest.class))).thenThrow(IOException.class);
return mockOrion;
Enclave brokenMockEnclave() throws IOException {
Enclave mockEnclave = mock(Enclave.class);
when(mockEnclave.send(any(SendRequest.class))).thenThrow(IOException.class);
return mockEnclave;
}
@Before
public void setUp() throws IOException {
privateTransactionHandler = new PrivateTransactionHandler(mockOrion(), Address.DEFAULT_PRIVACY);
privateTransactionHandler =
new PrivateTransactionHandler(mockEnclave(), Address.DEFAULT_PRIVACY);
brokenPrivateTransactionHandler =
new PrivateTransactionHandler(brokenMockOrion(), Address.DEFAULT_PRIVACY);
new PrivateTransactionHandler(brokenMockEnclave(), Address.DEFAULT_PRIVACY);
}
@Test

@ -40,7 +40,7 @@ dependencies {
implementation project(':ethereum:p2p')
implementation project(':ethereum:rlp')
implementation project(':metrics')
implementation project(':orion')
implementation project(':enclave')
implementation project(':services:kvstore')
implementation 'com.google.guava:guava'

@ -479,7 +479,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
names = {"--privacy-url"},
description = "The URL on which enclave is running "
)
private final URI privacyUrl = PrivacyParameters.DEFAULT_ORION_URL;
private final URI privacyUrl = PrivacyParameters.DEFAULT_ENCLAVE_URL;
@Option(
names = {"--privacy-public-key-file"},
@ -634,7 +634,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
.devMode(NetworkName.DEV.equals(getNetwork()))
.nodePrivateKeyFile(nodePrivateKeyFile())
.metricsSystem(metricsSystem)
.privacyParameters(orionConfiguration())
.privacyParameters(privacyParameters())
.build();
} catch (final InvalidConfigurationException e) {
throw new ExecutionException(new CommandLine(this), e.getMessage());
@ -750,7 +750,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable {
return Optional.of(permissioningConfiguration);
}
private PrivacyParameters orionConfiguration() throws IOException {
private PrivacyParameters privacyParameters() throws IOException {
CommandLineUtils.checkOptionDependencies(
logger,

@ -71,8 +71,8 @@ import picocli.CommandLine;
public class PantheonCommandTest extends CommandTestAbstract {
private final String ORION_URI = "http://1.2.3.4:5555";
private final String ORION_PUBLIC_KEY = "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=";
private final String ENCLAVE_URI = "http://1.2.3.4:5555";
private final String ENCLAVE_PUBLIC_KEY = "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=";
private final String VALID_NODE_ID =
"6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0";
static final String PERMISSIONING_CONFIG_TOML = "permissioning_config.toml";
@ -1822,24 +1822,24 @@ public class PantheonCommandTest extends CommandTestAbstract {
}
@Test
public void mustUseOrionUriAndOptions() throws IOException {
public void mustUseEnclaveUriAndOptions() throws IOException {
final URL configFile = Resources.getResource("orion_publickey.pub");
parseCommand(
"--privacy-enabled",
"--privacy-url",
ORION_URI,
ENCLAVE_URI,
"--privacy-public-key-file",
configFile.getPath());
final ArgumentCaptor<PrivacyParameters> orionArg =
final ArgumentCaptor<PrivacyParameters> enclaveArg =
ArgumentCaptor.forClass(PrivacyParameters.class);
verify(mockControllerBuilder).privacyParameters(orionArg.capture());
verify(mockControllerBuilder).privacyParameters(enclaveArg.capture());
verify(mockControllerBuilder).build();
assertThat(orionArg.getValue().getUrl()).isEqualTo(ORION_URI);
assertThat(orionArg.getValue().getPublicKey()).isEqualTo(ORION_PUBLIC_KEY);
assertThat(enclaveArg.getValue().getUrl()).isEqualTo(ENCLAVE_URI);
assertThat(enclaveArg.getValue().getPublicKey()).isEqualTo(ENCLAVE_PUBLIC_KEY);
assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
@ -1852,7 +1852,7 @@ public class PantheonCommandTest extends CommandTestAbstract {
parseCommand(
"--privacy-url",
ORION_URI,
ENCLAVE_URI,
"--privacy-public-key-file",
file.getPath(),
"--privacy-precompiled-address",
@ -1870,15 +1870,15 @@ public class PantheonCommandTest extends CommandTestAbstract {
public void mustVerifyPrivacyIsDisabled() throws IOException {
parseCommand();
final ArgumentCaptor<PrivacyParameters> orionArg =
final ArgumentCaptor<PrivacyParameters> enclaveArg =
ArgumentCaptor.forClass(PrivacyParameters.class);
verify(mockControllerBuilder).privacyParameters(orionArg.capture());
verify(mockControllerBuilder).privacyParameters(enclaveArg.capture());
verify(mockControllerBuilder).build();
assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
assertThat(orionArg.getValue().isEnabled()).isEqualTo(false);
assertThat(enclaveArg.getValue().isEnabled()).isEqualTo(false);
}
private Path createFakeGenesisFile(final JsonObject jsonGenesis) throws IOException {

@ -20,6 +20,7 @@ include 'consensus:common'
include 'consensus:ibft'
include 'consensus:ibftlegacy'
include 'crypto'
include 'enclave'
include 'errorprone-checks'
include 'ethereum:blockcreation'
include 'ethereum:core'
@ -32,7 +33,6 @@ include 'ethereum:referencetests'
include 'ethereum:rlp'
include 'ethereum:trie'
include 'metrics'
include 'orion'
include 'pantheon'
include 'services:kvstore'
include 'services:queue'

Loading…
Cancel
Save