use of org.ethereum.jsontestsuite.TestProgramInvokeFactory in project rskj by rsksmart.
the class StateTestRunner method runImpl.
public List<String> runImpl() {
logger.info("");
repository = RepositoryBuilder.build(stateTestCase.getPre());
logger.info("loaded repository");
transaction = TransactionBuilder.build(stateTestCase.getTransaction());
logger.info("transaction: {}", transaction.toString());
BlockStore blockStore = new IndexedBlockStore(new HashMap<>(), new HashMapDB(), null);
blockchain = new BlockChainImpl(config, repository, blockStore, null, null, null, null, null);
env = EnvBuilder.build(stateTestCase.getEnv());
invokeFactory = new TestProgramInvokeFactory(env);
block = BlockBuilder.build(env);
block.setStateRoot(repository.getRoot());
block.flushRLP();
blockchain.setBestBlock(block);
// blockchain.setProgramInvokeFactory(invokeFactory);
// blockchain.startTracking();
ProgramResult programResult = executeTransaction(transaction);
repository.flushNoReconnect();
List<LogInfo> origLogs = programResult.getLogInfoList();
List<LogInfo> postLogs = LogBuilder.build(stateTestCase.getLogs());
List<String> logsResult = LogsValidator.valid(origLogs, postLogs);
Repository postRepository = RepositoryBuilder.build(stateTestCase.getPost());
List<String> repoResults = RepositoryValidator.valid(repository, postRepository, false);
logger.info("--------- POST Validation---------");
List<String> outputResults = OutputValidator.valid(Hex.toHexString(programResult.getHReturn()), stateTestCase.getOut());
List<String> results = new ArrayList<>();
results.addAll(repoResults);
results.addAll(logsResult);
results.addAll(outputResults);
for (String result : results) {
logger.error(result);
}
logger.info("\n\n");
return results;
}
Aggregations