From 46233966f52b617e8eb3a4d0c0b13e698b87508d Mon Sep 17 00:00:00 2001 From: Stefan Pingel <16143240+pinges@users.noreply.github.com> Date: Tue, 5 May 2020 16:33:46 +1000 Subject: [PATCH] Make sure that the onchain privacy group version is always different. (#828) * Make sure that the onchain privacy group version is always different. Signed-off-by: Stefan Pingel --- .../privacy/PrivacyRequestFactory.java | 8 +- .../privacy/OnChainPrivacyAcceptanceTest.java | 6 +- .../web3j/privacy/PrivCallAcceptanceTest.java | 2 - .../privacy/contracts/PrivacyGroupTest.java | 38 ++++++--- .../privacy/contracts/PrivacyProxyTest.java | 63 +++++++++------ .../methods/eea/EeaSendRawTransaction.java | 2 +- .../priv/PrivDistributeRawTransaction.java | 2 +- .../internal/response/JsonRpcError.java | 4 +- .../eea/EeaSendRawTransactionTest.java | 2 +- .../besu/ethereum/core/Address.java | 6 +- .../OnChainPrivacyPrecompiledContract.java | 31 +++---- .../privacy/DefaultPrivacyController.java | 4 +- ...PrivateGroupRehydrationBlockProcessor.java | 12 +-- .../privacy/group/OnChainGroupManagement.java | 8 +- ...nChainPrivacyGroupManagementContract.java} | 80 ++++++++++++------- ...ChainPrivacyGroupManagementInterface.java} | 77 ++++++++++++------ ...> OnChainPrivacyGroupManagementProxy.java} | 68 +++++++++------- ...tOnChainPrivacyGroupManagementContract.sol | 14 +++- ...OnChainPrivacyGroupManagementInterface.sol | 2 +- .../OnChainPrivacyGroupManagementProxy.sol | 2 +- .../src/main/solidity/generateWrappers.sh | 1 + 21 files changed, 266 insertions(+), 166 deletions(-) rename privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/{PrivacyGroup.java => DefaultOnChainPrivacyGroupManagementContract.java} (66%) rename privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/{PrivacyInterface.java => OnChainPrivacyGroupManagementInterface.java} (76%) rename privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/{PrivacyProxy.java => OnChainPrivacyGroupManagementProxy.java} (87%) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java index 8579fd4348..5ce9961646 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java @@ -146,7 +146,7 @@ public class PrivacyRequestFactory { nonce, BigInteger.valueOf(1000), BigInteger.valueOf(3000000), - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), payload.toHexString(), Base64String.wrap(adder.getEnclaveKey()), privacyGroupId, @@ -180,7 +180,7 @@ public class PrivacyRequestFactory { nonce, BigInteger.valueOf(1000), BigInteger.valueOf(3000000), - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), payload.toHexString(), Base64String.wrap(remover.getEnclaveKey()), privacyGroupId, @@ -213,7 +213,7 @@ public class PrivacyRequestFactory { nonce, BigInteger.valueOf(1000), BigInteger.valueOf(3000000), - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), OnChainGroupManagement.LOCK_GROUP_METHOD_SIGNATURE.toHexString(), Base64String.wrap(locker.getEnclaveKey()), privacyGroupId, @@ -262,7 +262,7 @@ public class PrivacyRequestFactory { nonce, BigInteger.valueOf(1000), BigInteger.valueOf(3000000), - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), payload.toHexString(), Base64String.wrap(creator.getEnclaveKey()), Base64String.wrap(privacyGroupId.toArrayUnsafe()), diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/OnChainPrivacyAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/OnChainPrivacyAcceptanceTest.java index ce317626ed..dd2cc7b643 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/OnChainPrivacyAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/OnChainPrivacyAcceptanceTest.java @@ -330,7 +330,7 @@ public class OnChainPrivacyAcceptanceTest extends PrivacyAcceptanceTestBase { new PrivateTransactionReceipt( null, alice.getAddress().toHexString(), - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), "0x", Collections.emptyList(), null, @@ -503,7 +503,7 @@ public class OnChainPrivacyAcceptanceTest extends PrivacyAcceptanceTestBase { final String privacyGroupId, final PrivacyNode groupCreator) { return groupCreator.execute( privateContractTransactions.callOnChainPermissioningSmartContract( - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), GET_PARTICIPANTS_METHOD_SIGNATURE + Bytes.fromBase64String(groupCreator.getEnclaveKey()).toUnprefixedHexString(), groupCreator.getTransactionSigningKey(), @@ -529,7 +529,7 @@ public class OnChainPrivacyAcceptanceTest extends PrivacyAcceptanceTestBase { return new PrivateTransactionReceipt( null, groupCreator.getAddress().toHexString(), - Address.PRIVACY_PROXY.toHexString(), + Address.ONCHAIN_PRIVACY_PROXY.toHexString(), output.toString(), Collections.emptyList(), null, diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivCallAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivCallAcceptanceTest.java index 1fdac4e4a5..5c311db63a 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivCallAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivCallAcceptanceTest.java @@ -113,8 +113,6 @@ public class PrivCallAcceptanceTest extends PrivacyAcceptanceTestBase { minerNode.getEnclaveKey(), privacyGroupId)); - System.out.println("Address: " + eventEmitter.getContractAddress()); - privateContractVerifier .validPrivateContractDeployed( eventEmitter.getContractAddress(), minerNode.getAddress().toString()) diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyGroupTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyGroupTest.java index 7b44734a13..b2a346e2bd 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyGroupTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyGroupTest.java @@ -16,11 +16,10 @@ package org.hyperledger.besu.tests.web3j.privacy.contracts; import static org.assertj.core.api.Assertions.assertThat; -import org.hyperledger.besu.privacy.contracts.generated.PrivacyGroup; +import org.hyperledger.besu.privacy.contracts.generated.DefaultOnChainPrivacyGroupManagementContract; import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; -import java.math.BigInteger; import java.util.Collections; import java.util.List; @@ -38,7 +37,7 @@ public class PrivacyGroupTest extends AcceptanceTestBase { Base64String.wrap("Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="); private final Base64String thirdParticipant = Base64String.wrap("Jo2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="); - private PrivacyGroup privacyGroup; + private DefaultOnChainPrivacyGroupManagementContract privacyGroup; private static final String RAW_FIRST_PARTICIPANT = "0x0b0235be035695b4cc4b0941e60551d7a19cf30603db5bfc23e5ac43a56f57f25f75486a"; @@ -57,7 +56,10 @@ public class PrivacyGroupTest extends AcceptanceTestBase { public void setUp() throws Exception { minerNode = besu.createMinerNode("node"); cluster.start(minerNode); - privacyGroup = minerNode.execute(contractTransactions.createSmartContract(PrivacyGroup.class)); + privacyGroup = + minerNode.execute( + contractTransactions.createSmartContract( + DefaultOnChainPrivacyGroupManagementContract.class)); } @Test @@ -131,6 +133,26 @@ public class PrivacyGroupTest extends AcceptanceTestBase { assertThat(privacyGroup.canExecute().send()).isTrue(); } + @Test + public void ensurePrivacyGroupVersionIsAlwaysDifferent() throws Exception { + privacyGroup + .addParticipants(firstParticipant.raw(), Collections.singletonList(secondParticipant.raw())) + .send(); + final byte[] version1 = privacyGroup.getVersion().send(); + privacyGroup.lock().send(); + privacyGroup + .addParticipants(firstParticipant.raw(), Collections.singletonList(thirdParticipant.raw())) + .send(); + final byte[] version2 = privacyGroup.getVersion().send(); + privacyGroup.lock().send(); + privacyGroup.removeParticipant(firstParticipant.raw(), secondParticipant.raw()).send(); + final byte[] version3 = privacyGroup.getVersion().send(); + + assertThat(version1).isNotEqualTo(version2); + assertThat(version1).isNotEqualTo(version3); + assertThat(version2).isNotEqualTo(version3); + } + @Test public void canAddTwiceToContractWhenCallLock() throws Exception { privacyGroup @@ -140,8 +162,6 @@ public class PrivacyGroupTest extends AcceptanceTestBase { privacyGroup .addParticipants(firstParticipant.raw(), Collections.singletonList(secondParticipant.raw())) .send(); - final BigInteger privacyGroupVersion = privacyGroup.getVersion().send(); - assertThat(privacyGroupVersion).isEqualTo(BigInteger.TWO); final List participants = privacyGroup.getParticipants(firstParticipant.raw()).send(); assertThat(participants.size()).isEqualTo(3); @@ -150,12 +170,6 @@ public class PrivacyGroupTest extends AcceptanceTestBase { assertThat(secondParticipant.raw()).isEqualTo(participants.get(2)); } - @Test - public void versionStartsAtZero() throws Exception { - final BigInteger privacyGroupVersion = privacyGroup.getVersion().send(); - assertThat(privacyGroupVersion).isEqualTo(BigInteger.ZERO); - } - @Test(expected = TransactionException.class) public void cannotLockTwice() throws Exception { privacyGroup diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyProxyTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyProxyTest.java index 52561b276b..4a3bd43eab 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyProxyTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyProxyTest.java @@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.web3j.privacy.contracts; import static org.assertj.core.api.Assertions.assertThat; -import org.hyperledger.besu.privacy.contracts.generated.PrivacyGroup; -import org.hyperledger.besu.privacy.contracts.generated.PrivacyProxy; +import org.hyperledger.besu.privacy.contracts.generated.DefaultOnChainPrivacyGroupManagementContract; +import org.hyperledger.besu.privacy.contracts.generated.OnChainPrivacyGroupManagementProxy; import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; @@ -38,7 +38,7 @@ public class PrivacyProxyTest extends AcceptanceTestBase { Base64String.wrap("9iaJ6OObl6TUWYjXAOyZsL0VaDPwF+tRFkMwwYSeqqw="); private final Base64String thirdParticipant = Base64String.wrap("Jo2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="); - private PrivacyProxy privacyProxy; + private OnChainPrivacyGroupManagementProxy onChainPrivacyGroupManagementProxy; private static final String RAW_FIRST_PARTICIPANT = "0x0b0235bef772b2ee55f016431cefe724a05814324bb96e9afdb73e338665a693d4653678"; @@ -51,27 +51,32 @@ public class PrivacyProxyTest extends AcceptanceTestBase { public void setUp() throws Exception { minerNode = besu.createMinerNode("node"); cluster.start(minerNode); - PrivacyGroup privacyGroup = - minerNode.execute(contractTransactions.createSmartContract(PrivacyGroup.class)); - privacyProxy = + DefaultOnChainPrivacyGroupManagementContract privacyGroup = minerNode.execute( contractTransactions.createSmartContract( - PrivacyProxy.class, privacyGroup.getContractAddress())); + DefaultOnChainPrivacyGroupManagementContract.class)); + onChainPrivacyGroupManagementProxy = + minerNode.execute( + contractTransactions.createSmartContract( + OnChainPrivacyGroupManagementProxy.class, privacyGroup.getContractAddress())); } @Test public void rlp() throws Exception { - assertThat(privacyProxy.isValid()).isEqualTo(true); + assertThat(onChainPrivacyGroupManagementProxy.isValid()).isEqualTo(true); contractVerifier - .validTransactionReceipt(privacyProxy.getContractAddress()) - .verify(privacyProxy); + .validTransactionReceipt(onChainPrivacyGroupManagementProxy.getContractAddress()) + .verify(onChainPrivacyGroupManagementProxy); // 0x0b0235be assertThat(RAW_FIRST_PARTICIPANT) - .isEqualTo(privacyProxy.getParticipants(firstParticipant.raw()).encodeFunctionCall()); + .isEqualTo( + onChainPrivacyGroupManagementProxy + .getParticipants(firstParticipant.raw()) + .encodeFunctionCall()); // 0xf744b089 assertThat(RAW_ADD_PARTICIPANT) .isEqualTo( - privacyProxy + onChainPrivacyGroupManagementProxy .addParticipants(firstParticipant.raw(), Collections.emptyList()) .encodeFunctionCall()); } @@ -79,16 +84,18 @@ public class PrivacyProxyTest extends AcceptanceTestBase { @Ignore("return 0x which causes web3j to throw exception instead of return empty list") @Test public void deploysWithNoParticipant() throws Exception { - final List participants = privacyProxy.getParticipants(firstParticipant.raw()).send(); + final List participants = + onChainPrivacyGroupManagementProxy.getParticipants(firstParticipant.raw()).send(); assertThat(participants.size()).isEqualTo(0); } @Test public void canAddParticipants() throws Exception { - privacyProxy + onChainPrivacyGroupManagementProxy .addParticipants(firstParticipant.raw(), Collections.singletonList(secondParticipant.raw())) .send(); - final List participants = privacyProxy.getParticipants(firstParticipant.raw()).send(); + final List participants = + onChainPrivacyGroupManagementProxy.getParticipants(firstParticipant.raw()).send(); assertThat(participants.size()).isEqualTo(2); assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); @@ -96,23 +103,26 @@ public class PrivacyProxyTest extends AcceptanceTestBase { @Test public void canUpgrade() throws Exception { - privacyProxy + onChainPrivacyGroupManagementProxy .addParticipants(firstParticipant.raw(), Collections.singletonList(secondParticipant.raw())) .send(); - final List participants = privacyProxy.getParticipants(firstParticipant.raw()).send(); + final List participants = + onChainPrivacyGroupManagementProxy.getParticipants(firstParticipant.raw()).send(); assertThat(participants.size()).isEqualTo(2); assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); assertThat(secondParticipant.raw()).isEqualTo(participants.get(1)); - final PrivacyGroup upgradedContract = - minerNode.execute(contractTransactions.createSmartContract(PrivacyGroup.class)); + final DefaultOnChainPrivacyGroupManagementContract upgradedContract = + minerNode.execute( + contractTransactions.createSmartContract( + DefaultOnChainPrivacyGroupManagementContract.class)); - privacyProxy.upgradeTo(upgradedContract.getContractAddress()).send(); - privacyProxy + onChainPrivacyGroupManagementProxy.upgradeTo(upgradedContract.getContractAddress()).send(); + onChainPrivacyGroupManagementProxy .addParticipants(firstParticipant.raw(), Collections.singletonList(secondParticipant.raw())) .send(); final List participantsAfterUpgrade = - privacyProxy.getParticipants(firstParticipant.raw()).send(); + onChainPrivacyGroupManagementProxy.getParticipants(firstParticipant.raw()).send(); assertThat(participantsAfterUpgrade.size()).isEqualTo(2); assertThat(firstParticipant.raw()).isEqualTo(participantsAfterUpgrade.get(0)); assertThat(secondParticipant.raw()).isEqualTo(participantsAfterUpgrade.get(1)); @@ -120,14 +130,15 @@ public class PrivacyProxyTest extends AcceptanceTestBase { @Test public void canAddTwiceToContractWhenCallLock() throws Exception { - privacyProxy + onChainPrivacyGroupManagementProxy .addParticipants(firstParticipant.raw(), Collections.singletonList(thirdParticipant.raw())) .send(); - privacyProxy.lock().send(); - privacyProxy + onChainPrivacyGroupManagementProxy.lock().send(); + onChainPrivacyGroupManagementProxy .addParticipants(firstParticipant.raw(), Collections.singletonList(secondParticipant.raw())) .send(); - final List participants = privacyProxy.getParticipants(firstParticipant.raw()).send(); + final List participants = + onChainPrivacyGroupManagementProxy.getParticipants(firstParticipant.raw()).send(); assertThat(participants.size()).isEqualTo(3); assertThat(firstParticipant.raw()).isEqualTo(participants.get(0)); assertThat(thirdParticipant.raw()).isEqualTo(participants.get(1)); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransaction.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransaction.java index adb9793e63..e7e4cde37c 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransaction.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransaction.java @@ -90,7 +90,7 @@ public class EeaSendRawTransaction implements JsonRpcMethod { final Optional maybePrivacyGroupId = privateTransaction.getPrivacyGroupId(); if (onchainPrivacyGroupsEnabled) { if (!maybePrivacyGroupId.isPresent()) { - return new JsonRpcErrorResponse(id, JsonRpcError.PRIVACY_GROUP_ID_NOT_AVAILABLE); + return new JsonRpcErrorResponse(id, JsonRpcError.ONCHAIN_PRIVACY_GROUP_ID_NOT_AVAILABLE); } maybePrivacyGroup = privacyController.retrieveOnChainPrivacyGroup( diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivDistributeRawTransaction.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivDistributeRawTransaction.java index d93fb9e6c4..7b29eb537d 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivDistributeRawTransaction.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/priv/PrivDistributeRawTransaction.java @@ -85,7 +85,7 @@ public class PrivDistributeRawTransaction implements JsonRpcMethod { final Optional maybePrivacyGroupId = privateTransaction.getPrivacyGroupId(); if (onchainPrivacyGroupsEnabled) { if (!maybePrivacyGroupId.isPresent()) { - return new JsonRpcErrorResponse(id, JsonRpcError.PRIVACY_GROUP_ID_NOT_AVAILABLE); + return new JsonRpcErrorResponse(id, JsonRpcError.ONCHAIN_PRIVACY_GROUP_ID_NOT_AVAILABLE); } maybePrivacyGroup = privacyController.retrieveOnChainPrivacyGroup( diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java index fbbb3d33de..da700eb8bd 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java @@ -120,8 +120,8 @@ public enum JsonRpcError { ONCHAIN_PRIVACY_GROUP_NOT_ENABLED(-50100, "Onchain privacy groups not enabled."), OFFCHAIN_PRIVACY_GROUP_NOT_ENABLED( -50100, "Offchain privacy group can't be used with Onchain privacy groups enabled."), - PRIVACY_GROUP_ID_NOT_AVAILABLE( - -50100, "Privacy group id is not available while OnChain privacy groups are enabled"), + ONCHAIN_PRIVACY_GROUP_ID_NOT_AVAILABLE( + -50100, "Private transactions to on-chain privacy groups must use privacyGroupId"), PRIVATE_FROM_DOES_NOT_MATCH_ENCLAVE_PUBLIC_KEY( -50100, "Private from does not match enclave public key"), PMT_FAILED_INTRINSIC_GAS_EXCEEDS_LIMIT( diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransactionTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransactionTest.java index 88184aa2ec..c03b77346e 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransactionTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransactionTest.java @@ -308,7 +308,7 @@ public class EeaSendRawTransactionTest { final JsonRpcResponse expectedResponse = new JsonRpcErrorResponse( - request.getRequest().getId(), JsonRpcError.PRIVACY_GROUP_ID_NOT_AVAILABLE); + request.getRequest().getId(), JsonRpcError.ONCHAIN_PRIVACY_GROUP_ID_NOT_AVAILABLE); final JsonRpcResponse actualResponse = method.response(request); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Address.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Address.java index 3a19e3b41b..ed0236629a 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Address.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Address.java @@ -46,8 +46,10 @@ public class Address extends DelegatingBytes implements org.hyperledger.besu.plu public static final Integer PRIVACY = Byte.MAX_VALUE - 1; public static final Address DEFAULT_PRIVACY = Address.precompiled(PRIVACY); public static final Address ONCHAIN_PRIVACY = Address.precompiled(PRIVACY - 1); - public static final Address PRIVACY_PROXY = Address.precompiled(PRIVACY - 2); - public static final Address DEFAULT_PRIVACY_MANAGEMENT = Address.precompiled(PRIVACY - 3); + + // Onchain privacy management contracts (injected in private state) + public static final Address ONCHAIN_PRIVACY_PROXY = Address.precompiled(PRIVACY - 2); + public static final Address DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT = Address.precompiled(PRIVACY - 3); public static final Address ZERO = Address.fromHexString("0x0"); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/OnChainPrivacyPrecompiledContract.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/OnChainPrivacyPrecompiledContract.java index a1eaa11242..0619a69194 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/OnChainPrivacyPrecompiledContract.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/OnChainPrivacyPrecompiledContract.java @@ -228,7 +228,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac final MutableWorldState disposablePrivateState, final WorldUpdater privateWorldStateUpdater) { final PrivateTransactionProcessor.Result result = - checkCanExecute( + simulateTransaction( messageFrame, currentBlockHeader, publicWorldState, @@ -240,7 +240,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac return result.getOutput().toHexString().endsWith("0"); } - protected PrivateTransactionProcessor.Result checkCanExecute( + protected PrivateTransactionProcessor.Result simulateTransaction( final MessageFrame messageFrame, final ProcessableBlockHeader currentBlockHeader, final WorldUpdater publicWorldState, @@ -248,23 +248,22 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac final Blockchain currentBlockchain, final MutableWorldState disposablePrivateState, final WorldUpdater privateWorldStateUpdater, - final Bytes canExecuteMethodSignature) { + final Bytes methodSignature) { // We need the "lock status" of the group for every single transaction but we don't want this // call to affect the state // privateTransactionProcessor.processTransaction(...) commits the state if the process was // successful before it returns - final MutableWorldState canExecutePrivateState = + final MutableWorldState localMutableState = privateWorldStateArchive.getMutable(disposablePrivateState.rootHash()).get(); - final WorldUpdater canExecuteUpdater = canExecutePrivateState.updater(); + final WorldUpdater updater = localMutableState.updater(); return privateTransactionProcessor.processTransaction( currentBlockchain, publicWorldState, - canExecuteUpdater, + updater, currentBlockHeader, messageFrame.getTransactionHash(), - buildSimulationTransaction( - privacyGroupId, privateWorldStateUpdater, canExecuteMethodSignature), + buildSimulationTransaction(privacyGroupId, privateWorldStateUpdater, methodSignature), messageFrame.getMiningBeneficiary(), new DebugOperationTracer(TraceOptions.DEFAULT), messageFrame.getBlockHashLookup(), @@ -278,20 +277,22 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac if (lastRootHash.equals(EMPTY_ROOT_HASH)) { // inject management final DefaultEvmAccount managementPrecompile = - privateWorldStateUpdater.createAccount(Address.DEFAULT_PRIVACY_MANAGEMENT); + privateWorldStateUpdater.createAccount(Address.DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT); final MutableAccount mutableManagementPrecompiled = managementPrecompile.getMutable(); // this is the code for the simple management contract - mutableManagementPrecompiled.setCode(OnChainGroupManagement.DEFAULT_GROUP_MANAGEMENT_CODE); + mutableManagementPrecompiled.setCode( + OnChainGroupManagement.DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE); // inject proxy final DefaultEvmAccount proxyPrecompile = - privateWorldStateUpdater.createAccount(Address.PRIVACY_PROXY); + privateWorldStateUpdater.createAccount(Address.ONCHAIN_PRIVACY_PROXY); final MutableAccount mutableProxyPrecompiled = proxyPrecompile.getMutable(); // this is the code for the proxy contract - mutableProxyPrecompiled.setCode(OnChainGroupManagement.DEFAULT_PROXY_PRECOMPILED_CODE); + mutableProxyPrecompiled.setCode(OnChainGroupManagement.PROXY_RUNTIME_BYTECODE); // manually set the management contract address so the proxy can trust it mutableProxyPrecompiled.setStorageValue( - UInt256.ZERO, UInt256.fromBytes(Bytes32.leftPad(Address.DEFAULT_PRIVACY_MANAGEMENT))); + UInt256.ZERO, + UInt256.fromBytes(Bytes32.leftPad(Address.DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT))); privateWorldStateUpdater.commit(); disposablePrivateState.persist(); @@ -312,7 +313,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac // privateTransactionProcessor.processTransaction(...) commits the state if the process was // successful before it returns final PrivateTransactionProcessor.Result getVersionResult = - checkCanExecute( + simulateTransaction( messageFrame, currentBlockHeader, publicWorldState, @@ -348,7 +349,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac : 0) .gasPrice(Wei.of(1000)) .gasLimit(3000000) - .to(Address.PRIVACY_PROXY) + .to(Address.ONCHAIN_PRIVACY_PROXY) .sender(Address.ZERO) .value(Wei.ZERO) .payload(payload) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/DefaultPrivacyController.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/DefaultPrivacyController.java index 978a8817b0..caa2e20916 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/DefaultPrivacyController.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/DefaultPrivacyController.java @@ -321,7 +321,7 @@ public class DefaultPrivacyController implements PrivacyController { private CallParameter buildCallParams(final Bytes enclavePublicKey, final Bytes methodCall) { return new CallParameter( Address.ZERO, - Address.PRIVACY_PROXY, + Address.ONCHAIN_PRIVACY_PROXY, 3000000, Wei.of(1000), Wei.ZERO, @@ -394,7 +394,7 @@ public class DefaultPrivacyController implements PrivacyController { @Override public boolean isGroupAdditionTransaction(final PrivateTransaction privateTransaction) { return privateTransaction.getTo().isPresent() - && privateTransaction.getTo().get().equals(Address.PRIVACY_PROXY) + && privateTransaction.getTo().get().equals(Address.ONCHAIN_PRIVACY_PROXY) && privateTransaction .getPayload() .toHexString() diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivateGroupRehydrationBlockProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivateGroupRehydrationBlockProcessor.java index 02012c4b01..c0559ae9c7 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivateGroupRehydrationBlockProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivateGroupRehydrationBlockProcessor.java @@ -232,20 +232,22 @@ public class PrivateGroupRehydrationBlockProcessor { if (lastRootHash.equals(EMPTY_ROOT_HASH)) { // inject management final DefaultEvmAccount managementPrecompile = - privateWorldStateUpdater.createAccount(Address.DEFAULT_PRIVACY_MANAGEMENT); + privateWorldStateUpdater.createAccount(Address.DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT); final MutableAccount mutableManagementPrecompiled = managementPrecompile.getMutable(); // this is the code for the simple management contract - mutableManagementPrecompiled.setCode(OnChainGroupManagement.DEFAULT_GROUP_MANAGEMENT_CODE); + mutableManagementPrecompiled.setCode( + OnChainGroupManagement.DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE); // inject proxy final DefaultEvmAccount proxyPrecompile = - privateWorldStateUpdater.createAccount(Address.PRIVACY_PROXY); + privateWorldStateUpdater.createAccount(Address.ONCHAIN_PRIVACY_PROXY); final MutableAccount mutableProxyPrecompiled = proxyPrecompile.getMutable(); // this is the code for the proxy contract - mutableProxyPrecompiled.setCode(OnChainGroupManagement.DEFAULT_PROXY_PRECOMPILED_CODE); + mutableProxyPrecompiled.setCode(OnChainGroupManagement.PROXY_RUNTIME_BYTECODE); // manually set the management contract address so the proxy can trust it mutableProxyPrecompiled.setStorageValue( - UInt256.ZERO, UInt256.fromBytes(Bytes32.leftPad(Address.DEFAULT_PRIVACY_MANAGEMENT))); + UInt256.ZERO, + UInt256.fromBytes(Bytes32.leftPad(Address.DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT))); privateWorldStateUpdater.commit(); disposablePrivateState.persist(); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/group/OnChainGroupManagement.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/group/OnChainGroupManagement.java index b2da1777f5..8b21f51e23 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/group/OnChainGroupManagement.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/group/OnChainGroupManagement.java @@ -17,13 +17,13 @@ package org.hyperledger.besu.ethereum.privacy.group; import org.apache.tuweni.bytes.Bytes; public class OnChainGroupManagement { - public static final Bytes DEFAULT_PROXY_PRECOMPILED_CODE = + public static final Bytes PROXY_RUNTIME_BYTECODE = Bytes.fromHexString( - "0x608060405234801561001057600080fd5b50600436106100935760003560e01c806361544c911161006657806361544c91146101c757806378b9033714610217578063a69df4b514610239578063f744b08914610243578063f83d08ba1461031d57610093565b80630b0235be146100985780630d8e6e2c1461011b5780633659cfe6146101395780635c60da1b1461017d575b600080fd5b6100c4600480360360208110156100ae57600080fd5b8101908080359060200190929190505050610327565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101075780820151818401526020810190506100ec565b505050509050019250505060405180910390f35b61012361047d565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561014f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061052b565b005b610185610591565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101fd600480360360408110156101dd57600080fd5b8101908080359060200190929190803590602001909291905050506105b6565b604051808215151515815260200191505060405180910390f35b61021f61067c565b604051808215151515815260200191505060405180910390f35b61024161072a565b005b6103036004803603604081101561025957600080fd5b81019080803590602001909291908035906020019064010000000081111561028057600080fd5b82018360208201111561029257600080fd5b803590602001918460208302840111640100000000831117156102b457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107b3565b604051808215151515815260200191505060405180910390f35b6103256108ba565b005b606060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630b0235be846040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156103de57600080fd5b81019080805160405193929190846401000000008211156103fe57600080fd5b8382019150602082018581111561041457600080fd5b825186602082028301116401000000008211171561043157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561046857808201518184015260208101905061044d565b50505050905001604052505050915050919050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630d8e6e2c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ea57600080fd5b505afa1580156104fe573d6000803e3d6000fd5b505050506040513d602081101561051457600080fd5b810190808051906020019092919050505091505090565b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561058557600080fd5b61058e81610943565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166361544c9185856040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b15801561063857600080fd5b505af115801561064c573d6000803e3d6000fd5b505050506040513d602081101561066257600080fd5b810190808051906020019092919050505091505092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166378b903376040518163ffffffff1660e01b815260040160206040518083038186803b1580156106e957600080fd5b505afa1580156106fd573d6000803e3d6000fd5b505050506040513d602081101561071357600080fd5b810190808051906020019092919050505091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a69df4b56040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561079857600080fd5b505af11580156107ac573d6000803e3d6000fd5b5050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f744b08985856040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610850578082015181840152602081019050610835565b505050509050019350505050602060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505050506040513d60208110156108a057600080fd5b810190808051906020019092919050505091505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f83d08ba6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092857600080fd5b505af115801561093c573d6000803e3d6000fd5b5050505050565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72315820498cff5aa36efa4596466bc5546201e9c41df019fcc994f209e16b330d34284b64736f6c63430005100032"); + "608060405234801561001057600080fd5b50600436106100935760003560e01c806361544c911161006657806361544c91146101c757806378b9033714610217578063a69df4b514610239578063f744b08914610243578063f83d08ba1461031d57610093565b80630b0235be146100985780630d8e6e2c1461011b5780633659cfe6146101395780635c60da1b1461017d575b600080fd5b6100c4600480360360208110156100ae57600080fd5b8101908080359060200190929190505050610327565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101075780820151818401526020810190506100ec565b505050509050019250505060405180910390f35b61012361047d565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561014f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061052b565b005b610185610591565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101fd600480360360408110156101dd57600080fd5b8101908080359060200190929190803590602001909291905050506105b6565b604051808215151515815260200191505060405180910390f35b61021f61067c565b604051808215151515815260200191505060405180910390f35b61024161072a565b005b6103036004803603604081101561025957600080fd5b81019080803590602001909291908035906020019064010000000081111561028057600080fd5b82018360208201111561029257600080fd5b803590602001918460208302840111640100000000831117156102b457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107b3565b604051808215151515815260200191505060405180910390f35b6103256108ba565b005b606060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630b0235be846040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156103de57600080fd5b81019080805160405193929190846401000000008211156103fe57600080fd5b8382019150602082018581111561041457600080fd5b825186602082028301116401000000008211171561043157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561046857808201518184015260208101905061044d565b50505050905001604052505050915050919050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630d8e6e2c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ea57600080fd5b505afa1580156104fe573d6000803e3d6000fd5b505050506040513d602081101561051457600080fd5b810190808051906020019092919050505091505090565b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561058557600080fd5b61058e81610943565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166361544c9185856040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b15801561063857600080fd5b505af115801561064c573d6000803e3d6000fd5b505050506040513d602081101561066257600080fd5b810190808051906020019092919050505091505092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166378b903376040518163ffffffff1660e01b815260040160206040518083038186803b1580156106e957600080fd5b505afa1580156106fd573d6000803e3d6000fd5b505050506040513d602081101561071357600080fd5b810190808051906020019092919050505091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a69df4b56040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561079857600080fd5b505af11580156107ac573d6000803e3d6000fd5b5050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f744b08985856040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610850578082015181840152602081019050610835565b505050509050019350505050602060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505050506040513d60208110156108a057600080fd5b810190808051906020019092919050505091505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f83d08ba6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092857600080fd5b505af115801561093c573d6000803e3d6000fd5b5050505050565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a7231582086789349219ec4e3fca6895060836bcb51dbdead2090453fc01b0a49c021d4ef64736f6c63430005110032"); - public static final Bytes DEFAULT_GROUP_MANAGEMENT_CODE = + public static final Bytes DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE = Bytes.fromHexString( - "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806378b903371161005b57806378b9033714610173578063a69df4b514610195578063f744b0891461019f578063f83d08ba146102795761007d565b80630b0235be146100825780630d8e6e2c1461010557806361544c9114610123575b600080fd5b6100ae6004803603602081101561009857600080fd5b8101908080359060200190929190505050610283565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100f15780820151818401526020810190506100d6565b505050509050019250505060405180910390f35b61010d6102ef565b6040518082815260200191505060405180910390f35b6101596004803603604081101561013957600080fd5b8101908080359060200190929190803590602001909291905050506102f9565b604051808215151515815260200191505060405180910390f35b61017b61031e565b604051808215151515815260200191505060405180910390f35b61019d610334565b005b61025f600480360360408110156101b557600080fd5b8101908080359060200190929190803590602001906401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184602083028401116401000000008311171561021057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610369565b604051808215151515815260200191505060405180910390f35b6102816103f3565b005b606061028e82610427565b61029757600080fd5b60028054806020026020016040519081016040528092919081815260200182805480156102e357602002820191906000526020600020905b8154815260200190600101908083116102cf575b50505050509050919050565b6000600154905090565b600061030483610427565b61030d57600080fd5b61031682610447565b905092915050565b60008060009054906101000a900460ff16905090565b6000809054906101000a900460ff161561034d57600080fd5b60016000806101000a81548160ff021916908315150217905550565b60008060009054906101000a900460ff161561038457600080fd5b6000600280549050141561039d5761039b8361052a565b505b6103a683610427565b6103af57600080fd5b60006103bb848461059c565b905060016000806101000a81548160ff0219169083151502179055506001600081548092919060010191905055508091505092915050565b6000809054906101000a900460ff1661040b57600080fd5b60008060006101000a81548160ff021916908315150217905550565b600080600360008481526020019081526020016000205414159050919050565b6000806003600084815260200190815260200160002054905060008111801561047557506002805490508111155b1561051f5760028054905081146104e357600060026001600280549050038154811061049d57fe5b9060005260206000200154905080600260018403815481106104bb57fe5b9060005260206000200181905550816003600083815260200190815260200160002081905550505b60016002818180549050039150816104fb919061087e565b50600060036000858152602001908152602001600020819055506001915050610525565b60009150505b919050565b600080600360008481526020019081526020016000205414156105925760028290806001815401808255809150509060018203906000526020600020016000909192909190915055600360008481526020019081526020016000208190555060019050610597565b600090505b919050565b6000806001905060008090505b8351811015610873578381815181106105be57fe5b6020026020010151851415610652577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf21360008583815181106105fc57fe5b60200260200101516040518083151515158152602001828152602001806020018281038252602f8152602001806108f1602f9139604001935050505060405180910390a181801561064b575060005b9150610866565b61066e84828151811061066157fe5b6020026020010151610427565b15610715577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf21360008583815181106106a257fe5b60200260200101516040518083151515158152602001828152602001806020018281038252601b8152602001807f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250602001935050505060405180910390a181801561070e575060005b9150610865565b600061073385838151811061072657fe5b602002602001015161052a565b9050606081610777576040518060400160405280601b81526020017f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250610791565b6040518060600160405280602181526020016108d0602191395b90507fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf213828785815181106107c157fe5b602002602001015183604051808415151515815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561081a5780820151818401526020810190506107ff565b50505050905090810190601f1680156108475780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a18380156108605750815b935050505b5b80806001019150506105a9565b508091505092915050565b8154818355818111156108a5578183600052602060002091820191016108a491906108aa565b5b505050565b6108cc91905b808211156108c85760008160009055506001016108b0565b5090565b9056fe4d656d626572206163636f756e74206164646564207375636365737366756c6c79416464696e67206f776e206163636f756e742061732061204d656d626572206973206e6f74207065726d6974746564a265627a7a7231582081adaba054a78ca50b49183102a909f50f15b49eb4947bfa3593139d8833895564736f6c63430005100032"); + "608060405234801561001057600080fd5b506004361061007d5760003560e01c806378b903371161005b57806378b9033714610173578063a69df4b514610195578063f744b0891461019f578063f83d08ba146102795761007d565b80630b0235be146100825780630d8e6e2c1461010557806361544c9114610123575b600080fd5b6100ae6004803603602081101561009857600080fd5b8101908080359060200190929190505050610283565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100f15780820151818401526020810190506100d6565b505050509050019250505060405180910390f35b61010d6102ef565b6040518082815260200191505060405180910390f35b6101596004803603604081101561013957600080fd5b8101908080359060200190929190803590602001909291905050506102f9565b604051808215151515815260200191505060405180910390f35b61017b61032d565b604051808215151515815260200191505060405180910390f35b61019d610343565b005b61025f600480360360408110156101b557600080fd5b8101908080359060200190929190803590602001906401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184602083028401116401000000008311171561021057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610378565b604051808215151515815260200191505060405180910390f35b6102816103f9565b005b606061028e8261042d565b61029757600080fd5b60028054806020026020016040519081016040528092919081815260200182805480156102e357602002820191906000526020600020905b8154815260200190600101908083116102cf575b50505050509050919050565b6000600154905090565b60006103048361042d565b61030d57600080fd5b60006103188361044d565b9050610322610530565b508091505092915050565b60008060009054906101000a900460ff16905090565b6000809054906101000a900460ff161561035c57600080fd5b60016000806101000a81548160ff021916908315150217905550565b60008060009054906101000a900460ff161561039357600080fd5b600060028054905014156103ac576103aa836105d0565b505b6103b58361042d565b6103be57600080fd5b60006103ca8484610642565b905060016000806101000a81548160ff0219169083151502179055506103ee610530565b508091505092915050565b6000809054906101000a900460ff1661041157600080fd5b60008060006101000a81548160ff021916908315150217905550565b600080600360008481526020019081526020016000205414159050919050565b6000806003600084815260200190815260200160002054905060008111801561047b57506002805490508111155b156105255760028054905081146104e95760006002600160028054905003815481106104a357fe5b9060005260206000200154905080600260018403815481106104c157fe5b9060005260206000200181905550816003600083815260200190815260200160002081905550505b60016002818180549050039150816105019190610924565b5060006003600085815260200190815260200160002081905550600191505061052b565b60009150505b919050565b60006001430340416002604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182805480156105aa57602002820191906000526020600020905b815481526020019060010190808311610596575b505093505050506040516020818303038152906040528051906020012060018190555090565b60008060036000848152602001908152602001600020541415610638576002829080600181540180825580915050906001820390600052602060002001600090919290919091505560036000848152602001908152602001600020819055506001905061063d565b600090505b919050565b6000806001905060008090505b83518110156109195783818151811061066457fe5b60200260200101518514156106f8577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf21360008583815181106106a257fe5b60200260200101516040518083151515158152602001828152602001806020018281038252602f815260200180610997602f9139604001935050505060405180910390a18180156106f1575060005b915061090c565b61071484828151811061070757fe5b602002602001015161042d565b156107bb577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf213600085838151811061074857fe5b60200260200101516040518083151515158152602001828152602001806020018281038252601b8152602001807f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250602001935050505060405180910390a18180156107b4575060005b915061090b565b60006107d98583815181106107cc57fe5b60200260200101516105d0565b905060608161081d576040518060400160405280601b81526020017f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250610837565b604051806060016040528060218152602001610976602191395b90507fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf2138287858151811061086757fe5b602002602001015183604051808415151515815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156108c05780820151818401526020810190506108a5565b50505050905090810190601f1680156108ed5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a18380156109065750815b935050505b5b808060010191505061064f565b508091505092915050565b81548183558181111561094b5781836000526020600020918201910161094a9190610950565b5b505050565b61097291905b8082111561096e576000816000905550600101610956565b5090565b9056fe4d656d626572206163636f756e74206164646564207375636365737366756c6c79416464696e67206f776e206163636f756e742061732061204d656d626572206973206e6f74207065726d6974746564a265627a7a723158202d88696da9f39c286f5e1cc5830df2599a4d57a91cdd982a4872494055ad40d464736f6c63430005110032"); public static final Bytes ADD_TO_GROUP_METHOD_SIGNATURE = Bytes.fromHexString("0xf744b089"); public static final Bytes CAN_EXECUTE_METHOD_SIGNATURE = Bytes.fromHexString("0x78b90337"); diff --git a/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyGroup.java b/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/DefaultOnChainPrivacyGroupManagementContract.java similarity index 66% rename from privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyGroup.java rename to privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/DefaultOnChainPrivacyGroupManagementContract.java index 0fa7ffd70e..802e237a61 100644 --- a/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyGroup.java +++ b/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/DefaultOnChainPrivacyGroupManagementContract.java @@ -31,7 +31,6 @@ import org.web3j.abi.datatypes.Event; import org.web3j.abi.datatypes.Type; import org.web3j.abi.datatypes.Utf8String; import org.web3j.abi.datatypes.generated.Bytes32; -import org.web3j.abi.datatypes.generated.Int256; import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.DefaultBlockParameter; @@ -54,12 +53,12 @@ import org.web3j.tx.gas.ContractGasProvider; * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the codegen module to update. * - *

Generated with web3j versionimport static org.junit.Assert.assertThat; 4.5.14. + *

Generated with web3j version 4.5.15. */ @SuppressWarnings("rawtypes") -public class PrivacyGroup extends Contract { +public class DefaultOnChainPrivacyGroupManagementContract extends Contract { public static final String BINARY = - "608060405234801561001057600080fd5b50610954806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806378b903371161005b57806378b9033714610173578063a69df4b514610195578063f744b0891461019f578063f83d08ba146102795761007d565b80630b0235be146100825780630d8e6e2c1461010557806361544c9114610123575b600080fd5b6100ae6004803603602081101561009857600080fd5b8101908080359060200190929190505050610283565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100f15780820151818401526020810190506100d6565b505050509050019250505060405180910390f35b61010d6102ef565b6040518082815260200191505060405180910390f35b6101596004803603604081101561013957600080fd5b8101908080359060200190929190803590602001909291905050506102f9565b604051808215151515815260200191505060405180910390f35b61017b61031e565b604051808215151515815260200191505060405180910390f35b61019d610334565b005b61025f600480360360408110156101b557600080fd5b8101908080359060200190929190803590602001906401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184602083028401116401000000008311171561021057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610369565b604051808215151515815260200191505060405180910390f35b6102816103f3565b005b606061028e82610427565b61029757600080fd5b60028054806020026020016040519081016040528092919081815260200182805480156102e357602002820191906000526020600020905b8154815260200190600101908083116102cf575b50505050509050919050565b6000600154905090565b600061030483610427565b61030d57600080fd5b61031682610447565b905092915050565b60008060009054906101000a900460ff16905090565b6000809054906101000a900460ff161561034d57600080fd5b60016000806101000a81548160ff021916908315150217905550565b60008060009054906101000a900460ff161561038457600080fd5b6000600280549050141561039d5761039b8361052a565b505b6103a683610427565b6103af57600080fd5b60006103bb848461059c565b905060016000806101000a81548160ff0219169083151502179055506001600081548092919060010191905055508091505092915050565b6000809054906101000a900460ff1661040b57600080fd5b60008060006101000a81548160ff021916908315150217905550565b600080600360008481526020019081526020016000205414159050919050565b6000806003600084815260200190815260200160002054905060008111801561047557506002805490508111155b1561051f5760028054905081146104e357600060026001600280549050038154811061049d57fe5b9060005260206000200154905080600260018403815481106104bb57fe5b9060005260206000200181905550816003600083815260200190815260200160002081905550505b60016002818180549050039150816104fb919061087e565b50600060036000858152602001908152602001600020819055506001915050610525565b60009150505b919050565b600080600360008481526020019081526020016000205414156105925760028290806001815401808255809150509060018203906000526020600020016000909192909190915055600360008481526020019081526020016000208190555060019050610597565b600090505b919050565b6000806001905060008090505b8351811015610873578381815181106105be57fe5b6020026020010151851415610652577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf21360008583815181106105fc57fe5b60200260200101516040518083151515158152602001828152602001806020018281038252602f8152602001806108f1602f9139604001935050505060405180910390a181801561064b575060005b9150610866565b61066e84828151811061066157fe5b6020026020010151610427565b15610715577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf21360008583815181106106a257fe5b60200260200101516040518083151515158152602001828152602001806020018281038252601b8152602001807f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250602001935050505060405180910390a181801561070e575060005b9150610865565b600061073385838151811061072657fe5b602002602001015161052a565b9050606081610777576040518060400160405280601b81526020017f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250610791565b6040518060600160405280602181526020016108d0602191395b90507fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf213828785815181106107c157fe5b602002602001015183604051808415151515815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561081a5780820151818401526020810190506107ff565b50505050905090810190601f1680156108475780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a18380156108605750815b935050505b5b80806001019150506105a9565b508091505092915050565b8154818355818111156108a5578183600052602060002091820191016108a491906108aa565b5b505050565b6108cc91905b808211156108c85760008160009055506001016108b0565b5090565b9056fe4d656d626572206163636f756e74206164646564207375636365737366756c6c79416464696e67206f776e206163636f756e742061732061204d656d626572206973206e6f74207065726d6974746564a265627a7a723158209b8cbc4503135a6654e90319f2db6e4559f25bd3ae7c55c69c7c7c52670c67fa64736f6c634300050c0032"; + "608060405234801561001057600080fd5b506109fa806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806378b903371161005b57806378b9033714610173578063a69df4b514610195578063f744b0891461019f578063f83d08ba146102795761007d565b80630b0235be146100825780630d8e6e2c1461010557806361544c9114610123575b600080fd5b6100ae6004803603602081101561009857600080fd5b8101908080359060200190929190505050610283565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156100f15780820151818401526020810190506100d6565b505050509050019250505060405180910390f35b61010d6102ef565b6040518082815260200191505060405180910390f35b6101596004803603604081101561013957600080fd5b8101908080359060200190929190803590602001909291905050506102f9565b604051808215151515815260200191505060405180910390f35b61017b61032d565b604051808215151515815260200191505060405180910390f35b61019d610343565b005b61025f600480360360408110156101b557600080fd5b8101908080359060200190929190803590602001906401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184602083028401116401000000008311171561021057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610378565b604051808215151515815260200191505060405180910390f35b6102816103f9565b005b606061028e8261042d565b61029757600080fd5b60028054806020026020016040519081016040528092919081815260200182805480156102e357602002820191906000526020600020905b8154815260200190600101908083116102cf575b50505050509050919050565b6000600154905090565b60006103048361042d565b61030d57600080fd5b60006103188361044d565b9050610322610530565b508091505092915050565b60008060009054906101000a900460ff16905090565b6000809054906101000a900460ff161561035c57600080fd5b60016000806101000a81548160ff021916908315150217905550565b60008060009054906101000a900460ff161561039357600080fd5b600060028054905014156103ac576103aa836105d0565b505b6103b58361042d565b6103be57600080fd5b60006103ca8484610642565b905060016000806101000a81548160ff0219169083151502179055506103ee610530565b508091505092915050565b6000809054906101000a900460ff1661041157600080fd5b60008060006101000a81548160ff021916908315150217905550565b600080600360008481526020019081526020016000205414159050919050565b6000806003600084815260200190815260200160002054905060008111801561047b57506002805490508111155b156105255760028054905081146104e95760006002600160028054905003815481106104a357fe5b9060005260206000200154905080600260018403815481106104c157fe5b9060005260206000200181905550816003600083815260200190815260200160002081905550505b60016002818180549050039150816105019190610924565b5060006003600085815260200190815260200160002081905550600191505061052b565b60009150505b919050565b60006001430340416002604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182805480156105aa57602002820191906000526020600020905b815481526020019060010190808311610596575b505093505050506040516020818303038152906040528051906020012060018190555090565b60008060036000848152602001908152602001600020541415610638576002829080600181540180825580915050906001820390600052602060002001600090919290919091505560036000848152602001908152602001600020819055506001905061063d565b600090505b919050565b6000806001905060008090505b83518110156109195783818151811061066457fe5b60200260200101518514156106f8577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf21360008583815181106106a257fe5b60200260200101516040518083151515158152602001828152602001806020018281038252602f815260200180610997602f9139604001935050505060405180910390a18180156106f1575060005b915061090c565b61071484828151811061070757fe5b602002602001015161042d565b156107bb577fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf213600085838151811061074857fe5b60200260200101516040518083151515158152602001828152602001806020018281038252601b8152602001807f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250602001935050505060405180910390a18180156107b4575060005b915061090b565b60006107d98583815181106107cc57fe5b60200260200101516105d0565b905060608161081d576040518060400160405280601b81526020017f4163636f756e7420697320616c72656164792061204d656d6265720000000000815250610837565b604051806060016040528060218152602001610976602191395b90507fcc7365305ae5f16c463d1383713d699f43c5548bbda5537ee61373ceb9aaf2138287858151811061086757fe5b602002602001015183604051808415151515815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156108c05780820151818401526020810190506108a5565b50505050905090810190601f1680156108ed5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a18380156109065750815b935050505b5b808060010191505061064f565b508091505092915050565b81548183558181111561094b5781836000526020600020918201910161094a9190610950565b5b505050565b61097291905b8082111561096e576000816000905550600101610956565b5090565b9056fe4d656d626572206163636f756e74206164646564207375636365737366756c6c79416464696e67206f776e206163636f756e742061732061204d656d626572206973206e6f74207065726d6974746564a265627a7a7231582072ad7e8bdc33e07430cb03b246b20c31c09189ccb0829a24e7a9c848aaa71c7e64736f6c63430005110032"; public static final String FUNC_ADDPARTICIPANTS = "addParticipants"; @@ -84,7 +83,7 @@ public class PrivacyGroup extends Contract { new TypeReference() {}));; @Deprecated - protected PrivacyGroup( + protected DefaultOnChainPrivacyGroupManagementContract( String contractAddress, Web3j web3j, Credentials credentials, @@ -93,7 +92,7 @@ public class PrivacyGroup extends Contract { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } - protected PrivacyGroup( + protected DefaultOnChainPrivacyGroupManagementContract( String contractAddress, Web3j web3j, Credentials credentials, @@ -102,7 +101,7 @@ public class PrivacyGroup extends Contract { } @Deprecated - protected PrivacyGroup( + protected DefaultOnChainPrivacyGroupManagementContract( String contractAddress, Web3j web3j, TransactionManager transactionManager, @@ -111,7 +110,7 @@ public class PrivacyGroup extends Contract { super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); } - protected PrivacyGroup( + protected DefaultOnChainPrivacyGroupManagementContract( String contractAddress, Web3j web3j, TransactionManager transactionManager, @@ -207,13 +206,13 @@ public class PrivacyGroup extends Contract { }); } - public RemoteFunctionCall getVersion() { + public RemoteFunctionCall getVersion() { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_GETVERSION, Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); } public RemoteFunctionCall lock() { @@ -243,67 +242,94 @@ public class PrivacyGroup extends Contract { } @Deprecated - public static PrivacyGroup load( + public static DefaultOnChainPrivacyGroupManagementContract load( String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new PrivacyGroup(contractAddress, web3j, credentials, gasPrice, gasLimit); + return new DefaultOnChainPrivacyGroupManagementContract( + contractAddress, web3j, credentials, gasPrice, gasLimit); } @Deprecated - public static PrivacyGroup load( + public static DefaultOnChainPrivacyGroupManagementContract load( String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new PrivacyGroup(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + return new DefaultOnChainPrivacyGroupManagementContract( + contractAddress, web3j, transactionManager, gasPrice, gasLimit); } - public static PrivacyGroup load( + public static DefaultOnChainPrivacyGroupManagementContract load( String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new PrivacyGroup(contractAddress, web3j, credentials, contractGasProvider); + return new DefaultOnChainPrivacyGroupManagementContract( + contractAddress, web3j, credentials, contractGasProvider); } - public static PrivacyGroup load( + public static DefaultOnChainPrivacyGroupManagementContract load( String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new PrivacyGroup(contractAddress, web3j, transactionManager, contractGasProvider); + return new DefaultOnChainPrivacyGroupManagementContract( + contractAddress, web3j, transactionManager, contractGasProvider); } - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { return deployRemoteCall( - PrivacyGroup.class, web3j, credentials, contractGasProvider, BINARY, ""); + DefaultOnChainPrivacyGroupManagementContract.class, + web3j, + credentials, + contractGasProvider, + BINARY, + ""); } @Deprecated - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(PrivacyGroup.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + return deployRemoteCall( + DefaultOnChainPrivacyGroupManagementContract.class, + web3j, + credentials, + gasPrice, + gasLimit, + BINARY, + ""); } - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { return deployRemoteCall( - PrivacyGroup.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + DefaultOnChainPrivacyGroupManagementContract.class, + web3j, + transactionManager, + contractGasProvider, + BINARY, + ""); } @Deprecated - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall( - PrivacyGroup.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + DefaultOnChainPrivacyGroupManagementContract.class, + web3j, + transactionManager, + gasPrice, + gasLimit, + BINARY, + ""); } public static class ParticipantAddedEventResponse extends BaseEventResponse { diff --git a/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyInterface.java b/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementInterface.java similarity index 76% rename from privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyInterface.java rename to privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementInterface.java index 3563b0c7fb..3253222510 100644 --- a/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyInterface.java +++ b/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementInterface.java @@ -26,7 +26,6 @@ import org.web3j.abi.datatypes.DynamicArray; import org.web3j.abi.datatypes.Function; import org.web3j.abi.datatypes.Type; import org.web3j.abi.datatypes.generated.Bytes32; -import org.web3j.abi.datatypes.generated.Int256; import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.RemoteCall; @@ -45,10 +44,10 @@ import org.web3j.tx.gas.ContractGasProvider; * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the codegen module to update. * - *

Generated with web3j version 4.5.14. + *

Generated with web3j version 4.5.15. */ @SuppressWarnings("rawtypes") -public class PrivacyInterface extends Contract { +public class OnChainPrivacyGroupManagementInterface extends Contract { public static final String BINARY = ""; public static final String FUNC_ADDPARTICIPANTS = "addParticipants"; @@ -66,7 +65,7 @@ public class PrivacyInterface extends Contract { public static final String FUNC_UNLOCK = "unlock"; @Deprecated - protected PrivacyInterface( + protected OnChainPrivacyGroupManagementInterface( String contractAddress, Web3j web3j, Credentials credentials, @@ -75,7 +74,7 @@ public class PrivacyInterface extends Contract { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } - protected PrivacyInterface( + protected OnChainPrivacyGroupManagementInterface( String contractAddress, Web3j web3j, Credentials credentials, @@ -84,7 +83,7 @@ public class PrivacyInterface extends Contract { } @Deprecated - protected PrivacyInterface( + protected OnChainPrivacyGroupManagementInterface( String contractAddress, Web3j web3j, TransactionManager transactionManager, @@ -93,7 +92,7 @@ public class PrivacyInterface extends Contract { super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); } - protected PrivacyInterface( + protected OnChainPrivacyGroupManagementInterface( String contractAddress, Web3j web3j, TransactionManager transactionManager, @@ -143,13 +142,13 @@ public class PrivacyInterface extends Contract { }); } - public RemoteFunctionCall getVersion() { + public RemoteFunctionCall getVersion() { final Function function = new Function( FUNC_GETVERSION, Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); } public RemoteFunctionCall lock() { @@ -177,67 +176,93 @@ public class PrivacyInterface extends Contract { } @Deprecated - public static PrivacyInterface load( + public static OnChainPrivacyGroupManagementInterface load( String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new PrivacyInterface(contractAddress, web3j, credentials, gasPrice, gasLimit); + return new OnChainPrivacyGroupManagementInterface( + contractAddress, web3j, credentials, gasPrice, gasLimit); } @Deprecated - public static PrivacyInterface load( + public static OnChainPrivacyGroupManagementInterface load( String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new PrivacyInterface(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + return new OnChainPrivacyGroupManagementInterface( + contractAddress, web3j, transactionManager, gasPrice, gasLimit); } - public static PrivacyInterface load( + public static OnChainPrivacyGroupManagementInterface load( String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new PrivacyInterface(contractAddress, web3j, credentials, contractGasProvider); + return new OnChainPrivacyGroupManagementInterface( + contractAddress, web3j, credentials, contractGasProvider); } - public static PrivacyInterface load( + public static OnChainPrivacyGroupManagementInterface load( String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new PrivacyInterface(contractAddress, web3j, transactionManager, contractGasProvider); + return new OnChainPrivacyGroupManagementInterface( + contractAddress, web3j, transactionManager, contractGasProvider); } - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { return deployRemoteCall( - PrivacyInterface.class, web3j, credentials, contractGasProvider, BINARY, ""); + OnChainPrivacyGroupManagementInterface.class, + web3j, + credentials, + contractGasProvider, + BINARY, + ""); } @Deprecated - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall( - PrivacyInterface.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + OnChainPrivacyGroupManagementInterface.class, + web3j, + credentials, + gasPrice, + gasLimit, + BINARY, + ""); } - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { return deployRemoteCall( - PrivacyInterface.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + OnChainPrivacyGroupManagementInterface.class, + web3j, + transactionManager, + contractGasProvider, + BINARY, + ""); } @Deprecated - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall( - PrivacyInterface.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + OnChainPrivacyGroupManagementInterface.class, + web3j, + transactionManager, + gasPrice, + gasLimit, + BINARY, + ""); } } diff --git a/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyProxy.java b/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementProxy.java similarity index 87% rename from privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyProxy.java rename to privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementProxy.java index 4726fdb893..112930ab60 100644 --- a/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/PrivacyProxy.java +++ b/privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnChainPrivacyGroupManagementProxy.java @@ -28,7 +28,6 @@ import org.web3j.abi.datatypes.DynamicArray; import org.web3j.abi.datatypes.Function; import org.web3j.abi.datatypes.Type; import org.web3j.abi.datatypes.generated.Bytes32; -import org.web3j.abi.datatypes.generated.Int256; import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.RemoteCall; @@ -47,12 +46,12 @@ import org.web3j.tx.gas.ContractGasProvider; * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the codegen module to update. * - *

Generated with web3j version 4.5.14. + *

Generated with web3j version 4.5.15. */ @SuppressWarnings("rawtypes") -public class PrivacyProxy extends Contract { +public class OnChainPrivacyGroupManagementProxy extends Contract { public static final String BINARY = - "608060405234801561001057600080fd5b50604051610a4f380380610a4f8339818101604052602081101561003357600080fd5b8101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506109bb806100946000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806361544c911161006657806361544c91146101c757806378b9033714610217578063a69df4b514610239578063f744b08914610243578063f83d08ba1461031d57610093565b80630b0235be146100985780630d8e6e2c1461011b5780633659cfe6146101395780635c60da1b1461017d575b600080fd5b6100c4600480360360208110156100ae57600080fd5b8101908080359060200190929190505050610327565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101075780820151818401526020810190506100ec565b505050509050019250505060405180910390f35b61012361047d565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561014f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061052b565b005b610185610591565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101fd600480360360408110156101dd57600080fd5b8101908080359060200190929190803590602001909291905050506105b6565b604051808215151515815260200191505060405180910390f35b61021f61067c565b604051808215151515815260200191505060405180910390f35b61024161072a565b005b6103036004803603604081101561025957600080fd5b81019080803590602001909291908035906020019064010000000081111561028057600080fd5b82018360208201111561029257600080fd5b803590602001918460208302840111640100000000831117156102b457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107b3565b604051808215151515815260200191505060405180910390f35b6103256108ba565b005b606060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630b0235be846040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156103de57600080fd5b81019080805160405193929190846401000000008211156103fe57600080fd5b8382019150602082018581111561041457600080fd5b825186602082028301116401000000008211171561043157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561046857808201518184015260208101905061044d565b50505050905001604052505050915050919050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630d8e6e2c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ea57600080fd5b505afa1580156104fe573d6000803e3d6000fd5b505050506040513d602081101561051457600080fd5b810190808051906020019092919050505091505090565b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561058557600080fd5b61058e81610943565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166361544c9185856040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b15801561063857600080fd5b505af115801561064c573d6000803e3d6000fd5b505050506040513d602081101561066257600080fd5b810190808051906020019092919050505091505092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166378b903376040518163ffffffff1660e01b815260040160206040518083038186803b1580156106e957600080fd5b505afa1580156106fd573d6000803e3d6000fd5b505050506040513d602081101561071357600080fd5b810190808051906020019092919050505091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a69df4b56040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561079857600080fd5b505af11580156107ac573d6000803e3d6000fd5b5050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f744b08985856040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610850578082015181840152602081019050610835565b505050509050019350505050602060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505050506040513d60208110156108a057600080fd5b810190808051906020019092919050505091505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f83d08ba6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092857600080fd5b505af115801561093c573d6000803e3d6000fd5b5050505050565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a72315820e33ecd4eea8b7a726b69d0db7cbc6b26d018a34ebd1b88911b5506edc542777264736f6c634300050c0032"; + "608060405234801561001057600080fd5b50604051610a4f380380610a4f8339818101604052602081101561003357600080fd5b8101908080519060200190929190505050806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506109bb806100946000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806361544c911161006657806361544c91146101c757806378b9033714610217578063a69df4b514610239578063f744b08914610243578063f83d08ba1461031d57610093565b80630b0235be146100985780630d8e6e2c1461011b5780633659cfe6146101395780635c60da1b1461017d575b600080fd5b6100c4600480360360208110156100ae57600080fd5b8101908080359060200190929190505050610327565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156101075780820151818401526020810190506100ec565b505050509050019250505060405180910390f35b61012361047d565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561014f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061052b565b005b610185610591565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101fd600480360360408110156101dd57600080fd5b8101908080359060200190929190803590602001909291905050506105b6565b604051808215151515815260200191505060405180910390f35b61021f61067c565b604051808215151515815260200191505060405180910390f35b61024161072a565b005b6103036004803603604081101561025957600080fd5b81019080803590602001909291908035906020019064010000000081111561028057600080fd5b82018360208201111561029257600080fd5b803590602001918460208302840111640100000000831117156102b457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506107b3565b604051808215151515815260200191505060405180910390f35b6103256108ba565b005b606060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630b0235be846040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b1580156103a057600080fd5b505afa1580156103b4573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156103de57600080fd5b81019080805160405193929190846401000000008211156103fe57600080fd5b8382019150602082018581111561041457600080fd5b825186602082028301116401000000008211171561043157600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561046857808201518184015260208101905061044d565b50505050905001604052505050915050919050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16630d8e6e2c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ea57600080fd5b505afa1580156104fe573d6000803e3d6000fd5b505050506040513d602081101561051457600080fd5b810190808051906020019092919050505091505090565b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561058557600080fd5b61058e81610943565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166361544c9185856040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b15801561063857600080fd5b505af115801561064c573d6000803e3d6000fd5b505050506040513d602081101561066257600080fd5b810190808051906020019092919050505091505092915050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166378b903376040518163ffffffff1660e01b815260040160206040518083038186803b1580156106e957600080fd5b505afa1580156106fd573d6000803e3d6000fd5b505050506040513d602081101561071357600080fd5b810190808051906020019092919050505091505090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663a69df4b56040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561079857600080fd5b505af11580156107ac573d6000803e3d6000fd5b5050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f744b08985856040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610850578082015181840152602081019050610835565b505050509050019350505050602060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505050506040513d60208110156108a057600080fd5b810190808051906020019092919050505091505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663f83d08ba6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561092857600080fd5b505af115801561093c573d6000803e3d6000fd5b5050505050565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fea265627a7a723158207fea7928b00fedaff98beadf2cfe879463becd0c33005dc70cf51f4d8ff0cb8c64736f6c63430005110032"; public static final String FUNC_ADDPARTICIPANTS = "addParticipants"; @@ -73,7 +72,7 @@ public class PrivacyProxy extends Contract { public static final String FUNC_UPGRADETO = "upgradeTo"; @Deprecated - protected PrivacyProxy( + protected OnChainPrivacyGroupManagementProxy( String contractAddress, Web3j web3j, Credentials credentials, @@ -82,7 +81,7 @@ public class PrivacyProxy extends Contract { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); } - protected PrivacyProxy( + protected OnChainPrivacyGroupManagementProxy( String contractAddress, Web3j web3j, Credentials credentials, @@ -91,7 +90,7 @@ public class PrivacyProxy extends Contract { } @Deprecated - protected PrivacyProxy( + protected OnChainPrivacyGroupManagementProxy( String contractAddress, Web3j web3j, TransactionManager transactionManager, @@ -100,7 +99,7 @@ public class PrivacyProxy extends Contract { super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); } - protected PrivacyProxy( + protected OnChainPrivacyGroupManagementProxy( String contractAddress, Web3j web3j, TransactionManager transactionManager, @@ -150,13 +149,13 @@ public class PrivacyProxy extends Contract { }); } - public RemoteFunctionCall getVersion() { + public RemoteFunctionCall getVersion() { final Function function = new Function( FUNC_GETVERSION, Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); } public RemoteFunctionCall implementation() { @@ -202,42 +201,46 @@ public class PrivacyProxy extends Contract { } @Deprecated - public static PrivacyProxy load( + public static OnChainPrivacyGroupManagementProxy load( String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new PrivacyProxy(contractAddress, web3j, credentials, gasPrice, gasLimit); + return new OnChainPrivacyGroupManagementProxy( + contractAddress, web3j, credentials, gasPrice, gasLimit); } @Deprecated - public static PrivacyProxy load( + public static OnChainPrivacyGroupManagementProxy load( String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new PrivacyProxy(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + return new OnChainPrivacyGroupManagementProxy( + contractAddress, web3j, transactionManager, gasPrice, gasLimit); } - public static PrivacyProxy load( + public static OnChainPrivacyGroupManagementProxy load( String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new PrivacyProxy(contractAddress, web3j, credentials, contractGasProvider); + return new OnChainPrivacyGroupManagementProxy( + contractAddress, web3j, credentials, contractGasProvider); } - public static PrivacyProxy load( + public static OnChainPrivacyGroupManagementProxy load( String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new PrivacyProxy(contractAddress, web3j, transactionManager, contractGasProvider); + return new OnChainPrivacyGroupManagementProxy( + contractAddress, web3j, transactionManager, contractGasProvider); } - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, @@ -246,10 +249,15 @@ public class PrivacyProxy extends Contract { FunctionEncoder.encodeConstructor( Arrays.asList(new org.web3j.abi.datatypes.Address(160, _implementation))); return deployRemoteCall( - PrivacyProxy.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); + OnChainPrivacyGroupManagementProxy.class, + web3j, + credentials, + contractGasProvider, + BINARY, + encodedConstructor); } - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, @@ -258,7 +266,7 @@ public class PrivacyProxy extends Contract { FunctionEncoder.encodeConstructor( Arrays.asList(new org.web3j.abi.datatypes.Address(160, _implementation))); return deployRemoteCall( - PrivacyProxy.class, + OnChainPrivacyGroupManagementProxy.class, web3j, transactionManager, contractGasProvider, @@ -267,7 +275,7 @@ public class PrivacyProxy extends Contract { } @Deprecated - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, Credentials credentials, BigInteger gasPrice, @@ -277,11 +285,17 @@ public class PrivacyProxy extends Contract { FunctionEncoder.encodeConstructor( Arrays.asList(new org.web3j.abi.datatypes.Address(160, _implementation))); return deployRemoteCall( - PrivacyProxy.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); + OnChainPrivacyGroupManagementProxy.class, + web3j, + credentials, + gasPrice, + gasLimit, + BINARY, + encodedConstructor); } @Deprecated - public static RemoteCall deploy( + public static RemoteCall deploy( Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, @@ -291,7 +305,7 @@ public class PrivacyProxy extends Contract { FunctionEncoder.encodeConstructor( Arrays.asList(new org.web3j.abi.datatypes.Address(160, _implementation))); return deployRemoteCall( - PrivacyProxy.class, + OnChainPrivacyGroupManagementProxy.class, web3j, transactionManager, gasPrice, diff --git a/privacy-contracts/src/main/solidity/DefaultOnChainPrivacyGroupManagementContract.sol b/privacy-contracts/src/main/solidity/DefaultOnChainPrivacyGroupManagementContract.sol index 03264778e6..1e6eec39ba 100644 --- a/privacy-contracts/src/main/solidity/DefaultOnChainPrivacyGroupManagementContract.sol +++ b/privacy-contracts/src/main/solidity/DefaultOnChainPrivacyGroupManagementContract.sol @@ -4,11 +4,11 @@ import "./OnChainPrivacyGroupManagementInterface.sol"; contract DefaultOnChainPrivacyGroupManagementContract is OnChainPrivacyGroupManagementInterface { bool private _canExecute; - int private _version; + bytes32 private _version; bytes32[] private distributionList; mapping(bytes32 => uint256) private distributionIndexOf; - function getVersion() external view returns (int) { + function getVersion() external view returns (bytes32) { return _version; } @@ -35,13 +35,15 @@ contract DefaultOnChainPrivacyGroupManagementContract is OnChainPrivacyGroupMana require(isMember(_enclaveKey)); bool result = addAll(_enclaveKey, _accounts); _canExecute = true; - _version++; + updateVersion(); return result; } function removeParticipant(bytes32 _enclaveKey, bytes32 _account) public returns (bool) { require(isMember(_enclaveKey)); - return removeInternal(_account); + bool result = removeInternal(_account); + updateVersion(); + return result; } function getParticipants(bytes32 _enclaveKey) public view returns (bytes32[] memory) { @@ -98,6 +100,10 @@ contract DefaultOnChainPrivacyGroupManagementContract is OnChainPrivacyGroupMana return false; } + function updateVersion() internal returns (int) { + _version = keccak256(abi.encodePacked(blockhash(block.number-1), block.coinbase, distributionList)); + } + event ParticipantAdded( bool adminAdded, bytes32 account, diff --git a/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementInterface.sol b/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementInterface.sol index 8c1b66f984..43f43512e6 100644 --- a/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementInterface.sol +++ b/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementInterface.sol @@ -14,5 +14,5 @@ interface OnChainPrivacyGroupManagementInterface { function canExecute() external view returns (bool); - function getVersion() external view returns (int); + function getVersion() external view returns (bytes32); } diff --git a/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementProxy.sol b/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementProxy.sol index f2feb613b8..ebdb721cc7 100644 --- a/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementProxy.sol +++ b/privacy-contracts/src/main/solidity/OnChainPrivacyGroupManagementProxy.sol @@ -49,7 +49,7 @@ contract OnChainPrivacyGroupManagementProxy is OnChainPrivacyGroupManagementInte return privacyInterface.canExecute(); } - function getVersion() public view returns (int) { + function getVersion() public view returns (bytes32) { OnChainPrivacyGroupManagementInterface privacyInterface = OnChainPrivacyGroupManagementInterface(implementation); return privacyInterface.getVersion(); } diff --git a/privacy-contracts/src/main/solidity/generateWrappers.sh b/privacy-contracts/src/main/solidity/generateWrappers.sh index efd32d46fb..fe97ee3f81 100755 --- a/privacy-contracts/src/main/solidity/generateWrappers.sh +++ b/privacy-contracts/src/main/solidity/generateWrappers.sh @@ -22,4 +22,5 @@ for target in ${targets}; do -o ../java \ -p org.hyperledger.besu.privacy.contracts.generated + solc --bin-runtime --overwrite -o . ./${target}.sol done \ No newline at end of file