Skip to content

Commit

Permalink
[PIE-1798] Removed PrivacyGroup type.
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Terry <[email protected]>
  • Loading branch information
mark-terry committed Feb 3, 2020
1 parent 6aeddbf commit fcdc869
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void testCreateAndDeletePrivacyGroup() {
assertThat(privacyGroupResponse.getPrivacyGroupId()).isNotNull();
assertThat(privacyGroupResponse.getName()).isEqualTo(name);
assertThat(privacyGroupResponse.getDescription()).isEqualTo(description);
assertThat(privacyGroupResponse.getType()).isEqualByComparingTo(PrivacyGroup.Type.PANTHEON);
assertThat(privacyGroupResponse.getType()).isEqualByComparingTo(PrivacyGroup.Type.BESU);

final String response =
enclave.deletePrivacyGroup(privacyGroupResponse.getPrivacyGroupId(), publicKeys.get(0));
Expand All @@ -146,7 +146,7 @@ public void testCreateFindDeleteFindPrivacyGroup() {
assertThat(privacyGroupResponse.getPrivacyGroupId()).isNotNull();
assertThat(privacyGroupResponse.getName()).isEqualTo(name);
assertThat(privacyGroupResponse.getDescription()).isEqualTo(description);
assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.PANTHEON);
assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.BESU);

PrivacyGroup[] findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys);

Expand Down Expand Up @@ -176,7 +176,7 @@ public void testCreateDeleteRetrievePrivacyGroup() {
assertThat(privacyGroupResponse.getPrivacyGroupId()).isNotNull();
assertThat(privacyGroupResponse.getName()).isEqualTo(name);
assertThat(privacyGroupResponse.getDescription()).isEqualTo(description);
assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.PANTHEON);
assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.BESU);

