Skip to content

Commit

Permalink
Added empty messages and events entry to output from messages sent to…
Browse files Browse the repository at this point in the history
… libraries
  • Loading branch information
jjcnn committed Sep 26, 2022
1 parent 05750cc commit 793931a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/eval/Runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ let output_message_json gas_remaining mlist =

let output_event_json elist =
let open JSON.JSONLiteral in
List.map elist ~f:(function
| Msg m -> JSON.Event.event_to_json m
| _ -> `Null)
`List
(List.map elist ~f:(function
| Msg m -> JSON.Event.event_to_json m
| _ -> `Null))

let assert_no_address_type_in_type t gas_remaining =
let open RunnerType in
Expand Down Expand Up @@ -409,8 +410,12 @@ let run_with_args args =
if is_library then
if is_deployment then deploy_library args gas_remaining
else
(* Messages to libraries are ignored, but tolerated *)
`Assoc [ ("gas_remaining", `String (Uint64.to_string gas_remaining)) ]
(* Messages to libraries are ignored, but tolerated. *)
`Assoc [
("gas_remaining", `String (Uint64.to_string gas_remaining));
("messages", output_message_json gas_remaining []);
("events", output_event_json []);
]
else
match FEParser.parse_cmodule args.input with
| Error e ->
Expand Down Expand Up @@ -700,7 +705,7 @@ let run_with_args args =

let osj = output_state_json cstate'.balance field_vals in
let omj = output_message_json gas mlist in
let oej = `List (output_event_json elist) in
let oej = output_event_json elist in
let gas' = Gas.finalize_remaining_gas args.gas_limit gas in

((omj, osj, oej, accepted_b), gas')
Expand Down
2 changes: 1 addition & 1 deletion tests/runner/TestLib2/output_1.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "gas_remaining": "62896" }
{ "gas_remaining": "62896", "messages": [], "events": [] }

0 comments on commit 793931a

Please sign in to comment.