Skip to content

Commit

Permalink
Apply George suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: George Agapov <[email protected]>
  • Loading branch information
dkijania and georgeee authored Jan 8, 2025
1 parent e38d28d commit cb1b2ac
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/lib/network_pool/transacation_pool_reorg_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Account_spec = struct
; nonce: int
} [@@deriving sexp]

let rec find_in_test_keys ?(n=0) (x:Keypair.t) =
let find_in_test_keys (x : Keypair.t) = Array.findi_exn test_keys ~f:(fun _ -> Keypair.equal x) |> fst
if Keypair.equal test_keys.(n) x then n
else find_in_test_keys x ~n:(n+1)

Expand Down Expand Up @@ -231,7 +231,7 @@ let gen_commands_from_specs (sequence:Command_spec.t array) test : (User_command
~location_of_account:
(Mina_ledger.Ledger.location_of_account best_tip_ledger) )
zkapp) |> User_command.Zkapp_command
| Payment {sender;fee;amount;receiver_idx}->
| Payment {sender={key_idx=sender_idx;nonce;_};fee;amount;receiver_idx}->
mk_payment ~sender_idx:sender.key_idx ~fee ~nonce:
sender.nonce ~receiver_idx
~amount ()
Expand Down Expand Up @@ -259,22 +259,22 @@ let%test_unit "Handle transition frontier diff (permission send tx updated)" =
let test = Thread_safe.block_on_async_exn (fun () -> setup_test ()) in
let init_ledger_state = ledger_snapshot test in
let%bind (prefix,major,minor,minor_account_spec,major_account_spec) = gen_branches init_ledger_state ~permission_change:true ~limited_capacity:true () in
return (test,init_ledger_state,prefix,major,minor,major_account_spec,minor_account_spec))
~f:(fun (test,_init_ledger_state,prefix_specs,major_specs,minor_specs,major_account_spec,minor_account_spec) ->
return (test,prefix,major,minor,major_account_spec,minor_account_spec))
~f:(fun (test,prefix_specs,major_specs,minor_specs,major_account_spec,minor_account_spec) ->
Thread_safe.block_on_async_exn (fun () ->
let log_prefix = Array.map prefix_specs ~f:(fun cmd ->
let sender = Command_spec.sender cmd in
let content = Printf.sprintf !"%{sexp: Public_key.t} %{sexp: Command_spec.t}" test_keys.(sender.key_idx).public_key cmd in
`String content
) |> Array.to_list in

let log_major = Array.map minor_specs ~f:(fun cmd ->
let log_major = Array.map major_specs ~f:(fun cmd ->
let sender = Command_spec.sender cmd in
let content = Printf.sprintf !"%{sexp: Public_key.t} %{sexp: Command_spec.t}" test_keys.(sender.key_idx).public_key cmd in
`String content
) |> Array.to_list in

let log_minor = Array.map major_specs ~f:(fun cmd ->
let log_minor = Array.map minor_specs ~f:(fun cmd ->
let sender = Command_spec.sender cmd in
let content = Printf.sprintf !"%{sexp: Public_key.t} %{sexp: Command_spec.t}" test_keys.(sender.key_idx).public_key cmd in
`String content
Expand All @@ -299,7 +299,7 @@ let%test_unit "Handle transition frontier diff (permission send tx updated)" =
let minor = gen_commands_from_specs (Array.concat [minor_specs]) test in
let major = gen_commands_from_specs (Array.concat [major_specs]) test in

let%bind () = advance_chain test (prefix @ major) in
let%bind () = commit_commands test (prefix @ major) in

Test.Resource_pool.handle_transition_frontier_diff_inner
~new_commands:(List.map ~f:mk_with_status (prefix @ major))
Expand Down

0 comments on commit cb1b2ac

Please sign in to comment.