Search in sources :

Example 6 with SimpleEthereum

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);
}
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 7 with SimpleEthereum

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();
    }
}
Also used : BlockProcessor(co.rsk.net.BlockProcessor) BigInteger(java.math.BigInteger) SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) Test(org.junit.Test)

Example 8 with SimpleEthereum

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));
}
Also used : SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) World(co.rsk.test.World) Test(org.junit.Test)

Example 9 with SimpleEthereum

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));
}
Also used : SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) World(co.rsk.test.World) Test(org.junit.Test)

Example 10 with SimpleEthereum

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());
}
Also used : SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) Test(org.junit.Test)

Aggregations

SimpleEthereum (org.ethereum.rpc.Simples.SimpleEthereum)10 Test (org.junit.Test)7 World (co.rsk.test.World)5 DifficultyCalculator (co.rsk.core.DifficultyCalculator)2 ProofOfWorkRule (co.rsk.validators.ProofOfWorkRule)2 BigInteger (java.math.BigInteger)2 MiningConfig (co.rsk.config.MiningConfig)1 TestSystemProperties (co.rsk.config.TestSystemProperties)1 Wallet (co.rsk.core.Wallet)1 MiningMainchainView (co.rsk.core.bc.MiningMainchainView)1 MiningMainchainViewImpl (co.rsk.core.bc.MiningMainchainViewImpl)1 BlockProcessor (co.rsk.net.BlockProcessor)1 BridgeSupportFactory (co.rsk.peg.BridgeSupportFactory)1 ExecutionBlockRetriever (co.rsk.rpc.ExecutionBlockRetriever)1 Web3RskImpl (co.rsk.rpc.Web3RskImpl)1 DebugModule (co.rsk.rpc.modules.debug.DebugModule)1 DebugModuleImpl (co.rsk.rpc.modules.debug.DebugModuleImpl)1 EthModule (co.rsk.rpc.modules.eth.EthModule)1 EthModuleWalletEnabled (co.rsk.rpc.modules.eth.EthModuleWalletEnabled)1 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)1