Rename: OnChain -> onchain (#2806)

* onChain -> onchain
* OnChain -> Onchain

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/2815/head
Sally MacFarlane 3 years ago committed by GitHub
parent f23e88715a
commit 84f58a9aa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java
  2. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/privacy/PrivacyNodeFactory.java
  3. 12
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/ExpectValidOnchainPrivacyGroupCreated.java
  4. 14
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/condition/PrivateTransactionVerifier.java
  5. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/CallOnchainPermissioningPrivateSmartContractFunction.java
  6. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/contract/PrivateContractTransactions.java
  7. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/AddToOnchainPrivacyGroupTransaction.java
  8. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/CreateOnchainPrivacyGroupTransaction.java
  9. 10
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/FindOnchainPrivacyGroupTransaction.java
  10. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/LockOnchainPrivacyGroupTransaction.java
  11. 28
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/PrivacyTransactions.java
  12. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/RemoveFromOnchainPrivacyGroupTransaction.java
  13. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/transaction/UnlockOnchainPrivacyGroupTransaction.java
  14. 24
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivacyRequestFactory.java
  15. 14
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AccountLocalAndOnchainPermissioningAcceptanceTest.java
  16. 14
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeLocalAndOnchainPermissioningAcceptanceTest.java
  17. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningAcceptanceTest.java
  18. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningV2AcceptanceTest.java
  19. 14
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/PrivDebugGetStateRootOnchainGroupAcceptanceTest.java
  20. 32
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/privacy/multitenancy/OnchainMultiTenancyAcceptanceTest.java
  21. 68
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/OnchainPrivacyAcceptanceTest.java
  22. 30
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/OnchainPrivacyAcceptanceTestBase.java
  23. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyGroupTest.java
  24. 68
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/contracts/PrivacyProxyTest.java
  25. 6
      besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
  26. 6
      besu/src/test/java/org/hyperledger/besu/PrivacyTest.java
  27. 4
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  28. 2
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolSchedule.java
  29. 4
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftBlockHashing.java
  30. 4
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftBlockHeaderFunctions.java
  31. 2
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftHelpers.java
  32. 2
      consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/queries/BftQueryServiceImplTest.java
  33. 2
      consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java
  34. 6
      consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/BftBlockHashingTest.java
  35. 2
      consensus/ibftlegacy/src/main/java/org/hyperledger/besu/consensus/ibftlegacy/IbftBlockHashing.java
  36. 2
      consensus/ibftlegacy/src/main/java/org/hyperledger/besu/consensus/ibftlegacy/LegacyIbftBlockHeaderFunctions.java
  37. 4
      consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java
  38. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/RestrictedOffchainEeaSendRawTransaction.java
  39. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/RestrictedOnchainEeaSendRawTransaction.java
  40. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/privx/PrivxFindOnchainPrivacyGroup.java
  41. 8
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/EeaJsonRpcMethods.java
  42. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/PrivxJsonRpcMethods.java
  43. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/EeaSendRawTransactionTest.java
  44. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/RestrictedOffchainEeaSendRawTransactionTest.java
  45. 18
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/eea/RestrictedOnchainEeaSendRawTransactionTest.java
  46. 26
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/privacy/methods/privx/PrivxFindOnchainPrivacyGroupTest.java
  47. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/PrivxJsonRpcMethodsTest.java
  48. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetPrecompiledContractRegistries.java
  49. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PrivacyBlockProcessor.java
  50. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolSpecBuilder.java
  51. 18
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/OnchainPrivacyPrecompiledContract.java
  52. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/OnchainPrivacyGroupContract.java
  53. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PluginPrivacyController.java
  54. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivacyController.java
  55. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivacyGroupUtil.java
  56. 6
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/PrivateStateGenesisAllocator.java
  57. 20
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/RestrictedDefaultPrivacyController.java
  58. 8
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/RestrictedMultiTenancyPrivacyController.java
  59. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/privacy/group/OnchainGroupManagement.java
  60. 4
      ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/PrivateTransactionDataFixture.java
  61. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetPrecompiledContractRegistriesTest.java
  62. 6
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PrivacyBlockProcessorTest.java
  63. 26
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/precompiles/privacy/OnchainPrivacyPrecompiledContractTest.java
  64. 12
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/PrivateStateGenesisAllocatorTest.java
  65. 8
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/PrivateTransactionLocatorTest.java
  66. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/privacy/RestrictedDefaultPrivacyControllerTest.java
  67. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/vm/BlockHashLookupTest.java
  68. 2
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolTest.java
  69. 2
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/IBFTGenesisFileModule.java
  70. 4
      ethereum/permissioning/src/main/java/org/hyperledger/besu/ethereum/permissioning/account/AccountPermissioningController.java
  71. 2
      evm/src/main/java/org/hyperledger/besu/evm/processor/MessageCallProcessor.java
  72. 42
      privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/DefaultOnchainPrivacyGroupManagementContract.java
  73. 42
      privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnchainPrivacyGroupManagementInterface.java
  74. 42
      privacy-contracts/src/main/java/org/hyperledger/besu/privacy/contracts/generated/OnchainPrivacyGroupManagementProxy.java

@ -212,14 +212,14 @@ public class BesuNodeFactory {
final String enclaveUrl,
final String authFile,
final String privTransactionSigningKey,
final boolean enableOnChainPrivacy)
final boolean enableOnchainPrivacy)
throws IOException, URISyntaxException {
final PrivacyParameters.Builder privacyParametersBuilder = new PrivacyParameters.Builder();
final PrivacyParameters privacyParameters =
privacyParametersBuilder
.setMultiTenancyEnabled(true)
.setEnabled(true)
.setOnchainPrivacyGroupsEnabled(enableOnChainPrivacy)
.setOnchainPrivacyGroupsEnabled(enableOnchainPrivacy)
.setStorageProvider(new InMemoryPrivacyStorageProvider())
.setEnclaveFactory(new EnclaveFactory(Vertx.vertx()))
.setEnclaveUrl(URI.create(enclaveUrl))

@ -244,7 +244,7 @@ public class PrivacyNodeFactory {
containerNetwork);
}
public PrivacyNode createOnChainPrivacyGroupEnabledMinerNode(
public PrivacyNode createOnchainPrivacyGroupEnabledMinerNode(
final String name,
final PrivacyAccount privacyAccount,
final boolean multiTenancyEnabled,
@ -278,7 +278,7 @@ public class PrivacyNodeFactory {
containerNetwork);
}
public PrivacyNode createOnChainPrivacyGroupEnabledNode(
public PrivacyNode createOnchainPrivacyGroupEnabledNode(
final String name,
final PrivacyAccount privacyAccount,
final boolean multiTenancyEnabled,

@ -25,14 +25,14 @@ import java.util.List;
import org.awaitility.Awaitility;
import org.web3j.utils.Base64String;
public class ExpectValidOnChainPrivacyGroupCreated implements PrivateCondition {
public class ExpectValidOnchainPrivacyGroupCreated implements PrivateCondition {
private final PrivacyTransactions transactions;
private final PrivacyRequestFactory.OnChainPrivacyGroup expected;
private final PrivacyRequestFactory.OnchainPrivacyGroup expected;
public ExpectValidOnChainPrivacyGroupCreated(
public ExpectValidOnchainPrivacyGroupCreated(
final PrivacyTransactions transactions,
final PrivacyRequestFactory.OnChainPrivacyGroup expected) {
final PrivacyRequestFactory.OnchainPrivacyGroup expected) {
this.transactions = transactions;
this.expected = expected;
}
@ -42,9 +42,9 @@ public class ExpectValidOnChainPrivacyGroupCreated implements PrivateCondition {
Awaitility.await()
.untilAsserted(
() -> {
final List<PrivacyRequestFactory.OnChainPrivacyGroup> groups =
final List<PrivacyRequestFactory.OnchainPrivacyGroup> groups =
node.execute(
transactions.findOnChainPrivacyGroup(
transactions.findOnchainPrivacyGroup(
Base64String.unwrapList(expected.getMembers())));
assertThat(groups).contains(expected);
});

@ -16,7 +16,7 @@ package org.hyperledger.besu.tests.acceptance.dsl.privacy.condition;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.PrivacyTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory.OnChainPrivacyGroup;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory.OnchainPrivacyGroup;
import java.util.Arrays;
import java.util.List;
@ -53,7 +53,7 @@ public class PrivateTransactionVerifier {
return new ExpectValidPrivacyGroupCreated(transactions, expected);
}
public ExpectValidOnChainPrivacyGroupCreated onChainPrivacyGroupExists(
public ExpectValidOnchainPrivacyGroupCreated onchainPrivacyGroupExists(
final String privacyGroupId, final PrivacyNode... members) {
final List<Base64String> membersEnclaveKeys =
@ -61,16 +61,16 @@ public class PrivateTransactionVerifier {
.map(PrivacyNode::getEnclaveKey)
.map(Base64String::wrap)
.collect(Collectors.toList());
return onChainPrivacyGroupExists(privacyGroupId, membersEnclaveKeys);
return onchainPrivacyGroupExists(privacyGroupId, membersEnclaveKeys);
}
public ExpectValidOnChainPrivacyGroupCreated onChainPrivacyGroupExists(
public ExpectValidOnchainPrivacyGroupCreated onchainPrivacyGroupExists(
final String privacyGroupId, final List<Base64String> membersEnclaveKeys) {
final OnChainPrivacyGroup expectedGroup =
new OnChainPrivacyGroup(privacyGroupId, membersEnclaveKeys);
final OnchainPrivacyGroup expectedGroup =
new OnchainPrivacyGroup(privacyGroupId, membersEnclaveKeys);
return new ExpectValidOnChainPrivacyGroupCreated(transactions, expectedGroup);
return new ExpectValidOnchainPrivacyGroupCreated(transactions, expectedGroup);
}
public ExpectInternalErrorPrivateTransactionReceipt internalErrorPrivateTransactionReceipt(

@ -26,7 +26,7 @@ import org.web3j.tx.gas.BesuPrivacyGasProvider;
import org.web3j.utils.Base64String;
import org.web3j.utils.Restriction;
public class CallOnChainPermissioningPrivateSmartContractFunction implements Transaction<String> {
public class CallOnchainPermissioningPrivateSmartContractFunction implements Transaction<String> {
private static final BesuPrivacyGasProvider GAS_PROVIDER =
new BesuPrivacyGasProvider(BigInteger.valueOf(1000));
@ -36,7 +36,7 @@ public class CallOnChainPermissioningPrivateSmartContractFunction implements Tra
private final Base64String privateFrom;
private final Base64String privacyGroupId;
public CallOnChainPermissioningPrivateSmartContractFunction(
public CallOnchainPermissioningPrivateSmartContractFunction(
final String contractAddress,
final String encodedFunction,
final String transactionSigningKey,

@ -142,13 +142,13 @@ public class PrivateContractTransactions {
contractAddress, clazz, transactionSigningKey, privateFrom, privacyGroupId);
}
public CallOnChainPermissioningPrivateSmartContractFunction callOnChainPermissioningSmartContract(
public CallOnchainPermissioningPrivateSmartContractFunction callOnchainPermissioningSmartContract(
final String contractAddress,
final String encodedFunction,
final String transactionSigningKey,
final String privateFrom,
final String privacyGroupId) {
return new CallOnChainPermissioningPrivateSmartContractFunction(
return new CallOnchainPermissioningPrivateSmartContractFunction(
contractAddress, encodedFunction, transactionSigningKey, privateFrom, privacyGroupId);
}
}

@ -26,13 +26,13 @@ import java.util.stream.Collectors;
import org.web3j.crypto.Credentials;
import org.web3j.utils.Base64String;
public class AddToOnChainPrivacyGroupTransaction implements Transaction<String> {
public class AddToOnchainPrivacyGroupTransaction implements Transaction<String> {
private final Base64String privacyGroupId;
private final PrivacyNode adder;
private final List<String> addresses;
private final Credentials signer;
public AddToOnChainPrivacyGroupTransaction(
public AddToOnchainPrivacyGroupTransaction(
final String privacyGroupId,
final PrivacyNode adder,
final Credentials signer,

@ -22,13 +22,13 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequ
import java.io.IOException;
import java.util.List;
public class CreateOnChainPrivacyGroupTransaction
public class CreateOnchainPrivacyGroupTransaction
implements Transaction<PrivxCreatePrivacyGroupResponse> {
private final PrivacyNode creator;
private final List<String> addresses;
private final String privateFrom;
CreateOnChainPrivacyGroupTransaction(
CreateOnchainPrivacyGroupTransaction(
final PrivacyNode creator, final String privateFrom, final List<String> addresses) {
this.creator = creator;
this.addresses = addresses;

@ -27,19 +27,19 @@ import java.util.stream.Collectors;
import org.web3j.utils.Base64String;
public class FindOnChainPrivacyGroupTransaction
implements Transaction<List<PrivacyRequestFactory.OnChainPrivacyGroup>> {
public class FindOnchainPrivacyGroupTransaction
implements Transaction<List<PrivacyRequestFactory.OnchainPrivacyGroup>> {
private final List<Base64String> nodes;
public FindOnChainPrivacyGroupTransaction(final List<String> nodeEnclaveKeys) {
public FindOnchainPrivacyGroupTransaction(final List<String> nodeEnclaveKeys) {
this.nodes = nodeEnclaveKeys.stream().map(Base64String::wrap).collect(Collectors.toList());
}
@Override
public List<PrivacyRequestFactory.OnChainPrivacyGroup> execute(final NodeRequests node) {
public List<PrivacyRequestFactory.OnchainPrivacyGroup> execute(final NodeRequests node) {
try {
PrivxFindPrivacyGroupResponse result =
node.privacy().privxFindOnChainPrivacyGroup(nodes).send();
node.privacy().privxFindOnchainPrivacyGroup(nodes).send();
assertThat(result).isNotNull();
if (result.hasError()) {
throw new RuntimeException(result.getError().getMessage());

@ -24,12 +24,12 @@ import org.web3j.crypto.Credentials;
import org.web3j.protocol.exceptions.TransactionException;
import org.web3j.utils.Base64String;
public class LockOnChainPrivacyGroupTransaction implements Transaction<String> {
public class LockOnchainPrivacyGroupTransaction implements Transaction<String> {
private final Base64String privacyGroupId;
private final PrivacyNode locker;
private final Credentials signer;
public LockOnChainPrivacyGroupTransaction(
public LockOnchainPrivacyGroupTransaction(
final String privacyGroupId, final PrivacyNode locker, final Credentials signer) {
this.privacyGroupId = Base64String.wrap(privacyGroupId);
this.locker = locker;

@ -51,44 +51,44 @@ public class PrivacyTransactions {
return new RestrictedCreatePrivacyGroupTransaction(name, description, nodes);
}
public CreateOnChainPrivacyGroupTransaction createOnChainPrivacyGroup(
public CreateOnchainPrivacyGroupTransaction createOnchainPrivacyGroup(
final PrivacyNode creator,
final String privateFrom,
final List<String> addresses,
final String token) {
creator.getBesu().useAuthenticationTokenInHeaderForJsonRpc(token);
return new CreateOnChainPrivacyGroupTransaction(creator, privateFrom, addresses);
return new CreateOnchainPrivacyGroupTransaction(creator, privateFrom, addresses);
}
public CreateOnChainPrivacyGroupTransaction createOnChainPrivacyGroup(
public CreateOnchainPrivacyGroupTransaction createOnchainPrivacyGroup(
final PrivacyNode creator, final String privateFrom, final List<String> addresses) {
return new CreateOnChainPrivacyGroupTransaction(creator, privateFrom, addresses);
return new CreateOnchainPrivacyGroupTransaction(creator, privateFrom, addresses);
}
public AddToOnChainPrivacyGroupTransaction addToPrivacyGroup(
public AddToOnchainPrivacyGroupTransaction addToPrivacyGroup(
final String privacyGroupId,
final PrivacyNode adder,
final Credentials signer,
final PrivacyNode... nodes) {
return new AddToOnChainPrivacyGroupTransaction(privacyGroupId, adder, signer, nodes);
return new AddToOnchainPrivacyGroupTransaction(privacyGroupId, adder, signer, nodes);
}
public LockOnChainPrivacyGroupTransaction privxLockPrivacyGroupAndCheck(
public LockOnchainPrivacyGroupTransaction privxLockPrivacyGroupAndCheck(
final String privacyGroupId, final PrivacyNode locker, final Credentials signer) {
return new LockOnChainPrivacyGroupTransaction(privacyGroupId, locker, signer);
return new LockOnchainPrivacyGroupTransaction(privacyGroupId, locker, signer);
}
public UnlockOnChainPrivacyGroupTransaction privxUnlockPrivacyGroupAndCheck(
public UnlockOnchainPrivacyGroupTransaction privxUnlockPrivacyGroupAndCheck(
final String privacyGroupId, final PrivacyNode locker, final Credentials signer) {
return new UnlockOnChainPrivacyGroupTransaction(privacyGroupId, locker, signer);
return new UnlockOnchainPrivacyGroupTransaction(privacyGroupId, locker, signer);
}
public FindPrivacyGroupTransaction findPrivacyGroup(final List<String> nodes) {
return new FindPrivacyGroupTransaction(nodes);
}
public FindOnChainPrivacyGroupTransaction findOnChainPrivacyGroup(final List<String> nodes) {
return new FindOnChainPrivacyGroupTransaction(nodes);
public FindOnchainPrivacyGroupTransaction findOnchainPrivacyGroup(final List<String> nodes) {
return new FindOnchainPrivacyGroupTransaction(nodes);
}
public PrivDistributeTransactionTransaction privDistributeTransaction(
@ -115,12 +115,12 @@ public class PrivacyTransactions {
return new PrivGetLogsTransaction(privacyGroupId, filterParameter);
}
public RemoveFromOnChainPrivacyGroupTransaction removeFromPrivacyGroup(
public RemoveFromOnchainPrivacyGroupTransaction removeFromPrivacyGroup(
final String privacyGroupId,
final String remover,
final Credentials signer,
final String memberToRemove) {
return new RemoveFromOnChainPrivacyGroupTransaction(
return new RemoveFromOnchainPrivacyGroupTransaction(
privacyGroupId, remover, signer, memberToRemove);
}

@ -22,13 +22,13 @@ import java.io.IOException;
import org.web3j.crypto.Credentials;
import org.web3j.utils.Base64String;
public class RemoveFromOnChainPrivacyGroupTransaction implements Transaction<String> {
public class RemoveFromOnchainPrivacyGroupTransaction implements Transaction<String> {
private final Base64String privacyGroupId;
private final String remover;
private final String toRemove;
private final Credentials signer;
public RemoveFromOnChainPrivacyGroupTransaction(
public RemoveFromOnchainPrivacyGroupTransaction(
final String privacyGroupId,
final String remover,
final Credentials signer,

@ -24,12 +24,12 @@ import org.web3j.crypto.Credentials;
import org.web3j.protocol.exceptions.TransactionException;
import org.web3j.utils.Base64String;
public class UnlockOnChainPrivacyGroupTransaction implements Transaction<String> {
public class UnlockOnchainPrivacyGroupTransaction implements Transaction<String> {
private final Base64String privacyGroupId;
private final PrivacyNode locker;
private final Credentials signer;
public UnlockOnChainPrivacyGroupTransaction(
public UnlockOnchainPrivacyGroupTransaction(
final String privacyGroupId, final PrivacyNode locker, final Credentials signer) {
this.privacyGroupId = Base64String.wrap(privacyGroupId);
this.locker = locker;

@ -24,7 +24,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.enclave.types.PrivacyGroup;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.parameters.CreatePrivacyGroupParameter;
import org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement;
import org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivateTransactionGroupResponse;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.util.LogFilterJsonParameter;
@ -232,7 +232,7 @@ public class PrivacyRequestFactory {
}
private Bytes encodeRemoveFromGroupFunctionCall(final Bytes toRemove) {
return Bytes.concatenate(OnChainGroupManagement.REMOVE_PARTICIPANT_METHOD_SIGNATURE, toRemove);
return Bytes.concatenate(OnchainGroupManagement.REMOVE_PARTICIPANT_METHOD_SIGNATURE, toRemove);
}
public String privxLockPrivacyGroup(
@ -242,7 +242,7 @@ public class PrivacyRequestFactory {
locker,
privacyGroupId,
signer,
OnChainGroupManagement.LOCK_GROUP_METHOD_SIGNATURE.toHexString());
OnchainGroupManagement.LOCK_GROUP_METHOD_SIGNATURE.toHexString());
}
public String privxUnlockPrivacyGroup(
@ -252,7 +252,7 @@ public class PrivacyRequestFactory {
locker,
privacyGroupId,
signer,
OnChainGroupManagement.UNLOCK_GROUP_METHOD_SIGNATURE.toHexString());
OnchainGroupManagement.UNLOCK_GROUP_METHOD_SIGNATURE.toHexString());
}
private String privxLockOrUnlockPrivacyGroup(
@ -327,7 +327,7 @@ public class PrivacyRequestFactory {
return new PrivxCreatePrivacyGroupResponse(privacyGroupId.toBase64String(), transactionHash);
}
public Request<?, PrivxFindPrivacyGroupResponse> privxFindOnChainPrivacyGroup(
public Request<?, PrivxFindPrivacyGroupResponse> privxFindOnchainPrivacyGroup(
final List<Base64String> nodes) {
return new Request<>(
"privx_findOnChainPrivacyGroup",
@ -487,14 +487,14 @@ public class PrivacyRequestFactory {
DebugGetStateRoot.class);
}
public static class PrivxFindPrivacyGroupResponse extends Response<List<OnChainPrivacyGroup>> {
public static class PrivxFindPrivacyGroupResponse extends Response<List<OnchainPrivacyGroup>> {
public List<OnChainPrivacyGroup> getGroups() {
public List<OnchainPrivacyGroup> getGroups() {
return getResult();
}
}
public static class OnChainPrivacyGroup {
public static class OnchainPrivacyGroup {
private final Base64String privacyGroupId;
private final List<Base64String> members;
@ -506,7 +506,7 @@ public class PrivacyRequestFactory {
}
@JsonCreator
public OnChainPrivacyGroup(
public OnchainPrivacyGroup(
@JsonProperty(value = "privacyGroupId") final String privacyGroupId,
@JsonProperty(value = "type") final Type type,
@JsonProperty(value = "name") final String name,
@ -515,7 +515,7 @@ public class PrivacyRequestFactory {
this(privacyGroupId, members);
}
public OnChainPrivacyGroup(final String privacyGroupId, final List<Base64String> members) {
public OnchainPrivacyGroup(final String privacyGroupId, final List<Base64String> members) {
this.privacyGroupId = Base64String.wrap(privacyGroupId);
this.name = "";
this.description = "";
@ -550,7 +550,7 @@ public class PrivacyRequestFactory {
if (o == null || getClass() != o.getClass()) {
return false;
}
final OnChainPrivacyGroup that = (OnChainPrivacyGroup) o;
final OnchainPrivacyGroup that = (OnchainPrivacyGroup) o;
return getPrivacyGroupId().equals(that.getPrivacyGroupId())
&& getName().equals(that.getName())
&& getDescription().equals(that.getDescription())
@ -589,7 +589,7 @@ public class PrivacyRequestFactory {
private Bytes encodeAddToGroupFunctionCall(final List<Bytes> participants) {
return Bytes.concatenate(
OnChainGroupManagement.ADD_PARTICIPANTS_METHOD_SIGNATURE, encodeList(participants));
OnchainGroupManagement.ADD_PARTICIPANTS_METHOD_SIGNATURE, encodeList(participants));
}
private Bytes encodeList(final List<Bytes> participants) {

@ -24,7 +24,7 @@ import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
public class AccountLocalAndOnChainPermissioningAcceptanceTest
public class AccountLocalAndOnchainPermissioningAcceptanceTest
extends AccountSmartContractPermissioningAcceptanceTestBase {
private Account senderC;
@ -36,7 +36,7 @@ public class AccountLocalAndOnChainPermissioningAcceptanceTest
@Test
public void testAccountCannotSendTxWhenNotOnLocalAllowList() {
// OnChain allowlist: Primary, Secondary, C
// Onchain allowlist: Primary, Secondary, C
// Local allowlist: Primary, Secondary
final Node node =
@ -51,7 +51,7 @@ public class AccountLocalAndOnChainPermissioningAcceptanceTest
node.execute(accountTransactions.createTransfer(senderC, 10));
node.verify(senderC.balanceEquals(10));
// add accounts to onChain allowlist
// add accounts to onchain allowlist
node.execute(allowAccount(accounts.getPrimaryBenefactor()));
node.verify(accountIsAllowed(accounts.getPrimaryBenefactor()));
@ -66,8 +66,8 @@ public class AccountLocalAndOnChainPermissioningAcceptanceTest
}
@Test
public void testAccountCannotSendTxWhenNotOnOnChainAllowList() {
// OnChain allowlist: Primary, Secondary, Receiver
public void testAccountCannotSendTxWhenNotOnOnchainAllowList() {
// Onchain allowlist: Primary, Secondary, Receiver
// Local allowlist: Primary, Secondary, C, Receiver
final Account receiverAccount = accounts.createAccount("Rec-A");
@ -86,7 +86,7 @@ public class AccountLocalAndOnChainPermissioningAcceptanceTest
node.execute(accountTransactions.createTransfer(senderC, 10));
node.verify(senderC.balanceEquals(10));
// add accounts to onChain allowlist
// add accounts to onchain allowlist
node.execute(allowAccount(accounts.getPrimaryBenefactor()));
node.verify(accountIsAllowed(accounts.getPrimaryBenefactor()));
@ -96,7 +96,7 @@ public class AccountLocalAndOnChainPermissioningAcceptanceTest
node.execute(allowAccount(receiverAccount));
node.verify(accountIsAllowed(receiverAccount));
// verify senderC is forbidden because it is not on OnChain allowlist
// verify senderC is forbidden because it is not on Onchain allowlist
node.verify(accountIsForbidden(senderC));
// sender C should not be able to send Tx

@ -19,7 +19,7 @@ import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.junit.Before;
import org.junit.Test;
public class NodeLocalAndOnChainPermissioningAcceptanceTest
public class NodeLocalAndOnchainPermissioningAcceptanceTest
extends NodeSmartContractPermissioningAcceptanceTestBase {
private Node bootnode;
@ -37,13 +37,13 @@ public class NodeLocalAndOnChainPermissioningAcceptanceTest
}
@Test
public void testNodeCannotConnectWhenAllowedOnChainButNotLocally() {
public void testNodeCannotConnectWhenAllowedOnchainButNotLocally() {
// add permissioned node after cluster start because we need enode URI for local config
permissionedNode = permissionedNode("permissioned-node", bootnode, allowedNode);
permissionedCluster.addNode(permissionedNode);
// update OnChain smart contract with allowed nodes
// update Onchain smart contract with allowed nodes
permissionedNode.execute(allowNode(bootnode));
permissionedNode.verify(nodeIsAllowed(bootnode));
@ -60,7 +60,7 @@ public class NodeLocalAndOnChainPermissioningAcceptanceTest
}
@Test
public void testNodeCannotConnectWhenAllowedLocallyButNotOnChain() {
public void testNodeCannotConnectWhenAllowedLocallyButNotOnchain() {
// onchain allowlist: A, B
// local allowlist: A, B, C
@ -68,7 +68,7 @@ public class NodeLocalAndOnChainPermissioningAcceptanceTest
permissionedNode = permissionedNode("permissioned-node", bootnode, allowedNode, forbiddenNode);
permissionedCluster.addNode(permissionedNode);
// update OnChain smart contract with allowed nodes
// update Onchain smart contract with allowed nodes
permissionedNode.execute(allowNode(bootnode));
permissionedNode.verify(nodeIsAllowed(bootnode));
@ -82,12 +82,12 @@ public class NodeLocalAndOnChainPermissioningAcceptanceTest
}
@Test
public void testNodesCanConnectWhenAllowedBothOnChainAndLocally() {
public void testNodesCanConnectWhenAllowedBothOnchainAndLocally() {
// add permissioned node after cluster start because we need enode URI for local config
permissionedNode = permissionedNode("permissioned-node", bootnode, allowedNode, forbiddenNode);
permissionedCluster.addNode(permissionedNode);
// update OnChain smart contract with allowed nodes
// update Onchain smart contract with allowed nodes
permissionedNode.execute(allowNode(bootnode));
permissionedNode.verify(nodeIsAllowed(bootnode));

@ -80,7 +80,7 @@ public class NodeSmartContractPermissioningAcceptanceTest
}
@Test
public void onChainPermissioningAllowlistShouldPersistAcrossRestarts() {
public void onchainPermissioningAllowlistShouldPersistAcrossRestarts() {
permissionedCluster.stop();
permissionedCluster.start(bootnode, forbiddenNode, allowedNode, permissionedNode);

@ -97,7 +97,7 @@ public class NodeSmartContractPermissioningV2AcceptanceTest
}
@Test
public void onChainPermissioningAllowlistShouldPersistAcrossRestarts() {
public void onchainPermissioningAllowlistShouldPersistAcrossRestarts() {
permissionedCluster.stop();
permissionedCluster.start(bootnode, forbiddenNode, allowedNode, permissionedNode);

@ -21,7 +21,7 @@ import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.account.PrivacyAccountResolver;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory;
import org.hyperledger.besu.tests.web3j.generated.EventEmitter;
import org.hyperledger.besu.tests.web3j.privacy.OnChainPrivacyAcceptanceTestBase;
import org.hyperledger.besu.tests.web3j.privacy.OnchainPrivacyAcceptanceTestBase;
import org.hyperledger.enclave.testutil.EnclaveType;
import java.io.IOException;
@ -42,7 +42,7 @@ import org.testcontainers.containers.Network;
@RunWith(Parameterized.class)
public class PrivDebugGetStateRootOnchainGroupAcceptanceTest
extends OnChainPrivacyAcceptanceTestBase {
extends OnchainPrivacyAcceptanceTestBase {
private final EnclaveType enclaveType;
@ -65,14 +65,14 @@ public class PrivDebugGetStateRootOnchainGroupAcceptanceTest
final Network containerNetwork = Network.newNetwork();
aliceNode =
privacyBesu.createOnChainPrivacyGroupEnabledMinerNode(
privacyBesu.createOnchainPrivacyGroupEnabledMinerNode(
"alice-node",
PrivacyAccountResolver.ALICE,
false,
enclaveType,
Optional.of(containerNetwork));
bobNode =
privacyBesu.createOnChainPrivacyGroupEnabledNode(
privacyBesu.createOnchainPrivacyGroupEnabledNode(
"bob-node",
PrivacyAccountResolver.BOB,
false,
@ -84,7 +84,7 @@ public class PrivDebugGetStateRootOnchainGroupAcceptanceTest
@Test
public void nodesInGroupShouldHaveSameStateRoot() {
final String privacyGroupId = createOnChainPrivacyGroup(aliceNode, bobNode);
final String privacyGroupId = createOnchainPrivacyGroup(aliceNode, bobNode);
final Hash aliceStateRootId =
aliceNode
@ -117,7 +117,7 @@ public class PrivDebugGetStateRootOnchainGroupAcceptanceTest
waitForBlockHeight(aliceNode, 2);
waitForBlockHeight(bobNode, 2);
final String privacyGroupId = createOnChainPrivacyGroup(aliceNode, bobNode);
final String privacyGroupId = createOnchainPrivacyGroup(aliceNode, bobNode);
waitForBlockHeight(aliceNode, 10);
waitForBlockHeight(bobNode, 10);
@ -145,7 +145,7 @@ public class PrivDebugGetStateRootOnchainGroupAcceptanceTest
@Test
public void canInteractWithPrivateGenesisPreCompile() throws Exception {
final String privacyGroupId = createOnChainPrivacyGroup(aliceNode, bobNode);
final String privacyGroupId = createOnchainPrivacyGroup(aliceNode, bobNode);
final EventEmitter eventEmitter =
aliceNode.execute(

@ -22,12 +22,12 @@ import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.account.PrivacyAccountResolver;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.contract.CallPrivateSmartContractFunction;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.CreateOnChainPrivacyGroupTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.CreateOnchainPrivacyGroupTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.util.LogFilterJsonParameter;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.perm.PermissioningTransactions;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory;
import org.hyperledger.besu.tests.web3j.generated.EventEmitter;
import org.hyperledger.besu.tests.web3j.privacy.OnChainPrivacyAcceptanceTestBase;
import org.hyperledger.besu.tests.web3j.privacy.OnchainPrivacyAcceptanceTestBase;
import org.hyperledger.enclave.testutil.EnclaveType;
import java.math.BigInteger;
@ -50,11 +50,11 @@ import org.web3j.utils.Base64String;
import org.web3j.utils.Restriction;
@RunWith(Parameterized.class)
public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceTestBase {
public class OnchainMultiTenancyAcceptanceTest extends OnchainPrivacyAcceptanceTestBase {
private final EnclaveType enclaveType;
public OnChainMultiTenancyAcceptanceTest(final EnclaveType enclaveType) {
public OnchainMultiTenancyAcceptanceTest(final EnclaveType enclaveType) {
this.enclaveType = enclaveType;
}
@ -78,7 +78,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
@Before
public void setUp() throws Exception {
alice =
privacyBesu.createOnChainPrivacyGroupEnabledMinerNode(
privacyBesu.createOnchainPrivacyGroupEnabledMinerNode(
"node1", PrivacyAccountResolver.MULTI_TENANCY, true, enclaveType, Optional.empty());
final BesuNode aliceBesu = alice.getBesu();
privacyCluster.startNodes(alice);
@ -109,7 +109,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
@Test
public void createPrivacyGroup() {
createOnChainPrivacyGroup(alice);
createOnchainPrivacyGroup(alice);
}
@Test
@ -117,7 +117,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
final MultiTenancyPrivacyGroup privacyGroup = new MultiTenancyPrivacyGroup();
privacyGroup.addNodeWithTenants(
aliceMultiTenancyPrivacyNode, aliceMultiTenancyPrivacyNode.getTenants());
createOnChainPrivacyGroup(privacyGroup);
createOnchainPrivacyGroup(privacyGroup);
}
@Test
@ -126,7 +126,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
final List<String> tenants = aliceMultiTenancyPrivacyNode.getTenants();
final String removedTenant = tenants.remove(tenants.size() - 1);
twoTenantsFromAlice.addNodeWithTenants(aliceMultiTenancyPrivacyNode, tenants);
final String privacyGroupId = createOnChainPrivacyGroup(twoTenantsFromAlice);
final String privacyGroupId = createOnchainPrivacyGroup(twoTenantsFromAlice);
final MultiTenancyPrivacyNode multiTenancyPrivacyNode =
twoTenantsFromAlice.getPrivacyNodes().get(0);
@ -256,9 +256,9 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
.getBesu()
.useAuthenticationTokenInHeaderForJsonRpc(
multiTenancyPrivacyNode.getTokenForTenant(tenant));
final List<PrivacyRequestFactory.OnChainPrivacyGroup> group =
final List<PrivacyRequestFactory.OnchainPrivacyGroup> group =
privacyNode.execute(
privacyTransactions.findOnChainPrivacyGroup(Base64String.unwrapList(base64StringList)));
privacyTransactions.findOnchainPrivacyGroup(Base64String.unwrapList(base64StringList)));
assertThat(group.size()).isEqualTo(1);
assertThat(group.get(0).getMembers()).containsAll(base64StringList).hasSize(2);
@ -270,7 +270,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
assertThatThrownBy(
() ->
privacyNode.execute(
privacyTransactions.findOnChainPrivacyGroup(
privacyTransactions.findOnchainPrivacyGroup(
Base64String.unwrapList(base64StringList))))
.hasMessageContaining("Error finding onchain privacy group");
@ -324,7 +324,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
final MultiTenancyPrivacyGroup allTenantsFromAlice = new MultiTenancyPrivacyGroup();
final List<String> tenants = aliceMultiTenancyPrivacyNode.getTenants();
allTenantsFromAlice.addNodeWithTenants(aliceMultiTenancyPrivacyNode, tenants);
final String privacyGroupId = createOnChainPrivacyGroup(allTenantsFromAlice);
final String privacyGroupId = createOnchainPrivacyGroup(allTenantsFromAlice);
final MultiTenancyPrivacyNode multiTenancyPrivacyNode =
allTenantsFromAlice.getPrivacyNodes().get(0);
final String groupCreatingTenant = allTenantsFromAlice.getGroupCreatingTenant();
@ -413,7 +413,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
.hasMessageContaining("Unauthorized");
}
private String createOnChainPrivacyGroup(final MultiTenancyPrivacyGroup group) {
private String createOnchainPrivacyGroup(final MultiTenancyPrivacyGroup group) {
final List<MultiTenancyPrivacyNode> multiTenancyPrivacyNodes = group.getPrivacyNodes();
final MultiTenancyPrivacyNode groupCreatorMultiTenancyPrivacyNode =
multiTenancyPrivacyNodes.get(0);
@ -421,8 +421,8 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
final String groupCreatorTenant = group.getGroupCreatingTenant();
final List<String> members = group.getTenants();
final String token = groupCreatorMultiTenancyPrivacyNode.getTokenForTenant(groupCreatorTenant);
final CreateOnChainPrivacyGroupTransaction createTx =
privacyTransactions.createOnChainPrivacyGroup(
final CreateOnchainPrivacyGroupTransaction createTx =
privacyTransactions.createOnchainPrivacyGroup(
groupCreatorNode, groupCreatorTenant, members, token);
final PrivacyRequestFactory.PrivxCreatePrivacyGroupResponse createResponse =
@ -438,7 +438,7 @@ public class OnChainMultiTenancyAcceptanceTest extends OnChainPrivacyAcceptanceT
privacyNode
.getBesu()
.useAuthenticationTokenInHeaderForJsonRpc(mtpn.getTokenForTenant(tenant));
privacyNode.verify(onChainPrivacyGroupExists(privacyGroupId, base64StringList));
privacyNode.verify(onchainPrivacyGroupExists(privacyGroupId, base64StringList));
}
}
}

@ -49,11 +49,11 @@ import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
@RunWith(Parameterized.class)
public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBase {
public class OnchainPrivacyAcceptanceTest extends OnchainPrivacyAcceptanceTestBase {
private final EnclaveType enclaveType;
public OnChainPrivacyAcceptanceTest(final EnclaveType enclaveType) {
public OnchainPrivacyAcceptanceTest(final EnclaveType enclaveType) {
this.enclaveType = enclaveType;
}
@ -81,21 +81,21 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
final Network containerNetwork = Network.newNetwork();
alice =
privacyBesu.createOnChainPrivacyGroupEnabledMinerNode(
privacyBesu.createOnchainPrivacyGroupEnabledMinerNode(
"node1",
privacyAccountResolver.resolve(0),
false,
enclaveType,
Optional.of(containerNetwork));
bob =
privacyBesu.createOnChainPrivacyGroupEnabledNode(
privacyBesu.createOnchainPrivacyGroupEnabledNode(
"node2",
privacyAccountResolver.resolve(1),
false,
enclaveType,
Optional.of(containerNetwork));
charlie =
privacyBesu.createOnChainPrivacyGroupEnabledNode(
privacyBesu.createOnchainPrivacyGroupEnabledNode(
"node3",
privacyAccountResolver.resolve(2),
false,
@ -106,13 +106,13 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
@Test
public void nodeCanCreatePrivacyGroup() {
final String privacyGroupId = createOnChainPrivacyGroup(alice);
checkOnChainPrivacyGroupExists(privacyGroupId, alice);
final String privacyGroupId = createOnchainPrivacyGroup(alice);
checkOnchainPrivacyGroupExists(privacyGroupId, alice);
}
@Test
public void deployingMustGiveValidReceipt() {
final String privacyGroupId = createOnChainPrivacyGroup(alice, bob);
final String privacyGroupId = createOnchainPrivacyGroup(alice, bob);
final Contract eventEmitter = deployPrivateContract(EventEmitter.class, privacyGroupId, alice);
final String commitmentHash = getContractDeploymentCommitmentHash(eventEmitter);
@ -122,7 +122,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
@Test
public void canAddParticipantToGroup() {
final String privacyGroupId = createOnChainPrivacyGroup(alice, bob);
final String privacyGroupId = createOnchainPrivacyGroup(alice, bob);
final Contract eventEmitter = deployPrivateContract(EventEmitter.class, privacyGroupId, alice);
final String commitmentHash = getContractDeploymentCommitmentHash(eventEmitter);
@ -131,14 +131,14 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
final Credentials aliceCredentials = Credentials.create(alice.getTransactionSigningKey());
lockPrivacyGroup(privacyGroupId, alice, aliceCredentials);
addMembersToPrivacyGroup(privacyGroupId, alice, aliceCredentials, charlie);
checkOnChainPrivacyGroupExists(privacyGroupId, alice, bob, charlie);
checkOnchainPrivacyGroupExists(privacyGroupId, alice, bob, charlie);
charlie.verify(privateTransactionVerifier.existingPrivateTransactionReceipt(commitmentHash));
}
@Test
public void removedMemberCannotSendTransactionToGroup() {
final String privacyGroupId = createOnChainPrivacyGroup(alice, bob);
final String privacyGroupId = createOnchainPrivacyGroup(alice, bob);
final String removeHash =
removeFromPrivacyGroup(
@ -153,7 +153,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
@Test
public void canInteractWithPrivateGenesisPreCompile() throws Exception {
final String privacyGroupId = createOnChainPrivacyGroup(alice, bob);
final String privacyGroupId = createOnchainPrivacyGroup(alice, bob);
final EventEmitter eventEmitter =
alice.execute(
@ -198,15 +198,15 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
@Test
public void memberCanBeAddedAfterBeingRemoved() {
final String privacyGroupId = createOnChainPrivacyGroup(alice);
final String privacyGroupId = createOnchainPrivacyGroup(alice);
checkOnChainPrivacyGroupExists(privacyGroupId, alice);
checkOnchainPrivacyGroupExists(privacyGroupId, alice);
lockPrivacyGroup(privacyGroupId, alice, Credentials.create(alice.getTransactionSigningKey()));
addMembersToPrivacyGroup(
privacyGroupId, alice, Credentials.create(alice.getTransactionSigningKey()), bob);
checkOnChainPrivacyGroupExists(privacyGroupId, alice, bob);
checkOnchainPrivacyGroupExists(privacyGroupId, alice, bob);
final EventEmitter eventEmitter =
deployPrivateContract(EventEmitter.class, privacyGroupId, alice);
@ -222,7 +222,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
removeFromPrivacyGroup(
privacyGroupId, alice, Credentials.create(alice.getTransactionSigningKey()), bob);
checkOnChainPrivacyGroupExists(privacyGroupId, alice);
checkOnchainPrivacyGroupExists(privacyGroupId, alice);
final int valueSetWhileBobWas_NOT_aMember = 1337;
final PrivateTransactionReceipt receiptWhileBobRemoved =
@ -241,7 +241,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
addMembersToPrivacyGroup(
privacyGroupId, alice, Credentials.create(alice.getTransactionSigningKey()), bob);
checkOnChainPrivacyGroupExists(privacyGroupId, alice, bob);
checkOnchainPrivacyGroupExists(privacyGroupId, alice, bob);
checkEmitterValue(
Lists.newArrayList(alice, bob),
@ -282,7 +282,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
final PrivacyNode firstNode = nodes.get(0);
final String txHash =
firstNode.execute(
privateContractTransactions.callOnChainPermissioningSmartContract(
privateContractTransactions.callOnchainPermissioningSmartContract(
eventEmitter.getContractAddress(),
eventEmitter.store(BigInteger.valueOf(value)).encodeFunctionCall(),
firstNode.getTransactionSigningKey(),
@ -314,8 +314,8 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
@Test
public void bobCanAddCharlieAfterBeingAddedByAlice() {
final String privacyGroupId = createOnChainPrivacyGroup(alice);
checkOnChainPrivacyGroupExists(privacyGroupId, alice);
final String privacyGroupId = createOnchainPrivacyGroup(alice);
checkOnchainPrivacyGroupExists(privacyGroupId, alice);
final EventEmitter eventEmitter =
alice.execute(
privateContractTransactions.createSmartContractWithPrivacyGroupId(
@ -338,7 +338,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
alice.execute(
privacyTransactions.addToPrivacyGroup(privacyGroupId, alice, aliceCredentials, bob));
checkOnChainPrivacyGroupExists(privacyGroupId, alice, bob);
checkOnchainPrivacyGroupExists(privacyGroupId, alice, bob);
bob.execute(
privacyTransactions.privxLockPrivacyGroupAndCheck(privacyGroupId, bob, aliceCredentials));
@ -352,7 +352,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
final String callHash =
alice.execute(
privateContractTransactions.callOnChainPermissioningSmartContract(
privateContractTransactions.callOnchainPermissioningSmartContract(
eventEmitter.getContractAddress(),
eventEmitter.value().encodeFunctionCall(),
alice.getTransactionSigningKey(),
@ -372,7 +372,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
alice.getBesu().verify(ethConditions.miningStatus(true));
checkOnChainPrivacyGroupExists(privacyGroupId, alice, bob, charlie);
checkOnchainPrivacyGroupExists(privacyGroupId, alice, bob, charlie);
final Optional<TransactionReceipt> aliceAddReceipt =
alice.execute(ethTransactions.getTransactionReceipt(bobAddHash));
@ -428,7 +428,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
final String aliceStoreHash =
charlie.execute(
privateContractTransactions.callOnChainPermissioningSmartContract(
privateContractTransactions.callOnchainPermissioningSmartContract(
eventEmitter.getContractAddress(),
eventEmitter.store(BigInteger.valueOf(1337)).encodeFunctionCall(),
charlie.getTransactionSigningKey(),
@ -475,13 +475,13 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
removeFromPrivacyGroup(privacyGroupId, bob, aliceCredentials, charlie);
checkOnChainPrivacyGroupExists(privacyGroupId, alice, bob);
checkOnchainPrivacyGroupExists(privacyGroupId, alice, bob);
}
@Test
public void canOnlyCallProxyContractWhenGroupLocked() {
final String privacyGroupId = createOnChainPrivacyGroup(alice);
checkOnChainPrivacyGroupExists(privacyGroupId, alice);
final String privacyGroupId = createOnchainPrivacyGroup(alice);
checkOnchainPrivacyGroupExists(privacyGroupId, alice);
final EventEmitter eventEmitter =
alice.execute(
@ -501,7 +501,7 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
final Supplier<String> callContract =
() -> {
return alice.execute(
privateContractTransactions.callOnChainPermissioningSmartContract(
privateContractTransactions.callOnchainPermissioningSmartContract(
eventEmitter.getContractAddress(),
eventEmitter.value().encodeFunctionCall(),
alice.getTransactionSigningKey(),
@ -545,10 +545,10 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
@Test
public void addMembersToTwoGroupsInTheSameBlock() {
final String privacyGroupId1 = createOnChainPrivacyGroup(alice);
final String privacyGroupId2 = createOnChainPrivacyGroup(bob);
checkOnChainPrivacyGroupExists(privacyGroupId1, alice);
checkOnChainPrivacyGroupExists(privacyGroupId2, bob);
final String privacyGroupId1 = createOnchainPrivacyGroup(alice);
final String privacyGroupId2 = createOnchainPrivacyGroup(bob);
checkOnchainPrivacyGroupExists(privacyGroupId1, alice);
checkOnchainPrivacyGroupExists(privacyGroupId2, bob);
lockPrivacyGroup(privacyGroupId1, alice, Credentials.create(alice.getTransactionSigningKey()));
lockPrivacyGroup(privacyGroupId2, bob, Credentials.create(bob.getTransactionSigningKey()));
@ -574,8 +574,8 @@ public class OnChainPrivacyAcceptanceTest extends OnChainPrivacyAcceptanceTestBa
alice.execute(minerTransactions.minerStart());
checkOnChainPrivacyGroupExists(privacyGroupId1, alice, charlie);
checkOnChainPrivacyGroupExists(privacyGroupId2, bob, alice);
checkOnchainPrivacyGroupExists(privacyGroupId1, alice, charlie);
checkOnchainPrivacyGroupExists(privacyGroupId2, bob, alice);
}
private <T extends Contract> T deployPrivateContract(

@ -16,13 +16,13 @@ package org.hyperledger.besu.tests.web3j.privacy;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.core.PrivacyParameters.ONCHAIN_PRIVACY_PROXY;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.GET_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.GET_PARTICIPANTS_METHOD_SIGNATURE;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyAcceptanceTestBase;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.ExpectValidOnChainPrivacyGroupCreated;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.CreateOnChainPrivacyGroupTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.condition.ExpectValidOnchainPrivacyGroupCreated;
import org.hyperledger.besu.tests.acceptance.dsl.privacy.transaction.CreateOnchainPrivacyGroupTransaction;
import org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy.PrivacyRequestFactory;
import java.util.Arrays;
@ -37,12 +37,12 @@ import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.utils.Base64String;
public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase {
public class OnchainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase {
protected String createOnChainPrivacyGroup(final PrivacyNode... members) {
protected String createOnchainPrivacyGroup(final PrivacyNode... members) {
final List<String> addresses =
Arrays.stream(members).map(PrivacyNode::getEnclaveKey).collect(Collectors.toList());
return createOnChainPrivacyGroup(members[0].getEnclaveKey(), addresses, members);
return createOnchainPrivacyGroup(members[0].getEnclaveKey(), addresses, members);
}
/**
@ -55,13 +55,13 @@ public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase
* the creator of the group.
* @return the id of the privacy group
*/
protected String createOnChainPrivacyGroup(
protected String createOnchainPrivacyGroup(
final String privateFrom, final List<String> addresses, final PrivacyNode... members) {
final PrivacyNode groupCreator = members[0];
final CreateOnChainPrivacyGroupTransaction createTx =
privacyTransactions.createOnChainPrivacyGroup(groupCreator, privateFrom, addresses);
final CreateOnchainPrivacyGroupTransaction createTx =
privacyTransactions.createOnchainPrivacyGroup(groupCreator, privateFrom, addresses);
final PrivacyRequestFactory.PrivxCreatePrivacyGroupResponse createResponse =
groupCreator.execute(createTx);
@ -73,7 +73,7 @@ public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase
.collect(Collectors.toList());
for (final PrivacyNode member : members) {
member.verify(onChainPrivacyGroupExists(privacyGroupId, membersEnclaveKeys));
member.verify(onchainPrivacyGroupExists(privacyGroupId, membersEnclaveKeys));
}
final String commitmentHash =
@ -94,7 +94,7 @@ public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase
protected String callGetParticipantsMethodAndReturnCommitmentHash(
final String privacyGroupId, final PrivacyNode groupCreator, final String privateFrom) {
return groupCreator.execute(
privateContractTransactions.callOnChainPermissioningSmartContract(
privateContractTransactions.callOnchainPermissioningSmartContract(
ONCHAIN_PRIVACY_PROXY.toHexString(),
GET_PARTICIPANTS_METHOD_SIGNATURE.toString(),
groupCreator.getTransactionSigningKey(),
@ -140,9 +140,9 @@ public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase
null);
}
protected ExpectValidOnChainPrivacyGroupCreated onChainPrivacyGroupExists(
protected ExpectValidOnchainPrivacyGroupCreated onchainPrivacyGroupExists(
final String privacyGroupId, final List<Base64String> members) {
return privateTransactionVerifier.onChainPrivacyGroupExists(privacyGroupId, members);
return privateTransactionVerifier.onchainPrivacyGroupExists(privacyGroupId, members);
}
protected String getContractDeploymentCommitmentHash(final Contract contract) {
@ -161,7 +161,7 @@ public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase
* @param privacyGroupId the id of the privacy group
* @param members the list of member in the privacy group
*/
protected void checkOnChainPrivacyGroupExists(
protected void checkOnchainPrivacyGroupExists(
final String privacyGroupId, final PrivacyNode... members) {
final List<Base64String> membersEnclaveKeys =
Arrays.stream(members)
@ -170,7 +170,7 @@ public class OnChainPrivacyAcceptanceTestBase extends PrivacyAcceptanceTestBase
.collect(Collectors.toList());
for (final PrivacyNode member : members) {
member.verify(onChainPrivacyGroupExists(privacyGroupId, membersEnclaveKeys));
member.verify(onchainPrivacyGroupExists(privacyGroupId, membersEnclaveKeys));
}
}
}

@ -16,7 +16,7 @@ package org.hyperledger.besu.tests.web3j.privacy.contracts;
import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.privacy.contracts.generated.DefaultOnChainPrivacyGroupManagementContract;
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;
@ -40,7 +40,7 @@ public class PrivacyGroupTest extends AcceptanceTestBase {
Base64String.wrap("Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=");
private final Base64String thirdParticipant =
Base64String.wrap("Jo2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=");
private DefaultOnChainPrivacyGroupManagementContract defaultPrivacyGroupManagementContract;
private DefaultOnchainPrivacyGroupManagementContract defaultPrivacyGroupManagementContract;
private static final String RAW_FIRST_PARTICIPANT = "0x5aa68ac0";
private static final String RAW_ADD_PARTICIPANT =
@ -61,7 +61,7 @@ public class PrivacyGroupTest extends AcceptanceTestBase {
defaultPrivacyGroupManagementContract =
minerNode.execute(
contractTransactions.createSmartContract(
DefaultOnChainPrivacyGroupManagementContract.class));
DefaultOnchainPrivacyGroupManagementContract.class));
}
@Test

@ -17,8 +17,8 @@ package org.hyperledger.besu.tests.web3j.privacy.contracts;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import org.hyperledger.besu.privacy.contracts.generated.DefaultOnChainPrivacyGroupManagementContract;
import org.hyperledger.besu.privacy.contracts.generated.OnChainPrivacyGroupManagementProxy;
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.account.Accounts;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
@ -45,58 +45,58 @@ public class PrivacyProxyTest extends AcceptanceTestBase {
Base64String.wrap("9iaJ6OObl6TUWYjXAOyZsL0VaDPwF+tRFkMwwYSeqqw=");
private final Base64String thirdParticipant =
Base64String.wrap("Jo2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=");
private OnChainPrivacyGroupManagementProxy onChainPrivacyGroupManagementProxy;
private OnchainPrivacyGroupManagementProxy onchainPrivacyGroupManagementProxy;
private static final String RAW_GET_PARTICIPANTS = "0x5aa68ac0";
private static final String RAW_ADD_PARTICIPANT =
"0xb4926e2500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001f772b2ee55f016431cefe724a05814324bb96e9afdb73e338665a693d4653678";
private BesuNode minerNode;
private DefaultOnChainPrivacyGroupManagementContract defaultOnChainPrivacyGroupManagementContract;
private DefaultOnchainPrivacyGroupManagementContract defaultOnchainPrivacyGroupManagementContract;
@Before
public void setUp() throws Exception {
minerNode = besu.createMinerNode("node");
cluster.start(minerNode);
defaultOnChainPrivacyGroupManagementContract =
defaultOnchainPrivacyGroupManagementContract =
minerNode.execute(
contractTransactions.createSmartContract(
DefaultOnChainPrivacyGroupManagementContract.class));
onChainPrivacyGroupManagementProxy =
DefaultOnchainPrivacyGroupManagementContract.class));
onchainPrivacyGroupManagementProxy =
minerNode.execute(
contractTransactions.createSmartContract(
OnChainPrivacyGroupManagementProxy.class,
defaultOnChainPrivacyGroupManagementContract.getContractAddress()));
OnchainPrivacyGroupManagementProxy.class,
defaultOnchainPrivacyGroupManagementContract.getContractAddress()));
}
@Test
public void rlp() throws Exception {
assertThat(onChainPrivacyGroupManagementProxy.isValid()).isEqualTo(true);
assertThat(onchainPrivacyGroupManagementProxy.isValid()).isEqualTo(true);
contractVerifier
.validTransactionReceipt(onChainPrivacyGroupManagementProxy.getContractAddress())
.verify(onChainPrivacyGroupManagementProxy);
.validTransactionReceipt(onchainPrivacyGroupManagementProxy.getContractAddress())
.verify(onchainPrivacyGroupManagementProxy);
assertThat(RAW_GET_PARTICIPANTS)
.isEqualTo(onChainPrivacyGroupManagementProxy.getParticipants().encodeFunctionCall());
.isEqualTo(onchainPrivacyGroupManagementProxy.getParticipants().encodeFunctionCall());
assertThat(RAW_ADD_PARTICIPANT)
.isEqualTo(
onChainPrivacyGroupManagementProxy
onchainPrivacyGroupManagementProxy
.addParticipants(List.of(firstParticipant.raw()))
.encodeFunctionCall());
}
@Test
public void deploysWithNoParticipant() throws Exception {
final List<byte[]> participants = onChainPrivacyGroupManagementProxy.getParticipants().send();
final List<byte[]> participants = onchainPrivacyGroupManagementProxy.getParticipants().send();
assertThat(participants.size()).isEqualTo(0);
}
@Test
public void canAddParticipants() throws Exception {
onChainPrivacyGroupManagementProxy
onchainPrivacyGroupManagementProxy
.addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw()))
.send();
final List<byte[]> participants = onChainPrivacyGroupManagementProxy.getParticipants().send();
final List<byte[]> participants = onchainPrivacyGroupManagementProxy.getParticipants().send();
assertThat(participants.size()).isEqualTo(2);
assertThat(firstParticipant.raw()).isEqualTo(participants.get(0));
assertThat(secondParticipant.raw()).isEqualTo(participants.get(1));
@ -104,18 +104,18 @@ public class PrivacyProxyTest extends AcceptanceTestBase {
@Test
public void nonOwnerCannotUpgrade() throws Exception {
onChainPrivacyGroupManagementProxy
onchainPrivacyGroupManagementProxy
.addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw()))
.send();
final List<byte[]> participants = onChainPrivacyGroupManagementProxy.getParticipants().send();
final List<byte[]> participants = onchainPrivacyGroupManagementProxy.getParticipants().send();
assertThat(participants.size()).isEqualTo(2);
assertThat(firstParticipant.raw()).isEqualTo(participants.get(0));
assertThat(secondParticipant.raw()).isEqualTo(participants.get(1));
final DefaultOnChainPrivacyGroupManagementContract upgradedContract =
final DefaultOnchainPrivacyGroupManagementContract upgradedContract =
minerNode.execute(
contractTransactions.createSmartContract(
DefaultOnChainPrivacyGroupManagementContract.class));
DefaultOnchainPrivacyGroupManagementContract.class));
final HttpService httpService =
new HttpService(
@ -123,9 +123,9 @@ public class PrivacyProxyTest extends AcceptanceTestBase {
final Web3j web3j = Web3j.build(httpService);
// load the proxy contract, use it with another signer
final OnChainPrivacyGroupManagementProxy proxyContractAccount2 =
OnChainPrivacyGroupManagementProxy.load(
onChainPrivacyGroupManagementProxy.getContractAddress(),
final OnchainPrivacyGroupManagementProxy proxyContractAccount2 =
OnchainPrivacyGroupManagementProxy.load(
onchainPrivacyGroupManagementProxy.getContractAddress(),
web3j,
Credentials.create(Accounts.GENESIS_ACCOUNT_TWO_PRIVATE_KEY),
new DefaultGasProvider());
@ -138,22 +138,22 @@ public class PrivacyProxyTest extends AcceptanceTestBase {
@Test
public void ownerCanUpgrade() throws Exception {
onChainPrivacyGroupManagementProxy
onchainPrivacyGroupManagementProxy
.addParticipants(Arrays.asList(firstParticipant.raw(), secondParticipant.raw()))
.send();
final List<byte[]> participants = onChainPrivacyGroupManagementProxy.getParticipants().send();
final List<byte[]> participants = onchainPrivacyGroupManagementProxy.getParticipants().send();
assertThat(participants.size()).isEqualTo(2);
assertThat(firstParticipant.raw()).isEqualTo(participants.get(0));
assertThat(secondParticipant.raw()).isEqualTo(participants.get(1));
final DefaultOnChainPrivacyGroupManagementContract upgradedContract =
final DefaultOnchainPrivacyGroupManagementContract upgradedContract =
minerNode.execute(
contractTransactions.createSmartContract(
DefaultOnChainPrivacyGroupManagementContract.class));
DefaultOnchainPrivacyGroupManagementContract.class));
onChainPrivacyGroupManagementProxy.upgradeTo(upgradedContract.getContractAddress()).send();
onchainPrivacyGroupManagementProxy.upgradeTo(upgradedContract.getContractAddress()).send();
final List<byte[]> participantsAfterUpgrade =
onChainPrivacyGroupManagementProxy.getParticipants().send();
onchainPrivacyGroupManagementProxy.getParticipants().send();
assertThat(participantsAfterUpgrade.size()).isEqualTo(2);
assertThat(firstParticipant.raw()).isEqualTo(participantsAfterUpgrade.get(0));
assertThat(secondParticipant.raw()).isEqualTo(participantsAfterUpgrade.get(1));
@ -161,14 +161,14 @@ public class PrivacyProxyTest extends AcceptanceTestBase {
@Test
public void canAddTwiceToContractWhenCallLock() throws Exception {
onChainPrivacyGroupManagementProxy
onchainPrivacyGroupManagementProxy
.addParticipants(Arrays.asList(firstParticipant.raw(), thirdParticipant.raw()))
.send();
onChainPrivacyGroupManagementProxy.lock().send();
onChainPrivacyGroupManagementProxy
onchainPrivacyGroupManagementProxy.lock().send();
onchainPrivacyGroupManagementProxy
.addParticipants(Collections.singletonList(secondParticipant.raw()))
.send();
final List<byte[]> participants = onChainPrivacyGroupManagementProxy.getParticipants().send();
final List<byte[]> participants = onchainPrivacyGroupManagementProxy.getParticipants().send();
assertThat(participants.size()).isEqualTo(3);
assertThat(firstParticipant.raw()).isEqualTo(participants.get(0));
assertThat(thirdParticipant.raw()).isEqualTo(participants.get(1));

@ -61,7 +61,7 @@ import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Synchronizer;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnChainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnchainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.p2p.config.DiscoveryConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.RlpxConfiguration;
@ -909,8 +909,8 @@ public class RunnerBuilder {
// register privateTransactionObserver as observer of events fired by the onchain precompile.
if (privacyParameters.isOnchainPrivacyGroupsEnabled()
&& privacyParameters.isMultiTenancyEnabled()) {
final OnChainPrivacyPrecompiledContract onchainPrivacyPrecompiledContract =
(OnChainPrivacyPrecompiledContract)
final OnchainPrivacyPrecompiledContract onchainPrivacyPrecompiledContract =
(OnchainPrivacyPrecompiledContract)
besuController
.getProtocolSchedule()
.getByBlockNumber(1)

@ -86,10 +86,10 @@ public class PrivacyTest {
final PrecompiledContract onchainPrecompiledContract =
getPrecompile(besuController, ONCHAIN_PRIVACY);
assertThat(onchainPrecompiledContract.getName()).isEqualTo("OnChainPrivacy");
assertThat(onchainPrecompiledContract.getName()).isEqualTo("OnchainPrivacy");
}
private BesuController setUpControllerWithPrivacyEnabled(final boolean onChainEnabled)
private BesuController setUpControllerWithPrivacyEnabled(final boolean onchainEnabled)
throws IOException, URISyntaxException {
final Path dataDir = folder.newFolder().toPath();
final Path dbDir = dataDir.resolve("database");
@ -99,7 +99,7 @@ public class PrivacyTest {
.setEnclaveUrl(new URI("http://127.0.0.1:8000"))
.setStorageProvider(createKeyValueStorageProvider(dataDir, dbDir))
.setEnclaveFactory(new EnclaveFactory(vertx))
.setOnchainPrivacyGroupsEnabled(onChainEnabled)
.setOnchainPrivacyGroupsEnabled(onchainEnabled)
.build();
return new BesuController.Builder()
.fromGenesisConfig(GenesisConfigFile.mainnet())

@ -3416,7 +3416,7 @@ public class BesuCommandTest extends CommandTestAbstract {
}
@Test
public void onChainPrivacyGroupEnabledFlagDefaultValueIsFalse() {
public void onchainPrivacyGroupEnabledFlagDefaultValueIsFalse() {
parseCommand(
"--privacy-enabled",
"--privacy-public-key-file",
@ -3438,7 +3438,7 @@ public class BesuCommandTest extends CommandTestAbstract {
}
@Test
public void onChainPrivacyGroupEnabledFlagValueIsSet() {
public void onchainPrivacyGroupEnabledFlagValueIsSet() {
parseCommand(
"--privacy-enabled",
"--privacy-public-key-file",

@ -124,7 +124,7 @@ public abstract class BaseBftProtocolSchedule {
.blockImporterBuilder(MainnetBlockImporter::new)
.difficultyCalculator((time, parent, protocolContext) -> BigInteger.ONE)
.skipZeroBlockRewards(true)
.blockHeaderFunctions(BftBlockHeaderFunctions.forOnChainBlock(bftExtraDataCodec));
.blockHeaderFunctions(BftBlockHeaderFunctions.forOnchainBlock(bftExtraDataCodec));
blockReward.ifPresent(bigInteger -> builder.blockReward(Wei.of(bigInteger)));

@ -69,7 +69,7 @@ public class BftBlockHashing {
* @param header The header for which a block hash is to be calculated
* @return the hash of the header to be used when referencing the header on the blockchain
*/
public Hash calculateHashOfBftBlockOnChain(final BlockHeader header) {
public Hash calculateHashOfBftBlockOnchain(final BlockHeader header) {
final BftExtraData bftExtraData = bftExtraDataCodec.decode(header);
return Hash.hash(
serializeHeader(
@ -102,7 +102,7 @@ public class BftBlockHashing {
// create a block header which is a copy of the header supplied as parameter except of the
// extraData field
final BlockHeaderBuilder builder = BlockHeaderBuilder.fromHeader(header);
builder.blockHeaderFunctions(BftBlockHeaderFunctions.forOnChainBlock(bftExtraDataCodec));
builder.blockHeaderFunctions(BftBlockHeaderFunctions.forOnchainBlock(bftExtraDataCodec));
// set the extraData field using the supplied extraDataSerializer if the block height is not 0
if (header.getNumber() == BlockHeader.GENESIS_BLOCK_NUMBER) {

@ -31,9 +31,9 @@ public class BftBlockHeaderFunctions implements BlockHeaderFunctions {
this.bftExtraDataCodec = bftExtraDataCodec;
}
public static BlockHeaderFunctions forOnChainBlock(final BftExtraDataCodec bftExtraDataCodec) {
public static BlockHeaderFunctions forOnchainBlock(final BftExtraDataCodec bftExtraDataCodec) {
return new BftBlockHeaderFunctions(
h -> new BftBlockHashing(bftExtraDataCodec).calculateHashOfBftBlockOnChain(h),
h -> new BftBlockHashing(bftExtraDataCodec).calculateHashOfBftBlockOnchain(h),
bftExtraDataCodec);
}

@ -55,7 +55,7 @@ public class BftHelpers {
final BlockHeader sealedHeader =
BlockHeaderBuilder.fromHeader(initialHeader)
.extraData(bftExtraDataCodec.encode(sealedExtraData))
.blockHeaderFunctions(BftBlockHeaderFunctions.forOnChainBlock(bftExtraDataCodec))
.blockHeaderFunctions(BftBlockHeaderFunctions.forOnchainBlock(bftExtraDataCodec))
.buildBlockHeader();
return new Block(sealedHeader, block.getBody());

@ -71,7 +71,7 @@ public class BftQueryServiceImplTest {
final BlockHeaderTestFixture blockHeaderTestFixture = new BlockHeaderTestFixture();
blockHeaderTestFixture.number(1); // can't be genesis block (due to extradata serialisation)
blockHeaderTestFixture.blockHeaderFunctions(
BftBlockHeaderFunctions.forOnChainBlock(bftExtraDataCodec));
BftBlockHeaderFunctions.forOnchainBlock(bftExtraDataCodec));
blockHeader = blockHeaderTestFixture.buildHeader();
}

@ -190,7 +190,7 @@ public class TestContextBuilder {
final MutableBlockchain blockChain =
createInMemoryBlockchain(
genesisBlock, BftBlockHeaderFunctions.forOnChainBlock(IBFT_EXTRA_DATA_ENCODER));
genesisBlock, BftBlockHeaderFunctions.forOnchainBlock(IBFT_EXTRA_DATA_ENCODER));
// Use a stubbed version of the multicaster, to prevent creating PeerConnections etc.
final StubValidatorMulticaster multicaster = new StubValidatorMulticaster();

@ -60,8 +60,8 @@ public class BftBlockHashingTest {
private final Hash EXPECTED_HEADER_HASH = expectedHeaderHash();
@Test
public void testCalculateHashOfIbft2BlockOnChain() {
Hash actualHeaderHash = bftBlockHashing.calculateHashOfBftBlockOnChain(headerToBeHashed);
public void testCalculateHashOfIbft2BlockOnchain() {
Hash actualHeaderHash = bftBlockHashing.calculateHashOfBftBlockOnchain(headerToBeHashed);
assertThat(actualHeaderHash).isEqualTo(EXPECTED_HEADER_HASH);
}
@ -142,7 +142,7 @@ public class BftBlockHashingTest {
builder.mixHash(
Hash.fromHexString("0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365"));
builder.nonce(0);
builder.blockHeaderFunctions(BftBlockHeaderFunctions.forOnChainBlock(new IbftExtraDataCodec()));
builder.blockHeaderFunctions(BftBlockHeaderFunctions.forOnchainBlock(new IbftExtraDataCodec()));
return builder;
}

@ -73,7 +73,7 @@ public class IbftBlockHashing {
* @param header The header for which a block hash is to be calculated
* @return the hash of the header including the validator and proposer seal in the extra data
*/
public static Hash calculateHashOfIbftBlockOnChain(final BlockHeader header) {
public static Hash calculateHashOfIbftBlockOnchain(final BlockHeader header) {
final IbftExtraData ibftExtraData = IbftExtraData.decode(header);
return Hash.hash(serializeHeaderWithoutCommittedSeals(header, ibftExtraData));
}

@ -22,7 +22,7 @@ public class LegacyIbftBlockHeaderFunctions implements BlockHeaderFunctions {
@Override
public Hash hash(final BlockHeader header) {
return IbftBlockHashing.calculateHashOfIbftBlockOnChain(header);
return IbftBlockHashing.calculateHashOfIbftBlockOnchain(header);
}
@Override

@ -259,7 +259,7 @@ public class TestContextBuilder {
blockChain =
createInMemoryBlockchain(
genesisState.getBlock(),
BftBlockHeaderFunctions.forOnChainBlock(BFT_EXTRA_DATA_ENCODER));
BftBlockHeaderFunctions.forOnchainBlock(BFT_EXTRA_DATA_ENCODER));
genesisState.writeStateTo(worldStateArchive.getMutable());
} catch (IOException e) {
throw new IllegalStateException(e);
@ -268,7 +268,7 @@ public class TestContextBuilder {
final Block genesisBlock = createGenesisBlock(networkNodes.getValidatorAddresses());
blockChain =
createInMemoryBlockchain(
genesisBlock, BftBlockHeaderFunctions.forOnChainBlock(BFT_EXTRA_DATA_ENCODER));
genesisBlock, BftBlockHeaderFunctions.forOnchainBlock(BFT_EXTRA_DATA_ENCODER));
}
// Use a stubbed version of the multicaster, to prevent creating PeerConnections etc.

@ -36,12 +36,12 @@ import java.util.Optional;
import io.vertx.ext.auth.User;
import org.apache.tuweni.bytes.Bytes;
public class RestrictedOffChainEeaSendRawTransaction extends AbstractEeaSendRawTransaction {
public class RestrictedOffchainEeaSendRawTransaction extends AbstractEeaSendRawTransaction {
final PrivacyController privacyController;
private final PrivacyIdProvider privacyIdProvider;
public RestrictedOffChainEeaSendRawTransaction(
public RestrictedOffchainEeaSendRawTransaction(
final TransactionPool transactionPool,
final PrivacyIdProvider privacyIdProvider,
final PrivateMarkerTransactionFactory privateMarkerTransactionFactory,

@ -37,12 +37,12 @@ import io.vertx.ext.auth.User;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
public class RestrictedOnChainEeaSendRawTransaction extends AbstractEeaSendRawTransaction {
public class RestrictedOnchainEeaSendRawTransaction extends AbstractEeaSendRawTransaction {
private final PrivacyController privacyController;
private final PrivacyIdProvider privacyIdProvider;
public RestrictedOnChainEeaSendRawTransaction(
public RestrictedOnchainEeaSendRawTransaction(
final TransactionPool transactionPool,
final PrivacyIdProvider privacyIdProvider,
final PrivateMarkerTransactionFactory privateMarkerTransactionFactory,

@ -33,13 +33,13 @@ import java.util.List;
import org.apache.logging.log4j.Logger;
public class PrivxFindOnChainPrivacyGroup implements JsonRpcMethod {
public class PrivxFindOnchainPrivacyGroup implements JsonRpcMethod {
private static final Logger LOG = getLogger();
private final PrivacyController privacyController;
private final PrivacyIdProvider privacyIdProvider;
public PrivxFindOnChainPrivacyGroup(
public PrivxFindOnchainPrivacyGroup(
final PrivacyController privacyController, final PrivacyIdProvider privacyIdProvider) {
this.privacyController = privacyController;
this.privacyIdProvider = privacyIdProvider;
@ -61,7 +61,7 @@ public class PrivxFindOnChainPrivacyGroup implements JsonRpcMethod {
final List<PrivacyGroup> response;
try {
response =
privacyController.findOnChainPrivacyGroupByMembers(
privacyController.findOnchainPrivacyGroupByMembers(
Arrays.asList(addresses),
privacyIdProvider.getPrivacyUserId(requestContext.getUser()));
} catch (final MultiTenancyValidationException e) {

@ -20,8 +20,8 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.PrivacyIdProvider;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.PluginEeaSendRawTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.RestrictedOffChainEeaSendRawTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.RestrictedOnChainEeaSendRawTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.RestrictedOffchainEeaSendRawTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.eea.RestrictedOnchainEeaSendRawTransaction;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.priv.PrivGetEeaTransactionCount;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
@ -69,7 +69,7 @@ public class EeaJsonRpcMethods extends PrivacyApiGroupJsonRpcMethods {
new PrivGetEeaTransactionCount(privacyController, privacyIdProvider));
} else if (getPrivacyParameters().isOnchainPrivacyGroupsEnabled()) {
return mapOf(
new RestrictedOnChainEeaSendRawTransaction(
new RestrictedOnchainEeaSendRawTransaction(
transactionPool,
privacyIdProvider,
privateMarkerTransactionFactory,
@ -78,7 +78,7 @@ public class EeaJsonRpcMethods extends PrivacyApiGroupJsonRpcMethods {
new PrivGetEeaTransactionCount(privacyController, privacyIdProvider));
} else { // off chain privacy
return mapOf(
new RestrictedOffChainEeaSendRawTransaction(
new RestrictedOffchainEeaSendRawTransaction(
transactionPool,
privacyIdProvider,
privateMarkerTransactionFactory,

@ -18,7 +18,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApi;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.PrivacyIdProvider;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.privx.PrivxFindOnChainPrivacyGroup;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.privx.PrivxFindOnchainPrivacyGroup;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
@ -49,7 +49,7 @@ public class PrivxJsonRpcMethods extends PrivacyApiGroupJsonRpcMethods {
final PrivacyIdProvider privacyIdProvider,
final PrivateMarkerTransactionFactory privateMarkerTransactionFactory) {
if (getPrivacyParameters().isOnchainPrivacyGroupsEnabled()) {
return mapOf(new PrivxFindOnChainPrivacyGroup(privacyController, privacyIdProvider));
return mapOf(new PrivxFindOnchainPrivacyGroup(privacyController, privacyIdProvider));
} else {
return Map.of();
}

@ -56,13 +56,13 @@ public class EeaSendRawTransactionTest extends BaseEeaSendRawTransaction {
static final String ENCLAVE_PUBLIC_KEY = "S28yYlZxRCtuTmxOWUw1RUU3eTNJZE9udmlmdGppaXo=";
final PrivacyIdProvider privacyIdProvider = (user) -> ENCLAVE_PUBLIC_KEY;
RestrictedOffChainEeaSendRawTransaction method;
RestrictedOffchainEeaSendRawTransaction method;
@Before
public void before() {
method =
new RestrictedOffChainEeaSendRawTransaction(
new RestrictedOffchainEeaSendRawTransaction(
transactionPool,
privacyIdProvider,
privateMarkerTransactionFactory,

@ -36,17 +36,17 @@ import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class RestrictedOffChainEeaSendRawTransactionTest extends BaseEeaSendRawTransaction {
public class RestrictedOffchainEeaSendRawTransactionTest extends BaseEeaSendRawTransaction {
static final String ENCLAVE_PUBLIC_KEY = "S28yYlZxRCtuTmxOWUw1RUU3eTNJZE9udmlmdGppaXo=";
final PrivacyIdProvider privacyIdProvider = (user) -> ENCLAVE_PUBLIC_KEY;
RestrictedOffChainEeaSendRawTransaction method;
RestrictedOffchainEeaSendRawTransaction method;
@Before
public void before() {
method =
new RestrictedOffChainEeaSendRawTransaction(
new RestrictedOffchainEeaSendRawTransaction(
transactionPool,
privacyIdProvider,
privateMarkerTransactionFactory,

@ -37,17 +37,17 @@ import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class RestrictedOnChainEeaSendRawTransactionTest extends BaseEeaSendRawTransaction {
public class RestrictedOnchainEeaSendRawTransactionTest extends BaseEeaSendRawTransaction {
static final String ENCLAVE_PUBLIC_KEY = "S28yYlZxRCtuTmxOWUw1RUU3eTNJZE9udmlmdGppaXo=";
final PrivacyIdProvider privacyIdProvider = (user) -> ENCLAVE_PUBLIC_KEY;
RestrictedOnChainEeaSendRawTransaction method;
RestrictedOnchainEeaSendRawTransaction method;
@Before
public void before() {
method =
new RestrictedOnChainEeaSendRawTransaction(
new RestrictedOnchainEeaSendRawTransaction(
transactionPool,
privacyIdProvider,
privateMarkerTransactionFactory,
@ -56,7 +56,7 @@ public class RestrictedOnChainEeaSendRawTransactionTest extends BaseEeaSendRawTr
}
@Test
public void validOnChainTransactionPrivacyGroupIsSentToTransactionPool() {
public void validOnchainTransactionPrivacyGroupIsSentToTransactionPool() {
when(privacyController.validatePrivateTransaction(any(), any()))
.thenReturn(ValidationResult.valid());
when(transactionPool.addLocalTransaction(any(Transaction.class)))
@ -65,13 +65,13 @@ public class RestrictedOnChainEeaSendRawTransactionTest extends BaseEeaSendRawTr
when(privacyController.createPrivateMarkerTransactionPayload(any(), any(), any()))
.thenReturn(MOCK_ORION_KEY);
final Optional<PrivacyGroup> onChainPrivacyGroup =
final Optional<PrivacyGroup> onchainPrivacyGroup =
Optional.of(
new PrivacyGroup(
"", PrivacyGroup.Type.ONCHAIN, "", "", Arrays.asList(ENCLAVE_PUBLIC_KEY)));
when(privacyController.findOnChainPrivacyGroupAndAddNewMembers(any(), any(), any()))
.thenReturn(onChainPrivacyGroup);
when(privacyController.findOnchainPrivacyGroupAndAddNewMembers(any(), any(), any()))
.thenReturn(onchainPrivacyGroup);
final JsonRpcSuccessResponse expectedResponse =
new JsonRpcSuccessResponse(
@ -104,7 +104,7 @@ public class RestrictedOnChainEeaSendRawTransactionTest extends BaseEeaSendRawTr
when(privacyController.validatePrivateTransaction(any(), any()))
.thenReturn(ValidationResult.valid());
when(privacyController.findOnChainPrivacyGroupAndAddNewMembers(any(), any(), any()))
when(privacyController.findOnchainPrivacyGroupAndAddNewMembers(any(), any(), any()))
.thenReturn(Optional.empty());
final JsonRpcResponse expectedResponse =
@ -118,7 +118,7 @@ public class RestrictedOnChainEeaSendRawTransactionTest extends BaseEeaSendRawTr
}
@Test
public void onChainPrivacyGroupTransactionFailsWhenGroupDoesNotExist() {
public void onchainPrivacyGroupTransactionFailsWhenGroupDoesNotExist() {
when(privacyController.validatePrivateTransaction(any(), any()))
.thenReturn(ValidationResult.valid());

@ -43,7 +43,7 @@ import org.assertj.core.util.Lists;
import org.junit.Before;
import org.junit.Test;
public class PrivxFindOnChainPrivacyGroupTest {
public class PrivxFindOnchainPrivacyGroupTest {
private static final String ENCLAVE_PUBLIC_KEY = "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=";
private static final List<String> ADDRESSES =
List.of(
@ -60,7 +60,7 @@ public class PrivxFindOnChainPrivacyGroupTest {
private JsonRpcRequestContext request;
private PrivacyGroup privacyGroup;
private PrivxFindOnChainPrivacyGroup privxFindOnChainPrivacyGroup;
private PrivxFindOnchainPrivacyGroup privxFindOnchainPrivacyGroup;
@Before
public void setUp() {
@ -76,45 +76,45 @@ public class PrivxFindOnChainPrivacyGroupTest {
privacyGroup.setPrivacyGroupId("privacy group id");
privacyGroup.setMembers(Lists.list("member1"));
privxFindOnChainPrivacyGroup =
new PrivxFindOnChainPrivacyGroup(privacyController, privacyIdProvider);
privxFindOnchainPrivacyGroup =
new PrivxFindOnchainPrivacyGroup(privacyController, privacyIdProvider);
}
@SuppressWarnings("unchecked")
@Test
public void findsPrivacyGroupWithValidAddresses() {
when(privacyController.findOnChainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY))
when(privacyController.findOnchainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY))
.thenReturn(Collections.singletonList(privacyGroup));
final JsonRpcSuccessResponse response =
(JsonRpcSuccessResponse) privxFindOnChainPrivacyGroup.response(request);
(JsonRpcSuccessResponse) privxFindOnchainPrivacyGroup.response(request);
final List<PrivacyGroup> result = (List<PrivacyGroup>) response.getResult();
assertThat(result).hasSize(1);
assertThat(result.get(0)).isEqualToComparingFieldByField(privacyGroup);
verify(privacyController).findOnChainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY);
verify(privacyController).findOnchainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY);
}
@Test
public void failsWithFindPrivacyGroupErrorIfEnclaveFails() {
when(privacyController.findOnChainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY))
when(privacyController.findOnchainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY))
.thenThrow(new EnclaveClientException(500, "some failure"));
final JsonRpcErrorResponse response =
(JsonRpcErrorResponse) privxFindOnChainPrivacyGroup.response(request);
(JsonRpcErrorResponse) privxFindOnchainPrivacyGroup.response(request);
assertThat(response.getError()).isEqualTo(JsonRpcError.FIND_ONCHAIN_PRIVACY_GROUP_ERROR);
verify(privacyController).findOnChainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY);
verify(privacyController).findOnchainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY);
}
@Test
public void failsWithUnauthorizedErrorIfMultiTenancyValidationFails() {
when(privacyController.findOnChainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY))
when(privacyController.findOnchainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY))
.thenThrow(new MultiTenancyValidationException("validation failed"));
final JsonRpcResponse expectedResponse =
new JsonRpcErrorResponse(
request.getRequest().getId(), JsonRpcError.FIND_ONCHAIN_PRIVACY_GROUP_ERROR);
final JsonRpcResponse response = privxFindOnChainPrivacyGroup.response(request);
final JsonRpcResponse response = privxFindOnchainPrivacyGroup.response(request);
assertThat(response).isEqualTo(expectedResponse);
verify(privacyController).findOnChainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY);
verify(privacyController).findOnchainPrivacyGroupByMembers(ADDRESSES, ENCLAVE_PUBLIC_KEY);
}
}

@ -20,7 +20,7 @@ import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.when;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.privx.PrivxFindOnChainPrivacyGroup;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.privacy.methods.privx.PrivxFindOnchainPrivacyGroup;
import org.hyperledger.besu.ethereum.api.query.BlockchainQueries;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
@ -69,6 +69,6 @@ public class PrivxJsonRpcMethodsTest {
final JsonRpcMethod method = rpcMethods.get(PRIVX_FIND_PRIVACY_GROUP.getMethodName());
assertThat(method).isNotNull();
assertThat(method).isInstanceOf(PrivxFindOnChainPrivacyGroup.class);
assertThat(method).isInstanceOf(PrivxFindOnchainPrivacyGroup.class);
}
}

@ -22,7 +22,7 @@ import static org.hyperledger.besu.evm.precompile.MainnetPrecompiledContracts.po
import static org.hyperledger.besu.evm.precompile.MainnetPrecompiledContracts.populateForFrontier;
import static org.hyperledger.besu.evm.precompile.MainnetPrecompiledContracts.populateForIstanbul;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnChainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnchainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPluginPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPrecompiledContract;
import org.hyperledger.besu.evm.precompile.PrecompileContractRegistry;
@ -79,7 +79,7 @@ public abstract class MainnetPrecompiledContractRegistries {
.isOnchainPrivacyGroupsEnabled()) {
registry.put(
ONCHAIN_PRIVACY,
new OnChainPrivacyPrecompiledContract(
new OnchainPrivacyPrecompiledContract(
precompiledContractConfiguration.getGasCalculator(),
precompiledContractConfiguration.getPrivacyParameters()));
} else {

@ -109,7 +109,7 @@ public class PrivacyBlockProcessor implements BlockProcessor {
final BlockHeader blockHeader,
final List<Transaction> transactions) {
transactions.stream()
.filter(this::onChainAddToGroupPrivateMarkerTransactions)
.filter(this::onchainAddToGroupPrivateMarkerTransactions)
.forEach(
pmt -> {
final Bytes32 privateTransactionsLookupId =
@ -159,7 +159,7 @@ public class PrivacyBlockProcessor implements BlockProcessor {
});
}
private boolean onChainAddToGroupPrivateMarkerTransactions(final Transaction t) {
private boolean onchainAddToGroupPrivateMarkerTransactions(final Transaction t) {
return t.getTo().isPresent()
&& t.getTo().equals(Optional.of(ONCHAIN_PRIVACY))
&& t.getPayload().size() == 64;

@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.core.BlockImporter;
import org.hyperledger.besu.ethereum.core.GoQuorumPrivacyParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnChainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnchainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPluginPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor;
@ -318,9 +318,9 @@ public class ProtocolSpecBuilder {
privacyPluginPrecompiledContract.setPrivateTransactionProcessor(
privateTransactionProcessor);
} else if (privacyParameters.isOnchainPrivacyGroupsEnabled()) {
final OnChainPrivacyPrecompiledContract onChainPrivacyPrecompiledContract =
(OnChainPrivacyPrecompiledContract) precompileContractRegistry.get(ONCHAIN_PRIVACY);
onChainPrivacyPrecompiledContract.setPrivateTransactionProcessor(
final OnchainPrivacyPrecompiledContract onchainPrivacyPrecompiledContract =
(OnchainPrivacyPrecompiledContract) precompileContractRegistry.get(ONCHAIN_PRIVACY);
onchainPrivacyPrecompiledContract.setPrivateTransactionProcessor(
privateTransactionProcessor);
} else {
final PrivacyPrecompiledContract privacyPrecompiledContract =

@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.privacy.PrivateTransactionEvent;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionObserver;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionReceipt;
import org.hyperledger.besu.ethereum.privacy.VersionedPrivateTransaction;
import org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement;
import org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement;
import org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater;
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.rlp.BytesValueRLPInput;
@ -57,14 +57,14 @@ import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContract {
public class OnchainPrivacyPrecompiledContract extends PrivacyPrecompiledContract {
private static final Logger LOG = LogManager.getLogger();
private final Subscribers<PrivateTransactionObserver> privateTransactionEventObservers =
Subscribers.create();
public OnChainPrivacyPrecompiledContract(
public OnchainPrivacyPrecompiledContract(
final GasCalculator gasCalculator,
final Enclave enclave,
final WorldStateArchive worldStateArchive,
@ -76,10 +76,10 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac
worldStateArchive,
privateStateRootResolver,
privateStateGenesisAllocator,
"OnChainPrivacy");
"OnchainPrivacy");
}
public OnChainPrivacyPrecompiledContract(
public OnchainPrivacyPrecompiledContract(
final GasCalculator gasCalculator, final PrivacyParameters privacyParameters) {
this(
gasCalculator,
@ -250,7 +250,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac
return false;
}
if (!onChainPrivacyGroupVersionMatches(onchainPrivacyGroupContract, privacyGroupId, version)) {
if (!onchainPrivacyGroupVersionMatches(onchainPrivacyGroupContract, privacyGroupId, version)) {
LOG.debug(
"Privacy group version mismatch while trying to execute transaction with commitment {}",
(Hash) messageFrame.getContextVariable(KEY_TRANSACTION_HASH));
@ -322,7 +322,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac
&& privateTransaction
.getPayload()
.toHexString()
.startsWith(OnChainGroupManagement.ADD_PARTICIPANTS_METHOD_SIGNATURE.toHexString());
.startsWith(OnchainGroupManagement.ADD_PARTICIPANTS_METHOD_SIGNATURE.toHexString());
}
private boolean isRemovingParticipant(final PrivateTransaction privateTransaction) {
@ -330,7 +330,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac
&& privateTransaction
.getPayload()
.toHexString()
.startsWith(OnChainGroupManagement.REMOVE_PARTICIPANT_METHOD_SIGNATURE.toHexString());
.startsWith(OnchainGroupManagement.REMOVE_PARTICIPANT_METHOD_SIGNATURE.toHexString());
}
protected boolean isContractLocked(
@ -341,7 +341,7 @@ public class OnChainPrivacyPrecompiledContract extends PrivacyPrecompiledContrac
return canExecuteResult.map(Bytes::isZero).orElse(true);
}
protected boolean onChainPrivacyGroupVersionMatches(
protected boolean onchainPrivacyGroupVersionMatches(
final OnchainPrivacyGroupContract onchainPrivacyGroupContract,
final Bytes32 privacyGroupId,
final Bytes32 version) {

@ -15,9 +15,9 @@
package org.hyperledger.besu.ethereum.privacy;
import static org.hyperledger.besu.ethereum.core.PrivacyParameters.ONCHAIN_PRIVACY_PROXY;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.CAN_EXECUTE_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.GET_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.GET_VERSION_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.CAN_EXECUTE_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.GET_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.GET_VERSION_METHOD_SIGNATURE;
import org.hyperledger.besu.crypto.SECPSignature;
import org.hyperledger.besu.crypto.SignatureAlgorithm;

@ -262,14 +262,14 @@ public class PluginPrivacyController implements PrivacyController {
}
@Override
public List<PrivacyGroup> findOnChainPrivacyGroupByMembers(
public List<PrivacyGroup> findOnchainPrivacyGroupByMembers(
final List<String> asList, final String privacyUserId) {
throw new PrivacyConfigurationNotSupportedException(
"Method not supported when using PrivacyPlugin");
}
@Override
public Optional<PrivacyGroup> findOnChainPrivacyGroupAndAddNewMembers(
public Optional<PrivacyGroup> findOnchainPrivacyGroupAndAddNewMembers(
final Bytes privacyGroupId,
final String privacyUserId,
final PrivateTransaction privateTransaction) {

@ -71,7 +71,7 @@ public interface PrivacyController {
Optional<PrivacyGroup> findPrivacyGroupByGroupId(
final String privacyGroupId, final String privacyUserId);
List<PrivacyGroup> findOnChainPrivacyGroupByMembers(List<String> asList, String privacyUserId);
List<PrivacyGroup> findOnchainPrivacyGroupByMembers(List<String> asList, String privacyUserId);
Optional<Bytes> getContractCode(
final String privacyGroupId,
@ -79,7 +79,7 @@ public interface PrivacyController {
final Hash blockHash,
final String privacyUserId);
Optional<PrivacyGroup> findOnChainPrivacyGroupAndAddNewMembers(
Optional<PrivacyGroup> findOnchainPrivacyGroupAndAddNewMembers(
Bytes privacyGroupId, String privacyUserId, final PrivateTransaction privateTransaction);
List<PrivateTransactionWithMetadata> retrieveAddBlob(String addDataKey);

@ -62,7 +62,7 @@ public class PrivacyGroupUtil {
final PrivateTransaction privateTransaction) {
return maybePrivacyGroupId.flatMap(
privacyGroupId ->
privacyController.findOnChainPrivacyGroupAndAddNewMembers(
privacyController.findOnchainPrivacyGroupAndAddNewMembers(
privacyGroupId, privacyUserId, privateTransaction));
}

@ -20,7 +20,7 @@ import static org.hyperledger.besu.ethereum.core.PrivacyParameters.ONCHAIN_PRIVA
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement;
import org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
import org.hyperledger.besu.plugin.data.PrivacyGenesis;
@ -93,14 +93,14 @@ public class PrivateStateGenesisAllocator {
privateWorldStateUpdater.createAccount(DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT).getMutable();
// this is the code for the simple management contract
managementContract.setCode(OnChainGroupManagement.DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE);
managementContract.setCode(OnchainGroupManagement.DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE);
// inject proxy
final MutableAccount procyContract =
privateWorldStateUpdater.createAccount(ONCHAIN_PRIVACY_PROXY).getMutable();
// this is the code for the proxy contract
procyContract.setCode(OnChainGroupManagement.PROXY_RUNTIME_BYTECODE);
procyContract.setCode(OnchainGroupManagement.PROXY_RUNTIME_BYTECODE);
// manually set the management contract address so the proxy can trust it
procyContract.setStorageValue(
UInt256.ZERO, UInt256.fromBytes(Bytes32.leftPad(DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT)));

@ -16,9 +16,9 @@ package org.hyperledger.besu.ethereum.privacy;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hyperledger.besu.ethereum.core.PrivacyParameters.ONCHAIN_PRIVACY_PROXY;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.ADD_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.GET_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.GET_VERSION_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.ADD_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.GET_PARTICIPANTS_METHOD_SIGNATURE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.GET_VERSION_METHOD_SIGNATURE;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
@ -247,7 +247,7 @@ public class RestrictedDefaultPrivacyController implements PrivacyController {
// An exception is thrown if the offchain group cannot be found
LOG.debug("Offchain privacy group not found: {}", privacyGroupId);
}
return findOnChainPrivacyGroupByGroupId(Bytes.fromBase64String(privacyGroupId), privacyUserId);
return findOnchainPrivacyGroupByGroupId(Bytes.fromBase64String(privacyGroupId), privacyUserId);
}
@Override
@ -257,7 +257,7 @@ public class RestrictedDefaultPrivacyController implements PrivacyController {
}
@Override
public List<PrivacyGroup> findOnChainPrivacyGroupByMembers(
public List<PrivacyGroup> findOnchainPrivacyGroupByMembers(
final List<String> addresses, final String privacyUserId) {
final ArrayList<PrivacyGroup> privacyGroups = new ArrayList<>();
final PrivacyGroupHeadBlockMap privacyGroupHeadBlockMap =
@ -269,7 +269,7 @@ public class RestrictedDefaultPrivacyController implements PrivacyController {
.forEach(
c -> {
final Optional<PrivacyGroup> maybePrivacyGroup =
findOnChainPrivacyGroupByGroupId(c, privacyUserId);
findOnchainPrivacyGroupByGroupId(c, privacyUserId);
if (maybePrivacyGroup.isPresent()
&& maybePrivacyGroup.get().getMembers().containsAll(addresses)) {
privacyGroups.add(maybePrivacyGroup.get());
@ -278,7 +278,7 @@ public class RestrictedDefaultPrivacyController implements PrivacyController {
return privacyGroups;
}
public Optional<PrivacyGroup> findOnChainPrivacyGroupByGroupId(
public Optional<PrivacyGroup> findOnchainPrivacyGroupByGroupId(
final Bytes privacyGroupId, final String enclaveKey) {
// get the privateFor list from the management contract
final Optional<TransactionProcessingResult> privateTransactionSimulatorResultOptional =
@ -306,7 +306,7 @@ public class RestrictedDefaultPrivacyController implements PrivacyController {
}
@Override
public Optional<PrivacyGroup> findOnChainPrivacyGroupAndAddNewMembers(
public Optional<PrivacyGroup> findOnchainPrivacyGroupAndAddNewMembers(
final Bytes privacyGroupId,
final String privacyUserId,
final PrivateTransaction privateTransaction) {
@ -481,11 +481,11 @@ public class RestrictedDefaultPrivacyController implements PrivacyController {
privateTransaction.getPrivacyGroupId().get().toBase64String(),
buildCallParams(GET_VERSION_METHOD_SIGNATURE));
new VersionedPrivateTransaction(privateTransaction, result).writeTo(rlpOutput);
final List<String> onChainPrivateFor = privacyGroup.getMembers();
final List<String> onchainPrivateFor = privacyGroup.getMembers();
return enclave.send(
rlpOutput.encoded().toBase64String(),
privateTransaction.getPrivateFrom().toBase64String(),
onChainPrivateFor);
onchainPrivateFor);
} else if (privacyGroup.getType() == PrivacyGroup.Type.PANTHEON) {
// offchain privacy group
privateTransaction.writeTo(rlpOutput);

@ -208,14 +208,14 @@ public class RestrictedMultiTenancyPrivacyController implements PrivacyControlle
}
@Override
public List<PrivacyGroup> findOnChainPrivacyGroupByMembers(
public List<PrivacyGroup> findOnchainPrivacyGroupByMembers(
final List<String> addresses, final String privacyUserId) {
if (!addresses.contains(privacyUserId)) {
throw new MultiTenancyValidationException(
"Privacy group addresses must contain the enclave public key");
}
final List<PrivacyGroup> resultantGroups =
privacyController.findOnChainPrivacyGroupByMembers(addresses, privacyUserId);
privacyController.findOnchainPrivacyGroupByMembers(addresses, privacyUserId);
return resultantGroups.stream()
.filter(g -> g.getMembers().contains(privacyUserId))
.collect(Collectors.toList());
@ -243,12 +243,12 @@ public class RestrictedMultiTenancyPrivacyController implements PrivacyControlle
}
@Override
public Optional<PrivacyGroup> findOnChainPrivacyGroupAndAddNewMembers(
public Optional<PrivacyGroup> findOnchainPrivacyGroupAndAddNewMembers(
final Bytes privacyGroupId,
final String privacyUserId,
final PrivateTransaction privateTransaction) {
final Optional<PrivacyGroup> maybePrivacyGroup =
privacyController.findOnChainPrivacyGroupAndAddNewMembers(
privacyController.findOnchainPrivacyGroupAndAddNewMembers(
privacyGroupId, privacyUserId, privateTransaction);
// The check that the privacyUserId is a member (if the group already exists) is done in the
// DefaultPrivacyController.

@ -89,11 +89,11 @@ public class PrivateTransactionDataFixture {
return privateMarkerTransaction(VALID_BASE64_ENCLAVE_KEY, DEFAULT_PRIVACY);
}
public static Transaction privateMarkerTransactionOnChain() {
public static Transaction privateMarkerTransactionOnchain() {
return privateMarkerTransaction(VALID_BASE64_ENCLAVE_KEY, ONCHAIN_PRIVACY);
}
public static Transaction privateMarkerTransactionOnChainAdd() {
public static Transaction privateMarkerTransactionOnchainAdd() {
return privateMarkerTransaction(
Bytes.concatenate(VALID_BASE64_ENCLAVE_KEY, VALID_BASE64_ENCLAVE_KEY), ONCHAIN_PRIVACY);
}

@ -25,7 +25,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnChainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnchainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPrecompiledContract;
import org.hyperledger.besu.evm.gascalculator.GasCalculator;
import org.hyperledger.besu.evm.precompile.PrecompileContractRegistry;
@ -62,7 +62,7 @@ public class MainnetPrecompiledContractRegistriesTest {
verify(privacyParameters).isEnabled();
verify(privacyParameters).isOnchainPrivacyGroupsEnabled();
assertThat(reg.get(ONCHAIN_PRIVACY)).isInstanceOf(OnChainPrivacyPrecompiledContract.class);
assertThat(reg.get(ONCHAIN_PRIVACY)).isInstanceOf(OnchainPrivacyPrecompiledContract.class);
assertThat(reg.get(DEFAULT_PRIVACY)).isNull();
}

@ -134,18 +134,18 @@ public class PrivacyBlockProcessorTest {
final Block firstBlock =
blockDataGenerator.block(
BlockDataGenerator.BlockOptions.create()
.addTransaction(PrivateTransactionDataFixture.privateMarkerTransactionOnChain()));
.addTransaction(PrivateTransactionDataFixture.privateMarkerTransactionOnchain()));
final Block secondBlock =
blockDataGenerator.block(
BlockDataGenerator.BlockOptions.create()
.addTransaction(
PrivateTransactionDataFixture.privateMarkerTransactionOnChainAdd()));
PrivateTransactionDataFixture.privateMarkerTransactionOnchainAdd()));
when(enclave.receive(any()))
.thenReturn(
PrivateTransactionDataFixture.generateAddToGroupReceiveResponse(
PrivateTransactionDataFixture.privateTransactionBesu(),
PrivateTransactionDataFixture.privateMarkerTransactionOnChain()));
PrivateTransactionDataFixture.privateMarkerTransactionOnchain()));
when(blockchain.getTransactionLocation(any()))
.thenReturn(Optional.of(new TransactionLocation(firstBlock.getHash(), 0)));
when(blockchain.getBlockByHash(any())).thenReturn(Optional.of(firstBlock));

@ -69,7 +69,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.mockito.Mockito;
public class OnChainPrivacyPrecompiledContractTest {
public class OnchainPrivacyPrecompiledContractTest {
@Rule public final TemporaryFolder temp = new TemporaryFolder();
@ -144,7 +144,7 @@ public class OnChainPrivacyPrecompiledContractTest {
@Test
public void testPayloadFoundInEnclave() {
final Enclave enclave = mock(Enclave.class);
final OnChainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final OnchainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final List<Log> logs = new ArrayList<>();
contract.setPrivateTransactionProcessor(
mockPrivateTxProcessor(
@ -161,7 +161,7 @@ public class OnChainPrivacyPrecompiledContractTest {
new ReceiveResponse(payload, PAYLOAD_TEST_PRIVACY_GROUP_ID, privateFrom);
when(enclave.receive(any())).thenReturn(response);
final OnChainPrivacyPrecompiledContract contractSpy = spy(contract);
final OnchainPrivacyPrecompiledContract contractSpy = spy(contract);
Mockito.doReturn(true)
.when(contractSpy)
.canExecute(any(), any(), any(), any(), any(), any(), any(), any());
@ -195,7 +195,7 @@ public class OnChainPrivacyPrecompiledContractTest {
@Test
public void testEnclaveBelowRequiredVersion() {
final Enclave enclave = mock(Enclave.class);
final OnChainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final OnchainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final VersionedPrivateTransaction versionedPrivateTransaction =
versionedPrivateTransactionBesu();
final byte[] payload = convertVersionedPrivateTransactionToBytes(versionedPrivateTransaction);
@ -213,7 +213,7 @@ public class OnChainPrivacyPrecompiledContractTest {
@Test
public void testPayloadNotMatchingPrivateFrom() {
final Enclave enclave = mock(Enclave.class);
final OnChainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final OnchainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final VersionedPrivateTransaction versionedPrivateTransaction =
versionedPrivateTransactionBesu();
final byte[] payload = convertVersionedPrivateTransactionToBytes(versionedPrivateTransaction);
@ -260,16 +260,16 @@ public class OnChainPrivacyPrecompiledContractTest {
private void assertThatComputeReturnsEmptyGivenContractMembershipQueryReturns(
final Bytes memberList) {
final Enclave enclave = mock(Enclave.class);
final OnChainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final OnchainPrivacyPrecompiledContract contract = buildPrivacyPrecompiledContract(enclave);
final List<Log> logs = new ArrayList<>();
contract.setPrivateTransactionProcessor(
mockPrivateTxProcessor(
TransactionProcessingResult.successful(logs, 0, 0, memberList, null)));
final OnChainPrivacyPrecompiledContract contractSpy = spy(contract);
final OnchainPrivacyPrecompiledContract contractSpy = spy(contract);
Mockito.doReturn(false).when(contractSpy).isContractLocked(any(), any());
Mockito.doReturn(true).when(contractSpy).onChainPrivacyGroupVersionMatches(any(), any(), any());
Mockito.doReturn(true).when(contractSpy).onchainPrivacyGroupVersionMatches(any(), any(), any());
final VersionedPrivateTransaction privateTransaction = versionedPrivateTransactionBesu();
final byte[] payload = convertVersionedPrivateTransactionToBytes(privateTransaction);
@ -289,8 +289,8 @@ public class OnChainPrivacyPrecompiledContractTest {
public void testInvalidPrivateTransaction() {
final Enclave enclave = mock(Enclave.class);
final OnChainPrivacyPrecompiledContract contract =
new OnChainPrivacyPrecompiledContract(
final OnchainPrivacyPrecompiledContract contract =
new OnchainPrivacyPrecompiledContract(
new SpuriousDragonGasCalculator(),
enclave,
worldStateArchive,
@ -302,7 +302,7 @@ public class OnChainPrivacyPrecompiledContractTest {
TransactionProcessingResult.invalid(
ValidationResult.invalid(TransactionInvalidReason.INCORRECT_NONCE))));
final OnChainPrivacyPrecompiledContract contractSpy = spy(contract);
final OnchainPrivacyPrecompiledContract contractSpy = spy(contract);
Mockito.doReturn(true)
.when(contractSpy)
.canExecute(any(), any(), any(), any(), any(), any(), any(), any());
@ -330,8 +330,8 @@ public class OnChainPrivacyPrecompiledContractTest {
return bytesValueRLPOutput.encoded().toBase64String().getBytes(UTF_8);
}
private OnChainPrivacyPrecompiledContract buildPrivacyPrecompiledContract(final Enclave enclave) {
return new OnChainPrivacyPrecompiledContract(
private OnchainPrivacyPrecompiledContract buildPrivacyPrecompiledContract(final Enclave enclave) {
return new OnchainPrivacyPrecompiledContract(
new SpuriousDragonGasCalculator(),
enclave,
worldStateArchive,

@ -18,8 +18,8 @@ package org.hyperledger.besu.ethereum.privacy;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.core.PrivacyParameters.DEFAULT_ONCHAIN_PRIVACY_MANAGEMENT;
import static org.hyperledger.besu.ethereum.core.PrivacyParameters.ONCHAIN_PRIVACY_PROXY;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE;
import static org.hyperledger.besu.ethereum.privacy.group.OnChainGroupManagement.PROXY_RUNTIME_BYTECODE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.DEFAULT_GROUP_MANAGEMENT_RUNTIME_BYTECODE;
import static org.hyperledger.besu.ethereum.privacy.group.OnchainGroupManagement.PROXY_RUNTIME_BYTECODE;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
@ -82,7 +82,7 @@ public class PrivateStateGenesisAllocatorTest {
});
@Test
public void whenOnChainDisabledAndNoAccountsProvidedNoGenesisIsApplied() {
public void whenOnchainDisabledAndNoAccountsProvidedNoGenesisIsApplied() {
PrivateStateGenesisAllocator privateStateGenesisAllocator =
new PrivateStateGenesisAllocator(
false, (privacyGroupId, blockNumber) -> Collections::emptyList);
@ -94,7 +94,7 @@ public class PrivateStateGenesisAllocatorTest {
}
@Test
public void whenOnChainEnabledAndNoAccountsProvidedPrivacyManagementContractIsApplied() {
public void whenOnchainEnabledAndNoAccountsProvidedPrivacyManagementContractIsApplied() {
PrivateStateGenesisAllocator privateStateGenesisAllocator =
new PrivateStateGenesisAllocator(
true, (privacyGroupId, blockNumber) -> Collections::emptyList);
@ -108,7 +108,7 @@ public class PrivateStateGenesisAllocatorTest {
}
@Test
public void whenOnChainEnabledAndAccountsProvidedPrivacyManagementContractAndGenesisIsApplied() {
public void whenOnchainEnabledAndAccountsProvidedPrivacyManagementContractAndGenesisIsApplied() {
PrivateStateGenesisAllocator privateStateGenesisAllocator =
new PrivateStateGenesisAllocator(true, (privacyGroupId, blockNumber) -> privacyGenesis);
@ -122,7 +122,7 @@ public class PrivateStateGenesisAllocatorTest {
}
@Test
public void whenOnChainDisabledAndAccountsProvidedPrivacyManagementContractAndGenesisIsApplied() {
public void whenOnchainDisabledAndAccountsProvidedPrivacyManagementContractAndGenesisIsApplied() {
PrivateStateGenesisAllocator privateStateGenesisAllocator =
new PrivateStateGenesisAllocator(false, (privacyGroupId, blockNumber) -> privacyGenesis);

@ -126,7 +126,7 @@ public class PrivateTransactionLocatorTest {
@Test
public void locateBesuPrivateTransactionSentToOnchainPrivacyGroup() {
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnChain();
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnchain();
final PrivateTransaction privateTransaction = privateTransactionBesu();
final ExecutedPrivateTransaction expectedPrivateTx =
@ -160,7 +160,7 @@ public class PrivateTransactionLocatorTest {
@Test
public void locateBesuPrivateTransactionFromAddBlobSentToOnchainPrivacyGroup() {
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnChain();
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnchain();
final PrivateTransaction privateTransaction = privateTransactionBesu();
final ExecutedPrivateTransaction expectedPrivateTx =
@ -174,7 +174,7 @@ public class PrivateTransactionLocatorTest {
@Test
public void locatePrivateTransactionWithNoEntryOnPGHeadBlockMap() {
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnChain();
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnchain();
final PrivateTransaction privateTransaction = privateTransactionBesu();
createExecutedPrivateTransactionFromAddBlob(pmt, privateTransaction);
@ -190,7 +190,7 @@ public class PrivateTransactionLocatorTest {
@Test
public void locateBesuPrivateTransactionNotFoundInAddBlob() {
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnChain();
final Transaction pmt = PrivateTransactionDataFixture.privateMarkerTransactionOnchain();
final PrivateTransaction privateTransaction = privateTransactionBesu();
createExecutedPrivateTransactionFromAddBlob(pmt, privateTransaction);

@ -164,7 +164,7 @@ public class RestrictedDefaultPrivacyControllerTest {
}
@Test
public void findOnChainPrivacyGroups() {
public void findOnchainPrivacyGroups() {
final List<String> privacyGroupAddresses = newArrayList(ENCLAVE_PUBLIC_KEY, ENCLAVE_KEY2);
final PrivacyGroup privacyGroup =
@ -193,7 +193,7 @@ public class RestrictedDefaultPrivacyControllerTest {
Optional.empty())));
final List<PrivacyGroup> privacyGroups =
privacyController.findOnChainPrivacyGroupByMembers(
privacyController.findOnchainPrivacyGroupByMembers(
privacyGroupAddresses, ENCLAVE_PUBLIC_KEY);
assertThat(privacyGroups).hasSize(1);
assertThat(privacyGroups.get(0)).isEqualToComparingFieldByField(privacyGroup);

@ -79,12 +79,12 @@ public class BlockHashLookupTest {
}
@Test
public void shouldReturnEmptyHashWhenRequestedBlockNotOnChain() {
public void shouldReturnEmptyHashWhenRequestedBlockNotOnchain() {
Assertions.assertThat(lookup.apply(CURRENT_BLOCK_NUMBER + 20L)).isEqualTo(Hash.ZERO);
}
@Test
public void shouldReturnEmptyHashWhenParentBlockNotOnChain() {
public void shouldReturnEmptyHashWhenParentBlockNotOnchain() {
final BlockHashLookup lookupWithUnavailableParent =
new BlockHashLookup(
new BlockHeaderTestFixture().number(CURRENT_BLOCK_NUMBER + 20).buildHeader(),

@ -201,7 +201,7 @@ public class TransactionPoolTest {
}
@Test
public void shouldRemoveTransactionsFromPendingListWhenIncludedInBlockOnChain() {
public void shouldRemoveTransactionsFromPendingListWhenIncludedInBlockOnchain() {
transactions.addRemoteTransaction(transaction1);
assertTransactionPending(transaction1);
appendBlock(transaction1);

@ -40,6 +40,6 @@ class IBFTGenesisFileModule extends GenesisFileModule {
@Override
BlockHeaderFunctions blockHashFunction() {
return BftBlockHeaderFunctions.forOnChainBlock(bftExtraDataEncoder);
return BftBlockHeaderFunctions.forOnchainBlock(bftExtraDataEncoder);
}
}

@ -52,7 +52,7 @@ public class AccountPermissioningController {
public boolean isPermitted(
final Transaction transaction,
final boolean includeLocalCheck,
final boolean includeOnChainCheck) {
final boolean includeOnchainCheck) {
final boolean checkPermissions =
goQuorumQip714Gate.map(GoQuorumQip714Gate::shouldCheckPermissions).orElse(true);
if (!checkPermissions) {
@ -76,7 +76,7 @@ public class AccountPermissioningController {
.orElse(true);
}
if (includeOnChainCheck) {
if (includeOnchainCheck) {
permittedOnchain =
transactionSmartContractPermissioningController
.map(c -> c.isPermitted(transaction))

@ -138,7 +138,7 @@ public class MessageCallProcessor extends AbstractMessageProcessor {
final Bytes output = contract.compute(frame.getInputData(), frame);
operationTracer.tracePrecompileCall(frame, gasRequirement, output);
if (output != null) {
if (contract.getName().equals("Privacy") || contract.getName().equals("OnChainPrivacy")) {
if (contract.getName().equals("Privacy") || contract.getName().equals("OnchainPrivacy")) {
// do not decrement the gas requirement for a privacy pre-compile contract call -> leads
// to discrepancies in receipts root between public and private nodes in a network.
frame.incrementRemainingGas(gasRequirement);

@ -47,7 +47,7 @@ import org.web3j.tx.gas.ContractGasProvider;
* <p>Generated with web3j version 4.5.16.
*/
@SuppressWarnings("rawtypes")
public class OnChainPrivacyGroupManagementInterface extends Contract {
public class OnchainPrivacyGroupManagementInterface extends Contract {
public static final String BINARY = "";
public static final String FUNC_ADDPARTICIPANTS = "addParticipants";
@ -67,7 +67,7 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
public static final String FUNC_UNLOCK = "unlock";
@Deprecated
protected OnChainPrivacyGroupManagementInterface(
protected OnchainPrivacyGroupManagementInterface(
String contractAddress,
Web3j web3j,
Credentials credentials,
@ -76,7 +76,7 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}
protected OnChainPrivacyGroupManagementInterface(
protected OnchainPrivacyGroupManagementInterface(
String contractAddress,
Web3j web3j,
Credentials credentials,
@ -85,7 +85,7 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
}
@Deprecated
protected OnChainPrivacyGroupManagementInterface(
protected OnchainPrivacyGroupManagementInterface(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
@ -94,7 +94,7 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
protected OnChainPrivacyGroupManagementInterface(
protected OnchainPrivacyGroupManagementInterface(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
@ -180,49 +180,49 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
}
@Deprecated
public static OnChainPrivacyGroupManagementInterface load(
public static OnchainPrivacyGroupManagementInterface load(
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
return new OnChainPrivacyGroupManagementInterface(
return new OnchainPrivacyGroupManagementInterface(
contractAddress, web3j, credentials, gasPrice, gasLimit);
}
@Deprecated
public static OnChainPrivacyGroupManagementInterface load(
public static OnchainPrivacyGroupManagementInterface load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
return new OnChainPrivacyGroupManagementInterface(
return new OnchainPrivacyGroupManagementInterface(
contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public static OnChainPrivacyGroupManagementInterface load(
public static OnchainPrivacyGroupManagementInterface load(
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
return new OnChainPrivacyGroupManagementInterface(
return new OnchainPrivacyGroupManagementInterface(
contractAddress, web3j, credentials, contractGasProvider);
}
public static OnChainPrivacyGroupManagementInterface load(
public static OnchainPrivacyGroupManagementInterface load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
return new OnChainPrivacyGroupManagementInterface(
return new OnchainPrivacyGroupManagementInterface(
contractAddress, web3j, transactionManager, contractGasProvider);
}
public static RemoteCall<OnChainPrivacyGroupManagementInterface> deploy(
public static RemoteCall<OnchainPrivacyGroupManagementInterface> deploy(
Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return deployRemoteCall(
OnChainPrivacyGroupManagementInterface.class,
OnchainPrivacyGroupManagementInterface.class,
web3j,
credentials,
contractGasProvider,
@ -231,10 +231,10 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
}
@Deprecated
public static RemoteCall<OnChainPrivacyGroupManagementInterface> deploy(
public static RemoteCall<OnchainPrivacyGroupManagementInterface> deploy(
Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(
OnChainPrivacyGroupManagementInterface.class,
OnchainPrivacyGroupManagementInterface.class,
web3j,
credentials,
gasPrice,
@ -243,10 +243,10 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
"");
}
public static RemoteCall<OnChainPrivacyGroupManagementInterface> deploy(
public static RemoteCall<OnchainPrivacyGroupManagementInterface> deploy(
Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
return deployRemoteCall(
OnChainPrivacyGroupManagementInterface.class,
OnchainPrivacyGroupManagementInterface.class,
web3j,
transactionManager,
contractGasProvider,
@ -255,13 +255,13 @@ public class OnChainPrivacyGroupManagementInterface extends Contract {
}
@Deprecated
public static RemoteCall<OnChainPrivacyGroupManagementInterface> deploy(
public static RemoteCall<OnchainPrivacyGroupManagementInterface> deploy(
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
return deployRemoteCall(
OnChainPrivacyGroupManagementInterface.class,
OnchainPrivacyGroupManagementInterface.class,
web3j,
transactionManager,
gasPrice,
Loading…
Cancel
Save