use of co.rsk.rpc.modules.txpool.TxPoolModuleImpl in project rskj by rsksmart.
the class Web3ImplTest method eth_compileSolidity.
@Test
@Ignore
public void eth_compileSolidity() throws Exception {
RskSystemProperties systemProperties = Mockito.mock(RskSystemProperties.class);
String solc = System.getProperty("solc");
if (StringUtils.isEmpty(solc))
solc = "/usr/bin/solc";
Mockito.when(systemProperties.customSolcPath()).thenReturn(solc);
Ethereum eth = Mockito.mock(Ethereum.class);
EthModule ethModule = new EthModule(config, null, null, new ExecutionBlockRetriever(null, null, null), new EthModuleSolidityEnabled(new SolidityCompiler(systemProperties)), null);
PersonalModule personalModule = new PersonalModuleWalletDisabled();
TxPoolModule txPoolModule = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
Web3Impl web3 = new Web3RskImpl(eth, null, null, systemProperties, null, null, personalModule, ethModule, txPoolModule, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, null, null, null, null, null, null, null);
String contract = "pragma solidity ^0.4.1; contract rsk { function multiply(uint a) returns(uint d) { return a * 7; } }";
Map<String, CompilationResultDTO> result = web3.eth_compileSolidity(contract);
org.junit.Assert.assertNotNull(result);
CompilationResultDTO dto = result.get("rsk");
if (dto == null)
dto = result.get("<stdin>:rsk");
org.junit.Assert.assertEquals(contract, dto.info.getSource());
}
use of co.rsk.rpc.modules.txpool.TxPoolModuleImpl in project rskj by rsksmart.
the class Web3ImplTest method eth_compileSolidityWithoutSolidity.
@Test
public void eth_compileSolidityWithoutSolidity() throws Exception {
SystemProperties systemProperties = Mockito.mock(SystemProperties.class);
String solc = System.getProperty("solc");
if (StringUtils.isEmpty(solc))
solc = "/usr/bin/solc";
Mockito.when(systemProperties.customSolcPath()).thenReturn(solc);
Wallet wallet = WalletFactory.createWallet();
Ethereum eth = Web3Mocks.getMockEthereum();
Blockchain blockchain = Web3Mocks.getMockBlockchain();
TransactionPool transactionPool = Web3Mocks.getMockTransactionPool();
EthModule ethModule = new EthModule(config, blockchain, null, new ExecutionBlockRetriever(blockchain, null, null), new EthModuleSolidityDisabled(), new EthModuleWalletEnabled(config, eth, wallet, null));
TxPoolModule txPoolModule = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
Web3Impl web3 = new Web3RskImpl(eth, blockchain, transactionPool, config, null, null, new PersonalModuleWalletDisabled(), ethModule, txPoolModule, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, null, null, null, null, null, null, null);
String contract = "pragma solidity ^0.4.1; contract rsk { function multiply(uint a) returns(uint d) { return a * 7; } }";
Map<String, CompilationResultDTO> result = web3.eth_compileSolidity(contract);
org.junit.Assert.assertNotNull(result);
org.junit.Assert.assertEquals(0, result.size());
}
use of co.rsk.rpc.modules.txpool.TxPoolModuleImpl in project rskj by rsksmart.
the class Web3ImplTest method createWeb3.
private Web3Impl createWeb3(SimpleEthereum eth, PeerServer peerServer) {
wallet = WalletFactory.createWallet();
Blockchain blockchain = Web3Mocks.getMockBlockchain();
TransactionPool transactionPool = Web3Mocks.getMockTransactionPool();
PersonalModuleWalletEnabled personalModule = new PersonalModuleWalletEnabled(config, eth, wallet, null);
EthModule ethModule = new EthModule(config, blockchain, null, new ExecutionBlockRetriever(blockchain, null, null), new EthModuleSolidityDisabled(), new EthModuleWalletEnabled(config, eth, wallet, null));
TxPoolModule txPoolModule = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
MinerClient minerClient = new SimpleMinerClient();
ChannelManager channelManager = new SimpleChannelManager();
return new Web3RskImpl(eth, blockchain, transactionPool, config, minerClient, Web3Mocks.getMockMinerServer(), personalModule, ethModule, txPoolModule, channelManager, Web3Mocks.getMockRepository(), null, null, null, null, peerServer, null, null, null);
}
use of co.rsk.rpc.modules.txpool.TxPoolModuleImpl in project rskj by rsksmart.
the class Web3ImplTest method eth_mining.
@Test
public void eth_mining() {
Ethereum ethMock = Web3Mocks.getMockEthereum();
Blockchain blockchain = Web3Mocks.getMockBlockchain();
TransactionPool transactionPool = Web3Mocks.getMockTransactionPool();
BlockStore blockStore = Web3Mocks.getMockBlockStore();
RskSystemProperties mockProperties = Web3Mocks.getMockProperties();
MinerClient minerClient = new SimpleMinerClient();
PersonalModule personalModule = new PersonalModuleWalletDisabled();
TxPoolModule txPoolModule = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
Web3 web3 = new Web3Impl(ethMock, blockchain, transactionPool, blockStore, null, mockProperties, minerClient, null, personalModule, null, txPoolModule, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, null, null, null, null);
Assert.assertTrue("Node is not mining", !web3.eth_mining());
try {
minerClient.mine();
Assert.assertTrue("Node is mining", web3.eth_mining());
} finally {
minerClient.stop();
}
Assert.assertTrue("Node is not mining", !web3.eth_mining());
}
Aggregations