use of org.hyperledger.enclave.testutil.EnclaveKeyConfiguration in project besu by hyperledger.
the class PluginPrivacySigningAcceptanceTest method setup.
@Before
public void setup() throws IOException {
minerNode = privacyBesu.create(new PrivacyNodeConfiguration(false, false, true, new BesuNodeConfigurationBuilder().name("miner").miningEnabled().jsonRpcEnabled().webSocketEnabled().enablePrivateTransactions().keyFilePath(BOB.getPrivateKeyPath()).plugins(Collections.singletonList("testPlugins")).extraCLIOptions(List.of("--plugin-privacy-service-encryption-prefix=0xAA", "--plugin-privacy-service-signing-enabled=true", "--plugin-privacy-service-signing-key=8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63")).build(), new EnclaveKeyConfiguration(BOB.getEnclaveKeyPaths(), BOB.getEnclavePrivateKeyPaths())), EnclaveType.NOOP, Optional.empty());
privacyCluster.start(minerNode);
}
use of org.hyperledger.enclave.testutil.EnclaveKeyConfiguration in project besu by hyperledger.
the class PrivacyPrecompiledContractIntegrationTest method setUpOnce.
@BeforeAll
public static void setUpOnce() throws Exception {
testHarness = TesseraTestHarnessFactory.create("enclave", Files.createTempDirectory(folder, "enclave"), new EnclaveKeyConfiguration("enclave_key_0.pub", "enclave_key_1.key"), Optional.empty());
testHarness.start();
final EnclaveFactory factory = new EnclaveFactory(vertx);
enclave = factory.createVertxEnclave(testHarness.clientUrl());
messageFrame = mock(MessageFrame.class);
final BlockDataGenerator blockGenerator = new BlockDataGenerator();
final Block genesis = blockGenerator.genesisBlock();
final Block block = blockGenerator.block(new BlockDataGenerator.BlockOptions().setParentHash(genesis.getHeader().getHash()));
when(messageFrame.getBlockValues()).thenReturn(block.getHeader());
final PrivateMetadataUpdater privateMetadataUpdater = mock(PrivateMetadataUpdater.class);
when(privateMetadataUpdater.getPrivateBlockMetadata(any())).thenReturn(null);
when(privateMetadataUpdater.getPrivacyGroupHeadBlockMap()).thenReturn(PrivacyGroupHeadBlockMap.empty());
when(messageFrame.getContextVariable(eq(PrivateStateUtils.KEY_IS_PERSISTING_PRIVATE_STATE), anyBoolean())).thenReturn(false);
when(messageFrame.getContextVariable(eq(PrivateStateUtils.KEY_PRIVATE_METADATA_UPDATER))).thenReturn(privateMetadataUpdater);
when(messageFrame.hasContextVariable(eq(PrivateStateUtils.KEY_PRIVATE_METADATA_UPDATER))).thenReturn(true);
worldStateArchive = mock(WorldStateArchive.class);
final MutableWorldState mutableWorldState = mock(MutableWorldState.class);
when(mutableWorldState.updater()).thenReturn(mock(WorldUpdater.class));
when(worldStateArchive.getMutable()).thenReturn(mutableWorldState);
when(worldStateArchive.getMutable(any(), any())).thenReturn(Optional.of(mutableWorldState));
privateStateStorage = mock(PrivateStateStorage.class);
final PrivateStateStorage.Updater storageUpdater = mock(PrivateStateStorage.Updater.class);
when(privateStateStorage.getPrivacyGroupHeadBlockMap(any())).thenReturn(Optional.of(PrivacyGroupHeadBlockMap.empty()));
when(storageUpdater.putPrivateBlockMetadata(nullable(Bytes32.class), nullable(Bytes32.class), any())).thenReturn(storageUpdater);
when(storageUpdater.putTransactionReceipt(nullable(Bytes32.class), nullable(Bytes32.class), any())).thenReturn(storageUpdater);
when(privateStateStorage.updater()).thenReturn(storageUpdater);
}
use of org.hyperledger.enclave.testutil.EnclaveKeyConfiguration in project besu by hyperledger.
the class PrivGetPrivateTransactionIntegrationTest method setUp.
@BeforeEach
public void setUp() throws Exception {
vertx = Vertx.vertx();
testHarness = TesseraTestHarnessFactory.create("enclave", Files.createTempDirectory(folder, "enclave"), new EnclaveKeyConfiguration("enclave_key_0.pub", "enclave_key_0.key"), Optional.empty());
testHarness.start();
final EnclaveFactory factory = new EnclaveFactory(vertx);
enclave = factory.createVertxEnclave(testHarness.clientUrl());
privacyController = new RestrictedDefaultPrivacyController(blockchain, privateStateStorage, enclave, null, null, null, null, null);
}
Aggregations