final PrivacyGroup retrievePrivacyGroup =
enclave.retrievePrivacyGroup(privacyGroupResponse.getPrivacyGroupId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ public PrivacyGroup(

public enum Type {
LEGACY,
PANTHEON,
BESU
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void setUp() {
public void verifyCreatePrivacyGroup() {
final String expected = "a wonderful group";
final PrivacyGroup privacyGroup =
new PrivacyGroup(expected, PrivacyGroup.Type.PANTHEON, NAME, DESCRIPTION, ADDRESSES);
new PrivacyGroup(expected, PrivacyGroup.Type.BESU, NAME, DESCRIPTION, ADDRESSES);
when(privacyController.createPrivacyGroup(ADDRESSES, NAME, DESCRIPTION, ENCLAVE_PUBLIC_KEY))
.thenReturn(privacyGroup);
when(privacyParameters.getEnclavePublicKey()).thenReturn(FROM);
Expand Down Expand Up @@ -98,7 +98,7 @@ public void verifyCreatePrivacyGroup() {
public void verifyCreatePrivacyGroupWithoutDescription() {
final String expected = "a wonderful group";
final PrivacyGroup privacyGroup =
new PrivacyGroup(expected, PrivacyGroup.Type.PANTHEON, NAME, DESCRIPTION, ADDRESSES);
new PrivacyGroup(expected, PrivacyGroup.Type.BESU, NAME, DESCRIPTION, ADDRESSES);
when(privacyController.createPrivacyGroup(ADDRESSES, NAME, null, ENCLAVE_PUBLIC_KEY))
.thenReturn(privacyGroup);
when(privacyParameters.getEnclavePublicKey()).thenReturn(FROM);
Expand Down Expand Up @@ -134,7 +134,7 @@ public String getName() {
public void verifyCreatePrivacyGroupWithoutName() {
final String expected = "a wonderful group";
final PrivacyGroup privacyGroup =
new PrivacyGroup(expected, PrivacyGroup.Type.PANTHEON, NAME, DESCRIPTION, ADDRESSES);
new PrivacyGroup(expected, PrivacyGroup.Type.BESU, NAME, DESCRIPTION, ADDRESSES);
when(privacyController.createPrivacyGroup(ADDRESSES, null, DESCRIPTION, ENCLAVE_PUBLIC_KEY))
.thenReturn(privacyGroup);
when(privacyParameters.getEnclavePublicKey()).thenReturn(FROM);
Expand Down Expand Up @@ -170,7 +170,7 @@ public String getDescription() {
public void verifyCreatePrivacyGroupWithoutOptionalParams() {
final String expected = "a wonderful group";
final PrivacyGroup privacyGroup =
new PrivacyGroup(expected, PrivacyGroup.Type.PANTHEON, NAME, DESCRIPTION, ADDRESSES);
new PrivacyGroup(expected, PrivacyGroup.Type.BESU, NAME, DESCRIPTION, ADDRESSES);
when(privacyController.createPrivacyGroup(ADDRESSES, null, null, ENCLAVE_PUBLIC_KEY))
.thenReturn(privacyGroup);
when(privacyParameters.getEnclavePublicKey()).thenReturn(FROM);
Expand Down Expand Up @@ -203,7 +203,7 @@ public void returnsCorrectExceptionInvalidParam() {

final String expected = "a wonderful group";
final PrivacyGroup privacyGroup =
new PrivacyGroup(expected, PrivacyGroup.Type.PANTHEON, NAME, DESCRIPTION, ADDRESSES);
new PrivacyGroup(expected, PrivacyGroup.Type.BESU, NAME, DESCRIPTION, ADDRESSES);
when(enclave.createPrivacyGroup(any(), any(), any(), any())).thenReturn(privacyGroup);
when(privacyParameters.getEnclavePublicKey()).thenReturn(FROM);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public void createsPrivacyGroup() {
final PrivacyGroup enclavePrivacyGroupResponse =
new PrivacyGroup(
PRIVACY_GROUP_ID,
Type.PANTHEON,
Type.BESU,
PRIVACY_GROUP_NAME,
PRIVACY_GROUP_DESCRIPTION,
PRIVACY_GROUP_ADDRESSES);
Expand Down Expand Up @@ -322,7 +322,7 @@ public void findsPrivacyGroup() {
final PrivacyGroup privacyGroup =
new PrivacyGroup(
PRIVACY_GROUP_ID,
Type.PANTHEON,
Type.BESU,
PRIVACY_GROUP_NAME,
PRIVACY_GROUP_DESCRIPTION,
PRIVACY_GROUP_ADDRESSES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ public void setup() {
.thenReturn(new SendTransactionResponse(ENCLAVE_KEY, PRIVACY_GROUP_ID));
final PrivacyGroup privacyGroupWithEnclavePublicKey =
new PrivacyGroup(
PRIVACY_GROUP_ID,
Type.PANTHEON,
"",
"",
List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2));
PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithEnclavePublicKey);

Expand Down Expand Up @@ -149,7 +145,7 @@ public void sendBesuTransactionFailsWithValidationExceptionWhenPrivateFromDoesNo
.build();

final PrivacyGroup privacyGroupWithoutEnclavePublicKey =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithoutEnclavePublicKey);

Expand Down Expand Up @@ -179,7 +175,7 @@ public void retrieveTransactionDelegatesToPrivacyController() {
public void createPrivacyGroupDelegatesToPrivacyController() {
final List<String> addresses = List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2);
final PrivacyGroup delegatePrivacyGroup =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "name", "description", addresses);
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "name", "description", addresses);

when(privacyController.createPrivacyGroup(
addresses, "name", "description", ENCLAVE_PUBLIC_KEY1))
Expand All @@ -197,11 +193,7 @@ public void createPrivacyGroupDelegatesToPrivacyController() {
public void deletesPrivacyGroupWhenEnclavePublicKeyInPrivacyGroup() {
final PrivacyGroup privacyGroupWithEnclavePublicKey =
new PrivacyGroup(
PRIVACY_GROUP_ID,
Type.PANTHEON,
"",
"",
List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2));
PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithEnclavePublicKey);
when(privacyController.deletePrivacyGroup(PRIVACY_GROUP_ID, ENCLAVE_PUBLIC_KEY1))
Expand All @@ -217,7 +209,7 @@ public void deletesPrivacyGroupWhenEnclavePublicKeyInPrivacyGroup() {
public void
deletePrivacyGroupFailsWithValidationExceptionWhenPrivacyGroupDoesNotContainEnclavePublicKey() {
final PrivacyGroup privacyGroupWithoutEnclavePublicKey =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithoutEnclavePublicKey);

Expand All @@ -233,7 +225,7 @@ public void deletesPrivacyGroupWhenEnclavePublicKeyInPrivacyGroup() {
public void findsPrivacyGroupWhenEnclavePublicKeyInAddresses() {
final List<String> addresses = List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2);
final PrivacyGroup privacyGroup =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
when(privacyController.findPrivacyGroup(addresses, ENCLAVE_PUBLIC_KEY1))
.thenReturn(new PrivacyGroup[] {privacyGroup});

Expand Down Expand Up @@ -285,11 +277,7 @@ public void determinesEeaNonceWhenPrivateFromMatchesEnclavePublicKey() {
public void determineBesuNonceWhenEnclavePublicKeyInPrivacyGroup() {
final PrivacyGroup privacyGroupWithEnclavePublicKey =
new PrivacyGroup(
PRIVACY_GROUP_ID,
Type.PANTHEON,
"",
"",
List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2));
PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY1, ENCLAVE_PUBLIC_KEY2));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithEnclavePublicKey);
when(privacyController.determineBesuNonce(Address.ZERO, PRIVACY_GROUP_ID, ENCLAVE_PUBLIC_KEY1))
Expand All @@ -307,7 +295,7 @@ public void determineBesuNonceWhenEnclavePublicKeyInPrivacyGroup() {
public void
determineBesuNonceFailsWithValidationExceptionWhenEnclavePublicKeyNotInPrivacyGroup() {
final PrivacyGroup privacyGroupWithoutEnclavePublicKey =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY2));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithoutEnclavePublicKey);

Expand All @@ -322,7 +310,7 @@ public void determineBesuNonceWhenEnclavePublicKeyInPrivacyGroup() {
@Test
public void simulatePrivateTransactionWorksForValidEnclaveKey() {
final PrivacyGroup privacyGroupWithEnclavePublicKey =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "", "", List.of(ENCLAVE_PUBLIC_KEY1));
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY1));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithEnclavePublicKey);
when(privacyController.simulatePrivateTransaction(any(), any(), any(), any(long.class)))
Expand All @@ -344,7 +332,7 @@ public void simulatePrivateTransactionWorksForValidEnclaveKey() {
@Test
public void simulatePrivateTransactionFailsForInvalidEnclaveKey() {
final PrivacyGroup privacyGroupWithEnclavePublicKey =
new PrivacyGroup(PRIVACY_GROUP_ID, Type.PANTHEON, "", "", List.of(ENCLAVE_PUBLIC_KEY1));
new PrivacyGroup(PRIVACY_GROUP_ID, Type.BESU, "", "", List.of(ENCLAVE_PUBLIC_KEY1));
when(enclave.retrievePrivacyGroup(PRIVACY_GROUP_ID))
.thenReturn(privacyGroupWithEnclavePublicKey);

Expand Down
2 changes: 1 addition & 1 deletion ethereum/referencetests/src/test/resources
Submodule resources updated 23 files
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call1MB1024Calldepth.json
+0 −247 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call20KbytesContract50_1.json
+0 −247 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call20KbytesContract50_2.json
+0 −247 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call20KbytesContract50_3.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000_ecrec.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000_identity.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000_identity2.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000_rip160.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000_sha256.json
+247 −0 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000bytesContract50_1.json
+247 −0 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000bytesContract50_2.json
+247 −0 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Call50000bytesContract50_3.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Callcode50000.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Create1000.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Create1000Byzantium.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/QuadraticComplexitySolidity_CallDataCopy.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Return50000.json
+6 −6 BlockchainTests/GeneralStateTests/stQuadraticComplexityTest/Return50000_2.json
+0 −554 BlockchainTests/GeneralStateTests/stSelfBalance/selfBalanceCallTypes.json
+0 −116 GeneralStateTests/stSelfBalance/selfBalanceCallTypes.json
+0 −3 PRLOG.md
+0 −135 src/GeneralStateTestsFiller/stSelfBalance/selfBalanceCallTypesFiller.json

0 comments on commit fcdc869

Please sign in to comment.