Skip to content

Commit b63bbc8

Browse files
committed
cairo-run: make tracer host:port configurable
We make the --tracer flag take an optional argument, letting us configure the host:port to serve on at startup. We default to localhost:8100 if the optional argument is not set, and as previously don't start the tracer in case the --tracer flag is not set at all.
1 parent 29a1d3e commit b63bbc8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/starkware/cairo/lang/vm/cairo_run.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ def main():
148148
default="plain",
149149
help="The layout of the Cairo AIR.",
150150
)
151-
parser.add_argument("--tracer", action="store_true", help="Run the tracer.")
151+
parser.add_argument(
152+
"--tracer",
153+
nargs='?',
154+
const="localhost:8100",
155+
help="Run the tracer at the given host and port (default: localhost:8081).")
152156
parser.add_argument(
153157
"--profile_output",
154158
type=str,
@@ -432,7 +436,12 @@ def cairo_run(args):
432436
debug_info_file=debug_info_file, debug_info=runner.get_relocated_debug_info()
433437
)
434438

435-
if args.tracer:
439+
if args.tracer is not None:
440+
# Tracer set, split host and port.
441+
splits = args.tracer.split(':')
442+
host = splits[0]
443+
port = int(splits[1])
444+
436445
CAIRO_TRACER = "starkware.cairo.lang.tracer.tracer"
437446
subprocess.call(
438447
list(
@@ -444,6 +453,8 @@ def cairo_run(args):
444453
CAIRO_TRACER,
445454
f"--program={args.program.name}",
446455
f"--trace={trace_file.name}",
456+
f"--host={host}",
457+
f"--port={port}",
447458
f"--memory={memory_file.name}",
448459
f"--air_public_input={args.air_public_input.name}"
449460
if args.air_public_input

0 commit comments

Comments
 (0)