This commit is contained in:
andri lim 2018-12-11 08:16:21 +07:00 committed by zah
parent 8c6cec4999
commit d3380f6cf0
2 changed files with 8 additions and 6 deletions

View File

@ -130,7 +130,7 @@ method persistBlocks*(c: Chain, headers: openarray[BlockHeader], bodies: openarr
let receiptRoot = calcReceiptRoot(receipts)
if headers[i].receiptRoot != receiptRoot:
debug "wrong receipt in block", blockNumber = headers[i].blockNumber, receiptRoot, valid=headers[i].receiptRoot
debug "wrong receiptRoot in block", blockNumber = headers[i].blockNumber, actual=receiptRoot, expected=headers[i].receiptRoot
assert(headers[i].receiptRoot == receiptRoot)
discard c.db.persistHeaderToDb(headers[i])

View File

@ -16,6 +16,9 @@ import
../nimbus/vm/interpreter,
../nimbus/db/[db_chain, state_db]
proc hashLogEntries(logs: seq[Log]): string =
toLowerAscii("0x" & $keccak256.digest(rlp.encode(logs)))
proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus)
suite "vm json tests":
@ -69,12 +72,11 @@ proc testFixture(fixtures: JsonNode, testStatusIMPL: var TestStatus) =
if computation.isError:
echo "Computation error: ", computation.error.info
let logEntries = computation.getLogEntries()
let logEntries = vmState.getAndClearLogEntries()
if not fixture{"logs"}.isNil:
discard
# TODO hashLogEntries let actualLogsHash = hashLogEntries(logEntries)
# let expectedLogsHash = fixture{"logs"}.getStr
# check(expectedLogsHash == actualLogsHash)
let actualLogsHash = hashLogEntries(logEntries)
let expectedLogsHash = toLowerAscii(fixture{"logs"}.getStr)
check(expectedLogsHash == actualLogsHash)
elif logEntries.len > 0:
checkpoint(&"Got log entries: {logEntries}")
fail()