diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivacyClusterAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivacyClusterAcceptanceTest.java index 2a7e19cd079..97a12eb92d5 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivacyClusterAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivacyClusterAcceptanceTest.java @@ -98,7 +98,29 @@ public void onlyAliceAndBobCanExecuteContract() { bob.verify( privateTransactionVerifier.validPrivateTransactionReceipt( transactionHash, expectedReceipt)); + charlie.verify(privateTransactionVerifier.noPrivateTransactionReceipt(transactionHash)); + + // When Alice executes a contract call in the wrong privacy group the transaction should pass + // but it should NOT return any output + final String transactionHash2 = + alice.execute( + privateContractTransactions.callSmartContract( + eventEmitter.getContractAddress(), + eventEmitter.value().encodeFunctionCall(), + alice.getTransactionSigningKey(), + POW_CHAIN_ID, + alice.getEnclaveKey(), + charlie.getEnclaveKey())); + + final PrivateTransactionReceipt expectedReceipt2 = + alice.execute(privacyTransactions.getPrivateTransactionReceipt(transactionHash2)); + + assertThat(expectedReceipt2.getOutput()).isEqualTo("0x"); + + charlie.verify( + privateTransactionVerifier.validPrivateTransactionReceipt( + transactionHash2, expectedReceipt2)); } @Test diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutablePrivateWorldStateUpdater.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutablePrivateWorldStateUpdater.java index 4a0152e1096..48bc8293222 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutablePrivateWorldStateUpdater.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/worldstate/DefaultMutablePrivateWorldStateUpdater.java @@ -60,7 +60,7 @@ public DefaultEvmAccount getAccount(final Address address) { publicAccount.setImmutable(true); return publicAccount; } - return null; + return privateAccount; } @Override