Skip to content

Commit cb1b2ac

Browse files
dkijaniageorgeee
andauthored
Apply George suggestions from code review
Co-authored-by: George Agapov <[email protected]>
1 parent e38d28d commit cb1b2ac

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/lib/network_pool/transacation_pool_reorg_tests.ml

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Account_spec = struct
1717
; nonce: int
1818
} [@@deriving sexp]
1919

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

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

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

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

302-
let%bind () = advance_chain test (prefix @ major) in
302+
let%bind () = commit_commands test (prefix @ major) in
303303

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

0 commit comments

Comments
 (0)