fix GoQuorum privacy (#2184)

* fix goQuorum privacy

Signed-off-by: Stefan Pingel <stefan.pingel@consensys.net>
pull/2196/head
Stefan Pingel 4 years ago committed by GitHub
parent efe845b4b1
commit 8267f90fdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      container-tests/tests/src/test/java/org/hyperledger/besu/tests/container/ContainerTestBase.java
  2. 4
      enclave/src/integration-test/java/org/hyperledger/besu/enclave/GoQuorumEnclaveTest.java
  3. 16
      enclave/src/main/java/org/hyperledger/besu/enclave/GoQuorumEnclave.java

@ -44,7 +44,7 @@ import org.web3j.quorum.Quorum;
public class ContainerTestBase {
private final String besuImage = System.getProperty("containertest.imagename");
private final String goQuorumVersion = "21.1.0";
private final String tesseraVersion = "21.1.0";
private final String tesseraVersion = "21.1.1";
protected final String goQuorumTesseraPubKey = "3XGBIf+x8IdVQOVfIsbRnHwTYOJP/Fx84G8gMmy8qDM=";
protected final String besuTesseraPubKey = "8JJLEAbq6o9m4Kqm++v0Y1n9Z2ryAFtZTyhnxSKWgws=";

@ -60,7 +60,7 @@ public class GoQuorumEnclaveTest {
@Test
public void receiveThrowsWhenPayloadDoesNotExist() {
when(vertxTransmitter.get(any(), any(), ArgumentMatchers.contains("/receive"), any()))
when(vertxTransmitter.get(any(), any(), ArgumentMatchers.contains("/transaction"), any()))
.thenThrow(
new EnclaveClientException(404, "Message with hash " + MOCK_KEY + " was not found"));
@ -72,7 +72,7 @@ public class GoQuorumEnclaveTest {
@Test
public void sendAndReceive() {
when(vertxTransmitter.post(any(), any(), any(), any())).thenReturn(new SendResponse(KEY));
when(vertxTransmitter.get(any(), any(), ArgumentMatchers.contains("/receive"), any()))
when(vertxTransmitter.get(any(), any(), ArgumentMatchers.contains("/transaction"), any()))
.thenReturn(new GoQuorumReceiveResponse(PAYLOAD, 0, null, null));
final List<String> publicKeys = Arrays.asList("/+UuD63zItL1EbjxkKUljMgG8Z1w0AJ8pNOR4iq2yQc=");

@ -19,11 +19,11 @@ import org.hyperledger.besu.enclave.types.GoQuorumReceiveResponse;
import org.hyperledger.besu.enclave.types.GoQuorumSendRequest;
import org.hyperledger.besu.enclave.types.GoQuorumSendSignedRequest;
import org.hyperledger.besu.enclave.types.GoQuorumStoreRawRequest;
import org.hyperledger.besu.enclave.types.ReceiveRequest;
import org.hyperledger.besu.enclave.types.SendResponse;
import org.hyperledger.besu.enclave.types.StoreRawResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
@ -81,11 +81,9 @@ public class GoQuorumEnclave {
}
public GoQuorumReceiveResponse receive(final String payloadKey) {
final ReceiveRequest request = new ReceiveRequest(payloadKey);
return get(
JSON,
request,
"/receive",
"/transaction/" + URLEncoder.encode(payloadKey, StandardCharsets.UTF_8),
(statusCode, body) ->
handleJsonResponse(statusCode, body, GoQuorumReceiveResponse.class, 200));
}
@ -107,17 +105,9 @@ public class GoQuorumEnclave {
private <T> T get(
final String mediaType,
final Object content,
final String endpoint,
final ResponseBodyHandler<T> responseBodyHandler) {
final String bodyText;
try {
bodyText = objectMapper.writeValueAsString(content);
} catch (final JsonProcessingException e) {
throw new EnclaveClientException(400, "Unable to serialize request.");
}
final T t = requestTransmitter.get(mediaType, bodyText, endpoint, responseBodyHandler);
final T t = requestTransmitter.get(mediaType, null, endpoint, responseBodyHandler);
return t;
}

Loading…
Cancel
Save