use of org.hyperledger.besu.ethereum.privacy.PrivateStateGenesisAllocator in project besu by hyperledger.
the class PrivacyBlockProcessorTest method setUp.
@Before
public void setUp() {
blockProcessor = mock(AbstractBlockProcessor.class);
privateStateStorage = new PrivateStateKeyValueStorage(new InMemoryKeyValueStorage());
privateWorldStateArchive = mock(WorldStateArchive.class);
enclave = mock(Enclave.class);
protocolSchedule = mock(ProtocolSchedule.class);
this.privacyBlockProcessor = new PrivacyBlockProcessor(blockProcessor, protocolSchedule, enclave, privateStateStorage, privateWorldStateArchive, new PrivateStateRootResolver(privateStateStorage), new PrivateStateGenesisAllocator(true, (privacyGroupId, blockNumber) -> Collections::emptyList));
publicWorldStateArchive = mock(WorldStateArchive.class);
privacyBlockProcessor.setPublicWorldStateArchive(publicWorldStateArchive);
}
use of org.hyperledger.besu.ethereum.privacy.PrivateStateGenesisAllocator in project besu by hyperledger.
the class PrivacyPrecompiledContractIntegrationTest method testSendAndReceive.
@Test
public void testSendAndReceive() {
final List<String> publicKeys = testHarness.getPublicKeys();
final PrivateTransaction privateTransaction = PrivateTransactionDataFixture.privateContractDeploymentTransactionBesu(publicKeys.get(0));
final BytesValueRLPOutput bytesValueRLPOutput = new BytesValueRLPOutput();
privateTransaction.writeTo(bytesValueRLPOutput);
final String s = bytesValueRLPOutput.encoded().toBase64String();
final SendResponse sr = enclave.send(s, publicKeys.get(0), Lists.newArrayList(publicKeys.get(0)));
final PrivacyPrecompiledContract privacyPrecompiledContract = new PrivacyPrecompiledContract(new SpuriousDragonGasCalculator(), enclave, worldStateArchive, new PrivateStateRootResolver(privateStateStorage), new PrivateStateGenesisAllocator(false, (privacyGroupId, blockNumber) -> Collections::emptyList), "IntegrationTest");
privacyPrecompiledContract.setPrivateTransactionProcessor(mockPrivateTxProcessor());
final PrecompiledContract.PrecompileContractResult result = privacyPrecompiledContract.computePrecompile(Bytes.fromBase64String(sr.getKey()), messageFrame);
final Bytes actual = result.getOutput();
assertThat(actual).isEqualTo(Bytes.fromHexString(DEFAULT_OUTPUT));
}
Aggregations