-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/hyperledger/besu
- Loading branch information
Showing
32 changed files
with
893 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...org/hyperledger/besu/tests/acceptance/dsl/transaction/privacy/PrivGetCodeTransaction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.tests.acceptance.dsl.transaction.privacy; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.hyperledger.besu.ethereum.core.Address; | ||
import org.hyperledger.besu.tests.acceptance.dsl.transaction.NodeRequests; | ||
import org.hyperledger.besu.tests.acceptance.dsl.transaction.Transaction; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.tuweni.bytes.Bytes; | ||
|
||
public class PrivGetCodeTransaction implements Transaction<Bytes> { | ||
|
||
private final String privacyGroupId; | ||
private final Address contractAddress; | ||
private final String blockParameter; | ||
|
||
public PrivGetCodeTransaction( | ||
final String privacyGroupId, final Address contractAddress, final String blockParameter) { | ||
this.privacyGroupId = privacyGroupId; | ||
this.contractAddress = contractAddress; | ||
this.blockParameter = blockParameter; | ||
} | ||
|
||
@Override | ||
public Bytes execute(final NodeRequests node) { | ||
try { | ||
final PrivacyRequestFactory.GetCodeResponse response = | ||
node.privacy() | ||
.privGetCode(privacyGroupId, contractAddress.toHexString(), blockParameter) | ||
.send(); | ||
assertThat(response).as("check response is not null").isNotNull(); | ||
assertThat(response.getResult()).as("check code in response isn't null").isNotNull(); | ||
return Bytes.fromHexString(response.getResult()); | ||
} catch (final IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
...sts/src/test/java/org/hyperledger/besu/tests/web3j/privacy/PrivGetCodeAcceptanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.tests.web3j.privacy; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.hyperledger.besu.ethereum.core.Address; | ||
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyAcceptanceTestBase; | ||
import org.hyperledger.besu.tests.acceptance.dsl.privacy.PrivacyNode; | ||
import org.hyperledger.besu.tests.web3j.generated.EventEmitter; | ||
|
||
import org.apache.tuweni.bytes.Bytes; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.web3j.protocol.besu.response.privacy.PrivacyGroup; | ||
import org.web3j.utils.Base64String; | ||
|
||
public class PrivGetCodeAcceptanceTest extends PrivacyAcceptanceTestBase { | ||
|
||
private PrivacyNode alice; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
alice = | ||
privacyBesu.createPrivateTransactionEnabledMinerNode( | ||
"alice", privacyAccountResolver.resolve(0)); | ||
privacyCluster.start(alice); | ||
} | ||
|
||
@Test | ||
public void privGetCodeReturnsDeployedContractBytecode() { | ||
final String privacyGroupId = createPrivacyGroup(); | ||
final EventEmitter eventEmitterContract = deployPrivateContract(privacyGroupId); | ||
|
||
final Bytes deployedContractCode = | ||
alice.execute( | ||
privacyTransactions.privGetCode( | ||
privacyGroupId, | ||
Address.fromHexString(eventEmitterContract.getContractAddress()), | ||
"latest")); | ||
|
||
assertThat(eventEmitterContract.getContractBinary()) | ||
.contains(deployedContractCode.toUnprefixedHexString()); | ||
} | ||
|
||
private EventEmitter deployPrivateContract(final String privacyGroupId) { | ||
final EventEmitter eventEmitter = | ||
alice.execute( | ||
privateContractTransactions.createSmartContractWithPrivacyGroupId( | ||
EventEmitter.class, | ||
alice.getTransactionSigningKey(), | ||
POW_CHAIN_ID, | ||
alice.getEnclaveKey(), | ||
privacyGroupId)); | ||
|
||
privateContractVerifier | ||
.validPrivateContractDeployed( | ||
eventEmitter.getContractAddress(), alice.getAddress().toString()) | ||
.verify(eventEmitter); | ||
return eventEmitter; | ||
} | ||
|
||
private String createPrivacyGroup() { | ||
final String privacyGroupId = | ||
alice.execute( | ||
privacyTransactions.createPrivacyGroup("myGroupName", "my group description", alice)); | ||
|
||
assertThat(privacyGroupId).isNotNull(); | ||
|
||
final PrivacyGroup expected = | ||
new PrivacyGroup( | ||
privacyGroupId, | ||
PrivacyGroup.Type.PANTHEON, | ||
"myGroupName", | ||
"my group description", | ||
Base64String.wrapList(alice.getEnclaveKey())); | ||
|
||
alice.verify(privateTransactionVerifier.validPrivacyGroupCreated(expected)); | ||
|
||
return privacyGroupId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 0 additions & 72 deletions
72
besu/src/main/java/org/hyperledger/besu/cli/options/PrunerOptions.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.