@Override public PrivacyParameters getPrivacyParameters() { LOG.warn("IbftLegacyPantheonController does not currently support private transactions."); return PrivacyParameters.noPrivacy(); }
private PrivacyParameters orionConfiguration() { // Check that mining options are able top work or send an error CommandLineUtils.checkOptionDependencies( logger, commandLine, "--privacy-enabled", !privacyEnabled, Arrays.asList( "--privacy-url", "--privacy-public-key-file", "--privacy-precompiled-address")); final PrivacyParameters privacyParameters = PrivacyParameters.noPrivacy(); privacyParameters.setEnabled(privacyEnabled); privacyParameters.setUrl(privacyUrl.toString()); privacyParameters.setPublicKey(privacyPublicKeyFile); privacyParameters.setPrivacyAddress(privacyPrecompiledAddress); return privacyParameters; }
@Test public void mustUseOrionUriAndOptions() throws IOException { final File file = new File("./specific/public_key"); parseCommand( "--privacy-enabled", "--privacy-url", ORION_URI, "--privacy-public-key-file", file.getPath()); final ArgumentCaptor<PrivacyParameters> orionArg = ArgumentCaptor.forClass(PrivacyParameters.class); verify(mockControllerBuilder).privacyParameters(orionArg.capture()); verify(mockControllerBuilder).build(); assertThat(orionArg.getValue().getUrl()).isEqualTo(ORION_URI); assertThat(orionArg.getValue().getPublicKey()).isEqualTo(file); assertThat(commandOutput.toString()).isEmpty(); assertThat(commandErrorOutput.toString()).isEmpty(); }
@Test public void mustVerifyPrivacyIsDisabled() throws IOException { parseCommand(); final ArgumentCaptor<PrivacyParameters> orionArg = ArgumentCaptor.forClass(PrivacyParameters.class); verify(mockControllerBuilder).privacyParameters(orionArg.capture()); verify(mockControllerBuilder).build(); assertThat(commandOutput.toString()).isEmpty(); assertThat(commandErrorOutput.toString()).isEmpty(); assertThat(orionArg.getValue().isEnabled()).isEqualTo(false); }
@Override public PrivacyParameters getPrivacyParameters() { LOG.warn("CliquePantheonController does not currently support private transactions."); return PrivacyParameters.noPrivacy(); }
@Override public PrivacyParameters getPrivacyParameters() { LOG.warn("IbftPantheonController does not currently support private transactions."); return PrivacyParameters.noPrivacy(); }
private static ProtocolSchedule<Void> createSchedule(final GenesisConfigOptions options) { return new ProtocolScheduleBuilder<>( options, CHAIN_ID, Function.identity(), PrivacyParameters.noPrivacy()) .createProtocolSchedule(); } }
@Test public void shouldOnlyUseFrontierWhenEmptyJsonConfigIsUsed() { final JsonObject json = new JsonObject("{}"); final ProtocolSchedule<Void> sched = MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig(json).getConfigOptions(), PrivacyParameters.noPrivacy()); Assertions.assertThat(sched.getByBlockNumber(1L).getName()).isEqualTo("Frontier"); Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()).isEqualTo("Frontier"); }
@Test public void shouldCreateRopstenConfig() throws Exception { final ProtocolSchedule<Void> sched = MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig( Resources.toString( Resources.getResource("ropsten.json"), StandardCharsets.UTF_8)) .getConfigOptions(), PrivacyParameters.noPrivacy()); Assertions.assertThat(sched.getByBlockNumber(0).getName()).isEqualTo("TangerineWhistle"); Assertions.assertThat(sched.getByBlockNumber(1).getName()).isEqualTo("TangerineWhistle"); Assertions.assertThat(sched.getByBlockNumber(10).getName()).isEqualTo("SpuriousDragon"); Assertions.assertThat(sched.getByBlockNumber(1700000).getName()).isEqualTo("Byzantium"); Assertions.assertThat(sched.getByBlockNumber(4230000).getName()).isEqualTo("Constantinople"); Assertions.assertThat(sched.getByBlockNumber(4939394).getName()).isEqualTo("ConstantinopleFix"); Assertions.assertThat(sched.getByBlockNumber(Long.MAX_VALUE).getName()) .isEqualTo("ConstantinopleFix"); } }
MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), PrivacyParameters.noPrivacy()), mock(FilterManager.class), mock(TransactionPool.class),
MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), PrivacyParameters.noPrivacy()), mock(FilterManager.class), mock(TransactionPool.class),
@Test public void createFromConfigWithSettings() { final JsonObject json = new JsonObject( "{\"config\": {\"homesteadBlock\": 2, \"daoForkBlock\": 3, \"eip150Block\": 14, \"eip158Block\": 15, \"byzantiumBlock\": 16, \"constantinopleBlock\": 18, \"constantinopleFixBlock\": 19, \"chainId\":1234}}"); final ProtocolSchedule<Void> sched = MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig(json).getConfigOptions(), PrivacyParameters.noPrivacy()); Assertions.assertThat(sched.getByBlockNumber(1).getName()).isEqualTo("Frontier"); Assertions.assertThat(sched.getByBlockNumber(2).getName()).isEqualTo("Homestead"); Assertions.assertThat(sched.getByBlockNumber(3).getName()).isEqualTo("DaoRecoveryInit"); Assertions.assertThat(sched.getByBlockNumber(4).getName()).isEqualTo("DaoRecoveryTransition"); Assertions.assertThat(sched.getByBlockNumber(13).getName()).isEqualTo("Homestead"); Assertions.assertThat(sched.getByBlockNumber(14).getName()).isEqualTo("TangerineWhistle"); Assertions.assertThat(sched.getByBlockNumber(15).getName()).isEqualTo("SpuriousDragon"); Assertions.assertThat(sched.getByBlockNumber(16).getName()).isEqualTo("Byzantium"); Assertions.assertThat(sched.getByBlockNumber(18).getName()).isEqualTo("Constantinople"); Assertions.assertThat(sched.getByBlockNumber(19).getName()).isEqualTo("ConstantinopleFix"); }
@Test public void outOfOrderForksFails() { final JsonObject json = new JsonObject( "{\"config\": {\"homesteadBlock\": 2, \"daoForkBlock\": 3, \"eip150Block\": 14, \"eip158Block\": 15, \"byzantiumBlock\": 16, \"constantinopleBlock\": 18, \"constantinopleFixBlock\": 17, \"chainId\":1234}}"); Assertions.assertThatExceptionOfType(RuntimeException.class) .describedAs( "Genesis Config Error: 'ConstantinopleFix' is scheduled for block 17 but it must be on or after block 18.") .isThrownBy( () -> MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig(json).getConfigOptions(), PrivacyParameters.noPrivacy())); }
KeyPair.generate(), new NoOpMetricsSystem(), PrivacyParameters.noPrivacy()); final BlockImporter.ImportResult result = blockImporter.importBlockchain(source, controller);
@Test public void blockHeadersRoundTrip() throws IOException { final List<BlockHeader> headers = new ArrayList<>(); final ByteBuffer buffer = ByteBuffer.wrap(Resources.toByteArray(Resources.getResource("50.blocks"))); for (int i = 0; i < 50; ++i) { final int blockSize = RLP.calculateSize(BytesValue.wrapBuffer(buffer)); final byte[] block = new byte[blockSize]; buffer.get(block); buffer.compact().position(0); final RLPInput oneBlock = new BytesValueRLPInput(BytesValue.wrap(block), false); oneBlock.enterList(); headers.add(BlockHeader.readFrom(oneBlock, MainnetBlockHashFunction::createHash)); // We don't care about the bodies, just the headers oneBlock.skipNext(); oneBlock.skipNext(); } final MessageData initialMessage = BlockHeadersMessage.create(headers); final MessageData raw = new RawMessage(EthPV62.BLOCK_HEADERS, initialMessage.getData()); final BlockHeadersMessage message = BlockHeadersMessage.readFrom(raw); final Iterator<BlockHeader> readHeaders = message.getHeaders( FixedDifficultyProtocolSchedule.create( GenesisConfigFile.development().getConfigOptions(), PrivacyParameters.noPrivacy())); for (int i = 0; i < 50; ++i) { Assertions.assertThat(readHeaders.next()).isEqualTo(headers.get(i)); } } }
FixedDifficultyProtocolSchedule.create( GenesisConfigFile.development().getConfigOptions(), PrivacyParameters.noPrivacy())) .iterator(); for (int i = 0; i < 50; ++i) {
@Test public void blockImport() throws IOException { final Path source = folder.newFile().toPath(); BlockTestUtil.write1000Blocks(source); final PantheonController<?> targetController = PantheonController.fromConfig( GenesisConfigFile.mainnet(), SynchronizerConfiguration.builder().build(), new InMemoryStorageProvider(), false, 1, new MiningParametersTestBuilder().enabled(false).build(), KeyPair.generate(), new NoOpMetricsSystem(), PrivacyParameters.noPrivacy()); final BlockImporter.ImportResult result = blockImporter.importBlockchain(source, targetController); // Don't count the Genesis block assertThat(result.count).isEqualTo(999); assertThat(result.td).isEqualTo(UInt256.of(21991996248790L)); }
final ProtocolSchedule<Void> protocolSchedule = FixedDifficultyProtocolSchedule.create( GenesisConfigFile.development().getConfigOptions(), PrivacyParameters.noPrivacy()); final Blockchain blockchain = new TestBlockchain(); final TransactionProcessor transactionProcessor =
aheadDbNodeKeys, noOpMetricsSystem, PrivacyParameters.noPrivacy())) { setupState(blockCount, controller.getProtocolSchedule(), controller.getProtocolContext()); aheadDbNodeKeys, noOpMetricsSystem, PrivacyParameters.noPrivacy()); final String listenHost = InetAddress.getLoopbackAddress().getHostAddress(); final ExecutorService executorService = Executors.newFixedThreadPool(2); KeyPair.generate(), noOpMetricsSystem, PrivacyParameters.noPrivacy()); final Runner runnerBehind = runnerBuilder
.nodePrivateKeyFile(KeyPairUtil.getDefaultKeyFile(node.homeDirectory())) .metricsSystem(noOpMetricsSystem) .privacyParameters(PrivacyParameters.noPrivacy()) .build(); } catch (final IOException e) {