本文整理汇总了Java中org.ethereum.config.net.MainNetConfig类的典型用法代码示例。如果您正苦于以下问题:Java MainNetConfig类的具体用法?Java MainNetConfig怎么用?Java MainNetConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MainNetConfig类属于org.ethereum.config.net包,在下文中一共展示了MainNetConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Before
public void setup() {
// if not set explicitly
// this test fails being run by Gradle
ConfigHelper.CONFIG.setGenesisInfo("frontier.json");
originalBlockchainConfig = ConfigHelper.CONFIG.getBlockchainConfig();
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
示例2: runHomestead
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
private void runHomestead(String name) throws IOException, ParseException {
String json = JSONReader.loadJSONFromCommit("BlockchainTests/Homestead/" + name + ".json", shacommit);
ConfigHelper.CONFIG.setBlockchainConfig(new GenesisConfig());
try {
GitHubJSONTestSuite.runGitHubJsonBlockTest(json, Collections.EMPTY_SET);
} finally {
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
}
示例3: run
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
public static List<String> run(StateTestCase stateTestCase2) {
try {
SystemProperties.getDefault().setBlockchainConfig(stateTestCase2.getConfig());
return new StateTestRunner(stateTestCase2).runImpl();
} finally {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
}
}
示例4: clean
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void clean() {
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
示例5: recover
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void recover() {
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
示例6: runDifficultyTest
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyTest() throws IOException, ParseException {
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
String json = JSONReader.loadJSONFromCommit("BasicTests/difficulty.json", shacommit);
DifficultyTestSuite testSuite = new DifficultyTestSuite(json);
for (DifficultyTestCase testCase : testSuite.getTestCases()) {
logger.info("Running {}\n", testCase.getName());
BlockHeader current = testCase.getCurrent();
BlockHeader parent = testCase.getParent();
assertEquals(testCase.getExpectedDifficulty(), DIFFICULTY_CALCULATOR.calcDifficulty(current, parent));
}
}
示例7: runDifficultyFrontierTest
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyFrontierTest() throws IOException, ParseException {
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
String json = JSONReader.loadJSONFromCommit("BasicTests/difficultyFrontier.json", shacommit);
DifficultyTestSuite testSuite = new DifficultyTestSuite(json);
for (DifficultyTestCase testCase : testSuite.getTestCases()) {
logger.info("Running {}\n", testCase.getName());
BlockHeader current = testCase.getCurrent();
BlockHeader parent = testCase.getParent();
assertEquals(testCase.getExpectedDifficulty(), DIFFICULTY_CALCULATOR.calcDifficulty(current, parent));
}
}
示例8: cleanup
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@AfterClass
public static void cleanup() {
ConfigHelper.CONFIG.setBlockchainConfig(MainNetConfig.INSTANCE);
}
示例9: recover
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void recover() {
SystemProperties.getDefault().setBlockchainConfig(new MainNetConfig());
}
示例10: run
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
private static void run(List<String> checkFiles,
String commitSHA,
GitHubJSONTestSuite.Network[] networks) throws IOException {
if (checkFiles.isEmpty()) return;
List<BlockTestSuite> suites = new ArrayList<>();
List<String> filenames = new ArrayList<>();
for (String file : checkFiles) {
filenames.add(TEST_ROOT + file);
}
List<String> jsons = loadJSONsFromCommit(filenames, commitSHA, 64);
for (String json : jsons) {
suites.add(new BlockTestSuite(json));
}
Map<String, BlockTestCase> testCases = new HashMap<>();
for (BlockTestSuite suite : suites) {
Map<String, BlockTestCase> suiteCases = suite.getTestCases(networks);
testCases.putAll(suiteCases);
}
Map<String, Boolean> summary = new HashMap<>();
for (String testName : testCases.keySet()) {
BlockTestCase blockTestCase = testCases.get(testName);
TestRunner runner = new TestRunner();
logger.info("\n\n ***************** Running test: {} ***************************** \n\n", testName);
try {
SystemProperties.getDefault().setBlockchainConfig(blockTestCase.getConfig());
List<String> result = runner.runTestCase(blockTestCase);
logger.info("--------- POST Validation---------");
if (!result.isEmpty())
for (String single : result)
logger.info(single);
if (!result.isEmpty())
summary.put(testName, false);
else
summary.put(testName, true);
} finally {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
}
}
logger.info("");
logger.info("");
logger.info("Summary: ");
logger.info("=========");
int fails = 0; int pass = 0;
for (String key : summary.keySet()){
if (summary.get(key)) ++pass; else ++fails;
String sumTest = String.format("%-60s:^%s", key, (summary.get(key) ? "OK" : "FAIL")).
replace(' ', '.').
replace("^", " ");
logger.info(sumTest);
}
logger.info(" - Total: Pass: {}, Failed: {} - ", pass, fails);
Assert.assertTrue(fails == 0);
}
示例11: clean
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@AfterClass
public static void clean() {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
SystemProperties.getDefault().setRecordInternalTransactionsData(true);
}
示例12: recover
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@After
public void recover() {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
}
示例13: runDifficultyTest
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyTest() throws IOException, ParseException {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
String json = JSONReader.loadJSONFromCommit("BasicTests/difficulty.json", shacommit);
DifficultyTestSuite testSuite = new DifficultyTestSuite(json);
for (DifficultyTestCase testCase : testSuite.getTestCases()) {
logger.info("Running {}\n", testCase.getName());
BlockHeader current = testCase.getCurrent();
BlockHeader parent = testCase.getParent();
assertEquals(testCase.getExpectedDifficulty(), current.calcDifficulty
(SystemProperties.getDefault().getBlockchainConfig(), parent));
}
}
示例14: runDifficultyFrontierTest
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@Test
public void runDifficultyFrontierTest() throws IOException, ParseException {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
String json = JSONReader.loadJSONFromCommit("BasicTests/difficultyFrontier.json", shacommit);
DifficultyTestSuite testSuite = new DifficultyTestSuite(json);
for (DifficultyTestCase testCase : testSuite.getTestCases()) {
logger.info("Running {}\n", testCase.getName());
BlockHeader current = testCase.getCurrent();
BlockHeader parent = testCase.getParent();
assertEquals(testCase.getExpectedDifficulty(), current.calcDifficulty(
SystemProperties.getDefault().getBlockchainConfig(), parent));
}
}
示例15: cleanup
import org.ethereum.config.net.MainNetConfig; //导入依赖的package包/类
@AfterClass
public static void cleanup() {
SystemProperties.getDefault().setBlockchainConfig(MainNetConfig.INSTANCE);
}