Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-3111] Renames eea_getTransactionReceipt to priv_getTransactionReceipt #1927

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
import org.web3j.protocol.pantheon.Pantheon;
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 @@ -13,15 +13,15 @@
package tech.pegasys.pantheon.tests.acceptance.dsl.privacy.transaction;

import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.PrivacyNode;
import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.condition.EeaGetTransactionReceiptTransaction;
import tech.pegasys.pantheon.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 @@ -97,7 +97,6 @@
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning.PermRemoveNodesFromWhitelist;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.eea.EeaGetTransactionCount;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.eea.EeaGetTransactionReceipt;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.eea.EeaPrivateNonceProvider;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.eea.EeaSendRawTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv.PrivCreatePrivacyGroup;
Expand All @@ -106,6 +105,7 @@
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv.PrivGetPrivacyPrecompileAddress;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv.PrivGetPrivateTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv.PrivGetTransactionCount;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv.PrivGetTransactionReceipt;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.processor.BlockReplay;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.processor.BlockTracer;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.processor.TransactionTracer;
Expand Down Expand Up @@ -363,7 +363,7 @@ blockchainQueries, new TransactionTracer(blockReplay), parameter),
if (eea) {
addMethods(
enabledMethods,
new EeaGetTransactionReceipt(blockchainQueries, enclave, parameter, privacyParameters),
new PrivGetTransactionReceipt(blockchainQueries, enclave, parameter, privacyParameters),
new EeaSendRawTransaction(privateTransactionHandler, transactionPool, parameter),
new EeaGetTransactionCount(
parameter, new EeaPrivateNonceProvider(enclave, privateTransactionHandler)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,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 @@ -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.ethereum.jsonrpc.internal.privacy.methods.eea;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv;

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

Expand Down Expand Up @@ -48,7 +48,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 @@ -57,7 +57,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 @@ -70,12 +70,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 @@ -36,6 +36,7 @@
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.privacy.methods.priv.PrivGetTransactionReceipt;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.results.privacy.PrivateTransactionReceiptResult;
Expand All @@ -57,7 +58,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 @@ -161,13 +162,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 @@ -179,14 +180,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 @@ -197,13 +198,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 @@ -212,13 +213,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);
}
}