Search in sources :

Example 1 with TxPoolModule

use of co.rsk.rpc.modules.txpool.TxPoolModule 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 TxPoolModule

use of co.rsk.rpc.modules.txpool.TxPoolModule 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)

Example 3 with TxPoolModule

use of co.rsk.rpc.modules.txpool.TxPoolModule in project rskj by rsksmart.

the class Web3ImplScoringTest method createWeb3.

private static Web3Impl createWeb3(PeerScoringManager peerScoringManager) {
    SimpleEthereum rsk = new SimpleEthereum();
    World world = new World();
    rsk.blockchain = world.getBlockChain();
    MiningMainchainView miningMainchainView = new MiningMainchainViewImpl(world.getBlockStore(), 2);
    Wallet wallet = WalletFactory.createWallet();
    TestSystemProperties config = new TestSystemProperties();
    PersonalModule pm = new PersonalModuleWalletEnabled(config, rsk, wallet, null);
    EthModule em = new EthModule(config.getNetworkConstants().getBridgeConstants(), config.getNetworkConstants().getChainId(), world.getBlockChain(), null, null, new ExecutionBlockRetriever(miningMainchainView, world.getBlockChain(), null, null), null, new EthModuleWalletEnabled(wallet), null, new BridgeSupportFactory(null, config.getNetworkConstants().getBridgeConstants(), config.getActivationConfig()), config.getGasEstimationCap());
    TxPoolModule tpm = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
    DebugModule dm = new DebugModuleImpl(null, null, Web3Mocks.getMockMessageHandler(), null);
    return new Web3RskImpl(rsk, world.getBlockChain(), config, Web3Mocks.getMockMinerClient(), Web3Mocks.getMockMinerServer(), pm, em, null, tpm, null, dm, null, null, Web3Mocks.getMockChannelManager(), peerScoringManager, null, null, null, null, null, null, null, null, null, null, null);
}
Also used : Wallet(co.rsk.core.Wallet) Web3RskImpl(co.rsk.rpc.Web3RskImpl) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) DebugModuleImpl(co.rsk.rpc.modules.debug.DebugModuleImpl) World(co.rsk.test.World) MiningMainchainViewImpl(co.rsk.core.bc.MiningMainchainViewImpl) PersonalModuleWalletEnabled(co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled) MiningMainchainView(co.rsk.core.bc.MiningMainchainView) EthModuleWalletEnabled(co.rsk.rpc.modules.eth.EthModuleWalletEnabled) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) EthModule(co.rsk.rpc.modules.eth.EthModule) DebugModule(co.rsk.rpc.modules.debug.DebugModule) SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) BridgeSupportFactory(co.rsk.peg.BridgeSupportFactory) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) TestSystemProperties(co.rsk.config.TestSystemProperties)

Example 4 with TxPoolModule

use of co.rsk.rpc.modules.txpool.TxPoolModule 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());
}
Also used : EthModuleSolidityDisabled(co.rsk.rpc.modules.eth.EthModuleSolidityDisabled) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) EthModule(co.rsk.rpc.modules.eth.EthModule) Web3RskImpl(co.rsk.rpc.Web3RskImpl) SimpleConfigCapabilities(org.ethereum.rpc.Simples.SimpleConfigCapabilities) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) PersonalModuleWalletEnabled(co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) EthModuleWalletEnabled(co.rsk.rpc.modules.eth.EthModuleWalletEnabled) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule)

Example 5 with TxPoolModule

use of co.rsk.rpc.modules.txpool.TxPoolModule 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();
}
Also used : BlockStore(org.ethereum.db.BlockStore) EthModuleSolidityDisabled(co.rsk.rpc.modules.eth.EthModuleSolidityDisabled) Wallet(co.rsk.core.Wallet) Blockchain(org.ethereum.core.Blockchain) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) Rsk(co.rsk.core.Rsk) PersonalModuleWalletEnabled(co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled) EthModuleWalletEnabled(co.rsk.rpc.modules.eth.EthModuleWalletEnabled) NetworkStateExporter(co.rsk.core.NetworkStateExporter) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) EthModule(co.rsk.rpc.modules.eth.EthModule) Block(org.ethereum.core.Block) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) RskSystemProperties(co.rsk.config.RskSystemProperties) Test(org.junit.Test)

Aggregations

TxPoolModule (co.rsk.rpc.modules.txpool.TxPoolModule)14 TxPoolModuleImpl (co.rsk.rpc.modules.txpool.TxPoolModuleImpl)14 ExecutionBlockRetriever (co.rsk.rpc.ExecutionBlockRetriever)10 Web3RskImpl (co.rsk.rpc.Web3RskImpl)10 EthModule (co.rsk.rpc.modules.eth.EthModule)10 EthModuleWalletEnabled (co.rsk.rpc.modules.eth.EthModuleWalletEnabled)9 PersonalModuleWalletEnabled (co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled)9 DebugModule (co.rsk.rpc.modules.debug.DebugModule)8 DebugModuleImpl (co.rsk.rpc.modules.debug.DebugModuleImpl)8 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)8 BridgeSupportFactory (co.rsk.peg.BridgeSupportFactory)6 MinerClient (co.rsk.mine.MinerClient)5 Web3InformationRetriever (co.rsk.rpc.Web3InformationRetriever)5 PersonalModuleWalletDisabled (co.rsk.rpc.modules.personal.PersonalModuleWalletDisabled)5 ChannelManager (org.ethereum.net.server.ChannelManager)5 RskSystemProperties (co.rsk.config.RskSystemProperties)4 MiningMainchainView (co.rsk.core.bc.MiningMainchainView)4 EthModuleSolidityDisabled (co.rsk.rpc.modules.eth.EthModuleSolidityDisabled)4 Ethereum (org.ethereum.facade.Ethereum)4 Test (org.junit.Test)4