use of org.ethereum.rpc.Simples.SimpleEthereum 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);
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class TxBuilderTest method createAndBroadcastTransaction.
@Test
public void createAndBroadcastTransaction() {
SimpleEthereum rsk = new SimpleEthereum();
BlockProcessor blockProcessor = Mockito.mock(BlockProcessor.class);
TxBuilder builder = new TxBuilder(config, rsk, blockProcessor, (Repository) rsk.repository);
BigInteger nonce = BigInteger.TEN;
try {
builder.createNewTx(nonce);
} catch (InterruptedException ex) {
Assert.fail();
}
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class Web3ImplSnapshotTest method increaseTimeUsingHexadecimalValue.
@Test
public void increaseTimeUsingHexadecimalValue() {
World world = new World();
SimpleEthereum ethereum = new SimpleEthereum();
MinerServer minerServer = getMinerServerForTest(world, ethereum);
Web3Impl web3 = createWeb3(world, ethereum, minerServer);
String result = web3.evm_increaseTime("0x10");
Assert.assertEquals("0x10", result);
Assert.assertEquals(16, minerServer.increaseTime(0));
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class Web3ImplSnapshotTest method increaseTimeUsingDecimalValue.
@Test
public void increaseTimeUsingDecimalValue() {
World world = new World();
SimpleEthereum ethereum = new SimpleEthereum();
MinerServer minerServer = getMinerServerForTest(world, ethereum);
Web3Impl web3 = createWeb3(world, ethereum, minerServer);
String result = web3.evm_increaseTime("16");
Assert.assertEquals("0x10", result);
Assert.assertEquals(16, minerServer.increaseTime(0));
}
use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.
the class Web3ImplSnapshotTest method mine.
@Test
public void mine() {
SimpleEthereum ethereum = new SimpleEthereum();
Web3Impl web3 = createWeb3(ethereum);
Assert.assertEquals(0, blockchain.getBestBlock().getNumber());
web3.evm_mine();
Assert.assertEquals(1, blockchain.getBestBlock().getNumber());
}
Aggregations