allow user to turn pruning on/off when run test

This commit is contained in:
andri lim 2020-02-19 21:50:03 +07:00 committed by zah
parent ed5710fa17
commit 32574fcebe
3 changed files with 5 additions and 4 deletions

View File

@ -635,8 +635,7 @@ proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus, debugMode = fal
continue
var tester = parseTester(fixture, testStatusIMPL)
# TODO: do we need another test with pruneTrie = false?
var chainDB = newBaseChainDB(newMemoryDb(), pruneTrie = false)
var chainDB = newBaseChainDB(newMemoryDb(), pruneTrie = getConfiguration().pruning)
echo "TESTING: ", fixtureName
if not tester.good: continue

View File

@ -18,6 +18,7 @@ type
index*: int
trace*: bool
legacy*: bool
pruning*: bool
var testConfig {.threadvar.}: Configuration
@ -26,6 +27,7 @@ proc initConfiguration(): Configuration =
result.fork = FkFrontier
result.index = 0
result.trace = true
result.pruning = true
proc getConfiguration*(): Configuration {.gcsafe.} =
if isNil(testConfig):
@ -48,6 +50,7 @@ proc processArguments*(msg: var string): ConfigStatus =
of "index": config.index = parseInt(value)
of "trace": config.trace = parseBool(value)
of "legacy": config.legacy = parseBool(value)
of "pruning": config.pruning = parseBool(value)
else:
msg = "Unknown option " & key
if value.len > 0: msg = msg & " : " & value

View File

@ -88,8 +88,7 @@ proc dumpDebugData(tester: Tester, vmState: BaseVMState, sender: EthAddress, gas
proc testFixtureIndexes(tester: Tester, testStatusIMPL: var TestStatus) =
var tracerFlags: set[TracerFlags] = if tester.trace: {TracerFlags.EnableTracing} else : {}
# TODO: do we need another test with pruneTrie = false?
var chainDB = newBaseChainDB(newMemoryDb(), pruneTrie = true)
var chainDB = newBaseChainDB(newMemoryDb(), pruneTrie = getConfiguration().pruning)
var vmState = newGST_VMState(emptyRlpHash, tester.header, chainDB, tracerFlags)
var gasUsed: GasInt
let sender = tester.tx.getSender()