[PAN-2943] Renames various eea methods to priv methods, with associated docs (#1736)

* Renames various eea methods to priv methods, with associated docs

* Restructures packages

* Adds priv commandline switch

* Refactors eea_getTransactionCount and eea_getPrivateTransaction to priv

* Changes package structure and fixes TODO

* Remove whitespace

* Update docs with new method names

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Josh Richardson 5 years ago committed by MadelineMurray
parent d31dc58a4d
commit d9f35948be
  1. 2
      CHANGELOG.md
  2. 1
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/configuration/PantheonFactoryConfigurationBuilder.java
  3. 4
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyNode.java
  4. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivateTransactions.java
  5. 4
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eea/EeaRequestFactory.java
  6. 6
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/eea/EeaTransactions.java
  7. 8
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/priv/PrivGetTransactionCountTransaction.java
  8. 2
      docs/Deploying-Pantheon/High-Availability.md
  9. 4
      docs/Privacy/How-To/Creating-Sending-Private-Transactions.md
  10. 31
      docs/Reference/Pantheon-API-Methods.md
  11. 2
      docs/Reference/Pantheon-API-Objects.md
  12. 12
      ethereum/jsonrpc/src/integration-test/java/tech/pegasys/pantheon/ethereum/jsonrpc/methods/PrivGetPrivateTransactionIntegrationTest.java
  13. 41
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcMethodsFactory.java
  14. 3
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcApis.java
  15. 12
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethod.java
  16. 2
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/EeaGetTransactionReceipt.java
  17. 2
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/EeaSendRawTransaction.java
  18. 10
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivCreatePrivacyGroup.java
  19. 10
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivDeletePrivacyGroup.java
  20. 10
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivFindPrivacyGroup.java
  21. 8
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddress.java
  22. 10
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivateTransaction.java
  23. 8
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetTransactionCount.java
  24. 9
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/EeaCreatePrivacyGroupTest.java
  25. 2
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/EeaGetTransactionReceiptTest.java
  26. 2
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/EeaSendRawTransactionTest.java
  27. 21
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/PrivGetPrivateTransactionTest.java
  28. 13
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/eea/PrivGetTransactionCountTest.java
  29. 20
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/priv/PrivGetPrivacyPrecompileAddressTest.java

@ -374,7 +374,7 @@ Documentation updates include:
### Technical Improvements
- eea_getTransactionCount fails if account has not interacted with private state [\#1369](https://github.com/PegaSysEng/pantheon/pull/1369)
- priv_getTransactionCount fails if account has not interacted with private state [\#1369](https://github.com/PegaSysEng/pantheon/pull/1369)
- Updating Orion to 0.9.0 [\#1360](https://github.com/PegaSysEng/pantheon/pull/1360)
- Allow use of large chain IDs [\#1357](https://github.com/PegaSysEng/pantheon/pull/1357)
- Allow private contract invocations in multiple privacy groups [\#1340](https://github.com/PegaSysEng/pantheon/pull/1340)

@ -87,6 +87,7 @@ public class PantheonFactoryConfigurationBuilder {
public PantheonFactoryConfigurationBuilder enablePrivateTransactions(
final PrivacyParameters privacyParameters) {
this.jsonRpcConfiguration.addRpcApi(RpcApis.EEA);
this.jsonRpcConfiguration.addRpcApi(RpcApis.PRIV);
this.privacyParameters = privacyParameters;
this.privacyParameters.setEnabled(true);
return this;

@ -28,7 +28,7 @@ import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration;
import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationProvider;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaGetTransactionCountTransaction;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.priv.PrivGetTransactionCountTransaction;
import tech.pegasys.pantheon.util.bytes.BytesValue;
import tech.pegasys.pantheon.util.bytes.BytesValues;
@ -115,7 +115,7 @@ public class PrivacyNode extends PantheonNode {
public long nextNonce(final BytesValue privacyGroupId) {
return execute(
new EeaGetTransactionCountTransaction(
new PrivGetTransactionCountTransaction(
getAddress().toString(), BytesValues.asBase64String(privacyGroupId)))
.longValue();
}

@ -12,8 +12,8 @@
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.privacy;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaGetTransactionCountTransaction;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaSendRawTransactionTransaction;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.priv.PrivGetTransactionCountTransaction;
public class PrivateTransactions {
@ -29,8 +29,8 @@ public class PrivateTransactions {
return new EeaSendRawTransactionTransaction(signedRawPrivateTransaction);
}
public EeaGetTransactionCountTransaction getTransactionCount(
public PrivGetTransactionCountTransaction getTransactionCount(
final String address, final String privacyGroupId) {
return new EeaGetTransactionCountTransaction(address, privacyGroupId);
return new PrivGetTransactionCountTransaction(address, privacyGroupId);
}
}

@ -100,10 +100,10 @@ public class EeaRequestFactory {
PrivateTransactionReceiptResponse.class);
}
Request<?, EthGetTransactionCount> eeaGetTransactionCount(
public Request<?, EthGetTransactionCount> privGetTransactionCount(
final String accountAddress, final String privacyGroupId) {
return new Request<>(
"eea_getTransactionCount",
"priv_getTransactionCount",
Lists.newArrayList(accountAddress, privacyGroupId),
web3jService,
EthGetTransactionCount.class);

@ -12,15 +12,17 @@
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.priv.PrivGetTransactionCountTransaction;
public class EeaTransactions {
public EeaGetTransactionReceiptTransaction getTransactionReceipt(final String transactionHash) {
return new EeaGetTransactionReceiptTransaction(transactionHash);
}
public EeaGetTransactionCountTransaction getTransactionCount(
public PrivGetTransactionCountTransaction getTransactionCount(
final String address, final String privacyGroupId) {
return new EeaGetTransactionCountTransaction(address, privacyGroupId);
return new PrivGetTransactionCountTransaction(address, privacyGroupId);
}
public EeaGetTransactionReceiptTransaction getPrivateTransactionReceipt(

@ -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.tests.acceptance.dsl.transaction.eea;
package tech.pegasys.pantheon.tests.acceptance.dsl.transaction.priv;
import static org.assertj.core.api.Assertions.assertThat;
@ -22,12 +22,12 @@ import java.math.BigInteger;
import org.web3j.protocol.core.methods.response.EthGetTransactionCount;
public class EeaGetTransactionCountTransaction implements Transaction<BigInteger> {
public class PrivGetTransactionCountTransaction implements Transaction<BigInteger> {
private final String accountAddress;
private String privacyGroupId;
public EeaGetTransactionCountTransaction(
public PrivGetTransactionCountTransaction(
final String accountAddress, final String privacyGroupId) {
this.accountAddress = accountAddress;
this.privacyGroupId = privacyGroupId;
@ -37,7 +37,7 @@ public class EeaGetTransactionCountTransaction implements Transaction<BigInteger
public BigInteger execute(final NodeRequests node) {
try {
EthGetTransactionCount result =
node.eea().eeaGetTransactionCount(accountAddress, privacyGroupId).send();
node.eea().privGetTransactionCount(accountAddress, privacyGroupId).send();
assertThat(result).isNotNull();
return result.getTransactionCount();
} catch (final IOException e) {

@ -29,7 +29,7 @@ are sent to multiple nodes, the [`eth_getTransactionCount`](../Reference/Pantheo
results can be incorrect.
!!! note
If using [private transactions](../Privacy/Explanation/Privacy-Overview.md), `eea_getTransactionCount` is used to obtain
If using [private transactions](../Privacy/Explanation/Privacy-Overview.md), `priv_getTransactionCount` is used to obtain
the account nonce and [`eea_sendRawTransaction`](../Reference/Pantheon-API-Methods.md#eea_sendrawtransaction)
to send private transactions.

@ -22,13 +22,13 @@ to get the transaction receipt for the private transaction.
Use [`eth_getTransactionByHash`](../../Reference/Pantheon-API-Methods.md#eth_gettransactionbyhash) to
get the Privacy Marker Transaction with the transaction hash returned when submitting the private transaction.
Use [`eea_getPrivateTransacton`](../../Reference/Pantheon-API-Methods.md#eea_getprivatetransaction)
Use [`priv_getPrivateTransaction`](../../Reference/Pantheon-API-Methods.md#priv_getprivatetransaction)
to get the private transaction with the `input` value from the Privacy Marker Transaction.
Separate private states are maintained for each [privacy group](../Explanation/Privacy-Overview.md#privacy-groups) so
the account nonce for an account is specific to the privacy group. That is, the nonce for account A for
privacy group ABC is different to the account nonce for account A for privacy group AB. Use
[`eea_getTransactionCount`](../../Reference/Pantheon-API-Methods.md#eea_gettransactioncount) to get
[`priv_getTransactionCount`](../../Reference/Pantheon-API-Methods.md#priv_getTransactionCount) to get
the account nonce for an account for the specified privacy group.
!!! note

@ -3771,7 +3771,8 @@ None
The `EEA` API methods are not enabled by default for JSON-RPC. Use the [`--rpc-http-api`](Pantheon-CLI-Syntax.md#rpc-http-api)
or [`--rpc-ws-api`](Pantheon-CLI-Syntax.md#rpc-ws-api) options to enable the `EEA` API methods.
### eea_getPrivateTransaction
### priv_getPrivateTransaction
Returns the private transaction if you are a participant; otherwise, null. To get the public transaction,
use [`eth_getTransactionByHash`](#eth_gettransactionbyhash) with the transaction hash returned by
@ -3788,11 +3789,11 @@ Object - [Private transaction object](Pantheon-API-Objects.md#private-transactio
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eea_getPrivateTransaction","params":["0xd2274e3da9ac7f7fcec531adeefdc205688e85544ccf515c4de73b0540c9b818"], "id":1}' http://127.0.0.1:8545
curl -X POST --data '{"jsonrpc":"2.0","method":"priv_getPrivateTransaction","params":["0xd2274e3da9ac7f7fcec531adeefdc205688e85544ccf515c4de73b0540c9b818"], "id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eea_getPrivateTransaction","params":["0xd2274e3da9ac7f7fcec531adeefdc205688e85544ccf515c4de73b0540c9b818"], "id":1}
{"jsonrpc":"2.0","method":"priv_getPrivateTransaction","params":["0xd2274e3da9ac7f7fcec531adeefdc205688e85544ccf515c4de73b0540c9b818"], "id":1}
```
```bash tab="json tab="JSON result"
@ -3821,7 +3822,7 @@ Object - [Private transaction object](Pantheon-API-Objects.md#private-transactio
```
### eea_createPrivacyGroup
### priv_createPrivacyGroup
Creates a privacy group containing the specified members. Members are specified by their Orion public key.
@ -3841,11 +3842,11 @@ Privacy group ID
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eea_createPrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "Group A", "Description Group A", ["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=","g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id":1}' http://127.0.0.1:8545
curl -X POST --data '{"jsonrpc":"2.0","method":"priv_createPrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "Group A", "Description Group A", ["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=","g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eea_createPrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "Group A", "Description Group A", ["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=","g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id":1}
{"jsonrpc":"2.0","method":"priv_createPrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "Group A", "Description Group A", ["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=","g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id":1}
```
```json tab="JSON result"
@ -3856,7 +3857,7 @@ Privacy group ID
}
```
### eea_deletePrivacyGroup
### priv_deletePrivacyGroup
Deletes the specified privacy group.
@ -3868,11 +3869,11 @@ Privacy group ID
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eea_deletePrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "ewuTVoc5nlvWMwTFdRRK/wvV0dcyQo/Pauvx5bNEbTk="],"id":1}' http://127.0.0.1:8545
curl -X POST --data '{"jsonrpc":"2.0","method":"priv_deletePrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "ewuTVoc5nlvWMwTFdRRK/wvV0dcyQo/Pauvx5bNEbTk="],"id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eea_deletePrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "ewuTVoc5nlvWMwTFdRRK/wvV0dcyQo/Pauvx5bNEbTk="],"id":1}
{"jsonrpc":"2.0","method":"priv_deletePrivacyGroup","params":["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "ewuTVoc5nlvWMwTFdRRK/wvV0dcyQo/Pauvx5bNEbTk="],"id":1}
```
```json tab="JSON result"
@ -3883,7 +3884,7 @@ Privacy group ID
}
```
### eea_findPrivacyGroup
### priv_findPrivacyGroup
Returns a list of privacy groups containing only the listed members. For example, if the listed members
are A and B, a privacy group containing A, B, and C is not returned.
@ -3898,11 +3899,11 @@ Privacy groups containing only the specified members.
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc": "2.0","method": "eea_findPrivacyGroup","params": [["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id": 1}' http://127.0.0.1:8545
curl -X POST --data '{"jsonrpc": "2.0","method": "priv_findPrivacyGroup","params": [["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id": 1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc": "2.0","method": "eea_findPrivacyGroup","params": [["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id": 1}
{"jsonrpc": "2.0","method": "priv_findPrivacyGroup","params": [["negmDcN2P4ODpqn/6WkJ02zT/0w0bjhGpkZ8UP6vARk=", "g59BmTeJIn7HIcnq8VQWgyh/pDbvbt2eyP0Ii60aDDw="]],"id": 1}
```
```json tab="JSON result"
@ -3921,7 +3922,7 @@ Privacy groups containing only the specified members.
}
```
### eea_getTransactionCount
### priv_getTransactionCount
Returns the private transaction count for specified account and privacy group.
@ -3941,11 +3942,11 @@ Returns the private transaction count for specified account and privacy group.
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eea_getTransactionCount","params":["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "kAbelwaVW7okoEn1+okO+AbA4Hhz/7DaCOWVQz9nx5M="], "id":1}' http://127.0.0.1:8545
curl -X POST --data '{"jsonrpc":"2.0","method":"priv_getTransactionCount","params":["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "kAbelwaVW7okoEn1+okO+AbA4Hhz/7DaCOWVQz9nx5M="], "id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eea_getTransactionCount","params":["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "kAbelwaVW7okoEn1+okO+AbA4Hhz/7DaCOWVQz9nx5M="], "id":1}
{"jsonrpc":"2.0","method":"priv_getTransactionCount","params":["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", "kAbelwaVW7okoEn1+okO+AbA4Hhz/7DaCOWVQz9nx5M="], "id":1}
```
```json tab="JSON result"

@ -67,7 +67,7 @@ Returned by [eth_getFilterChanges](Pantheon-API-Methods.md#eth_getfilterchanges)
## Private Transaction Object
Returned by [eea_getPrivateTransaction](Pantheon-API-Methods.md#eea_getprivatetransaction).
Returned by [priv_getPrivateTransaction](Pantheon-API-Methods.md#priv_getprivatetransaction).
| Key | Type | Value |
|----------------------|-:-:-------------------------------|---------------------------------------------------------------------------------|

@ -27,7 +27,7 @@ import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.core.PrivacyParameters;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaGetPrivateTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivGetPrivateTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.results.privacy.PrivateTransactionLegacyResult;
@ -48,7 +48,7 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
public class EeaGetPrivateTransactionIntegrationTest {
public class PrivGetPrivateTransactionIntegrationTest {
@ClassRule public static final TemporaryFolder folder = new TemporaryFolder();
@ -120,8 +120,8 @@ public class EeaGetPrivateTransactionIntegrationTest {
@Test
public void returnsStoredPrivateTransaction() throws Exception {
final EeaGetPrivateTransaction eeaGetPrivateTransaction =
new EeaGetPrivateTransaction(enclave, parameters, privacyParameters);
final PrivGetPrivateTransaction privGetPrivateTransaction =
new PrivGetPrivateTransaction(enclave, parameters, privacyParameters);
final BytesValueRLPOutput bvrlp = new BytesValueRLPOutput();
privateTransaction.writeTo(bvrlp);
@ -135,10 +135,10 @@ public class EeaGetPrivateTransactionIntegrationTest {
final String hexKey = BytesValues.fromBase64(sendResponse.getKey()).toString();
final Object[] params = new Object[] {hexKey};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getPrivateTransaction", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getPrivateTransaction", params);
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetPrivateTransaction.response(request);
(JsonRpcSuccessResponse) privGetPrivateTransaction.response(request);
final PrivateTransactionLegacyResult result =
(PrivateTransactionLegacyResult) response.getResult();

@ -90,14 +90,14 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning.Per
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning.PermReloadPermissionsFromFile;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning.PermRemoveAccountsFromWhitelist;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning.PermRemoveNodesFromWhitelist;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaCreatePrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaDeletePrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaFindPrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaGetPrivacyPrecompileAddress;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaGetPrivateTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaGetTransactionCount;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaGetTransactionReceipt;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.EeaSendRawTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea.EeaGetTransactionReceipt;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea.EeaSendRawTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivCreatePrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivDeletePrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivFindPrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivGetPrivacyPrecompileAddress;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivGetPrivateTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivGetTransactionCount;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.processor.BlockReplay;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.processor.BlockTracer;
@ -321,22 +321,31 @@ public class JsonRpcMethodsFactory {
new AdminPeers(p2pNetwork),
new AdminChangeLogLevel(parameter));
}
if (rpcApis.contains(RpcApis.EEA)) {
boolean eea = rpcApis.contains(RpcApis.EEA), priv = rpcApis.contains(RpcApis.PRIV);
if (eea || priv) {
final PrivateTransactionHandler privateTransactionHandler =
new PrivateTransactionHandler(privacyParameters, protocolSchedule.getChainId());
final Enclave enclave = new Enclave(privacyParameters.getEnclaveUri());
if (eea) {
addMethods(
enabledMethods,
new EeaGetTransactionReceipt(blockchainQueries, enclave, parameter, privacyParameters),
new EeaSendRawTransaction(
blockchainQueries, privateTransactionHandler, transactionPool, parameter),
new EeaGetTransactionCount(parameter, privateTransactionHandler),
new EeaGetPrivateTransaction(enclave, parameter, privacyParameters),
new EeaCreatePrivacyGroup(new Enclave(privacyParameters.getEnclaveUri()), parameter),
new EeaDeletePrivacyGroup(new Enclave(privacyParameters.getEnclaveUri()), parameter),
new EeaFindPrivacyGroup(new Enclave(privacyParameters.getEnclaveUri()), parameter),
new EeaGetPrivacyPrecompileAddress(privacyParameters));
blockchainQueries, privateTransactionHandler, transactionPool, parameter));
}
if (priv) {
addMethods(
enabledMethods,
new PrivCreatePrivacyGroup(new Enclave(privacyParameters.getEnclaveUri()), parameter),
new PrivDeletePrivacyGroup(new Enclave(privacyParameters.getEnclaveUri()), parameter),
new PrivFindPrivacyGroup(new Enclave(privacyParameters.getEnclaveUri()), parameter),
new PrivGetPrivacyPrecompileAddress(privacyParameters),
new PrivGetTransactionCount(parameter, privateTransactionHandler),
new PrivGetPrivateTransaction(enclave, parameter, privacyParameters));
}
}
return enabledMethods;
}

@ -26,6 +26,7 @@ public class RpcApis {
public static final RpcApi WEB3 = new RpcApi("WEB3");
public static final RpcApi ADMIN = new RpcApi("ADMIN");
public static final RpcApi EEA = new RpcApi("EEA");
public static final RpcApi PRIV = new RpcApi("PRIV");
public static final RpcApi TX_POOL = new RpcApi("TXPOOL");
public static final List<RpcApi> DEFAULT_JSON_RPC_APIS = Arrays.asList(ETH, NET, WEB3);
@ -47,6 +48,8 @@ public class RpcApis {
return Optional.of(ADMIN);
} else if (name.equals(EEA.getCliValue())) {
return Optional.of(EEA);
} else if (name.equals(PRIV.getCliValue())) {
return Optional.of(PRIV);
} else if (name.equals(TX_POOL.getCliValue())) {
return Optional.of(TX_POOL);
} else {

@ -33,13 +33,13 @@ public enum RpcMethod {
DEBUG_TRACE_BLOCK_BY_HASH("debug_traceBlockByHash"),
DEBUG_TRACE_BLOCK_BY_NUMBER("debug_traceBlockByNumber"),
DEBUG_TRACE_TRANSACTION("debug_traceTransaction"),
EEA_GET_PRIVATE_TRANSACTION("eea_getPrivateTransaction"),
EEA_GET_TRANSACTION_COUNT("eea_getTransactionCount"),
EEA_GET_PRIVACY_PRECOMPILE_ADDRESS("eea_getPrivacyPrecompileAddress"),
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"),
EEA_CREATE_PRIVACY_GROUP("eea_createPrivacyGroup"),
EEA_DELETE_PRIVACY_GROUP("eea_deletePrivacyGroup"),
EEA_FIND_PRIVACY_GROUP("eea_findPrivacyGroup"),
PRIV_CREATE_PRIVACY_GROUP("priv_createPrivacyGroup"),
PRIV_DELETE_PRIVACY_GROUP("priv_deletePrivacyGroup"),
PRIV_FIND_PRIVACY_GROUP("priv_findPrivacyGroup"),
EEA_SEND_RAW_TRANSACTION("eea_sendRawTransaction"),
ETH_ACCOUNTS("eth_accounts"),
ETH_BLOCK_NUMBER("eth_blockNumber"),

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static org.apache.logging.log4j.LogManager.getLogger;

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcEnclaveErrorConverter.convertEnclaveInvalidReason;
import static tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcErrorConverter.convertTransactionInvalidReason;

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import static org.apache.logging.log4j.LogManager.getLogger;
@ -27,25 +27,25 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessRe
import org.apache.logging.log4j.Logger;
public class EeaCreatePrivacyGroup implements JsonRpcMethod {
public class PrivCreatePrivacyGroup implements JsonRpcMethod {
private static final Logger LOG = getLogger();
private final Enclave enclave;
private final JsonRpcParameter parameters;
public EeaCreatePrivacyGroup(final Enclave enclave, final JsonRpcParameter parameters) {
public PrivCreatePrivacyGroup(final Enclave enclave, final JsonRpcParameter parameters) {
this.enclave = enclave;
this.parameters = parameters;
}
@Override
public String getName() {
return RpcMethod.EEA_CREATE_PRIVACY_GROUP.getMethodName();
return RpcMethod.PRIV_CREATE_PRIVACY_GROUP.getMethodName();
}
@Override
public JsonRpcResponse response(final JsonRpcRequest request) {
LOG.trace("Executing {}", RpcMethod.EEA_CREATE_PRIVACY_GROUP.getMethodName());
LOG.trace("Executing {}", RpcMethod.PRIV_CREATE_PRIVACY_GROUP.getMethodName());
final String from = parameters.required(request.getParams(), 0, String.class);
final String name = parameters.required(request.getParams(), 1, String.class);

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import static org.apache.logging.log4j.LogManager.getLogger;
@ -26,25 +26,25 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessRe
import org.apache.logging.log4j.Logger;
public class EeaDeletePrivacyGroup implements JsonRpcMethod {
public class PrivDeletePrivacyGroup implements JsonRpcMethod {
private static final Logger LOG = getLogger();
private final Enclave enclave;
private final JsonRpcParameter parameters;
public EeaDeletePrivacyGroup(final Enclave enclave, final JsonRpcParameter parameters) {
public PrivDeletePrivacyGroup(final Enclave enclave, final JsonRpcParameter parameters) {
this.enclave = enclave;
this.parameters = parameters;
}
@Override
public String getName() {
return RpcMethod.EEA_DELETE_PRIVACY_GROUP.getMethodName();
return RpcMethod.PRIV_DELETE_PRIVACY_GROUP.getMethodName();
}
@Override
public JsonRpcResponse response(final JsonRpcRequest request) {
LOG.trace("Executing {}", RpcMethod.EEA_DELETE_PRIVACY_GROUP.getMethodName());
LOG.trace("Executing {}", RpcMethod.PRIV_DELETE_PRIVACY_GROUP.getMethodName());
final String privacyGroupId = parameters.required(request.getParams(), 1, String.class);
final String from = parameters.required(request.getParams(), 0, String.class);

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import static org.apache.logging.log4j.LogManager.getLogger;
@ -29,25 +29,25 @@ import java.util.Arrays;
import org.apache.logging.log4j.Logger;
public class EeaFindPrivacyGroup implements JsonRpcMethod {
public class PrivFindPrivacyGroup implements JsonRpcMethod {
private static final Logger LOG = getLogger();
private final Enclave enclave;
private final JsonRpcParameter parameters;
public EeaFindPrivacyGroup(final Enclave enclave, final JsonRpcParameter parameters) {
public PrivFindPrivacyGroup(final Enclave enclave, final JsonRpcParameter parameters) {
this.enclave = enclave;
this.parameters = parameters;
}
@Override
public String getName() {
return RpcMethod.EEA_FIND_PRIVACY_GROUP.getMethodName();
return RpcMethod.PRIV_FIND_PRIVACY_GROUP.getMethodName();
}
@Override
public JsonRpcResponse response(final JsonRpcRequest request) {
LOG.trace("Executing {}", RpcMethod.EEA_FIND_PRIVACY_GROUP.getMethodName());
LOG.trace("Executing {}", RpcMethod.PRIV_FIND_PRIVACY_GROUP.getMethodName());
final String[] addresses = parameters.required(request.getParams(), 0, String[].class);

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import tech.pegasys.pantheon.ethereum.core.PrivacyParameters;
import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod;
@ -21,19 +21,19 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResp
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse;
public class EeaGetPrivacyPrecompileAddress implements JsonRpcMethod {
public class PrivGetPrivacyPrecompileAddress implements JsonRpcMethod {
private final Integer privacyAddress;
private final Boolean privacyEnabled;
public EeaGetPrivacyPrecompileAddress(final PrivacyParameters privacyParameters) {
public PrivGetPrivacyPrecompileAddress(final PrivacyParameters privacyParameters) {
privacyAddress = privacyParameters.getPrivacyAddress();
privacyEnabled = privacyParameters.isEnabled();
}
@Override
public String getName() {
return RpcMethod.EEA_GET_PRIVACY_PRECOMPILE_ADDRESS.getMethodName();
return RpcMethod.PRIV_GET_PRIVACY_PRECOMPILE_ADDRESS.getMethodName();
}
@Override

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import static org.apache.logging.log4j.LogManager.getLogger;
@ -33,7 +33,7 @@ import tech.pegasys.pantheon.util.bytes.BytesValues;
import org.apache.logging.log4j.Logger;
public class EeaGetPrivateTransaction implements JsonRpcMethod {
public class PrivGetPrivateTransaction implements JsonRpcMethod {
private static final Logger LOG = getLogger();
@ -41,7 +41,7 @@ public class EeaGetPrivateTransaction implements JsonRpcMethod {
private final JsonRpcParameter parameters;
private final PrivacyParameters privacyParameters;
public EeaGetPrivateTransaction(
public PrivGetPrivateTransaction(
final Enclave enclave,
final JsonRpcParameter parameters,
final PrivacyParameters privacyParameters) {
@ -52,12 +52,12 @@ public class EeaGetPrivateTransaction implements JsonRpcMethod {
@Override
public String getName() {
return RpcMethod.EEA_GET_PRIVATE_TRANSACTION.getMethodName();
return RpcMethod.PRIV_GET_PRIVATE_TRANSACTION.getMethodName();
}
@Override
public JsonRpcResponse response(final JsonRpcRequest request) {
LOG.trace("Executing {}", RpcMethod.EEA_GET_PRIVATE_TRANSACTION.getMethodName());
LOG.trace("Executing {}", RpcMethod.PRIV_GET_PRIVATE_TRANSACTION.getMethodName());
final String enclaveKey = parameters.required(request.getParams(), 0, String.class);
try {
ReceiveResponse 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.ethereum.jsonrpc.internal.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod;
@ -24,12 +24,12 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessRe
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.results.Quantity;
import tech.pegasys.pantheon.ethereum.privacy.PrivateTransactionHandler;
public class EeaGetTransactionCount implements JsonRpcMethod {
public class PrivGetTransactionCount implements JsonRpcMethod {
private final JsonRpcParameter parameters;
private final PrivateTransactionHandler privateTransactionHandler;
public EeaGetTransactionCount(
public PrivGetTransactionCount(
final JsonRpcParameter parameters,
final PrivateTransactionHandler privateTransactionHandler) {
this.parameters = parameters;
@ -38,7 +38,7 @@ public class EeaGetTransactionCount implements JsonRpcMethod {
@Override
public String getName() {
return RpcMethod.EEA_GET_TRANSACTION_COUNT.getMethodName();
return RpcMethod.PRIV_GET_TRANSACTION_COUNT.getMethodName();
}
@Override

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
@ -20,6 +20,7 @@ import static org.mockito.Mockito.when;
import tech.pegasys.pantheon.enclave.Enclave;
import tech.pegasys.pantheon.enclave.types.PrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivCreatePrivacyGroup;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse;
@ -47,11 +48,11 @@ public class EeaCreatePrivacyGroupTest {
new PrivacyGroup(privacyGroupId, PrivacyGroup.Type.PANTHEON, name, description, addresses);
when(enclave.createPrivacyGroup(any())).thenReturn(privacyGroup);
final EeaCreatePrivacyGroup eeaCreatePrivacyGroup =
new EeaCreatePrivacyGroup(enclave, parameters);
final PrivCreatePrivacyGroup eeaCreatePrivacyGroup =
new PrivCreatePrivacyGroup(enclave, parameters);
Object[] params = new Object[] {from, name, description, addresses};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_createPrivacyGroup", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_createPrivacyGroup", params);
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaCreatePrivacyGroup.response(request);

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
@ -26,6 +26,7 @@ import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.core.PrivacyParameters;
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivGetPrivateTransaction;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.results.privacy.PrivateTransactionGroupResult;
@ -45,7 +46,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
public class EeaGetPrivateTransactionTest {
public class PrivGetPrivateTransactionTest {
@Rule public final TemporaryFolder temp = new TemporaryFolder();
@ -100,10 +101,10 @@ public class EeaGetPrivateTransactionTest {
final PrivateTransactionLegacyResult privateTransactionLegacyResult =
new PrivateTransactionLegacyResult(privateTransaction);
final EeaGetPrivateTransaction eeaGetPrivateTransaction =
new EeaGetPrivateTransaction(enclave, parameters, privacyParameters);
final PrivGetPrivateTransaction privGetPrivateTransaction =
new PrivGetPrivateTransaction(enclave, parameters, privacyParameters);
final Object[] params = new Object[] {enclaveKey};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getPrivateTransaction", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getPrivateTransaction", params);
final BytesValueRLPOutput bvrlp = new BytesValueRLPOutput();
privateTransaction.writeTo(bvrlp);
@ -113,7 +114,7 @@ public class EeaGetPrivateTransactionTest {
Base64.getEncoder().encodeToString(bvrlp.encoded().extractArray()).getBytes(UTF_8),
""));
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetPrivateTransaction.response(request);
(JsonRpcSuccessResponse) privGetPrivateTransaction.response(request);
final PrivateTransactionResult result = (PrivateTransactionResult) response.getResult();
assertThat(result).isEqualToComparingFieldByField(privateTransactionLegacyResult);
@ -128,10 +129,10 @@ public class EeaGetPrivateTransactionTest {
final PrivateTransactionGroupResult privateTransactionGroupResult =
new PrivateTransactionGroupResult(privateTransaction);
final EeaGetPrivateTransaction eeaGetPrivateTransaction =
new EeaGetPrivateTransaction(enclave, parameters, privacyParameters);
final PrivGetPrivateTransaction privGetPrivateTransaction =
new PrivGetPrivateTransaction(enclave, parameters, privacyParameters);
final Object[] params = new Object[] {enclaveKey};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getPrivateTransaction", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getPrivateTransaction", params);
final BytesValueRLPOutput bvrlp = new BytesValueRLPOutput();
privateTransaction.writeTo(bvrlp);
@ -141,7 +142,7 @@ public class EeaGetPrivateTransactionTest {
Base64.getEncoder().encodeToString(bvrlp.encoded().extractArray()).getBytes(UTF_8),
""));
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetPrivateTransaction.response(request);
(JsonRpcSuccessResponse) privGetPrivateTransaction.response(request);
final PrivateTransactionResult result = (PrivateTransactionResult) response.getResult();
assertThat(result).isEqualToComparingFieldByField(privateTransactionGroupResult);

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.eea;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.junit.Assert.assertEquals;
@ -19,6 +19,7 @@ import static org.mockito.Mockito.when;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv.PrivGetTransactionCount;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter;
import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse;
import tech.pegasys.pantheon.ethereum.privacy.PrivateTransactionHandler;
@ -27,7 +28,7 @@ import tech.pegasys.pantheon.util.bytes.BytesValues;
import org.junit.Test;
public class EeaGetTransactionCountTest {
public class PrivGetTransactionCountTest {
private final JsonRpcParameter parameters = new JsonRpcParameter();
private final String privacyGroupId =
@ -43,14 +44,14 @@ public class EeaGetTransactionCountTest {
mock(PrivateTransactionHandler.class);
when(privateTransactionHandler.getSenderNonce(senderAddress, privacyGroupId)).thenReturn(NONCE);
final EeaGetTransactionCount eeaGetTransactionCount =
new EeaGetTransactionCount(parameters, privateTransactionHandler);
final PrivGetTransactionCount privGetTransactionCount =
new PrivGetTransactionCount(parameters, privateTransactionHandler);
final Object[] params = new Object[] {senderAddress, privacyGroupId};
final JsonRpcRequest request = new JsonRpcRequest("1", "eea_getTransactionCount", params);
final JsonRpcRequest request = new JsonRpcRequest("1", "priv_getTransactionCount", params);
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetTransactionCount.response(request);
(JsonRpcSuccessResponse) privGetTransactionCount.response(request);
assertEquals(String.format("0x%X", NONCE), response.getResult());
}

@ -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.methods.privacy;
package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.privacy.priv;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
@ -26,7 +26,7 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessRe
import org.junit.Test;
public class EeaGetPrivacyPrecompileAddressTest {
public class PrivGetPrivacyPrecompileAddressTest {
private final Integer privacyAddress = 127;
private final PrivacyParameters privacyParameters = mock(PrivacyParameters.class);
@ -36,14 +36,14 @@ public class EeaGetPrivacyPrecompileAddressTest {
when(privacyParameters.getPrivacyAddress()).thenReturn(privacyAddress);
when(privacyParameters.isEnabled()).thenReturn(true);
final EeaGetPrivacyPrecompileAddress eeaGetPrivacyPrecompileAddress =
new EeaGetPrivacyPrecompileAddress(privacyParameters);
final PrivGetPrivacyPrecompileAddress privGetPrivacyPrecompileAddress =
new PrivGetPrivacyPrecompileAddress(privacyParameters);
final JsonRpcRequest request =
new JsonRpcRequest("1", "eea_getPrivacyPrecompileAddress", new Object[0]);
new JsonRpcRequest("1", "priv_getPrivacyPrecompileAddress", new Object[0]);
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) eeaGetPrivacyPrecompileAddress.response(request);
(JsonRpcSuccessResponse) privGetPrivacyPrecompileAddress.response(request);
assertEquals(privacyAddress, response.getResult());
}
@ -53,13 +53,13 @@ public class EeaGetPrivacyPrecompileAddressTest {
when(privacyParameters.getPrivacyAddress()).thenReturn(privacyAddress);
when(privacyParameters.isEnabled()).thenReturn(false);
final EeaGetPrivacyPrecompileAddress eeaGetPrivacyPrecompileAddress =
new EeaGetPrivacyPrecompileAddress(privacyParameters);
final PrivGetPrivacyPrecompileAddress privGetPrivacyPrecompileAddress =
new PrivGetPrivacyPrecompileAddress(privacyParameters);
final JsonRpcRequest request =
new JsonRpcRequest("1", "eea_getPrivacyPrecompileAddress", new Object[0]);
new JsonRpcRequest("1", "priv_getPrivacyPrecompileAddress", new Object[0]);
final JsonRpcResponse response = eeaGetPrivacyPrecompileAddress.response(request);
final JsonRpcResponse response = privGetPrivacyPrecompileAddress.response(request);
assertEquals(JsonRpcResponseType.ERROR, response.getType());
assertEquals(JsonRpcError.PRIVACY_NOT_ENABLED, ((JsonRpcErrorResponse) response).getError());
Loading…
Cancel
Save