Search in sources :

Example 1 with EthModule

use of co.rsk.rpc.modules.eth.EthModule 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);
}
Also used : ChannelManager(org.ethereum.net.server.ChannelManager) EthModuleSolidityDisabled(co.rsk.rpc.modules.eth.EthModuleSolidityDisabled) ProgramResult(org.ethereum.vm.program.ProgramResult) Web3RskImpl(co.rsk.rpc.Web3RskImpl) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) PersonalModuleWalletEnabled(co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled) EthModuleWalletEnabled(co.rsk.rpc.modules.eth.EthModuleWalletEnabled) MinerClient(co.rsk.mine.MinerClient) EthModule(co.rsk.rpc.modules.eth.EthModule) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule)

Example 2 with EthModule

use of co.rsk.rpc.modules.eth.EthModule in project rskj by rsksmart.

the class Web3EthModuleTest method eth_chainId.

@Test
public void eth_chainId() {
    EthModule ethModule = mock(EthModule.class);
    when(ethModule.chainId()).thenReturn("0x21");
    Web3EthModule web3 = new Web3RskImpl(mock(Ethereum.class), mock(Blockchain.class, RETURNS_DEEP_STUBS), mock(RskSystemProperties.class), mock(MinerClient.class), mock(MinerServer.class), mock(PersonalModule.class), ethModule, mock(EvmModule.class), mock(TxPoolModule.class), mock(MnrModule.class), mock(DebugModule.class), null, mock(RskModule.class), mock(ChannelManager.class), mock(PeerScoringManager.class), mock(NetworkStateExporter.class), mock(BlockStore.class), mock(ReceiptStore.class), mock(PeerServer.class), mock(BlockProcessor.class), mock(HashRateCalculator.class), mock(ConfigCapabilities.class), mock(BuildInfo.class), mock(BlocksBloomStore.class), mock(Web3InformationRetriever.class), mock(SyncProcessor.class));
    assertThat(web3.eth_chainId(), is("0x21"));
}
Also used : ConfigCapabilities(org.ethereum.net.client.ConfigCapabilities) Blockchain(org.ethereum.core.Blockchain) RskModule(co.rsk.rpc.modules.rsk.RskModule) MnrModule(co.rsk.rpc.modules.mnr.MnrModule) NetworkStateExporter(co.rsk.core.NetworkStateExporter) PeerServer(org.ethereum.net.server.PeerServer) Ethereum(org.ethereum.facade.Ethereum) MinerServer(co.rsk.mine.MinerServer) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) DebugModule(co.rsk.rpc.modules.debug.DebugModule) SyncProcessor(co.rsk.net.SyncProcessor) ChannelManager(org.ethereum.net.server.ChannelManager) BlockStore(org.ethereum.db.BlockStore) BlocksBloomStore(co.rsk.logfilter.BlocksBloomStore) MinerClient(co.rsk.mine.MinerClient) PeerScoringManager(co.rsk.scoring.PeerScoringManager) BlockProcessor(co.rsk.net.BlockProcessor) EthModule(co.rsk.rpc.modules.eth.EthModule) BuildInfo(org.ethereum.util.BuildInfo) EvmModule(co.rsk.rpc.modules.evm.EvmModule) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) HashRateCalculator(co.rsk.metrics.HashRateCalculator) RskSystemProperties(co.rsk.config.RskSystemProperties) ReceiptStore(org.ethereum.db.ReceiptStore) Test(org.junit.Test)

Example 3 with EthModule

use of co.rsk.rpc.modules.eth.EthModule in project rskj by rsksmart.

the class NestedContractsTest method buildEthModule.

private EthModule buildEthModule(World world) {
    final TestSystemProperties config = new TestSystemProperties();
    TransactionExecutorFactory executor = new TransactionExecutorFactory(config, world.getBlockStore(), null, null, new ProgramInvokeFactoryImpl(), new PrecompiledContracts(config, world.getBridgeSupportFactory()), null);
    return new EthModule(null, Constants.REGTEST_CHAIN_ID, world.getBlockChain(), world.getTransactionPool(), new ReversibleTransactionExecutor(world.getRepositoryLocator(), executor), new ExecutionBlockRetriever(null, world.getBlockChain(), null, null), world.getRepositoryLocator(), null, null, world.getBridgeSupportFactory(), config.getGasEstimationCap());
}
Also used : PrecompiledContracts(org.ethereum.vm.PrecompiledContracts) EthModule(co.rsk.rpc.modules.eth.EthModule) ReversibleTransactionExecutor(co.rsk.core.ReversibleTransactionExecutor) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TestSystemProperties(co.rsk.config.TestSystemProperties) ProgramInvokeFactoryImpl(org.ethereum.vm.program.invoke.ProgramInvokeFactoryImpl) TransactionExecutorFactory(co.rsk.core.TransactionExecutorFactory)

Example 4 with EthModule

use of co.rsk.rpc.modules.eth.EthModule in project rskj by rsksmart.

the class EthModuleTestUtils method buildBasicEthModule.

public static EthModule buildBasicEthModule(World world) {
    TestSystemProperties config = new TestSystemProperties();
    TransactionExecutorFactory executor = buildBasicExecutorFactory(world, config);
    return new EthModule(null, Constants.REGTEST_CHAIN_ID, world.getBlockChain(), null, new ReversibleTransactionExecutor(world.getRepositoryLocator(), executor), new ExecutionBlockRetriever(null, world.getBlockChain(), null, null), null, null, null, world.getBridgeSupportFactory(), config.getGasEstimationCap());
}
Also used : EthModule(co.rsk.rpc.modules.eth.EthModule) ReversibleTransactionExecutor(co.rsk.core.ReversibleTransactionExecutor) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TestSystemProperties(co.rsk.config.TestSystemProperties) TransactionExecutorFactory(co.rsk.core.TransactionExecutorFactory)

