fix t8n compiler switch when evmc_enabled

This commit is contained in:
jangko 2022-12-08 13:18:43 +07:00
parent a57471197f
commit 4287a31961
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
3 changed files with 23 additions and 9 deletions

View File

@ -114,6 +114,8 @@ ENABLE_EVMC := 0
# "-d:release" cannot be added to config.nims # "-d:release" cannot be added to config.nims
NIM_PARAMS += -d:release NIM_PARAMS += -d:release
T8N_PARAMS := -d:chronicles_default_output_device=stderr
ifeq ($(USE_LIBBACKTRACE), 0) ifeq ($(USE_LIBBACKTRACE), 0)
NIM_PARAMS += -d:disable_libbacktrace NIM_PARAMS += -d:disable_libbacktrace
endif endif
@ -129,6 +131,7 @@ endif
ifneq ($(ENABLE_EVMC), 0) ifneq ($(ENABLE_EVMC), 0)
NIM_PARAMS += -d:evmc_enabled NIM_PARAMS += -d:evmc_enabled
T8N_PARAMS := -d:chronicles_enabled=off
endif endif
# disabled by default, enable with ENABLE_VMLOWMEM=1 # disabled by default, enable with ENABLE_VMLOWMEM=1
@ -243,7 +246,7 @@ nimbus-verified-proxy-test: | build deps
# builds transition tool # builds transition tool
t8n: | build deps t8n: | build deps
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:chronicles_default_output_device=stderr "tools/t8n/$@.nim" $(ENV_SCRIPT) nim c $(NIM_PARAMS) $(T8N_PARAMS) "tools/t8n/$@.nim"
# builds and runs transition tool test suite # builds and runs transition tool test suite
t8n_test: | build deps t8n t8n_test: | build deps t8n

View File

@ -106,7 +106,7 @@ type
defaultValue: 3 defaultValue: 3
name: "verbosity" }: int name: "verbosity" }: int
proc parseCmdArg*(T: type Option[UInt256], p: TaintedString): T = proc parseCmdArg(T: type Option[UInt256], p: TaintedString): T =
if p.string == "-1": if p.string == "-1":
none(UInt256) none(UInt256)
elif startsWith(p.string, "0x"): elif startsWith(p.string, "0x"):
@ -114,16 +114,16 @@ proc parseCmdArg*(T: type Option[UInt256], p: TaintedString): T =
else: else:
some(parse(p.string, UInt256, 10)) some(parse(p.string, UInt256, 10))
proc completeCmdArg*(T: type Option[UInt256], val: TaintedString): seq[string] = proc completeCmdArg(T: type Option[UInt256], val: TaintedString): seq[string] =
return @[] return @[]
proc parseCmdArg*(T: type HexOrInt, p: TaintedString): T = proc parseCmdArg(T: type HexOrInt, p: TaintedString): T =
if startsWith(p.string, "0x"): if startsWith(p.string, "0x"):
parseHexInt(p.string).T parseHexInt(p.string).T
else: else:
parseInt(p.string).T parseInt(p.string).T
proc completeCmdArg*(T: type HexOrInt, val: TaintedString): seq[string] = proc completeCmdArg(T: type HexOrInt, val: TaintedString): seq[string] =
return @[] return @[]
proc notCmd(x: string): bool = proc notCmd(x: string): bool =
@ -156,9 +156,13 @@ proc convertToNimStyle(cmds: openArray[string]): seq[string] =
const const
Copyright = "Copyright (c) 2022 Status Research & Development GmbH" Copyright = "Copyright (c) 2022 Status Research & Development GmbH"
Version = "Nimbus-t8n 0.1.0" Version = "Nimbus-t8n 0.1.2"
proc init*(_: type T8NConf, cmdLine = commandLineParams()): T8NConf = # force the compiler to instantiate T8NConf.load
# rather than have to export parseCmdArg
# because it will use wrong parseCmdArg from nimbus/config.nim
# when evmc_enabled
proc initT8NConf(cmdLine: openArray[string]): T8NConf =
{.push warning[ProveInit]: off.} {.push warning[ProveInit]: off.}
result = T8NConf.load( result = T8NConf.load(
cmdLine.convertToNimStyle, cmdLine.convertToNimStyle,
@ -166,3 +170,6 @@ proc init*(_: type T8NConf, cmdLine = commandLineParams()): T8NConf =
copyrightBanner = Version & "\n" & Copyright copyrightBanner = Version & "\n" & Copyright
) )
{.pop.} {.pop.}
proc init*(_: type T8NConf, cmdLine = commandLineParams()): T8NConf =
initT8NConf(cmdLine)

View File

@ -1,2 +1,6 @@
switch("define", "chronicles_default_output_device=stderr") if defined(evmc_enabled):
switch("define", "chronicles_runtime_filtering=on") # evmcLoadVMShowDetail log output will intefere with t8n ouput
switch("define", "chronicles_enabled=off")
else:
switch("define", "chronicles_default_output_device=stderr")
switch("define", "chronicles_runtime_filtering=on")