use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class RemascProcessMinerFeesTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
config = new RskSystemProperties();
config.setBlockchainConfig(new RegTestConfig());
remascConfig = new RemascConfigFactory(RemascContract.REMASC_CONFIG).createRemascConfig("regtest");
accountsAddressesUpToD = new LinkedList<>();
accountsAddressesUpToD.add(coinbaseA.getBytes());
accountsAddressesUpToD.add(coinbaseB.getBytes());
accountsAddressesUpToD.add(coinbaseC.getBytes());
accountsAddressesUpToD.add(coinbaseD.getBytes());
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class RemascTestRunner method start.
public void start() {
this.blockchain = this.builder.build();
((BlockChainImpl) this.blockchain).setNoValidation(true);
this.addedSiblings = new ArrayList<>();
List<Block> mainChainBlocks = new ArrayList<>();
this.blockchain.tryToConnect(this.genesis);
BlockExecutor blockExecutor = new BlockExecutor(new RskSystemProperties(), blockchain.getRepository(), null, blockchain.getBlockStore(), null);
for (int i = 0; i <= this.initialHeight; i++) {
int finalI = i;
List<SiblingElement> siblingsForCurrentHeight = this.siblingElements.stream().filter(siblingElement -> siblingElement.getHeightToBeIncluded() == finalI).collect(Collectors.toList());
List<BlockHeader> blockSiblings = new ArrayList<>();
// Going to add siblings
BlockDifficulty cummDifficulty = BlockDifficulty.ZERO;
if (siblingsForCurrentHeight.size() > 0) {
cummDifficulty = blockchain.getTotalDifficulty();
}
for (SiblingElement sibling : siblingsForCurrentHeight) {
RskAddress siblingCoinbase = TestUtils.randomAddress();
Block mainchainSiblingParent = mainChainBlocks.get(sibling.getHeight() - 1);
Block siblingBlock = createBlock(this.genesis, mainchainSiblingParent, PegTestUtils.createHash3(), siblingCoinbase, null, minerFee, Long.valueOf(i), this.txValue, this.txSigningKey, null);
blockSiblings.add(siblingBlock.getHeader());
blockchain.getBlockStore().saveBlock(siblingBlock, cummDifficulty.add(siblingBlock.getCumulativeDifficulty()), false);
this.addedSiblings.add(siblingBlock);
}
long txNonce = i;
RskAddress coinbase = TestUtils.randomAddress();
Block block = createBlock(this.genesis, this.blockchain.getBestBlock(), PegTestUtils.createHash3(), coinbase, blockSiblings, minerFee, txNonce, this.txValue, this.txSigningKey, null);
mainChainBlocks.add(block);
blockExecutor.executeAndFillAll(block, this.blockchain.getBestBlock());
block.seal();
ImportResult result = this.blockchain.tryToConnect(block);
System.out.println(result);
}
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class ModuleDescriptionTest method getModulesFromTestNewRskSystemProperties.
@Test
public void getModulesFromTestNewRskSystemProperties() {
RskSystemProperties config = new RskSystemProperties();
List<ModuleDescription> modules = config.getRpcModules();
Assert.assertNotNull(modules);
Assert.assertFalse(modules.isEmpty());
Assert.assertEquals(2, modules.size());
ModuleDescription moduleEth = modules.get(0);
Assert.assertEquals("eth", moduleEth.getName());
Assert.assertEquals("1.0", moduleEth.getVersion());
Assert.assertTrue(moduleEth.isEnabled());
Assert.assertNotNull(moduleEth.getEnabledMethods());
Assert.assertTrue(moduleEth.getEnabledMethods().isEmpty());
Assert.assertNotNull(moduleEth.getDisabledMethods());
Assert.assertTrue(moduleEth.getDisabledMethods().isEmpty());
ModuleDescription moduleEvm = modules.get(1);
Assert.assertEquals("evm", moduleEvm.getName());
Assert.assertEquals("1.1", moduleEvm.getVersion());
Assert.assertFalse(moduleEvm.isEnabled());
Assert.assertNotNull(moduleEvm.getEnabledMethods());
Assert.assertFalse(moduleEvm.getEnabledMethods().isEmpty());
Assert.assertEquals(2, moduleEvm.getEnabledMethods().size());
Assert.assertNotNull(moduleEvm.getDisabledMethods());
Assert.assertFalse(moduleEvm.getDisabledMethods().isEmpty());
Assert.assertEquals(2, moduleEvm.getDisabledMethods().size());
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class Web3ImplRpcTest method getRpcModules.
@Test
public void getRpcModules() {
Ethereum eth = Web3Mocks.getMockEthereum();
Blockchain blockchain = Web3Mocks.getMockBlockchain();
TransactionPool transactionPool = Web3Mocks.getMockTransactionPool();
PersonalModule pm = new PersonalModuleWalletDisabled();
Repository repository = Web3Mocks.getMockRepository();
Web3Impl web3 = new Web3RskImpl(eth, blockchain, transactionPool, new RskSystemProperties(), null, null, pm, null, null, null, repository, null, null, null, null, null, null, null, null);
Map<String, String> result = web3.rpc_modules();
Assert.assertNotNull(result);
Assert.assertFalse(result.isEmpty());
Assert.assertTrue(result.containsKey("eth"));
Assert.assertEquals("1.0", result.get("eth"));
}
use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.
the class TxValidatorIntrinsicGasLimitValidatorTest method setUp.
@Before
public void setUp() {
config = new RskSystemProperties();
config.setBlockchainConfig(new RegTestConfig());
}
Aggregations