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

[PAN-3111] Renames eea_getTransactionReceipt to priv_getTransactionReceipt #10

Merged
merged 9 commits into from
Sep 22, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions;

import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;

public class ExpectValidPrivateTransactionReceipt implements PrivateCondition {
private final PrivacyTransactions transactions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@

import java.io.IOException;

import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.exceptions.TransactionException;
import org.web3j.protocol.pantheon.Pantheon;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;
import org.web3j.tx.response.PollingPrivateTransactionReceiptProcessor;

public class EeaGetTransactionReceiptTransaction implements Transaction<PrivateTransactionReceipt> {
public class PrivGetTransactionReceiptTransaction
implements Transaction<PrivateTransactionReceipt> {

private final String transactionHash;

public EeaGetTransactionReceiptTransaction(final String transactionHash) {
public PrivGetTransactionReceiptTransaction(final String transactionHash) {
this.transactionHash = transactionHash;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions;

import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.pantheon.response.privacy.PrivacyGroup;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;

public class PrivateTransactionVerifier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
package org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction;

import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.EeaGetTransactionReceiptTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.PrivGetTransactionReceiptTransaction;

import java.util.List;

public class PrivacyTransactions {

public EeaGetTransactionReceiptTransaction getPrivateTransactionReceipt(
public PrivGetTransactionReceiptTransaction getPrivateTransactionReceipt(
final String transactionHash) {
return new EeaGetTransactionReceiptTransaction(transactionHash);
return new PrivGetTransactionReceiptTransaction(transactionHash);
}

public CreatePrivacyGroupTransaction createPrivacyGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.tuweni.crypto.sodium.Box;
import org.junit.Before;
import org.junit.Test;
import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;

public class EnclaveErrorAcceptanceTest extends PrivacyAcceptanceTestBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.pantheon.response.privacy.PrivacyGroup;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;
import org.web3j.utils.Base64String;

public class EthSignerAcceptanceTest extends PrivacyAcceptanceTestBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.junit.Before;
import org.junit.Test;
import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;

public class Ibft2PrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import org.junit.Before;
import org.junit.Test;
import org.web3j.protocol.eea.response.PrivateTransactionReceipt;
import org.web3j.protocol.pantheon.response.privacy.PrivateTransactionReceipt;

public class PrivacyClusterAcceptanceTest extends PrivacyAcceptanceTestBase {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.permissioning.PermRemoveNodesFromWhitelist;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonRpcParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.EeaGetTransactionCount;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.EeaGetTransactionReceipt;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.EeaPrivateNonceProvider;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.EeaSendRawTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivCreatePrivacyGroup;
Expand All @@ -101,6 +100,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivGetPrivacyPrecompileAddress;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivGetPrivateTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivGetTransactionCount;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivGetTransactionReceipt;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.BlockReplay;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.BlockTracer;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.processor.TransactionTracer;
Expand Down Expand Up @@ -365,14 +365,14 @@ blockchainQueries, new TransactionTracer(blockReplay), parameter),
if (eea) {
addMethods(
enabledMethods,
new EeaGetTransactionReceipt(blockchainQueries, enclave, parameter, privacyParameters),
new EeaSendRawTransaction(privateTransactionHandler, transactionPool, parameter),
new EeaGetTransactionCount(
parameter, new EeaPrivateNonceProvider(enclave, privateTransactionHandler)));
}
if (priv) {
addMethods(
enabledMethods,
new PrivGetTransactionReceipt(blockchainQueries, enclave, parameter, privacyParameters),
new PrivCreatePrivacyGroup(
new Enclave(privacyParameters.getEnclaveUri()), privacyParameters, parameter),
new PrivDeletePrivacyGroup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public enum RpcMethod {
PRIV_GET_PRIVATE_TRANSACTION("priv_getPrivateTransaction"),
PRIV_GET_TRANSACTION_COUNT("priv_getTransactionCount"),
PRIV_GET_PRIVACY_PRECOMPILE_ADDRESS("priv_getPrivacyPrecompileAddress"),
EEA_GET_TRANSACTION_RECEIPT("eea_getTransactionReceipt"),
PRIV_GET_TRANSACTION_RECEIPT("priv_getTransactionReceipt"),
PRIV_CREATE_PRIVACY_GROUP("priv_createPrivacyGroup"),
PRIV_DELETE_PRIVACY_GROUP("priv_deletePrivacyGroup"),
PRIV_FIND_PRIVACY_GROUP("priv_findPrivacyGroup"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea;
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv;

import static org.apache.logging.log4j.LogManager.getLogger;

Expand Down Expand Up @@ -50,7 +50,7 @@

import org.apache.logging.log4j.Logger;

public class EeaGetTransactionReceipt implements JsonRpcMethod {
public class PrivGetTransactionReceipt implements JsonRpcMethod {

private static final Logger LOG = getLogger();

Expand All @@ -59,7 +59,7 @@ public class EeaGetTransactionReceipt implements JsonRpcMethod {
private final JsonRpcParameter parameters;
private final PrivacyParameters privacyParameters;

public EeaGetTransactionReceipt(
public PrivGetTransactionReceipt(
final BlockchainQueries blockchain,
final Enclave enclave,
final JsonRpcParameter parameters,
Expand All @@ -72,12 +72,12 @@ public EeaGetTransactionReceipt(

@Override
public String getName() {
return RpcMethod.EEA_GET_TRANSACTION_RECEIPT.getMethodName();
return RpcMethod.PRIV_GET_TRANSACTION_RECEIPT.getMethodName();
}

@Override
public JsonRpcResponse response(final JsonRpcRequest request) {
LOG.trace("Executing {}", RpcMethod.EEA_GET_TRANSACTION_RECEIPT.getMethodName());
LOG.trace("Executing {}", RpcMethod.PRIV_GET_TRANSACTION_RECEIPT.getMethodName());
final Hash transactionHash = parameters.required(request.getParams(), 0, Hash.class);
final Optional<TransactionLocation> maybeLocation =
blockchain.getBlockchain().getTransactionLocation(transactionHash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea;
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
Expand Down Expand Up @@ -59,7 +59,7 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class EeaGetTransactionReceiptTest {
public class PrivGetTransactionReceiptTest {

@Rule public final TemporaryFolder temp = new TemporaryFolder();

Expand Down Expand Up @@ -163,13 +163,13 @@ public void setUp() {

@Test
public void returnReceiptIfTransactionExists() {
final EeaGetTransactionReceipt eeaGetTransactionReceipt =
new EeaGetTransactionReceipt(blockchainQueries, enclave, parameters, privacyParameters);
final PrivGetTransactionReceipt privGetTransactionReceipt =
new PrivGetTransactionReceipt(blockchainQueries, enclave, parameters, privacyParameters);
final Object[] params = new Object[] {transaction.hash()};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getTransactionReceipt", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getTransactionReceipt", params);

final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetTransactionReceipt.response(request);
(JsonRpcSuccessResponse) privGetTransactionReceipt.response(request);
final PrivateTransactionReceiptResult result =
(PrivateTransactionReceiptResult) response.getResult();

Expand All @@ -181,14 +181,14 @@ public void enclavePayloadNotFoundResultsInSuccessButNullResponse() {
when(failingEnclave.receive(any(ReceiveRequest.class)))
.thenThrow(new EnclaveException("EnclavePayloadNotFound"));

final EeaGetTransactionReceipt eeaGetTransactionReceipt =
new EeaGetTransactionReceipt(
final PrivGetTransactionReceipt privGetTransactionReceipt =
new PrivGetTransactionReceipt(
blockchainQueries, failingEnclave, parameters, privacyParameters);
final Object[] params = new Object[] {transaction.hash()};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getTransactionReceipt", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getTransactionReceipt", params);

final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetTransactionReceipt.response(request);
(JsonRpcSuccessResponse) privGetTransactionReceipt.response(request);
final PrivateTransactionReceiptResult result =
(PrivateTransactionReceiptResult) response.getResult();

Expand All @@ -199,13 +199,13 @@ public void enclavePayloadNotFoundResultsInSuccessButNullResponse() {
public void markerTransactionNotAvailableResultsInNullResponse() {
when(blockchain.getTransactionLocation(nullable(Hash.class))).thenReturn(Optional.empty());

final EeaGetTransactionReceipt eeaGetTransactionReceipt =
new EeaGetTransactionReceipt(blockchainQueries, enclave, parameters, privacyParameters);
final PrivGetTransactionReceipt privGetTransactionReceipt =
new PrivGetTransactionReceipt(blockchainQueries, enclave, parameters, privacyParameters);
final Object[] params = new Object[] {transaction.hash()};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getTransactionReceipt", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getTransactionReceipt", params);

final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetTransactionReceipt.response(request);
(JsonRpcSuccessResponse) privGetTransactionReceipt.response(request);
final PrivateTransactionReceiptResult result =
(PrivateTransactionReceiptResult) response.getResult();

Expand All @@ -214,13 +214,13 @@ public void markerTransactionNotAvailableResultsInNullResponse() {

@Test
public void enclaveConnectionIssueThrowsRuntimeException() {
final EeaGetTransactionReceipt eeaGetTransactionReceipt =
new EeaGetTransactionReceipt(
final PrivGetTransactionReceipt privGetTransactionReceipt =
new PrivGetTransactionReceipt(
blockchainQueries, failingEnclave, parameters, privacyParameters);
final Object[] params = new Object[] {transaction.hash()};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getTransactionReceipt", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getTransactionReceipt", params);

final Throwable t = catchThrowable(() -> eeaGetTransactionReceipt.response(request));
final Throwable t = catchThrowable(() -> privGetTransactionReceipt.response(request));
assertThat(t).isInstanceOf(RuntimeException.class);
}
}
8 changes: 4 additions & 4 deletions gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ dependencyManagement {

dependency 'org.springframework.security:spring-security-crypto:5.1.5.RELEASE'

dependency 'org.web3j:abi:4.5.0'
dependency 'org.web3j:core:4.5.0'
dependency 'org.web3j:crypto:4.5.0'
dependency 'org.web3j:pantheon:4.5.0'
dependency 'org.web3j:abi:4.5.1'
dependency 'org.web3j:core:4.5.1'
dependency 'org.web3j:crypto:4.5.1'
dependency 'org.web3j:pantheon:4.5.1'

dependency 'org.xerial.snappy:snappy-java:1.1.7.3'

Expand Down