Search in sources :

Example 96 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class BlockDifficultyValidationRuleTest method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    config = new RskSystemProperties();
    config.setBlockchainConfig(new RegTestConfig());
}
Also used : RegTestConfig(org.ethereum.config.blockchain.RegTestConfig) RskSystemProperties(co.rsk.config.RskSystemProperties) BeforeClass(org.junit.BeforeClass)

Example 97 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class SystemPropertiesTest method externalIpTest.

@Test
public void externalIpTest() {
    RskSystemProperties config = new RskSystemProperties();
    config.overrideParams("public.ip", "");
    long st = System.currentTimeMillis();
    String ip = config.getPublicIp();
    long t = System.currentTimeMillis() - st;
    System.out.println(ip + " in " + t + " msec");
    Assert.assertTrue(t < 10 * 1000);
    Assert.assertFalse(ip.isEmpty());
}
Also used : RskSystemProperties(co.rsk.config.RskSystemProperties) Test(org.junit.Test)

Example 98 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class StateTest method generateGenesisState.

private Trie generateGenesisState() {
    Trie trie = new TrieImpl();
    Genesis genesis = (Genesis) Genesis.getInstance(new RskSystemProperties());
    for (RskAddress addr : genesis.getPremine().keySet()) {
        trie = trie.put(addr.getBytes(), genesis.getPremine().get(addr).getAccountState().getEncoded());
    }
    return trie;
}
Also used : TrieImpl(co.rsk.trie.TrieImpl) RskAddress(co.rsk.core.RskAddress) Trie(co.rsk.trie.Trie) RskSystemProperties(co.rsk.config.RskSystemProperties)

Example 99 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class IndexedBlockStoreTest method setup.

@Before
public void setup() throws URISyntaxException, IOException {
    URL scenario1 = ClassLoader.getSystemResource("blockstore/load.dmp");
    File file = new File(scenario1.toURI());
    List<String> strData = Files.readAllLines(file.toPath(), StandardCharsets.UTF_8);
    config = new RskSystemProperties();
    Block genesis = Genesis.getInstance(config);
    blocks.add(genesis);
    cumDifficulty = cumDifficulty.add(genesis.getCumulativeDifficulty());
    for (String blockRLP : strData) {
        Block block = new Block(Hex.decode(blockRLP));
        if (block.getNumber() % 1000 == 0)
            logger.info("adding block.hash: [{}] block.number: [{}]", block.getShortHash(), block.getNumber());
        blocks.add(block);
        cumDifficulty = cumDifficulty.add(block.getCumulativeDifficulty());
    }
    logger.info("total difficulty: {}", cumDifficulty);
    logger.info("total blocks loaded: {}", blocks.size());
}
Also used : Block(org.ethereum.core.Block) File(java.io.File) URL(java.net.URL) RskSystemProperties(co.rsk.config.RskSystemProperties) Before(org.junit.Before)

Example 100 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class GitHubBlockTest method runHomestead.

private void runHomestead(String name) throws IOException, ParseException {
    String json = JSONReader.loadJSONFromCommit("BlockchainTests/Homestead/" + name + ".json", shacommit);
    RskSystemProperties config = new RskSystemProperties();
    config.setBlockchainConfig(new GenesisConfig());
    try {
        GitHubJSONTestSuite.runGitHubJsonBlockTest(json, Collections.EMPTY_SET);
    } finally {
        config.setBlockchainConfig(new MainNetConfig());
    }
}
Also used : MainNetConfig(org.ethereum.config.net.MainNetConfig) RskSystemProperties(co.rsk.config.RskSystemProperties) GenesisConfig(org.ethereum.config.blockchain.GenesisConfig)

Aggregations

RskSystemProperties (co.rsk.config.RskSystemProperties)112 Test (org.junit.Test)81 SyncConfiguration (co.rsk.net.sync.SyncConfiguration)48 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)45 Blockchain (org.ethereum.core.Blockchain)45 Block (org.ethereum.core.Block)41 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)35 ProofOfWorkRule (co.rsk.validators.ProofOfWorkRule)20 Ignore (org.junit.Ignore)10 Keccak256 (co.rsk.crypto.Keccak256)8 RegTestConfig (org.ethereum.config.blockchain.RegTestConfig)8 Repository (org.ethereum.core.Repository)8 SimpleChannelManager (org.ethereum.rpc.Simples.SimpleChannelManager)8 Channel (org.ethereum.net.server.Channel)7 ChannelManager (org.ethereum.net.server.ChannelManager)7 InvocationOnMock (org.mockito.invocation.InvocationOnMock)7 BlockDifficulty (co.rsk.core.BlockDifficulty)6 RskAddress (co.rsk.core.RskAddress)6 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)6 BeforeClass (org.junit.BeforeClass)6