Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix t8n tool #1354

Merged
merged 6 commits into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix t8n compiler switch when evmc_enabled
  • Loading branch information
jangko committed Dec 8, 2022
commit 4287a31961d844a5d989a3ead94b47d32cdeb4af
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ ENABLE_EVMC := 0
# "-d:release" cannot be added to config.nims
NIM_PARAMS += -d:release

T8N_PARAMS := -d:chronicles_default_output_device=stderr

ifeq ($(USE_LIBBACKTRACE), 0)
NIM_PARAMS += -d:disable_libbacktrace
endif
Expand All @@ -129,6 +131,7 @@ endif

ifneq ($(ENABLE_EVMC), 0)
NIM_PARAMS += -d:evmc_enabled
T8N_PARAMS := -d:chronicles_enabled=off
endif

# disabled by default, enable with ENABLE_VMLOWMEM=1
Expand Down Expand Up @@ -243,7 +246,7 @@ nimbus-verified-proxy-test: | build deps

# builds transition tool
t8n: | build deps
$(ENV_SCRIPT) nim c $(NIM_PARAMS) -d:chronicles_default_output_device=stderr "tools/t8n/[email protected]"
$(ENV_SCRIPT) nim c $(NIM_PARAMS) $(T8N_PARAMS) "tools/t8n/[email protected]"

# builds and runs transition tool test suite
t8n_test: | build deps t8n
Expand Down
19 changes: 13 additions & 6 deletions tools/t8n/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,24 @@ type
defaultValue: 3
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":
none(UInt256)
elif startsWith(p.string, "0x"):
some(parse(p.string, UInt256, 16))
else:
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 @[]

proc parseCmdArg*(T: type HexOrInt, p: TaintedString): T =
proc parseCmdArg(T: type HexOrInt, p: TaintedString): T =
if startsWith(p.string, "0x"):
parseHexInt(p.string).T
else:
parseInt(p.string).T

proc completeCmdArg*(T: type HexOrInt, val: TaintedString): seq[string] =
proc completeCmdArg(T: type HexOrInt, val: TaintedString): seq[string] =
return @[]

proc notCmd(x: string): bool =
Expand Down Expand Up @@ -156,13 +156,20 @@ proc convertToNimStyle(cmds: openArray[string]): seq[string] =

const
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.}
result = T8NConf.load(
cmdLine.convertToNimStyle,
version = Version,
copyrightBanner = Version & "\n" & Copyright
)
{.pop.}

proc init*(_: type T8NConf, cmdLine = commandLineParams()): T8NConf =
initT8NConf(cmdLine)
8 changes: 6 additions & 2 deletions tools/t8n/config.nims
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
switch("define", "chronicles_default_output_device=stderr")
switch("define", "chronicles_runtime_filtering=on")
if defined(evmc_enabled):
# 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")