use of co.rsk.test.World in project rskj by rsksmart.
the class Web3ImplLogsTest method getLogsFromBlockchainWithCallContractAndFilterByKnownTopicInList.
@Test
public void getLogsFromBlockchainWithCallContractAndFilterByKnownTopicInList() throws Exception {
World world = new World();
Web3Impl web3 = getWeb3WithContractCall(world);
Block block1 = world.getBlockChain().getBlockByNumber(1l);
Web3.FilterRequest fr = new Web3.FilterRequest();
fr.fromBlock = "earliest";
fr.topics = new Object[1];
List<String> topics = new ArrayList<>();
topics.add(GET_VALUED_EVENT_SIGNATURE);
fr.topics[0] = topics;
Object[] logs = web3.eth_getLogs(fr);
Assert.assertNotNull(logs);
String address = "0x" + Hex.toHexString(block1.getTransactionsList().get(0).getContractAddress().getBytes());
Assert.assertEquals(1, logs.length);
Assert.assertEquals(address, ((LogFilterElement) logs[0]).address);
}
use of co.rsk.test.World in project rskj by rsksmart.
the class RepositoryDumpTest method dumpState.
@Test
public void dumpState() {
World world = new World();
world.getRepository().dumpState(world.getBlockChain().getBestBlock(), 0, 0, null);
}
use of co.rsk.test.World in project rskj by rsksmart.
the class TwoAsyncNodeTest method createNode.
private static SimpleAsyncNode createNode(int size) {
final World world = new World();
final BlockStore store = new BlockStore();
final Blockchain blockchain = world.getBlockChain();
List<Block> blocks = new BlockGenerator().getBlockChain(blockchain.getBestBlock(), size);
for (Block b : blocks) blockchain.tryToConnect(b);
BlockNodeInformation nodeInformation = new BlockNodeInformation();
SyncConfiguration syncConfiguration = SyncConfiguration.IMMEDIATE_FOR_TESTING;
BlockSyncService blockSyncService = new BlockSyncService(config, store, blockchain, nodeInformation, syncConfiguration);
NodeBlockProcessor processor = new NodeBlockProcessor(store, blockchain, nodeInformation, blockSyncService, syncConfiguration);
NodeMessageHandler handler = new NodeMessageHandler(config, processor, null, null, null, null, null, new DummyBlockValidationRule());
return new SimpleAsyncNode(handler);
}
use of co.rsk.test.World 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);
}
use of co.rsk.test.World in project rskj by rsksmart.
the class Web3ImplSnapshotTest method takeFirstSnapshot.
@Test
public void takeFirstSnapshot() {
World world = new World();
Web3Impl web3 = createWeb3(world);
String result = web3.evm_snapshot();
Assert.assertNotNull(result);
Assert.assertEquals("0x1", result);
}
Aggregations