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

feat: Start trace printing at index 0; Make EXAMPLE_DIRS in Makefile rewritable; Use COMPARSE_HOME environment variable in .fst.config.json file #83

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .fst.config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ "fstar_exe":"fstar.exe",
"options":["--cache_dir", "cache", "--hint_dir", "hints", "--use_hints", "--record_hints"],
"include_dirs":[
"../comparse/src",
"${COMPARSE_HOME}/src",
"src/core",
"src/lib",
"src/lib/comparse",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COMPARSE_HOME ?= $(DY_HOME)/../comparse
INNER_SOURCE_DIRS = core lib lib/comparse lib/crypto lib/event lib/hpke lib/state lib/utils
SOURCE_DIRS = $(addprefix $(DY_HOME)/src/, $(INNER_SOURCE_DIRS))
INNER_EXAMPLE_DIRS = nsl_pk iso_dh
EXAMPLE_DIRS = $(addprefix $(DY_HOME)/examples/, $(INNER_EXAMPLE_DIRS))
EXAMPLE_DIRS ?= $(addprefix $(DY_HOME)/examples/, $(INNER_EXAMPLE_DIRS))

INCLUDE_DIRS = $(SOURCE_DIRS) $(EXAMPLE_DIRS) $(COMPARSE_HOME)/src
FSTAR_INCLUDE_DIRS = $(addprefix --include , $(INCLUDE_DIRS))
Expand Down
8 changes: 4 additions & 4 deletions src/lib/utils/DY.Lib.Printing.fst
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,23 @@ let trace_event_to_string printers tr_event i =
| MsgSent msg -> (
let msg_str = option_to_string printers.message_to_string msg in
Printf.sprintf "{\"TraceID\": %d, \"Type\": \"Message\", \"Content\": \"%s\"}\n"
i msg_str
(i-1) msg_str
)
| RandGen usg lab len -> (
Printf.sprintf "{\"TraceID\": %d, \"Type\": \"Nonce\", \"Usage\": %s}\n"
i (usage_to_string usg)
(i-1) (usage_to_string usg)
)
| Corrupt time -> ""
| SetState prin sess_id full_content -> (
let content_str = state_to_string printers.state_to_string full_content in
Printf.sprintf "{\"TraceID\": %d, \"Type\": \"Session\", \"SessionID\": %d, \"Principal\": \"%s\", \"Content\": \"%s\"}\n"
i sess_id.the_id prin content_str
(i-1) sess_id.the_id prin content_str
)
| Event prin tag content -> (
let printer = find_printer printers.event_to_string tag in
let content_str = option_to_string printer content in
Printf.sprintf "{\"TraceID\": %d, \"Type\": \"Event\", \"Principal\": \"%s\", \"Tag\": \"%s\", \"Content\": \"%s\"}\n"
i prin tag content_str
(i-1) prin tag content_str
)

/// Helper function for `trace_to_string` to avoid calling `length` for each trace event,
Expand Down