diff --git a/premix/parser.nim b/premix/parser.nim index aad83678a..4c489de14 100644 --- a/premix/parser.nim +++ b/premix/parser.nim @@ -53,11 +53,6 @@ proc fromJson*(n: JsonNode, name: string, x: var Blob) = proc fromJson*(n: JsonNode, name: string, x: var UInt256) = x = UInt256.fromHex(n[name].getStr()) - if x.prefixHex != toLowerAscii(n[name].getStr()): - debugEcho "name: ", name - debugEcho "A: ", x.prefixHex - debugEcho "B: ", toLowerAscii(n[name].getStr()) - quit(1) doAssert(x.prefixHex == toLowerAscii(n[name].getStr()), name) proc fromJson*(n: JsonNode, name: string, x: var SomeInteger) = diff --git a/tests/test_blockchain_json.nim b/tests/test_blockchain_json.nim index ea48f9199..6e01709cd 100644 --- a/tests/test_blockchain_json.nim +++ b/tests/test_blockchain_json.nim @@ -72,11 +72,14 @@ func normalizeNumber(n: JsonNode): JsonNode = let str = n.getStr # paranoid checks doAssert n.kind == Jstring - doAssert str.len > 3 doAssert str[0] == '0' and str[1] == 'x' # real normalization # strip leading 0 - if str == "0x00": + if str == "0x": + result = newJString("0x0") + elif str == "0x0": + result = n + elif str == "0x00": result = newJString("0x0") elif str[2] == '0': var i = 2 @@ -197,6 +200,7 @@ func vmConfiguration(network: string): VMConfig = of "HomesteadToEIP150At5": result = [(0, FkHomestead), (5, FkTangerine)] of "FrontierToHomesteadAt5": result = [(0, FkFrontier), (5, FkHomestead)] of "ByzantiumToConstantinopleFixAt5": result = [(0, FkByzantium), (5, FkConstantinople)] + of "Istanbul": result = [(0, FkIstanbul), (0, FkIstanbul)] else: raise newException(ValueError, "unsupported network") @@ -279,7 +283,7 @@ proc processBlock(vmState: BaseVMState, minedBlock: PlainBlock, fork: Fork) = vmState.receipts[txIndex] = makeReceipt(vmState, fork) if vmState.cumulativeGasUsed != minedBlock.header.gasUsed: - raise newException(ValidationError, "wrong gas used in header") + raise newException(ValidationError, &"wrong gas used in header expected={minedBlock.header.gasUsed}, actual={vmState.cumulativeGasUsed}") assignBlockRewards(minedBlock, vmState, fork, vmState.chainDB) @@ -663,6 +667,8 @@ proc main() = # run all test fixtures suite "block chain json tests": jsonTest("BlockchainTests", testFixture) + suite "new block chain json tests": + jsonTest("NewBlockchainTests", testFixture) else: # execute single test in debug mode let config = getConfiguration() @@ -670,7 +676,7 @@ proc main() = echo "missing test subject" quit(QuitFailure) - let path = "tests" / "fixtures" / "BlockChainTests" + let path = "tests" / "fixtures" / "NewBlockChainTests" let n = json.parseFile(path / config.testSubject) var testStatusIMPL: TestStatus testFixture(n, testStatusIMPL, debugMode = true, config.trace) diff --git a/tests/test_generalstate_json.nim b/tests/test_generalstate_json.nim index aa001a924..01bab8c63 100644 --- a/tests/test_generalstate_json.nim +++ b/tests/test_generalstate_json.nim @@ -176,6 +176,8 @@ proc generalStateJsonMain*(debugMode = false) = # run all test fixtures suite "generalstate json tests": jsonTest("GeneralStateTests", testFixture) + suite "new generalstate json tests": + jsonTest("NewGeneralStateTests", testFixture) else: # execute single test in debug mode let config = getConfiguration() diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index a5eb09613..5ea12604d 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -26,10 +26,18 @@ const FkTangerine: "EIP150", FkSpurious: "EIP158", FkByzantium: "Byzantium", - FkConstantinople: "ConstantinopleFix" + FkConstantinople: "ConstantinopleFix", + FkIstanbul: "Istanbul" }.toTable - supportedForks* = {FkFrontier, FkHomestead, FkTangerine, FkSpurious, FkByzantium, FkConstantinople} + supportedForks* = { + FkFrontier, + FkHomestead, + FkTangerine, + FkSpurious, + FkByzantium, + FkConstantinople, + FkIstanbul} nameToFork* = revmap(forkNames)