use of co.rsk.rpc.modules.eth.EthModuleSolidityDisabled in project rskj by rsksmart.
the class Web3ImplScoringTest method createWeb3.
private static Web3Impl createWeb3(PeerScoringManager peerScoringManager) {
SimpleRsk rsk = new SimpleRsk();
World world = new World();
rsk.blockchain = world.getBlockChain();
Wallet wallet = WalletFactory.createWallet();
RskSystemProperties config = new RskSystemProperties();
PersonalModule pm = new PersonalModuleWalletEnabled(config, rsk, wallet, null);
EthModule em = new EthModule(config, world.getBlockChain(), null, new ExecutionBlockRetriever(world.getBlockChain(), null, null), new EthModuleSolidityDisabled(), new EthModuleWalletEnabled(config, rsk, wallet, null));
TxPoolModule tpm = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
return new Web3RskImpl(rsk, world.getBlockChain(), null, config, Web3Mocks.getMockMinerClient(), Web3Mocks.getMockMinerServer(), pm, em, tpm, Web3Mocks.getMockChannelManager(), rsk.getRepository(), peerScoringManager, null, null, null, null, null, null, null);
}
use of co.rsk.rpc.modules.eth.EthModuleSolidityDisabled in project rskj by rsksmart.
the class Web3ImplTest method createWeb3.
private Web3Impl createWeb3(Ethereum eth, Blockchain blockchain, TransactionPool transactionPool, BlockStore blockStore, BlockProcessor nodeBlockProcessor, ConfigCapabilities configCapabilities, ReceiptStore receiptStore) {
wallet = WalletFactory.createWallet();
PersonalModuleWalletEnabled personalModule = new PersonalModuleWalletEnabled(config, eth, wallet, transactionPool);
ReversibleTransactionExecutor executor = Mockito.mock(ReversibleTransactionExecutor.class);
ProgramResult res = new ProgramResult();
res.setHReturn(TypeConverter.stringHexToByteArray("0x0000000000000000000000000000000000000000000000000000000064617665"));
Mockito.when(executor.executeTransaction(Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any(), Matchers.any())).thenReturn(res);
EthModule ethModule = new EthModule(config, blockchain, executor, new ExecutionBlockRetriever(blockchain, null, null), new EthModuleSolidityDisabled(), new EthModuleWalletEnabled(config, eth, wallet, transactionPool));
TxPoolModule txPoolModule = new TxPoolModuleImpl(transactionPool);
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, blockStore, receiptStore, null, nodeBlockProcessor, null, configCapabilities);
}
use of co.rsk.rpc.modules.eth.EthModuleSolidityDisabled in project rskj by rsksmart.
the class Web3ImplLogsTest method createWeb3.
private Web3Impl createWeb3(Ethereum eth, Blockchain blockchain, TransactionPool transactionPool, ReceiptStore receiptStore, Wallet wallet) {
PersonalModule 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());
return new Web3RskImpl(eth, blockchain, transactionPool, config, Web3Mocks.getMockMinerClient(), Web3Mocks.getMockMinerServer(), personalModule, ethModule, txPoolModule, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, null, blockchain.getBlockStore(), receiptStore, null, null, null, new SimpleConfigCapabilities());
}
use of co.rsk.rpc.modules.eth.EthModuleSolidityDisabled in project rskj by rsksmart.
the class Web3RskImplTest method web3_ext_dumpState.
@Test
public void web3_ext_dumpState() throws Exception {
Rsk rsk = Mockito.mock(Rsk.class);
Blockchain blockchain = Mockito.mock(Blockchain.class);
NetworkStateExporter networkStateExporter = Mockito.mock(NetworkStateExporter.class);
Mockito.when(networkStateExporter.exportStatus(Mockito.anyString())).thenReturn(true);
Block block = Mockito.mock(Block.class);
Mockito.when(block.getHash()).thenReturn(PegTestUtils.createHash3());
Mockito.when(block.getNumber()).thenReturn(1L);
BlockStore blockStore = Mockito.mock(BlockStore.class);
Mockito.when(blockStore.getBestBlock()).thenReturn(block);
Mockito.when(networkStateExporter.exportStatus(Mockito.anyString())).thenReturn(true);
Mockito.when(blockchain.getBestBlock()).thenReturn(block);
Wallet wallet = WalletFactory.createWallet();
RskSystemProperties config = new RskSystemProperties();
PersonalModule pm = new PersonalModuleWalletEnabled(config, rsk, wallet, null);
EthModule em = new EthModule(config, blockchain, null, new ExecutionBlockRetriever(blockchain, null, null), new EthModuleSolidityDisabled(), new EthModuleWalletEnabled(config, rsk, wallet, null));
TxPoolModule tpm = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
Web3RskImpl web3 = new Web3RskImpl(rsk, blockchain, Web3Mocks.getMockTransactionPool(), config, Web3Mocks.getMockMinerClient(), Web3Mocks.getMockMinerServer(), pm, em, tpm, Web3Mocks.getMockChannelManager(), Web3Mocks.getMockRepository(), null, networkStateExporter, blockStore, null, null, null, null, null);
web3.ext_dumpState();
}
use of co.rsk.rpc.modules.eth.EthModuleSolidityDisabled 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());
}
Aggregations