Search in sources :

Example 56 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class Web3ImplScoringTest method createWeb3.

private static Web3Impl createWeb3(PeerScoringManager peerScoringManager) {
    SimpleRsk rsk = new SimpleRsk();
    World world = new World();
    rsk.blockchain = world.getBlockChain();
    Wallet wallet = WalletFactory.createWallet();
    RskSystemProperties config = new RskSystemProperties();
    PersonalModule pm = new PersonalModuleWalletEnabled(config, rsk, wallet, null);
    EthModule em = new EthModule(config, world.getBlockChain(), null, new ExecutionBlockRetriever(world.getBlockChain(), null, null), new EthModuleSolidityDisabled(), new EthModuleWalletEnabled(config, rsk, wallet, null));
    TxPoolModule tpm = new TxPoolModuleImpl(Web3Mocks.getMockTransactionPool());
    return new Web3RskImpl(rsk, world.getBlockChain(), null, config, Web3Mocks.getMockMinerClient(), Web3Mocks.getMockMinerServer(), pm, em, tpm, Web3Mocks.getMockChannelManager(), rsk.getRepository(), peerScoringManager, null, null, null, null, null, null, null);
}
Also used : EthModuleSolidityDisabled(co.rsk.rpc.modules.eth.EthModuleSolidityDisabled) Wallet(co.rsk.core.Wallet) Web3RskImpl(co.rsk.rpc.Web3RskImpl) SimpleRsk(org.ethereum.rpc.Simples.SimpleRsk) TxPoolModuleImpl(co.rsk.rpc.modules.txpool.TxPoolModuleImpl) World(co.rsk.test.World) PersonalModuleWalletEnabled(co.rsk.rpc.modules.personal.PersonalModuleWalletEnabled) EthModuleWalletEnabled(co.rsk.rpc.modules.eth.EthModuleWalletEnabled) PersonalModule(co.rsk.rpc.modules.personal.PersonalModule) EthModule(co.rsk.rpc.modules.eth.EthModule) ExecutionBlockRetriever(co.rsk.rpc.ExecutionBlockRetriever) TxPoolModule(co.rsk.rpc.modules.txpool.TxPoolModule) RskSystemProperties(co.rsk.config.RskSystemProperties)

Example 57 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class ContractRunner method executeTransaction.

private TransactionExecutor executeTransaction(Transaction transaction) {
    Repository track = repository.startTracking();
    TransactionExecutor executor = new TransactionExecutor(new RskSystemProperties(), transaction, 0, RskAddress.nullAddress(), repository, blockStore, receiptStore, new ProgramInvokeFactoryImpl(), blockchain.getBestBlock());
    executor.init();
    executor.execute();
    executor.go();
    executor.finalization();
    track.commit();
    return executor;
}
Also used : RskSystemProperties(co.rsk.config.RskSystemProperties) ProgramInvokeFactoryImpl(org.ethereum.vm.program.invoke.ProgramInvokeFactoryImpl)

Example 58 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class BlockBuilder method build.

public Block build() {
    Block block = blockGenerator.createChildBlock(parent, txs, uncles, difficulty, this.minGasPrice, gasLimit);
    if (blockChain != null) {
        BlockExecutor executor = new BlockExecutor(new RskSystemProperties(), blockChain.getRepository(), null, blockChain.getBlockStore(), blockChain.getListener());
        executor.executeAndFill(block, parent);
    }
    return block;
}
Also used : BlockExecutor(co.rsk.core.bc.BlockExecutor) Block(org.ethereum.core.Block) RskSystemProperties(co.rsk.config.RskSystemProperties)

Example 59 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class ProgramMemoryTest method createProgram.

@Before
public void createProgram() {
    RskSystemProperties config = new RskSystemProperties();
    program = new Program(config.getVmConfig(), new PrecompiledContracts(config), mock(BlockchainConfig.class), ByteUtil.EMPTY_BYTE_ARRAY, pi, null);
}
Also used : Program(org.ethereum.vm.program.Program) RskSystemProperties(co.rsk.config.RskSystemProperties) Before(org.junit.Before)

Example 60 with RskSystemProperties

use of co.rsk.config.RskSystemProperties in project rskj by rsksmart.

the class BridgeStateTest method recreateFromEmptyStorageProvider.

@Test
public void recreateFromEmptyStorageProvider() throws IOException {
    RskSystemProperties config = new RskSystemProperties();
    Repository repository = new RepositoryImpl(config, new TrieStoreImpl(new HashMapDB()));
    BridgeConstants bridgeConstants = config.getBlockchainConfig().getCommonConstants().getBridgeConstants();
    BridgeStorageProvider provider = new BridgeStorageProvider(repository, PrecompiledContracts.BRIDGE_ADDR, bridgeConstants);
    BridgeState state = new BridgeState(42, provider);
    BridgeState clone = BridgeState.create(bridgeConstants, state.getEncoded());
    Assert.assertNotNull(clone);
    Assert.assertEquals(42, clone.getBtcBlockchainBestChainHeight());
    Assert.assertTrue(clone.getBtcTxHashesAlreadyProcessed().isEmpty());
    Assert.assertTrue(clone.getActiveFederationBtcUTXOs().isEmpty());
    Assert.assertTrue(clone.getRskTxsWaitingForSignatures().isEmpty());
}
Also used : TrieStoreImpl(co.rsk.trie.TrieStoreImpl) Repository(org.ethereum.core.Repository) RepositoryImpl(co.rsk.db.RepositoryImpl) HashMapDB(org.ethereum.datasource.HashMapDB) BridgeConstants(co.rsk.config.BridgeConstants) RskSystemProperties(co.rsk.config.RskSystemProperties) Test(org.junit.Test)

Aggregations

RskSystemProperties (co.rsk.config.RskSystemProperties)112 Test (org.junit.Test)81 SyncConfiguration (co.rsk.net.sync.SyncConfiguration)48 SimpleMessageChannel (co.rsk.net.simples.SimpleMessageChannel)45 Blockchain (org.ethereum.core.Blockchain)45 Block (org.ethereum.core.Block)41 BlockGenerator (co.rsk.blockchain.utils.BlockGenerator)35 ProofOfWorkRule (co.rsk.validators.ProofOfWorkRule)20 Ignore (org.junit.Ignore)10 Keccak256 (co.rsk.crypto.Keccak256)8 RegTestConfig (org.ethereum.config.blockchain.RegTestConfig)8 Repository (org.ethereum.core.Repository)8 SimpleChannelManager (org.ethereum.rpc.Simples.SimpleChannelManager)8 Channel (org.ethereum.net.server.Channel)7 ChannelManager (org.ethereum.net.server.ChannelManager)7 InvocationOnMock (org.mockito.invocation.InvocationOnMock)7 BlockDifficulty (co.rsk.core.BlockDifficulty)6 RskAddress (co.rsk.core.RskAddress)6 PersonalModule (co.rsk.rpc.modules.personal.PersonalModule)6 BeforeClass (org.junit.BeforeClass)6