Search in sources :

Example 1 with SimpleEthereum

use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.

the class MinerManagerTest method getMinerServer.

private static MinerServerImpl getMinerServer(Blockchain blockchain) {
    SimpleEthereum ethereum = new SimpleEthereum();
    ethereum.repository = blockchain.getRepository();
    ethereum.blockchain = blockchain;
    DifficultyCalculator difficultyCalculator = new DifficultyCalculator(config);
    return new MinerServerImpl(config, ethereum, blockchain, null, difficultyCalculator, new ProofOfWorkRule(config).setFallbackMiningEnabled(false), new BlockToMineBuilder(ConfigUtils.getDefaultMiningConfig(), blockchain.getRepository(), blockchain.getBlockStore(), blockchain.getTransactionPool(), difficultyCalculator, new GasLimitCalculator(config), new BlockValidationRuleDummy(), config, null), ConfigUtils.getDefaultMiningConfig());
}
Also used : DifficultyCalculator(co.rsk.core.DifficultyCalculator) SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) ProofOfWorkRule(co.rsk.validators.ProofOfWorkRule)

Example 2 with SimpleEthereum

use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.

the class TxBuilderTest method createBasicTransaction.

@Test
public void createBasicTransaction() {
    SimpleEthereum rsk = new SimpleEthereum();
    TxBuilder builder = new TxBuilder(config, rsk, null, (Repository) rsk.repository);
    BigInteger gasPrice = BigInteger.ONE;
    BigInteger gasLimit = BigInteger.valueOf(21000);
    BigInteger nonce = BigInteger.TEN;
    Transaction tx = builder.createNewTransaction(gasPrice, gasLimit, nonce);
    Assert.assertEquals(gasLimit, new BigInteger(1, tx.getGasLimit()));
    Assert.assertEquals(gasPrice, tx.getGasPrice().asBigInteger());
    Assert.assertEquals(nonce, new BigInteger(1, tx.getNonce()));
}
Also used : Transaction(org.ethereum.core.Transaction) BigInteger(java.math.BigInteger) SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) Test(org.junit.Test)

Example 3 with SimpleEthereum

use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.

the class Web3ImplSnapshotTest method increaseTimeTwiceUsingDecimalValues.

@Test
public void increaseTimeTwiceUsingDecimalValues() {
    World world = new World();
    SimpleEthereum ethereum = new SimpleEthereum();
    MinerServer minerServer = getMinerServerForTest(world, ethereum);
    Web3Impl web3 = createWeb3(world, ethereum, minerServer);
    web3.evm_increaseTime("16");
    String result = web3.evm_increaseTime("16");
    Assert.assertEquals("0x20", result);
    Assert.assertEquals(32, minerServer.increaseTime(0));
}
Also used : SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) World(co.rsk.test.World) Test(org.junit.Test)

Example 4 with SimpleEthereum

use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.

the class Web3ImplSnapshotTest method increaseTimeTwice.

@Test
public void increaseTimeTwice() {
    World world = new World();
    SimpleEthereum ethereum = new SimpleEthereum();
    MinerServer minerServer = getMinerServerForTest(world, ethereum);
    Web3Impl web3 = createWeb3(world, ethereum, minerServer);
    web3.evm_increaseTime("0x10");
    String result = web3.evm_increaseTime("0x10");
    Assert.assertEquals("0x20", result);
    Assert.assertEquals(32, minerServer.increaseTime(0));
}
Also used : SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum) World(co.rsk.test.World) Test(org.junit.Test)

Example 5 with SimpleEthereum

use of org.ethereum.rpc.Simples.SimpleEthereum in project rskj by rsksmart.

the class MinerManagerTest method getMinerServer.

private MinerServerImpl getMinerServer() {
    SimpleEthereum ethereum = new SimpleEthereum();
    ethereum.blockchain = blockchain;
    DifficultyCalculator difficultyCalculator = new DifficultyCalculator(config.getActivationConfig(), config.getNetworkConstants());
    MinerClock clock = new MinerClock(true, Clock.systemUTC());
    MiningConfig miningConfig = ConfigUtils.getDefaultMiningConfig();
    return new MinerServerImpl(config, ethereum, miningMainchainView, null, new ProofOfWorkRule(config).setFallbackMiningEnabled(false), new BlockToMineBuilder(config.getActivationConfig(), miningConfig, repositoryLocator, blockStore, transactionPool, difficultyCalculator, new GasLimitCalculator(config.getNetworkConstants()), new ForkDetectionDataCalculator(), new BlockValidationRuleDummy(), clock, blockFactory, blockExecutor, new MinimumGasPriceCalculator(Coin.valueOf(miningConfig.getMinGasPriceTarget())), new MinerUtils()), clock, blockFactory, new BuildInfo("cb7f28e", "master"), miningConfig);
}
Also used : ProofOfWorkRule(co.rsk.validators.ProofOfWorkRule) DifficultyCalculator(co.rsk.core.DifficultyCalculator) MiningConfig(co.rsk.config.MiningConfig) BuildInfo(org.ethereum.util.BuildInfo) SimpleEthereum(org.ethereum.rpc.Simples.SimpleEthereum)

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