use of co.rsk.rpc.ExecutionBlockRetriever 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.ExecutionBlockRetriever in project rskj by rsksmart.
the class EthModuleTest method callWithoutReturn.
@Test
public void callWithoutReturn() {
CallArguments args = new CallArguments();
BlockResult blockResult = mock(BlockResult.class);
Block block = mock(Block.class);
ExecutionBlockRetriever retriever = mock(ExecutionBlockRetriever.class);
when(retriever.retrieveExecutionBlock("latest")).thenReturn(blockResult);
when(blockResult.getBlock()).thenReturn(block);
byte[] hReturn = new byte[0];
ProgramResult executorResult = mock(ProgramResult.class);
when(executorResult.getHReturn()).thenReturn(hReturn);
ReversibleTransactionExecutor executor = mock(ReversibleTransactionExecutor.class);
when(executor.executeTransaction(eq(blockResult.getBlock()), any(), any(), any(), any(), any(), any(), any())).thenReturn(executorResult);
EthModule eth = new EthModule(null, anyByte(), null, null, executor, retriever, null, null, null, new BridgeSupportFactory(null, null, null), config.getGasEstimationCap());
String expectedResult = TypeConverter.toUnformattedJsonHex(hReturn);
String actualResult = eth.call(args, "latest");
assertEquals(expectedResult, actualResult);
}
use of co.rsk.rpc.ExecutionBlockRetriever 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());
}
use of co.rsk.rpc.ExecutionBlockRetriever in project rskj by rsksmart.
the class EthModuleTestUtils method buildBasicEthModuleForGasEstimation.
public static EthModuleGasEstimation buildBasicEthModuleForGasEstimation(World world) {
TestSystemProperties config = new TestSystemProperties();
TransactionExecutorFactory executor = buildBasicExecutorFactory(world, config);
return new EthModuleGasEstimation(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());
}
use of co.rsk.rpc.ExecutionBlockRetriever 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());
}
Aggregations