Example 5 with EthModule

use of co.rsk.rpc.modules.eth.EthModule in project rskj by rsksmart.

the class Web3ImplTest method createWeb3.

private Web3Impl createWeb3(Ethereum eth, Blockchain blockchain, RepositoryLocator repositoryLocator, TransactionPool transactionPool, BlockStore blockStore, BlockProcessor nodeBlockProcessor, ConfigCapabilities configCapabilities, ReceiptStore receiptStore) {
    MiningMainchainView miningMainchainViewMock = mock(MiningMainchainView.class);
    ExecutionBlockRetriever executionBlockRetriever = mock(ExecutionBlockRetriever.class);
    wallet = WalletFactory.createWallet();
    PersonalModuleWalletEnabled personalModule = new PersonalModuleWalletEnabled(config, eth, wallet, transactionPool);
    ReversibleTransactionExecutor executor = new ReversibleTransactionExecutor(repositoryLocator, buildTransactionExecutorFactory(blockStore, null));
    Web3InformationRetriever retriever = new Web3InformationRetriever(transactionPool, blockchain, repositoryLocator, executionBlockRetriever);
    TransactionGateway transactionGateway = new TransactionGateway(new SimpleChannelManager(), transactionPool);
    EthModule ethModule = new EthModule(config.getNetworkConstants().getBridgeConstants(), config.getNetworkConstants().getChainId(), blockchain, transactionPool, executor, new ExecutionBlockRetriever(miningMainchainViewMock, blockchain, null, null), repositoryLocator, new EthModuleWalletEnabled(wallet), new EthModuleTransactionBase(config.getNetworkConstants(), wallet, transactionPool, transactionGateway), new BridgeSupportFactory(null, config.getNetworkConstants().getBridgeConstants(), config.getActivationConfig()), config.getGasEstimationCap());
    TxPoolModule txPoolModule = new TxPoolModuleImpl(transactionPool);
    DebugModule debugModule = new DebugModuleImpl(null, null, Web3Mocks.getMockMessageHandler(), null);
    RskModule rskModule = new RskModuleImpl(blockchain, blockStore, receiptStore, retriever);
    MinerClient minerClient = new SimpleMinerClient();
    ChannelManager channelManager = new SimpleChannelManager();
    return new Web3RskImpl(eth, blockchain, config, minerClient, Web3Mocks.getMockMinerServer(), personalModule, ethModule, null, txPoolModule, null, debugModule, null, rskModule, channelManager, null, null, blockStore, receiptStore, null, nodeBlockProcessor, null, configCapabilities, new BuildInfo("test", "test"), null, retriever, syncProcessor);
}
Also used : EthModuleTransactionBase(co.rsk.rpc.modules.eth.EthModuleTransactionBase) ChannelManager(org.ethereum.net.server.ChannelManager) RskModule(co.rsk.rpc.modules.rsk.RskModule) Web3RskImpl(co.rsk.rpc.Web3RskImpl) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) DebugModuleImpl(co.rsk.rpc.modules.debug.DebugModuleImpl) PersonalModuleWalletEnabled(co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled) TransactionGateway(co.rsk.net.TransactionGateway) MiningMainchainView(co.rsk.core.bc.MiningMainchainView) EthModuleWalletEnabled(co.rsk.rpc.modules.eth.EthModuleWalletEnabled) MinerClient(co.rsk.mine.MinerClient) Web3InformationRetriever(co.rsk.rpc.Web3InformationRetriever) EthModule(co.rsk.rpc.modules.eth.EthModule) BuildInfo(org.ethereum.util.BuildInfo) DebugModule(co.rsk.rpc.modules.debug.DebugModule) BridgeSupportFactory(co.rsk.peg.BridgeSupportFactory) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) RskModuleImpl(co.rsk.rpc.modules.rsk.RskModuleImpl)

Aggregations

EthModule (co.rsk.rpc.modules.eth.EthModule)13 ExecutionBlockRetriever (co.rsk.rpc.ExecutionBlockRetriever)11 TxPoolModule (co.rsk.rpc.modules.txpool.TxPoolModule)11 TxPoolModuleImpl (co.rsk.rpc.modules.txpool.TxPoolModuleImpl)10 Web3RskImpl (co.rsk.rpc.Web3RskImpl)9 EthModuleWalletEnabled (co.rsk.rpc.modules.eth.EthModuleWalletEnabled)9 PersonalModuleWalletEnabled (co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled)8 DebugModule (co.rsk.rpc.modules.debug.DebugModule)6 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)6 MinerClient (co.rsk.mine.MinerClient)5 BridgeSupportFactory (co.rsk.peg.BridgeSupportFactory)5 DebugModuleImpl (co.rsk.rpc.modules.debug.DebugModuleImpl)5 ChannelManager (org.ethereum.net.server.ChannelManager)5 RskSystemProperties (co.rsk.config.RskSystemProperties)4 MiningMainchainView (co.rsk.core.bc.MiningMainchainView)4 Web3InformationRetriever (co.rsk.rpc.Web3InformationRetriever)4 EthModuleSolidityDisabled (co.rsk.rpc.modules.eth.EthModuleSolidityDisabled)4 TestSystemProperties (co.rsk.config.TestSystemProperties)3 Wallet (co.rsk.core.Wallet)3 RskModule (co.rsk.rpc.modules.rsk.RskModule)3